#[non_exhaustive]pub struct Container {Show 15 fields
pub name: String,
pub image: String,
pub source_code: Option<SourceCode>,
pub command: Vec<String>,
pub args: Vec<String>,
pub env: Vec<EnvVar>,
pub resources: Option<ResourceRequirements>,
pub ports: Vec<ContainerPort>,
pub volume_mounts: Vec<VolumeMount>,
pub working_dir: String,
pub liveness_probe: Option<Probe>,
pub startup_probe: Option<Probe>,
pub depends_on: Vec<String>,
pub base_image_uri: String,
pub build_info: Option<BuildInfo>,
/* private fields */
}Expand description
A single application container. This specifies both the container to run, the command to run in the container and the arguments to supply to it. Note that additional arguments can be supplied by the system to the container at runtime.
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.name: StringName of the container specified as a DNS_LABEL (RFC 1123).
image: StringRequired. Name of the container image in Dockerhub, Google Artifact Registry, or Google Container Registry. If the host is not provided, Dockerhub is assumed.
source_code: Option<SourceCode>Optional. Location of the source.
command: Vec<String>Entrypoint array. Not executed within a shell. The docker image’s ENTRYPOINT is used if this is not provided.
args: Vec<String>Arguments to the entrypoint. The docker image’s CMD is used if this is not provided.
env: Vec<EnvVar>List of environment variables to set in the container.
resources: Option<ResourceRequirements>Compute Resource requirements by this container.
ports: Vec<ContainerPort>List of ports to expose from the container. Only a single port can be specified. The specified ports must be listening on all interfaces (0.0.0.0) within the container to be accessible.
If omitted, a port number will be chosen and passed to the container through the PORT environment variable for the container to listen on.
volume_mounts: Vec<VolumeMount>Volume to mount into the container’s filesystem.
working_dir: StringContainer’s working directory. If not specified, the container runtime’s default will be used, which might be configured in the container image.
liveness_probe: Option<Probe>Periodic probe of container liveness. Container will be restarted if the probe fails.
startup_probe: Option<Probe>Startup probe of application within the container. All other probes are disabled if a startup probe is provided, until it succeeds. Container will not be added to service endpoints if the probe fails.
depends_on: Vec<String>Names of the containers that must start before this container.
base_image_uri: StringBase image for this container. Only supported for services. If set, it indicates that the service is enrolled into automatic base image update.
build_info: Option<BuildInfo>Output only. The build info of the container image.
Implementations§
Source§impl Container
impl Container
pub fn new() -> Self
Sourcepub fn set_source_code<T>(self, v: T) -> Selfwhere
T: Into<SourceCode>,
pub fn set_source_code<T>(self, v: T) -> Selfwhere
T: Into<SourceCode>,
Sets the value of source_code.
§Example
use google_cloud_run_v2::model::SourceCode;
let x = Container::new().set_source_code(SourceCode::default()/* use setters */);Sourcepub fn set_or_clear_source_code<T>(self, v: Option<T>) -> Selfwhere
T: Into<SourceCode>,
pub fn set_or_clear_source_code<T>(self, v: Option<T>) -> Selfwhere
T: Into<SourceCode>,
Sets or clears the value of source_code.
§Example
use google_cloud_run_v2::model::SourceCode;
let x = Container::new().set_or_clear_source_code(Some(SourceCode::default()/* use setters */));
let x = Container::new().set_or_clear_source_code(None::<SourceCode>);Sourcepub fn set_command<T, V>(self, v: T) -> Self
pub fn set_command<T, V>(self, v: T) -> Self
Sourcepub fn set_resources<T>(self, v: T) -> Selfwhere
T: Into<ResourceRequirements>,
pub fn set_resources<T>(self, v: T) -> Selfwhere
T: Into<ResourceRequirements>,
Sourcepub fn set_or_clear_resources<T>(self, v: Option<T>) -> Selfwhere
T: Into<ResourceRequirements>,
pub fn set_or_clear_resources<T>(self, v: Option<T>) -> Selfwhere
T: Into<ResourceRequirements>,
Sourcepub fn set_volume_mounts<T, V>(self, v: T) -> Self
pub fn set_volume_mounts<T, V>(self, v: T) -> Self
Sets the value of volume_mounts.
§Example
use google_cloud_run_v2::model::VolumeMount;
let x = Container::new()
.set_volume_mounts([
VolumeMount::default()/* use setters */,
VolumeMount::default()/* use (different) setters */,
]);Sourcepub fn set_working_dir<T: Into<String>>(self, v: T) -> Self
pub fn set_working_dir<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_liveness_probe<T>(self, v: T) -> Self
pub fn set_liveness_probe<T>(self, v: T) -> Self
Sets the value of liveness_probe.
§Example
use google_cloud_run_v2::model::Probe;
let x = Container::new().set_liveness_probe(Probe::default()/* use setters */);Sourcepub fn set_or_clear_liveness_probe<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_liveness_probe<T>(self, v: Option<T>) -> Self
Sets or clears the value of liveness_probe.
§Example
use google_cloud_run_v2::model::Probe;
let x = Container::new().set_or_clear_liveness_probe(Some(Probe::default()/* use setters */));
let x = Container::new().set_or_clear_liveness_probe(None::<Probe>);Sourcepub fn set_startup_probe<T>(self, v: T) -> Self
pub fn set_startup_probe<T>(self, v: T) -> Self
Sets the value of startup_probe.
§Example
use google_cloud_run_v2::model::Probe;
let x = Container::new().set_startup_probe(Probe::default()/* use setters */);Sourcepub fn set_or_clear_startup_probe<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_startup_probe<T>(self, v: Option<T>) -> Self
Sets or clears the value of startup_probe.
§Example
use google_cloud_run_v2::model::Probe;
let x = Container::new().set_or_clear_startup_probe(Some(Probe::default()/* use setters */));
let x = Container::new().set_or_clear_startup_probe(None::<Probe>);Sourcepub fn set_depends_on<T, V>(self, v: T) -> Self
pub fn set_depends_on<T, V>(self, v: T) -> Self
Sourcepub fn set_base_image_uri<T: Into<String>>(self, v: T) -> Self
pub fn set_base_image_uri<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_build_info<T>(self, v: T) -> Self
pub fn set_build_info<T>(self, v: T) -> Self
Sets the value of build_info.
§Example
use google_cloud_run_v2::model::BuildInfo;
let x = Container::new().set_build_info(BuildInfo::default()/* use setters */);Sourcepub fn set_or_clear_build_info<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_build_info<T>(self, v: Option<T>) -> Self
Sets or clears the value of build_info.
§Example
use google_cloud_run_v2::model::BuildInfo;
let x = Container::new().set_or_clear_build_info(Some(BuildInfo::default()/* use setters */));
let x = Container::new().set_or_clear_build_info(None::<BuildInfo>);