Skip to main content

telemetry_rust/middleware/aws/operations/
ssm.rs

1/// AWS SSM Parameter Store operations
2///
3/// API Reference: https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_Operations.html
4use crate::{KeyValue, StringValue};
5
6use super::*;
7
8/// Builder for SSM Parameter Store-specific OpenTelemetry spans.
9///
10/// This enum serves as a namespace for SSM Parameter Store operation span builders.
11/// Each operation provides a specific method to create properly configured
12/// spans with SSM-specific attributes.
13pub enum SsmSpanBuilder {}
14
15impl AwsSpanBuilder<'_> {
16    /// Creates an SSM operation span builder.
17    ///
18    /// This method creates a span builder configured for SSM Parameter Store
19    /// operations with the parameter name as the primary resource identifier.
20    ///
21    /// # Arguments
22    ///
23    /// * `method` - The SSM operation method name
24    /// * `parameter_name` - Optional parameter name for the operation
25    pub fn ssm(
26        method: impl Into<StringValue>,
27        parameter_name: Option<impl Into<StringValue>>,
28    ) -> Self {
29        let mut attributes = Vec::new();
30        if let Some(name) = parameter_name {
31            attributes.push(KeyValue::new("aws.ssm.parameter_name", name.into()));
32        }
33        Self::client("SSM", method, attributes)
34    }
35}
36
37macro_rules! ssm_global_operation {
38    ($op: ident) => {
39        impl SsmSpanBuilder {
40            #[doc = concat!("Creates a span builder for the SSM ", stringify!($op), " operation.")]
41            #[inline]
42            pub fn $op<'a>() -> AwsSpanBuilder<'a> {
43                AwsSpanBuilder::ssm(stringify_camel!($op), None::<StringValue>)
44            }
45        }
46    };
47}
48
49macro_rules! ssm_parameter_operation {
50    ($op: ident) => {
51        impl SsmSpanBuilder {
52            #[doc = concat!("Creates a span builder for the SSM ", stringify!($op), " parameter operation.")]
53            ///
54            /// # Arguments
55            ///
56            /// * `parameter_name` - The name of the SSM parameter
57            pub fn $op<'a>(
58                parameter_name: impl Into<StringValue>,
59            ) -> AwsSpanBuilder<'a> {
60                AwsSpanBuilder::ssm(stringify_camel!($op), Some(parameter_name))
61            }
62        }
63    };
64}
65
66// Single parameter operations
67ssm_parameter_operation!(get_parameter);
68ssm_parameter_operation!(put_parameter);
69ssm_parameter_operation!(delete_parameter);
70ssm_parameter_operation!(get_parameter_history);
71ssm_parameter_operation!(label_parameter_version);
72ssm_parameter_operation!(unlabel_parameter_version);
73
74// Multi-parameter operations
75ssm_global_operation!(get_parameters);
76ssm_global_operation!(delete_parameters);
77
78// Path-based operations
79ssm_parameter_operation!(get_parameters_by_path);
80
81// List/describe operations
82ssm_global_operation!(describe_parameters);