four/core/
service.rs

1use dyn_clone::DynClone;
2
3pub trait Service: erased_serde::Serialize + DynClone + std::fmt::Debug + 'static {
4    fn to_string(&self) -> String;
5}
6
7erased_serde::serialize_trait_object!(Service);
8dyn_clone::clone_trait_object!(Service);
9
10macro_rules! services {
11    ($(($service_name:ident, $stringify_service:expr)),*) => {
12        $(
13            #[derive(Debug, Clone, Copy)]
14            pub struct $service_name;
15
16            impl serde::Serialize for $service_name {
17                fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
18                where
19                    S: serde::Serializer,
20                {
21                    serializer.serialize_str(&self.to_string())
22                }
23            }
24
25            impl Service for $service_name {
26                fn to_string(&self) -> String {
27                    $stringify_service.to_string()
28                }
29            }
30        )*
31    };
32}
33
34services!(
35    (Amplify, "amplify"),
36    (APIGateway, "apigateway"),
37    (AppFlow, "appflow"),
38    (AppMesh, "appmesh"),
39    (AppRunner, "apprunner"),
40    (AppSync, "appsync"),
41    (Athena, "athena"),
42    (Batch, "batch"),
43    (Cloud9, "cloud9"),
44    (CloudFormation, "cloudformation"),
45    (CloudFront, "cloudfront"),
46    (CloudShell, "cloudshell"),
47    (CloudWatch, "cloudwatch"),
48    (CloudWatchLogs, "logs"),
49    (CodeArtifact, "codeartifact"),
50    (CodeBuild, "codebuild"),
51    (CodeCommit, "codecommit"),
52    (CodeDeploy, "codedeploy"),
53    (CodeGuru, "codeguru"),
54    (CodePipeline, "codepipeline"),
55    (Comprehend, "comprehend"),
56    (ControlTower, "controltower"),
57    (DataExchange, "dataexchange"),
58    (DataPipeline, "datapipeline"),
59    (DynamoDB, "dynamodb"),
60    (EC2, "ec2"),
61    (ECR, "ecr"),
62    (ECS, "ecs"),
63    (ElastiCache, "elasticache"),
64    (ElasticFilesystem, "elasticfilesystem"),
65    (EKS, "eks"),
66    (ElasticBeanstalk, "elasticbeanstalk"),
67    (EMR, "elasticmapreduce"),
68    (EventBridge, "events"),
69    (Glue, "glue"),
70    (GlueDataBrew, "databrew"),
71    (Gracier, "gracier"),
72    (GuardDuty, "guardduty"),
73    (IAM, "iam"),
74    (IoTCore, "iot"),
75    (Kendra, "kendra"),
76    (Kinesis, "kinesis"),
77    (LakeFormation, "lakeformation"),
78    (Lambda, "lambda"),
79    (Lightsail, "lightsail"),
80    (Macie, "macie"),
81    (Macie2, "macie2"),
82    (Neptune, "neptune-db"),
83    (Organizations, "organizations"),
84    (QuickSight, "quicksight"),
85    (RDS, "rds"),
86    (RDSData, "rds-data"),
87    (RDSDB, "rds-db"),
88    (Redshift, "redshift"),
89    (Route53, "route53"),
90    (S3, "s3"),
91    (SageMaker, "sagemaker"),
92    (SecretsManager, "secretsmanager"),
93    (SimpleEmail, "sms"),
94    (SimpleQueue, "sqs"),
95    (SimpleNotification, "sns"),
96    (SingleSignOn, "sso"),
97    (StorageGateway, "storagegateway"),
98    (StepFunctions, "states"),
99    (Sts, "sts"),
100    (SystemsManager, "ssm"),
101    (Transcribe, "transcribe"),
102    (Translate, "translate"),
103    (WAF, "waf"),
104    (XRay, "xray")
105);