1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Retrieves the list of performance issues which are identified.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct Insight {
/// <p>The unique identifier for the insight. For example, <code>insight-12345678901234567</code>.</p>
pub insight_id: ::std::string::String,
/// <p>The type of insight. For example, <code>HighDBLoad</code>, <code>HighCPU</code>, or <code>DominatingSQLs</code>.</p>
pub insight_type: ::std::option::Option<::std::string::String>,
/// <p>Indicates if the insight is causal or correlated insight.</p>
pub context: ::std::option::Option<crate::types::ContextType>,
/// <p>The start time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
pub start_time: ::std::option::Option<::aws_smithy_types::DateTime>,
/// <p>The end time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
pub end_time: ::std::option::Option<::aws_smithy_types::DateTime>,
/// <p>The severity of the insight. The values are: <code>Low</code>, <code>Medium</code>, or <code>High</code>.</p>
pub severity: ::std::option::Option<crate::types::Severity>,
/// <p>List of supporting insights that provide additional factors for the insight.</p>
pub supporting_insights: ::std::option::Option<::std::vec::Vec<crate::types::Insight>>,
/// <p>Description of the insight. For example: <code>A high severity Insight found between 02:00 to 02:30, where there was an unusually high DB load 600x above baseline. Likely performance impact</code>.</p>
pub description: ::std::option::Option<::std::string::String>,
/// <p>List of recommendations for the insight. For example, <code>Investigate the following SQLs that contributed to 100% of the total DBLoad during that time period: sql-id</code>.</p>
pub recommendations: ::std::option::Option<::std::vec::Vec<crate::types::Recommendation>>,
/// <p>List of data objects containing metrics and references from the time range while generating the insight.</p>
pub insight_data: ::std::option::Option<::std::vec::Vec<crate::types::Data>>,
/// <p>Metric names and values from the timeframe used as baseline to generate the insight.</p>
pub baseline_data: ::std::option::Option<::std::vec::Vec<crate::types::Data>>,
}
impl Insight {
/// <p>The unique identifier for the insight. For example, <code>insight-12345678901234567</code>.</p>
pub fn insight_id(&self) -> &str {
use std::ops::Deref;
self.insight_id.deref()
}
/// <p>The type of insight. For example, <code>HighDBLoad</code>, <code>HighCPU</code>, or <code>DominatingSQLs</code>.</p>
pub fn insight_type(&self) -> ::std::option::Option<&str> {
self.insight_type.as_deref()
}
/// <p>Indicates if the insight is causal or correlated insight.</p>
pub fn context(&self) -> ::std::option::Option<&crate::types::ContextType> {
self.context.as_ref()
}
/// <p>The start time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
pub fn start_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
self.start_time.as_ref()
}
/// <p>The end time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
pub fn end_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
self.end_time.as_ref()
}
/// <p>The severity of the insight. The values are: <code>Low</code>, <code>Medium</code>, or <code>High</code>.</p>
pub fn severity(&self) -> ::std::option::Option<&crate::types::Severity> {
self.severity.as_ref()
}
/// <p>List of supporting insights that provide additional factors for the insight.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.supporting_insights.is_none()`.
pub fn supporting_insights(&self) -> &[crate::types::Insight] {
self.supporting_insights.as_deref().unwrap_or_default()
}
/// <p>Description of the insight. For example: <code>A high severity Insight found between 02:00 to 02:30, where there was an unusually high DB load 600x above baseline. Likely performance impact</code>.</p>
pub fn description(&self) -> ::std::option::Option<&str> {
self.description.as_deref()
}
/// <p>List of recommendations for the insight. For example, <code>Investigate the following SQLs that contributed to 100% of the total DBLoad during that time period: sql-id</code>.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.recommendations.is_none()`.
pub fn recommendations(&self) -> &[crate::types::Recommendation] {
self.recommendations.as_deref().unwrap_or_default()
}
/// <p>List of data objects containing metrics and references from the time range while generating the insight.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.insight_data.is_none()`.
pub fn insight_data(&self) -> &[crate::types::Data] {
self.insight_data.as_deref().unwrap_or_default()
}
/// <p>Metric names and values from the timeframe used as baseline to generate the insight.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.baseline_data.is_none()`.
pub fn baseline_data(&self) -> &[crate::types::Data] {
self.baseline_data.as_deref().unwrap_or_default()
}
}
impl ::std::fmt::Debug for Insight {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("Insight");
formatter.field("insight_id", &self.insight_id);
formatter.field("insight_type", &self.insight_type);
formatter.field("context", &self.context);
formatter.field("start_time", &self.start_time);
formatter.field("end_time", &self.end_time);
formatter.field("severity", &self.severity);
formatter.field("supporting_insights", &self.supporting_insights);
formatter.field("description", &"*** Sensitive Data Redacted ***");
formatter.field("recommendations", &self.recommendations);
formatter.field("insight_data", &self.insight_data);
formatter.field("baseline_data", &self.baseline_data);
formatter.finish()
}
}
impl Insight {
/// Creates a new builder-style object to manufacture [`Insight`](crate::types::Insight).
pub fn builder() -> crate::types::builders::InsightBuilder {
crate::types::builders::InsightBuilder::default()
}
}
/// A builder for [`Insight`](crate::types::Insight).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct InsightBuilder {
pub(crate) insight_id: ::std::option::Option<::std::string::String>,
pub(crate) insight_type: ::std::option::Option<::std::string::String>,
pub(crate) context: ::std::option::Option<crate::types::ContextType>,
pub(crate) start_time: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) end_time: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) severity: ::std::option::Option<crate::types::Severity>,
pub(crate) supporting_insights: ::std::option::Option<::std::vec::Vec<crate::types::Insight>>,
pub(crate) description: ::std::option::Option<::std::string::String>,
pub(crate) recommendations: ::std::option::Option<::std::vec::Vec<crate::types::Recommendation>>,
pub(crate) insight_data: ::std::option::Option<::std::vec::Vec<crate::types::Data>>,
pub(crate) baseline_data: ::std::option::Option<::std::vec::Vec<crate::types::Data>>,
}
impl InsightBuilder {
/// <p>The unique identifier for the insight. For example, <code>insight-12345678901234567</code>.</p>
/// This field is required.
pub fn insight_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.insight_id = ::std::option::Option::Some(input.into());
self
}
/// <p>The unique identifier for the insight. For example, <code>insight-12345678901234567</code>.</p>
pub fn set_insight_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.insight_id = input;
self
}
/// <p>The unique identifier for the insight. For example, <code>insight-12345678901234567</code>.</p>
pub fn get_insight_id(&self) -> &::std::option::Option<::std::string::String> {
&self.insight_id
}
/// <p>The type of insight. For example, <code>HighDBLoad</code>, <code>HighCPU</code>, or <code>DominatingSQLs</code>.</p>
pub fn insight_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.insight_type = ::std::option::Option::Some(input.into());
self
}
/// <p>The type of insight. For example, <code>HighDBLoad</code>, <code>HighCPU</code>, or <code>DominatingSQLs</code>.</p>
pub fn set_insight_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.insight_type = input;
self
}
/// <p>The type of insight. For example, <code>HighDBLoad</code>, <code>HighCPU</code>, or <code>DominatingSQLs</code>.</p>
pub fn get_insight_type(&self) -> &::std::option::Option<::std::string::String> {
&self.insight_type
}
/// <p>Indicates if the insight is causal or correlated insight.</p>
pub fn context(mut self, input: crate::types::ContextType) -> Self {
self.context = ::std::option::Option::Some(input);
self
}
/// <p>Indicates if the insight is causal or correlated insight.</p>
pub fn set_context(mut self, input: ::std::option::Option<crate::types::ContextType>) -> Self {
self.context = input;
self
}
/// <p>Indicates if the insight is causal or correlated insight.</p>
pub fn get_context(&self) -> &::std::option::Option<crate::types::ContextType> {
&self.context
}
/// <p>The start time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
pub fn start_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.start_time = ::std::option::Option::Some(input);
self
}
/// <p>The start time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
pub fn set_start_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.start_time = input;
self
}
/// <p>The start time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
pub fn get_start_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.start_time
}
/// <p>The end time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
pub fn end_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.end_time = ::std::option::Option::Some(input);
self
}
/// <p>The end time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
pub fn set_end_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.end_time = input;
self
}
/// <p>The end time of the insight. For example, <code>2018-10-30T00:00:00Z</code>.</p>
pub fn get_end_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.end_time
}
/// <p>The severity of the insight. The values are: <code>Low</code>, <code>Medium</code>, or <code>High</code>.</p>
pub fn severity(mut self, input: crate::types::Severity) -> Self {
self.severity = ::std::option::Option::Some(input);
self
}
/// <p>The severity of the insight. The values are: <code>Low</code>, <code>Medium</code>, or <code>High</code>.</p>
pub fn set_severity(mut self, input: ::std::option::Option<crate::types::Severity>) -> Self {
self.severity = input;
self
}
/// <p>The severity of the insight. The values are: <code>Low</code>, <code>Medium</code>, or <code>High</code>.</p>
pub fn get_severity(&self) -> &::std::option::Option<crate::types::Severity> {
&self.severity
}
/// Appends an item to `supporting_insights`.
///
/// To override the contents of this collection use [`set_supporting_insights`](Self::set_supporting_insights).
///
/// <p>List of supporting insights that provide additional factors for the insight.</p>
pub fn supporting_insights(mut self, input: crate::types::Insight) -> Self {
let mut v = self.supporting_insights.unwrap_or_default();
v.push(input);
self.supporting_insights = ::std::option::Option::Some(v);
self
}
/// <p>List of supporting insights that provide additional factors for the insight.</p>
pub fn set_supporting_insights(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Insight>>) -> Self {
self.supporting_insights = input;
self
}
/// <p>List of supporting insights that provide additional factors for the insight.</p>
pub fn get_supporting_insights(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Insight>> {
&self.supporting_insights
}
/// <p>Description of the insight. For example: <code>A high severity Insight found between 02:00 to 02:30, where there was an unusually high DB load 600x above baseline. Likely performance impact</code>.</p>
pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.description = ::std::option::Option::Some(input.into());
self
}
/// <p>Description of the insight. For example: <code>A high severity Insight found between 02:00 to 02:30, where there was an unusually high DB load 600x above baseline. Likely performance impact</code>.</p>
pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.description = input;
self
}
/// <p>Description of the insight. For example: <code>A high severity Insight found between 02:00 to 02:30, where there was an unusually high DB load 600x above baseline. Likely performance impact</code>.</p>
pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
&self.description
}
/// Appends an item to `recommendations`.
///
/// To override the contents of this collection use [`set_recommendations`](Self::set_recommendations).
///
/// <p>List of recommendations for the insight. For example, <code>Investigate the following SQLs that contributed to 100% of the total DBLoad during that time period: sql-id</code>.</p>
pub fn recommendations(mut self, input: crate::types::Recommendation) -> Self {
let mut v = self.recommendations.unwrap_or_default();
v.push(input);
self.recommendations = ::std::option::Option::Some(v);
self
}
/// <p>List of recommendations for the insight. For example, <code>Investigate the following SQLs that contributed to 100% of the total DBLoad during that time period: sql-id</code>.</p>
pub fn set_recommendations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Recommendation>>) -> Self {
self.recommendations = input;
self
}
/// <p>List of recommendations for the insight. For example, <code>Investigate the following SQLs that contributed to 100% of the total DBLoad during that time period: sql-id</code>.</p>
pub fn get_recommendations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Recommendation>> {
&self.recommendations
}
/// Appends an item to `insight_data`.
///
/// To override the contents of this collection use [`set_insight_data`](Self::set_insight_data).
///
/// <p>List of data objects containing metrics and references from the time range while generating the insight.</p>
pub fn insight_data(mut self, input: crate::types::Data) -> Self {
let mut v = self.insight_data.unwrap_or_default();
v.push(input);
self.insight_data = ::std::option::Option::Some(v);
self
}
/// <p>List of data objects containing metrics and references from the time range while generating the insight.</p>
pub fn set_insight_data(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Data>>) -> Self {
self.insight_data = input;
self
}
/// <p>List of data objects containing metrics and references from the time range while generating the insight.</p>
pub fn get_insight_data(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Data>> {
&self.insight_data
}
/// Appends an item to `baseline_data`.
///
/// To override the contents of this collection use [`set_baseline_data`](Self::set_baseline_data).
///
/// <p>Metric names and values from the timeframe used as baseline to generate the insight.</p>
pub fn baseline_data(mut self, input: crate::types::Data) -> Self {
let mut v = self.baseline_data.unwrap_or_default();
v.push(input);
self.baseline_data = ::std::option::Option::Some(v);
self
}
/// <p>Metric names and values from the timeframe used as baseline to generate the insight.</p>
pub fn set_baseline_data(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Data>>) -> Self {
self.baseline_data = input;
self
}
/// <p>Metric names and values from the timeframe used as baseline to generate the insight.</p>
pub fn get_baseline_data(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Data>> {
&self.baseline_data
}
/// Consumes the builder and constructs a [`Insight`](crate::types::Insight).
/// This method will fail if any of the following fields are not set:
/// - [`insight_id`](crate::types::builders::InsightBuilder::insight_id)
pub fn build(self) -> ::std::result::Result<crate::types::Insight, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Insight {
insight_id: self.insight_id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"insight_id",
"insight_id was not specified but it is required when building Insight",
)
})?,
insight_type: self.insight_type,
context: self.context,
start_time: self.start_time,
end_time: self.end_time,
severity: self.severity,
supporting_insights: self.supporting_insights,
description: self.description,
recommendations: self.recommendations,
insight_data: self.insight_data,
baseline_data: self.baseline_data,
})
}
}
impl ::std::fmt::Debug for InsightBuilder {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("InsightBuilder");
formatter.field("insight_id", &self.insight_id);
formatter.field("insight_type", &self.insight_type);
formatter.field("context", &self.context);
formatter.field("start_time", &self.start_time);
formatter.field("end_time", &self.end_time);
formatter.field("severity", &self.severity);
formatter.field("supporting_insights", &self.supporting_insights);
formatter.field("description", &"*** Sensitive Data Redacted ***");
formatter.field("recommendations", &self.recommendations);
formatter.field("insight_data", &self.insight_data);
formatter.field("baseline_data", &self.baseline_data);
formatter.finish()
}
}