Estrutura do Arquivo .yaml de RestAPI (comando apply)

apiVersion: api-management.sensedia.com/v1
kind: RestAPI
metadata:
  # Descrição de texto aberto apenas com valores de exemplo
  type: production
  owner: engineering
spec:
  # Campos de identificação
  name: "My Api"
  version: "1.0.0"
  # Outros campos
  description: "string"
  basePath: "string"
  stageRef:
    name: "my stage"
  # Campos de atributos. Adaptive Governance deve estar habilitado.
  attributes:
    - attributeName: "AttributeName"
      tags:
        - "nameTag1"
        - "nameTag2"
  visibility:
    type: Team
    teamRef:
      name: MyTeam
  responsible:
    teamRef:
      name: "Engineering team"
  resources:
  - name: "my-resource"
    description: "string"
    operations:
    - method: GET
      path: "operation path"
      description: "operation description"
      flow:
        destination: "http://my-backend.sensedia.com"
        requestInterceptors:
        - ipFiltering:
            ips: ["192.168.10.1", "10.1.1.0"]
            type: "Allow"
        - log:
            encryptContent: true
            encryptParams: false
        - oauth:
            allowedGrantTypes: ["AuthorizationCode", "Implicit"]
        - rateLimit:
            calls: 100
            interval: Second
            softLimit:
              enabled: true
              percentage: 5
            returnQuotaHeader: true
        - restrictAccess:
            environmentRefs:
            - name: Production
            type: Allow
        - header:
            headers:
            - name: "myHeader"
              type: "App"
              extraField: "myExtraField"
        - httpMethod:
             method: "PUT"
        - logObfuscation:
             location: Header
             attribute: MyAttribute
             customRegex: "[A-Z]+"
             replaceWith: "*****"
        - spikeArrest:
             limit: 10
             interval: Second
        - jsonToText: {}
        - jsonToXml: {}
        - textToJson: {}
        - xmlToJson:
            forceValueAsString: true
        - payloadSize:
            maximumSizeKBytes: 500
        - sqlThreatProtection:
            blocks: ["Body", "Headers", "Cookies", "PathParams", "QueryParams"]
            ignoreContentTypes: ["multipart/form-data"]
            ignoreExpressions: ["expression1", "expression2"]
        - xssThreatProtection:
            uriPathExpressions:
              includeDefaultExpression: true
            queryParamExpressions:
              additionalExpressions: ["expression1"]
            bodyExpressions:
              includeDefaultExpression: true
              additionalExpressions: ["expression2", "expression3"]
O campo attributes só pode ser incluído na estrutura do arquivo se o Adaptive Governance estiver habilitado. Caso contrário, uma mensagem de erro será exibida.

Schema de RestAPI (comando apply)

