確定您的 API 符合上述要求後,請將 API 新增為類型提供者資源。您必須提供 API 描述元文件,並選擇性地提供使用進階選項的其他 API 選項。將 API 新增為類型提供者可以向 Deployment Manager 公開 API 的所有資源,並允許使用者透過 Deployment Manager 建立、更新或刪除這些資源。
如果 API 具有可能不易識別的細微 API 模式,則您還需要向 Deployment Manager 提供輸入對應,以正確處理 API 要求。如需詳情,請參閱進階 API 選項一文。
在設定檔案中呼叫類型提供者
向 Deployment Manager 註冊 API 後,您就可以將 API 資源做為設定中的類型呼叫,藉此建立 API 資源。
舉例來說,如果您將類型提供者命名為 example-directory-api,而您想要建立一項名為 person 的 API 資源,則可以在設定中指定類型,如下所示:
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-03 (世界標準時間)。"],[[["\u003cp\u003eThis guide provides an overview of integrating third-party APIs with Deployment Manager, enabling users to deploy resources from those APIs as types in their configurations.\u003c/p\u003e\n"],["\u003cp\u003eDeployment Manager requires that integrated APIs be RESTful, have resolvable parameters, and provide an accessible descriptor document, among other requirements.\u003c/p\u003e\n"],["\u003cp\u003eTo integrate an API, users must add it as a Type Provider, supplying a descriptor document and any necessary advanced options to handle complex API behaviors.\u003c/p\u003e\n"],["\u003cp\u003eOnce registered as a Type Provider, an API's resources can be called as types within Deployment Manager configuration files, similar to calling Google API resources.\u003c/p\u003e\n"],["\u003cp\u003eThis feature is currently in Beta, meaning it is subject to the Pre-GA Offerings Terms and has the possibility of having limited support.\u003c/p\u003e\n"]]],[],null,["# Integrating with Deployment Manager\n\n| **Beta**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nDeployment Manager offers the ability to register a third-party API with the\nDeployment Manager service. After registering an API as a\n[type provider](/deployment-manager/docs/configuration/type-providers/creating-type-provider)\nwith Deployment Manager, you can use Deployment Manager to deploy resources from\nthe API as types in your configuration.\n\nThis document is a one-page guide that describes the process of integrating a\nthird-party API with Deployment Manager. This page does not contain\ncomprehensive instructions for each step of the process but provides an\noverview and additional links for more information. Use this page to\ngain a high-level view of the process for adding an API but refer to the\ndetailed documentation for step-by-step instructions.\n\nDetermining if an API is eligible for integrating with Deployment Manager\n-------------------------------------------------------------------------\n\nDeployment Manager has certain expectations of any API that attempts to\nintegrate with it. Specifically:\n\n- Deployment Manager expects a RESTful API. That is, the API exposes a REST-like interface with Create, Read, Update, and Delete (CRUD) methods.\n- All path and query parameters resolve successfully. All path and query parameters of the API must exist as part of the resource body or exist on all methods of the API, so that Deployment Manager can match the parameter when a user supplies it.\n- The API's descriptor document endpoint must be accessible. Deployment Manager makes an HTTP request to get an API's descriptor document so the document must be hosted somewhere accessible by Deployment Manager. The document must be publicly available or protected by basic authentication.\n- Related to the previous point, the API has either basic authentication, or, if the API is running on Google Kubernetes Engine or Google Cloud Endpoints, the API supports OAuth 2.0 authentication using an access token from the project's service account. Read more about [authentication](/deployment-manager/docs/configuration/type-providers/creating-type-provider#authentication).\n- If your API is complex, you might need to configure additional options to explain to Deployment Manager how to handle less obvious API behavior.\n\nFor more information, read the\n[API Requirements](/deployment-manager/docs/configuration/type-providers/api-requirements)\ndocumentation.\n\nAdding your API to Deployment Manager\n-------------------------------------\n\nAfter determining that your API matches the requirements above,\n[add the API as a Type Provider](/deployment-manager/docs/configuration/type-providers/creating-type-provider)\nresource. You must provide an API descriptor document and optionally, any\nadditional API options using\n[advanced options](/deployment-manager/docs/configuration/type-providers/advanced-configuration-options).\nAdding an API as a type provider exposes all resources of that API to Deployment\nManager and allows users to create, update, or delete those resources with\nDeployment Manager.\n\nIf your API has subtle API patterns that might not be easily recognizable, you\nwill need to also provide input mappings to Deployment Manager so it can\nproperly handle API requests. For information, read\n[Advanced API Options](/deployment-manager/docs/configuration/type-providers/advanced-configuration-options).\n\nCalling a type provider in configuration files\n----------------------------------------------\n\nOnce an API is registered with Deployment Manager, you can create API resources\nby calling that API resource as a type in your configuration.\n\nFor example, if you named your type provider `example-directory-api` and you\nwant to create an API resource known as `person`, you can specify the type\nin your configurations like so: \n\n resources:\n - name: Jane\n type: my-project/example-directory-api:person\n properties:\n - name: Jane\n website: www.example.com\n ...\n\nTo compare, this is the same process as calling a Google API and\ncreating an API resource: \n\n resource:\n - name: example-instance\n type: compute.v1.instance\n properties:\n - machineType: n1-standard-1\n ...\n\nWhat's next\n-----------\n\n- Read about the [API requirements](/deployment-manager/docs/configuration/type-providers/api-requirements) for adding an API to Deployment Manager\n- Follow the instructions to [add an API](/deployment-manager/docs/configuration/type-providers/creating-type-provider).\n- Learn more about [advanced API options](/deployment-manager/docs/configuration/type-providers/advanced-configuration-options).\n- Learn more about [types](/deployment-manager/docs/fundamentals#types).\n- Read about [creating a configuration](/deployment-manager/docs/configuration).\n- [Create a deployment](/deployment-manager/docs/deployments)."]]