aws-sdk-ec2 1.224.0

AWS SDK for Amazon Elastic Compute Cloud
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CreatePlacementGroupInput {
    /// <p>The number of partitions. Valid only when <b>Strategy</b> is set to <code>partition</code>.</p>
    pub partition_count: ::std::option::Option<i32>,
    /// <p>The tags to apply to the new placement group.</p>
    pub tag_specifications: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>,
    /// <p>Determines how placement groups spread instances.</p>
    /// <ul>
    /// <li>
    /// <p>Host – You can use <code>host</code> only with Outpost placement groups.</p></li>
    /// <li>
    /// <p>Rack – No usage restrictions.</p></li>
    /// </ul>
    pub spread_level: ::std::option::Option<crate::types::SpreadLevel>,
    /// <p>Reserved for future use.</p>
    pub linked_group_id: ::std::option::Option<::std::string::String>,
    /// <p>Reserved for internal use.</p>
    pub operator: ::std::option::Option<crate::types::OperatorRequest>,
    /// <p>Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
    pub dry_run: ::std::option::Option<bool>,
    /// <p>A name for the placement group. Must be unique within the scope of your account for the Region.</p>
    /// <p>Constraints: Up to 255 ASCII characters</p>
    pub group_name: ::std::option::Option<::std::string::String>,
    /// <p>The placement strategy.</p>
    pub strategy: ::std::option::Option<crate::types::PlacementStrategy>,
}
impl CreatePlacementGroupInput {
    /// <p>The number of partitions. Valid only when <b>Strategy</b> is set to <code>partition</code>.</p>
    pub fn partition_count(&self) -> ::std::option::Option<i32> {
        self.partition_count
    }
    /// <p>The tags to apply to the new placement group.</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 `.tag_specifications.is_none()`.
    pub fn tag_specifications(&self) -> &[crate::types::TagSpecification] {
        self.tag_specifications.as_deref().unwrap_or_default()
    }
    /// <p>Determines how placement groups spread instances.</p>
    /// <ul>
    /// <li>
    /// <p>Host – You can use <code>host</code> only with Outpost placement groups.</p></li>
    /// <li>
    /// <p>Rack – No usage restrictions.</p></li>
    /// </ul>
    pub fn spread_level(&self) -> ::std::option::Option<&crate::types::SpreadLevel> {
        self.spread_level.as_ref()
    }
    /// <p>Reserved for future use.</p>
    pub fn linked_group_id(&self) -> ::std::option::Option<&str> {
        self.linked_group_id.as_deref()
    }
    /// <p>Reserved for internal use.</p>
    pub fn operator(&self) -> ::std::option::Option<&crate::types::OperatorRequest> {
        self.operator.as_ref()
    }
    /// <p>Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
    pub fn dry_run(&self) -> ::std::option::Option<bool> {
        self.dry_run
    }
    /// <p>A name for the placement group. Must be unique within the scope of your account for the Region.</p>
    /// <p>Constraints: Up to 255 ASCII characters</p>
    pub fn group_name(&self) -> ::std::option::Option<&str> {
        self.group_name.as_deref()
    }
    /// <p>The placement strategy.</p>
    pub fn strategy(&self) -> ::std::option::Option<&crate::types::PlacementStrategy> {
        self.strategy.as_ref()
    }
}
impl CreatePlacementGroupInput {
    /// Creates a new builder-style object to manufacture [`CreatePlacementGroupInput`](crate::operation::create_placement_group::CreatePlacementGroupInput).
    pub fn builder() -> crate::operation::create_placement_group::builders::CreatePlacementGroupInputBuilder {
        crate::operation::create_placement_group::builders::CreatePlacementGroupInputBuilder::default()
    }
}

