Container

Struct Container 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String

Name of the container specified as a DNS_LABEL (RFC 1123).

§image: String

Required. 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: String

Container’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: String

Base 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

Source

pub fn new() -> Self

Source

pub fn set_name<T: Into<String>>(self, v: T) -> Self

Sets the value of name.

§Example
let x = Container::new().set_name("example");
Source

pub fn set_image<T: Into<String>>(self, v: T) -> Self

Sets the value of image.

§Example
let x = Container::new().set_image("example");
Source

pub fn set_source_code<T>(self, v: T) -> Self
where 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 */);
Source

pub fn set_or_clear_source_code<T>(self, v: Option<T>) -> Self
where 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>);
Source

pub fn set_command<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of command.

§Example
let x = Container::new().set_command(["a", "b", "c"]);
Source

pub fn set_args<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of args.

§Example
let x = Container::new().set_args(["a", "b", "c"]);
Source

pub fn set_env<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<EnvVar>,

Sets the value of env.

§Example
use google_cloud_run_v2::model::EnvVar;
let x = Container::new()
    .set_env([
        EnvVar::default()/* use setters */,
        EnvVar::default()/* use (different) setters */,
    ]);
Source

pub fn set_resources<T>(self, v: T) -> Self

Sets the value of resources.

§Example
use google_cloud_run_v2::model::ResourceRequirements;
let x = Container::new().set_resources(ResourceRequirements::default()/* use setters */);
Source

pub fn set_or_clear_resources<T>(self, v: Option<T>) -> Self

Sets or clears the value of resources.

§Example
use google_cloud_run_v2::model::ResourceRequirements;
let x = Container::new().set_or_clear_resources(Some(ResourceRequirements::default()/* use setters */));
let x = Container::new().set_or_clear_resources(None::<ResourceRequirements>);
Source

pub fn set_ports<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<ContainerPort>,

Sets the value of ports.

§Example
use google_cloud_run_v2::model::ContainerPort;
let x = Container::new()
    .set_ports([
        ContainerPort::default()/* use setters */,
        ContainerPort::default()/* use (different) setters */,
    ]);
Source

pub fn set_volume_mounts<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<VolumeMount>,

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 */,
    ]);
Source

pub fn set_working_dir<T: Into<String>>(self, v: T) -> Self

Sets the value of working_dir.

§Example
let x = Container::new().set_working_dir("example");
Source

pub fn set_liveness_probe<T>(self, v: T) -> Self
where T: Into<Probe>,

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 */);
Source

pub fn set_or_clear_liveness_probe<T>(self, v: Option<T>) -> Self
where T: Into<Probe>,

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>);
Source

pub fn set_startup_probe<T>(self, v: T) -> Self
where T: Into<Probe>,

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 */);
Source

pub fn set_or_clear_startup_probe<T>(self, v: Option<T>) -> Self
where T: Into<Probe>,

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>);
Source

pub fn set_depends_on<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of depends_on.

§Example
let x = Container::new().set_depends_on(["a", "b", "c"]);
Source

pub fn set_base_image_uri<T: Into<String>>(self, v: T) -> Self

Sets the value of base_image_uri.

§Example
let x = Container::new().set_base_image_uri("example");
Source

pub fn set_build_info<T>(self, v: T) -> Self
where T: Into<BuildInfo>,

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 */);
Source

pub fn set_or_clear_build_info<T>(self, v: Option<T>) -> Self
where T: Into<BuildInfo>,

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>);

Trait Implementations§

Source§

impl Clone for Container

Source§

fn clone(&self) -> Container

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Container

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Container

Source§

fn default() -> Container

Returns the “default value” for a type. Read more
Source§

impl Message for Container

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Container

Source§

fn eq(&self, other: &Container) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Container

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,