amazonka-iam-2.0: Amazon Identity and Access Management SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.IAM.AttachRolePolicy

Description

Attaches the specified managed policy to the specified IAM role. When you attach a managed policy to a role, the managed policy becomes part of the role's permission (access) policy.

You cannot use a managed policy as the role's trust policy. The role's trust policy is created at the same time as the role, using CreateRole. You can update a role's trust policy using UpdateAssumeRolePolicy.

Use this operation to attach a managed policy to a role. To embed an inline policy in a role, use PutRolePolicy. For more information about policies, see Managed policies and inline policies in the IAM User Guide.

As a best practice, you can validate your IAM policies. To learn more, see Validating IAM policies in the IAM User Guide.

Synopsis

Creating a Request

data AttachRolePolicy Source #

See: newAttachRolePolicy smart constructor.

Constructors

AttachRolePolicy' 

Fields

  • roleName :: Text

    The name (friendly name, not ARN) of the role to attach the policy to.

    This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

  • policyArn :: Text

    The Amazon Resource Name (ARN) of the IAM policy you want to attach.

    For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.

Instances

Instances details
ToHeaders AttachRolePolicy Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

ToPath AttachRolePolicy Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

ToQuery AttachRolePolicy Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

AWSRequest AttachRolePolicy Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

Associated Types

type AWSResponse AttachRolePolicy #

Generic AttachRolePolicy Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

Associated Types

type Rep AttachRolePolicy :: Type -> Type #

Read AttachRolePolicy Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

Show AttachRolePolicy Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

NFData AttachRolePolicy Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

Methods

rnf :: AttachRolePolicy -> () #

Eq AttachRolePolicy Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

Hashable AttachRolePolicy Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

type AWSResponse AttachRolePolicy Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

type Rep AttachRolePolicy Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

type Rep AttachRolePolicy = D1 ('MetaData "AttachRolePolicy" "Amazonka.IAM.AttachRolePolicy" "amazonka-iam-2.0-5DxkArXx9sD3CCYYGFyGET" 'False) (C1 ('MetaCons "AttachRolePolicy'" 'PrefixI 'True) (S1 ('MetaSel ('Just "roleName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "policyArn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))

newAttachRolePolicy Source #

Create a value of AttachRolePolicy 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:

AttachRolePolicy, attachRolePolicy_roleName - The name (friendly name, not ARN) of the role to attach the policy to.

This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

AttachRolePolicy, attachRolePolicy_policyArn - The Amazon Resource Name (ARN) of the IAM policy you want to attach.

For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.

Request Lenses

attachRolePolicy_roleName :: Lens' AttachRolePolicy Text Source #

The name (friendly name, not ARN) of the role to attach the policy to.

This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

attachRolePolicy_policyArn :: Lens' AttachRolePolicy Text Source #

The Amazon Resource Name (ARN) of the IAM policy you want to attach.

For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.

Destructuring the Response

data AttachRolePolicyResponse Source #

See: newAttachRolePolicyResponse smart constructor.

Instances

Instances details
Generic AttachRolePolicyResponse Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

Associated Types

type Rep AttachRolePolicyResponse :: Type -> Type #

Read AttachRolePolicyResponse Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

Show AttachRolePolicyResponse Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

NFData AttachRolePolicyResponse Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

Eq AttachRolePolicyResponse Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

type Rep AttachRolePolicyResponse Source # 
Instance details

Defined in Amazonka.IAM.AttachRolePolicy

type Rep AttachRolePolicyResponse = D1 ('MetaData "AttachRolePolicyResponse" "Amazonka.IAM.AttachRolePolicy" "amazonka-iam-2.0-5DxkArXx9sD3CCYYGFyGET" 'False) (C1 ('MetaCons "AttachRolePolicyResponse'" 'PrefixI 'False) (U1 :: Type -> Type))

newAttachRolePolicyResponse :: AttachRolePolicyResponse Source #

Create a value of AttachRolePolicyResponse with all optional fields omitted.

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