#[non_exhaustive]pub struct TaskTemplate {
pub containers: Vec<Container>,
pub volumes: Vec<Volume>,
pub timeout: Option<Duration>,
pub service_account: String,
pub execution_environment: ExecutionEnvironment,
pub encryption_key: String,
pub vpc_access: Option<VpcAccess>,
pub node_selector: Option<NodeSelector>,
pub gpu_zonal_redundancy_disabled: Option<bool>,
pub retries: Option<Retries>,
/* private fields */
}Expand description
TaskTemplate describes the data a task should have when created from a template.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.containers: Vec<Container>Holds the single container that defines the unit of execution for this task.
volumes: Vec<Volume>Optional. A list of Volumes to make available to containers.
timeout: Option<Duration>Optional. Max allowed time duration the Task may be active before the system will actively try to mark it failed and kill associated containers. This applies per attempt of a task, meaning each retry can run for the full timeout. Defaults to 600 seconds.
service_account: StringOptional. Email address of the IAM service account associated with the Task of a Job. The service account represents the identity of the running task, and determines what permissions the task has. If not provided, the task will use the project’s default service account.
execution_environment: ExecutionEnvironmentOptional. The execution environment being used to host this Task.
encryption_key: StringA reference to a customer managed encryption key (CMEK) to use to encrypt this container image. For more information, go to https://cloud.google.com/run/docs/securing/using-cmek
vpc_access: Option<VpcAccess>Optional. VPC Access configuration to use for this Task. For more information, visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
node_selector: Option<NodeSelector>Optional. The node selector for the task template.
gpu_zonal_redundancy_disabled: Option<bool>Optional. True if GPU zonal redundancy is disabled on this task template.
retries: Option<Retries>Implementations§
Source§impl TaskTemplate
impl TaskTemplate
pub fn new() -> Self
Sourcepub fn set_containers<T, V>(self, v: T) -> Self
pub fn set_containers<T, V>(self, v: T) -> Self
Sets the value of containers.
§Example
use google_cloud_run_v2::model::Container;
let x = TaskTemplate::new()
.set_containers([
Container::default()/* use setters */,
Container::default()/* use (different) setters */,
]);Sourcepub fn set_volumes<T, V>(self, v: T) -> Self
pub fn set_volumes<T, V>(self, v: T) -> Self
Sourcepub fn set_timeout<T>(self, v: T) -> Self
pub fn set_timeout<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_timeout<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_timeout<T>(self, v: Option<T>) -> Self
Sourcepub fn set_service_account<T: Into<String>>(self, v: T) -> Self
pub fn set_service_account<T: Into<String>>(self, v: T) -> Self
Sets the value of service_account.
§Example
let x = TaskTemplate::new().set_service_account("example");Sourcepub fn set_execution_environment<T: Into<ExecutionEnvironment>>(
self,
v: T,
) -> Self
pub fn set_execution_environment<T: Into<ExecutionEnvironment>>( self, v: T, ) -> Self
Sets the value of execution_environment.
§Example
use google_cloud_run_v2::model::ExecutionEnvironment;
let x0 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen1);
let x1 = TaskTemplate::new().set_execution_environment(ExecutionEnvironment::Gen2);Sourcepub fn set_encryption_key<T: Into<String>>(self, v: T) -> Self
pub fn set_encryption_key<T: Into<String>>(self, v: T) -> Self
Sets the value of encryption_key.
§Example
let x = TaskTemplate::new().set_encryption_key("example");Sourcepub fn set_vpc_access<T>(self, v: T) -> Self
pub fn set_vpc_access<T>(self, v: T) -> Self
Sets the value of vpc_access.
§Example
use google_cloud_run_v2::model::VpcAccess;
let x = TaskTemplate::new().set_vpc_access(VpcAccess::default()/* use setters */);Sourcepub fn set_or_clear_vpc_access<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_vpc_access<T>(self, v: Option<T>) -> Self
Sets or clears the value of vpc_access.
§Example
use google_cloud_run_v2::model::VpcAccess;
let x = TaskTemplate::new().set_or_clear_vpc_access(Some(VpcAccess::default()/* use setters */));
let x = TaskTemplate::new().set_or_clear_vpc_access(None::<VpcAccess>);Sourcepub fn set_node_selector<T>(self, v: T) -> Selfwhere
T: Into<NodeSelector>,
pub fn set_node_selector<T>(self, v: T) -> Selfwhere
T: Into<NodeSelector>,
Sets the value of node_selector.
§Example
use google_cloud_run_v2::model::NodeSelector;
let x = TaskTemplate::new().set_node_selector(NodeSelector::default()/* use setters */);Sourcepub fn set_or_clear_node_selector<T>(self, v: Option<T>) -> Selfwhere
T: Into<NodeSelector>,
pub fn set_or_clear_node_selector<T>(self, v: Option<T>) -> Selfwhere
T: Into<NodeSelector>,
Sets or clears the value of node_selector.
§Example
use google_cloud_run_v2::model::NodeSelector;
let x = TaskTemplate::new().set_or_clear_node_selector(Some(NodeSelector::default()/* use setters */));
let x = TaskTemplate::new().set_or_clear_node_selector(None::<NodeSelector>);Sourcepub fn set_gpu_zonal_redundancy_disabled<T>(self, v: T) -> Self
pub fn set_gpu_zonal_redundancy_disabled<T>(self, v: T) -> Self
Sets the value of gpu_zonal_redundancy_disabled.
§Example
let x = TaskTemplate::new().set_gpu_zonal_redundancy_disabled(true);Sourcepub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_gpu_zonal_redundancy_disabled<T>(self, v: Option<T>) -> Self
Sets or clears the value of gpu_zonal_redundancy_disabled.
§Example
let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(Some(false));
let x = TaskTemplate::new().set_or_clear_gpu_zonal_redundancy_disabled(None::<bool>);Sourcepub fn set_retries<T: Into<Option<Retries>>>(self, v: T) -> Self
pub fn set_retries<T: Into<Option<Retries>>>(self, v: T) -> Self
Sourcepub fn max_retries(&self) -> Option<&i32>
pub fn max_retries(&self) -> Option<&i32>
The value of retries
if it holds a MaxRetries, None if the field is not set or
holds a different branch.
Trait Implementations§
Source§impl Clone for TaskTemplate
impl Clone for TaskTemplate
Source§fn clone(&self) -> TaskTemplate
fn clone(&self) -> TaskTemplate
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more