Configure and use generic HTTP connections

This page describes how to configure a connection to a generic HTTP endpoint.

In addition to the Git repository connections and account connectors, you can also set up a Developer Connect connection to a generic HTTP endpoint. This lets you establish and manage connections to many third-party developer tools, services, and APIs, as long as those tools are accessible using HTTP endpoints.

For example, you could set up an HTTP connection to a page on Confluence, and then Gemini Code Assist could use that connection to access content on that Confluence page as context.

Create an HTTP connection

HTTP connections support Basic Authentication (username and password) and bearer token authentication. Both authentication types require that you create a secret in Secret Manager.

Bearer token auth

  1. Use Secret Manager to create a secret and a secret version, containing your token.

    The token is your personal access token or API token that give you access to the tool for which you're creating this connection. For example, for Confluence, you would use the API token for your Atlassian account.

  2. To create the connection using bearer token authentication, run the following command:

    gcloud developer-connect connections create CONNECTION_ID \
    --location=REGION \
    --project=PROJECT_ID \
    --http-config-host-uri=HOST_URI \
    --http-config-bearer-token-authentication-secret-version=TOKEN_SECRET_VERSION \
    --http-config-service-directory=SERVICE_DIRECTORY_SERVICE \
    --http-config-ssl-ca-certificate=SSL_CERTIFICATE_FILE_PATH \
    --git-proxy-config-enabled
    

    Replace the following:

    • CONNECTION_ID with a unique ID for this new connection.
    • REGION with the Google Cloud region in which you're creating this connection.
    • PROJECT_ID with the Google Cloud project ID.
    • HOST_URI with the base HTTPS endpoint (for example, https://api.myservice.com).
    • TOKEN_SECRET_VERSION with the Secret Manager secret version resource name for the authentication token.
    • SERVICE_DIRECTORY_SERVICE with the Service Directory resource name for private network access. This is optional.
    • SSL_CERTIFICATE_FILE_PATH with the path to a local file containing the SSL CA certificate content. This is optional.
    • Include the --git-proxy-config-enabled option to access this connection using the Developer Connect proxy.

Basic auth

  1. Use Secret Manager to create a secret and a secret version, containing your username and password.

  2. To create the connection using basic authentication, run the following command:

    gcloud developer-connect connections create CONNECTION_ID \
    --location=REGION \
    --project=PROJECT_ID \
    --http-config-host-uri=HOST_URI \
    --http-config-basic-authentication-username=USERNAME \
    --http-config-basic-authentication-password-secret-version=PASSWORD_SECRET_VERSION \
    --http-config-service-directory=SERVICE_DIRECTORY_SERVICE \
    --http-config-ssl-ca-certificate=SSL_CERTIFICATE_FILE_PATH \
    --git-proxy-config-enabled \
    

    Replace the following:

    • CONNECTION_ID with a unique ID for this new connection.
    • REGION with the Google Cloud region in which you're creating this connection.
    • PROJECT_ID with the Google Cloud project ID.
    • HOST_URI with the base HTTPS endpoint (for example, https://api.myservice.com).
    • USERNAME with the username for basic username-password authentication.
    • PASSWORD_SECRET_VERSION with the Secret Manager secret version resource name for the password, for basic username-password authentication. (For example: projects/01234567890/secrets/confluence-api-pw/versions/1.)
    • SERVICE_DIRECTORY_SERVICE with the Service Directory resource name for private network access. This is optional.
    • SSL_CERTIFICATE_FILE_PATH with the path to a local file containing the SSL CA certificate content. This is optional.
    • Include the --git-proxy-config-enabled option to access this connection using the Developer Connect proxy.

After the connection is created, you can access it using the connection resource name in Developer Connect. For example, you can use this connection to give Gemini Code Assist RAG access to resources in Confluence.