Skip to main content

aws_sdk_secretsmanager/client/
put_resource_policy.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2impl super::Client {
3    /// Constructs a fluent builder for the [`PutResourcePolicy`](crate::operation::put_resource_policy::builders::PutResourcePolicyFluentBuilder) operation.
4    ///
5    /// - The fluent builder is configurable:
6    ///   - [`secret_id(impl Into<String>)`](crate::operation::put_resource_policy::builders::PutResourcePolicyFluentBuilder::secret_id) / [`set_secret_id(Option<String>)`](crate::operation::put_resource_policy::builders::PutResourcePolicyFluentBuilder::set_secret_id):<br>required: **true**<br><p>The ARN or name of the secret to attach the resource-based policy.</p> <p>For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen">Finding a secret from a partial ARN</a>.</p><br>
7    ///   - [`resource_policy(impl Into<String>)`](crate::operation::put_resource_policy::builders::PutResourcePolicyFluentBuilder::resource_policy) / [`set_resource_policy(Option<String>)`](crate::operation::put_resource_policy::builders::PutResourcePolicyFluentBuilder::set_resource_policy):<br>required: **true**<br><p>A JSON-formatted string for an Amazon Web Services resource-based policy. For example policies, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples.html">Permissions policy examples</a>.</p><br>
8    ///   - [`policy_name(impl Into<String>)`](crate::operation::put_resource_policy::builders::PutResourcePolicyFluentBuilder::policy_name) / [`set_policy_name(Option<String>)`](crate::operation::put_resource_policy::builders::PutResourcePolicyFluentBuilder::set_policy_name):<br>required: **false**<br><p>The name of the resource policy to attach. If you don't specify this field, Secrets Manager uses <code>default</code>. You can only attach the <code>default</code> policy; if you specify any other name, the operation returns an <code>InvalidParameterException</code>.</p><br>
9    ///   - [`block_public_policy(bool)`](crate::operation::put_resource_policy::builders::PutResourcePolicyFluentBuilder::block_public_policy) / [`set_block_public_policy(Option<bool>)`](crate::operation::put_resource_policy::builders::PutResourcePolicyFluentBuilder::set_block_public_policy):<br>required: **false**<br><p>Specifies whether to block resource-based policies that allow broad access to the secret, for example those that use a wildcard for the principal. By default, public policies aren't blocked.</p><important>  <p>Resource policy validation and the BlockPublicPolicy parameter help protect your resources by preventing public access from being granted through the resource policies that are directly attached to your secrets. In addition to using these features, carefully inspect the following policies to confirm that they do not grant public access:</p>  <ul>   <li>    <p>Identity-based policies attached to associated Amazon Web Services principals (for example, IAM roles)</p></li>   <li>    <p>Resource-based policies attached to associated Amazon Web Services resources (for example, Key Management Service (KMS) keys)</p></li>  </ul>  <p>To review permissions to your secrets, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/determine-acccess_examine-iam-policies.html">Determine who has permissions to your secrets</a>.</p> </important><br>
10    /// - On success, responds with [`PutResourcePolicyOutput`](crate::operation::put_resource_policy::PutResourcePolicyOutput) with field(s):
11    ///   - [`arn(Option<String>)`](crate::operation::put_resource_policy::PutResourcePolicyOutput::arn): <p>The ARN of the secret.</p>
12    ///   - [`name(Option<String>)`](crate::operation::put_resource_policy::PutResourcePolicyOutput::name): <p>The name of the secret.</p>
13    ///   - [`policy_name(Option<String>)`](crate::operation::put_resource_policy::PutResourcePolicyOutput::policy_name): <p>The name of the resource policy. If you didn't specify <code>PolicyName</code> in the request, this is <code>default</code>.</p>
14    /// - On failure, responds with [`SdkError<PutResourcePolicyError>`](crate::operation::put_resource_policy::PutResourcePolicyError)
15    pub fn put_resource_policy(&self) -> crate::operation::put_resource_policy::builders::PutResourcePolicyFluentBuilder {
16        crate::operation::put_resource_policy::builders::PutResourcePolicyFluentBuilder::new(self.handle.clone())
17    }
18}