From ad239e302b2f39a068538d2596a92f69547e00a6 Mon Sep 17 00:00:00 2001 From: Marko Juraga Date: Wed, 4 Sep 2019 19:23:28 +0200 Subject: [PATCH 1/2] MAJOR: Add first v2 changes Changes: - added agent-check to server - added runtime/ url container - moved process_info to runtime/ url - added runtime/server endpoints and model - added runtime/stick_tables and runtime/stick_table_entries endpoints and models - added runtime/commands endpoint and models - renamed haproxy.yaml to configuration.yaml in both models and paths to better represent their contents --- build/haproxy_spec.yaml | 675 ++++++++++++++++++-- haproxy-spec.yaml | 156 +++-- models/{haproxy.yaml => configuration.yaml} | 3 + models/general.yaml | 36 -- models/runtime.yaml | 381 +++++++++++ paths/{haproxy.yaml => configuration.yaml} | 0 paths/general.yaml | 22 +- paths/runtime.yaml | 188 ++++++ 8 files changed, 1311 insertions(+), 150 deletions(-) rename models/{haproxy.yaml => configuration.yaml} (99%) create mode 100644 models/runtime.yaml rename paths/{haproxy.yaml => configuration.yaml} (100%) create mode 100644 paths/runtime.yaml diff --git a/build/haproxy_spec.yaml b/build/haproxy_spec.yaml index de3cd00..575ff73 100644 --- a/build/haproxy_spec.yaml +++ b/build/haproxy_spec.yaml @@ -5,7 +5,7 @@ info: description: | API for editing and managing haproxy instances. Provides process information, configuration management, haproxy stats and logs. - version: '1.2' + version: '2.0' contact: name: HAProxy Support url: https://my.haproxy.com/portal/cust/login @@ -770,6 +770,11 @@ definitions: pattern: ^[^\s]+$ type: string x-nullable: false + agent-check: + enum: + - enabled + - disabled + type: string backup: enum: - enabled @@ -2393,7 +2398,7 @@ definitions: type: array items: $ref: '#/definitions/endpoint' - process_info: + process_infos: description: General HAProxy process information example: haproxy: @@ -2404,31 +2409,205 @@ definitions: time: "2018-07-02T12:00:00.124Z" uptime: 8 version: 1.7-dev1-868ab3-148 - properties: - haproxy: - properties: - pid: - description: Process id of the replying worker process - type: integer - x-nullable: true - processes: - description: Number of spawned processes - type: integer - x-nullable: true - release_date: - description: HAProxy version release date - format: date - type: string - uptime: - description: HAProxy uptime in s - type: integer - x-nullable: true - version: - description: HAProxy version string - type: string - type: object + items: + properties: + error: + type: string + info: + properties: + active_peers: + type: integer + x-nullable: true + busy_polling: + type: integer + x-nullable: true + bytes_out_rate: + type: integer + x-nullable: true + compress_bps_in: + type: integer + x-nullable: true + compress_bps_out: + type: integer + x-nullable: true + compress_bps_rate_lim: + type: integer + x-nullable: true + conn_rate: + type: integer + x-nullable: true + conn_rate_limit: + type: integer + x-nullable: true + connected_peers: + type: integer + x-nullable: true + cum_conns: + type: integer + x-nullable: true + cum_req: + type: integer + x-nullable: true + curr_conns: + type: integer + x-nullable: true + curr_ssl_conns: + type: integer + x-nullable: true + dropped_logs: + type: integer + x-nullable: true + failed_resolutions: + type: integer + x-nullable: true + hard_max_conn: + type: integer + x-nullable: true + idle_pct: + type: integer + x-nullable: true + jobs: + type: integer + x-nullable: true + listeners: + type: integer + x-nullable: true + max_conn: + type: integer + x-nullable: true + max_conn_rate: + type: integer + x-nullable: true + max_pipes: + type: integer + x-nullable: true + max_sess_rate: + type: integer + x-nullable: true + max_sock: + type: integer + x-nullable: true + max_ssl_conns: + type: integer + x-nullable: true + max_ssl_rate: + type: integer + x-nullable: true + max_zlib_mem_usage: + type: integer + x-nullable: true + mem_max_mb: + type: integer + x-nullable: true + nbthread: + description: Number of threads + type: integer + x-display-name: Number of Threads + x-nullable: true + node: + type: string + pid: + description: Process id of the replying worker process + type: integer + x-display-name: PID + x-nullable: true + pipes_free: + type: integer + x-nullable: true + pipes_used: + type: integer + x-nullable: true + pool_alloc_mb: + type: integer + x-nullable: true + pool_failed: + type: integer + x-nullable: true + pool_used_mb: + type: integer + x-nullable: true + process_num: + description: Process number + type: integer + x-display-name: Process Number + x-nullable: true + processes: + description: Number of spawned processes + type: integer + x-display-name: Number of processes + x-nullable: true + release_date: + description: HAProxy version release date + format: date + type: string + run_queue: + type: integer + x-nullable: true + sess_rate: + type: integer + x-nullable: true + sess_rate_limit: + type: integer + x-nullable: true + ssl_backend_key_rate: + type: integer + x-nullable: true + ssl_backend_max_key_rate: + type: integer + x-nullable: true + ssl_cache_lookups: + type: integer + x-nullable: true + ssl_cache_misses: + type: integer + x-nullable: true + ssl_frontend_key_rate: + type: integer + x-nullable: true + ssl_frontend_max_key_rate: + type: integer + x-nullable: true + ssl_frontend_session_reuse: + type: integer + x-nullable: true + ssl_rate: + type: integer + x-nullable: true + ssl_rate_limit: + type: integer + x-nullable: true + stopping: + type: integer + x-nullable: true + tasks: + type: integer + x-nullable: true + total_bytes_out: + type: integer + x-nullable: true + ulimit_n: + type: integer + x-nullable: true + unstoppable: + type: integer + x-nullable: true + uptime: + description: HAProxy uptime in s + type: integer + x-nullable: true + version: + description: HAProxy version string + type: string + zlib_mem_usage: + type: integer + x-nullable: true + type: object + runtimeAPI: + type: string + type: object + x-go-name: ProcessInfo title: HAProxy Information - type: object + type: array transaction: description: HAProxy configuration transaction example: @@ -2546,6 +2725,223 @@ definitions: type: array items: $ref: "#/definitions/reload" + runtime_server: + description: Runtime transient server properties + properties: + address: + pattern: ^[^\s]+$ + readOnly: true + type: string + x-nullable: false + admin_state: + enum: + - up + - maint + - drain + type: string + operational_state: + enum: + - up + - down + - stopping + type: string + port: + maximum: 65535 + minimum: 0 + readOnly: true + type: integer + x-nullable: true + server_id: + readOnly: true + type: string + server_name: + readOnly: true + type: string + title: Runtime Server + type: object + stick_table: + description: Stick Table Information + properties: + expire: + type: integer + x-nullable: true + fields: + items: + properties: + field: + enum: + - server_id + - gpc0 + - gpc1 + - gpc1_rate + - conn_cnt + - conn_cur + - conn_rate + - sess_cnt + - sess_rate + - http_req_cnt + - http_req_rate + - http_err_cnt + - http_err_rate + - bytes_in_cnt + - bytes_in_rate + - bytes_out_cnt + - bytes_out_rate + type: string + period: + type: integer + x-dependency: + type: + value: rate + type: + enum: + - rate + - counter + type: string + type: object + type: array + keylen: + type: integer + x-display-name: Key Length + x-nullable: true + name: + type: string + nopurge: + type: boolean + x-display-name: No Purge + peers: + pattern: ^[^\s]+$ + type: string + process: + description: Process number if master-worker mode + type: integer + x-nullable: true + size: + type: integer + x-nullable: true + store: + pattern: ^[^\s]+$ + type: string + type: + enum: + - ip + - ipv6 + - integer + - string + - binary + type: string + title: Stick Table + type: object + stick_tables: + title: Stick Tables Array + description: Array of runtime stick tables + type: array + items: + $ref: "#/definitions/stick_table" + stick_table_entry: + description: One entry in stick table + properties: + bytes_in_cnt: + type: integer + x-nullable: true + bytes_in_rate: + type: integer + x-nullable: true + bytes_out_cnt: + type: integer + x-nullable: true + bytes_out_rate: + type: integer + x-nullable: true + conn_cnt: + type: integer + x-nullable: true + conn_cur: + type: integer + x-nullable: true + conn_rate: + type: integer + x-nullable: true + exp: + type: integer + x-nullable: true + gpc0: + type: integer + x-nullable: true + gpc0_rate: + type: integer + x-nullable: true + gpc1: + type: integer + x-nullable: true + gpc1_rate: + type: integer + x-nullable: true + http_err_cnt: + type: integer + x-nullable: true + http_err_rate: + type: integer + x-nullable: true + http_req_cnt: + type: integer + x-nullable: true + http_req_rate: + type: integer + x-nullable: true + id: + type: string + key: + type: string + sess_cnt: + type: integer + x-nullable: true + sess_rate: + type: integer + x-nullable: true + use: + type: boolean + title: Stick Table Entry + type: object + stick_table_entries: + title: Stick Tables Entries + description: Entries of one runtime stick table + type: array + items: + $ref: "#/definitions/stick_table_entry" + runtime_command: + description: A command run on the Runtime API + properties: + all: + type: boolean + x-dependency: + command: + value: clear-counters + backend: + type: string + x-dependency: + command: + value: shutdown-sessions-server + command: + enum: + - shutdown-sessions-server + - clear-counters + type: string + result: + enum: + - successful + - failed + readOnly: true + type: string + server: + type: string + x-dependency: + command: + value: shutdown-sessions-server + required: + - command + title: Runtime command + type: object balance: properties: algorithm: @@ -2719,7 +3115,7 @@ parameters: securityDefinitions: basic_auth: type: basic -basePath: /v1 +basePath: /v2 schemes: - http consumes: @@ -2781,6 +3177,8 @@ tags: - name: StickRule - name: LogTarget - name: ACL + - name: RuntimeCommand + - name: StickTable security: - basic_auth: [] paths: @@ -2864,22 +3262,6 @@ paths: summary: Return list of HAProxy related endpoints tags: - Discovery - /services/haproxy/info: - get: - description: Return HAProxy process information - operationId: getHaproxyProcessInfo - produces: - - application/json - responses: - "200": - description: Success - schema: - $ref: '#/definitions/process_info' - default: - $ref: '#/responses/DefaultError' - summary: Return HAProxy process information - tags: - - Information /services/haproxy/sites: get: description: Returns an array of all configured sites. @@ -6465,4 +6847,211 @@ paths: tags: - Configuration - HAProxy configuration management + /services/haproxy/runtime: + get: + description: Returns a list of endpoints to be used for advanced runtime settings + of HAProxy objects. + operationId: getRuntimeEndpoints + produces: + - application/json + responses: + "200": + description: Success + schema: + $ref: '#/definitions/endpoints' + default: + $ref: '#/responses/DefaultError' + summary: Return list of HAProxy advanced runtime endpoints + tags: + - Discovery + /services/haproxy/runtime/info: + get: + description: Return HAProxy process information + operationId: getHaproxyProcessInfo + produces: + - application/json + responses: + "200": + description: Success + schema: + $ref: '#/definitions/process_infos' + default: + $ref: '#/responses/DefaultError' + summary: Return HAProxy process information + tags: + - Information + /services/haproxy/runtime/servers/{name}: + get: + description: Returns one server runtime settings by it's name in the specified backend. + operationId: getRuntimeServer + parameters: + - description: Server name + in: path + name: name + required: true + type: string + - description: Parent backend name + in: query + name: backend + required: true + type: string + responses: + "200": + description: Successful operation + schema: + properties: + data: + $ref: '#/definitions/runtime_server' + type: object + "404": + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/DefaultError' + summary: Return one server runtime settings + tags: + - Server + - Backend options + put: + description: Replaces a server transient settings by it's name in the specified + backend. + operationId: replaceRuntimeServer + parameters: + - description: Server name + in: path + name: name + required: true + type: string + - description: Parent backend name + in: query + name: backend + required: true + type: string + - in: body + name: data + required: true + schema: + $ref: '#/definitions/runtime_server' + responses: + "200": + description: Server transient settings replaced + schema: + $ref: '#/definitions/runtime_server' + "400": + $ref: '#/responses/BadRequest' + "404": + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/DefaultError' + summary: Replace server transient settings + tags: + - Server + - Backend options + /services/haproxy/runtime/commands: + post: + description: Send a command and execute it to the Runtime API + operationId: sendRuntimeCommand + parameters: + - in: body + name: data + required: true + schema: + $ref: '#/definitions/runtime_command' + responses: + "200": + description: Command executed successfully + schema: + $ref: '#/definitions/runtime_command' + default: + $ref: '#/responses/DefaultError' + summary: Send Command + tags: + - RuntimeCommand + /services/haproxy/runtime/stick_tables: + get: + description: Returns an array of all stick tables. + operationId: getStickTables + responses: + "200": + description: Successful operation + schema: + $ref: '#/definitions/stick_tables' + default: + $ref: '#/responses/DefaultError' + summary: Return Stick Tables + tags: + - StickTable + /services/haproxy/runtime/stick_tables/{name}: + get: + description: Returns one stick table from runtime. + operationId: getStickTable + parameters: + - description: Stick table name + in: path + name: name + required: true + type: string + responses: + "200": + description: Successful operation + schema: + $ref: '#/definitions/stick_table' + "404": + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/DefaultError' + summary: Return Stick Table + tags: + - StickTable + /services/haproxy/runtime/stick_table_entries: + get: + description: Returns an array of all entries in a given stick tables. + operationId: getStickTableEntries + parameters: + - description: Stick table name + in: query + name: stick_table + required: true + type: string + - description: A list of filters in format data. separated + by comma + in: query + name: filter + type: string + responses: + "200": + description: Successful operation + schema: + $ref: '#/definitions/stick_table_entries' + default: + $ref: '#/responses/DefaultError' + summary: Return Stick Table Entries + tags: + - StickTable + /services/haproxy/runtime/stick_table_entries/{id}: + get: + description: Returns one stick table entry from stick table. + operationId: getStickTableEntry + parameters: + - description: Stick table name + in: query + name: stick_table + required: true + type: string + - description: Stick table name + in: path + name: id + required: true + type: string + responses: + "200": + description: Successful operation + schema: + $ref: '#/definitions/stick_table_entry' + "404": + $ref: '#/responses/NotFound' + default: + $ref: '#/responses/DefaultError' + summary: Return Stick Table Entry + tags: + - StickTable diff --git a/haproxy-spec.yaml b/haproxy-spec.yaml index cd98d9b..5b0be01 100644 --- a/haproxy-spec.yaml +++ b/haproxy-spec.yaml @@ -5,7 +5,7 @@ info: description: | API for editing and managing haproxy instances. Provides process information, configuration management, haproxy stats and logs. - version: '1.2' + version: '2.0' contact: name: HAProxy Support url: https://my.haproxy.com/portal/cust/login @@ -27,11 +27,11 @@ definitions: items: $ref: "#/definitions/site" global: - $ref: "models/haproxy.yaml#/global" + $ref: "models/configuration.yaml#/global" defaults: - $ref: "models/haproxy.yaml#/defaults" + $ref: "models/configuration.yaml#/defaults" frontend: - $ref: "models/haproxy.yaml#/frontend" + $ref: "models/configuration.yaml#/frontend" frontends: title: Frontends description: HAProxy frontends array @@ -39,7 +39,7 @@ definitions: items: $ref: '#/definitions/frontend' backend: - $ref: "models/haproxy.yaml#/backend" + $ref: "models/configuration.yaml#/backend" backends: title: Backends description: HAProxy backends array @@ -47,7 +47,7 @@ definitions: items: $ref: '#/definitions/backend' bind: - $ref: "models/haproxy.yaml#/bind" + $ref: "models/configuration.yaml#/bind" binds: title: Binds description: HAProxy frontend binds array (corresponds to bind directives) @@ -55,7 +55,7 @@ definitions: items: $ref: '#/definitions/bind' server: - $ref: "models/haproxy.yaml#/server" + $ref: "models/configuration.yaml#/server" servers: title: Servers description: HAProxy backend servers array @@ -63,7 +63,7 @@ definitions: items: $ref: '#/definitions/server' http_request_rule: - $ref: "models/haproxy.yaml#/http_request_rule" + $ref: "models/configuration.yaml#/http_request_rule" http_request_rules: title: HTTP Request Rules Array description: HAProxy HTTP request rules array (corresponds to http-request directives) @@ -71,7 +71,7 @@ definitions: items: $ref: '#/definitions/http_request_rule' http_response_rule: - $ref: "models/haproxy.yaml#/http_response_rule" + $ref: "models/configuration.yaml#/http_response_rule" http_response_rules: title: HTTP Response Rules Array description: HAProxy HTTP response rules array (corresponds to http-response directives) @@ -79,7 +79,7 @@ definitions: items: $ref: '#/definitions/http_response_rule' tcp_request_rule: - $ref: "models/haproxy.yaml#/tcp_request_rule" + $ref: "models/configuration.yaml#/tcp_request_rule" tcp_request_rules: title: TCP Request Rules Array description: HAProxy TCP request rules array (corresponds to tcp-request directive) @@ -87,7 +87,7 @@ definitions: items: $ref: '#/definitions/tcp_request_rule' tcp_response_rule: - $ref: "models/haproxy.yaml#/tcp_response_rule" + $ref: "models/configuration.yaml#/tcp_response_rule" tcp_response_rules: title: TCP Response Rules Array description: HAProxy TCP response rules array (corresponds to tcp-response directive) @@ -95,7 +95,7 @@ definitions: items: $ref: '#/definitions/tcp_response_rule' backend_switching_rule: - $ref: "models/haproxy.yaml#/backend_switching_rule" + $ref: "models/configuration.yaml#/backend_switching_rule" backend_switching_rules: title: Backend Switching Rules Array description: HAProxy backend switching rules array (corresponds to use_backend directives) @@ -103,7 +103,7 @@ definitions: items: $ref: '#/definitions/backend_switching_rule' server_switching_rule: - $ref: "models/haproxy.yaml#/server_switching_rule" + $ref: "models/configuration.yaml#/server_switching_rule" server_switching_rules: title: Server Switching Rules Array description: HAProxy backend server switching rules array (corresponds to use-server directives) @@ -111,7 +111,7 @@ definitions: items: $ref: '#/definitions/server_switching_rule' filter: - $ref: "models/haproxy.yaml#/filter" + $ref: "models/configuration.yaml#/filter" filters: title: Filters Array description: HAProxy filters array (corresponds to filter directive) @@ -119,7 +119,7 @@ definitions: items: $ref: '#/definitions/filter' stick_rule: - $ref: "models/haproxy.yaml#/stick_rule" + $ref: "models/configuration.yaml#/stick_rule" stick_rules: title: Stick Rules Array description: HAProxy backend stick rules array (corresponds to stick store-request, stick match, stick on, stick store-response) @@ -127,7 +127,7 @@ definitions: items: $ref: '#/definitions/stick_rule' log_target: - $ref: "models/haproxy.yaml#/log_target" + $ref: "models/configuration.yaml#/log_target" log_targets: title: Log Target Array description: HAProxy log target array (corresponds to log directives) @@ -135,7 +135,7 @@ definitions: items: $ref: '#/definitions/log_target' acl: - $ref: "models/haproxy.yaml#/acl" + $ref: "models/configuration.yaml#/acl" acls: title: ACL Lines Array description: HAProxy ACL lines array (corresponds to acl directives) @@ -156,8 +156,8 @@ definitions: type: array items: $ref: '#/definitions/endpoint' - process_info: - $ref: "models/general.yaml#/process_info" + process_infos: + $ref: "models/runtime.yaml#/process_infos" transaction: $ref: "models/general.yaml#/transaction" transactions: @@ -176,18 +176,38 @@ definitions: type: array items: $ref: "#/definitions/reload" + runtime_server: + $ref: "models/runtime.yaml#/server" + stick_table: + $ref: "models/runtime.yaml#/table" + stick_tables: + title: Stick Tables Array + description: Array of runtime stick tables + type: array + items: + $ref: "#/definitions/stick_table" + stick_table_entry: + $ref: "models/runtime.yaml#/table_entry" + stick_table_entries: + title: Stick Tables Entries + description: Entries of one runtime stick table + type: array + items: + $ref: "#/definitions/stick_table_entry" + runtime_command: + $ref: "models/runtime.yaml#/command" balance: - $ref: "models/haproxy.yaml#/balance" + $ref: "models/configuration.yaml#/balance" forwardfor: - $ref: "models/haproxy.yaml#/forwardfor" + $ref: "models/configuration.yaml#/forwardfor" default_server: - $ref: "models/haproxy.yaml#/default_server" + $ref: "models/configuration.yaml#/default_server" httpchk: - $ref: "models/haproxy.yaml#/httpchk" + $ref: "models/configuration.yaml#/httpchk" redispatch: - $ref: "models/haproxy.yaml#/redispatch" + $ref: "models/configuration.yaml#/redispatch" errorfile: - $ref: "models/haproxy.yaml#/errorfile" + $ref: "models/configuration.yaml#/errorfile" responses: BadRequest: description: Bad request @@ -250,7 +270,7 @@ parameters: securityDefinitions: basic_auth: type: basic -basePath: /v1 +basePath: /v2 schemes: - http consumes: @@ -312,6 +332,8 @@ tags: - name: StickRule - name: LogTarget - name: ACL + - name: RuntimeCommand + - name: StickTable security: - basic_auth: [] paths: @@ -325,8 +347,6 @@ paths: $ref: "paths/general.yaml#/services" /services/haproxy: $ref: "paths/general.yaml#/haproxy" - /services/haproxy/info: - $ref: "paths/general.yaml#/process_info" /services/haproxy/sites: $ref: "paths/simple.yaml#/sites" /services/haproxy/sites/{name}: @@ -344,66 +364,82 @@ paths: /services/haproxy/reloads/{id}: $ref: "paths/general.yaml#/reloads_one" /services/haproxy/configuration: - $ref: "paths/general.yaml#/configuration" + $ref: "paths/general.yaml#/configuration" /services/haproxy/configuration/global: - $ref: "paths/haproxy.yaml#/global" + $ref: "paths/configuration.yaml#/global" /services/haproxy/configuration/defaults: - $ref: "paths/haproxy.yaml#/defaults" + $ref: "paths/configuration.yaml#/defaults" /services/haproxy/configuration/frontends: - $ref: "paths/haproxy.yaml#/frontends" + $ref: "paths/configuration.yaml#/frontends" /services/haproxy/configuration/frontends/{name}: - $ref: "paths/haproxy.yaml#/frontends_one" + $ref: "paths/configuration.yaml#/frontends_one" /services/haproxy/configuration/backends: - $ref: "paths/haproxy.yaml#/backends" + $ref: "paths/configuration.yaml#/backends" /services/haproxy/configuration/backends/{name}: - $ref: "paths/haproxy.yaml#/backends_one" + $ref: "paths/configuration.yaml#/backends_one" /services/haproxy/configuration/binds: - $ref: "paths/haproxy.yaml#/binds" + $ref: "paths/configuration.yaml#/binds" /services/haproxy/configuration/binds/{name}: - $ref: "paths/haproxy.yaml#/binds_one" + $ref: "paths/configuration.yaml#/binds_one" /services/haproxy/configuration/servers: - $ref: "paths/haproxy.yaml#/servers" + $ref: "paths/configuration.yaml#/servers" /services/haproxy/configuration/servers/{name}: - $ref: "paths/haproxy.yaml#/servers_one" + $ref: "paths/configuration.yaml#/servers_one" /services/haproxy/configuration/http_request_rules: - $ref: "paths/haproxy.yaml#/http_request_rules" + $ref: "paths/configuration.yaml#/http_request_rules" /services/haproxy/configuration/http_request_rules/{id}: - $ref: "paths/haproxy.yaml#/http_request_rules_one" + $ref: "paths/configuration.yaml#/http_request_rules_one" /services/haproxy/configuration/http_response_rules: - $ref: "paths/haproxy.yaml#/http_response_rules" + $ref: "paths/configuration.yaml#/http_response_rules" /services/haproxy/configuration/http_response_rules/{id}: - $ref: "paths/haproxy.yaml#/http_response_rules_one" + $ref: "paths/configuration.yaml#/http_response_rules_one" /services/haproxy/configuration/tcp_request_rules: - $ref: "paths/haproxy.yaml#/tcp_request_rules" + $ref: "paths/configuration.yaml#/tcp_request_rules" /services/haproxy/configuration/tcp_request_rules/{id}: - $ref: "paths/haproxy.yaml#/tcp_request_rules_one" + $ref: "paths/configuration.yaml#/tcp_request_rules_one" /services/haproxy/configuration/tcp_response_rules: - $ref: "paths/haproxy.yaml#/tcp_response_rules" + $ref: "paths/configuration.yaml#/tcp_response_rules" /services/haproxy/configuration/tcp_response_rules/{id}: - $ref: "paths/haproxy.yaml#/tcp_response_rules_one" + $ref: "paths/configuration.yaml#/tcp_response_rules_one" /services/haproxy/configuration/backend_switching_rules: - $ref: "paths/haproxy.yaml#/backend_switching_rules" + $ref: "paths/configuration.yaml#/backend_switching_rules" /services/haproxy/configuration/backend_switching_rules/{id}: - $ref: "paths/haproxy.yaml#/backend_switching_rules_one" + $ref: "paths/configuration.yaml#/backend_switching_rules_one" /services/haproxy/configuration/server_switching_rules: - $ref: "paths/haproxy.yaml#/server_switching_rules" + $ref: "paths/configuration.yaml#/server_switching_rules" /services/haproxy/configuration/server_switching_rules/{id}: - $ref: "paths/haproxy.yaml#/server_switching_rules_one" + $ref: "paths/configuration.yaml#/server_switching_rules_one" /services/haproxy/configuration/filters: - $ref: "paths/haproxy.yaml#/filters" + $ref: "paths/configuration.yaml#/filters" /services/haproxy/configuration/filters/{id}: - $ref: "paths/haproxy.yaml#/filters_one" + $ref: "paths/configuration.yaml#/filters_one" /services/haproxy/configuration/stick_rules: - $ref: "paths/haproxy.yaml#/stick_rules" + $ref: "paths/configuration.yaml#/stick_rules" /services/haproxy/configuration/stick_rules/{id}: - $ref: "paths/haproxy.yaml#/stick_rules_one" + $ref: "paths/configuration.yaml#/stick_rules_one" /services/haproxy/configuration/log_targets: - $ref: "paths/haproxy.yaml#/log_targets" + $ref: "paths/configuration.yaml#/log_targets" /services/haproxy/configuration/log_targets/{id}: - $ref: "paths/haproxy.yaml#/log_targets_one" + $ref: "paths/configuration.yaml#/log_targets_one" /services/haproxy/configuration/acls: - $ref: "paths/haproxy.yaml#/acls" + $ref: "paths/configuration.yaml#/acls" /services/haproxy/configuration/acls/{id}: - $ref: "paths/haproxy.yaml#/acls_one" + $ref: "paths/configuration.yaml#/acls_one" /services/haproxy/configuration/raw: - $ref: "paths/haproxy.yaml#/configuration" + $ref: "paths/configuration.yaml#/configuration" + /services/haproxy/runtime: + $ref: "paths/general.yaml#/runtime" + /services/haproxy/runtime/info: + $ref: "paths/runtime.yaml#/process_info" + /services/haproxy/runtime/servers/{name}: + $ref: "paths/runtime.yaml#/servers_one" + /services/haproxy/runtime/commands: + $ref: "paths/runtime.yaml#/commands" + /services/haproxy/runtime/stick_tables: + $ref: "paths/runtime.yaml#/stick_tables" + /services/haproxy/runtime/stick_tables/{name}: + $ref: "paths/runtime.yaml#/stick_tables_one" + /services/haproxy/runtime/stick_table_entries: + $ref: "paths/runtime.yaml#/stick_table_entries" + /services/haproxy/runtime/stick_table_entries/{id}: + $ref: "paths/runtime.yaml#/stick_table_entries_one" \ No newline at end of file diff --git a/models/haproxy.yaml b/models/configuration.yaml similarity index 99% rename from models/haproxy.yaml rename to models/configuration.yaml index fa28e28..3ac6544 100644 --- a/models/haproxy.yaml +++ b/models/configuration.yaml @@ -552,6 +552,9 @@ server: backup: type: string enum: [enabled, disabled] + agent-check: + type: string + enum: [enabled, disabled] check: type: string enum: [enabled, disabled] diff --git a/models/general.yaml b/models/general.yaml index 8e22aaa..959c983 100644 --- a/models/general.yaml +++ b/models/general.yaml @@ -76,42 +76,6 @@ info: total_memory: 16681517056 free_memory: 5790642176 dataplaneapi_memory: 44755536 -process_info: - title: HAProxy Information - description: General HAProxy process information - type: object - properties: - haproxy: - type: object - properties: - version: - type: string - description: HAProxy version string - release_date: - type: string - format: date - description: HAProxy version release date - processes: - type: integer - description: Number of spawned processes - x-nullable: true - pid: - type: integer - description: Process id of the replying worker process - x-nullable: true - uptime: - type: integer - description: HAProxy uptime in s - x-nullable: true - example: - haproxy: - version: 1.7-dev1-868ab3-148 - release_date: "2016-03-11" - address: 127.0.0.1 - time: 2018-07-02T12:00:00.124Z - processes: 4 - pid: 1234 - uptime: 8 transaction: title: Configuration transaction description: HAProxy configuration transaction diff --git a/models/runtime.yaml b/models/runtime.yaml new file mode 100644 index 0000000..0053bf7 --- /dev/null +++ b/models/runtime.yaml @@ -0,0 +1,381 @@ +process_infos: + title: HAProxy Information + description: General HAProxy process information + type: array + items: + type: object + x-go-name: ProcessInfo + properties: + runtimeAPI: + type: string + error: + type: string + info: + type: object + properties: + version: + type: string + description: HAProxy version string + release_date: + type: string + format: date + description: HAProxy version release date + nbthread: + type: integer + description: Number of threads + x-display-name: Number of Threads + x-nullable: true + processes: + type: integer + description: Number of spawned processes + x-nullable: true + x-display-name: Number of processes + process_num: + type: integer + description: Process number + x-display-name: Process Number + x-nullable: true + pid: + type: integer + description: Process id of the replying worker process + x-nullable: true + x-display-name: PID + uptime: + type: integer + description: HAProxy uptime in s + x-nullable: true + mem_max_mb: + type: integer + x-nullable: true + pool_alloc_mb: + type: integer + x-nullable: true + pool_used_mb: + type: integer + x-nullable: true + pool_failed: + type: integer + x-nullable: true + ulimit_n: + type: integer + x-nullable: true + max_sock: + type: integer + x-nullable: true + max_conn: + type: integer + x-nullable: true + hard_max_conn: + type: integer + x-nullable: true + curr_conns: + type: integer + x-nullable: true + cum_conns: + type: integer + x-nullable: true + cum_req: + type: integer + x-nullable: true + max_ssl_conns: + type: integer + x-nullable: true + curr_ssl_conns: + type: integer + x-nullable: true + max_pipes: + type: integer + x-nullable: true + pipes_used: + type: integer + x-nullable: true + pipes_free: + type: integer + x-nullable: true + conn_rate: + type: integer + x-nullable: true + conn_rate_limit: + type: integer + x-nullable: true + max_conn_rate: + type: integer + x-nullable: true + sess_rate: + type: integer + x-nullable: true + sess_rate_limit: + type: integer + x-nullable: true + max_sess_rate: + type: integer + x-nullable: true + ssl_rate: + type: integer + x-nullable: true + ssl_rate_limit: + type: integer + x-nullable: true + max_ssl_rate: + type: integer + x-nullable: true + ssl_frontend_key_rate: + type: integer + x-nullable: true + ssl_frontend_max_key_rate: + type: integer + x-nullable: true + ssl_frontend_session_reuse: + type: integer + x-nullable: true + ssl_backend_key_rate: + type: integer + x-nullable: true + ssl_backend_max_key_rate: + type: integer + x-nullable: true + ssl_cache_lookups: + type: integer + x-nullable: true + ssl_cache_misses: + type: integer + x-nullable: true + compress_bps_in: + type: integer + x-nullable: true + compress_bps_out: + type: integer + x-nullable: true + compress_bps_rate_lim: + type: integer + x-nullable: true + zlib_mem_usage: + type: integer + x-nullable: true + max_zlib_mem_usage: + type: integer + x-nullable: true + tasks: + type: integer + x-nullable: true + run_queue: + type: integer + x-nullable: true + idle_pct: + type: integer + x-nullable: true + node: + type: string + stopping: + type: integer + x-nullable: true + jobs: + type: integer + x-nullable: true + unstoppable: + type: integer + x-nullable: true + listeners: + type: integer + x-nullable: true + active_peers: + type: integer + x-nullable: true + connected_peers: + type: integer + x-nullable: true + dropped_logs: + type: integer + x-nullable: true + busy_polling: + type: integer + x-nullable: true + failed_resolutions: + type: integer + x-nullable: true + total_bytes_out: + type: integer + x-nullable: true + bytes_out_rate: + type: integer + x-nullable: true + example: + haproxy: + version: 1.7-dev1-868ab3-148 + release_date: "2016-03-11" + address: 127.0.0.1 + time: 2018-07-02T12:00:00.124Z + processes: 4 + pid: 1234 + uptime: 8 +table: + title: Stick Table + description: Stick Table Information + type: object + properties: + process: + type: integer + x-nullable: true + description: Process number if master-worker mode + name: + type: string + type: + type: string + enum: [ip, ipv6, integer, string, binary] + keylen: + type: integer + x-display-name: Key Length + x-nullable: true + size: + type: integer + x-nullable: true + expire: + type: integer + x-nullable: true + nopurge: + type: boolean + x-display-name: No Purge + peers: + type: string + pattern: '^[^\s]+$' + store: + type: string + pattern: '^[^\s]+$' + fields: + type: array + items: + type: object + properties: + field: + type: string + enum: [server_id, gpc0, gpc1, gpc1_rate, conn_cnt, conn_cur, conn_rate, sess_cnt, sess_rate, http_req_cnt, http_req_rate, http_err_cnt, http_err_rate, bytes_in_cnt, bytes_in_rate, bytes_out_cnt, bytes_out_rate] + type: + type: string + enum: [rate, counter] + period: + type: integer + x-dependency: + type: + value: rate +table_entry: + title: Stick Table Entry + description: One entry in stick table + type: object + properties: + id: + type: string + key: + type: string + gpc0: + type: integer + x-nullable: true + gpc0_rate: + type: integer + x-nullable: true + gpc1: + type: integer + x-nullable: true + gpc1_rate: + type: integer + x-nullable: true + conn_cnt: + type: integer + x-nullable: true + conn_cur: + type: integer + x-nullable: true + conn_rate: + type: integer + x-nullable: true + sess_cnt: + type: integer + x-nullable: true + sess_rate: + type: integer + x-nullable: true + http_req_cnt: + type: integer + x-nullable: true + http_req_rate: + type: integer + x-nullable: true + http_err_cnt: + type: integer + x-nullable: true + http_err_rate: + type: integer + x-nullable: true + bytes_in_cnt: + type: integer + x-nullable: true + bytes_in_rate: + type: integer + x-nullable: true + bytes_out_cnt: + type: integer + x-nullable: true + bytes_out_rate: + type: integer + x-nullable: true + exp: + type: integer + x-nullable: true + use: + type: boolean +server: + title: Runtime Server + description: Runtime transient server properties + type: object + properties: + server_id: + type: string + readOnly: true + server_name: + type: string + readOnly: true + address: + type: string + pattern: '^[^\s]+$' + x-nullable: false + readOnly: true + port: + type: integer + x-nullable: true + minimum: 0 + maximum: 65535 + readOnly: true + operational_state: + type: string + enum: [up, down, stopping] + admin_state: + type: string + enum: [up, maint, drain] +command: + title: Runtime command + description: A command run on the Runtime API + type: object + required: + - command + properties: + command: + type: string + enum: [shutdown-sessions-server, clear-counters] + backend: + type: string + x-dependency: + command: + value: shutdown-sessions-server + server: + type: string + x-dependency: + command: + value: shutdown-sessions-server + all: + type: boolean + x-dependency: + command: + value: clear-counters + result: + type: string + enum: [successful, failed] + readOnly: true \ No newline at end of file diff --git a/paths/haproxy.yaml b/paths/configuration.yaml similarity index 100% rename from paths/haproxy.yaml rename to paths/configuration.yaml diff --git a/paths/general.yaml b/paths/general.yaml index 60049ef..0f8ee15 100644 --- a/paths/general.yaml +++ b/paths/general.yaml @@ -78,36 +78,36 @@ configuration: $ref: '#/definitions/endpoints' 'default': $ref: '#/responses/DefaultError' -info: +runtime: get: tags: - - Information - summary: Return API, hardware and OS information - description: Return API, hardware and OS information - operationId: getInfo + - Discovery + summary: Return list of HAProxy advanced runtime endpoints + description: Returns a list of endpoints to be used for advanced runtime settings of HAProxy objects. + operationId: getRuntimeEndpoints produces: - application/json responses: '200': description: Success schema: - $ref: '#/definitions/info' + $ref: '#/definitions/endpoints' 'default': $ref: '#/responses/DefaultError' -process_info: +info: get: tags: - Information - summary: Return HAProxy process information - description: Return HAProxy process information - operationId: getHaproxyProcessInfo + summary: Return API, hardware and OS information + description: Return API, hardware and OS information + operationId: getInfo produces: - application/json responses: '200': description: Success schema: - $ref: '#/definitions/process_info' + $ref: '#/definitions/info' 'default': $ref: '#/responses/DefaultError' transactions: diff --git a/paths/runtime.yaml b/paths/runtime.yaml new file mode 100644 index 0000000..48661ef --- /dev/null +++ b/paths/runtime.yaml @@ -0,0 +1,188 @@ +process_info: + get: + tags: + - Information + summary: Return HAProxy process information + description: Return HAProxy process information + operationId: getHaproxyProcessInfo + produces: + - application/json + responses: + '200': + description: Success + schema: + $ref: '#/definitions/process_infos' + 'default': + $ref: '#/responses/DefaultError' +servers_one: + get: + summary: Return one server runtime settings + description: Returns one server runtime settings by it's name in the specified backend. + operationId: getRuntimeServer + tags: + - Server + - Backend options + parameters: + - name: name + in: path + description: Server name + required: true + type: string + - name: backend + in: query + description: Parent backend name + required: true + type: string + responses: + '200': + description: Successful operation + schema: + type: object + properties: + data: + $ref: "#/definitions/runtime_server" + '404': + $ref: '#/responses/NotFound' + 'default': + $ref: '#/responses/DefaultError' + put: + summary: Replace server transient settings + description: Replaces a server transient settings by it's name in the specified backend. + operationId: replaceRuntimeServer + tags: + - Server + - Backend options + parameters: + - name: name + in: path + description: Server name + required: true + type: string + - name: backend + in: query + description: Parent backend name + required: true + type: string + - name: data + in: body + required: true + schema: + $ref: '#/definitions/runtime_server' + responses: + '200': + description: Server transient settings replaced + schema: + $ref: "#/definitions/runtime_server" + '400': + $ref: '#/responses/BadRequest' + '404': + $ref: '#/responses/NotFound' + 'default': + $ref: '#/responses/DefaultError' +commands: + post: + summary: Send Command + description: Send a command and execute it to the Runtime API + operationId: sendRuntimeCommand + tags: + - RuntimeCommand + parameters: + - name: data + in: body + required: true + schema: + $ref: '#/definitions/runtime_command' + responses: + '200': + description: Command executed successfully + schema: + $ref: '#/definitions/runtime_command' + 'default': + $ref: '#/responses/DefaultError' +stick_tables: + get: + summary: Return Stick Tables + description: Returns an array of all stick tables. + operationId: getStickTables + tags: + - StickTable + responses: + '200': + description: Successful operation + schema: + $ref: "#/definitions/stick_tables" + 'default': + $ref: '#/responses/DefaultError' +stick_tables_one: + get: + summary: Return Stick Table + description: Returns one stick table from runtime. + operationId: getStickTable + tags: + - StickTable + parameters: + - name: name + in: path + description: Stick table name + required: true + type: string + responses: + '200': + description: Successful operation + schema: + $ref: "#/definitions/stick_table" + '404': + $ref: '#/responses/NotFound' + 'default': + $ref: '#/responses/DefaultError' +stick_table_entries: + get: + summary: Return Stick Table Entries + description: Returns an array of all entries in a given stick tables. + operationId: getStickTableEntries + tags: + - StickTable + parameters: + - name: stick_table + in: query + description: Stick table name + required: true + type: string + - name: filter + in: query + description: A list of filters in format data. separated by comma + type: string + responses: + '200': + description: Successful operation + schema: + $ref: "#/definitions/stick_table_entries" + 'default': + $ref: '#/responses/DefaultError' +stick_table_entries_one: + get: + summary: Return Stick Table Entry + description: Returns one stick table entry from stick table. + operationId: getStickTableEntry + tags: + - StickTable + parameters: + - name: stick_table + in: query + description: Stick table name + required: true + type: string + - name: id + in: path + description: Stick table name + required: true + type: string + responses: + '200': + description: Successful operation + schema: + $ref: "#/definitions/stick_table_entry" + '404': + $ref: '#/responses/NotFound' + 'default': + $ref: '#/responses/DefaultError' From ff9e21fd3a60d24818c125fd78543f7e23e7c6dc Mon Sep 17 00:00:00 2001 From: Marko Juraga Date: Thu, 3 Oct 2019 11:32:14 +0200 Subject: [PATCH 2/2] MINOR: stick_table: remove stick_table_entries_one uri --- build/haproxy_spec.yaml | 27 --------------------------- haproxy-spec.yaml | 4 +--- paths/runtime.yaml | 29 +---------------------------- 3 files changed, 2 insertions(+), 58 deletions(-) diff --git a/build/haproxy_spec.yaml b/build/haproxy_spec.yaml index 575ff73..105e123 100644 --- a/build/haproxy_spec.yaml +++ b/build/haproxy_spec.yaml @@ -7027,31 +7027,4 @@ paths: summary: Return Stick Table Entries tags: - StickTable - /services/haproxy/runtime/stick_table_entries/{id}: - get: - description: Returns one stick table entry from stick table. - operationId: getStickTableEntry - parameters: - - description: Stick table name - in: query - name: stick_table - required: true - type: string - - description: Stick table name - in: path - name: id - required: true - type: string - responses: - "200": - description: Successful operation - schema: - $ref: '#/definitions/stick_table_entry' - "404": - $ref: '#/responses/NotFound' - default: - $ref: '#/responses/DefaultError' - summary: Return Stick Table Entry - tags: - - StickTable diff --git a/haproxy-spec.yaml b/haproxy-spec.yaml index 5b0be01..55229fd 100644 --- a/haproxy-spec.yaml +++ b/haproxy-spec.yaml @@ -440,6 +440,4 @@ paths: /services/haproxy/runtime/stick_tables/{name}: $ref: "paths/runtime.yaml#/stick_tables_one" /services/haproxy/runtime/stick_table_entries: - $ref: "paths/runtime.yaml#/stick_table_entries" - /services/haproxy/runtime/stick_table_entries/{id}: - $ref: "paths/runtime.yaml#/stick_table_entries_one" \ No newline at end of file + $ref: "paths/runtime.yaml#/stick_table_entries" \ No newline at end of file diff --git a/paths/runtime.yaml b/paths/runtime.yaml index 48661ef..5e80a97 100644 --- a/paths/runtime.yaml +++ b/paths/runtime.yaml @@ -158,31 +158,4 @@ stick_table_entries: schema: $ref: "#/definitions/stick_table_entries" 'default': - $ref: '#/responses/DefaultError' -stick_table_entries_one: - get: - summary: Return Stick Table Entry - description: Returns one stick table entry from stick table. - operationId: getStickTableEntry - tags: - - StickTable - parameters: - - name: stick_table - in: query - description: Stick table name - required: true - type: string - - name: id - in: path - description: Stick table name - required: true - type: string - responses: - '200': - description: Successful operation - schema: - $ref: "#/definitions/stick_table_entry" - '404': - $ref: '#/responses/NotFound' - 'default': - $ref: '#/responses/DefaultError' + $ref: '#/responses/DefaultError' \ No newline at end of file