Manage deployments

This page applies to Apigee and Apigee hybrid.

This document describes how to create and manage API deployments. See also Introduction to API deployments. After you create a deployment entity, you can link it to one or more API versions.

Create a deployment

You can create a deployment entity in the console or with the REST API.

Console

To create a new deployment:

  1. In the Google Cloud console, go to the API hub page.

    Go to API hub
  2. Click APIs.
  3. Use Filter to specify keywords to filter the list of APIs. If needed, use Search to locate an API.
  4. Click an API to view its details.
  5. Under the Deployments tab, click Add Deployment.
  6. Specify deployment details in the Create deployment form:
    • Deployment ID: Click Specify Unique ID to optionally provide a unique ID for the deployment. If you omit the ID, API hub creates one for you. The ID must be 4-500 characters, and valid characters are /[A-Z][a-z][0-9]-/.
    • Deployment name: (Required) Provide a display name for the deployment.
    • Description: Enter a description of the deployment.
    • Deployment type: Select the type of deployment. Possible values are defined in a system attribute, and you can modify them in Manage attributes.
    • Resource URI: (Required) Provide a URI to the runtime resource. This URI can be used to manage the resource. For example, if the runtime resource is an Apigee API proxy, then this field must contain the URI to the management user interface of the proxy.
    • Environment: The environment mapping to this deployment. The environment maps to the system-defined environment attribute.
    • Documentation: Enter a link to documentation for the deployment.
    • SLO: Provide the SLO for this deployment. This maps to the SLO system-defined attribute. You can modify values for this attribute in Manage attributes.
    • Endpoints: (Required) Provide the endpoints at which this deployment resource is listening for API requests. This could be a list of complete URIs, hostnames or IP addresses.
    • Link to a version: Link the deployment to one or more API versions.
    • User defined attributes: User-defined key/value pairs. You can add user-defined attributes in Manage attributes.
  7. Click Create.

REST

To add a new deployment using the Create a deployment API:

curl "https://apihub.googleapis.com/v1/projects/HUB_PROJECT/locations/HUB_LOCATION/deployments?deployment_id=DEPLOYMENT_ID"
  -H "Authorization: Bearer: $(gcloud auth print-access-token)" -X POST -H "Content-Type: application/json" \
  '{
    "display-name": DISPLAY_NAME
    }'

Replace the following:

  • HUB_PROJECT: The name of your API hub host project. The host project was selected when API hub was provisioned.
  • HUB_LOCATION: The location of the host project. The location was chosen when API hub was provisioned.
  • DEPLOYMENT_ID: (Optional) The identifier of the deployment. If not provided, a system-generated ID will be used. The name must be a string of 4-500 characters, where valid characters are /[a-z][A-Z][0-9]-_/.
  • DISPLAY_NAME: (Required) The display name of the deployment. You can use any name you wish.
  • Optional Attributes: In addition to the required display name, you can attach optional attributes and entities to a deployment. These additional items are described in the deployment resource description in the REST API reference.

Link a deployment to an API version

A version can have one or more deployments linked to it. This section explains how to link deployments to versions. You can link deployments to a version at the time you create the version, or, you can link deployments to an existing version by editing it. See Create an API version and Edit a version.

To link a deployment to a new or existing version, the deployment must already exist. See Create a deployment.

Console

To add a deployment to a version:

  1. In the Google Cloud console, go to the API hub page.

    Go to API hub
  2. Click APIs.
  3. Use Filter to specify keywords to filter the list of APIs. If needed, use Search to locate an API.
  4. Select an API.
  5. In the Versions table, locate the version you wish to edit.
  6. Select Edit from the Actions menu at the right side of the version row or select the version and click Edit version in the details page.
  7. Under Link to a deployment select one or more deployments to link to the version and click Ok.
  8. Click Save.

REST

Example adding a deployment to a version:

curl "https://apihub.googleapis.com/v1/projects/HUB_PROJECT/locations/HUB_LOCATION/apis/API_NAME/versions/VERSION_ID"
  -H "Authorization: Bearer: $(gcloud auth print-access-token)" -X PATCH -H "Content-Type: application/json" \
  '{
    "deployments": "DEPLOYMENTS"
  }'

Replace the following:

  • HUB_PROJECT: The name of your API hub host project. The host project was selected when API hub was provisioned.
  • HUB_LOCATION: The location of the host project. The location was chosen when API hub was provisioned.
  • API_NAME: The name of the API that has the version you wish to edit.
  • VERSION_ID: The unique ID of the version to edit.
  • DEPLOYMENTS: The fully qualified resource name of one or more deployments. For example: "projects/myproject/locations/us-central1/deployments/mydeployment-1, projects/myproject/locations/us-central1/deployments/mydeployment-2"

List deployments

This section explains how to list the deployments. You can list all deployments associated with all the versions for an API, or list all deployments associated with a specific version.

Console

To list deployments with the UI:

  1. In the Google Cloud console, go to the API hub page.

    Go to API hub
  2. Click APIs.
  3. Use Filter to specify keywords to filter the list of APIs. If needed, use Search to locate an API.
  4. Click an API to view its details.
  5. Select the Deployments tab to list all deployments associated with the API.
  6. From the Versions tab, select a version if you want to see the deployments associated with that version.

REST

To list all deployments, use the List deployments API:

curl "https://apihub.googleapis.com/v1/projects/HUB_PROJECT/locations/HUB_LOCATION/deployments"
        -H "Authorization: Bearer: $(gcloud auth print-access-token)" -X GET -H "Content-Type: application/json"

