Enum aws_sdk_amplifybackend::model::ServiceName
source · #[non_exhaustive]
pub enum ServiceName {
S3,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against ServiceName, 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 servicename = unimplemented!();
match servicename {
ServiceName::S3 => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when servicename represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant ServiceName::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
ServiceName::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 ServiceName::NewFeature is defined.
Specifically, when servicename represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on ServiceName::NewFeature also yielding "NewFeature".
Explicitly matching on the Unknown variant should
be avoided for two reasons:
- The inner data
UnknownVariantValueis 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
S3
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl ServiceName
impl ServiceName
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
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 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 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570
pub fn serialize_structure_crate_input_delete_backend_storage_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::DeleteBackendStorageInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_25) = &input.resource_name {
object.key("resourceName").string(var_25.as_str());
}
if let Some(var_26) = &input.service_name {
object.key("serviceName").string(var_26.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_generate_backend_api_models_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::GenerateBackendApiModelsInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_27) = &input.resource_name {
object.key("resourceName").string(var_27.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_get_backend_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::GetBackendInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_28) = &input.backend_environment_name {
object.key("backendEnvironmentName").string(var_28.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_get_backend_api_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::GetBackendApiInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_29) = &input.resource_config {
#[allow(unused_mut)]
let mut object_30 = object.key("resourceConfig").start_object();
crate::json_ser::serialize_structure_crate_model_backend_api_resource_config(
&mut object_30,
var_29,
)?;
object_30.finish();
}
if let Some(var_31) = &input.resource_name {
object.key("resourceName").string(var_31.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_get_backend_api_models_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::GetBackendApiModelsInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_32) = &input.resource_name {
object.key("resourceName").string(var_32.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_get_backend_auth_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::GetBackendAuthInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_33) = &input.resource_name {
object.key("resourceName").string(var_33.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_get_backend_storage_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::GetBackendStorageInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_34) = &input.resource_name {
object.key("resourceName").string(var_34.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_import_backend_auth_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::ImportBackendAuthInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_35) = &input.identity_pool_id {
object.key("identityPoolId").string(var_35.as_str());
}
if let Some(var_36) = &input.native_client_id {
object.key("nativeClientId").string(var_36.as_str());
}
if let Some(var_37) = &input.user_pool_id {
object.key("userPoolId").string(var_37.as_str());
}
if let Some(var_38) = &input.web_client_id {
object.key("webClientId").string(var_38.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_import_backend_storage_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::ImportBackendStorageInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_39) = &input.bucket_name {
object.key("bucketName").string(var_39.as_str());
}
if let Some(var_40) = &input.service_name {
object.key("serviceName").string(var_40.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_list_backend_jobs_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::ListBackendJobsInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_41) = &input.job_id {
object.key("jobId").string(var_41.as_str());
}
if input.max_results != 0 {
object.key("maxResults").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((input.max_results).into()),
);
}
if let Some(var_42) = &input.next_token {
object.key("nextToken").string(var_42.as_str());
}
if let Some(var_43) = &input.operation {
object.key("operation").string(var_43.as_str());
}
if let Some(var_44) = &input.status {
object.key("status").string(var_44.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_list_s3_buckets_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::ListS3BucketsInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_45) = &input.next_token {
object.key("nextToken").string(var_45.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_remove_all_backends_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::RemoveAllBackendsInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if input.clean_amplify_app {
object
.key("cleanAmplifyApp")
.boolean(input.clean_amplify_app);
}
Ok(())
}
pub fn serialize_structure_crate_input_update_backend_api_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateBackendApiInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_46) = &input.resource_config {
#[allow(unused_mut)]
let mut object_47 = object.key("resourceConfig").start_object();
crate::json_ser::serialize_structure_crate_model_backend_api_resource_config(
&mut object_47,
var_46,
)?;
object_47.finish();
}
if let Some(var_48) = &input.resource_name {
object.key("resourceName").string(var_48.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_update_backend_auth_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateBackendAuthInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_49) = &input.resource_config {
#[allow(unused_mut)]
let mut object_50 = object.key("resourceConfig").start_object();
crate::json_ser::serialize_structure_crate_model_update_backend_auth_resource_config(
&mut object_50,
var_49,
)?;
object_50.finish();
}
if let Some(var_51) = &input.resource_name {
object.key("resourceName").string(var_51.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_update_backend_config_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateBackendConfigInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_52) = &input.login_auth_config {
#[allow(unused_mut)]
let mut object_53 = object.key("loginAuthConfig").start_object();
crate::json_ser::serialize_structure_crate_model_login_auth_config_req_obj(
&mut object_53,
var_52,
)?;
object_53.finish();
}
Ok(())
}
pub fn serialize_structure_crate_input_update_backend_job_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateBackendJobInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_54) = &input.operation {
object.key("operation").string(var_54.as_str());
}
if let Some(var_55) = &input.status {
object.key("status").string(var_55.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_update_backend_storage_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateBackendStorageInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_56) = &input.resource_config {
#[allow(unused_mut)]
let mut object_57 = object.key("resourceConfig").start_object();
crate::json_ser::serialize_structure_crate_model_update_backend_storage_resource_config(
&mut object_57,
var_56,
)?;
object_57.finish();
}
if let Some(var_58) = &input.resource_name {
object.key("resourceName").string(var_58.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_resource_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::ResourceConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
let (_, _) = (object, input);
Ok(())
}
pub fn serialize_structure_crate_model_backend_api_resource_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::BackendApiResourceConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_59) = &input.additional_auth_types {
let mut array_60 = object.key("additionalAuthTypes").start_array();
for item_61 in var_59 {
{
#[allow(unused_mut)]
let mut object_62 = array_60.value().start_object();
crate::json_ser::serialize_structure_crate_model_backend_api_auth_type(
&mut object_62,
item_61,
)?;
object_62.finish();
}
}
array_60.finish();
}
if let Some(var_63) = &input.api_name {
object.key("apiName").string(var_63.as_str());
}
if let Some(var_64) = &input.conflict_resolution {
#[allow(unused_mut)]
let mut object_65 = object.key("conflictResolution").start_object();
crate::json_ser::serialize_structure_crate_model_backend_api_conflict_resolution(
&mut object_65,
var_64,
)?;
object_65.finish();
}
if let Some(var_66) = &input.default_auth_type {
#[allow(unused_mut)]
let mut object_67 = object.key("defaultAuthType").start_object();
crate::json_ser::serialize_structure_crate_model_backend_api_auth_type(
&mut object_67,
var_66,
)?;
object_67.finish();
}
if let Some(var_68) = &input.service {
object.key("service").string(var_68.as_str());
}
if let Some(var_69) = &input.transform_schema {
object.key("transformSchema").string(var_69.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_create_backend_auth_resource_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::CreateBackendAuthResourceConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_70) = &input.auth_resources {
object.key("authResources").string(var_70.as_str());
}
if let Some(var_71) = &input.identity_pool_configs {
#[allow(unused_mut)]
let mut object_72 = object.key("identityPoolConfigs").start_object();
crate::json_ser::serialize_structure_crate_model_create_backend_auth_identity_pool_config(
&mut object_72,
var_71,
)?;
object_72.finish();
}
if let Some(var_73) = &input.service {
object.key("service").string(var_73.as_str());
}
if let Some(var_74) = &input.user_pool_configs {
#[allow(unused_mut)]
let mut object_75 = object.key("userPoolConfigs").start_object();
crate::json_ser::serialize_structure_crate_model_create_backend_auth_user_pool_config(
&mut object_75,
var_74,
)?;
object_75.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_create_backend_storage_resource_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::CreateBackendStorageResourceConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_76) = &input.bucket_name {
object.key("bucketName").string(var_76.as_str());
}
if let Some(var_77) = &input.permissions {
#[allow(unused_mut)]
let mut object_78 = object.key("permissions").start_object();
crate::json_ser::serialize_structure_crate_model_backend_storage_permissions(
&mut object_78,
var_77,
)?;
object_78.finish();
}
if let Some(var_79) = &input.service_name {
object.key("serviceName").string(var_79.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_update_backend_auth_resource_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::UpdateBackendAuthResourceConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_80) = &input.auth_resources {
object.key("authResources").string(var_80.as_str());
}
if let Some(var_81) = &input.identity_pool_configs {
#[allow(unused_mut)]
let mut object_82 = object.key("identityPoolConfigs").start_object();
crate::json_ser::serialize_structure_crate_model_update_backend_auth_identity_pool_config(
&mut object_82,
var_81,
)?;
object_82.finish();
}
if let Some(var_83) = &input.service {
object.key("service").string(var_83.as_str());
}
if let Some(var_84) = &input.user_pool_configs {
#[allow(unused_mut)]
let mut object_85 = object.key("userPoolConfigs").start_object();
crate::json_ser::serialize_structure_crate_model_update_backend_auth_user_pool_config(
&mut object_85,
var_84,
)?;
object_85.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_login_auth_config_req_obj(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::LoginAuthConfigReqObj,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_86) = &input.aws_cognito_identity_pool_id {
object
.key("aws_cognito_identity_pool_id")
.string(var_86.as_str());
}
if let Some(var_87) = &input.aws_cognito_region {
object.key("aws_cognito_region").string(var_87.as_str());
}
if let Some(var_88) = &input.aws_user_pools_id {
object.key("aws_user_pools_id").string(var_88.as_str());
}
if let Some(var_89) = &input.aws_user_pools_web_client_id {
object
.key("aws_user_pools_web_client_id")
.string(var_89.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_update_backend_storage_resource_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::UpdateBackendStorageResourceConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_90) = &input.permissions {
#[allow(unused_mut)]
let mut object_91 = object.key("permissions").start_object();
crate::json_ser::serialize_structure_crate_model_backend_storage_permissions(
&mut object_91,
var_90,
)?;
object_91.finish();
}
if let Some(var_92) = &input.service_name {
object.key("serviceName").string(var_92.as_str());
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for ServiceName
impl AsRef<str> for ServiceName
source§impl Clone for ServiceName
impl Clone for ServiceName
source§fn clone(&self) -> ServiceName
fn clone(&self) -> ServiceName
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ServiceName
impl Debug for ServiceName
source§impl From<&str> for ServiceName
impl From<&str> for ServiceName
source§impl FromStr for ServiceName
impl FromStr for ServiceName
source§impl Hash for ServiceName
impl Hash for ServiceName
source§impl Ord for ServiceName
impl Ord for ServiceName
source§fn cmp(&self, other: &ServiceName) -> Ordering
fn cmp(&self, other: &ServiceName) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<ServiceName> for ServiceName
impl PartialEq<ServiceName> for ServiceName
source§fn eq(&self, other: &ServiceName) -> bool
fn eq(&self, other: &ServiceName) -> bool
source§impl PartialOrd<ServiceName> for ServiceName
impl PartialOrd<ServiceName> for ServiceName
source§fn partial_cmp(&self, other: &ServiceName) -> Option<Ordering>
fn partial_cmp(&self, other: &ServiceName) -> 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 ServiceName
impl StructuralEq for ServiceName
impl StructuralPartialEq for ServiceName
Auto Trait Implementations§
impl RefUnwindSafe for ServiceName
impl Send for ServiceName
impl Sync for ServiceName
impl Unpin for ServiceName
impl UnwindSafe for ServiceName
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.