1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[allow(unused_imports)]
use super::*;
/// A resource created or operated on by a work request.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct WorkRequestResource {
/// The resource type that the work request affects.
pub entity_type: TargetResourceEntityType,
/// The way in which this resource is affected by the work tracked in the work request. A resource being created, updated, or deleted will remain in the IN_PROGRESS state until work is complete for that resource at which point it will transition to CREATED, UPDATED, or DELETED, respectively.
pub action_type: ActionType,
/// The identifier of the resource the work request affects.
pub identifier: String,
/// The URI path that the user can do a GET on to access the resource metadata.
#[serde(skip_serializing_if = "Option::is_none")]
pub entity_uri: Option<String>,
/// The name of the resource. Not all resources will have a name specified.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// Additional information that helps to explain the resource.
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<HashMap<String, String>>,
}
/// Required fields for WorkRequestResource
pub struct WorkRequestResourceRequired {
/// The resource type that the work request affects.
pub entity_type: TargetResourceEntityType,
/// The way in which this resource is affected by the work tracked in the work request. A resource being created, updated, or deleted will remain in the IN_PROGRESS state until work is complete for that resource at which point it will transition to CREATED, UPDATED, or DELETED, respectively.
pub action_type: ActionType,
/// The identifier of the resource the work request affects.
pub identifier: String,
}
impl WorkRequestResource {
/// Create a new WorkRequestResource with required fields
pub fn new(required: WorkRequestResourceRequired) -> Self {
Self {
entity_type: required.entity_type,
action_type: required.action_type,
identifier: required.identifier,
entity_uri: None,
name: None,
metadata: None,
}
}
/// Set entity_type
pub fn set_entity_type(mut self, value: TargetResourceEntityType) -> Self {
self.entity_type = value;
self
}
/// Set action_type
pub fn set_action_type(mut self, value: ActionType) -> Self {
self.action_type = value;
self
}
/// Set identifier
pub fn set_identifier(mut self, value: String) -> Self {
self.identifier = value;
self
}
/// Set entity_uri
pub fn set_entity_uri(mut self, value: Option<String>) -> Self {
self.entity_uri = value;
self
}
/// Set name
pub fn set_name(mut self, value: Option<String>) -> Self {
self.name = value;
self
}
/// Set metadata
pub fn set_metadata(mut self, value: Option<HashMap<String, String>>) -> Self {
self.metadata = value;
self
}
/// Set entity_uri (unwraps Option)
pub fn with_entity_uri(mut self, value: impl Into<String>) -> Self {
self.entity_uri = Some(value.into());
self
}
/// Set name (unwraps Option)
pub fn with_name(mut self, value: impl Into<String>) -> Self {
self.name = Some(value.into());
self
}
/// Set metadata (unwraps Option)
pub fn with_metadata(mut self, value: HashMap<String, String>) -> Self {
self.metadata = Some(value);
self
}
}