aws_sdk_xray/types/_service.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Information about an application that processed requests, users that made requests, or downstream services, resources, and applications that an application used.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Service {
7 /// <p>Identifier for the service. Unique within the service map.</p>
8 pub reference_id: ::std::option::Option<i32>,
9 /// <p>The canonical name of the service.</p>
10 pub name: ::std::option::Option<::std::string::String>,
11 /// <p>A list of names for the service, including the canonical name.</p>
12 pub names: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
13 /// <p>Indicates that the service was the first service to process a request.</p>
14 pub root: ::std::option::Option<bool>,
15 /// <p>Identifier of the Amazon Web Services account in which the service runs.</p>
16 pub account_id: ::std::option::Option<::std::string::String>,
17 /// <p>The type of service.</p>
18 /// <ul>
19 /// <li>
20 /// <p>Amazon Web Services Resource - The type of an Amazon Web Services resource. For example, <code>AWS::EC2::Instance</code> for an application running on Amazon EC2 or <code>AWS::DynamoDB::Table</code> for an Amazon DynamoDB table that the application used.</p></li>
21 /// <li>
22 /// <p>Amazon Web Services Service - The type of an Amazon Web Services service. For example, <code>AWS::DynamoDB</code> for downstream calls to Amazon DynamoDB that didn't target a specific table.</p></li>
23 /// <li>
24 /// <p><code>client</code> - Represents the clients that sent requests to a root service.</p></li>
25 /// <li>
26 /// <p><code>remote</code> - A downstream service of indeterminate type.</p></li>
27 /// </ul>
28 pub r#type: ::std::option::Option<::std::string::String>,
29 /// <p>The service's state.</p>
30 pub state: ::std::option::Option<::std::string::String>,
31 /// <p>The start time of the first segment that the service generated.</p>
32 pub start_time: ::std::option::Option<::aws_smithy_types::DateTime>,
33 /// <p>The end time of the last segment that the service generated.</p>
34 pub end_time: ::std::option::Option<::aws_smithy_types::DateTime>,
35 /// <p>Connections to downstream services.</p>
36 pub edges: ::std::option::Option<::std::vec::Vec<crate::types::Edge>>,
37 /// <p>Aggregated statistics for the service.</p>
38 pub summary_statistics: ::std::option::Option<crate::types::ServiceStatistics>,
39 /// <p>A histogram that maps the spread of service durations.</p>
40 pub duration_histogram: ::std::option::Option<::std::vec::Vec<crate::types::HistogramEntry>>,
41 /// <p>A histogram that maps the spread of service response times.</p>
42 pub response_time_histogram: ::std::option::Option<::std::vec::Vec<crate::types::HistogramEntry>>,
43}
44impl Service {
45 /// <p>Identifier for the service. Unique within the service map.</p>
46 pub fn reference_id(&self) -> ::std::option::Option<i32> {
47 self.reference_id
48 }
49 /// <p>The canonical name of the service.</p>
50 pub fn name(&self) -> ::std::option::Option<&str> {
51 self.name.as_deref()
52 }
53 /// <p>A list of names for the service, including the canonical name.</p>
54 ///
55 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.names.is_none()`.
56 pub fn names(&self) -> &[::std::string::String] {
57 self.names.as_deref().unwrap_or_default()
58 }
59 /// <p>Indicates that the service was the first service to process a request.</p>
60 pub fn root(&self) -> ::std::option::Option<bool> {
61 self.root
62 }
63 /// <p>Identifier of the Amazon Web Services account in which the service runs.</p>
64 pub fn account_id(&self) -> ::std::option::Option<&str> {
65 self.account_id.as_deref()
66 }
67 /// <p>The type of service.</p>
68 /// <ul>
69 /// <li>
70 /// <p>Amazon Web Services Resource - The type of an Amazon Web Services resource. For example, <code>AWS::EC2::Instance</code> for an application running on Amazon EC2 or <code>AWS::DynamoDB::Table</code> for an Amazon DynamoDB table that the application used.</p></li>
71 /// <li>
72 /// <p>Amazon Web Services Service - The type of an Amazon Web Services service. For example, <code>AWS::DynamoDB</code> for downstream calls to Amazon DynamoDB that didn't target a specific table.</p></li>
73 /// <li>
74 /// <p><code>client</code> - Represents the clients that sent requests to a root service.</p></li>
75 /// <li>
76 /// <p><code>remote</code> - A downstream service of indeterminate type.</p></li>
77 /// </ul>
78 pub fn r#type(&self) -> ::std::option::Option<&str> {
79 self.r#type.as_deref()
80 }
81 /// <p>The service's state.</p>
82 pub fn state(&self) -> ::std::option::Option<&str> {
83 self.state.as_deref()
84 }
85 /// <p>The start time of the first segment that the service generated.</p>
86 pub fn start_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
87 self.start_time.as_ref()
88 }
89 /// <p>The end time of the last segment that the service generated.</p>
90 pub fn end_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
91 self.end_time.as_ref()
92 }
93 /// <p>Connections to downstream services.</p>
94 ///
95 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.edges.is_none()`.
96 pub fn edges(&self) -> &[crate::types::Edge] {
97 self.edges.as_deref().unwrap_or_default()
98 }
99 /// <p>Aggregated statistics for the service.</p>
100 pub fn summary_statistics(&self) -> ::std::option::Option<&crate::types::ServiceStatistics> {
101 self.summary_statistics.as_ref()
102 }
103 /// <p>A histogram that maps the spread of service durations.</p>
104 ///
105 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.duration_histogram.is_none()`.
106 pub fn duration_histogram(&self) -> &[crate::types::HistogramEntry] {
107 self.duration_histogram.as_deref().unwrap_or_default()
108 }
109 /// <p>A histogram that maps the spread of service response times.</p>
110 ///
111 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.response_time_histogram.is_none()`.
112 pub fn response_time_histogram(&self) -> &[crate::types::HistogramEntry] {
113 self.response_time_histogram.as_deref().unwrap_or_default()
114 }
115}
116impl Service {
117 /// Creates a new builder-style object to manufacture [`Service`](crate::types::Service).
118 pub fn builder() -> crate::types::builders::ServiceBuilder {
119 crate::types::builders::ServiceBuilder::default()
120 }
121}
122
123/// A builder for [`Service`](crate::types::Service).
124#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
125#[non_exhaustive]
126pub struct ServiceBuilder {
127 pub(crate) reference_id: ::std::option::Option<i32>,
128 pub(crate) name: ::std::option::Option<::std::string::String>,
129 pub(crate) names: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
130 pub(crate) root: ::std::option::Option<bool>,
131 pub(crate) account_id: ::std::option::Option<::std::string::String>,
132 pub(crate) r#type: ::std::option::Option<::std::string::String>,
133 pub(crate) state: ::std::option::Option<::std::string::String>,
134 pub(crate) start_time: ::std::option::Option<::aws_smithy_types::DateTime>,
135 pub(crate) end_time: ::std::option::Option<::aws_smithy_types::DateTime>,
136 pub(crate) edges: ::std::option::Option<::std::vec::Vec<crate::types::Edge>>,
137 pub(crate) summary_statistics: ::std::option::Option<crate::types::ServiceStatistics>,
138 pub(crate) duration_histogram: ::std::option::Option<::std::vec::Vec<crate::types::HistogramEntry>>,
139 pub(crate) response_time_histogram: ::std::option::Option<::std::vec::Vec<crate::types::HistogramEntry>>,
140}
141impl ServiceBuilder {
142 /// <p>Identifier for the service. Unique within the service map.</p>
143 pub fn reference_id(mut self, input: i32) -> Self {
144 self.reference_id = ::std::option::Option::Some(input);
145 self
146 }
147 /// <p>Identifier for the service. Unique within the service map.</p>
148 pub fn set_reference_id(mut self, input: ::std::option::Option<i32>) -> Self {
149 self.reference_id = input;
150 self
151 }
152 /// <p>Identifier for the service. Unique within the service map.</p>
153 pub fn get_reference_id(&self) -> &::std::option::Option<i32> {
154 &self.reference_id
155 }
156 /// <p>The canonical name of the service.</p>
157 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158 self.name = ::std::option::Option::Some(input.into());
159 self
160 }
161 /// <p>The canonical name of the service.</p>
162 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
163 self.name = input;
164 self
165 }
166 /// <p>The canonical name of the service.</p>
167 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
168 &self.name
169 }
170 /// Appends an item to `names`.
171 ///
172 /// To override the contents of this collection use [`set_names`](Self::set_names).
173 ///
174 /// <p>A list of names for the service, including the canonical name.</p>
175 pub fn names(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
176 let mut v = self.names.unwrap_or_default();
177 v.push(input.into());
178 self.names = ::std::option::Option::Some(v);
179 self
180 }
181 /// <p>A list of names for the service, including the canonical name.</p>
182 pub fn set_names(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
183 self.names = input;
184 self
185 }
186 /// <p>A list of names for the service, including the canonical name.</p>
187 pub fn get_names(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
188 &self.names
189 }
190 /// <p>Indicates that the service was the first service to process a request.</p>
191 pub fn root(mut self, input: bool) -> Self {
192 self.root = ::std::option::Option::Some(input);
193 self
194 }
195 /// <p>Indicates that the service was the first service to process a request.</p>
196 pub fn set_root(mut self, input: ::std::option::Option<bool>) -> Self {
197 self.root = input;
198 self
199 }
200 /// <p>Indicates that the service was the first service to process a request.</p>
201 pub fn get_root(&self) -> &::std::option::Option<bool> {
202 &self.root
203 }
204 /// <p>Identifier of the Amazon Web Services account in which the service runs.</p>
205 pub fn account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
206 self.account_id = ::std::option::Option::Some(input.into());
207 self
208 }
209 /// <p>Identifier of the Amazon Web Services account in which the service runs.</p>
210 pub fn set_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
211 self.account_id = input;
212 self
213 }
214 /// <p>Identifier of the Amazon Web Services account in which the service runs.</p>
215 pub fn get_account_id(&self) -> &::std::option::Option<::std::string::String> {
216 &self.account_id
217 }
218 /// <p>The type of service.</p>
219 /// <ul>
220 /// <li>
221 /// <p>Amazon Web Services Resource - The type of an Amazon Web Services resource. For example, <code>AWS::EC2::Instance</code> for an application running on Amazon EC2 or <code>AWS::DynamoDB::Table</code> for an Amazon DynamoDB table that the application used.</p></li>
222 /// <li>
223 /// <p>Amazon Web Services Service - The type of an Amazon Web Services service. For example, <code>AWS::DynamoDB</code> for downstream calls to Amazon DynamoDB that didn't target a specific table.</p></li>
224 /// <li>
225 /// <p><code>client</code> - Represents the clients that sent requests to a root service.</p></li>
226 /// <li>
227 /// <p><code>remote</code> - A downstream service of indeterminate type.</p></li>
228 /// </ul>
229 pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
230 self.r#type = ::std::option::Option::Some(input.into());
231 self
232 }
233 /// <p>The type of service.</p>
234 /// <ul>
235 /// <li>
236 /// <p>Amazon Web Services Resource - The type of an Amazon Web Services resource. For example, <code>AWS::EC2::Instance</code> for an application running on Amazon EC2 or <code>AWS::DynamoDB::Table</code> for an Amazon DynamoDB table that the application used.</p></li>
237 /// <li>
238 /// <p>Amazon Web Services Service - The type of an Amazon Web Services service. For example, <code>AWS::DynamoDB</code> for downstream calls to Amazon DynamoDB that didn't target a specific table.</p></li>
239 /// <li>
240 /// <p><code>client</code> - Represents the clients that sent requests to a root service.</p></li>
241 /// <li>
242 /// <p><code>remote</code> - A downstream service of indeterminate type.</p></li>
243 /// </ul>
244 pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
245 self.r#type = input;
246 self
247 }
248 /// <p>The type of service.</p>
249 /// <ul>
250 /// <li>
251 /// <p>Amazon Web Services Resource - The type of an Amazon Web Services resource. For example, <code>AWS::EC2::Instance</code> for an application running on Amazon EC2 or <code>AWS::DynamoDB::Table</code> for an Amazon DynamoDB table that the application used.</p></li>
252 /// <li>
253 /// <p>Amazon Web Services Service - The type of an Amazon Web Services service. For example, <code>AWS::DynamoDB</code> for downstream calls to Amazon DynamoDB that didn't target a specific table.</p></li>
254 /// <li>
255 /// <p><code>client</code> - Represents the clients that sent requests to a root service.</p></li>
256 /// <li>
257 /// <p><code>remote</code> - A downstream service of indeterminate type.</p></li>
258 /// </ul>
259 pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
260 &self.r#type
261 }
262 /// <p>The service's state.</p>
263 pub fn state(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
264 self.state = ::std::option::Option::Some(input.into());
265 self
266 }
267 /// <p>The service's state.</p>
268 pub fn set_state(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
269 self.state = input;
270 self
271 }
272 /// <p>The service's state.</p>
273 pub fn get_state(&self) -> &::std::option::Option<::std::string::String> {
274 &self.state
275 }
276 /// <p>The start time of the first segment that the service generated.</p>
277 pub fn start_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
278 self.start_time = ::std::option::Option::Some(input);
279 self
280 }
281 /// <p>The start time of the first segment that the service generated.</p>
282 pub fn set_start_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
283 self.start_time = input;
284 self
285 }
286 /// <p>The start time of the first segment that the service generated.</p>
287 pub fn get_start_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
288 &self.start_time
289 }
290 /// <p>The end time of the last segment that the service generated.</p>
291 pub fn end_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
292 self.end_time = ::std::option::Option::Some(input);
293 self
294 }
295 /// <p>The end time of the last segment that the service generated.</p>
296 pub fn set_end_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
297 self.end_time = input;
298 self
299 }
300 /// <p>The end time of the last segment that the service generated.</p>
301 pub fn get_end_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
302 &self.end_time
303 }
304 /// Appends an item to `edges`.
305 ///
306 /// To override the contents of this collection use [`set_edges`](Self::set_edges).
307 ///
308 /// <p>Connections to downstream services.</p>
309 pub fn edges(mut self, input: crate::types::Edge) -> Self {
310 let mut v = self.edges.unwrap_or_default();
311 v.push(input);
312 self.edges = ::std::option::Option::Some(v);
313 self
314 }
315 /// <p>Connections to downstream services.</p>
316 pub fn set_edges(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Edge>>) -> Self {
317 self.edges = input;
318 self
319 }
320 /// <p>Connections to downstream services.</p>
321 pub fn get_edges(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Edge>> {
322 &self.edges
323 }
324 /// <p>Aggregated statistics for the service.</p>
325 pub fn summary_statistics(mut self, input: crate::types::ServiceStatistics) -> Self {
326 self.summary_statistics = ::std::option::Option::Some(input);
327 self
328 }
329 /// <p>Aggregated statistics for the service.</p>
330 pub fn set_summary_statistics(mut self, input: ::std::option::Option<crate::types::ServiceStatistics>) -> Self {
331 self.summary_statistics = input;
332 self
333 }
334 /// <p>Aggregated statistics for the service.</p>
335 pub fn get_summary_statistics(&self) -> &::std::option::Option<crate::types::ServiceStatistics> {
336 &self.summary_statistics
337 }
338 /// Appends an item to `duration_histogram`.
339 ///
340 /// To override the contents of this collection use [`set_duration_histogram`](Self::set_duration_histogram).
341 ///
342 /// <p>A histogram that maps the spread of service durations.</p>
343 pub fn duration_histogram(mut self, input: crate::types::HistogramEntry) -> Self {
344 let mut v = self.duration_histogram.unwrap_or_default();
345 v.push(input);
346 self.duration_histogram = ::std::option::Option::Some(v);
347 self
348 }
349 /// <p>A histogram that maps the spread of service durations.</p>
350 pub fn set_duration_histogram(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::HistogramEntry>>) -> Self {
351 self.duration_histogram = input;
352 self
353 }
354 /// <p>A histogram that maps the spread of service durations.</p>
355 pub fn get_duration_histogram(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::HistogramEntry>> {
356 &self.duration_histogram
357 }
358 /// Appends an item to `response_time_histogram`.
359 ///
360 /// To override the contents of this collection use [`set_response_time_histogram`](Self::set_response_time_histogram).
361 ///
362 /// <p>A histogram that maps the spread of service response times.</p>
363 pub fn response_time_histogram(mut self, input: crate::types::HistogramEntry) -> Self {
364 let mut v = self.response_time_histogram.unwrap_or_default();
365 v.push(input);
366 self.response_time_histogram = ::std::option::Option::Some(v);
367 self
368 }
369 /// <p>A histogram that maps the spread of service response times.</p>
370 pub fn set_response_time_histogram(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::HistogramEntry>>) -> Self {
371 self.response_time_histogram = input;
372 self
373 }
374 /// <p>A histogram that maps the spread of service response times.</p>
375 pub fn get_response_time_histogram(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::HistogramEntry>> {
376 &self.response_time_histogram
377 }
378 /// Consumes the builder and constructs a [`Service`](crate::types::Service).
379 pub fn build(self) -> crate::types::Service {
380 crate::types::Service {
381 reference_id: self.reference_id,
382 name: self.name,
383 names: self.names,
384 root: self.root,
385 account_id: self.account_id,
386 r#type: self.r#type,
387 state: self.state,
388 start_time: self.start_time,
389 end_time: self.end_time,
390 edges: self.edges,
391 summary_statistics: self.summary_statistics,
392 duration_histogram: self.duration_histogram,
393 response_time_histogram: self.response_time_histogram,
394 }
395 }
396}