aws-sdk-iot 1.112.0

AWS SDK for AWS IoT
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The input for the CreatePolicyVersion operation.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CreatePolicyVersionInput {
    /// <p>The policy name.</p>
    pub policy_name: ::std::option::Option<::std::string::String>,
    /// <p>The JSON document that describes the policy. Minimum length of 1. Maximum length of 2048, excluding whitespace.</p>
    pub policy_document: ::std::option::Option<::std::string::String>,
    /// <p>Specifies whether the policy version is set as the default. When this parameter is true, the new policy version becomes the operative version (that is, the version that is in effect for the certificates to which the policy is attached).</p>
    pub set_as_default: ::std::option::Option<bool>,
}
impl CreatePolicyVersionInput {
    /// <p>The policy name.</p>
    pub fn policy_name(&self) -> ::std::option::Option<&str> {
        self.policy_name.as_deref()
    }
    /// <p>The JSON document that describes the policy. Minimum length of 1. Maximum length of 2048, excluding whitespace.</p>
    pub fn policy_document(&self) -> ::std::option::Option<&str> {
        self.policy_document.as_deref()
    }
    /// <p>Specifies whether the policy version is set as the default. When this parameter is true, the new policy version becomes the operative version (that is, the version that is in effect for the certificates to which the policy is attached).</p>
    pub fn set_as_default(&self) -> ::std::option::Option<bool> {
        self.set_as_default
    }
}
impl CreatePolicyVersionInput {
    /// Creates a new builder-style object to manufacture [`CreatePolicyVersionInput`](crate::operation::create_policy_version::CreatePolicyVersionInput).
    pub fn builder() -> crate::operation::create_policy_version::builders::CreatePolicyVersionInputBuilder {
        crate::operation::create_policy_version::builders::CreatePolicyVersionInputBuilder::default()
    }
}

/// A builder for [`CreatePolicyVersionInput`](crate::operation::create_policy_version::CreatePolicyVersionInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CreatePolicyVersionInputBuilder {
    pub(crate) policy_name: ::std::option::Option<::std::string::String>,
    pub(crate) policy_document: ::std::option::Option<::std::string::String>,
    pub(crate) set_as_default: ::std::option::Option<bool>,
}
impl CreatePolicyVersionInputBuilder {
    /// <p>The policy name.</p>
    /// This field is required.
    pub fn policy_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.policy_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The policy name.</p>
    pub fn set_policy_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.policy_name = input;
        self
    }
    /// <p>The policy name.</p>
    pub fn get_policy_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.policy_name
    }
    /// <p>The JSON document that describes the policy. Minimum length of 1. Maximum length of 2048, excluding whitespace.</p>
    /// This field is required.
    pub fn policy_document(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.policy_document = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The JSON document that describes the policy. Minimum length of 1. Maximum length of 2048, excluding whitespace.</p>
    pub fn set_policy_document(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.policy_document = input;
        self
    }
    /// <p>The JSON document that describes the policy. Minimum length of 1. Maximum length of 2048, excluding whitespace.</p>
    pub fn get_policy_document(&self) -> &::std::option::Option<::std::string::String> {
        &self.policy_document
    }
    /// <p>Specifies whether the policy version is set as the default. When this parameter is true, the new policy version becomes the operative version (that is, the version that is in effect for the certificates to which the policy is attached).</p>
    pub fn set_as_default(mut self, input: bool) -> Self {
        self.set_as_default = ::std::option::Option::Some(input);
        self
    }
    /// <p>Specifies whether the policy version is set as the default. When this parameter is true, the new policy version becomes the operative version (that is, the version that is in effect for the certificates to which the policy is attached).</p>
    pub fn set_set_as_default(mut self, input: ::std::option::Option<bool>) -> Self {
        self.set_as_default = input;
        self
    }
    /// <p>Specifies whether the policy version is set as the default. When this parameter is true, the new policy version becomes the operative version (that is, the version that is in effect for the certificates to which the policy is attached).</p>
    pub fn get_set_as_default(&self) -> &::std::option::Option<bool> {
        &self.set_as_default
    }
    /// Consumes the builder and constructs a [`CreatePolicyVersionInput`](crate::operation::create_policy_version::CreatePolicyVersionInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::create_policy_version::CreatePolicyVersionInput, ::aws_smithy_types::error::operation::BuildError>
    {
        ::std::result::Result::Ok(crate::operation::create_policy_version::CreatePolicyVersionInput {
            policy_name: self.policy_name,
            policy_document: self.policy_document,
            set_as_default: self.set_as_default,
        })
    }
}