put_role_permissions_boundary(
role_name: roleNameType,
permissions_boundary: arnType,
*,
config_overrides: Optional[IAMClientConfig] = None,
) -> None
Adds or updates the policy that is specified as the IAM role's permissions boundary. You can use an Amazon Web Services managed policy or a customer managed policy to set the boundary for a role. Use the boundary to control the maximum permissions that the role can have. Setting a permissions boundary is an advanced feature that can affect the permissions for the role.
You cannot set the boundary for a service-linked role.
Policies used as permissions boundaries do not provide permissions. You must also attach a permissions policy to the role. To learn how the effective permissions for a role are evaluated, see IAM JSON policy evaluation logic in the IAM User Guide.
Parameters:
-
role_name
(roleNameType)
–
The name (friendly name, not ARN) of the IAM role for which you want to set the permissions boundary.
-
permissions_boundary
(arnType)
–
The ARN of the managed policy that is used to set the permissions boundary for the role.
A permissions boundary policy defines the maximum permissions that identity-based policies can grant to an entity, but does not grant permissions. Permissions boundaries do not define the maximum permissions that a resource-based policy can grant to an entity. To learn more, see Permissions boundaries for IAM entities in the IAM User Guide.
For more information about policy types, see Policy types in the IAM User Guide.
Raises:
-
InvalidInputException
–
The request was rejected because an invalid or out-of-range value was supplied for an input parameter.
-
NoSuchEntityException
–
The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.
-
PolicyNotAttachableException
–
The request failed because Amazon Web Services service role policies can only be attached to the service-linked role for that service.
-
ServiceFailureException
–
The request processing has failed because of an unknown error, exception or failure.
-
UnmodifiableEntityException
–
The request was rejected because service-linked roles are protected Amazon Web Services resources. Only the service that depends on the service-linked role can modify or delete the role on your behalf. The error message includes the name of the service that depends on this service-linked role. You must request the change through that service.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_iam/_services/iam.py
| def put_role_permissions_boundary(
self,
role_name: "capo_iam.types.role_name_type.roleNameType",
permissions_boundary: "capo_iam.types.arn_type.arnType",
*,
config_overrides: Optional[IAMClientConfig] = None,
) -> None:
"""<p>Adds or updates the policy that is specified as the IAM role's permissions boundary. You can use an Amazon Web Services managed policy or a customer managed policy to set the boundary for a role. Use the boundary to control the maximum permissions that the role can have. Setting a permissions boundary is an advanced feature that can affect the permissions for the role.</p> <p>You cannot set the boundary for a service-linked role.</p> <important> <p>Policies used as permissions boundaries do not provide permissions. You must also attach a permissions policy to the role. To learn how the effective permissions for a role are evaluated, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html">IAM JSON policy evaluation logic</a> in the IAM User Guide. </p> </important>
Args:
role_name: <p>The name (friendly name, not ARN) of the IAM role for which you want to set the permissions boundary.</p>
permissions_boundary: <p>The ARN of the managed policy that is used to set the permissions boundary for the role.</p> <p>A permissions boundary policy defines the maximum permissions that identity-based policies can grant to an entity, but does not grant permissions. Permissions boundaries do not define the maximum permissions that a resource-based policy can grant to an entity. To learn more, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html">Permissions boundaries for IAM entities</a> in the <i>IAM User Guide</i>.</p> <p>For more information about policy types, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policy-types">Policy types </a> in the <i>IAM User Guide</i>.</p>
Raises:
capo_iam.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because an invalid or out-of-range value was supplied for an input parameter.</p>
capo_iam.errors.no_such_entity_exception.NoSuchEntityException: <p>The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.</p>
capo_iam.errors.policy_not_attachable_exception.PolicyNotAttachableException: <p>The request failed because Amazon Web Services service role policies can only be attached to the service-linked role for that service.</p>
capo_iam.errors.service_failure_exception.ServiceFailureException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
capo_iam.errors.unmodifiable_entity_exception.UnmodifiableEntityException: <p>The request was rejected because service-linked roles are protected Amazon Web Services resources. Only the service that depends on the service-linked role can modify or delete the role on your behalf. The error message includes the name of the service that depends on this service-linked role. You must request the change through that service.</p>
capo_iam.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_iam.types.put_role_permissions_boundary_request.PutRolePermissionsBoundaryRequest]",
) -> OperationResponse[None]:
import capo_iam._operations.aws_identity_management_v20100508.put_role_permissions_boundary
output, http_response = (
capo_iam._operations.aws_identity_management_v20100508.put_role_permissions_boundary.put_role_permissions_boundary(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutRolePermissionsBoundary")
)
input_: capo_iam.types.put_role_permissions_boundary_request.PutRolePermissionsBoundaryRequest = {
"role_name": role_name,
"permissions_boundary": permissions_boundary,
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|