google_cloud_containeranalysis_v1/
builders.rs1pub mod container_analysis {
18 use crate::Result;
19 use std::sync::Arc;
20
21 #[derive(Clone, Debug)]
23 pub struct RequestBuilder<R: std::default::Default> {
24 stub: Arc<dyn crate::stubs::dynamic::ContainerAnalysis>,
25 request: R,
26 options: gax::options::RequestOptions,
27 }
28
29 impl<R> RequestBuilder<R>
30 where
31 R: std::default::Default,
32 {
33 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::ContainerAnalysis>) -> Self {
34 Self {
35 stub,
36 request: R::default(),
37 options: gax::options::RequestOptions::default(),
38 }
39 }
40 }
41
42 #[derive(Clone, Debug)]
44 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
45
46 impl SetIamPolicy {
47 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::ContainerAnalysis>) -> Self {
48 Self(RequestBuilder::new(stub))
49 }
50
51 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
53 self.0.request = v.into();
54 self
55 }
56
57 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
59 self.0.options = v.into();
60 self
61 }
62
63 pub async fn send(self) -> Result<iam_v1::model::Policy> {
65 (*self.0.stub)
66 .set_iam_policy(self.0.request, self.0.options)
67 .await
68 }
69
70 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
72 self.0.request.resource = v.into();
73 self
74 }
75
76 pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
78 mut self,
79 v: T,
80 ) -> Self {
81 self.0.request.policy = v.into();
82 self
83 }
84
85 pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
87 mut self,
88 v: T,
89 ) -> Self {
90 self.0.request.update_mask = v.into();
91 self
92 }
93 }
94
95 impl gax::options::RequestBuilder for SetIamPolicy {
96 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
97 &mut self.0.options
98 }
99 }
100
101 #[derive(Clone, Debug)]
103 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
104
105 impl GetIamPolicy {
106 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::ContainerAnalysis>) -> Self {
107 Self(RequestBuilder::new(stub))
108 }
109
110 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
112 self.0.request = v.into();
113 self
114 }
115
116 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
118 self.0.options = v.into();
119 self
120 }
121
122 pub async fn send(self) -> Result<iam_v1::model::Policy> {
124 (*self.0.stub)
125 .get_iam_policy(self.0.request, self.0.options)
126 .await
127 }
128
129 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
131 self.0.request.resource = v.into();
132 self
133 }
134
135 pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
137 mut self,
138 v: T,
139 ) -> Self {
140 self.0.request.options = v.into();
141 self
142 }
143 }
144
145 impl gax::options::RequestBuilder for GetIamPolicy {
146 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
147 &mut self.0.options
148 }
149 }
150
151 #[derive(Clone, Debug)]
153 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
154
155 impl TestIamPermissions {
156 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::ContainerAnalysis>) -> Self {
157 Self(RequestBuilder::new(stub))
158 }
159
160 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
162 mut self,
163 v: V,
164 ) -> Self {
165 self.0.request = v.into();
166 self
167 }
168
169 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
171 self.0.options = v.into();
172 self
173 }
174
175 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
177 (*self.0.stub)
178 .test_iam_permissions(self.0.request, self.0.options)
179 .await
180 }
181
182 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
184 self.0.request.resource = v.into();
185 self
186 }
187
188 pub fn set_permissions<T, V>(mut self, v: T) -> Self
190 where
191 T: std::iter::IntoIterator<Item = V>,
192 V: std::convert::Into<std::string::String>,
193 {
194 use std::iter::Iterator;
195 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
196 self
197 }
198 }
199
200 impl gax::options::RequestBuilder for TestIamPermissions {
201 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
202 &mut self.0.options
203 }
204 }
205
206 #[derive(Clone, Debug)]
208 pub struct GetVulnerabilityOccurrencesSummary(
209 RequestBuilder<crate::model::GetVulnerabilityOccurrencesSummaryRequest>,
210 );
211
212 impl GetVulnerabilityOccurrencesSummary {
213 pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::ContainerAnalysis>) -> Self {
214 Self(RequestBuilder::new(stub))
215 }
216
217 pub fn with_request<V: Into<crate::model::GetVulnerabilityOccurrencesSummaryRequest>>(
219 mut self,
220 v: V,
221 ) -> Self {
222 self.0.request = v.into();
223 self
224 }
225
226 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
228 self.0.options = v.into();
229 self
230 }
231
232 pub async fn send(self) -> Result<crate::model::VulnerabilityOccurrencesSummary> {
234 (*self.0.stub)
235 .get_vulnerability_occurrences_summary(self.0.request, self.0.options)
236 .await
237 }
238
239 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
241 self.0.request.parent = v.into();
242 self
243 }
244
245 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
247 self.0.request.filter = v.into();
248 self
249 }
250 }
251
252 impl gax::options::RequestBuilder for GetVulnerabilityOccurrencesSummary {
253 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
254 &mut self.0.options
255 }
256 }
257}