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>
impl JobRequestItemBuilder<NoPodSpec>
Sourcepub fn new() -> Self
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>
impl<S> JobRequestItemBuilder<S>
Sourcepub fn priority(self, p: f64) -> Self
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.
Sourcepub fn namespace(self, ns: impl Into<String>) -> Self
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.
Sourcepub fn client_id(self, id: impl Into<String>) -> Self
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.
Sourcepub fn label(self, k: impl Into<String>, v: impl Into<String>) -> Self
pub fn label(self, k: impl Into<String>, v: impl Into<String>) -> Self
Insert a single label. Can be chained multiple times.
Sourcepub fn annotations(self, a: HashMap<String, String>) -> Self
pub fn annotations(self, a: HashMap<String, String>) -> Self
Replace the entire annotations map.
Sourcepub fn annotation(self, k: impl Into<String>, v: impl Into<String>) -> Self
pub fn annotation(self, k: impl Into<String>, v: impl Into<String>) -> Self
Insert a single annotation. Can be chained multiple times.
Sourcepub fn scheduler(self, s: impl Into<String>) -> Self
pub fn scheduler(self, s: impl Into<String>) -> Self
Override the scheduler for this job. Leave empty to use the cluster default.
Sourcepub fn ingress(self, i: Vec<IngressConfig>) -> Self
pub fn ingress(self, i: Vec<IngressConfig>) -> Self
Replace the entire ingress config list.
Sourcepub fn add_ingress(self, i: IngressConfig) -> Self
pub fn add_ingress(self, i: IngressConfig) -> Self
Append a single ingress config. Can be chained multiple times.
Sourcepub fn services(self, s: Vec<ServiceConfig>) -> Self
pub fn services(self, s: Vec<ServiceConfig>) -> Self
Replace the entire service config list.
Sourcepub fn add_service(self, s: ServiceConfig) -> Self
pub fn add_service(self, s: ServiceConfig) -> Self
Append a single service config. Can be chained multiple times.
Sourcepub fn pod_spec(self, spec: PodSpec) -> JobRequestItemBuilder<HasPodSpec>
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.
Sourcepub fn pod_specs(self, specs: Vec<PodSpec>) -> JobRequestItemBuilder<HasPodSpec>
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>
impl JobRequestItemBuilder<HasPodSpec>
Sourcepub fn build(self) -> JobSubmitRequestItem
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§
impl<S> Freeze for JobRequestItemBuilder<S>
impl<S> RefUnwindSafe for JobRequestItemBuilder<S>where
S: RefUnwindSafe,
impl<S> Send for JobRequestItemBuilder<S>where
S: Send,
impl<S> Sync for JobRequestItemBuilder<S>where
S: Sync,
impl<S> Unpin for JobRequestItemBuilder<S>where
S: Unpin,
impl<S> UnsafeUnpin for JobRequestItemBuilder<S>
impl<S> UnwindSafe for JobRequestItemBuilder<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request