Parametreler

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

API Proxy içinde benzersiz olmalı

targetVariableForIdentityVariableDTOHayır-Throttling 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ı
throttlingIntervalEnumThrottleTimeIntervalEvet-Throttling 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 throttling sınırları tanımlanır

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

throttlingInterval değerleri

DeğerAçıklama
ONE_SECONDSaniye başına istek sınırı
ONE_MINUTEDakika başına istek sınırı

cacheErrorHandlingType değerleri

DeğerAçıklama
FAILÖnbellek hatası durumunda isteği reddet
CONTINUEÖ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

-

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

0'dan büyük olmalı

intervalPeriodLength

Integer

Hayır

-

Throttling Zaman Aralığı

0'dan büyük olmalı

throttlingInterval

Enum

Hayır

-

Throttling Zaman Birimi

-

Örnek JSON Yapıları

1. IP Bazlı Saniyelik Throttling

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

2. IP Bazlı Saniyelik Throttling + Kullanıcı IP Bazlı Saniyelik ve Dakikalık Kota

{
  "operationMetadata" : {
    "targetScope" : "ALL",
    "targetPipeline" : "REQUEST",
    "deploy" : true,
	"deployTargetEnvironmentNameList": [
      "test", "prod"
    ], 
    "order" : 1
  },
  "policy" : {
	"type" : "policy-api-based-throttling",
    "name" : "SaniyelikIpThrottling",
    "messageCountForInterval" : 10,
    "throttlingInterval" : "ONE_SECOND",
    "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_SECOND"
      },
      {
        "targetValue": "10.0.0.*",
        "regexExpression": true,
        "messageCountForInterval": 5,
        "intervalPeriodLength": 2,
        "quotaInterval": "ONE_MINUTE"
      }
    ]   
}
}
CODE

3. Dakika Bazlı Throttling

{
  "operationMetadata" : {
    "targetScope" : "ENDPOINT",
    "targetEndpoint" : "/api/v1/transactions",
    "targetEndpointHTTPMethod" : "POST",
    "targetPipeline" : "REQUEST",
    "deploy" : true,
	"deployTargetEnvironmentNameList": [
      "test", "prod"
    ], 
    "order" : 1
  },
  "policy" : {
 	"type" : "policy-api-based-throttling",
    "name" : "DakikalikApiKeyThrottling",
    "messageCountForInterval" : 60,
    "throttlingInterval" : "ONE_MINUTE",
    "cacheConnectionTimeoutInSeconds" : 3,
    "cacheErrorHandlingType" : "PASS",
    "targetVariableForIdentity" : {
      "name" : "apiKey",
      "type" : "HEADER",
      "headerName" : "X-API-KEY",
      "description" : "API Anahtarı"
    }
  }
}
CODE