Skip to content

create_role_association

create_role_association(
    target_arn: AmazonResourceName,
    role_type: RoleTypeName,
    principal: PrincipalInput,
    *,
    config_overrides: Optional[RedshiftServerlessClientConfig] = None,
) -> CreateRoleAssociationResponse

Associates an IAM principal with an Amazon Redshift system-defined role on Amazon Redshift Serverless with express configuration. When the principal connects to the regional endpoint, its database user gets the associated system-defined role for monitoring, operational, or administrative tasks. A role association doesn't give access to your data. You must also have separate permissions to obtain credentials and connect to the regional endpoint. To associate multiple principals or role types, submit a separate request for each association. You can associate up to 10 principals with each role type.

Parameters:

  • target_arn (AmazonResourceName) –

    The Amazon Resource Name (ARN) of the default endpoint. Only express-default is supported, and it must be in the same Amazon Web Services account as the caller. The ARN format is arn:aws-partition:redshift-serverless:region:account-id:workgroup/express/express-default, for example arn:aws:redshift-serverless:us-east-1:111122223333:workgroup/express/express-default.

  • role_type (RoleTypeName) –

    The case-sensitive system-defined role to associate the principal with. Valid values are sys:superuser, sys:operator, sys:dba, sys:secadmin, and sys:monitor. On the express configuration, sys:operator, sys:dba, and sys:superuser give the same permissions.

  • principal (PrincipalInput) –

    The IAM role or IAM user to associate with the role type, specified by its ARN. The principal must exist and must be in the same Amazon Web Services account as the caller.

Raises:

Source code in docs_src/capo_redshift_serverless/_services/redshift_serverless.py
def create_role_association(
    self,
    target_arn: "capo_redshift_serverless.types.amazon_resource_name.AmazonResourceName",
    role_type: "capo_redshift_serverless.types.role_type_name.RoleTypeName",
    principal: "capo_redshift_serverless.types.principal_input.PrincipalInput",
    *,
    config_overrides: Optional[RedshiftServerlessClientConfig] = None,
) -> "capo_redshift_serverless.types.create_role_association_response.CreateRoleAssociationResponse":
    """<p>Associates an IAM principal with an Amazon Redshift system-defined role on Amazon Redshift Serverless with express configuration. When the principal connects to the regional endpoint, its database user gets the associated system-defined role for monitoring, operational, or administrative tasks. A role association doesn't give access to your data. You must also have separate permissions to obtain credentials and connect to the regional endpoint. To associate multiple principals or role types, submit a separate request for each association. You can associate up to 10 principals with each role type.</p>

    Args:
        target_arn: <p>The Amazon Resource Name (ARN) of the default endpoint. Only <code>express-default</code> is supported, and it must be in the same Amazon Web Services account as the caller. The ARN format is <code>arn:aws-partition:redshift-serverless:region:account-id:workgroup/express/express-default</code>, for example <code>arn:aws:redshift-serverless:us-east-1:111122223333:workgroup/express/express-default</code>.</p>
        role_type: <p>The case-sensitive system-defined role to associate the principal with. Valid values are <code>sys:superuser</code>, <code>sys:operator</code>, <code>sys:dba</code>, <code>sys:secadmin</code>, and <code>sys:monitor</code>. On the express configuration, <code>sys:operator</code>, <code>sys:dba</code>, and <code>sys:superuser</code> give the same permissions.</p>
        principal: <p>The IAM role or IAM user to associate with the role type, specified by its ARN. The principal must exist and must be in the same Amazon Web Services account as the caller.</p>

    Raises:
        capo_redshift_serverless.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_redshift_serverless.errors.conflict_exception.ConflictException: <p>The submitted action has conflicts.</p>
        capo_redshift_serverless.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_redshift_serverless.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_redshift_serverless.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_redshift_serverless.errors.validation_exception.ValidationException: <p>The input failed to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_redshift_serverless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_redshift_serverless.types.create_role_association_request.CreateRoleAssociationRequest]",
    ) -> OperationResponse[
        "capo_redshift_serverless.types.create_role_association_response.CreateRoleAssociationResponse"
    ]:
        import capo_redshift_serverless._operations.redshift_serverless.create_role_association

        output, http_response = (
            capo_redshift_serverless._operations.redshift_serverless.create_role_association.create_role_association(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateRoleAssociation")
    )
    input_: capo_redshift_serverless.types.create_role_association_request.CreateRoleAssociationRequest = {
        "target_arn": target_arn,
        "role_type": role_type,
        "principal": principal,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output