Skip to content

batch_update_standards_control_associations

batch_update_standards_control_associations(
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
    standards_control_association_updates: Optional[
        StandardsControlAssociationUpdates
    ] = None,
) -> BatchUpdateStandardsControlAssociationsResponse

For a batch of security controls and standards, this operation updates the enablement status of a control in a standard.

Parameters:

  • standards_control_association_updates (Optional[StandardsControlAssociationUpdates], default: None ) –

    Updates the enablement status of a security control in a specified standard.

    Calls to this operation return a RESOURCE_NOT_FOUND_EXCEPTION error when the standard subscription for the control has StandardsControlsUpdatable value NOT_READY_FOR_UPDATES.

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.

  • UnknownServiceError –

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

Examples:

To update enablement status of a batch of controls The following example disables CloudWatch.12 in CIS AWS Foundations Benchmark v1.2.0. The example returns an error for CloudTrail.1 because an invalid standard ARN is provided.

>>> client.batch_update_standards_control_associations(standards_control_association_updates=[{'SecurityControlId': 'CloudTrail.1', 'StandardsArn': 'arn:aws:securityhub:::ruleset/sample-standard/v/1.1.0', 'AssociationStatus': 'DISABLED', 'UpdatedReason': 'Not relevant to environment'}, {'SecurityControlId': 'CloudWatch.12', 'StandardsArn': 'arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0', 'AssociationStatus': 'DISABLED', 'UpdatedReason': 'Not relevant to environment'}])
Source code in docs_src/capo_securityhub/_services/security_hub.py
def batch_update_standards_control_associations(
    self,
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
    standards_control_association_updates: Optional[
        "capo_securityhub.types.standards_control_association_updates.StandardsControlAssociationUpdates"
    ] = None,
) -> "capo_securityhub.types.batch_update_standards_control_associations_response.BatchUpdateStandardsControlAssociationsResponse":
    """<p> For a batch of security controls and standards, this operation updates the enablement status of a control in a standard. </p>

    Args:
        standards_control_association_updates: <p> Updates the enablement status of a security control in a specified standard. </p> <p> Calls to this operation return a <code>RESOURCE_NOT_FOUND_EXCEPTION</code> error when the standard subscription for the control has <code>StandardsControlsUpdatable</code> value <code>NOT_READY_FOR_UPDATES</code>. </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.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To update enablement status of a batch of controls
        The following example disables CloudWatch.12 in CIS AWS Foundations Benchmark v1.2.0. The example returns an error for CloudTrail.1 because an invalid standard ARN is provided.

        >>> client.batch_update_standards_control_associations(standards_control_association_updates=[{'SecurityControlId': 'CloudTrail.1', 'StandardsArn': 'arn:aws:securityhub:::ruleset/sample-standard/v/1.1.0', 'AssociationStatus': 'DISABLED', 'UpdatedReason': 'Not relevant to environment'}, {'SecurityControlId': 'CloudWatch.12', 'StandardsArn': 'arn:aws:securityhub:::ruleset/cis-aws-foundations-benchmark/v/1.2.0', 'AssociationStatus': 'DISABLED', 'UpdatedReason': 'Not relevant to environment'}])
    """

    def _handler(
        req: "OperationRequest[capo_securityhub.types.batch_update_standards_control_associations_request.BatchUpdateStandardsControlAssociationsRequest]",
    ) -> OperationResponse[
        "capo_securityhub.types.batch_update_standards_control_associations_response.BatchUpdateStandardsControlAssociationsResponse"
    ]:
        import capo_securityhub._operations.security_hub_api_service.batch_update_standards_control_associations

        output, http_response = (
            capo_securityhub._operations.security_hub_api_service.batch_update_standards_control_associations.batch_update_standards_control_associations(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("BatchUpdateStandardsControlAssociations"),
    )
    input_: capo_securityhub.types.batch_update_standards_control_associations_request.BatchUpdateStandardsControlAssociationsRequest = {}
    if standards_control_association_updates is not None:
        input_["standards_control_association_updates"] = (
            standards_control_association_updates
        )

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