// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Describes the scope of a recommendation preference.</p>
/// <p>Recommendation preferences can be created at the organization level (for management accounts of an organization only), account level, and resource level. For more information, see <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/enhanced-infrastructure-metrics.html">Activating enhanced infrastructure metrics</a> in the <i>Compute Optimizer User Guide</i>.</p><note>
/// <p>You cannot create recommendation preferences for Amazon EC2 Auto Scaling groups at the organization and account levels. You can create recommendation preferences for Amazon EC2 Auto Scaling groups only at the resource level by specifying a scope name of <code>ResourceArn</code> and a scope value of the Amazon EC2 Auto Scaling group Amazon Resource Name (ARN). This will configure the preference for all instances that are part of the specified Amazon EC2 Auto Scaling group. You also cannot create recommendation preferences at the resource level for instances that are part of an Amazon EC2 Auto Scaling group. You can create recommendation preferences at the resource level only for standalone instances.</p>
/// </note>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Scope {
/// <p>The name of the scope.</p>
/// <p>The following scopes are possible:</p>
/// <ul>
/// <li>
/// <p><code>Organization</code> - Specifies that the recommendation preference applies at the organization level, for all member accounts of an organization.</p></li>
/// <li>
/// <p><code>AccountId</code> - Specifies that the recommendation preference applies at the account level, for all resources of a given resource type in an account.</p></li>
/// <li>
/// <p><code>ResourceArn</code> - Specifies that the recommendation preference applies at the individual resource level.</p></li>
/// </ul>
pub name: ::std::option::Option<crate::types::ScopeName>,
/// <p>The value of the scope.</p>
/// <p>If you specified the <code>name</code> of the scope as:</p>
/// <ul>
/// <li>
/// <p><code>Organization</code> - The <code>value</code> must be <code>ALL_ACCOUNTS</code>.</p></li>
/// <li>
/// <p><code>AccountId</code> - The <code>value</code> must be a 12-digit Amazon Web Services account ID.</p></li>
/// <li>
/// <p><code>ResourceArn</code> - The <code>value</code> must be the Amazon Resource Name (ARN) of an EC2 instance or an Amazon EC2 Auto Scaling group.</p></li>
/// </ul>
/// <p>Only EC2 instance and Amazon EC2 Auto Scaling group ARNs are currently supported.</p>
pub value: ::std::option::Option<::std::string::String>,
}
impl Scope {
/// <p>The name of the scope.</p>
/// <p>The following scopes are possible:</p>
/// <ul>
/// <li>
/// <p><code>Organization</code> - Specifies that the recommendation preference applies at the organization level, for all member accounts of an organization.</p></li>
/// <li>
/// <p><code>AccountId</code> - Specifies that the recommendation preference applies at the account level, for all resources of a given resource type in an account.</p></li>
/// <li>
/// <p><code>ResourceArn</code> - Specifies that the recommendation preference applies at the individual resource level.</p></li>
/// </ul>
pub fn name(&self) -> ::std::option::Option<&crate::types::ScopeName> {
self.name.as_ref()
}
/// <p>The value of the scope.</p>
/// <p>If you specified the <code>name</code> of the scope as:</p>
/// <ul>
/// <li>
/// <p><code>Organization</code> - The <code>value</code> must be <code>ALL_ACCOUNTS</code>.</p></li>
/// <li>
/// <p><code>AccountId</code> - The <code>value</code> must be a 12-digit Amazon Web Services account ID.</p></li>
/// <li>
/// <p><code>ResourceArn</code> - The <code>value</code> must be the Amazon Resource Name (ARN) of an EC2 instance or an Amazon EC2 Auto Scaling group.</p></li>
/// </ul>
/// <p>Only EC2 instance and Amazon EC2 Auto Scaling group ARNs are currently supported.</p>
pub fn value(&self) -> ::std::option::Option<&str> {
self.value.as_deref()
}
}
impl Scope {
/// Creates a new builder-style object to manufacture [`Scope`](crate::types::Scope).
pub fn builder() -> crate::types::builders::ScopeBuilder {
crate::types::builders::ScopeBuilder::default()
}
}
/// A builder for [`Scope`](crate::types::Scope).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ScopeBuilder {
pub(crate) name: ::std::option::Option<crate::types::ScopeName>,
pub(crate) value: ::std::option::Option<::std::string::String>,
}
impl ScopeBuilder {
/// <p>The name of the scope.</p>
/// <p>The following scopes are possible:</p>
/// <ul>
/// <li>
/// <p><code>Organization</code> - Specifies that the recommendation preference applies at the organization level, for all member accounts of an organization.</p></li>
/// <li>
/// <p><code>AccountId</code> - Specifies that the recommendation preference applies at the account level, for all resources of a given resource type in an account.</p></li>
/// <li>
/// <p><code>ResourceArn</code> - Specifies that the recommendation preference applies at the individual resource level.</p></li>
/// </ul>
pub fn name(mut self, input: crate::types::ScopeName) -> Self {
self.name = ::std::option::Option::Some(input);
self
}
/// <p>The name of the scope.</p>
/// <p>The following scopes are possible:</p>
/// <ul>
/// <li>
/// <p><code>Organization</code> - Specifies that the recommendation preference applies at the organization level, for all member accounts of an organization.</p></li>
/// <li>
/// <p><code>AccountId</code> - Specifies that the recommendation preference applies at the account level, for all resources of a given resource type in an account.</p></li>
/// <li>
/// <p><code>ResourceArn</code> - Specifies that the recommendation preference applies at the individual resource level.</p></li>
/// </ul>
pub fn set_name(mut self, input: ::std::option::Option<crate::types::ScopeName>) -> Self {
self.name = input;
self
}
/// <p>The name of the scope.</p>
/// <p>The following scopes are possible:</p>
/// <ul>
/// <li>
/// <p><code>Organization</code> - Specifies that the recommendation preference applies at the organization level, for all member accounts of an organization.</p></li>
/// <li>
/// <p><code>AccountId</code> - Specifies that the recommendation preference applies at the account level, for all resources of a given resource type in an account.</p></li>
/// <li>
/// <p><code>ResourceArn</code> - Specifies that the recommendation preference applies at the individual resource level.</p></li>
/// </ul>
pub fn get_name(&self) -> &::std::option::Option<crate::types::ScopeName> {
&self.name
}
/// <p>The value of the scope.</p>
/// <p>If you specified the <code>name</code> of the scope as:</p>
/// <ul>
/// <li>
/// <p><code>Organization</code> - The <code>value</code> must be <code>ALL_ACCOUNTS</code>.</p></li>
/// <li>
/// <p><code>AccountId</code> - The <code>value</code> must be a 12-digit Amazon Web Services account ID.</p></li>
/// <li>
/// <p><code>ResourceArn</code> - The <code>value</code> must be the Amazon Resource Name (ARN) of an EC2 instance or an Amazon EC2 Auto Scaling group.</p></li>
/// </ul>
/// <p>Only EC2 instance and Amazon EC2 Auto Scaling group ARNs are currently supported.</p>
pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.value = ::std::option::Option::Some(input.into());
self
}
/// <p>The value of the scope.</p>
/// <p>If you specified the <code>name</code> of the scope as:</p>
/// <ul>
/// <li>
/// <p><code>Organization</code> - The <code>value</code> must be <code>ALL_ACCOUNTS</code>.</p></li>
/// <li>
/// <p><code>AccountId</code> - The <code>value</code> must be a 12-digit Amazon Web Services account ID.</p></li>
/// <li>
/// <p><code>ResourceArn</code> - The <code>value</code> must be the Amazon Resource Name (ARN) of an EC2 instance or an Amazon EC2 Auto Scaling group.</p></li>
/// </ul>
/// <p>Only EC2 instance and Amazon EC2 Auto Scaling group ARNs are currently supported.</p>
pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.value = input;
self
}
/// <p>The value of the scope.</p>
/// <p>If you specified the <code>name</code> of the scope as:</p>
/// <ul>
/// <li>
/// <p><code>Organization</code> - The <code>value</code> must be <code>ALL_ACCOUNTS</code>.</p></li>
/// <li>
/// <p><code>AccountId</code> - The <code>value</code> must be a 12-digit Amazon Web Services account ID.</p></li>
/// <li>
/// <p><code>ResourceArn</code> - The <code>value</code> must be the Amazon Resource Name (ARN) of an EC2 instance or an Amazon EC2 Auto Scaling group.</p></li>
/// </ul>
/// <p>Only EC2 instance and Amazon EC2 Auto Scaling group ARNs are currently supported.</p>
pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
&self.value
}
/// Consumes the builder and constructs a [`Scope`](crate::types::Scope).
pub fn build(self) -> crate::types::Scope {
crate::types::Scope {
name: self.name,
value: self.value,
}
}
}