{
  "openapi": "3.0.3",
  "info": {
    "title": "Endpoint configuration registry REST",
    "version": "v1",
    "description": ""
  },
  "servers": [
    {
      "url": "https://cloud.kaaiot.com/ecr/api/v1",
      "description": "API Server"
    }
  ],
  "paths": {
    "/endpoints/{endpointId}/app-versions/{appVersionName}": {
      "parameters": [
        {
          "name": "endpointId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Identifier of the endpoint to operate on",
          "example": "7d5dda9b-c9f6-427d-91ea-9891a4f62cbb"
        },
        {
          "name": "appVersionName",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Application version name",
          "example": "smart-kettle-v1"
        }
      ],
      "put": {
        "description": "Creates or updates (if exists) endpoint configuration for given endpoint identifier, application version, and configuration name.",
        "responses": {
          "200": {
            "description": "Configuration is successfully upserted.",
            "headers": {
              "ETag": {
                "description": "Entity tag of the returned configuration.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfigurationResponse"
                },
                "example": {
                  "configId": "231f1aae-a4be-11ea-bb37-0242ac130002",
                  "name": "night-mode",
                  "config": "{\"active\": true,\"pushInterval\": 5}",
                  "createdDate": "2017-03-17T11:30:02.643Z",
                  "updatedDate": "2017-03-17T11:30:02.643Z",
                  "origin": "SERVER"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {},
              "example": {
                "active": true,
                "pushInterval": 5
              }
            }
          }
        }
      },
      "get": {
        "description": "Returns endpoint configuration details by endpoint identifier, application version, and configuration name.",
        "responses": {
          "200": {
            "description": "Endpoint configuration is successfully retrieved.",
            "headers": {
              "ETag": {
                "description": "Identifier of the returned configuration.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "configId": "231f1aae-a4be-11ea-bb37-0242ac130002",
                  "name": "night-mode",
                  "config": "{\"active\": true,\"pushInterval\": 5}",
                  "createdDate": "2017-03-17T11:30:02.643Z",
                  "updatedDate": "2017-03-17T11:30:02.643Z",
                  "origin": "SERVER"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:read"
            ]
          }
        ]
      },
      "delete": {
        "description": "Deletes endpoint configuration by endpoint identifier, application version, and configuration name.",
        "responses": {
          "204": {
            "description": "Endpoint configuration was successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:delete"
            ]
          }
        ]
      }
    },
    "/endpoints/{endpointId}/app-versions/{appVersionName}/configurations": {
      "parameters": [
        {
          "name": "endpointId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Identifier of the endpoint to operate on",
          "example": "7d5dda9b-c9f6-427d-91ea-9891a4f62cbb"
        },
        {
          "name": "appVersionName",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Application version name",
          "example": "smart-kettle-v1"
        }
      ],
      "get": {
        "description": "Returns all endpoint configurations for given endpoint identifier and application version.",
        "responses": {
          "200": {
            "description": "Endpoint configurations are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfigurationListResponse"
                },
                "example": [
                  {
                    "configId": "231f1aae-a4be-11ea-bb37-0242ac130002",
                    "name": "default",
                    "config": "{\"active\": true,\"pushInterval\": 5}",
                    "createdDate": "2017-03-17T11:30:02.643Z",
                    "updatedDate": "2017-03-17T11:30:02.643Z",
                    "origin": "SERVER"
                  },
                  {
                    "configId": "3d6de7aa-7c15-43e9-9ca0-e7af0fcf6949",
                    "name": "night-mode",
                    "config": "{\"active\": true,\"pushInterval\": 30}",
                    "createdDate": "2017-03-18T10:15:00.000Z",
                    "updatedDate": "2017-03-18T10:15:00.000Z",
                    "origin": "SERVER"
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:read"
            ]
          }
        ]
      }
    },
    "/endpoints/batch": {
      "put": {
        "description": "Creates or updates (if exists) configuration for given endpoints in scope of specified application versions.",
        "responses": {
          "200": {
            "description": "Configurations is successfully upserted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkConfigurationRequest"
              },
              "example": {
                "endpoints": {
                  "smart-kettle-v1": [
                    "7d5dda9b-c9f6-427d-91ea-9891a4f62cbb"
                  ]
                },
                "configPayload": {
                  "active": true,
                  "pushInterval": 5
                }
              }
            }
          }
        }
      }
    },
    "/endpoints/filters/{filterId}": {
      "parameters": [
        {
          "name": "filterId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Endpoint filter ID",
          "example": "79c717d9-eedd-4f71-b9f8-86caf7e309e4"
        }
      ],
      "put": {
        "description": "Creates or updates (if exists) configuration for endpoints that match specified filter.",
        "responses": {
          "200": {
            "description": "Configurations is successfully upserted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {},
              "example": {
                "active": true,
                "pushInterval": 5
              }
            }
          }
        }
      }
    },
    "/app-versions/{appVersionName}": {
      "put": {
        "description": "Upserts current default configuration for a given application version and configuration name.",
        "responses": {
          "200": {
            "description": "Default configuration is successfully upserted.",
            "headers": {
              "ETag": {
                "description": "Entity tag of the returned configuration.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "configId": "231f1aae-a4be-11ea-bb37-0242ac130002",
                  "name": "night-mode",
                  "config": "{\"active\": true,\"pushInterval\": 5}",
                  "createdDate": "2017-03-17T11:30:02.643Z",
                  "updatedDate": "2017-03-17T11:30:02.643Z",
                  "origin": "SERVER"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:endpoint-config:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {},
              "example": {
                "active": true,
                "pushInterval": 5
              }
            }
          }
        }
      },
      "get": {
        "description": "Returns current default configuration by configuration name.",
        "responses": {
          "200": {
            "description": "Default configuration is successfully retrieved.",
            "headers": {
              "ETag": {
                "description": "Entity tag of the returned configuration.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "configId": "231f1aae-a4be-11ea-bb37-0242ac130002",
                  "name": "night-mode",
                  "config": "{\"active\": true,\"pushInterval\": 5}",
                  "createdDate": "2017-03-17T11:30:02.643Z",
                  "updatedDate": "2017-03-17T11:30:02.643Z",
                  "origin": "SERVER"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:endpoint-config:read"
            ]
          }
        ]
      },
      "delete": {
        "description": "Deletes default configuration by application version and configuration name.",
        "responses": {
          "204": {
            "description": "Default configuration was successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:delete"
            ]
          }
        ]
      }
    },
    "/app-versions/{appVersionName}/configurations": {
      "parameters": [
        {
          "name": "appVersionName",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Application version name.",
          "example": "smart-kettle-v1"
        }
      ],
      "get": {
        "description": "Returns all default configurations for a given application version.",
        "responses": {
          "200": {
            "description": "Default configurations are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": [
                  {
                    "configId": "231f1aae-a4be-11ea-bb37-0242ac130002",
                    "name": "default",
                    "config": "{\"active\": true,\"pushInterval\": 5}",
                    "createdDate": "2017-03-17T11:30:02.643Z",
                    "updatedDate": "2017-03-17T11:30:02.643Z",
                    "origin": "SERVER"
                  },
                  {
                    "configId": "3d6de7aa-7c15-43e9-9ca0-e7af0fcf6949",
                    "name": "night-mode",
                    "config": "{\"active\": true,\"pushInterval\": 30}",
                    "createdDate": "2017-03-18T10:15:00.000Z",
                    "updatedDate": "2017-03-18T10:15:00.000Z",
                    "origin": "SERVER"
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:endpoint-config:read"
            ]
          }
        ]
      }
    },
    "/app-versions/{appVersionName}/schemas": {
      "get": {
        "description": "Returns endpoint configuration schema by application version.",
        "responses": {
          "200": {
            "description": "Returns current endpoint configuration schema (if exist) for the application version.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "$id": "https://example.com/test.schema.json",
                  "$schema": "http://json-schema.org/draft-07/schema#",
                  "title": "Test",
                  "type": "object",
                  "properties": {
                    "testProp": {
                      "description": "Description of property",
                      "type": "integer",
                      "minimum": 0
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Endpoint configuration schema not found."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:read"
            ]
          }
        ]
      }
    },
    "/app-versions/{appVersionName}/schemas/validate": {
      "parameters": [
        {
          "name": "appVersionName",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Application version name.",
          "example": "smart_kettle_v1"
        }
      ],
      "put": {
        "description": "Validates endpoint configuration schema by application version name.",
        "responses": {
          "200": {
            "description": "Configuration passed validation successfully or schema is not expected and is missing."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:read"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {},
              "example": {
                "active": true,
                "pushInterval": 5
              }
            }
          }
        }
      }
    },
    "/statuses": {
      "get": {
        "description": "",
        "responses": {
          "200": {
            "description": "Configuration application statuses were successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PagableConfigurationStatus"
                }
              }
            }
          },
          "404": {
            "description": "Configuration statuses were not found."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "endpointId",
            "in": "query",
            "description": "Endpoint identifier. One or many.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "79c717d9-eedd-4f71-b9f8-86caf7e309e4"
          },
          {
            "name": "appVersionName",
            "in": "query",
            "description": "Application version name.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "smart-kettle"
          },
          {
            "name": "configId",
            "in": "query",
            "description": "Configuration identifier.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "8edcc3fa-a0e0-11ea-bb37-0242ac130002"
          }
        ]
      }
    },
    "/system/tenants/{tenantId}/configs": {
      "parameters": [
        {
          "name": "tenantId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Tenant ID."
        }
      ],
      "post": {
        "description": "Creates a new item.",
        "responses": {
          "201": {
            "description": "Item is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/ecr/api/v1/system/tenants/{tenantId}/configs/{configId}",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "description": "Entity tag used for conditional updates.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertRequest"
              },
              "example": {
                "name": "alert-email-recipients",
                "displayName": "Alert email recipients",
                "config": "{\"emails\": [\"alert-monitor@acme.com\"]}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves list.",
        "responses": {
          "200": {
            "description": "List is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListResponse"
                },
                "example": {
                  "content": [
                    {
                      "configId": "89449e85-7721-4437-8f25-23a99fe45a1c",
                      "name": "alert-email-recipients",
                      "displayName": "Alert email recipients",
                      "config": "{\"emails\": [\"alert-monitor@acme.com\"]}",
                      "createdAt": "2024-02-02T01:23:29.841Z",
                      "updatedAt": "2024-02-02T01:23:29.841Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:read"
            ]
          }
        ]
      }
    },
    "/system/tenants/{tenantId}/configs/current": {
      "parameters": [
        {
          "name": "tenantId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Tenant ID."
        }
      ],
      "get": {
        "description": "Retrieves current active config by its name.",
        "responses": {
          "200": {
            "description": "Item is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "configId": "89449e85-7721-4437-8f25-23a99fe45a1c",
                  "name": "alert-email-recipients",
                  "displayName": "Alert email recipients",
                  "config": "{\"emails\": [\"alert-monitor@acme.com\"]}",
                  "createdAt": "2024-02-02T01:23:29.841Z",
                  "updatedAt": "2024-02-02T01:23:29.841Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:read"
            ]
          }
        ]
      }
    },
    "/system/tenants/{tenantId}/configs/{configId}": {
      "parameters": [
        {
          "name": "tenantId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Tenant ID."
        },
        {
          "name": "configId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Config ID."
        }
      ],
      "get": {
        "description": "Retrieves item.",
        "responses": {
          "200": {
            "description": "Item is successfully retrieved.",
            "headers": {
              "ETag": {
                "description": "Entity tag used for conditional updates.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "configId": "89449e85-7721-4437-8f25-23a99fe45a1c",
                  "name": "alert-email-recipients",
                  "displayName": "Alert email recipients",
                  "config": "{\"emails\": [\"alert-monitor@acme.com\"]}",
                  "createdAt": "2024-02-02T01:23:29.841Z",
                  "updatedAt": "2024-02-02T01:23:29.841Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates item.",
        "responses": {},
        "security": [
          {
            "oauth_2_0": [
              "tenant:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "alert-email-recipients",
                "displayName": "Alert email recipients",
                "config": "{\"emails\": [\"alert-monitor@acme.com\"]}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes.",
        "responses": {
          "204": {
            "description": "Item is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:update"
            ]
          }
        ]
      }
    },
    "/system/applications/{appName}/configs": {
      "parameters": [
        {
          "name": "appName",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Application name."
        }
      ],
      "post": {
        "description": "Creates a new item.",
        "responses": {
          "201": {
            "description": "Item is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/ecr/api/v1/system/applications/{appName}/configs/{configId}",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "description": "Entity tag used for conditional updates.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "alert-email-recipients",
                "displayName": "Alert email recipients",
                "config": "{\"emails\": [\"alert-monitor@acme.com\"]}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves list.",
        "responses": {
          "200": {
            "description": "List is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "configId": "89449e85-7721-4437-8f25-23a99fe45a1c",
                      "name": "alert-email-recipients",
                      "displayName": "Alert email recipients",
                      "config": "{\"emails\": [\"alert-monitor@acme.com\"]}",
                      "createdAt": "2024-02-02T01:23:29.841Z",
                      "updatedAt": "2024-02-02T01:23:29.841Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:read"
            ]
          }
        ]
      }
    },
    "/system/applications/{appName}/configs/current": {
      "parameters": [
        {
          "name": "appName",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Application name."
        }
      ],
      "get": {
        "description": "Retrieves current active config by its name.",
        "responses": {
          "200": {
            "description": "Item is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "configId": "89449e85-7721-4437-8f25-23a99fe45a1c",
                  "name": "alert-email-recipients",
                  "displayName": "Alert email recipients",
                  "config": "{\"emails\": [\"alert-monitor@acme.com\"]}",
                  "createdAt": "2024-02-02T01:23:29.841Z",
                  "updatedAt": "2024-02-02T01:23:29.841Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "treeTraversalStrategy",
            "in": "query",
            "description": "Tree traversal strategy.\n- SKIP - Returns application system config or `404` if not set.\n- TRAVERSE - Traverse system configuration hierarchy tree from bottom to up trying to find closest config.\n  For example, if application `c8u2bilah0mkralggie0` lacks a specific configuration, it falls back to tenant configurations.\n",
            "required": false,
            "schema": {
              "type": "string",
              "default": "TRAVERSE",
              "enum": [
                "TRAVERSE",
                "SKIP"
              ]
            },
            "example": "SKIP"
          }
        ]
      }
    },
    "/system/applications/{appName}/configs/{configId}": {
      "parameters": [
        {
          "name": "appName",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Application name."
        },
        {
          "name": "configId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Config ID."
        }
      ],
      "get": {
        "description": "Retrieves item.",
        "responses": {
          "200": {
            "description": "Item is successfully retrieved.",
            "headers": {
              "ETag": {
                "description": "Entity tag used for conditional updates.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "configId": "89449e85-7721-4437-8f25-23a99fe45a1c",
                  "name": "alert-email-recipients",
                  "displayName": "Alert email recipients",
                  "config": "{\"emails\": [\"alert-monitor@acme.com\"]}",
                  "createdAt": "2024-02-02T01:23:29.841Z",
                  "updatedAt": "2024-02-02T01:23:29.841Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates item.",
        "responses": {
          "204": {
            "description": "Item is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "alert-email-recipients",
                "displayName": "Alert email recipients",
                "config": "{\"emails\": [\"alert-monitor@acme.com\"]}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes.",
        "responses": {
          "204": {
            "description": "Item is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:update"
            ]
          }
        ]
      }
    },
    "/system/app-versions/{appVersionName}/configs": {
      "parameters": [
        {
          "name": "appVersionName",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Application version name."
        }
      ],
      "post": {
        "description": "Creates a new item.",
        "responses": {
          "201": {
            "description": "Item is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/ecr/api/v1/system/app-versions/{appVersionName}/configs/{configId}",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "description": "Entity tag used for conditional updates.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "alert-email-recipients",
                "displayName": "Alert email recipients",
                "config": "{\"emails\": [\"alert-monitor@acme.com\"]}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves list.",
        "responses": {
          "200": {
            "description": "List is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "configId": "89449e85-7721-4437-8f25-23a99fe45a1c",
                      "name": "alert-email-recipients",
                      "displayName": "Alert email recipients",
                      "config": "{\"emails\": [\"alert-monitor@acme.com\"]}",
                      "createdAt": "2024-02-02T01:23:29.841Z",
                      "updatedAt": "2024-02-02T01:23:29.841Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:read"
            ]
          }
        ]
      }
    },
    "/system/app-versions/{appVersionName}/configs/current": {
      "parameters": [
        {
          "name": "appVersionName",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Application version name."
        }
      ],
      "get": {
        "description": "Retrieves current active config by its name.",
        "responses": {
          "200": {
            "description": "Item is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "configId": "89449e85-7721-4437-8f25-23a99fe45a1c",
                  "name": "alert-email-recipients",
                  "displayName": "Alert email recipients",
                  "config": "{\"emails\": [\"alert-monitor@acme.com\"]}",
                  "createdAt": "2024-02-02T01:23:29.841Z",
                  "updatedAt": "2024-02-02T01:23:29.841Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "treeTraversalStrategy",
            "in": "query",
            "description": "Tree traversal strategy.\n- SKIP - Returns application version system config or `404` if not set.\n- TRAVERSE - Traverse system configuration hierarchy tree from bottom to up trying to find closest config.\n  For example, if application version `c8u2bilah0mkralggie0-v1` lacks a specific configuration, it falls back to application, or tenant configurations, in that order.\n",
            "required": false,
            "schema": {
              "type": "string",
              "default": "TRAVERSE",
              "enum": [
                "TRAVERSE",
                "SKIP"
              ]
            },
            "example": "SKIP"
          }
        ]
      }
    },
    "/system/app-versions/{appVersionName}/configs/{configId}": {
      "parameters": [
        {
          "name": "appVersionName",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Application version name."
        },
        {
          "name": "configId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Config ID."
        }
      ],
      "get": {
        "description": "Retrieves item.",
        "responses": {
          "200": {
            "description": "Item is successfully retrieved.",
            "headers": {
              "ETag": {
                "description": "Entity tag used for conditional updates.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "configId": "89449e85-7721-4437-8f25-23a99fe45a1c",
                  "name": "alert-email-recipients",
                  "displayName": "Alert email recipients",
                  "config": "{\"emails\": [\"alert-monitor@acme.com\"]}",
                  "createdAt": "2024-02-02T01:23:29.841Z",
                  "updatedAt": "2024-02-02T01:23:29.841Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates item.",
        "responses": {
          "204": {
            "description": "Item is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "alert-email-recipients",
                "displayName": "Alert email recipients",
                "config": "{\"emails\": [\"alert-monitor@acme.com\"]}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes.",
        "responses": {
          "204": {
            "description": "Item is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "application:update"
            ]
          }
        ]
      }
    },
    "/system/endpoints/{endpointId}/configs": {
      "parameters": [
        {
          "name": "endpointId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Endpoint ID."
        }
      ],
      "post": {
        "description": "Creates a new item.",
        "responses": {
          "201": {
            "description": "Item is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/ecr/api/v1/system/endpoints/{endpointId}/configs/{configId}",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "description": "Entity tag used for conditional updates.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "alert-email-recipients",
                "displayName": "Alert email recipients",
                "config": "{\"emails\": [\"alert-monitor@acme.com\"]}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves list.",
        "responses": {
          "200": {
            "description": "List is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "configId": "89449e85-7721-4437-8f25-23a99fe45a1c",
                      "name": "alert-email-recipients",
                      "displayName": "Alert email recipients",
                      "config": "{\"emails\": [\"alert-monitor@acme.com\"]}",
                      "createdAt": "2024-02-02T01:23:29.841Z",
                      "updatedAt": "2024-02-02T01:23:29.841Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:read"
            ]
          }
        ]
      }
    },
    "/system/endpoints/{endpointId}/configs/current": {
      "parameters": [
        {
          "name": "endpointId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Endpoint ID."
        }
      ],
      "get": {
        "description": "Retrieves current active config by its name.",
        "responses": {
          "200": {
            "description": "Item is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "configId": "89449e85-7721-4437-8f25-23a99fe45a1c",
                  "name": "alert-email-recipients",
                  "displayName": "Alert email recipients",
                  "config": "{\"emails\": [\"alert-monitor@acme.com\"]}",
                  "createdAt": "2024-02-02T01:23:29.841Z",
                  "updatedAt": "2024-02-02T01:23:29.841Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "treeTraversalStrategy",
            "in": "query",
            "description": "Tree traversal strategy.\n- SKIP - Returns endpoint system config or `404` if not set.\n- TRAVERSE - Traverse system configuration hierarchy tree from bottom to up trying to find closest config.\n  For example, if endpoint `ep1` lacks a specific configuration, it falls back to application version, application, or tenant configurations, in that order.\n",
            "required": false,
            "schema": {
              "type": "string",
              "default": "TRAVERSE",
              "enum": [
                "TRAVERSE",
                "SKIP"
              ]
            },
            "example": "SKIP"
          }
        ]
      }
    },
    "/system/endpoints/{endpointId}/configs/{configId}": {
      "parameters": [
        {
          "name": "endpointId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Endpoint ID."
        },
        {
          "name": "configId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Config ID."
        }
      ],
      "get": {
        "description": "Retrieves item.",
        "responses": {
          "200": {
            "description": "Item is successfully retrieved.",
            "headers": {
              "ETag": {
                "description": "Entity tag used for conditional updates.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "configId": "89449e85-7721-4437-8f25-23a99fe45a1c",
                  "name": "alert-email-recipients",
                  "displayName": "Alert email recipients",
                  "config": "{\"emails\": [\"alert-monitor@acme.com\"]}",
                  "createdAt": "2024-02-02T01:23:29.841Z",
                  "updatedAt": "2024-02-02T01:23:29.841Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates item.",
        "responses": {
          "204": {
            "description": "Item is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "alert-email-recipients",
                "displayName": "Alert email recipients",
                "config": "{\"emails\": [\"alert-monitor@acme.com\"]}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes.",
        "responses": {
          "204": {
            "description": "Item is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "oauth_2_0": {
        "type": "oauth2",
        "description": "ECR supports OAuth 2.0 for authenticating all API requests.\n",
        "flows": {
          "implicit": {
            "authorizationUrl": "https://auth.example.com/oauth/authorize",
            "scopes": {}
          }
        }
      }
    },
    "schemas": {
      "ConfigurationResponse": {
        "type": "object",
        "properties": {
          "configId": {
            "type": "string",
            "description": "Configuration ID"
          },
          "name": {
            "type": "string",
            "description": "Configuration name. Defaults to \"default\" if not specified."
          },
          "config": {
            "type": "string",
            "description": "Configuration payload"
          },
          "origin": {
            "type": "string",
            "description": "Who set the configuration. \n- SERVER for configurations set through this API\n- ENDPOINT for configurations the endpoint reported about itself\n",
            "enum": [
              "SERVER",
              "ENDPOINT"
            ]
          },
          "createdDate": {
            "type": "string",
            "format": "rfc3339",
            "description": "Time of configuration creation"
          },
          "updatedDate": {
            "type": "string",
            "format": "rfc3339",
            "description": "Time of last configuration udpate"
          }
        },
        "required": [
          "configId",
          "name",
          "config",
          "origin",
          "createdDate",
          "updatedDate"
        ]
      },
      "ConfigurationListResponse": {
        "description": "List of configurations"
      },
      "BulkConfigurationRequest": {
        "type": "object",
        "properties": {
          "configPayload": {
            "description": "Configuration payload"
          },
          "endpoints": {
            "description": "version-to-endpoints mappings"
          }
        },
        "required": [
          "configPayload",
          "endpoints"
        ]
      },
      "ConfigurationStatus": {
        "type": "object",
        "properties": {
          "configId": {
            "type": "string",
            "description": "Configuration ID"
          },
          "endpointId": {
            "type": "string",
            "description": "Endpoint ID"
          },
          "appVersionName": {
            "type": "string",
            "description": "Application version name"
          },
          "config": {
            "type": "string",
            "description": "Configuration payload"
          },
          "status": {
            "type": "object",
            "description": "Configuration status",
            "enum": [
              "PENDING",
              "DISPATCHED",
              "APPLIED",
              "FAILED"
            ]
          },
          "lastDispatchedDate": {
            "type": "string",
            "format": "rfc3339",
            "description": "Last time configuration was dispatched to endpoint"
          },
          "lastConfirmedDate": {
            "type": "string",
            "format": "rfc3339",
            "description": "Last time configuration was confirmed by endpoint"
          },
          "confirmationStatusCode": {
            "type": "integer",
            "description": "Configuration application HTTP status code reported by endpoint"
          },
          "confirmationReasonPhrase": {
            "type": "integer",
            "description": "Configuration application reason phrase reported by endpoint"
          }
        },
        "required": [
          "configId",
          "endpointId",
          "appVersionName",
          "status"
        ]
      },
      "PagableConfigurationStatus": {
        "type": "object",
        "properties": {
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConfigurationStatus"
            }
          },
          "pageable": {
            "type": "object"
          },
          "totalElements": {
            "type": "integer"
          },
          "totalPages": {
            "type": "integer"
          },
          "last": {
            "type": "boolean"
          },
          "sort": {
            "type": "object"
          },
          "numberOfElements": {
            "type": "integer"
          },
          "first": {
            "type": "boolean"
          },
          "size": {
            "type": "integer"
          },
          "number": {
            "type": "integer"
          },
          "empty": {
            "type": "boolean"
          }
        }
      },
      "UpsertRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Name.",
            "pattern": "^[a-zA-Z0-9@._-]{3,100}+$"
          },
          "displayName": {
            "type": "string",
            "description": "Display name."
          },
          "config": {
            "type": "string",
            "description": "Config."
          }
        },
        "required": [
          "name",
          "config"
        ]
      },
      "ListResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UpsertRequest"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "ClientErrorResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Detailed error description."
          }
        },
        "required": [
          "message"
        ]
      }
    }
  }
}