Skip to content

create_host

create_host(
    name: HostName,
    provider_type: ProviderType,
    provider_endpoint: Url,
    *,
    config_overrides: Optional[CodeConnectionsClientConfig] = None,
    vpc_configuration: Optional[VpcConfiguration] = None,
    tags: Optional[TagList] = None,
) -> CreateHostOutput

Creates a resource that represents the infrastructure where a third-party provider is installed. The host is used when you create connections to an installed third-party provider type, such as GitHub Enterprise Server. You create one host for all connections to that provider.

A host created through the CLI or the SDK is in `PENDING` status by default. You can make its status `AVAILABLE` by setting up the host in the console.

Parameters:

  • name (HostName) –

    The name of the host to be created.

  • provider_type (ProviderType) –

    The name of the installed provider to be associated with your connection. The host resource represents the infrastructure where your provider type is installed. The valid provider type is GitHub Enterprise Server.

  • provider_endpoint (Url) –

    The endpoint of the infrastructure to be represented by the host after it is created.

  • vpc_configuration (Optional[VpcConfiguration], default: None ) –

    The VPC configuration to be provisioned for the host. A VPC must be configured and the infrastructure to be represented by the host must already be connected to the VPC.

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

    Tags for the host to be created.

Raises:

Source code in docs_src/capo_codeconnections/_services/code_connections.py
def create_host(
    self,
    name: "capo_codeconnections.types.host_name.HostName",
    provider_type: "capo_codeconnections.types.provider_type.ProviderType",
    provider_endpoint: "capo_codeconnections.types.url.Url",
    *,
    config_overrides: Optional[CodeConnectionsClientConfig] = None,
    vpc_configuration: Optional[
        "capo_codeconnections.types.vpc_configuration.VpcConfiguration"
    ] = None,
    tags: Optional["capo_codeconnections.types.tag_list.TagList"] = None,
) -> "capo_codeconnections.types.create_host_output.CreateHostOutput":
    """<p>Creates a resource that represents the infrastructure where a third-party provider is installed. The host is used when you create connections to an installed third-party provider type, such as GitHub Enterprise Server. You create one host for all connections to that provider.</p> <note> <p>A host created through the CLI or the SDK is in `PENDING` status by default. You can make its status `AVAILABLE` by setting up the host in the console.</p> </note>

    Args:
        name: <p>The name of the host to be created.</p>
        provider_type: <p>The name of the installed provider to be associated with your connection. The host resource represents the infrastructure where your provider type is installed. The valid provider type is GitHub Enterprise Server.</p>
        provider_endpoint: <p>The endpoint of the infrastructure to be represented by the host after it is created.</p>
        vpc_configuration: <p>The VPC configuration to be provisioned for the host. A VPC must be configured and the infrastructure to be represented by the host must already be connected to the VPC.</p>
        tags: <p>Tags for the host to be created.</p>

    Raises:
        capo_codeconnections.errors.limit_exceeded_exception.LimitExceededException: <p>Exceeded the maximum limit for connections.</p>
        capo_codeconnections.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codeconnections.types.create_host_input.CreateHostInput]",
    ) -> OperationResponse[
        "capo_codeconnections.types.create_host_output.CreateHostOutput"
    ]:
        import capo_codeconnections._operations.code_connections_20231201.create_host

        output, http_response = (
            capo_codeconnections._operations.code_connections_20231201.create_host.create_host(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateHost")
    )
    input_: capo_codeconnections.types.create_host_input.CreateHostInput = {
        "name": name,
        "provider_type": provider_type,
        "provider_endpoint": provider_endpoint,
    }
    if vpc_configuration is not None:
        input_["vpc_configuration"] = vpc_configuration
    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