/// A builder for [`CreatePlacementGroupInput`](crate::operation::create_placement_group::CreatePlacementGroupInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CreatePlacementGroupInputBuilder {
    pub(crate) partition_count: ::std::option::Option<i32>,
    pub(crate) tag_specifications: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>,
    pub(crate) spread_level: ::std::option::Option<crate::types::SpreadLevel>,
    pub(crate) linked_group_id: ::std::option::Option<::std::string::String>,
    pub(crate) operator: ::std::option::Option<crate::types::OperatorRequest>,
    pub(crate) dry_run: ::std::option::Option<bool>,
    pub(crate) group_name: ::std::option::Option<::std::string::String>,
    pub(crate) strategy: ::std::option::Option<crate::types::PlacementStrategy>,
}
impl CreatePlacementGroupInputBuilder {
    /// <p>The number of partitions. Valid only when <b>Strategy</b> is set to <code>partition</code>.</p>
    pub fn partition_count(mut self, input: i32) -> Self {
        self.partition_count = ::std::option::Option::Some(input);
        self
    }
    /// <p>The number of partitions. Valid only when <b>Strategy</b> is set to <code>partition</code>.</p>
    pub fn set_partition_count(mut self, input: ::std::option::Option<i32>) -> Self {
        self.partition_count = input;
        self
    }
    /// <p>The number of partitions. Valid only when <b>Strategy</b> is set to <code>partition</code>.</p>
    pub fn get_partition_count(&self) -> &::std::option::Option<i32> {
        &self.partition_count
    }
    /// Appends an item to `tag_specifications`.
    ///
    /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
    ///
    /// <p>The tags to apply to the new placement group.</p>
    pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
        let mut v = self.tag_specifications.unwrap_or_default();
        v.push(input);
        self.tag_specifications = ::std::option::Option::Some(v);
        self
    }
    /// <p>The tags to apply to the new placement group.</p>
    pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
        self.tag_specifications = input;
        self
    }
    /// <p>The tags to apply to the new placement group.</p>
    pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
        &self.tag_specifications
    }
    /// <p>Determines how placement groups spread instances.</p>
    /// <ul>
    /// <li>
    /// <p>Host – You can use <code>host</code> only with Outpost placement groups.</p></li>
    /// <li>
    /// <p>Rack – No usage restrictions.</p></li>
    /// </ul>
    pub fn spread_level(mut self, input: crate::types::SpreadLevel) -> Self {
        self.spread_level = ::std::option::Option::Some(input);
        self
    }
    /// <p>Determines how placement groups spread instances.</p>
    /// <ul>
    /// <li>
    /// <p>Host – You can use <code>host</code> only with Outpost placement groups.</p></li>
    /// <li>
    /// <p>Rack – No usage restrictions.</p></li>
    /// </ul>
    pub fn set_spread_level(mut self, input: ::std::option::Option<crate::types::SpreadLevel>) -> Self {
        self.spread_level = input;
        self
    }
    /// <p>Determines how placement groups spread instances.</p>
    /// <ul>
    /// <li>
    /// <p>Host – You can use <code>host</code> only with Outpost placement groups.</p></li>
    /// <li>
    /// <p>Rack – No usage restrictions.</p></li>
    /// </ul>
    pub fn get_spread_level(&self) -> &::std::option::Option<crate::types::SpreadLevel> {
        &self.spread_level
    }
    /// <p>Reserved for future use.</p>
    pub fn linked_group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.linked_group_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Reserved for future use.</p>
    pub fn set_linked_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.linked_group_id = input;
        self
    }
    /// <p>Reserved for future use.</p>
    pub fn get_linked_group_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.linked_group_id
    }
    /// <p>Reserved for internal use.</p>
    pub fn operator(mut self, input: crate::types::OperatorRequest) -> Self {
        self.operator = ::std::option::Option::Some(input);
        self
    }
    /// <p>Reserved for internal use.</p>
    pub fn set_operator(mut self, input: ::std::option::Option<crate::types::OperatorRequest>) -> Self {
        self.operator = input;
        self
    }
    /// <p>Reserved for internal use.</p>
    pub fn get_operator(&self) -> &::std::option::Option<crate::types::OperatorRequest> {
        &self.operator
    }
    /// <p>Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
    pub fn dry_run(mut self, input: bool) -> Self {
        self.dry_run = ::std::option::Option::Some(input);
        self
    }
    /// <p>Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
        self.dry_run = input;
        self
    }
    /// <p>Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
        &self.dry_run
    }
    /// <p>A name for the placement group. Must be unique within the scope of your account for the Region.</p>
    /// <p>Constraints: Up to 255 ASCII characters</p>
    pub fn group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.group_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A name for the placement group. Must be unique within the scope of your account for the Region.</p>
    /// <p>Constraints: Up to 255 ASCII characters</p>
    pub fn set_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.group_name = input;
        self
    }
    /// <p>A name for the placement group. Must be unique within the scope of your account for the Region.</p>
    /// <p>Constraints: Up to 255 ASCII characters</p>
    pub fn get_group_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.group_name
    }
    /// <p>The placement strategy.</p>
    pub fn strategy(mut self, input: crate::types::PlacementStrategy) -> Self {
        self.strategy = ::std::option::Option::Some(input);
        self
    }
    /// <p>The placement strategy.</p>
    pub fn set_strategy(mut self, input: ::std::option::Option<crate::types::PlacementStrategy>) -> Self {
        self.strategy = input;
        self
    }
    /// <p>The placement strategy.</p>
    pub fn get_strategy(&self) -> &::std::option::Option<crate::types::PlacementStrategy> {
        &self.strategy
    }
    /// Consumes the builder and constructs a [`CreatePlacementGroupInput`](crate::operation::create_placement_group::CreatePlacementGroupInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::create_placement_group::CreatePlacementGroupInput, ::aws_smithy_types::error::operation::BuildError>
    {
        ::std::result::Result::Ok(crate::operation::create_placement_group::CreatePlacementGroupInput {
            partition_count: self.partition_count,
            tag_specifications: self.tag_specifications,
            spread_level: self.spread_level,
            linked_group_id: self.linked_group_id,
            operator: self.operator,
            dry_run: self.dry_run,
            group_name: self.group_name,
            strategy: self.strategy,
        })
    }
}