Skip to main content

aws_sdk_proton/types/
_component.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Detailed data of an Proton component resource.</p>
4/// <p>For more information about components, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html">Proton components</a> in the <i>Proton User Guide</i>.</p>
5#[non_exhaustive]
6#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
7pub struct Component {
8    /// <p>The name of the component.</p>
9    pub name: ::std::string::String,
10    /// <p>A description of the component.</p>
11    pub description: ::std::option::Option<::std::string::String>,
12    /// <p>The Amazon Resource Name (ARN) of the component.</p>
13    pub arn: ::std::string::String,
14    /// <p>The name of the Proton environment that this component is associated with.</p>
15    pub environment_name: ::std::string::String,
16    /// <p>The name of the service that <code>serviceInstanceName</code> is associated with. Provided when a component is attached to a service instance.</p>
17    pub service_name: ::std::option::Option<::std::string::String>,
18    /// <p>The name of the service instance that this component is attached to. Provided when a component is attached to a service instance.</p>
19    pub service_instance_name: ::std::option::Option<::std::string::String>,
20    /// <p>The time when the component was created.</p>
21    pub created_at: ::aws_smithy_types::DateTime,
22    /// <p>The time when the component was last modified.</p>
23    pub last_modified_at: ::aws_smithy_types::DateTime,
24    /// <p>The time when a deployment of the component was last attempted.</p>
25    pub last_deployment_attempted_at: ::std::option::Option<::aws_smithy_types::DateTime>,
26    /// <p>The time when the component was last deployed successfully.</p>
27    pub last_deployment_succeeded_at: ::std::option::Option<::aws_smithy_types::DateTime>,
28    /// <p>The component deployment status.</p>
29    pub deployment_status: crate::types::DeploymentStatus,
30    /// <p>The message associated with the component deployment status.</p>
31    pub deployment_status_message: ::std::option::Option<::std::string::String>,
32    /// <p>The service spec that the component uses to access service inputs. Provided when a component is attached to a service instance.</p>
33    pub service_spec: ::std::option::Option<::std::string::String>,
34    /// <p>The last token the client requested.</p>
35    pub last_client_request_token: ::std::option::Option<::std::string::String>,
36    /// <p>The ID of the last attempted deployment of this component.</p>
37    pub last_attempted_deployment_id: ::std::option::Option<::std::string::String>,
38    /// <p>The ID of the last successful deployment of this component.</p>
39    pub last_succeeded_deployment_id: ::std::option::Option<::std::string::String>,
40}
41impl Component {
42    /// <p>The name of the component.</p>
43    pub fn name(&self) -> &str {
44        use std::ops::Deref;
45        self.name.deref()
46    }
47    /// <p>A description of the component.</p>
48    pub fn description(&self) -> ::std::option::Option<&str> {
49        self.description.as_deref()
50    }
51    /// <p>The Amazon Resource Name (ARN) of the component.</p>
52    pub fn arn(&self) -> &str {
53        use std::ops::Deref;
54        self.arn.deref()
55    }
56    /// <p>The name of the Proton environment that this component is associated with.</p>
57    pub fn environment_name(&self) -> &str {
58        use std::ops::Deref;
59        self.environment_name.deref()
60    }
61    /// <p>The name of the service that <code>serviceInstanceName</code> is associated with. Provided when a component is attached to a service instance.</p>
62    pub fn service_name(&self) -> ::std::option::Option<&str> {
63        self.service_name.as_deref()
64    }
65    /// <p>The name of the service instance that this component is attached to. Provided when a component is attached to a service instance.</p>
66    pub fn service_instance_name(&self) -> ::std::option::Option<&str> {
67        self.service_instance_name.as_deref()
68    }
69    /// <p>The time when the component was created.</p>
70    pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
71        &self.created_at
72    }
73    /// <p>The time when the component was last modified.</p>
74    pub fn last_modified_at(&self) -> &::aws_smithy_types::DateTime {
75        &self.last_modified_at
76    }
77    /// <p>The time when a deployment of the component was last attempted.</p>
78    pub fn last_deployment_attempted_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
79        self.last_deployment_attempted_at.as_ref()
80    }
81    /// <p>The time when the component was last deployed successfully.</p>
82    pub fn last_deployment_succeeded_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
83        self.last_deployment_succeeded_at.as_ref()
84    }
85    /// <p>The component deployment status.</p>
86    pub fn deployment_status(&self) -> &crate::types::DeploymentStatus {
87        &self.deployment_status
88    }
89    /// <p>The message associated with the component deployment status.</p>
90    pub fn deployment_status_message(&self) -> ::std::option::Option<&str> {
91        self.deployment_status_message.as_deref()
92    }
93    /// <p>The service spec that the component uses to access service inputs. Provided when a component is attached to a service instance.</p>
94    pub fn service_spec(&self) -> ::std::option::Option<&str> {
95        self.service_spec.as_deref()
96    }
97    /// <p>The last token the client requested.</p>
98    pub fn last_client_request_token(&self) -> ::std::option::Option<&str> {
99        self.last_client_request_token.as_deref()
100    }
101    /// <p>The ID of the last attempted deployment of this component.</p>
102    pub fn last_attempted_deployment_id(&self) -> ::std::option::Option<&str> {
103        self.last_attempted_deployment_id.as_deref()
104    }
105    /// <p>The ID of the last successful deployment of this component.</p>
106    pub fn last_succeeded_deployment_id(&self) -> ::std::option::Option<&str> {
107        self.last_succeeded_deployment_id.as_deref()
108    }
109}
110impl ::std::fmt::Debug for Component {
111    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
112        let mut formatter = f.debug_struct("Component");
113        formatter.field("name", &self.name);
114        formatter.field("description", &"*** Sensitive Data Redacted ***");
115        formatter.field("arn", &self.arn);
116        formatter.field("environment_name", &self.environment_name);
117        formatter.field("service_name", &self.service_name);
118        formatter.field("service_instance_name", &self.service_instance_name);
119        formatter.field("created_at", &self.created_at);
120        formatter.field("last_modified_at", &self.last_modified_at);
121        formatter.field("last_deployment_attempted_at", &self.last_deployment_attempted_at);
122        formatter.field("last_deployment_succeeded_at", &self.last_deployment_succeeded_at);
123        formatter.field("deployment_status", &self.deployment_status);
124        formatter.field("deployment_status_message", &"*** Sensitive Data Redacted ***");
125        formatter.field("service_spec", &"*** Sensitive Data Redacted ***");
126        formatter.field("last_client_request_token", &self.last_client_request_token);
127        formatter.field("last_attempted_deployment_id", &self.last_attempted_deployment_id);
128        formatter.field("last_succeeded_deployment_id", &self.last_succeeded_deployment_id);
129        formatter.finish()
130    }
131}
132impl Component {
133    /// Creates a new builder-style object to manufacture [`Component`](crate::types::Component).
134    pub fn builder() -> crate::types::builders::ComponentBuilder {
135        crate::types::builders::ComponentBuilder::default()
136    }
137}
138
139/// A builder for [`Component`](crate::types::Component).
140#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
141#[non_exhaustive]
142pub struct ComponentBuilder {
143    pub(crate) name: ::std::option::Option<::std::string::String>,
144    pub(crate) description: ::std::option::Option<::std::string::String>,
145    pub(crate) arn: ::std::option::Option<::std::string::String>,
146    pub(crate) environment_name: ::std::option::Option<::std::string::String>,
147    pub(crate) service_name: ::std::option::Option<::std::string::String>,
148    pub(crate) service_instance_name: ::std::option::Option<::std::string::String>,
149    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
150    pub(crate) last_modified_at: ::std::option::Option<::aws_smithy_types::DateTime>,
151    pub(crate) last_deployment_attempted_at: ::std::option::Option<::aws_smithy_types::DateTime>,
152    pub(crate) last_deployment_succeeded_at: ::std::option::Option<::aws_smithy_types::DateTime>,
153    pub(crate) deployment_status: ::std::option::Option<crate::types::DeploymentStatus>,
154    pub(crate) deployment_status_message: ::std::option::Option<::std::string::String>,
155    pub(crate) service_spec: ::std::option::Option<::std::string::String>,
156    pub(crate) last_client_request_token: ::std::option::Option<::std::string::String>,
157    pub(crate) last_attempted_deployment_id: ::std::option::Option<::std::string::String>,
158    pub(crate) last_succeeded_deployment_id: ::std::option::Option<::std::string::String>,
159}
160impl ComponentBuilder {
161    /// <p>The name of the component.</p>
162    /// This field is required.
163    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164        self.name = ::std::option::Option::Some(input.into());
165        self
166    }
167    /// <p>The name of the component.</p>
168    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
169        self.name = input;
170        self
171    }
172    /// <p>The name of the component.</p>
173    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
174        &self.name
175    }
176    /// <p>A description of the component.</p>
177    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
178        self.description = ::std::option::Option::Some(input.into());
179        self
180    }
181    /// <p>A description of the component.</p>
182    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
183        self.description = input;
184        self
185    }
186    /// <p>A description of the component.</p>
187    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
188        &self.description
189    }
190    /// <p>The Amazon Resource Name (ARN) of the component.</p>
191    /// This field is required.
192    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
193        self.arn = ::std::option::Option::Some(input.into());
194        self
195    }
196    /// <p>The Amazon Resource Name (ARN) of the component.</p>
197    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
198        self.arn = input;
199        self
200    }
201    /// <p>The Amazon Resource Name (ARN) of the component.</p>
202    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
203        &self.arn
204    }
205    /// <p>The name of the Proton environment that this component is associated with.</p>
206    /// This field is required.
207    pub fn environment_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
208        self.environment_name = ::std::option::Option::Some(input.into());
209        self
210    }
211    /// <p>The name of the Proton environment that this component is associated with.</p>
212    pub fn set_environment_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
213        self.environment_name = input;
214        self
215    }
216    /// <p>The name of the Proton environment that this component is associated with.</p>
217    pub fn get_environment_name(&self) -> &::std::option::Option<::std::string::String> {
218        &self.environment_name
219    }
220    /// <p>The name of the service that <code>serviceInstanceName</code> is associated with. Provided when a component is attached to a service instance.</p>
221    pub fn service_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
222        self.service_name = ::std::option::Option::Some(input.into());
223        self
224    }
225    /// <p>The name of the service that <code>serviceInstanceName</code> is associated with. Provided when a component is attached to a service instance.</p>
226    pub fn set_service_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
227        self.service_name = input;
228        self
229    }
230    /// <p>The name of the service that <code>serviceInstanceName</code> is associated with. Provided when a component is attached to a service instance.</p>
231    pub fn get_service_name(&self) -> &::std::option::Option<::std::string::String> {
232        &self.service_name
233    }
234    /// <p>The name of the service instance that this component is attached to. Provided when a component is attached to a service instance.</p>
235    pub fn service_instance_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
236        self.service_instance_name = ::std::option::Option::Some(input.into());
237        self
238    }
239    /// <p>The name of the service instance that this component is attached to. Provided when a component is attached to a service instance.</p>
240    pub fn set_service_instance_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
241        self.service_instance_name = input;
242        self
243    }
244    /// <p>The name of the service instance that this component is attached to. Provided when a component is attached to a service instance.</p>
245    pub fn get_service_instance_name(&self) -> &::std::option::Option<::std::string::String> {
246        &self.service_instance_name
247    }
248    /// <p>The time when the component was created.</p>
249    /// This field is required.
250    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
251        self.created_at = ::std::option::Option::Some(input);
252        self
253    }
254    /// <p>The time when the component was created.</p>
255    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
256        self.created_at = input;
257        self
258    }
259    /// <p>The time when the component was created.</p>
260    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
261        &self.created_at
262    }
263    /// <p>The time when the component was last modified.</p>
264    /// This field is required.
265    pub fn last_modified_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
266        self.last_modified_at = ::std::option::Option::Some(input);
267        self
268    }
269    /// <p>The time when the component was last modified.</p>
270    pub fn set_last_modified_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
271        self.last_modified_at = input;
272        self
273    }
274    /// <p>The time when the component was last modified.</p>
275    pub fn get_last_modified_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
276        &self.last_modified_at
277    }
278    /// <p>The time when a deployment of the component was last attempted.</p>
279    pub fn last_deployment_attempted_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
280        self.last_deployment_attempted_at = ::std::option::Option::Some(input);
281        self
282    }
283    /// <p>The time when a deployment of the component was last attempted.</p>
284    pub fn set_last_deployment_attempted_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
285        self.last_deployment_attempted_at = input;
286        self
287    }
288    /// <p>The time when a deployment of the component was last attempted.</p>
289    pub fn get_last_deployment_attempted_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
290        &self.last_deployment_attempted_at
291    }
292    /// <p>The time when the component was last deployed successfully.</p>
293    pub fn last_deployment_succeeded_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
294        self.last_deployment_succeeded_at = ::std::option::Option::Some(input);
295        self
296    }
297    /// <p>The time when the component was last deployed successfully.</p>
298    pub fn set_last_deployment_succeeded_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
299        self.last_deployment_succeeded_at = input;
300        self
301    }
302    /// <p>The time when the component was last deployed successfully.</p>
303    pub fn get_last_deployment_succeeded_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
304        &self.last_deployment_succeeded_at
305    }
306    /// <p>The component deployment status.</p>
307    /// This field is required.
308    pub fn deployment_status(mut self, input: crate::types::DeploymentStatus) -> Self {
309        self.deployment_status = ::std::option::Option::Some(input);
310        self
311    }
312    /// <p>The component deployment status.</p>
313    pub fn set_deployment_status(mut self, input: ::std::option::Option<crate::types::DeploymentStatus>) -> Self {
314        self.deployment_status = input;
315        self
316    }
317    /// <p>The component deployment status.</p>
318    pub fn get_deployment_status(&self) -> &::std::option::Option<crate::types::DeploymentStatus> {
319        &self.deployment_status
320    }
321    /// <p>The message associated with the component deployment status.</p>
322    pub fn deployment_status_message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
323        self.deployment_status_message = ::std::option::Option::Some(input.into());
324        self
325    }
326    /// <p>The message associated with the component deployment status.</p>
327    pub fn set_deployment_status_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
328        self.deployment_status_message = input;
329        self
330    }
331    /// <p>The message associated with the component deployment status.</p>
332    pub fn get_deployment_status_message(&self) -> &::std::option::Option<::std::string::String> {
333        &self.deployment_status_message
334    }
335    /// <p>The service spec that the component uses to access service inputs. Provided when a component is attached to a service instance.</p>
336    pub fn service_spec(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
337        self.service_spec = ::std::option::Option::Some(input.into());
338        self
339    }
340    /// <p>The service spec that the component uses to access service inputs. Provided when a component is attached to a service instance.</p>
341    pub fn set_service_spec(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
342        self.service_spec = input;
343        self
344    }
345    /// <p>The service spec that the component uses to access service inputs. Provided when a component is attached to a service instance.</p>
346    pub fn get_service_spec(&self) -> &::std::option::Option<::std::string::String> {
347        &self.service_spec
348    }
349    /// <p>The last token the client requested.</p>
350    pub fn last_client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
351        self.last_client_request_token = ::std::option::Option::Some(input.into());
352        self
353    }
354    /// <p>The last token the client requested.</p>
355    pub fn set_last_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
356        self.last_client_request_token = input;
357        self
358    }
359    /// <p>The last token the client requested.</p>
360    pub fn get_last_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
361        &self.last_client_request_token
362    }
363    /// <p>The ID of the last attempted deployment of this component.</p>
364    pub fn last_attempted_deployment_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
365        self.last_attempted_deployment_id = ::std::option::Option::Some(input.into());
366        self
367    }
368    /// <p>The ID of the last attempted deployment of this component.</p>
369    pub fn set_last_attempted_deployment_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
370        self.last_attempted_deployment_id = input;
371        self
372    }
373    /// <p>The ID of the last attempted deployment of this component.</p>
374    pub fn get_last_attempted_deployment_id(&self) -> &::std::option::Option<::std::string::String> {
375        &self.last_attempted_deployment_id
376    }
377    /// <p>The ID of the last successful deployment of this component.</p>
378    pub fn last_succeeded_deployment_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
379        self.last_succeeded_deployment_id = ::std::option::Option::Some(input.into());
380        self
381    }
382    /// <p>The ID of the last successful deployment of this component.</p>
383    pub fn set_last_succeeded_deployment_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
384        self.last_succeeded_deployment_id = input;
385        self
386    }
387    /// <p>The ID of the last successful deployment of this component.</p>
388    pub fn get_last_succeeded_deployment_id(&self) -> &::std::option::Option<::std::string::String> {
389        &self.last_succeeded_deployment_id
390    }
391    /// Consumes the builder and constructs a [`Component`](crate::types::Component).
392    /// This method will fail if any of the following fields are not set:
393    /// - [`name`](crate::types::builders::ComponentBuilder::name)
394    /// - [`arn`](crate::types::builders::ComponentBuilder::arn)
395    /// - [`environment_name`](crate::types::builders::ComponentBuilder::environment_name)
396    /// - [`created_at`](crate::types::builders::ComponentBuilder::created_at)
397    /// - [`last_modified_at`](crate::types::builders::ComponentBuilder::last_modified_at)
398    /// - [`deployment_status`](crate::types::builders::ComponentBuilder::deployment_status)
399    pub fn build(self) -> ::std::result::Result<crate::types::Component, ::aws_smithy_types::error::operation::BuildError> {
400        ::std::result::Result::Ok(crate::types::Component {
401            name: self.name.ok_or_else(|| {
402                ::aws_smithy_types::error::operation::BuildError::missing_field(
403                    "name",
404                    "name was not specified but it is required when building Component",
405                )
406            })?,
407            description: self.description,
408            arn: self.arn.ok_or_else(|| {
409                ::aws_smithy_types::error::operation::BuildError::missing_field(
410                    "arn",
411                    "arn was not specified but it is required when building Component",
412                )
413            })?,
414            environment_name: self.environment_name.ok_or_else(|| {
415                ::aws_smithy_types::error::operation::BuildError::missing_field(
416                    "environment_name",
417                    "environment_name was not specified but it is required when building Component",
418                )
419            })?,
420            service_name: self.service_name,
421            service_instance_name: self.service_instance_name,
422            created_at: self.created_at.ok_or_else(|| {
423                ::aws_smithy_types::error::operation::BuildError::missing_field(
424                    "created_at",
425                    "created_at was not specified but it is required when building Component",
426                )
427            })?,
428            last_modified_at: self.last_modified_at.ok_or_else(|| {
429                ::aws_smithy_types::error::operation::BuildError::missing_field(
430                    "last_modified_at",
431                    "last_modified_at was not specified but it is required when building Component",
432                )
433            })?,
434            last_deployment_attempted_at: self.last_deployment_attempted_at,
435            last_deployment_succeeded_at: self.last_deployment_succeeded_at,
436            deployment_status: self.deployment_status.ok_or_else(|| {
437                ::aws_smithy_types::error::operation::BuildError::missing_field(
438                    "deployment_status",
439                    "deployment_status was not specified but it is required when building Component",
440                )
441            })?,
442            deployment_status_message: self.deployment_status_message,
443            service_spec: self.service_spec,
444            last_client_request_token: self.last_client_request_token,
445            last_attempted_deployment_id: self.last_attempted_deployment_id,
446            last_succeeded_deployment_id: self.last_succeeded_deployment_id,
447        })
448    }
449}
450impl ::std::fmt::Debug for ComponentBuilder {
451    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
452        let mut formatter = f.debug_struct("ComponentBuilder");
453        formatter.field("name", &self.name);
454        formatter.field("description", &"*** Sensitive Data Redacted ***");
455        formatter.field("arn", &self.arn);
456        formatter.field("environment_name", &self.environment_name);
457        formatter.field("service_name", &self.service_name);
458        formatter.field("service_instance_name", &self.service_instance_name);
459        formatter.field("created_at", &self.created_at);
460        formatter.field("last_modified_at", &self.last_modified_at);
461        formatter.field("last_deployment_attempted_at", &self.last_deployment_attempted_at);
462        formatter.field("last_deployment_succeeded_at", &self.last_deployment_succeeded_at);
463        formatter.field("deployment_status", &self.deployment_status);
464        formatter.field("deployment_status_message", &"*** Sensitive Data Redacted ***");
465        formatter.field("service_spec", &"*** Sensitive Data Redacted ***");
466        formatter.field("last_client_request_token", &self.last_client_request_token);
467        formatter.field("last_attempted_deployment_id", &self.last_attempted_deployment_id);
468        formatter.field("last_succeeded_deployment_id", &self.last_succeeded_deployment_id);
469        formatter.finish()
470    }
471}