{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "$id": "https://sensedia.com/cli/api-management/restapi/apply",
  "type": "object",
  "properties": {
    "apiVersion": {
      "type": "string",
      "enum": [
        "api-management.sensedia.com/v1"
      ]
    },
    "kind": {
      "type": "string",
      "enum": [
        "RestAPI"
      ]
    },
    "metadata": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "spec": {
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "version",
        "basePath",
        "stageRef"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "basePath": {
          "type": "string"
        },
        "stageRef": {
          "$ref": "#/$defs/namedRef"
        },
        "attributes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/attribute"
          }
        },
        "visibility": {
          "$ref": "#/$defs/visibility"
        },
        "responsible": {
          "$ref": "#/$defs/responsible"
        },
        "flow": {
          "$ref": "#/$defs/flow"
        },
        "resources": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/resource"
          }
        }
      }
    }
  },
  "required": [
    "apiVersion",
    "kind",
    "spec"
  ],
  "$defs": {
    "visibility": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "Team",
            "Organization",
            "Me"
          ],
          "default": "Organization"
        },
        "teamRef": {
          "$ref": "#/$defs/namedRef"
        }
      }
    },
    "namedRef": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ]
    },
    "responsible": {
          "oneOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "teamRef": {
                  "$ref": "#/$defs/namedRef"
                }
              },
              "required": ["teamRef"]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "userRef": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "login": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "login"
                  ]
                }
              },
              "required": ["userRef"]
            }
          ]
        },
    "attribute": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "attributeName": {
          "type": "string"
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "attributeName",
        "tags"
      ]
    },
    "resource": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "flow": {
          "$ref": "#/$defs/flow"
        },
        "operations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/operation"
          }
        }
      },
      "required": [
        "name"
      ]
    },
    "operation": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "method": {
          "type": "string",
          "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"]
        },
        "path": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "flow": {
          "$ref": "#/$defs/flow"
        }
      },
      "required": [
          "method",
          "path"
        ]
    },
    "requestInterceptor": {
      "type": "object",
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "ipFiltering": {
              "$ref": "#/$defs/ipFilteringInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "log": {
              "$ref": "#/$defs/logInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "oauth": {
              "$ref": "#/$defs/oauthInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "rateLimit": {
              "$ref": "#/$defs/rateLimitInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "restrictAccess": {
              "$ref": "#/$defs/restrictAccessInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "header": {
              "$ref": "#/$defs/headerInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "httpMethod": {
              "$ref": "#/$defs/httpMethodInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "logObfuscation": {
              "$ref": "#/$defs/logObfuscationInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "spikeArrest": {
              "$ref": "#/$defs/spikeArrestInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "jsonToText": {
              "$ref": "#/$defs/jsonToTextInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "jsonToXml": {
              "$ref": "#/$defs/jsonToXmlInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "textToJson": {
              "$ref": "#/$defs/textToJsonInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "xmlToJson": {
              "$ref": "#/$defs/xmlToJsonInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "payloadSize": {
              "$ref": "#/$defs/payloadSizeInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "sqlThreatProtection": {
              "$ref": "#/$defs/sqlThreatProtectionRequestInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "xssThreatProtection": {
              "$ref": "#/$defs/xssThreatProtectionRequestInterceptor"
            }
          }
        }
      ]
    },
    "responseInterceptor": {
      "type": "object",
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "log": {
              "$ref": "#/$defs/logInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "header": {
              "$ref": "#/$defs/headerInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "logObfuscation": {
              "$ref": "#/$defs/logObfuscationInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "jsonToText": {
              "$ref": "#/$defs/jsonToTextInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "jsonToXml": {
              "$ref": "#/$defs/jsonToXmlInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "textToJson": {
              "$ref": "#/$defs/textToJsonInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "xmlToJson": {
              "$ref": "#/$defs/xmlToJsonInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "sqlThreatProtection": {
              "$ref": "#/$defs/sqlThreatProtectionResponseInterceptor"
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "xssThreatProtection": {
              "$ref": "#/$defs/xssThreatProtectionResponseInterceptor"
            }
          }
        }
      ]
    },
    "flow": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "requestInterceptors": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/requestInterceptor"
          }
        },
        "responseInterceptors": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/responseInterceptor"
          }
        },
        "destination": {
          "type": "string"
        }
      }
    },
    "ipFilteringInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "ips": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "type": {
          "type": "string",
          "enum": [
            "Allow",
            "Block"
          ]
        }
      },
      "required": [
        "ips",
        "type"
      ]
    },
    "logInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "encryptContent": {
          "type": "boolean"
        },
        "encryptParams": {
          "type": "boolean"
        }
      }
    },
    "oauthInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "allowedGrantTypes": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "AuthorizationCode",
              "Implicit",
              "ClientCredentials",
              "Password"
            ]
          }
        }
      }
    },
    "rateLimitInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "calls": {
          "type": "integer"
        },
        "interval": {
          "type": "string",
          "enum": [
            "Second",
            "Minute",
            "Hour",
            "Day",
            "Month"
          ]
        },
        "softLimit": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean"
            },
            "percentage": {
              "type": "integer"
            }
          }
        },
        "returnQuotaHeader": {
          "type": "boolean"
        }
      },
      "required": [
        "calls",
        "interval"
      ]
    },
    "restrictAccessInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "environmentRefs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/namedRef"
          }
        },
        "type": {
          "type": "string",
          "enum": [
            "Allow",
            "Deny"
          ]
        }
      },
      "required": [
        "environmentRefs",
        "type"
      ]
    },
    "headerInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "headers": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "App",
                  "AccessToken",
                  "Custom"
                ]
              },
              "extraField": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "type",
              "extraField"
            ]
          }
        }
      }
    },
    "httpMethodInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "method": {
          "type": "string",
          "enum": [
            "GET",
            "POST",
            "PUT",
            "DELETE"
          ]
        }
      },
      "required": [
        "method"
      ]
    },
    "logObfuscationInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "location": {
          "type": "string",
          "enum": [
            "Header",
            "Body"
          ]
        },
        "attribute": {
          "type": "string"
        },
        "customRegex": {
          "type": "string"
        },
        "replaceWith": {
          "type": "string"
        }
      },
      "required": [
        "location",
        "replaceWith"
      ]
    },
    "spikeArrestInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "limit": {
          "type": "integer"
        },
        "interval": {
          "type": "string",
          "enum": [
            "Second",
            "Minute",
            "Hour"
          ]
        }
      },
      "required": [
        "limit",
        "interval"
      ]
    },
    "jsonToTextInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {}
    },
    "jsonToXmlInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {}
    },
    "textToJsonInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {}
    },
    "xmlToJsonInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "forceValueAsString": {
          "type": "boolean"
        }
      }
    },
    "payloadSizeInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "maximumSizeKBytes": {
          "type": "integer"
        }
      },
      "required": ["maximumSizeKBytes"]
    },
    "sqlThreatProtectionRequestInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "blocks": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "Body",
              "Headers",
              "QueryParams",
              "Cookies",
              "PathParams"
            ]
          },
          "minItems": 1
        },
        "ignoreContentTypes": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "multipart/form-data"
            ]
          },
          "minItems": 1
        },
        "ignoreExpressions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1
        }
      },
      "required": [
        "blocks"
      ]
    },
    "sqlThreatProtectionResponseInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "blocks": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "Body",
              "Headers"
            ]
          },
          "minItems": 1
        },
        "ignoreContentTypes": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "multipart/form-data"
            ]
          },
          "minItems": 1
        },
        "ignoreExpressions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1
        }
      },
      "required": [
        "blocks"
      ]
    },
    "xssThreadProtectionExpressionConfig": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "includeDefaultExpression": {
          "type": "boolean",
          "default": "false"
        },
        "additionalExpressions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1
        }
      }
    },
    "xssThreatProtectionRequestInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "uriPathExpressions": {
          "$ref": "#/$defs/xssThreadProtectionExpressionConfig"
        },
        "queryParamExpressions": {
          "$ref": "#/$defs/xssThreadProtectionExpressionConfig"
        },
        "headerExpressions": {
          "$ref": "#/$defs/xssThreadProtectionExpressionConfig"
        },
        "bodyExpressions": {
          "$ref": "#/$defs/xssThreadProtectionExpressionConfig"
        }
      }
    },
    "xssThreatProtectionResponseInterceptor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "headerExpressions": {
          "$ref": "#/$defs/xssThreadProtectionExpressionConfig"
        },
        "bodyExpressions": {
          "$ref": "#/$defs/xssThreadProtectionExpressionConfig"
        }
      }
    }
  }
}
Thanks for your feedback!
EDIT

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