Enum aws_sdk_proton::model::Provisioning
source · #[non_exhaustive]
pub enum Provisioning {
CustomerManaged,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against Provisioning
, it is important to ensure
your code is forward-compatible. That is, if a match arm handles a case for a
feature that is supported by the service but has not been represented as an enum
variant in a current version of SDK, your code should continue to work when you
upgrade SDK to a future version in which the enum does include a variant for that
feature.
Here is an example of how you can make a match expression forward-compatible:
# let provisioning = unimplemented!();
match provisioning {
Provisioning::CustomerManaged => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when provisioning
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant Provisioning::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
Provisioning::Unknown(UnknownVariantValue("NewFeature".to_owned()))
and calling as_str
on it yields "NewFeature"
.
This match expression is forward-compatible when executed with a newer
version of SDK where the variant Provisioning::NewFeature
is defined.
Specifically, when provisioning
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on Provisioning::NewFeature
also yielding "NewFeature"
.
Explicitly matching on the Unknown
variant should
be avoided for two reasons:
- The inner data
UnknownVariantValue
is opaque, and no further information can be extracted. - It might inadvertently shadow other intended match arms.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
CustomerManaged
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl Provisioning
impl Provisioning
sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the &str
value of the enum member.
Examples found in repository?
More examples
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
pub fn serialize_structure_crate_input_create_environment_template_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::CreateEnvironmentTemplateInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_43) = &input.name {
object.key("name").string(var_43.as_str());
}
if let Some(var_44) = &input.display_name {
object.key("displayName").string(var_44.as_str());
}
if let Some(var_45) = &input.description {
object.key("description").string(var_45.as_str());
}
if let Some(var_46) = &input.encryption_key {
object.key("encryptionKey").string(var_46.as_str());
}
if let Some(var_47) = &input.provisioning {
object.key("provisioning").string(var_47.as_str());
}
if let Some(var_48) = &input.tags {
let mut array_49 = object.key("tags").start_array();
for item_50 in var_48 {
{
#[allow(unused_mut)]
let mut object_51 = array_49.value().start_object();
crate::json_ser::serialize_structure_crate_model_tag(&mut object_51, item_50)?;
object_51.finish();
}
}
array_49.finish();
}
Ok(())
}
pub fn serialize_structure_crate_input_create_environment_template_version_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::CreateEnvironmentTemplateVersionInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_52) = &input.client_token {
object.key("clientToken").string(var_52.as_str());
}
if let Some(var_53) = &input.template_name {
object.key("templateName").string(var_53.as_str());
}
if let Some(var_54) = &input.description {
object.key("description").string(var_54.as_str());
}
if let Some(var_55) = &input.major_version {
object.key("majorVersion").string(var_55.as_str());
}
if let Some(var_56) = &input.source {
#[allow(unused_mut)]
let mut object_57 = object.key("source").start_object();
crate::json_ser::serialize_union_crate_model_template_version_source_input(
&mut object_57,
var_56,
)?;
object_57.finish();
}
if let Some(var_58) = &input.tags {
let mut array_59 = object.key("tags").start_array();
for item_60 in var_58 {
{
#[allow(unused_mut)]
let mut object_61 = array_59.value().start_object();
crate::json_ser::serialize_structure_crate_model_tag(&mut object_61, item_60)?;
object_61.finish();
}
}
array_59.finish();
}
Ok(())
}
pub fn serialize_structure_crate_input_create_repository_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::CreateRepositoryInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_62) = &input.provider {
object.key("provider").string(var_62.as_str());
}
if let Some(var_63) = &input.name {
object.key("name").string(var_63.as_str());
}
if let Some(var_64) = &input.connection_arn {
object.key("connectionArn").string(var_64.as_str());
}
if let Some(var_65) = &input.encryption_key {
object.key("encryptionKey").string(var_65.as_str());
}
if let Some(var_66) = &input.tags {
let mut array_67 = object.key("tags").start_array();
for item_68 in var_66 {
{
#[allow(unused_mut)]
let mut object_69 = array_67.value().start_object();
crate::json_ser::serialize_structure_crate_model_tag(&mut object_69, item_68)?;
object_69.finish();
}
}
array_67.finish();
}
Ok(())
}
pub fn serialize_structure_crate_input_create_service_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::CreateServiceInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_70) = &input.name {
object.key("name").string(var_70.as_str());
}
if let Some(var_71) = &input.description {
object.key("description").string(var_71.as_str());
}
if let Some(var_72) = &input.template_name {
object.key("templateName").string(var_72.as_str());
}
if let Some(var_73) = &input.template_major_version {
object.key("templateMajorVersion").string(var_73.as_str());
}
if let Some(var_74) = &input.template_minor_version {
object.key("templateMinorVersion").string(var_74.as_str());
}
if let Some(var_75) = &input.spec {
object.key("spec").string(var_75.as_str());
}
if let Some(var_76) = &input.repository_connection_arn {
object
.key("repositoryConnectionArn")
.string(var_76.as_str());
}
if let Some(var_77) = &input.repository_id {
object.key("repositoryId").string(var_77.as_str());
}
if let Some(var_78) = &input.branch_name {
object.key("branchName").string(var_78.as_str());
}
if let Some(var_79) = &input.tags {
let mut array_80 = object.key("tags").start_array();
for item_81 in var_79 {
{
#[allow(unused_mut)]
let mut object_82 = array_80.value().start_object();
crate::json_ser::serialize_structure_crate_model_tag(&mut object_82, item_81)?;
object_82.finish();
}
}
array_80.finish();
}
Ok(())
}
pub fn serialize_structure_crate_input_create_service_template_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::CreateServiceTemplateInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_83) = &input.name {
object.key("name").string(var_83.as_str());
}
if let Some(var_84) = &input.display_name {
object.key("displayName").string(var_84.as_str());
}
if let Some(var_85) = &input.description {
object.key("description").string(var_85.as_str());
}
if let Some(var_86) = &input.encryption_key {
object.key("encryptionKey").string(var_86.as_str());
}
if let Some(var_87) = &input.pipeline_provisioning {
object.key("pipelineProvisioning").string(var_87.as_str());
}
if let Some(var_88) = &input.tags {
let mut array_89 = object.key("tags").start_array();
for item_90 in var_88 {
{
#[allow(unused_mut)]
let mut object_91 = array_89.value().start_object();
crate::json_ser::serialize_structure_crate_model_tag(&mut object_91, item_90)?;
object_91.finish();
}
}
array_89.finish();
}
Ok(())
}
Trait Implementations§
source§impl AsRef<str> for Provisioning
impl AsRef<str> for Provisioning
source§impl Clone for Provisioning
impl Clone for Provisioning
source§fn clone(&self) -> Provisioning
fn clone(&self) -> Provisioning
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Provisioning
impl Debug for Provisioning
source§impl From<&str> for Provisioning
impl From<&str> for Provisioning
source§impl FromStr for Provisioning
impl FromStr for Provisioning
source§impl Hash for Provisioning
impl Hash for Provisioning
source§impl Ord for Provisioning
impl Ord for Provisioning
source§fn cmp(&self, other: &Provisioning) -> Ordering
fn cmp(&self, other: &Provisioning) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<Provisioning> for Provisioning
impl PartialEq<Provisioning> for Provisioning
source§fn eq(&self, other: &Provisioning) -> bool
fn eq(&self, other: &Provisioning) -> bool
source§impl PartialOrd<Provisioning> for Provisioning
impl PartialOrd<Provisioning> for Provisioning
source§fn partial_cmp(&self, other: &Provisioning) -> Option<Ordering>
fn partial_cmp(&self, other: &Provisioning) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Provisioning
impl StructuralEq for Provisioning
impl StructuralPartialEq for Provisioning
Auto Trait Implementations§
impl RefUnwindSafe for Provisioning
impl Send for Provisioning
impl Sync for Provisioning
impl Unpin for Provisioning
impl UnwindSafe for Provisioning
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.