Skip to main content

nominal_api_conjure/conjure/objects/ingest/api/
create_ingest_job_request.rs

1/// Request to create a new ingest job.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct CreateIngestJobRequest {
14    #[serde(rename = "workspaceRid")]
15    workspace_rid: super::super::super::api::rids::WorkspaceRid,
16    #[builder(custom(type = super::IngestJobRequest, convert = Box::new))]
17    #[serde(rename = "ingestJobRequest")]
18    ingest_job_request: Box<super::IngestJobRequest>,
19    #[builder(default, into)]
20    #[serde(rename = "idempotencyKey", skip_serializing_if = "Option::is_none", default)]
21    idempotency_key: Option<String>,
22    #[builder(
23        default,
24        custom(
25            type = impl
26            Into<Option<super::IngestTriggerer>>,
27            convert = |v|v.into().map(Box::new)
28        )
29    )]
30    #[serde(rename = "triggerer", skip_serializing_if = "Option::is_none", default)]
31    triggerer: Option<Box<super::IngestTriggerer>>,
32}
33impl CreateIngestJobRequest {
34    /// Constructs a new instance of the type.
35    #[inline]
36    pub fn new(
37        workspace_rid: super::super::super::api::rids::WorkspaceRid,
38        ingest_job_request: super::IngestJobRequest,
39    ) -> Self {
40        Self::builder()
41            .workspace_rid(workspace_rid)
42            .ingest_job_request(ingest_job_request)
43            .build()
44    }
45    #[inline]
46    pub fn workspace_rid(&self) -> &super::super::super::api::rids::WorkspaceRid {
47        &self.workspace_rid
48    }
49    #[inline]
50    pub fn ingest_job_request(&self) -> &super::IngestJobRequest {
51        &*self.ingest_job_request
52    }
53    /// Optional caller-chosen token that makes creation idempotent, scoped to the workspace. A repeated
54    /// create with the same key returns the existing job instead of creating a new one.
55    #[inline]
56    pub fn idempotency_key(&self) -> Option<&str> {
57        self.idempotency_key.as_ref().map(|o| &**o)
58    }
59    /// What triggered this job, if anything. Recorded on the created job for attribution.
60    #[inline]
61    pub fn triggerer(&self) -> Option<&super::IngestTriggerer> {
62        self.triggerer.as_ref().map(|o| &**o)
63    }
64}