{
  "openapi": "3.1.0",
  "info": {
    "title": "Forward Networks: Aliases API",
    "description": "Define groups of network infrastructure elements or packet header values",
    "contact": {
      "email": "support@forwardnetworks.com"
    },
    "license": {
      "name": "MIT",
      "url": "https://spdx.org/licenses/MIT"
    },
    "version": "${apiVersion}"
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "security": [
    {
      "api_token": []
    }
  ],
  "tags": [
    {
      "name": "Aliases",
      "description": "Define groups of network infrastructure elements or packet header values"
    }
  ],
  "paths": {
    "/api/snapshots/{snapshotId}/aliases": {
      "get": {
        "tags": [
          "Aliases"
        ],
        "summary": "Gets all Aliases",
        "operationId": "getAllAliasesUsingGET",
        "parameters": [
          {
            "name": "snapshotId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Aliases"
                }
              }
            }
          },
          "409": {
            "description": "The system is currently processing this Snapshot.\n\nNote: GET /networks/{networkId}/snapshots/latestProcessed can be used to determine when processing of the latest Snapshot is done or to identify an alternate Snapshot that has already been processed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorInfo"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Aliases"
        ],
        "summary": "Deletes Aliases",
        "description": "Use the optional `name` parameter to delete only specific Aliases. It can be repeated as in `?name=foo&name=bar`. Omit the `name` parameter to delete all Aliases active in the Snapshot.",
        "operationId": "deactivateAliasesUsingDELETE",
        "parameters": [
          {
            "name": "snapshotId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK. The response contains the deleted Aliases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Aliases"
                }
              }
            }
          },
          "409": {
            "description": "The system is currently processing this Snapshot.\n\nNote: GET /networks/{networkId}/snapshots/latestProcessed can be used to determine when processing of the latest Snapshot is done or to identify an alternate Snapshot that has already been processed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorInfo"
                }
              }
            }
          }
        }
      }
    },
    "/api/snapshots/{snapshotId}/aliases/{name}": {
      "get": {
        "tags": [
          "Aliases"
        ],
        "summary": "Gets an Alias",
        "operationId": "getSingleAliasUsingGET",
        "parameters": [
          {
            "name": "snapshotId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AliasAndValue"
                }
              }
            }
          },
          "409": {
            "description": "The system is currently processing this Snapshot.\n\nNote: GET /networks/{networkId}/snapshots/latestProcessed can be used to determine when processing of the latest Snapshot is done or to identify an alternate Snapshot that has already been processed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorInfo"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Aliases"
        ],
        "summary": "Creates an Alias",
        "operationId": "createSnapshotAliasUsingPUT",
        "parameters": [
          {
            "name": "snapshotId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AliasBuilder"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Alias"
                }
              }
            }
          },
          "409": {
            "description": "The system is currently processing this Snapshot.\n\nNote: GET /networks/{networkId}/snapshots/latestProcessed can be used to determine when processing of the latest Snapshot is done or to identify an alternate Snapshot that has already been processed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorInfo"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Aliases"
        ],
        "summary": "Deletes an Alias",
        "operationId": "deactivateAliasUsingDELETE",
        "parameters": [
          {
            "name": "snapshotId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Alias"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Alias": {
        "type": "object",
        "required": [
          "creationTime",
          "creatorId",
          "name",
          "type"
        ],
        "properties": {
          "creationTime": {
            "type": "integer",
            "format": "int64",
            "examples": [
              1649277285118
            ]
          },
          "creatorId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/AliasType"
          }
        }
      },
      "AliasAndValue": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Alias"
          }
        ]
      },
      "AliasBuilder": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "HOSTS",
              "DEVICES",
              "INTERFACES",
              "HEADERS",
              "LOGICAL_NETWORK"
            ]
          }
        },
        "oneOf": [
          {
            "$ref": "#/components/schemas/HostsAliasBuilder"
          },
          {
            "$ref": "#/components/schemas/DevicesAliasBuilder"
          },
          {
            "$ref": "#/components/schemas/InterfacesAliasBuilder"
          },
          {
            "$ref": "#/components/schemas/TrafficAliasBuilder"
          },
          {
            "$ref": "#/components/schemas/LogicalNetworkAliasBuilder"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "HOSTS": "#/components/schemas/HostsAliasBuilder",
            "HostFilter": "#/components/schemas/HostsAliasBuilder",
            "DEVICES": "#/components/schemas/DevicesAliasBuilder",
            "DeviceFilter": "#/components/schemas/DevicesAliasBuilder",
            "INTERFACES": "#/components/schemas/InterfacesAliasBuilder",
            "InterfaceFilter": "#/components/schemas/InterfacesAliasBuilder",
            "HEADERS": "#/components/schemas/TrafficAliasBuilder",
            "PacketFilter": "#/components/schemas/TrafficAliasBuilder",
            "LOGICAL_NETWORK": "#/components/schemas/LogicalNetworkAliasBuilder"
          }
        }
      },
      "AliasType": {
        "type": "string",
        "enum": [
          "HOSTS",
          "DEVICES",
          "INTERFACES",
          "HEADERS",
          "LOGICAL_NETWORK"
        ]
      },
      "Aliases": {
        "type": "object",
        "required": [
          "aliases"
        ],
        "properties": {
          "aliases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Alias"
            }
          }
        }
      },
      "DevicesAliasBuilder": {
        "type": "object",
        "required": [
          "name",
          "type"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/AliasType"
          },
          "values": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ErrorInfo": {
        "type": "object",
        "required": [
          "httpMethod",
          "apiUrl",
          "message"
        ],
        "properties": {
          "httpMethod": {
            "type": "string",
            "examples": [
              "GET"
            ],
            "enum": [
              "GET",
              "HEAD",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "apiUrl": {
            "type": "string",
            "examples": [
              "/api/version"
            ]
          },
          "message": {
            "type": "string",
            "description": "A description of the error"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "HostsAliasBuilder": {
        "type": "object",
        "required": [
          "name",
          "type"
        ],
        "properties": {
          "locations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "name": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/AliasType"
          },
          "values": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "InterfacesAliasBuilder": {
        "type": "object",
        "required": [
          "name",
          "type"
        ],
        "properties": {
          "isExposurePoint": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/AliasType"
          },
          "values": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "vlanIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "vlanIntfTypes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "ACCESS",
                "TRUNK"
              ]
            }
          }
        }
      },
      "LogicalNetworkAliasBuilder": {
        "type": "object",
        "required": [
          "name",
          "type"
        ],
        "properties": {
          "devices": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "edgeNodes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "name": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/AliasType"
          }
        }
      },
      "TrafficAliasBuilder": {
        "type": "object",
        "required": [
          "name",
          "type"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/AliasType"
          },
          "values": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "api_token": {
        "type": "http",
        "scheme": "basic"
      }
    }
  }
}