Skip to content

update_standards_control async

update_standards_control(
    standards_control_arn: NonEmptyString,
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    control_status: Optional[ControlStatus] = None,
    disabled_reason: Optional[NonEmptyString] = None,
) -> UpdateStandardsControlResponse

Used to control whether an individual security standard control is enabled or disabled.

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.

Parameters:

  • standards_control_arn (NonEmptyString) –

    The ARN of the security standard control to enable or disable.

  • control_status (Optional[ControlStatus], default: None ) –

    The updated status of the security standard control.

  • disabled_reason (Optional[NonEmptyString], default: None ) –

    A description of the reason why you are disabling a security standard control. If you are disabling a control, then this is required.

Raises:

Examples:

To update the enablement status of a standard control The following example disables the specified control in the specified security standard.

>>> await client.update_standards_control(standards_control_arn='arn:aws:securityhub:us-west-1:123456789012:control/pci-dss/v/3.2.1/PCI.AutoScaling.1', control_status='DISABLED', disabled_reason='Not applicable to my service')
Source code in docs_src/capo_securityhub/_services/async_security_hub.py
async def update_standards_control(
    self,
    standards_control_arn: "capo_securityhub.types.non_empty_string.NonEmptyString",
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    control_status: Optional[
        "capo_securityhub.types.control_status.ControlStatus"
    ] = None,
    disabled_reason: Optional[
        "capo_securityhub.types.non_empty_string.NonEmptyString"
    ] = None,
) -> "capo_securityhub.types.update_standards_control_response.UpdateStandardsControlResponse":
    """<p>Used to control whether an individual security standard control is enabled or disabled.</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>

    Args:
        standards_control_arn: <p>The ARN of the security standard control to enable or disable.</p>
        control_status: <p>The updated status of the security standard control.</p>
        disabled_reason: <p>A description of the reason why you are disabling a security standard control. If you are disabling a control, then this is required.</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.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 update the enablement status of a standard control
        The following example disables the specified control in the specified security standard.

        >>> await client.update_standards_control(standards_control_arn='arn:aws:securityhub:us-west-1:123456789012:control/pci-dss/v/3.2.1/PCI.AutoScaling.1', control_status='DISABLED', disabled_reason='Not applicable to my service')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_securityhub.types.update_standards_control_request.UpdateStandardsControlRequest]",
    ) -> AsyncOperationResponse[
        "capo_securityhub.types.update_standards_control_response.UpdateStandardsControlResponse"
    ]:
        import capo_securityhub._operations.security_hub_api_service.update_standards_control

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateStandardsControl")
    )
    input_: capo_securityhub.types.update_standards_control_request.UpdateStandardsControlRequest = {
        "standards_control_arn": standards_control_arn
    }
    if control_status is not None:
        input_["control_status"] = control_status
    if disabled_reason is not None:
        input_["disabled_reason"] = disabled_reason

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