Skip to main content

aws_sdk_ec2/types/
_instance_credit_specification.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Describes the credit option for CPU usage of a burstable performance instance.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct InstanceCreditSpecification {
7    /// <p>The ID of the instance.</p>
8    pub instance_id: ::std::option::Option<::std::string::String>,
9    /// <p>The credit option for CPU usage of the instance.</p>
10    /// <p>Valid values: <code>standard</code> | <code>unlimited</code></p>
11    pub cpu_credits: ::std::option::Option<::std::string::String>,
12}
13impl InstanceCreditSpecification {
14    /// <p>The ID of the instance.</p>
15    pub fn instance_id(&self) -> ::std::option::Option<&str> {
16        self.instance_id.as_deref()
17    }
18    /// <p>The credit option for CPU usage of the instance.</p>
19    /// <p>Valid values: <code>standard</code> | <code>unlimited</code></p>
20    pub fn cpu_credits(&self) -> ::std::option::Option<&str> {
21        self.cpu_credits.as_deref()
22    }
23}
24impl InstanceCreditSpecification {
25    /// Creates a new builder-style object to manufacture [`InstanceCreditSpecification`](crate::types::InstanceCreditSpecification).
26    pub fn builder() -> crate::types::builders::InstanceCreditSpecificationBuilder {
27        crate::types::builders::InstanceCreditSpecificationBuilder::default()
28    }
29}
30
31/// A builder for [`InstanceCreditSpecification`](crate::types::InstanceCreditSpecification).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct InstanceCreditSpecificationBuilder {
35    pub(crate) instance_id: ::std::option::Option<::std::string::String>,
36    pub(crate) cpu_credits: ::std::option::Option<::std::string::String>,
37}
38impl InstanceCreditSpecificationBuilder {
39    /// <p>The ID of the instance.</p>
40    pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.instance_id = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>The ID of the instance.</p>
45    pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.instance_id = input;
47        self
48    }
49    /// <p>The ID of the instance.</p>
50    pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
51        &self.instance_id
52    }
53    /// <p>The credit option for CPU usage of the instance.</p>
54    /// <p>Valid values: <code>standard</code> | <code>unlimited</code></p>
55    pub fn cpu_credits(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
56        self.cpu_credits = ::std::option::Option::Some(input.into());
57        self
58    }
59    /// <p>The credit option for CPU usage of the instance.</p>
60    /// <p>Valid values: <code>standard</code> | <code>unlimited</code></p>
61    pub fn set_cpu_credits(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
62        self.cpu_credits = input;
63        self
64    }
65    /// <p>The credit option for CPU usage of the instance.</p>
66    /// <p>Valid values: <code>standard</code> | <code>unlimited</code></p>
67    pub fn get_cpu_credits(&self) -> &::std::option::Option<::std::string::String> {
68        &self.cpu_credits
69    }
70    /// Consumes the builder and constructs a [`InstanceCreditSpecification`](crate::types::InstanceCreditSpecification).
71    pub fn build(self) -> crate::types::InstanceCreditSpecification {
72        crate::types::InstanceCreditSpecification {
73            instance_id: self.instance_id,
74            cpu_credits: self.cpu_credits,
75        }
76    }
77}