Apigee를 사용하면 정책을 사용하여 코드를 작성하지 않고도 API 동작을 프로그래밍할 수 있습니다. 정책은 특정적으로 제한된 관리 기능을 구현하는 모듈과 같습니다. 정책은 일반적인 유형의 관리 기능을 API에 효율적이고 안정적으로 추가할 수 있도록 설계되었습니다.
정책은 보안, 비율 제한, 변환, 중재 기능과 같은 기능을 제공하므로 코드를 직접 빌드하고 유지할 필요가 없습니다. Apigee에서 제공하는 정책 유형 집합 이외에도 다양하게 사용할 수 있습니다. 또한 커스텀 스크립트와 코드(예: JavaScript 애플리케이션)를 작성하여 API 프록시 기능을 확장하고 Apigee 정책에서 지원하는 기본 관리 기능을 기반으로 혁신할 수 있습니다.
다음 섹션에 설명된 대로 Cloud Code에서 Apigee를 사용하여 API 프록시 및 공유 흐름에 정책을 만들고연결합니다. 정책 유형에 따라 리소스 관리에 설명된 대로 리소스를 만들어야 할 수 있습니다. Apigee 작업공간의 폴더 및 파일 관리도 참조하세요.
정책 만들기
Cloud Code에서 Apigee를 사용하여 정책을 만들려면 다음 안내를 따르세요.
Apigee 작업공간에서 정책을 연결할 위치에 따라 다음 작업 중 하나를 수행합니다.
연결 대상
작업
API 프록시
다음 작업 중 하나를 수행합니다.
커서를 다음 폴더 중 하나 위에 놓고 를 클릭한 후 정책 만들기를 선택합니다.
apiproxy-name 프록시 번들
apiproxy-name/apiproxy
API 프록시의 apiproxy-name/apiproxy/policies 폴더 위에 커서를 놓고 를 클릭합니다.
공유 흐름
다음 작업 중 하나를 수행합니다.
커서를 다음 폴더 중 하나 위에 놓고 를 클릭한 후 정책 만들기를 선택합니다.
sharedflow-name 공유 흐름 번들
sharedflow-name/sharedflowbundle
공유 흐름의 sharedflow-name/sharedflowbundle/policies 폴더 위에 커서를 놓고 를 클릭합니다.
정책 만들기 마법사가 열립니다.
만들려는 정책의 카테고리를 목록에서 선택합니다.
정책 카테고리에 대한 설명은 정책 참조 개요를 참조하세요.
정책의 고유한 이름을 입력하고 Enter 키를 누릅니다.
정책이 Apigee 섹션의 API 프록시 또는 공유 흐름에 대한 /policies 폴더에 추가되어 편집기에서 열립니다.
필요에 따라 파일을 수정하고 파일 > 저장 또는 ⌘S를 선택해 수정사항을 저장합니다.
정책 구성에 대한 자세한 내용은 정책 참조 개요를 참조하세요.
[[["이해하기 쉬움","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-08-18(UTC)"],[[["\u003cp\u003eApigee allows users to program API behavior without coding by using policies, which are modules that implement specific management functions.\u003c/p\u003e\n"],["\u003cp\u003ePolicies offer features like security, rate-limiting, transformation, and mediation, and can be extended with custom scripts and code.\u003c/p\u003e\n"],["\u003cp\u003ePolicies can be created and attached to API proxies or shared flows using Apigee in Cloud Code, with specific procedures outlined for each.\u003c/p\u003e\n"],["\u003cp\u003eCreating a policy involves selecting a policy category, giving the policy a unique name, and potentially creating resources depending on the policy type.\u003c/p\u003e\n"],["\u003cp\u003eTo be executed, policies must be attached to a flow by adding a \u003ccode\u003e<Step>\u003c/code\u003e element to the appropriate request or response flow in a ProxyEndpoint or TargetEndpoint configuration.\u003c/p\u003e\n"]]],[],null,["*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\n\u003cbr /\u003e\n\nApigee lets you program API behavior without writing any code by using *policies*. A policy is like a module that implements a specific, limited management function. Policies are designed to let you efficiently and reliably add common types of management capabilities to an API.\n\nPolicies provide features like security, rate-limiting, transformation, and mediation capabilities, saving you from having to build and maintain the code on your own. You're not limited to the set of policy types provided by Apigee. You can also write custom scripts and code (such as JavaScript applications) that extend API proxy functionality and enable you to innovate on top of the basic management capabilities supported by Apigee policies.\n\n[Create](#create) and [attach](#attach) policies to API proxies and shared flows using Apigee in Cloud Code as described in the following sections. Depending on the policy type, you may need to create a resource, as described in [Managing resources](/apigee/docs/api-platform/local-development/vscode/manage-resources). See also [Managing folders and files in an Apigee workspace](/apigee/docs/api-platform/local-development/vscode/manage-apigee-workspace#manage-folders-files).\n| **Before you begin** : Familiarize yourself with the concepts described in the following topics:\n|\n| - [What's a policy?](/apigee/docs/api-platform/develop/policy-attachment-and-enforcement)\n| - [Policy reference overview](/apigee/docs/api-platform/reference/policies/reference-overview-policy)\n| - [FlowCallout policy](/apigee/docs/api-platform/reference/policies/flow-callout-policy)\n\nCreating a policy\n\nTo create a policy using Apigee in Cloud Code:\n\n1. In your Apigee workspace, perform one of the following actions based on where you want to attach the policy:\n\n | Attach to | Action |\n |-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | API proxy | Perform one of the following actions: - Position your cursor over one of the following folders, click , and select **Create policy** : - \u003cvar translate=\"no\"\u003eapiproxy-name\u003c/var\u003e proxy bundle - \u003cvar translate=\"no\"\u003eapiproxy-name\u003c/var\u003e`/apiproxy` - Position your cursor over the **\u003cvar translate=\"no\"\u003eapiproxy-name\u003c/var\u003e`/apiproxy/policies`** folder for the API proxy and click . |\n | Shared flow | Perform one of the following actions: - Position your cursor over one of the following folders, click , and select **Create policy** : - \u003cvar translate=\"no\"\u003esharedflow-name\u003c/var\u003e shared flow bundle - \u003cvar translate=\"no\"\u003esharedflow-name\u003c/var\u003e`/sharedflowbundle` - Position your cursor over the **\u003cvar translate=\"no\"\u003esharedflow-name\u003c/var\u003e`/sharedflowbundle/policies`** folder for the shared flow and click . |\n\nThe Create policy wizard opens.\n\n1. Select the category of the policy that you want to create from the list.\n For a description of the policy categories, see [Policy reference overview](/apigee/docs/api-platform/reference/policies/reference-overview-policy).\n\n2. Enter a unique name for the policy and press **\u003ckbd\u003eEnter\u003c/kbd\u003e** .\n The policy is added to the `/policies` folder for the API proxy or shared flow in the Apigee section and opened in the editor.\n\n3. Edit the file, as required, and select **File \\\u003e Save** or ⌘S to save your edits.\n For more information about configuring the policy, see [Policy reference overview](/apigee/docs/api-platform/reference/policies/reference-overview-policy).\n\n4. Create resources if required by the policy type, as described in [Managing resources](/apigee/docs/api-platform/local-development/vscode/manage-resources).\n\nAttaching a policy to a flow\n\nPolicies are not executed until they are attached to a flow. You can attach a policy to a flow by adding the **\\\u003cStep\\\u003e** element to the appropriate request or response flow element in a ProxyEndpoint or TargetEndpoint configuration, as described in the following topics:\n\n- [Attaching a policy to a ProxyEndpoint or TargetEndpoint flow](/apigee/docs/api-platform/develop/attaching-policy-proxyendpoint-or-targetendpoint-flow)\n- [FlowCallout policy](/apigee/docs/api-platform/reference/policies/flow-callout-policy)\n\nFor example, the following configuration attaches a [QuotaPolicy](/apigee/docs/api-platform/reference/policies/quota-policy) to the `\u003cPreFlow\u003e` of the ProxyEndpoint to configure the number of request messages that an API proxy allows over a period of time. \n\n```\n\u003cProxyEndpoint name=\"default\"\u003e\n \u003cPreFlow\u003e\n \u003cRequest\u003e\n \u003cStep\u003e\u003cName\u003eQuotaPolicy\u003c/Name\u003e\u003c/Step\u003e\n \u003c/Request\u003e\n \u003c/PreFlow\u003e\n \u003cHTTPProxyConnection\u003e\n \u003cBasePath\u003e/weather\u003c/BasePath\u003e\n \u003c/HTTPProxyConnection\u003e\n \u003cRouteRule name=\"default\"\u003e\n \u003cTargetEndpoint\u003edefault\u003c/TargetEndpoint\u003e\n \u003c/RouteRule\u003e\n\u003c/ProxyEndpoint\u003e\n```"]]