Skip to content

create_code_security_scan_configuration async

create_code_security_scan_configuration(
    name: ScanConfigurationName,
    level: ConfigurationLevel,
    configuration: CodeSecurityScanConfiguration,
    *,
    config_overrides: Optional[AsyncInspector2ClientConfig] = None,
    scope_settings: Optional[ScopeSettings] = None,
    tags: Optional[TagMap] = None,
) -> CreateCodeSecurityScanConfigurationResponse

Creates a scan configuration for code security scanning.

Parameters:

  • name (ScanConfigurationName) –

    The name of the scan configuration.

  • level (ConfigurationLevel) –

    The security level for the scan configuration.

  • configuration (CodeSecurityScanConfiguration) –

    The configuration settings for the code security scan.

  • scope_settings (Optional[ScopeSettings], default: None ) –

    The scope settings that define which repositories will be scanned. Include this parameter to create a default scan configuration. Otherwise Amazon Inspector creates a general scan configuration.

    A default scan configuration automatically applies to all existing and future projects imported into Amazon Inspector. Use the BatchAssociateCodeSecurityScanConfiguration operation to associate a general scan configuration with projects.

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

    The tags to apply to the 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.

  • ConflictException –

    A conflict occurred. This exception occurs when the same resource is being modified by concurrent requests.

  • InternalServerException –

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

  • ServiceQuotaExceededException –

    You have exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use Service Quotas to request a service quota increase.

  • 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.

Source code in docs_src/capo_inspector2/_services/async_inspector2.py
async def create_code_security_scan_configuration(
    self,
    name: "capo_inspector2.types.scan_configuration_name.ScanConfigurationName",
    level: "capo_inspector2.types.configuration_level.ConfigurationLevel",
    configuration: "capo_inspector2.types.code_security_scan_configuration.CodeSecurityScanConfiguration",
    *,
    config_overrides: Optional[AsyncInspector2ClientConfig] = None,
    scope_settings: Optional[
        "capo_inspector2.types.scope_settings.ScopeSettings"
    ] = None,
    tags: Optional["capo_inspector2.types.tag_map.TagMap"] = None,
) -> "capo_inspector2.types.create_code_security_scan_configuration_response.CreateCodeSecurityScanConfigurationResponse":
    """<p>Creates a scan configuration for code security scanning.</p>

    Args:
        name: <p>The name of the scan configuration.</p>
        level: <p>The security level for the scan configuration.</p>
        configuration: <p>The configuration settings for the code security scan.</p>
        scope_settings: <p>The scope settings that define which repositories will be scanned. Include this parameter to create a default scan configuration. Otherwise Amazon Inspector creates a general scan configuration. </p> <p>A default scan configuration automatically applies to all existing and future projects imported into Amazon Inspector. Use the <code>BatchAssociateCodeSecurityScanConfiguration</code> operation to associate a general scan configuration with projects.</p>
        tags: <p>The tags to apply to the 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.conflict_exception.ConflictException: <p>A conflict occurred. This exception occurs when the same resource is being modified by concurrent requests.</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.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use Service Quotas to request a service quota increase.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_inspector2.types.create_code_security_scan_configuration_request.CreateCodeSecurityScanConfigurationRequest]",
    ) -> AsyncOperationResponse[
        "capo_inspector2.types.create_code_security_scan_configuration_response.CreateCodeSecurityScanConfigurationResponse"
    ]:
        import capo_inspector2._operations.inspector2.create_code_security_scan_configuration

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCodeSecurityScanConfiguration")
    )
    input_: capo_inspector2.types.create_code_security_scan_configuration_request.CreateCodeSecurityScanConfigurationRequest = {
        "name": name,
        "level": level,
        "configuration": configuration,
    }
    if scope_settings is not None:
        input_["scope_settings"] = scope_settings
    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