Skip to content

batch_get_configuration_policy_associations async

batch_get_configuration_policy_associations(
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    configuration_policy_association_identifiers: Optional[
        ConfigurationPolicyAssociationsList
    ] = None,
) -> BatchGetConfigurationPolicyAssociationsResponse

Returns associations between an Security Hub CSPM configuration and a batch of target accounts, organizational units, or the root. Only the Security Hub CSPM delegated administrator can invoke this operation from the home Region. A configuration can refer to a configuration policy or to a self-managed configuration.

Parameters:

  • configuration_policy_association_identifiers (Optional[ConfigurationPolicyAssociationsList], default: None ) –

    Specifies one or more target account IDs, organizational unit (OU) IDs, or the root ID to retrieve associations for.

Raises:

  • AccessDeniedException –

    You don't have permission to perform the action specified in the request.

  • InternalException –

    Internal server error.

  • InvalidAccessException –

    The account doesn't have permission to perform this action.

  • InvalidInputException –

    The request was rejected because you supplied an invalid or out-of-range value for an input parameter.

  • LimitExceededException –

    The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded.

  • ResourceNotFoundException –

    The request was rejected because we can't find the specified resource.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To get configuration associations for a batch of targets This operation provides details about configuration associations for a batch of target accounts, organizational units, or the root.

>>> await client.batch_get_configuration_policy_associations(configuration_policy_association_identifiers=[{'Target': {'AccountId': '111122223333'}}, {'Target': {'RootId': 'r-f6g7h8i9j0example'}}])
Source code in docs_src/capo_securityhub/_services/async_security_hub.py
async def batch_get_configuration_policy_associations(
    self,
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    configuration_policy_association_identifiers: Optional[
        "capo_securityhub.types.configuration_policy_associations_list.ConfigurationPolicyAssociationsList"
    ] = None,
) -> "capo_securityhub.types.batch_get_configuration_policy_associations_response.BatchGetConfigurationPolicyAssociationsResponse":
    """<p> Returns associations between an Security Hub CSPM configuration and a batch of target accounts, organizational units, or the root. Only the Security Hub CSPM delegated administrator can invoke this operation from the home Region. A configuration can refer to a configuration policy or to a self-managed configuration. </p>

    Args:
        configuration_policy_association_identifiers: <p> Specifies one or more target account IDs, organizational unit (OU) IDs, or the root ID to retrieve associations for. </p>

    Raises:
        capo_securityhub.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform the action specified in the request.</p>
        capo_securityhub.errors.internal_exception.InternalException: <p>Internal server error.</p>
        capo_securityhub.errors.invalid_access_exception.InvalidAccessException: <p>The account doesn't have permission to perform this action.</p>
        capo_securityhub.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because you supplied an invalid or out-of-range value for an input parameter.</p>
        capo_securityhub.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded.</p>
        capo_securityhub.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request was rejected because we can't find the specified resource.</p>
        capo_securityhub.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To get configuration associations for a batch of targets
        This operation provides details about configuration associations for a batch of target accounts, organizational units, or the root.

        >>> await client.batch_get_configuration_policy_associations(configuration_policy_association_identifiers=[{'Target': {'AccountId': '111122223333'}}, {'Target': {'RootId': 'r-f6g7h8i9j0example'}}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_securityhub.types.batch_get_configuration_policy_associations_request.BatchGetConfigurationPolicyAssociationsRequest]",
    ) -> AsyncOperationResponse[
        "capo_securityhub.types.batch_get_configuration_policy_associations_response.BatchGetConfigurationPolicyAssociationsResponse"
    ]:
        import capo_securityhub._operations.security_hub_api_service.batch_get_configuration_policy_associations

        (
            output,
            http_response,
        ) = await capo_securityhub._operations.security_hub_api_service.batch_get_configuration_policy_associations.async_batch_get_configuration_policy_associations(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("BatchGetConfigurationPolicyAssociations"),
    )
    input_: capo_securityhub.types.batch_get_configuration_policy_associations_request.BatchGetConfigurationPolicyAssociationsRequest = {}
    if configuration_policy_association_identifiers is not None:
        input_["configuration_policy_association_identifiers"] = (
            configuration_policy_association_identifiers
        )

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