aws_sdk_computeoptimizer/types/_lambda_function_utilization_metric.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Describes a utilization metric of an Lambda function.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct LambdaFunctionUtilizationMetric {
7 /// <p>The name of the utilization metric.</p>
8 /// <p>The following utilization metrics are available:</p>
9 /// <ul>
10 /// <li>
11 /// <p><code>Duration</code> - The amount of time that your function code spends processing an event.</p></li>
12 /// <li>
13 /// <p><code>Memory</code> - The amount of memory used per invocation.</p></li>
14 /// </ul>
15 pub name: ::std::option::Option<crate::types::LambdaFunctionMetricName>,
16 /// <p>The statistic of the utilization metric.</p>
17 /// <p>The Compute Optimizer API, Command Line Interface (CLI), and SDKs return utilization metrics using only the <code>Maximum</code> statistic, which is the highest value observed during the specified period.</p>
18 /// <p>The Compute Optimizer console displays graphs for some utilization metrics using the <code>Average</code> statistic, which is the value of <code>Sum</code> / <code>SampleCount</code> during the specified period. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/viewing-recommendations.html">Viewing resource recommendations</a> in the <i>Compute Optimizer User Guide</i>. You can also get averaged utilization metric data for your resources using Amazon CloudWatch. For more information, see the <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html">Amazon CloudWatch User Guide</a>.</p>
19 pub statistic: ::std::option::Option<crate::types::LambdaFunctionMetricStatistic>,
20 /// <p>The value of the utilization metric.</p>
21 pub value: f64,
22}
23impl LambdaFunctionUtilizationMetric {
24 /// <p>The name of the utilization metric.</p>
25 /// <p>The following utilization metrics are available:</p>
26 /// <ul>
27 /// <li>
28 /// <p><code>Duration</code> - The amount of time that your function code spends processing an event.</p></li>
29 /// <li>
30 /// <p><code>Memory</code> - The amount of memory used per invocation.</p></li>
31 /// </ul>
32 pub fn name(&self) -> ::std::option::Option<&crate::types::LambdaFunctionMetricName> {
33 self.name.as_ref()
34 }
35 /// <p>The statistic of the utilization metric.</p>
36 /// <p>The Compute Optimizer API, Command Line Interface (CLI), and SDKs return utilization metrics using only the <code>Maximum</code> statistic, which is the highest value observed during the specified period.</p>
37 /// <p>The Compute Optimizer console displays graphs for some utilization metrics using the <code>Average</code> statistic, which is the value of <code>Sum</code> / <code>SampleCount</code> during the specified period. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/viewing-recommendations.html">Viewing resource recommendations</a> in the <i>Compute Optimizer User Guide</i>. You can also get averaged utilization metric data for your resources using Amazon CloudWatch. For more information, see the <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html">Amazon CloudWatch User Guide</a>.</p>
38 pub fn statistic(&self) -> ::std::option::Option<&crate::types::LambdaFunctionMetricStatistic> {
39 self.statistic.as_ref()
40 }
41 /// <p>The value of the utilization metric.</p>
42 pub fn value(&self) -> f64 {
43 self.value
44 }
45}
46impl LambdaFunctionUtilizationMetric {
47 /// Creates a new builder-style object to manufacture [`LambdaFunctionUtilizationMetric`](crate::types::LambdaFunctionUtilizationMetric).
48 pub fn builder() -> crate::types::builders::LambdaFunctionUtilizationMetricBuilder {
49 crate::types::builders::LambdaFunctionUtilizationMetricBuilder::default()
50 }
51}
52
53/// A builder for [`LambdaFunctionUtilizationMetric`](crate::types::LambdaFunctionUtilizationMetric).
54#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
55#[non_exhaustive]
56pub struct LambdaFunctionUtilizationMetricBuilder {
57 pub(crate) name: ::std::option::Option<crate::types::LambdaFunctionMetricName>,
58 pub(crate) statistic: ::std::option::Option<crate::types::LambdaFunctionMetricStatistic>,
59 pub(crate) value: ::std::option::Option<f64>,
60}
61impl LambdaFunctionUtilizationMetricBuilder {
62 /// <p>The name of the utilization metric.</p>
63 /// <p>The following utilization metrics are available:</p>
64 /// <ul>
65 /// <li>
66 /// <p><code>Duration</code> - The amount of time that your function code spends processing an event.</p></li>
67 /// <li>
68 /// <p><code>Memory</code> - The amount of memory used per invocation.</p></li>
69 /// </ul>
70 pub fn name(mut self, input: crate::types::LambdaFunctionMetricName) -> Self {
71 self.name = ::std::option::Option::Some(input);
72 self
73 }
74 /// <p>The name of the utilization metric.</p>
75 /// <p>The following utilization metrics are available:</p>
76 /// <ul>
77 /// <li>
78 /// <p><code>Duration</code> - The amount of time that your function code spends processing an event.</p></li>
79 /// <li>
80 /// <p><code>Memory</code> - The amount of memory used per invocation.</p></li>
81 /// </ul>
82 pub fn set_name(mut self, input: ::std::option::Option<crate::types::LambdaFunctionMetricName>) -> Self {
83 self.name = input;
84 self
85 }
86 /// <p>The name of the utilization metric.</p>
87 /// <p>The following utilization metrics are available:</p>
88 /// <ul>
89 /// <li>
90 /// <p><code>Duration</code> - The amount of time that your function code spends processing an event.</p></li>
91 /// <li>
92 /// <p><code>Memory</code> - The amount of memory used per invocation.</p></li>
93 /// </ul>
94 pub fn get_name(&self) -> &::std::option::Option<crate::types::LambdaFunctionMetricName> {
95 &self.name
96 }
97 /// <p>The statistic of the utilization metric.</p>
98 /// <p>The Compute Optimizer API, Command Line Interface (CLI), and SDKs return utilization metrics using only the <code>Maximum</code> statistic, which is the highest value observed during the specified period.</p>
99 /// <p>The Compute Optimizer console displays graphs for some utilization metrics using the <code>Average</code> statistic, which is the value of <code>Sum</code> / <code>SampleCount</code> during the specified period. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/viewing-recommendations.html">Viewing resource recommendations</a> in the <i>Compute Optimizer User Guide</i>. You can also get averaged utilization metric data for your resources using Amazon CloudWatch. For more information, see the <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html">Amazon CloudWatch User Guide</a>.</p>
100 pub fn statistic(mut self, input: crate::types::LambdaFunctionMetricStatistic) -> Self {
101 self.statistic = ::std::option::Option::Some(input);
102 self
103 }
104 /// <p>The statistic of the utilization metric.</p>
105 /// <p>The Compute Optimizer API, Command Line Interface (CLI), and SDKs return utilization metrics using only the <code>Maximum</code> statistic, which is the highest value observed during the specified period.</p>
106 /// <p>The Compute Optimizer console displays graphs for some utilization metrics using the <code>Average</code> statistic, which is the value of <code>Sum</code> / <code>SampleCount</code> during the specified period. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/viewing-recommendations.html">Viewing resource recommendations</a> in the <i>Compute Optimizer User Guide</i>. You can also get averaged utilization metric data for your resources using Amazon CloudWatch. For more information, see the <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html">Amazon CloudWatch User Guide</a>.</p>
107 pub fn set_statistic(mut self, input: ::std::option::Option<crate::types::LambdaFunctionMetricStatistic>) -> Self {
108 self.statistic = input;
109 self
110 }
111 /// <p>The statistic of the utilization metric.</p>
112 /// <p>The Compute Optimizer API, Command Line Interface (CLI), and SDKs return utilization metrics using only the <code>Maximum</code> statistic, which is the highest value observed during the specified period.</p>
113 /// <p>The Compute Optimizer console displays graphs for some utilization metrics using the <code>Average</code> statistic, which is the value of <code>Sum</code> / <code>SampleCount</code> during the specified period. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/viewing-recommendations.html">Viewing resource recommendations</a> in the <i>Compute Optimizer User Guide</i>. You can also get averaged utilization metric data for your resources using Amazon CloudWatch. For more information, see the <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html">Amazon CloudWatch User Guide</a>.</p>
114 pub fn get_statistic(&self) -> &::std::option::Option<crate::types::LambdaFunctionMetricStatistic> {
115 &self.statistic
116 }
117 /// <p>The value of the utilization metric.</p>
118 pub fn value(mut self, input: f64) -> Self {
119 self.value = ::std::option::Option::Some(input);
120 self
121 }
122 /// <p>The value of the utilization metric.</p>
123 pub fn set_value(mut self, input: ::std::option::Option<f64>) -> Self {
124 self.value = input;
125 self
126 }
127 /// <p>The value of the utilization metric.</p>
128 pub fn get_value(&self) -> &::std::option::Option<f64> {
129 &self.value
130 }
131 /// Consumes the builder and constructs a [`LambdaFunctionUtilizationMetric`](crate::types::LambdaFunctionUtilizationMetric).
132 pub fn build(self) -> crate::types::LambdaFunctionUtilizationMetric {
133 crate::types::LambdaFunctionUtilizationMetric {
134 name: self.name,
135 statistic: self.statistic,
136 value: self.value.unwrap_or_default(),
137 }
138 }
139}