Parametreler

ParametreTipZorunluVarsayılan DeğerAçıklamaKurallar
nameStringEvet-Politika adı

API Proxy içinde benzersiz olmalı

targetVariableForIdentityVariable NesnesiHayır-Kota takibi için kullanılacak kimlik değişkeniBkz.
messageCountForIntervalIntegerEvet-Belirtilen zaman aralığında izin verilen maksimum istek sayısı0'dan büyük olmalı
quotaIntervalEnum Evet-Kota zaman aralığı-
cacheConnectionTimeoutInSecondsIntegerHayır3Önbellek bağlantı zaman aşımı (saniye)0'dan büyük olmalı
cacheErrorHandlingTypeEnumHayırFAILÖnbellek hatası durumunda yapılacak işlem-

detailList

Array

Hayır

-

Her hedef (örn. kullanıcı, IP) için özel kota sınırları tanımlanır

Bir veya birden fazla kota sınırları tanımlanır.

quotaInterval Enum Değerleri

DeğerAçıklama
ONE_DAYGün başına kota
ONE_WEEKHafta başına kota
ONE_MONTHAy başına kota

cacheErrorHandlingType Enum Değerleri

DeğerAçıklama
FAILÖnbellek hatası durumunda isteği reddet
PASSÖnbellek hatası durumunda isteğe izin ver

detailList Dizisine Eklenebilecek Değerler

ParametreTipZorunluVarsayılan DeğerAçıklamaKurallar

targetValue

String

Hayır

-

Hedef Değeri

-

regexExpression

Bool

Hayır

false

Regex İfadesi

-

messageCountForInterval

Integer

Hayır

-

Kota Zaman Aralığı için Mesaj Sayısı

0'dan büyük olmalı

intervalPeriodLength

Integer

Hayır

-

Kota Zaman Aralığı

0'dan büyük olmalı

quotaInterval

Enum

Hayır

-

Kota Zaman Birimi

-

Örnek JSON Yapıları

1. IP Bazlı Saatlik Kota

{
  "operationMetadata" : {
    "targetScope" : "ALL",
    "targetPipeline" : "REQUEST",
    "deploy" : true,
	"deployTargetEnvironmentNameList": [
      "test", "prod"
    ],
    "order" : 1
  },
  "policy" : {
	"type" : "policy-api-based-quota",
    "name" : "GunlukIpKotasi",
    "messageCountForInterval" : 1000,
    "quotaInterval" : "ONE_HOUR",
    "cacheConnectionTimeoutInSeconds" : 5,
    "cacheErrorHandlingType" : "FAIL",
    "targetVariableForIdentity" : {
      "name" : "clientIp",
      "type" : "CONTEXT_VALUES",
      "contextValue" : "REQUEST_REMOTE_ADDRESS",
      "description" : "İstemci IP adresi"
    }  
	}
}
CODE

2. IP Bazlı Saatlik Kota + Kullanıcı IP Bazlı Günlük ve Saatlik Kota

{
  "operationMetadata" : {
    "targetScope" : "ALL",
    "targetPipeline" : "REQUEST",
    "deploy" : true,
	"deployTargetEnvironmentNameList": [
      "test", "prod"
    ],
    "order" : 1
  },
  "policy" : {
	"type" : "policy-api-based-quota",
    "name" : "GunlukIpKotasi",
    "messageCountForInterval" : 1000,
    "quotaInterval" : "ONE_HOUR",
    "cacheConnectionTimeoutInSeconds" : 5,
    "cacheErrorHandlingType" : "FAIL",
    "targetVariableForIdentity" : {
      "name" : "clientIp",
      "type" : "CONTEXT_VALUES",
      "contextValue" : "REQUEST_REMOTE_ADDRESS",
      "description" : "İstemci IP adresi"
    },
    "detailList": [
      {
        "targetValue": "<IP>",
        "regexExpression": false,
        "messageCountForInterval": 20,
        "intervalPeriodLength": 1,
        "quotaInterval": "ONE_DAY"
      },
      {
        "targetValue": "10.0.0.*",
        "regexExpression": true,
        "messageCountForInterval": 5,
        "intervalPeriodLength": 2,
        "quotaInterval": "ONE_HOUR"
      }
    ]   
	}
}
CODE

3. API Key Bazlı Günlük Kota + Kullanıcı API Key Bazlı Saatlik Kota

{
  "operationMetadata" : {
    "targetScope" : "ENDPOINT",
    "targetEndpoint" : "/api/v1/islemler",
    "targetEndpointHTTPMethod" : "POST",
    "targetPipeline" : "REQUEST",
    "deploy" : true,
	"deployTargetEnvironmentNameList": [
      "test", "prod"
    ], 
    "order" : 1
  },
  "policy" : {
	"type" : "policy-api-based-quota",
    "name" : "GunlukApiKeyKotasi",
    "messageCountForInterval" : 10000,
    "quotaInterval" : "ONE_DAY",
    "cacheConnectionTimeoutInSeconds" : 3,
    "cacheErrorHandlingType" : "PASS",
    "targetVariableForIdentity" : {
      "name" : "apiKey",
      "type" : "HEADER",
      "headerName" : "X-API-KEY",
      "description" : "API Anahtarı"
    },
	"detailList": [
      {
        "targetValue": "<API_KEY>",
        "regexExpression": false,
        "messageCountForInterval": 20,
        "intervalPeriodLength": 1,
        "quotaInterval": "ONE_HOUR"
      },
    ]   
	}
}
CODE

4. Kullanıcı Id Bazlı Aylık Kota

{
  "operationMetadata" : {
    "targetScope" : "ALL",
    "targetPipeline" : "REQUEST",
    "deploy" : true,
	"deployTargetEnvironmentNameList": [
      "test", "prod"
    ], 
    "order" : 1
  },
  "policy" : {     
	"type" : "policy-api-based-quota",
    "name" : "AylikKullaniciKotasi",
    "messageCountForInterval" : 50000,
    "quotaInterval" : "ONE_MONTH",
    "targetVariableForIdentity" : {
      "name" : "userId",
      "type" : "BODY",
      "targetContentType" : "JSON",
      "jsonPathValue" : "$.user.id",
      "description" : "Kullanıcı ID"
    }
  }
}
CODE