libZSservicesZSamazonka-secretsmanagerZSamazonka-secretsmanager
Copyright(c) 2013-2021 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone

Amazonka.SecretsManager.PutResourcePolicy

Description

Attaches the contents of the specified resource-based permission policy to a secret. A resource-based policy is optional. Alternatively, you can use IAM identity-based policies that specify the secret's Amazon Resource Name (ARN) in the policy statement's Resources element. You can also use a combination of both identity-based and resource-based policies. The affected users and roles receive the permissions that are permitted by all of the relevant policies. For more information, see Using Resource-Based Policies for Amazon Web Services Secrets Manager. For the complete description of the Amazon Web Services policy syntax and grammar, see IAM JSON Policy Reference in the IAM User Guide.

Minimum permissions

To run this command, you must have the following permissions:

  • secretsmanager:PutResourcePolicy

Related operations

  • To retrieve the resource policy attached to a secret, use GetResourcePolicy.
  • To delete the resource-based policy attached to a secret, use DeleteResourcePolicy.
  • To list all of the currently available secrets, use ListSecrets.
Synopsis

Creating a Request

data PutResourcePolicy Source #

See: newPutResourcePolicy smart constructor.

Constructors

PutResourcePolicy' 

Fields

  • blockPublicPolicy :: Maybe Bool

    (Optional) If you set the parameter, BlockPublicPolicy to true, then you block resource-based policies that allow broad access to the secret.

  • secretId :: Text

    Specifies the secret that you want to attach the resource-based policy. You can specify either the ARN or the friendly name of the secret.

    For an ARN, we recommend that you specify a complete ARN rather than a partial ARN.

  • resourcePolicy :: Text

    A JSON-formatted string constructed according to the grammar and syntax for an Amazon Web Services resource-based policy. The policy in the string identifies who can access or manage this secret and its versions. For information on how to format a JSON parameter for the various command line tool environments, see Using JSON for Parameters in the CLI User Guide.

Instances

Instances details
Eq PutResourcePolicy Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

Read PutResourcePolicy Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

Show PutResourcePolicy Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

Generic PutResourcePolicy Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

Associated Types

type Rep PutResourcePolicy :: Type -> Type #

NFData PutResourcePolicy Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

Methods

rnf :: PutResourcePolicy -> () #

Hashable PutResourcePolicy Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

ToJSON PutResourcePolicy Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

AWSRequest PutResourcePolicy Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

Associated Types

type AWSResponse PutResourcePolicy #

ToHeaders PutResourcePolicy Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

ToPath PutResourcePolicy Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

ToQuery PutResourcePolicy Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

type Rep PutResourcePolicy Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

type Rep PutResourcePolicy = D1 ('MetaData "PutResourcePolicy" "Amazonka.SecretsManager.PutResourcePolicy" "libZSservicesZSamazonka-secretsmanagerZSamazonka-secretsmanager" 'False) (C1 ('MetaCons "PutResourcePolicy'" 'PrefixI 'True) (S1 ('MetaSel ('Just "blockPublicPolicy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)) :*: (S1 ('MetaSel ('Just "secretId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "resourcePolicy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))))
type AWSResponse PutResourcePolicy Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

newPutResourcePolicy Source #

Create a value of PutResourcePolicy with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:blockPublicPolicy:PutResourcePolicy', putResourcePolicy_blockPublicPolicy - (Optional) If you set the parameter, BlockPublicPolicy to true, then you block resource-based policies that allow broad access to the secret.

$sel:secretId:PutResourcePolicy', putResourcePolicy_secretId - Specifies the secret that you want to attach the resource-based policy. You can specify either the ARN or the friendly name of the secret.

For an ARN, we recommend that you specify a complete ARN rather than a partial ARN.

$sel:resourcePolicy:PutResourcePolicy', putResourcePolicy_resourcePolicy - A JSON-formatted string constructed according to the grammar and syntax for an Amazon Web Services resource-based policy. The policy in the string identifies who can access or manage this secret and its versions. For information on how to format a JSON parameter for the various command line tool environments, see Using JSON for Parameters in the CLI User Guide.

Request Lenses

putResourcePolicy_blockPublicPolicy :: Lens' PutResourcePolicy (Maybe Bool) Source #

(Optional) If you set the parameter, BlockPublicPolicy to true, then you block resource-based policies that allow broad access to the secret.

putResourcePolicy_secretId :: Lens' PutResourcePolicy Text Source #

Specifies the secret that you want to attach the resource-based policy. You can specify either the ARN or the friendly name of the secret.

For an ARN, we recommend that you specify a complete ARN rather than a partial ARN.

putResourcePolicy_resourcePolicy :: Lens' PutResourcePolicy Text Source #

A JSON-formatted string constructed according to the grammar and syntax for an Amazon Web Services resource-based policy. The policy in the string identifies who can access or manage this secret and its versions. For information on how to format a JSON parameter for the various command line tool environments, see Using JSON for Parameters in the CLI User Guide.

Destructuring the Response

data PutResourcePolicyResponse Source #

See: newPutResourcePolicyResponse smart constructor.

Constructors

PutResourcePolicyResponse' 

Fields

  • arn :: Maybe Text

    The ARN of the secret retrieved by the resource-based policy.

  • name :: Maybe Text

    The friendly name of the secret retrieved by the resource-based policy.

  • httpStatus :: Int

    The response's http status code.

Instances

Instances details
Eq PutResourcePolicyResponse Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

Read PutResourcePolicyResponse Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

Show PutResourcePolicyResponse Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

Generic PutResourcePolicyResponse Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

Associated Types

type Rep PutResourcePolicyResponse :: Type -> Type #

NFData PutResourcePolicyResponse Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

type Rep PutResourcePolicyResponse Source # 
Instance details

Defined in Amazonka.SecretsManager.PutResourcePolicy

type Rep PutResourcePolicyResponse = D1 ('MetaData "PutResourcePolicyResponse" "Amazonka.SecretsManager.PutResourcePolicy" "libZSservicesZSamazonka-secretsmanagerZSamazonka-secretsmanager" 'False) (C1 ('MetaCons "PutResourcePolicyResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "arn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))))

newPutResourcePolicyResponse Source #

Create a value of PutResourcePolicyResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:arn:PutResourcePolicyResponse', putResourcePolicyResponse_arn - The ARN of the secret retrieved by the resource-based policy.

$sel:name:PutResourcePolicyResponse', putResourcePolicyResponse_name - The friendly name of the secret retrieved by the resource-based policy.

$sel:httpStatus:PutResourcePolicyResponse', putResourcePolicyResponse_httpStatus - The response's http status code.

Response Lenses

putResourcePolicyResponse_arn :: Lens' PutResourcePolicyResponse (Maybe Text) Source #

The ARN of the secret retrieved by the resource-based policy.

putResourcePolicyResponse_name :: Lens' PutResourcePolicyResponse (Maybe Text) Source #

The friendly name of the secret retrieved by the resource-based policy.