This page applies to Apigee and Apigee hybrid.
This page describes how to attach, edit, and detach project associations in API hub. Project associations enable you to automatically register APIs from Google Cloud services to API hub.
Attach a runtime project to API hub
Attaching a runtime project to API hub establishes a project association between the Google Cloud project and API hub. This association enables API hub to automatically register APIs from the project and keep them synchronized.
Before you begin
- Ensure that the data residency status (enabled or disabled) of the attached Apigee runtime project matches the data residency status of the Apigee organization associated with your API hub host project.
- Grant the Cloud API hub Runtime Project Attachment Editor (
roles/apihub.runTimeProjectAttachmentsEditor) IAM role to your principal account.
Console
To attach an runtime project to API hub, do the following steps:
- In the Google Cloud console, go to the API hub page.
- Click Settings from the left navigation menu to open the Settings page.
- Go to the Project associations tab and click Attach runtime project. This displays the Select a resource pane.
- Click the Google Cloud project where your runtime project is provisioned.
- In the Project association settings pane, select the API assets to automatically import checkbox.
- Click Attach.
REST
To attach a runtime project to API hub, use the create method.
curl -X POST
-H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json"
-d '{
"runtime_project": "RUNTIME_PROJECT_ID"
}' "https://apihub.googleapis.com/v1/projects/HUB_PROJECT_ID/locations/LOCATION/runtimeProjectAttachments?runtime_project_attachment_id=RUNTIME_PROJECT_ID"Replace the following:
- HUB_PROJECT_ID: The project ID of your API hub host project.
- LOCATION: The location of your API hub host project.
- RUNTIME_PROJECT_ID: The Google Cloud project name or ID that you want to attach to API hub.
Edit project association settings
You can edit the project association settings to change the API assets which are imported to API hub.
Console
To edit the project association settings, do the following steps:
- In the Google Cloud console, go to the API hub page.
- Click Settings from the left navigation menu to open the Settings page.
- Go to the Project associations tab to view the list of attached projects.
- Click Edit settings for the desired project.
- In the Project association settings pane, edit the API assets to automatically import checkbox selection.
- Click Save to apply your changes.
Detach a runtime project from API hub
Console
To detach a runtime project from API hub, do the following steps:
- In the Google Cloud console, go to the API hub page.
- Click Settings from the left navigation menu to open the Settings page.
- Go to the Project associations tab to view the list of attached projects.
- Click Detach project for the project you want to detach.
REST
To detach a runtime project from API hub, use the delete method.
curl -X DELETE -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://apihub.googleapis.com/v1/projects/HUB_PROJECT_ID/locations/LOCATION/runtimeProjectAttachments/RUNTIME_PROJECT_ID"
Replace the following:
- HUB_PROJECT_ID: The project ID of your API hub host project.
- LOCATION: The location of your API hub host project.
- RUNTIME_PROJECT_ID: The Google Cloud project name or ID that you want to detach from API hub.