MonetizationLimitsCheck 정책

현재 Apigee Edge 문서가 표시되고 있습니다.
Apigee X 문서로 이동
정보

개요

MonetizationLimitsCheck 정책을 사용해 앱 개발자의 API 호출에 수익 창출 한도를 적용할 수 있습니다.

정책이 트리거되는 몇 가지 경우는 다음과 같습니다.

  • 수익 창출 API에 액세스하는 앱 개발자가 관련 API 제품에 대한 정기 결제를 구매하지 않은 경우
  • 개발자 계정의 잔액이 부족합니다.
  • 개발자가 거래량 한도를 초과했습니다.

정책을 API 프록시에 연결하는 방법에 대한 자세한 내용은 API 프록시에 수익 창출 한도 적용을 참고하세요.

<MonetizationLimitsCheck> 요소

MonetizationLimitsCheck 정책을 지정합니다.

기본값 N/A
필수 여부 필수
유형 복합 유형
상위 요소 N/A
하위 요소 <DisplayName>
<FaultResponse>
<IgnoreUnresolvedVariables>
<Variables>

다음 표에서는 <MonetizationLimitsCheck>의 하위 요소를 간략하게 설명합니다.

하위 요소 필수 여부 설명
<DisplayName> 선택사항 정책의 커스텀 이름입니다.
<FaultResponse> 선택사항 오류가 발생할 때 요청하는 클라이언트에 반환되는 응답 메시지를 지정합니다.
<IgnoreUnresolvedVariables> 선택사항 해결되지 않은 변수가 발생하면 처리를 중지할지 여부를 결정합니다.
<Variables> 선택사항 수익 창출 한도를 확인할 흐름 변수를 지정합니다.

<MonetizationLimitsCheck> 요소는 다음 구문을 사용합니다.

문법

<?xml version="1.0" encoding="UTF-8"?>
<MonetizationLimitsCheck async="false" continueOnError="false" enabled="true" name="POLICY_NAME">
    <DisplayName>DISPLAY_NAME</DisplayName>
    <IgnoreUnresolvedVariables>[true|false]</IgnoreUnresolvedVariables>
    <Variables>
        <Product>VARIABLE_NAME</Product>
    </Variables>
    <FaultResponse>
        <Set>
            <Payload contentType="text/xml">
                <error>
                    <messages>
                        <message>MESSAGE_TEXT</message>
                        <message>MESSAGE_TEXT</message>
                    </messages>
                </error>
            </Payload>
            <StatusCode>HTTP_STATUS</StatusCode>
            <ReasonPhrase>REASON_TEXT</ReasonPhrase>
        </Set>
    </FaultResponse>
</MonetizationLimitsCheck>

다음 예는 MonetizationLimitsCheck 정책 정의를 보여줍니다.

<?xml version="1.0" encoding="UTF-8"?>
<MonetizationLimitsCheck async="false" continueOnError="false" enabled="true" name="Monetization-Limits-Check">
    <DisplayName>Monetization Limits Check</DisplayName>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <Variables>
        <Product>myproductvar.name</Product>
    </Variables>
	<FaultResponse>
	        <Set>
	            <Payload contentType="text/xml">
	                <error>
	                    <messages>
	                        <message>Developer has reached usage quota</message>
	                        <message>Is Developer Suspended - {monetizationLimits.isDeveloperSuspended} </message>
	                    </messages>
	                </error>
	            </Payload>
	            <StatusCode>403</StatusCode>
	            <ReasonPhrase>Forbidden</ReasonPhrase>
	        </Set>
	</FaultResponse>
 </MonetizationLimitsCheck>

This element has the following attributes that are common to all policies:

Attribute Default Required? Description
name N/A Required

The internal name of the policy. The value of the name attribute can contain letters, numbers, spaces, hyphens, underscores, and periods. This value cannot exceed 255 characters.

Optionally, use the <DisplayName> element to label the policy in the management UI proxy editor with a different, natural-language name.

continueOnError false Optional Set to "false" to return an error when a policy fails. This is expected behavior for most policies. Set to "true" to have flow execution continue even after a policy fails.
enabled true Optional Set to "true" to enforce the policy. Set to "false" to "turn off" the policy. The policy will not be enforced even if it remains attached to a flow.
async   false Deprecated This attribute is deprecated.

하위 요소 참조

이 섹션에서는 <MonetizationLimitsCheck>의 하위 요소를 설명합니다.

<DisplayName>

