Plan

The plan defines the set of interceptors that will be executed in the API Gateway. Each API can have multiple plans, but each plan is only executed when linked to an app or access token.

By grouping interceptors into a plan, you can create different levels of usage for your APIs, establishing distinct flow policies for each level. This gives you better control over how different types of users access your APIs.

Although an API can have multiple plans for different flow controls, each plan is linked to a single API.

Refer to the Plans documentation for more details.

Plan .yaml File Structure (apply command)

apiVersion: api-management.sensedia.com/v1
kind: Plan
metadata:
  timestamp: "2024-04-16T17:06:24.046-03:00"
spec:
  name: Plan Sample
  apiRef:
    name: API Sample
    version: 1.0
  description: API Sample
  default: true
  flows:
  - context:
      revision: all
      resourceRef:
        name: all
      operationRef:
        method: all
        path: /
    requestInterceptors:
    - restrictAccess:
        environmentRefs:
        - name: Sandbox
        type: ALLOW_LIST | REJECT_LIST
    - rateLimit:
        calls: 1000
        limitBy: IP
        interval: SECOND | MINUTE | HOUR | DAY | MONTH
        softLimit:
          enabled: true | false
          percentage: 0 | 100
        returnQuotaHeader: true
    - log:
        encryptContent: false | true
        encryptParams: false | true
    - logObfuscation:
        location: HEADER | BODY
        attribute: "lorem.ipsum"
        customRegex: .+
        replaceWith: "ipsum"
    - header:
        headers:
        - name: Content-Type
          type: CUSTOM
          value: application/json
    - xmlToJson:
        forceValueAsString: true | false
    - timeAllowed:
        timezone: America/Sao_Paulo
        hoursOfDayInUTC: 4|15
    - dataObfuscation:
        location: BODY
        customRegex: '"cnpj":".*"'
        replaceWith: '"cnpj":"**.***.***/****-**"'
    - destination:
        type: APP | ACCESS_TOKEN | CUSTOM
        value: "123"
    - httpMethod:
        method: POST
    responseInterceptors:
    - jsonToXml: {}
    - header:
        headers:
        - name: Content-Type
          type: CUSTOM
          value: text/xml

Usage

If you don’t specify any flags, the interactive mode will be activated.
$ ssd (api-management | apim) get plan --name Plan Sample --api-name API Sample --api-version 1.0.0

# Fetches a plan in yaml format
$ ssd api-management get plan --id 111 --output yaml

# Fetches a plan and saves it to a yaml file
$ ssd api-management get plan --id 111 --output yaml > plan.yaml
Thanks for your feedback!
EDIT

Share your suggestions with us!
Click here and then [+ Submit idea]