Replace the following:

  • HUB_PROJECT: The name of your API hub host project. The host project was selected when API hub was provisioned.
  • HUB_LOCATION: The location of the host project. The location was chosen when API hub was provisioned.

Get deployment details

This section explains how to get the details about an API deployment.

Console

To view details of a deployment:

  1. In the Google Cloud console, go to the API hub page.

    Go to API hub
  2. Click APIs.
  3. Use Filter to specify keywords to filter the list of APIs. If needed, use Search to locate an API.
  4. Click an API to view its details.
  5. Select the Deployments tab to list all deployments associated with the API.
  6. Select the deployment to view its details page.

REST

To view details of a deployment, use the Get deployment details API:

curl "https://apihub.googleapis.com/v1/projects/HUB_PROJECT/locations/HUB_LOCATION/deployments/DEPLOYMENT_ID"
    -H "Authorization: Bearer: $(gcloud auth print-access-token)" -X GET -H "Content-Type: application/json"

Replace the following:

  • HUB_PROJECT: The name of your API hub host project. The host project was selected when API hub was provisioned.
  • HUB_LOCATION: The location of the host project. The location was chosen when API hub was provisioned.
  • DEPLOYMENT_ID: The unique ID of the deployment.

Delete an API deployment from an API

This section explains how to delete API deployment. When you delete an API deployment from an API, it is unlinked from all of the API's versions first, and then it is deleted from the API. Once a deployment is deleted, it will no longer show up in the list of deployments, and you cannot filter APIs based on the deleted deployment.

Console

To delete a deployment with the UI:

  1. In the Google Cloud console, go to the API hub page.

    Go to API hub
  2. Click APIs.
  3. Use Filter to specify keywords to filter the list of APIs. If needed, use Search to locate an API.
  4. Click an API to view its details.
  5. Select the Deployments tab to list all deployments associated with the API.
  6. Locate the deployment you wish to delete.
  7. Select Delete from the deployment's Action menu.

REST

To delete a deployment from API hub, use the Delete deployment API:

curl "https://apihub.googleapis.com/v1/projects/HUB_PROJECT/locations/HUB_LOCATION/deployments/DEPLOYMENT_ID"
    -H "Authorization: Bearer: $(gcloud auth print-access-token)" -X DELETE -H "Content-Type: application/json"

Replace the following:

  • HUB_PROJECT: The name of your API hub host project. The host project was selected when API hub was provisioned.
  • HUB_LOCATION: The location of the host project. The location was chosen when API hub was provisioned.
  • DEPLOYMENT_ID: The unique ID of the deployment to delete.

Unlink an API deployment from an API or version

This section explains how to unlink an API deployment from an API or version. If you unlink a deployment from an API, the deployment is unlinked from all versions of the API. When unlinked, a deployment no longer shows up in the list of deployments.

Console

To unlink a deployment from an API with the UI:

  1. In the Google Cloud console, go to the API hub page.

    Go to API hub
  2. Click APIs.
  3. Use Filter to specify keywords to filter the list of APIs. If needed, use Search to locate an API.
  4. Click an API to view its details.
  5. Select the Deployments tab to list all deployments associated with the API.
  6. Locate the deployment you wish to unlink.
  7. Select Unlink from API from the deployment's Action menu.

To unlink a deployment from a version with the UI:

  1. In the Google Cloud console, go to the API hub page.

    Go to API hub
  2. Click APIs.
  3. Use Filter to specify keywords to filter the list of APIs. If needed, use Search to locate an API.
  4. Click an API to view its details.
  5. Select a version.
  6. In the Deployments section, locate the deployment you wish to unlink.
  7. Select Unlink from version from the deployment's Action menu.

REST

To delete an API resource from API hub, use the Delete deployment API:

curl "https://apihub.googleapis.com/v1/projects/HUB_PROJECT/locations/HUB_LOCATION/deployments/DEPLOYMENT_ID"
    -H "Authorization: Bearer: $(gcloud auth print-access-token)" -X DELETE -H "Content-Type: application/json"

Replace the following:

  • HUB_PROJECT: The name of your API hub host project. The host project was selected when API hub was provisioned.
  • HUB_LOCATION: The location of the host project. The location was chosen when API hub was provisioned.
  • DEPLOYMENT_ID: The unique ID of the deployment to delete.

Edit a deployment

This section explains how to edit a deployment.

Console

  1. In the Google Cloud console, go to the API hub page.

    Go to API hub
  2. Click APIs.
  3. Use Filter to specify keywords to filter the list of APIs. If needed, use Search to locate an API.
  4. Click an API to view its details.
  5. Select the Deployments tab to list all deployments associated with the API.
  6. Locate the deployment you wish to edit.
  7. Select Edit from the deployment's Action menu, or click the deployment and then click Edit Deployment in the Deployment details panel.

REST

To edit a deployment, use the Patch deployment API:

curl "https://apihub.googleapis.com/v1/projects/HUB_PROJECT/locations/HUB_LOCATION/deployments/DEPLOYMENT_ID"
      -H "Authorization: Bearer: $(gcloud auth print-access-token)" -X PATCH -H "Content-Type: application/json"
      '{
        DEPLOYMENT_ATTRIBUTES
      {'

Replace the following:

  • HUB_PROJECT: The name of your API hub host project. The host project was selected when API hub was provisioned.
  • HUB_LOCATION: The location of the host project. The location was chosen when API hub was provisioned.
  • DEPLOYMENT_ID: The unique ID of the deployment to edit.
  • DEPLOYMENT_ATTRIBUTES: Attach the attributes you wish to modify in the request body. The editable attributes are described in deployment resource description in the REST API reference.