name 속성 외에 이 요소를 사용하여 관리 UI 프록시 편집기에서 자연스러운 다른 이름으로 정책의 라벨을 지정합니다.

<DisplayName> 요소는 모든 정책에 공통으로 적용됩니다.

기본값 해당 사항 없음
필수 여부 선택사항입니다. <DisplayName>을 생략하면 정책의 name 속성 값이 사용됩니다.
유형 문자열
상위 요소 <PolicyElement>
하위 요소 없음

<DisplayName> 요소는 다음 구문을 사용합니다.

문법

<PolicyElement>
  <DisplayName>policy_display_name</DisplayName>
  ...
</PolicyElement>

<PolicyElement>
  <DisplayName>My Validation Policy</DisplayName>
</PolicyElement>

<DisplayName> 요소에 속성 또는 하위 요소가 없습니다.

<IgnoreUnresolvedVariables>

Apigee에서 해결되지 않은 변수가 발생할 때 정책 처리를 중지해야 하는지 결정합니다.

기본값 True
필수 여부 선택사항
유형 불리언
상위 요소 <MonetizationLimitsCheck>
하위 요소 없음

해결되지 않은 변수를 무시하고 처리를 계속 진행하려면 값을 true로 설정하고, 그렇지 않으면 false로 설정합니다. 기본값은 true입니다.

<IgnoreUnresolvedVariables>true로 설정하는 것은 <MonetizationLimitsCheck> 요소의 continueOnErrortrue로 설정하는 것과 다릅니다. continueOnErrortrue로 설정하면 Apigee가 변수 오류뿐만 아니라 모든 오류를 무시합니다.

<IgnoreUnresolvedVariables> 요소는 다음 구문을 사용합니다.

문법

<IgnoreUnresolvedVariables>[true|false]</IgnoreUnresolvedVariables>

다음 예시에서는 <IgnoreUnresolvedVariables>false로 설정합니다.

<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>

<Variables>

정책 실행 중에 항목 또는 리소스 이름을 가져올 흐름 변수를 지정합니다.

<Variables> 요소 내에서 <Product> 요소만 지정할 수 있습니다. Apigee는 <Product> 요소에 지정된 흐름 변수에서 API 제품 이름을 가져옵니다. <Variables> 요소를 지정하지 않으면 Apigee는 기본적으로 apiproduct.name 컨텍스트 변수에서 API 제품 이름을 가져옵니다. Apigee는 API 제품 이름을 사용하여 제품의 해당 요금제를 가져오고 수익 창출 한도 검사를 수행합니다.

기본값 N/A
필수 여부 선택사항
유형 복합 유형
상위 요소 <MonetizationLimitsCheck>
하위 요소 <Product>

<Variables> 요소는 다음 구문을 사용합니다.

문법

<Variables>
    <Product>VARIABLE_NAME</Product>
</Variables>

다음 예는 API 프록시 흐름에 있는 myproductvar.name 맞춤 흐름 변수에서 API 제품 이름을 가져옵니다.

<Variables>
    <Product>myproductvar.name</Product>
</Variables>

AssignMessage 또는 JavaScript와 같은 정책을 사용하여 맞춤 흐름 변수를 설정할 수 있습니다.

<Product>

API 제품 이름이 있는 변수를 지정합니다.

기본값 N/A
필수 여부 선택사항
유형 문자열
상위 요소 <Variables>
하위 요소 없음

<Product> 요소는 다음 구문을 사용합니다.

문법

<Product>VARIABLE_NAME</Product>

다음 예는 API 프록시 흐름에 있는 myproductvar.name 맞춤 흐름 변수에서 API 제품 이름을 가져옵니다.

<Product>myproductvar.name</Product>

AssignMessage 또는 JavaScript와 같은 정책을 사용하여 맞춤 흐름 변수를 설정할 수 있습니다.

<FaultResponse>

오류가 발생한 경우 요청하는 클라이언트에 반환되는 응답 메시지를 정의합니다. 요구사항에 따라 응답 메시지를 맞춤설정할 수 있습니다. 요소와 요소의 모든 하위 요소에 관한 자세한 내용은 FaultResponse를 참조하세요.

흐름 변수

<MonetizationLimitsCheck> 요소의 ContinueOnError 속성을 true로 설정하면 오류가 발생하지 않습니다. 이 경우 흐름 변수 mint.limitsViolated, mint.isDeveloperSuspended, mint.limitsPolicyError가 자동으로 설정됩니다. 필요한 경우 이러한 변수를 사용하여 추가로 예외 처리를 수행할 수 있습니다.