aws-sdk-xray 1.93.0

AWS SDK for AWS X-Ray
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 PutResourcePolicyInput {
    /// <p>The name of the resource policy. Must be unique within a specific Amazon Web Services account.</p>
    pub policy_name: ::std::option::Option<::std::string::String>,
    /// <p>The resource policy document, which can be up to 5kb in size.</p>
    pub policy_document: ::std::option::Option<::std::string::String>,
    /// <p>Specifies a specific policy revision, to ensure an atomic create operation. By default the resource policy is created if it does not exist, or updated with an incremented revision id. The revision id is unique to each policy in the account.</p>
    /// <p>If the policy revision id does not match the latest revision id, the operation will fail with an <code>InvalidPolicyRevisionIdException</code> exception. You can also provide a <code>PolicyRevisionId</code> of 0. In this case, the operation will fail with an <code>InvalidPolicyRevisionIdException</code> exception if a resource policy with the same name already exists.</p>
    pub policy_revision_id: ::std::option::Option<::std::string::String>,
    /// <p>A flag to indicate whether to bypass the resource policy lockout safety check.</p><important>
    /// <p>Setting this value to true increases the risk that the policy becomes unmanageable. Do not set this value to true indiscriminately.</p>
    /// </important>
    /// <p>Use this parameter only when you include a policy in the request and you intend to prevent the principal that is making the request from making a subsequent <code>PutResourcePolicy</code> request.</p>
    /// <p>The default value is false.</p>
    pub bypass_policy_lockout_check: ::std::option::Option<bool>,
}
impl PutResourcePolicyInput {
    /// <p>The name of the resource policy. Must be unique within a specific Amazon Web Services account.</p>
    pub fn policy_name(&self) -> ::std::option::Option<&str> {
        self.policy_name.as_deref()
    }
    /// <p>The resource policy document, which can be up to 5kb in size.</p>
    pub fn policy_document(&self) -> ::std::option::Option<&str> {
        self.policy_document.as_deref()
    }
    /// <p>Specifies a specific policy revision, to ensure an atomic create operation. By default the resource policy is created if it does not exist, or updated with an incremented revision id. The revision id is unique to each policy in the account.</p>
    /// <p>If the policy revision id does not match the latest revision id, the operation will fail with an <code>InvalidPolicyRevisionIdException</code> exception. You can also provide a <code>PolicyRevisionId</code> of 0. In this case, the operation will fail with an <code>InvalidPolicyRevisionIdException</code> exception if a resource policy with the same name already exists.</p>
    pub fn policy_revision_id(&self) -> ::std::option::Option<&str> {
        self.policy_revision_id.as_deref()
    }
    /// <p>A flag to indicate whether to bypass the resource policy lockout safety check.</p><important>
    /// <p>Setting this value to true increases the risk that the policy becomes unmanageable. Do not set this value to true indiscriminately.</p>
    /// </important>
    /// <p>Use this parameter only when you include a policy in the request and you intend to prevent the principal that is making the request from making a subsequent <code>PutResourcePolicy</code> request.</p>
    /// <p>The default value is false.</p>
    pub fn bypass_policy_lockout_check(&self) -> ::std::option::Option<bool> {
        self.bypass_policy_lockout_check
    }
}
impl PutResourcePolicyInput {
    /// Creates a new builder-style object to manufacture [`PutResourcePolicyInput`](crate::operation::put_resource_policy::PutResourcePolicyInput).
    pub fn builder() -> crate::operation::put_resource_policy::builders::PutResourcePolicyInputBuilder {
        crate::operation::put_resource_policy::builders::PutResourcePolicyInputBuilder::default()
    }
}

