Skip to content

create_connector async

create_connector(
    name: ConnectorName,
    provider: ConnectorCloudProvider,
    provider_detail: ProviderDetailCreate,
    *,
    config_overrides: Optional[AsyncInspector2ClientConfig] = None,
    client_token: Optional[str] = None,
    description: Optional[ConnectorDescription] = None,
    tags: Optional[ConnectorTagMap] = None,
) -> CreateConnectorResponse

Creates a connector that links an external cloud provider to Amazon Inspector for vulnerability scanning.

Parameters:

  • client_token (Optional[str], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request but does not return an error.

  • name (ConnectorName) –

    The name of the connector.

  • provider (ConnectorCloudProvider) –

    The cloud provider for the connector.

  • description (Optional[ConnectorDescription], default: None ) –

    A description of the connector.

  • provider_detail (ProviderDetailCreate) –

    The provider-specific configuration details for the connector.

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

    The tags to apply to the connector.

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.

Examples:

Create an Azure customer-managed connector for VM scanning at SUBSCRIPTION scope

>>> await client.create_connector(name='my-azure-connector', description='Azure subscription scanner', provider='AZURE', provider_detail={'azure': {'awsConfigConnectorArn': 'arn:aws:config:us-east-1:123456789012:connector/azure/a7bc5463-04ce-4b52-901e-f26f7292a4a7/2fbed4bd-5b95-4947-a751-8defc76ecdae', 'scopeConfiguration': {'vmScanning': {'scopeType': 'SUBSCRIPTION', 'scopeValues': ['552802f5-1492-4184-bbae-7291c9939b16']}}, 'azureRegions': ['eastus'], 'autoInstallVMScanner': True}}, tags={'env': 'prod', 'owner': 'security-team'})
Source code in docs_src/capo_inspector2/_services/async_inspector2.py
async def create_connector(
    self,
    name: "capo_inspector2.types.connector_name.ConnectorName",
    provider: "capo_inspector2.types.connector_cloud_provider.ConnectorCloudProvider",
    provider_detail: "capo_inspector2.types.provider_detail_create.ProviderDetailCreate",
    *,
    config_overrides: Optional[AsyncInspector2ClientConfig] = None,
    client_token: Optional[str] = None,
    description: Optional[
        "capo_inspector2.types.connector_description.ConnectorDescription"
    ] = None,
    tags: Optional[
        "capo_inspector2.types.connector_tag_map.ConnectorTagMap"
    ] = None,
) -> "capo_inspector2.types.create_connector_response.CreateConnectorResponse":
    """<p>Creates a connector that links an external cloud provider to Amazon Inspector for vulnerability scanning.</p>

    Args:
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request but does not return an error.</p>
        name: <p>The name of the connector.</p>
        provider: <p>The cloud provider for the connector.</p>
        description: <p>A description of the connector.</p>
        provider_detail: <p>The provider-specific configuration details for the connector.</p>
        tags: <p>The tags to apply to the connector.</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.

    Examples:
        Create an Azure customer-managed connector for VM scanning at SUBSCRIPTION scope

        >>> await client.create_connector(name='my-azure-connector', description='Azure subscription scanner', provider='AZURE', provider_detail={'azure': {'awsConfigConnectorArn': 'arn:aws:config:us-east-1:123456789012:connector/azure/a7bc5463-04ce-4b52-901e-f26f7292a4a7/2fbed4bd-5b95-4947-a751-8defc76ecdae', 'scopeConfiguration': {'vmScanning': {'scopeType': 'SUBSCRIPTION', 'scopeValues': ['552802f5-1492-4184-bbae-7291c9939b16']}}, 'azureRegions': ['eastus'], 'autoInstallVMScanner': True}}, tags={'env': 'prod', 'owner': 'security-team'})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_inspector2.types.create_connector_request.CreateConnectorRequest]",
    ) -> AsyncOperationResponse[
        "capo_inspector2.types.create_connector_response.CreateConnectorResponse"
    ]:
        import capo_inspector2._operations.inspector2.create_connector

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateConnector")
    )
    input_: capo_inspector2.types.create_connector_request.CreateConnectorRequest = {
        "name": name,
        "provider": provider,
        "provider_detail": provider_detail,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if description is not None:
        input_["description"] = description
    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