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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// Declares a host capability that an extension requires. Capabilities must be explicitly approved by the deployer before the extension can use them.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Capability {
/// A unique identifier for this capability within the extension's configuration.
pub id: ::std::string::String,
/// A description of why the extension needs this capability and how it will be used.
pub purpose: ::std::string::String,
/// Whether this capability is mandatory for the extension to function. Defaults to false.
pub required: ::std::option::Option<bool>,
/// The type-specific details of the requested capability.
pub definition: ::std::option::Option<crate::types::CapabilityDefinition>,
}
impl Capability {
/// A unique identifier for this capability within the extension's configuration.
pub fn id(&self) -> &str {
use std::ops::Deref;
self.id.deref()
}
/// A description of why the extension needs this capability and how it will be used.
pub fn purpose(&self) -> &str {
use std::ops::Deref;
self.purpose.deref()
}
/// Whether this capability is mandatory for the extension to function. Defaults to false.
pub fn required(&self) -> ::std::option::Option<bool> {
self.required
}
/// The type-specific details of the requested capability.
pub fn definition(&self) -> ::std::option::Option<&crate::types::CapabilityDefinition> {
self.definition.as_ref()
}
}
impl Capability {
/// Creates a new builder-style object to manufacture [`Capability`](crate::types::Capability).
pub fn builder() -> crate::types::builders::CapabilityBuilder {
crate::types::builders::CapabilityBuilder::default()
}
}
/// A builder for [`Capability`](crate::types::Capability).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CapabilityBuilder {
pub(crate) id: ::std::option::Option<::std::string::String>,
pub(crate) purpose: ::std::option::Option<::std::string::String>,
pub(crate) required: ::std::option::Option<bool>,
pub(crate) definition: ::std::option::Option<crate::types::CapabilityDefinition>,
}
impl CapabilityBuilder {
/// A unique identifier for this capability within the extension's configuration.
/// This field is required.
pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.id = ::std::option::Option::Some(input.into());
self
}
/// A unique identifier for this capability within the extension's configuration.
pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.id = input;
self
}
/// A unique identifier for this capability within the extension's configuration.
pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
&self.id
}
/// A description of why the extension needs this capability and how it will be used.
/// This field is required.
pub fn purpose(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.purpose = ::std::option::Option::Some(input.into());
self
}
/// A description of why the extension needs this capability and how it will be used.
pub fn set_purpose(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.purpose = input;
self
}
/// A description of why the extension needs this capability and how it will be used.
pub fn get_purpose(&self) -> &::std::option::Option<::std::string::String> {
&self.purpose
}
/// Whether this capability is mandatory for the extension to function. Defaults to false.
pub fn required(mut self, input: bool) -> Self {
self.required = ::std::option::Option::Some(input);
self
}
/// Whether this capability is mandatory for the extension to function. Defaults to false.
pub fn set_required(mut self, input: ::std::option::Option<bool>) -> Self {
self.required = input;
self
}
/// Whether this capability is mandatory for the extension to function. Defaults to false.
pub fn get_required(&self) -> &::std::option::Option<bool> {
&self.required
}
/// The type-specific details of the requested capability.
/// This field is required.
pub fn definition(mut self, input: crate::types::CapabilityDefinition) -> Self {
self.definition = ::std::option::Option::Some(input);
self
}
/// The type-specific details of the requested capability.
pub fn set_definition(mut self, input: ::std::option::Option<crate::types::CapabilityDefinition>) -> Self {
self.definition = input;
self
}
/// The type-specific details of the requested capability.
pub fn get_definition(&self) -> &::std::option::Option<crate::types::CapabilityDefinition> {
&self.definition
}
/// Consumes the builder and constructs a [`Capability`](crate::types::Capability).
/// This method will fail if any of the following fields are not set:
/// - [`id`](crate::types::builders::CapabilityBuilder::id)
/// - [`purpose`](crate::types::builders::CapabilityBuilder::purpose)
pub fn build(self) -> ::std::result::Result<crate::types::Capability, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Capability {
id: self.id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"id",
"id was not specified but it is required when building Capability",
)
})?,
purpose: self.purpose.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"purpose",
"purpose was not specified but it is required when building Capability",
)
})?,
required: self.required,
definition: self.definition,
})
}
}