Skip to content

create_code_security_integration

create_code_security_integration(
    name: IntegrationName,
    type: IntegrationType,
    *,
    config_overrides: Optional[Inspector2ClientConfig] = None,
    details: Optional[CreateIntegrationDetail] = None,
    tags: Optional[TagMap] = None,
) -> CreateCodeSecurityIntegrationResponse

Creates a code security integration with a source code repository provider.

After calling the CreateCodeSecurityIntegration operation, you complete authentication and authorization with your provider. Next you call the UpdateCodeSecurityIntegration operation to provide the details to complete the integration setup

Parameters:

  • name (IntegrationName) –

    The name of the code security integration.

  • type (IntegrationType) –

    The type of repository provider for the integration.

  • details (Optional[CreateIntegrationDetail], default: None ) –

    The integration details specific to the repository provider type.

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

    The tags to apply to the code security integration.

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/inspector2.py
def create_code_security_integration(
    self,
    name: "capo_inspector2.types.integration_name.IntegrationName",
    type: "capo_inspector2.types.integration_type.IntegrationType",
    *,
    config_overrides: Optional[Inspector2ClientConfig] = None,
    details: Optional[
        "capo_inspector2.types.create_integration_detail.CreateIntegrationDetail"
    ] = None,
    tags: Optional["capo_inspector2.types.tag_map.TagMap"] = None,
) -> "capo_inspector2.types.create_code_security_integration_response.CreateCodeSecurityIntegrationResponse":
    """<p>Creates a code security integration with a source code repository provider.</p> <p>After calling the <code>CreateCodeSecurityIntegration</code> operation, you complete authentication and authorization with your provider. Next you call the <code>UpdateCodeSecurityIntegration</code> operation to provide the <code>details</code> to complete the integration setup</p>

    Args:
        name: <p>The name of the code security integration.</p>
        type: <p>The type of repository provider for the integration.</p>
        details: <p>The integration details specific to the repository provider type.</p>
        tags: <p>The tags to apply to the code security integration.</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.
    """

    def _handler(
        req: "OperationRequest[capo_inspector2.types.create_code_security_integration_request.CreateCodeSecurityIntegrationRequest]",
    ) -> OperationResponse[
        "capo_inspector2.types.create_code_security_integration_response.CreateCodeSecurityIntegrationResponse"
    ]:
        import capo_inspector2._operations.inspector2.create_code_security_integration

        output, http_response = (
            capo_inspector2._operations.inspector2.create_code_security_integration.create_code_security_integration(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_inspector2.types.create_code_security_integration_request.CreateCodeSecurityIntegrationRequest",
    ) -> dict[str, Any]:
        import capo_inspector2.types.create_code_security_integration_request

        return capo_inspector2.types.create_code_security_integration_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_inspector2.types.create_code_security_integration_response.CreateCodeSecurityIntegrationResponse",
    ) -> dict[str, Any]:
        import capo_inspector2.types.create_code_security_integration_response

        return capo_inspector2.types.create_code_security_integration_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateCodeSecurityIntegration",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_inspector2.types.create_code_security_integration_request.CreateCodeSecurityIntegrationRequest = {
        "name": name,
        "type": type,
    }
    if details is not None:
        input_["details"] = details
    if tags is not None:
        input_["tags"] = tags

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