Skip to main content

JobRequestItemBuilder

Struct JobRequestItemBuilder 

Source
pub struct JobRequestItemBuilder<S> { /* private fields */ }
Expand description

Typestate builder for JobSubmitRequestItem.

Start with JobRequestItemBuilder::new, set fields, then call .pod_spec(spec) or .pod_specs(specs) to transition to the HasPodSpec state, which unlocks .build(). Attempting to call .build() before providing a pod spec is a compile-time error.

§Example

let item = JobRequestItemBuilder::new()
    .namespace("default")
    .priority(1.0)
    .label("app", "my-app")
    .pod_spec(pod_spec)
    .build();

Implementations§

Source§

impl JobRequestItemBuilder<NoPodSpec>

Source

pub fn new() -> Self

Create a new builder with all fields set to their zero/empty defaults.

Call setters to configure the job, then supply a pod spec with .pod_spec() or .pod_specs() to unlock .build().

Source§

impl<S> JobRequestItemBuilder<S>

Source

pub fn priority(self, p: f64) -> Self

Job priority relative to others in the queue. Higher values are scheduled first. Must be non-negative; the server will reject negative values. Defaults to 0.0.

Source

pub fn namespace(self, ns: impl Into<String>) -> Self

Set the Kubernetes namespace in which the job’s pod will run.

Typically "default" unless your cluster uses a dedicated namespace for batch workloads.

Source

pub fn client_id(self, id: impl Into<String>) -> Self

Set an opaque client-supplied identifier for idempotency tracking.

If the same client_id is submitted twice, Armada will deduplicate the request and return the existing job rather than creating a new one. Leave empty (the default) to disable deduplication.

Source

pub fn labels(self, l: HashMap<String, String>) -> Self

Replace the entire labels map.

Source

pub fn label(self, k: impl Into<String>, v: impl Into<String>) -> Self

Insert a single label. Can be chained multiple times.

Source

pub fn annotations(self, a: HashMap<String, String>) -> Self

Replace the entire annotations map.

Source

pub fn annotation(self, k: impl Into<String>, v: impl Into<String>) -> Self

Insert a single annotation. Can be chained multiple times.

Source

pub fn scheduler(self, s: impl Into<String>) -> Self

Override the scheduler for this job. Leave empty to use the cluster default.

Source

pub fn ingress(self, i: Vec<IngressConfig>) -> Self

Replace the entire ingress config list.

Source

pub fn add_ingress(self, i: IngressConfig) -> Self

Append a single ingress config. Can be chained multiple times.

Source

pub fn services(self, s: Vec<ServiceConfig>) -> Self

Replace the entire service config list.

Source

pub fn add_service(self, s: ServiceConfig) -> Self

Append a single service config. Can be chained multiple times.

Source

pub fn pod_spec(self, spec: PodSpec) -> JobRequestItemBuilder<HasPodSpec>

Set a single pod spec and transition the builder to [HasPodSpec] state, which unlocks .build().

Shorthand for .pod_specs(vec![spec]). If called again on a JobRequestItemBuilder<HasPodSpec>, the previous spec is replaced.

Source

pub fn pod_specs(self, specs: Vec<PodSpec>) -> JobRequestItemBuilder<HasPodSpec>

Set multiple pod specs and transition the builder to [HasPodSpec] state, which unlocks .build().

If called again on a JobRequestItemBuilder<HasPodSpec>, the previous specs are replaced entirely.

Source§

impl JobRequestItemBuilder<HasPodSpec>

Source

pub fn build(self) -> JobSubmitRequestItem

Consume the builder and return a JobSubmitRequestItem ready to be included in a crate::JobSubmitRequest.

This method is only available after calling .pod_spec() or .pod_specs(). Calling .build() on a JobRequestItemBuilder<NoPodSpec> is a compile-time error.

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> 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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
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