From 79760efc9be565f93ca57e51c5d25b0d24833398 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 28 Aug 2024 11:31:05 +0400 Subject: [PATCH] Add Get geoip database configuration API (#2815) --- output/openapi/elasticsearch-openapi.json | 140 ++++++++++++ output/schema/schema.json | 212 +++++++++++++++++- output/schema/validation-errors.json | 2 +- output/typescript/types.ts | 25 +++ .../GetGeoipDatabaseRequest.ts | 46 ++++ .../GetGeoipDatabaseResponse.ts | 42 ++++ 6 files changed, 461 insertions(+), 6 deletions(-) create mode 100644 specification/ingest/get_geoip_database/GetGeoipDatabaseRequest.ts create mode 100644 specification/ingest/get_geoip_database/GetGeoipDatabaseResponse.ts diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index c222db477c..01921be457 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -16055,6 +16055,55 @@ "x-available-since": "7.13.0" } }, + "/_ingest/geoip/database": { + "get": { + "tags": [ + "ingest.get_geoip_database" + ], + "summary": "Returns information about one or more geoip database configurations", + "externalDocs": { + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/TODO.html" + }, + "operationId": "ingest-get-geoip-database", + "parameters": [ + { + "$ref": "#/components/parameters/ingest.get_geoip_database#master_timeout" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/ingest.get_geoip_database#200" + } + }, + "x-available-since": "8.15.0" + } + }, + "/_ingest/geoip/database/{id}": { + "get": { + "tags": [ + "ingest.get_geoip_database" + ], + "summary": "Returns information about one or more geoip database configurations", + "externalDocs": { + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/TODO.html" + }, + "operationId": "ingest-get-geoip-database-1", + "parameters": [ + { + "$ref": "#/components/parameters/ingest.get_geoip_database#id" + }, + { + "$ref": "#/components/parameters/ingest.get_geoip_database#master_timeout" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/ingest.get_geoip_database#200" + } + }, + "x-available-since": "8.15.0" + } + }, "/_ingest/pipeline": { "get": { "tags": [ @@ -38904,6 +38953,27 @@ } } }, + "ingest.get_geoip_database#200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "databases": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ingest.get_geoip_database:DatabaseConfigurationMetadata" + } + } + }, + "required": [ + "databases" + ] + } + } + } + }, "ingest.get_pipeline#200": { "description": "", "content": { @@ -45985,6 +46055,27 @@ }, "style": "simple" }, + "ingest.get_geoip_database#id": { + "in": "path", + "name": "id", + "description": "Comma-separated list of database configuration IDs to retrieve.\nWildcard (`*`) expressions are supported.\nTo get all database configurations, omit this parameter or use `*`.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Ids" + }, + "style": "simple" + }, + "ingest.get_geoip_database#master_timeout": { + "in": "query", + "name": "master_timeout", + "description": "Period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Duration" + }, + "style": "form" + }, "ingest.get_pipeline#id": { "in": "path", "name": "id", @@ -85976,6 +86067,55 @@ "name" ] }, + "ingest.get_geoip_database:DatabaseConfigurationMetadata": { + "type": "object", + "properties": { + "id": { + "$ref": "#/components/schemas/_types:Id" + }, + "version": { + "type": "number" + }, + "modified_date_millis": { + "$ref": "#/components/schemas/_types:EpochTimeUnitMillis" + }, + "database": { + "$ref": "#/components/schemas/ingest.get_geoip_database:DatabaseConfiguration" + } + }, + "required": [ + "id", + "version", + "modified_date_millis", + "database" + ] + }, + "ingest.get_geoip_database:DatabaseConfiguration": { + "type": "object", + "properties": { + "name": { + "$ref": "#/components/schemas/_types:Name" + }, + "maxmind": { + "$ref": "#/components/schemas/ingest.get_geoip_database:Maxmind" + } + }, + "required": [ + "name", + "maxmind" + ] + }, + "ingest.get_geoip_database:Maxmind": { + "type": "object", + "properties": { + "account_id": { + "$ref": "#/components/schemas/_types:Id" + } + }, + "required": [ + "account_id" + ] + }, "ingest._types:Pipeline": { "type": "object", "properties": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 725ef42651..53f9f81c34 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -8547,17 +8547,26 @@ }, { "availability": { + "serverless": { + "visibility": "private" + }, "stack": { - "stability": "stable", - "visibility": "public" + "since": "8.15.0", + "stability": "stable" } }, - "description": "Returns geoip database configuration.", + "description": "Returns information about one or more geoip database configurations.", "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/TODO.html", "name": "ingest.get_geoip_database", - "request": null, + "request": { + "name": "Request", + "namespace": "ingest.get_geoip_database" + }, "requestBodyRequired": false, - "response": null, + "response": { + "name": "Response", + "namespace": "ingest.get_geoip_database" + }, "responseMediaType": [ "application/json" ], @@ -142278,6 +142287,199 @@ }, "specLocation": "ingest/geo_ip_stats/IngestGeoIpStatsResponse.ts#L24-L31" }, + { + "kind": "interface", + "name": { + "name": "DatabaseConfiguration", + "namespace": "ingest.get_geoip_database" + }, + "properties": [ + { + "name": "name", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Name", + "namespace": "_types" + } + } + }, + { + "name": "maxmind", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Maxmind", + "namespace": "ingest.get_geoip_database" + } + } + } + ], + "specLocation": "ingest/get_geoip_database/GetGeoipDatabaseResponse.ts#L35-L38" + }, + { + "kind": "interface", + "name": { + "name": "DatabaseConfigurationMetadata", + "namespace": "ingest.get_geoip_database" + }, + "properties": [ + { + "name": "id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Id", + "namespace": "_types" + } + } + }, + { + "name": "version", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + } + }, + { + "name": "modified_date_millis", + "required": true, + "type": { + "kind": "instance_of", + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "UnitMillis", + "namespace": "_types" + } + } + ], + "type": { + "name": "EpochTime", + "namespace": "_types" + } + } + }, + { + "name": "database", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "DatabaseConfiguration", + "namespace": "ingest.get_geoip_database" + } + } + } + ], + "specLocation": "ingest/get_geoip_database/GetGeoipDatabaseResponse.ts#L28-L33" + }, + { + "kind": "interface", + "name": { + "name": "Maxmind", + "namespace": "ingest.get_geoip_database" + }, + "properties": [ + { + "name": "account_id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Id", + "namespace": "_types" + } + } + } + ], + "specLocation": "ingest/get_geoip_database/GetGeoipDatabaseResponse.ts#L40-L42" + }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Returns information about one or more geoip database configurations.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "ingest.get_geoip_database" + }, + "path": [ + { + "description": "Comma-separated list of database configuration IDs to retrieve.\nWildcard (`*`) expressions are supported.\nTo get all database configurations, omit this parameter or use `*`.", + "name": "id", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Ids", + "namespace": "_types" + } + } + } + ], + "query": [ + { + "description": "Period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "name": "master_timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "ingest/get_geoip_database/GetGeoipDatabaseRequest.ts#L24-L46" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "databases", + "required": true, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "DatabaseConfigurationMetadata", + "namespace": "ingest.get_geoip_database" + } + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "ingest.get_geoip_database" + }, + "specLocation": "ingest/get_geoip_database/GetGeoipDatabaseResponse.ts#L24-L26" + }, { "kind": "request", "attachedBehaviors": [ diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index af7f956d39..318dc9f36f 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -876,7 +876,7 @@ }, "ingest.get_geoip_database": { "request": [ - "Missing request & response" + "Request: query parameter 'master_timeout' does not exist in the json spec" ], "response": [] }, diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 9244dbcb29..a7b9340ab4 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -12964,6 +12964,31 @@ export interface IngestGeoIpStatsResponse { nodes: Record } +export interface IngestGetGeoipDatabaseDatabaseConfiguration { + name: Name + maxmind: IngestGetGeoipDatabaseMaxmind +} + +export interface IngestGetGeoipDatabaseDatabaseConfigurationMetadata { + id: Id + version: long + modified_date_millis: EpochTime + database: IngestGetGeoipDatabaseDatabaseConfiguration +} + +export interface IngestGetGeoipDatabaseMaxmind { + account_id: Id +} + +export interface IngestGetGeoipDatabaseRequest extends RequestBase { + id?: Ids + master_timeout?: Duration +} + +export interface IngestGetGeoipDatabaseResponse { + databases: IngestGetGeoipDatabaseDatabaseConfigurationMetadata[] +} + export interface IngestGetPipelineRequest extends RequestBase { id?: Id master_timeout?: Duration diff --git a/specification/ingest/get_geoip_database/GetGeoipDatabaseRequest.ts b/specification/ingest/get_geoip_database/GetGeoipDatabaseRequest.ts new file mode 100644 index 0000000000..341705ad9f --- /dev/null +++ b/specification/ingest/get_geoip_database/GetGeoipDatabaseRequest.ts @@ -0,0 +1,46 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestBase } from '@_types/Base' +import { Ids } from '@_types/common' +import { Duration } from '@_types/Time' + +/** + * Returns information about one or more geoip database configurations. + * @rest_spec_name ingest.get_geoip_database + * @availability stack since=8.15.0 stability=stable + * @availability serverless visibility=private + */ +export interface Request extends RequestBase { + path_parts: { + /** + * Comma-separated list of database configuration IDs to retrieve. + * Wildcard (`*`) expressions are supported. + * To get all database configurations, omit this parameter or use `*`. + */ + id?: Ids + } + query_parameters: { + /** + * Period to wait for a connection to the master node. + * If no response is received before the timeout expires, the request fails and returns an error. + * @server_default 30s */ + master_timeout?: Duration + } +} diff --git a/specification/ingest/get_geoip_database/GetGeoipDatabaseResponse.ts b/specification/ingest/get_geoip_database/GetGeoipDatabaseResponse.ts new file mode 100644 index 0000000000..b8b675250c --- /dev/null +++ b/specification/ingest/get_geoip_database/GetGeoipDatabaseResponse.ts @@ -0,0 +1,42 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Id, Name } from '@_types/common' +import { long } from '@_types/Numeric' +import { EpochTime, UnitMillis } from '@_types/Time' + +export class Response { + body: { databases: DatabaseConfigurationMetadata[] } +} + +class DatabaseConfigurationMetadata { + id: Id + version: long + modified_date_millis: EpochTime + database: DatabaseConfiguration +} + +class DatabaseConfiguration { + name: Name + maxmind: Maxmind +} + +class Maxmind { + account_id: Id +}