Skip to main content

telemetry_rust/middleware/aws/operations/
secretsmanager.rs

1/// AWS Secrets Manager operations
2///
3/// API Reference: https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_Operations.html
4use crate::{KeyValue, StringValue};
5
6use super::*;
7
8/// Builder for Secrets Manager-specific OpenTelemetry spans.
9///
10/// This enum serves as a namespace for Secrets Manager operation span builders.
11/// Each operation provides a specific method to create properly configured
12/// spans with Secrets Manager-specific attributes.
13pub enum SecretsManagerSpanBuilder {}
14
15impl AwsSpanBuilder<'_> {
16    /// Creates a Secrets Manager operation span builder.
17    ///
18    /// This method creates a span builder configured for Secrets Manager
19    /// operations with the secret identifier as the primary resource identifier.
20    ///
21    /// # Arguments
22    ///
23    /// * `method` - The Secrets Manager operation method name
24    /// * `secret_id` - Optional secret name or ARN for the operation
25    pub fn secretsmanager(
26        method: impl Into<StringValue>,
27        secret_id: Option<impl Into<StringValue>>,
28    ) -> Self {
29        let mut attributes = Vec::new();
30        if let Some(id) = secret_id {
31            attributes.push(KeyValue::new("aws.secretsmanager.secret_id", id.into()));
32        }
33        Self::client("SecretsManager", method, attributes)
34    }
35}
36
37macro_rules! secretsmanager_global_operation {
38    ($op: ident) => {
39        impl SecretsManagerSpanBuilder {
40            #[doc = concat!("Creates a span builder for the Secrets Manager ", stringify!($op), " operation.")]
41            #[inline]
42            pub fn $op<'a>() -> AwsSpanBuilder<'a> {
43                AwsSpanBuilder::secretsmanager(stringify_camel!($op), None::<StringValue>)
44            }
45        }
46    };
47}
48
49macro_rules! secretsmanager_secret_operation {
50    ($op: ident) => {
51        impl SecretsManagerSpanBuilder {
52            #[doc = concat!("Creates a span builder for the Secrets Manager ", stringify!($op), " operation.")]
53            ///
54            /// # Arguments
55            ///
56            /// * `secret_id` - The name or ARN of the secret
57            pub fn $op<'a>(
58                secret_id: impl Into<StringValue>,
59            ) -> AwsSpanBuilder<'a> {
60                AwsSpanBuilder::secretsmanager(stringify_camel!($op), Some(secret_id))
61            }
62        }
63    };
64}
65
66// Secret value operations
67secretsmanager_secret_operation!(get_secret_value);
68secretsmanager_secret_operation!(put_secret_value);
69secretsmanager_secret_operation!(create_secret);
70
71// Secret lifecycle operations
72secretsmanager_secret_operation!(delete_secret);
73secretsmanager_secret_operation!(describe_secret);
74secretsmanager_secret_operation!(update_secret);
75secretsmanager_secret_operation!(restore_secret);
76
77// Rotation operations
78secretsmanager_secret_operation!(rotate_secret);
79secretsmanager_secret_operation!(cancel_rotate_secret);
80
81// Version operations
82secretsmanager_secret_operation!(update_secret_version_stage);
83secretsmanager_secret_operation!(list_secret_version_ids);
84
85// Tagging operations
86secretsmanager_secret_operation!(tag_resource);
87secretsmanager_secret_operation!(untag_resource);
88
89// Resource policy operations
90secretsmanager_secret_operation!(get_resource_policy);
91secretsmanager_secret_operation!(put_resource_policy);
92secretsmanager_secret_operation!(delete_resource_policy);
93secretsmanager_secret_operation!(validate_resource_policy);
94
95// Replication operations
96secretsmanager_secret_operation!(remove_regions_from_replication);
97secretsmanager_secret_operation!(replicate_secret_to_regions);
98secretsmanager_secret_operation!(stop_replication_to_replica);
99
100// Global operations
101secretsmanager_global_operation!(list_secrets);
102secretsmanager_global_operation!(batch_get_secret_value);
103secretsmanager_global_operation!(get_random_password);