Skip to main content

aws_sdk_devopsguru/types/
_resource_type_filter.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// When writing a match expression against `ResourceTypeFilter`, it is important to ensure
4/// your code is forward-compatible. That is, if a match arm handles a case for a
5/// feature that is supported by the service but has not been represented as an enum
6/// variant in a current version of SDK, your code should continue to work when you
7/// upgrade SDK to a future version in which the enum does include a variant for that
8/// feature.
9///
10/// Here is an example of how you can make a match expression forward-compatible:
11///
12/// ```text
13/// # let resourcetypefilter = unimplemented!();
14/// match resourcetypefilter {
15///     ResourceTypeFilter::CloudfrontDistribution => { /* ... */ },
16///     ResourceTypeFilter::DynamodbTable => { /* ... */ },
17///     ResourceTypeFilter::Ec2NatGateway => { /* ... */ },
18///     ResourceTypeFilter::EcsCluster => { /* ... */ },
19///     ResourceTypeFilter::EcsService => { /* ... */ },
20///     ResourceTypeFilter::EksCluster => { /* ... */ },
21///     ResourceTypeFilter::ElasticacheCacheCluster => { /* ... */ },
22///     ResourceTypeFilter::ElasticsearchDomain => { /* ... */ },
23///     ResourceTypeFilter::ElasticBeanstalkEnvironment => { /* ... */ },
24///     ResourceTypeFilter::ElasticLoadBalancerLoadBalancer => { /* ... */ },
25///     ResourceTypeFilter::ElasticLoadBalancingV2LoadBalancer => { /* ... */ },
26///     ResourceTypeFilter::ElasticLoadBalancingV2TargetGroup => { /* ... */ },
27///     ResourceTypeFilter::KinesisStream => { /* ... */ },
28///     ResourceTypeFilter::LambdaFunction => { /* ... */ },
29///     ResourceTypeFilter::LogGroups => { /* ... */ },
30///     ResourceTypeFilter::OpenSearchServiceDomain => { /* ... */ },
31///     ResourceTypeFilter::RdsDbCluster => { /* ... */ },
32///     ResourceTypeFilter::RdsDbInstance => { /* ... */ },
33///     ResourceTypeFilter::RedshiftCluster => { /* ... */ },
34///     ResourceTypeFilter::Route53HealthCheck => { /* ... */ },
35///     ResourceTypeFilter::Route53HostedZone => { /* ... */ },
36///     ResourceTypeFilter::S3Bucket => { /* ... */ },
37///     ResourceTypeFilter::SagemakerEndpoint => { /* ... */ },
38///     ResourceTypeFilter::SnsTopic => { /* ... */ },
39///     ResourceTypeFilter::SqsQueue => { /* ... */ },
40///     ResourceTypeFilter::StepFunctionsActivity => { /* ... */ },
41///     ResourceTypeFilter::StepFunctionsStateMachine => { /* ... */ },
42///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
43///     _ => { /* ... */ },
44/// }
45/// ```
46/// The above code demonstrates that when `resourcetypefilter` represents
47/// `NewFeature`, the execution path will lead to the second last match arm,
48/// even though the enum does not contain a variant `ResourceTypeFilter::NewFeature`
49/// in the current version of SDK. The reason is that the variable `other`,
50/// created by the `@` operator, is bound to
51/// `ResourceTypeFilter::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
52/// and calling `as_str` on it yields `"NewFeature"`.
53/// This match expression is forward-compatible when executed with a newer
54/// version of SDK where the variant `ResourceTypeFilter::NewFeature` is defined.
55/// Specifically, when `resourcetypefilter` represents `NewFeature`,
56/// the execution path will hit the second last match arm as before by virtue of
57/// calling `as_str` on `ResourceTypeFilter::NewFeature` also yielding `"NewFeature"`.
58///
59/// Explicitly matching on the `Unknown` variant should
60/// be avoided for two reasons:
61/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
62/// - It might inadvertently shadow other intended match arms.
63///
64#[allow(missing_docs)] // documentation missing in model
65#[non_exhaustive]
66#[derive(
67    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
68)]
69pub enum ResourceTypeFilter {
70    #[allow(missing_docs)] // documentation missing in model
71    CloudfrontDistribution,
72    #[allow(missing_docs)] // documentation missing in model
73    DynamodbTable,
74    #[allow(missing_docs)] // documentation missing in model
75    Ec2NatGateway,
76    #[allow(missing_docs)] // documentation missing in model
77    EcsCluster,
78    #[allow(missing_docs)] // documentation missing in model
79    EcsService,
80    #[allow(missing_docs)] // documentation missing in model
81    EksCluster,
82    #[allow(missing_docs)] // documentation missing in model
83    ElasticacheCacheCluster,
84    #[allow(missing_docs)] // documentation missing in model
85    ElasticsearchDomain,
86    #[allow(missing_docs)] // documentation missing in model
87    ElasticBeanstalkEnvironment,
88    #[allow(missing_docs)] // documentation missing in model
89    ElasticLoadBalancerLoadBalancer,
90    #[allow(missing_docs)] // documentation missing in model
91    ElasticLoadBalancingV2LoadBalancer,
92    #[allow(missing_docs)] // documentation missing in model
93    ElasticLoadBalancingV2TargetGroup,
94    #[allow(missing_docs)] // documentation missing in model
95    KinesisStream,
96    #[allow(missing_docs)] // documentation missing in model
97    LambdaFunction,
98    #[allow(missing_docs)] // documentation missing in model
99    LogGroups,
100    #[allow(missing_docs)] // documentation missing in model
101    OpenSearchServiceDomain,
102    #[allow(missing_docs)] // documentation missing in model
103    RdsDbCluster,
104    #[allow(missing_docs)] // documentation missing in model
105    RdsDbInstance,
106    #[allow(missing_docs)] // documentation missing in model
107    RedshiftCluster,
108    #[allow(missing_docs)] // documentation missing in model
109    Route53HealthCheck,
110    #[allow(missing_docs)] // documentation missing in model
111    Route53HostedZone,
112    #[allow(missing_docs)] // documentation missing in model
113    S3Bucket,
114    #[allow(missing_docs)] // documentation missing in model
115    SagemakerEndpoint,
116    #[allow(missing_docs)] // documentation missing in model
117    SnsTopic,
118    #[allow(missing_docs)] // documentation missing in model
119    SqsQueue,
120    #[allow(missing_docs)] // documentation missing in model
121    StepFunctionsActivity,
122    #[allow(missing_docs)] // documentation missing in model
123    StepFunctionsStateMachine,
124    /// `Unknown` contains new variants that have been added since this code was generated.
125    #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
126    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
127}
128impl ::std::convert::From<&str> for ResourceTypeFilter {
129    fn from(s: &str) -> Self {
130        match s {
131            "CLOUDFRONT_DISTRIBUTION" => ResourceTypeFilter::CloudfrontDistribution,
132            "DYNAMODB_TABLE" => ResourceTypeFilter::DynamodbTable,
133            "EC2_NAT_GATEWAY" => ResourceTypeFilter::Ec2NatGateway,
134            "ECS_CLUSTER" => ResourceTypeFilter::EcsCluster,
135            "ECS_SERVICE" => ResourceTypeFilter::EcsService,
136            "EKS_CLUSTER" => ResourceTypeFilter::EksCluster,
137            "ELASTICACHE_CACHE_CLUSTER" => ResourceTypeFilter::ElasticacheCacheCluster,
138            "ELASTICSEARCH_DOMAIN" => ResourceTypeFilter::ElasticsearchDomain,
139            "ELASTIC_BEANSTALK_ENVIRONMENT" => ResourceTypeFilter::ElasticBeanstalkEnvironment,
140            "ELASTIC_LOAD_BALANCER_LOAD_BALANCER" => ResourceTypeFilter::ElasticLoadBalancerLoadBalancer,
141            "ELASTIC_LOAD_BALANCING_V2_LOAD_BALANCER" => ResourceTypeFilter::ElasticLoadBalancingV2LoadBalancer,
142            "ELASTIC_LOAD_BALANCING_V2_TARGET_GROUP" => ResourceTypeFilter::ElasticLoadBalancingV2TargetGroup,
143            "KINESIS_STREAM" => ResourceTypeFilter::KinesisStream,
144            "LAMBDA_FUNCTION" => ResourceTypeFilter::LambdaFunction,
145            "LOG_GROUPS" => ResourceTypeFilter::LogGroups,
146            "OPEN_SEARCH_SERVICE_DOMAIN" => ResourceTypeFilter::OpenSearchServiceDomain,
147            "RDS_DB_CLUSTER" => ResourceTypeFilter::RdsDbCluster,
148            "RDS_DB_INSTANCE" => ResourceTypeFilter::RdsDbInstance,
149            "REDSHIFT_CLUSTER" => ResourceTypeFilter::RedshiftCluster,
150            "ROUTE53_HEALTH_CHECK" => ResourceTypeFilter::Route53HealthCheck,
151            "ROUTE53_HOSTED_ZONE" => ResourceTypeFilter::Route53HostedZone,
152            "S3_BUCKET" => ResourceTypeFilter::S3Bucket,
153            "SAGEMAKER_ENDPOINT" => ResourceTypeFilter::SagemakerEndpoint,
154            "SNS_TOPIC" => ResourceTypeFilter::SnsTopic,
155            "SQS_QUEUE" => ResourceTypeFilter::SqsQueue,
156            "STEP_FUNCTIONS_ACTIVITY" => ResourceTypeFilter::StepFunctionsActivity,
157            "STEP_FUNCTIONS_STATE_MACHINE" => ResourceTypeFilter::StepFunctionsStateMachine,
158            other => ResourceTypeFilter::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
159        }
160    }
161}
162impl ::std::str::FromStr for ResourceTypeFilter {
163    type Err = ::std::convert::Infallible;
164
165    fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
166        ::std::result::Result::Ok(ResourceTypeFilter::from(s))
167    }
168}
169impl ResourceTypeFilter {
170    /// Returns the `&str` value of the enum member.
171    pub fn as_str(&self) -> &str {
172        match self {
173            ResourceTypeFilter::CloudfrontDistribution => "CLOUDFRONT_DISTRIBUTION",
174            ResourceTypeFilter::DynamodbTable => "DYNAMODB_TABLE",
175            ResourceTypeFilter::Ec2NatGateway => "EC2_NAT_GATEWAY",
176            ResourceTypeFilter::EcsCluster => "ECS_CLUSTER",
177            ResourceTypeFilter::EcsService => "ECS_SERVICE",
178            ResourceTypeFilter::EksCluster => "EKS_CLUSTER",
179            ResourceTypeFilter::ElasticacheCacheCluster => "ELASTICACHE_CACHE_CLUSTER",
180            ResourceTypeFilter::ElasticsearchDomain => "ELASTICSEARCH_DOMAIN",
181            ResourceTypeFilter::ElasticBeanstalkEnvironment => "ELASTIC_BEANSTALK_ENVIRONMENT",
182            ResourceTypeFilter::ElasticLoadBalancerLoadBalancer => "ELASTIC_LOAD_BALANCER_LOAD_BALANCER",
183            ResourceTypeFilter::ElasticLoadBalancingV2LoadBalancer => "ELASTIC_LOAD_BALANCING_V2_LOAD_BALANCER",
184            ResourceTypeFilter::ElasticLoadBalancingV2TargetGroup => "ELASTIC_LOAD_BALANCING_V2_TARGET_GROUP",
185            ResourceTypeFilter::KinesisStream => "KINESIS_STREAM",
186            ResourceTypeFilter::LambdaFunction => "LAMBDA_FUNCTION",
187            ResourceTypeFilter::LogGroups => "LOG_GROUPS",
188            ResourceTypeFilter::OpenSearchServiceDomain => "OPEN_SEARCH_SERVICE_DOMAIN",
189            ResourceTypeFilter::RdsDbCluster => "RDS_DB_CLUSTER",
190            ResourceTypeFilter::RdsDbInstance => "RDS_DB_INSTANCE",
191            ResourceTypeFilter::RedshiftCluster => "REDSHIFT_CLUSTER",
192            ResourceTypeFilter::Route53HealthCheck => "ROUTE53_HEALTH_CHECK",
193            ResourceTypeFilter::Route53HostedZone => "ROUTE53_HOSTED_ZONE",
194            ResourceTypeFilter::S3Bucket => "S3_BUCKET",
195            ResourceTypeFilter::SagemakerEndpoint => "SAGEMAKER_ENDPOINT",
196            ResourceTypeFilter::SnsTopic => "SNS_TOPIC",
197            ResourceTypeFilter::SqsQueue => "SQS_QUEUE",
198            ResourceTypeFilter::StepFunctionsActivity => "STEP_FUNCTIONS_ACTIVITY",
199            ResourceTypeFilter::StepFunctionsStateMachine => "STEP_FUNCTIONS_STATE_MACHINE",
200            ResourceTypeFilter::Unknown(value) => value.as_str(),
201        }
202    }
203    /// Returns all the `&str` representations of the enum members.
204    pub const fn values() -> &'static [&'static str] {
205        &[
206            "CLOUDFRONT_DISTRIBUTION",
207            "DYNAMODB_TABLE",
208            "EC2_NAT_GATEWAY",
209            "ECS_CLUSTER",
210            "ECS_SERVICE",
211            "EKS_CLUSTER",
212            "ELASTICACHE_CACHE_CLUSTER",
213            "ELASTICSEARCH_DOMAIN",
214            "ELASTIC_BEANSTALK_ENVIRONMENT",
215            "ELASTIC_LOAD_BALANCER_LOAD_BALANCER",
216            "ELASTIC_LOAD_BALANCING_V2_LOAD_BALANCER",
217            "ELASTIC_LOAD_BALANCING_V2_TARGET_GROUP",
218            "KINESIS_STREAM",
219            "LAMBDA_FUNCTION",
220            "LOG_GROUPS",
221            "OPEN_SEARCH_SERVICE_DOMAIN",
222            "RDS_DB_CLUSTER",
223            "RDS_DB_INSTANCE",
224            "REDSHIFT_CLUSTER",
225            "ROUTE53_HEALTH_CHECK",
226            "ROUTE53_HOSTED_ZONE",
227            "S3_BUCKET",
228            "SAGEMAKER_ENDPOINT",
229            "SNS_TOPIC",
230            "SQS_QUEUE",
231            "STEP_FUNCTIONS_ACTIVITY",
232            "STEP_FUNCTIONS_STATE_MACHINE",
233        ]
234    }
235}
236impl ::std::convert::AsRef<str> for ResourceTypeFilter {
237    fn as_ref(&self) -> &str {
238        self.as_str()
239    }
240}
241impl ResourceTypeFilter {
242    /// Parses the enum value while disallowing unknown variants.
243    ///
244    /// Unknown variants will result in an error.
245    pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
246        match Self::from(value) {
247            #[allow(deprecated)]
248            Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
249            known => Ok(known),
250        }
251    }
252}
253impl ::std::fmt::Display for ResourceTypeFilter {
254    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
255        match self {
256            ResourceTypeFilter::CloudfrontDistribution => write!(f, "CLOUDFRONT_DISTRIBUTION"),
257            ResourceTypeFilter::DynamodbTable => write!(f, "DYNAMODB_TABLE"),
258            ResourceTypeFilter::Ec2NatGateway => write!(f, "EC2_NAT_GATEWAY"),
259            ResourceTypeFilter::EcsCluster => write!(f, "ECS_CLUSTER"),
260            ResourceTypeFilter::EcsService => write!(f, "ECS_SERVICE"),
261            ResourceTypeFilter::EksCluster => write!(f, "EKS_CLUSTER"),
262            ResourceTypeFilter::ElasticacheCacheCluster => write!(f, "ELASTICACHE_CACHE_CLUSTER"),
263            ResourceTypeFilter::ElasticsearchDomain => write!(f, "ELASTICSEARCH_DOMAIN"),
264            ResourceTypeFilter::ElasticBeanstalkEnvironment => write!(f, "ELASTIC_BEANSTALK_ENVIRONMENT"),
265            ResourceTypeFilter::ElasticLoadBalancerLoadBalancer => write!(f, "ELASTIC_LOAD_BALANCER_LOAD_BALANCER"),
266            ResourceTypeFilter::ElasticLoadBalancingV2LoadBalancer => write!(f, "ELASTIC_LOAD_BALANCING_V2_LOAD_BALANCER"),
267            ResourceTypeFilter::ElasticLoadBalancingV2TargetGroup => write!(f, "ELASTIC_LOAD_BALANCING_V2_TARGET_GROUP"),
268            ResourceTypeFilter::KinesisStream => write!(f, "KINESIS_STREAM"),
269            ResourceTypeFilter::LambdaFunction => write!(f, "LAMBDA_FUNCTION"),
270            ResourceTypeFilter::LogGroups => write!(f, "LOG_GROUPS"),
271            ResourceTypeFilter::OpenSearchServiceDomain => write!(f, "OPEN_SEARCH_SERVICE_DOMAIN"),
272            ResourceTypeFilter::RdsDbCluster => write!(f, "RDS_DB_CLUSTER"),
273            ResourceTypeFilter::RdsDbInstance => write!(f, "RDS_DB_INSTANCE"),
274            ResourceTypeFilter::RedshiftCluster => write!(f, "REDSHIFT_CLUSTER"),
275            ResourceTypeFilter::Route53HealthCheck => write!(f, "ROUTE53_HEALTH_CHECK"),
276            ResourceTypeFilter::Route53HostedZone => write!(f, "ROUTE53_HOSTED_ZONE"),
277            ResourceTypeFilter::S3Bucket => write!(f, "S3_BUCKET"),
278            ResourceTypeFilter::SagemakerEndpoint => write!(f, "SAGEMAKER_ENDPOINT"),
279            ResourceTypeFilter::SnsTopic => write!(f, "SNS_TOPIC"),
280            ResourceTypeFilter::SqsQueue => write!(f, "SQS_QUEUE"),
281            ResourceTypeFilter::StepFunctionsActivity => write!(f, "STEP_FUNCTIONS_ACTIVITY"),
282            ResourceTypeFilter::StepFunctionsStateMachine => write!(f, "STEP_FUNCTIONS_STATE_MACHINE"),
283            ResourceTypeFilter::Unknown(value) => write!(f, "{value}"),
284        }
285    }
286}