/// A builder for [`PutResourcePolicyInput`](crate::operation::put_resource_policy::PutResourcePolicyInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PutResourcePolicyInputBuilder {
    pub(crate) policy_name: ::std::option::Option<::std::string::String>,
    pub(crate) policy_document: ::std::option::Option<::std::string::String>,
    pub(crate) policy_revision_id: ::std::option::Option<::std::string::String>,
    pub(crate) bypass_policy_lockout_check: ::std::option::Option<bool>,
}
impl PutResourcePolicyInputBuilder {
    /// <p>The name of the resource policy. Must be unique within a specific Amazon Web Services account.</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 name of the resource policy. Must be unique within a specific Amazon Web Services account.</p>
    pub fn set_policy_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.policy_name = input;
        self
    }
    /// <p>The name of the resource policy. Must be unique within a specific Amazon Web Services account.</p>
    pub fn get_policy_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.policy_name
    }
    /// <p>The resource policy document, which can be up to 5kb in size.</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 resource policy document, which can be up to 5kb in size.</p>
    pub fn set_policy_document(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.policy_document = input;
        self
    }
    /// <p>The resource policy document, which can be up to 5kb in size.</p>
    pub fn get_policy_document(&self) -> &::std::option::Option<::std::string::String> {
        &self.policy_document
    }
    /// <p>Specifies a specific policy revision, to ensure an atomic create operation. By default the resource policy is created if it does not exist, or updated with an incremented revision id. The revision id is unique to each policy in the account.</p>
    /// <p>If the policy revision id does not match the latest revision id, the operation will fail with an <code>InvalidPolicyRevisionIdException</code> exception. You can also provide a <code>PolicyRevisionId</code> of 0. In this case, the operation will fail with an <code>InvalidPolicyRevisionIdException</code> exception if a resource policy with the same name already exists.</p>
    pub fn policy_revision_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.policy_revision_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Specifies a specific policy revision, to ensure an atomic create operation. By default the resource policy is created if it does not exist, or updated with an incremented revision id. The revision id is unique to each policy in the account.</p>
    /// <p>If the policy revision id does not match the latest revision id, the operation will fail with an <code>InvalidPolicyRevisionIdException</code> exception. You can also provide a <code>PolicyRevisionId</code> of 0. In this case, the operation will fail with an <code>InvalidPolicyRevisionIdException</code> exception if a resource policy with the same name already exists.</p>
    pub fn set_policy_revision_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.policy_revision_id = input;
        self
    }
    /// <p>Specifies a specific policy revision, to ensure an atomic create operation. By default the resource policy is created if it does not exist, or updated with an incremented revision id. The revision id is unique to each policy in the account.</p>
    /// <p>If the policy revision id does not match the latest revision id, the operation will fail with an <code>InvalidPolicyRevisionIdException</code> exception. You can also provide a <code>PolicyRevisionId</code> of 0. In this case, the operation will fail with an <code>InvalidPolicyRevisionIdException</code> exception if a resource policy with the same name already exists.</p>
    pub fn get_policy_revision_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.policy_revision_id
    }
    /// <p>A flag to indicate whether to bypass the resource policy lockout safety check.</p><important>
    /// <p>Setting this value to true increases the risk that the policy becomes unmanageable. Do not set this value to true indiscriminately.</p>
    /// </important>
    /// <p>Use this parameter only when you include a policy in the request and you intend to prevent the principal that is making the request from making a subsequent <code>PutResourcePolicy</code> request.</p>
    /// <p>The default value is false.</p>
    pub fn bypass_policy_lockout_check(mut self, input: bool) -> Self {
        self.bypass_policy_lockout_check = ::std::option::Option::Some(input);
        self
    }
    /// <p>A flag to indicate whether to bypass the resource policy lockout safety check.</p><important>
    /// <p>Setting this value to true increases the risk that the policy becomes unmanageable. Do not set this value to true indiscriminately.</p>
    /// </important>
    /// <p>Use this parameter only when you include a policy in the request and you intend to prevent the principal that is making the request from making a subsequent <code>PutResourcePolicy</code> request.</p>
    /// <p>The default value is false.</p>
    pub fn set_bypass_policy_lockout_check(mut self, input: ::std::option::Option<bool>) -> Self {
        self.bypass_policy_lockout_check = input;
        self
    }
    /// <p>A flag to indicate whether to bypass the resource policy lockout safety check.</p><important>
    /// <p>Setting this value to true increases the risk that the policy becomes unmanageable. Do not set this value to true indiscriminately.</p>
    /// </important>
    /// <p>Use this parameter only when you include a policy in the request and you intend to prevent the principal that is making the request from making a subsequent <code>PutResourcePolicy</code> request.</p>
    /// <p>The default value is false.</p>
    pub fn get_bypass_policy_lockout_check(&self) -> &::std::option::Option<bool> {
        &self.bypass_policy_lockout_check
    }
    /// Consumes the builder and constructs a [`PutResourcePolicyInput`](crate::operation::put_resource_policy::PutResourcePolicyInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::put_resource_policy::PutResourcePolicyInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::put_resource_policy::PutResourcePolicyInput {
            policy_name: self.policy_name,
            policy_document: self.policy_document,
            policy_revision_id: self.policy_revision_id,
            bypass_policy_lockout_check: self.bypass_policy_lockout_check,
        })
    }
}