Skip to content

create_cis_scan_configuration async

create_cis_scan_configuration(
    scan_name: CisScanName,
    security_level: CisSecurityLevel,
    schedule: Schedule,
    targets: CreateCisTargets,
    *,
    config_overrides: Optional[AsyncInspector2ClientConfig] = None,
    tags: Optional[CisTagMap] = None,
) -> CreateCisScanConfigurationResponse

Creates a CIS scan configuration.

Parameters:

  • scan_name (CisScanName) –

    The scan name for the CIS scan configuration.

  • security_level (CisSecurityLevel) –

    The security level for the CIS scan configuration. Security level refers to the Benchmark levels that CIS assigns to a profile.

  • schedule (Schedule) –

    The schedule for the CIS scan configuration.

  • targets (CreateCisTargets) –

    The targets for the CIS scan configuration.

  • tags (Optional[CisTagMap], default: None ) –

    The tags for the CIS scan configuration.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

    For Enable, you receive this error if you attempt to use a feature in an unsupported Amazon Web Services Region.

  • InternalServerException –

    The request has failed due to an internal failure of the Amazon Inspector service.

  • ThrottlingException –

    The limit on the number of requests per second was exceeded.

  • ValidationException –

    The request has failed validation due to missing required fields or having invalid inputs.

  • UnknownServiceError –

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

Examples:

Sample CreateCisScanConfiguration Call

>>> await client.create_cis_scan_configuration(scan_name='sample', security_level='LEVEL_1', schedule={'daily': {'startTime': {'timeOfDay': '12:34', 'timezone': 'UTC'}}}, targets={'accountIds': ['SELF'], 'targetResourceTags': {'key': ['value']}})
Source code in docs_src/capo_inspector2/_services/async_inspector2.py
async def create_cis_scan_configuration(
    self,
    scan_name: "capo_inspector2.types.cis_scan_name.CisScanName",
    security_level: "capo_inspector2.types.cis_security_level.CisSecurityLevel",
    schedule: "capo_inspector2.types.schedule.Schedule",
    targets: "capo_inspector2.types.create_cis_targets.CreateCisTargets",
    *,
    config_overrides: Optional[AsyncInspector2ClientConfig] = None,
    tags: Optional["capo_inspector2.types.cis_tag_map.CisTagMap"] = None,
) -> "capo_inspector2.types.create_cis_scan_configuration_response.CreateCisScanConfigurationResponse":
    """<p>Creates a CIS scan configuration.</p>

    Args:
        scan_name: <p>The scan name for the CIS scan configuration.</p>
        security_level: <p> The security level for the CIS scan configuration. Security level refers to the Benchmark levels that CIS assigns to a profile. </p>
        schedule: <p>The schedule for the CIS scan configuration.</p>
        targets: <p>The targets for the CIS scan configuration.</p>
        tags: <p>The tags for the CIS scan configuration.</p>

    Raises:
        capo_inspector2.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p> <p> For <code>Enable</code>, you receive this error if you attempt to use a feature in an unsupported Amazon Web Services Region. </p>
        capo_inspector2.errors.internal_server_exception.InternalServerException: <p>The request has failed due to an internal failure of the Amazon Inspector service.</p>
        capo_inspector2.errors.throttling_exception.ThrottlingException: <p>The limit on the number of requests per second was exceeded.</p>
        capo_inspector2.errors.validation_exception.ValidationException: <p>The request has failed validation due to missing required fields or having invalid inputs.</p>
        capo_inspector2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Sample CreateCisScanConfiguration Call

        >>> await client.create_cis_scan_configuration(scan_name='sample', security_level='LEVEL_1', schedule={'daily': {'startTime': {'timeOfDay': '12:34', 'timezone': 'UTC'}}}, targets={'accountIds': ['SELF'], 'targetResourceTags': {'key': ['value']}})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_inspector2.types.create_cis_scan_configuration_request.CreateCisScanConfigurationRequest]",
    ) -> AsyncOperationResponse[
        "capo_inspector2.types.create_cis_scan_configuration_response.CreateCisScanConfigurationResponse"
    ]:
        import capo_inspector2._operations.inspector2.create_cis_scan_configuration

        (
            output,
            http_response,
        ) = await capo_inspector2._operations.inspector2.create_cis_scan_configuration.async_create_cis_scan_configuration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCisScanConfiguration")
    )
    input_: capo_inspector2.types.create_cis_scan_configuration_request.CreateCisScanConfigurationRequest = {
        "scan_name": scan_name,
        "security_level": security_level,
        "schedule": schedule,
        "targets": targets,
    }
    if tags is not None:
        input_["tags"] = tags

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