Skip to content

add_role_to_db_cluster async

add_role_to_db_cluster(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_cluster_identifier: Optional[String] = None,
    role_arn: Optional[IAMRoleArn] = None,
    feature_name: Optional[String] = None,
) -> None

Associates an Identity and Access Management (IAM) role with a DB cluster.

Parameters:

  • db_cluster_identifier (Optional[String], default: None ) –

    The name of the DB cluster to associate the IAM role with.

  • role_arn (Optional[IAMRoleArn], default: None ) –

    The Amazon Resource Name (ARN) of the IAM role to associate with the Aurora DB cluster, for example arn:aws:iam::123456789012:role/AuroraAccessRole.

  • feature_name (Optional[String], default: None ) –

    The name of the feature for the DB cluster that the IAM role is to be associated with. For information about supported feature names, see DBEngineVersion.

Raises:

Examples:

To associate an AWS Identity and Access Management (IAM) role with a DB cluster The following example associates a role with a DB cluster.

>>> await client.add_role_to_db_cluster(db_cluster_identifier='mydbcluster', role_arn='arn:aws:iam::123456789012:role/RDSLoadFromS3')
Source code in docs_src/capo_rds/_services/async_rds.py
async def add_role_to_db_cluster(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_cluster_identifier: Optional["capo_rds.types.string.String"] = None,
    role_arn: Optional["capo_rds.types.iam_role_arn.IAMRoleArn"] = None,
    feature_name: Optional["capo_rds.types.string.String"] = None,
) -> None:
    """<p>Associates an Identity and Access Management (IAM) role with a DB cluster.</p>

    Args:
        db_cluster_identifier: <p>The name of the DB cluster to associate the IAM role with.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of the IAM role to associate with the Aurora DB cluster, for example <code>arn:aws:iam::123456789012:role/AuroraAccessRole</code>.</p>
        feature_name: <p>The name of the feature for the DB cluster that the IAM role is to be associated with. For information about supported feature names, see <a>DBEngineVersion</a>.</p>

    Raises:
        capo_rds.errors.db_cluster_not_found_fault.DBClusterNotFoundFault: <p> <code>DBClusterIdentifier</code> doesn't refer to an existing DB cluster.</p>
        capo_rds.errors.db_cluster_role_already_exists_fault.DBClusterRoleAlreadyExistsFault: <p>The specified IAM role Amazon Resource Name (ARN) is already associated with the specified DB cluster.</p>
        capo_rds.errors.db_cluster_role_quota_exceeded_fault.DBClusterRoleQuotaExceededFault: <p>You have exceeded the maximum number of IAM roles that can be associated with the specified DB cluster.</p>
        capo_rds.errors.invalid_db_cluster_state_fault.InvalidDBClusterStateFault: <p>The requested operation can't be performed while the cluster is in this state.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To associate an AWS Identity and Access Management (IAM) role with a DB cluster
        The following example associates a role with a DB cluster.

        >>> await client.add_role_to_db_cluster(db_cluster_identifier='mydbcluster', role_arn='arn:aws:iam::123456789012:role/RDSLoadFromS3')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.add_role_to_db_cluster_message.AddRoleToDBClusterMessage]",
    ) -> AsyncOperationResponse[None]:
        import capo_rds._operations.amazon_rd_sv19.add_role_to_db_cluster

        (
            output,
            http_response,
        ) = await capo_rds._operations.amazon_rd_sv19.add_role_to_db_cluster.async_add_role_to_db_cluster(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AddRoleToDBCluster")
    )
    input_: capo_rds.types.add_role_to_db_cluster_message.AddRoleToDBClusterMessage = {}
    if db_cluster_identifier is not None:
        input_["db_cluster_identifier"] = db_cluster_identifier
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if feature_name is not None:
        input_["feature_name"] = feature_name

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output