telemetry_rust/middleware/aws/operations/
s3.rs1use crate::{KeyValue, StringValue, semconv};
5
6use super::*;
7
8pub enum S3SpanBuilder {}
15
16impl AwsSpanBuilder<'_> {
17 pub fn s3(
29 method: impl Into<StringValue>,
30 bucket: Option<impl Into<StringValue>>,
31 key: Option<impl Into<StringValue>>,
32 ) -> Self {
33 let mut attributes = Vec::new();
34 if let Some(bucket) = bucket {
35 attributes.push(KeyValue::new(semconv::AWS_S3_BUCKET, bucket.into()));
36 }
37 if let Some(key) = key {
38 attributes.push(KeyValue::new(semconv::AWS_S3_KEY, key.into()));
39 }
40 Self::client("S3", method, attributes)
41 }
42}
43
44macro_rules! s3_global_operation {
45 ($op: ident) => {
46 impl S3SpanBuilder {
47 #[doc = concat!("Creates a span builder for the S3 ", stringify!($op), " global operation.")]
48 #[inline]
49 pub fn $op<'a>() -> AwsSpanBuilder<'a> {
50 AwsSpanBuilder::s3(
51 stringify_camel!($op),
52 None::<StringValue>,
53 None::<StringValue>,
54 )
55 }
56 }
57 };
58}
59
60macro_rules! s3_bucket_operation {
61 ($op: ident) => {
62 impl S3SpanBuilder {
63 #[doc = concat!("Creates a span builder for the S3 ", stringify!($op), " bucket operation.")]
64 pub fn $op<'a>(bucket: impl Into<StringValue>) -> AwsSpanBuilder<'a> {
69 AwsSpanBuilder::s3(
70 stringify_camel!($op),
71 Some(bucket),
72 None::<StringValue>,
73 )
74 }
75 }
76 };
77}
78
79macro_rules! s3_object_operation {
80 ($op: ident) => {
81 impl S3SpanBuilder {
82 #[doc = concat!("Creates a span builder for the S3 ", stringify!($op), " object operation.")]
83 pub fn $op<'a>(
89 bucket: impl Into<StringValue>,
90 key: impl Into<StringValue>,
91 ) -> AwsSpanBuilder<'a> {
92 AwsSpanBuilder::s3(stringify_camel!($op), Some(bucket), Some(key))
93 }
94 }
95 };
96}
97
98s3_global_operation!(list_buckets);
100s3_global_operation!(list_directory_buckets);
101
102s3_bucket_operation!(create_bucket);
104s3_bucket_operation!(delete_bucket);
105s3_bucket_operation!(head_bucket);
106s3_bucket_operation!(create_session);
107
108s3_object_operation!(copy_object);
110s3_object_operation!(delete_object);
111s3_object_operation!(get_object);
112s3_object_operation!(head_object);
113s3_object_operation!(put_object);
114s3_object_operation!(rename_object);
115s3_object_operation!(restore_object);
116s3_object_operation!(select_object_content);
117s3_object_operation!(get_object_torrent);
118
119s3_bucket_operation!(delete_objects);
121
122s3_bucket_operation!(list_objects);
124s3_bucket_operation!(list_objects_v2);
125s3_bucket_operation!(list_object_versions);
126
127s3_object_operation!(create_multipart_upload);
129s3_object_operation!(upload_part);
130s3_object_operation!(upload_part_copy);
131s3_object_operation!(complete_multipart_upload);
132s3_object_operation!(abort_multipart_upload);
133s3_bucket_operation!(list_multipart_uploads);
134s3_object_operation!(list_parts);
135
136s3_object_operation!(get_object_acl);
138s3_object_operation!(put_object_acl);
139s3_object_operation!(get_object_attributes);
140
141s3_object_operation!(get_object_tagging);
143s3_object_operation!(put_object_tagging);
144s3_object_operation!(delete_object_tagging);
145
146s3_object_operation!(get_object_legal_hold);
148s3_object_operation!(put_object_legal_hold);
149s3_object_operation!(get_object_retention);
150s3_object_operation!(put_object_retention);
151s3_bucket_operation!(get_object_lock_configuration);
152s3_bucket_operation!(put_object_lock_configuration);
153
154s3_bucket_operation!(get_bucket_acl);
156s3_bucket_operation!(put_bucket_acl);
157s3_bucket_operation!(get_bucket_policy);
158s3_bucket_operation!(put_bucket_policy);
159s3_bucket_operation!(delete_bucket_policy);
160s3_bucket_operation!(get_bucket_policy_status);
161
162s3_bucket_operation!(get_bucket_cors);
164s3_bucket_operation!(put_bucket_cors);
165s3_bucket_operation!(delete_bucket_cors);
166
167s3_bucket_operation!(get_bucket_encryption);
169s3_bucket_operation!(put_bucket_encryption);
170s3_bucket_operation!(delete_bucket_encryption);
171
172s3_bucket_operation!(get_bucket_lifecycle_configuration);
174s3_bucket_operation!(put_bucket_lifecycle_configuration);
175s3_bucket_operation!(delete_bucket_lifecycle);
176
177s3_bucket_operation!(get_bucket_replication);
179s3_bucket_operation!(put_bucket_replication);
180s3_bucket_operation!(delete_bucket_replication);
181
182s3_bucket_operation!(get_bucket_tagging);
184s3_bucket_operation!(put_bucket_tagging);
185s3_bucket_operation!(delete_bucket_tagging);
186
187s3_bucket_operation!(get_bucket_versioning);
189s3_bucket_operation!(put_bucket_versioning);
190
191s3_bucket_operation!(get_bucket_website);
193s3_bucket_operation!(put_bucket_website);
194s3_bucket_operation!(delete_bucket_website);
195
196s3_bucket_operation!(get_bucket_logging);
198s3_bucket_operation!(put_bucket_logging);
199
200s3_bucket_operation!(get_bucket_notification_configuration);
202s3_bucket_operation!(put_bucket_notification_configuration);
203
204s3_bucket_operation!(get_bucket_location);
206
207s3_bucket_operation!(get_bucket_accelerate_configuration);
209s3_bucket_operation!(put_bucket_accelerate_configuration);
210
211s3_bucket_operation!(get_bucket_request_payment);
213s3_bucket_operation!(put_bucket_request_payment);
214
215s3_bucket_operation!(get_bucket_ownership_controls);
217s3_bucket_operation!(put_bucket_ownership_controls);
218s3_bucket_operation!(delete_bucket_ownership_controls);
219
220s3_bucket_operation!(get_bucket_analytics_configuration);
222s3_bucket_operation!(put_bucket_analytics_configuration);
223s3_bucket_operation!(delete_bucket_analytics_configuration);
224s3_bucket_operation!(list_bucket_analytics_configurations);
225
226s3_bucket_operation!(get_bucket_intelligent_tiering_configuration);
228s3_bucket_operation!(put_bucket_intelligent_tiering_configuration);
229s3_bucket_operation!(delete_bucket_intelligent_tiering_configuration);
230s3_bucket_operation!(list_bucket_intelligent_tiering_configurations);
231
232s3_bucket_operation!(get_bucket_inventory_configuration);
234s3_bucket_operation!(put_bucket_inventory_configuration);
235s3_bucket_operation!(delete_bucket_inventory_configuration);
236s3_bucket_operation!(list_bucket_inventory_configurations);
237
238s3_bucket_operation!(get_bucket_metrics_configuration);
240s3_bucket_operation!(put_bucket_metrics_configuration);
241s3_bucket_operation!(delete_bucket_metrics_configuration);
242s3_bucket_operation!(list_bucket_metrics_configurations);
243
244s3_bucket_operation!(get_public_access_block);
246s3_bucket_operation!(put_public_access_block);
247s3_bucket_operation!(delete_public_access_block);
248
249s3_bucket_operation!(create_bucket_metadata_configuration);
251s3_bucket_operation!(create_bucket_metadata_table_configuration);
252s3_bucket_operation!(delete_bucket_metadata_configuration);
253s3_bucket_operation!(delete_bucket_metadata_table_configuration);
254s3_bucket_operation!(get_bucket_metadata_configuration);
255s3_bucket_operation!(get_bucket_metadata_table_configuration);
256s3_bucket_operation!(update_bucket_metadata_inventory_table_configuration);
257s3_bucket_operation!(update_bucket_metadata_journal_table_configuration);
258
259s3_global_operation!(write_get_object_response);