From 0b49cde5415eed56ac2e767371cfdd314f9fafc7 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 8 Nov 2024 13:47:09 +0400 Subject: [PATCH 01/13] Add IP Location APIs --- output/openapi/elasticsearch-openapi.json | 236 ++++++++++ output/schema/schema.json | 439 ++++++++++++++++++ output/schema/validation-errors.json | 20 + output/typescript/types.ts | 36 ++ .../ingest.delete_ip_location_database.json | 28 ++ .../ingest.get_ip_location_database.json | 32 ++ .../ingest.put_ip_location_database.json | 33 ++ .../DeleteIpLocationDatabaseRequest.ts | 48 ++ .../DeleteIpLocationDatabaseResponse.ts | 24 + .../GetIpLocationDatabaseRequest.ts | 46 ++ .../GetIpLocationDatabaseResponse.ts | 34 ++ .../PutGeoipDatabaseRequest.ts | 57 +++ .../PutGeoipDatabaseResponse.ts | 24 + 13 files changed, 1057 insertions(+) create mode 100644 specification/_json_spec/ingest.delete_ip_location_database.json create mode 100644 specification/_json_spec/ingest.get_ip_location_database.json create mode 100644 specification/_json_spec/ingest.put_ip_location_database.json create mode 100644 specification/ingest/delete_ip_location_database/DeleteIpLocationDatabaseRequest.ts create mode 100644 specification/ingest/delete_ip_location_database/DeleteIpLocationDatabaseResponse.ts create mode 100644 specification/ingest/get_ip_location_database/GetIpLocationDatabaseRequest.ts create mode 100644 specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts create mode 100644 specification/ingest/put_ip_location_database/PutGeoipDatabaseRequest.ts create mode 100644 specification/ingest/put_ip_location_database/PutGeoipDatabaseResponse.ts diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index da0132cf77..c213846a56 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -15164,6 +15164,157 @@ "x-state": "Added in 8.15.0" } }, + "/_ingest/ip_location/database/{id}": { + "get": { + "tags": [ + "ingest" + ], + "summary": "Returns information about one or more IP location database configurations", + "operationId": "ingest-get-ip-location-database-1", + "parameters": [ + { + "$ref": "#/components/parameters/ingest.get_ip_location_database#id" + }, + { + "$ref": "#/components/parameters/ingest.get_ip_location_database#master_timeout" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/ingest.get_ip_location_database#200" + } + }, + "x-state": "Added in 8.15.0" + }, + "put": { + "tags": [ + "ingest" + ], + "summary": "Returns information about one or more IP location database configurations", + "operationId": "ingest-put-ip-location-database", + "parameters": [ + { + "in": "path", + "name": "id", + "description": "ID of the database configuration to create or update.", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Id" + }, + "style": "simple" + }, + { + "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" + }, + { + "in": "query", + "name": "timeout", + "description": "Period to wait for a response. If 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" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "$ref": "#/components/schemas/_types:Name" + }, + "maxmind": { + "$ref": "#/components/schemas/ingest._types:Maxmind" + } + }, + "required": [ + "name", + "maxmind" + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/_types:AcknowledgedResponseBase" + } + } + } + } + }, + "x-state": "Added in 8.15.0" + }, + "delete": { + "tags": [ + "ingest" + ], + "summary": "Deletes a geoip database configuration", + "operationId": "ingest-delete-ip-location-database", + "parameters": [ + { + "in": "path", + "name": "id", + "description": "A comma-separated list of IP location database configurations to delete", + "required": true, + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Ids" + }, + "style": "simple" + }, + { + "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" + }, + { + "in": "query", + "name": "timeout", + "description": "Period to wait for a response. If 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" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/_types:AcknowledgedResponseBase" + } + } + } + } + }, + "x-state": "Added in 8.15.0" + } + }, "/_ingest/pipeline/{id}": { "get": { "tags": [ @@ -15406,6 +15557,26 @@ "x-state": "Added in 8.15.0" } }, + "/_ingest/ip_location/database": { + "get": { + "tags": [ + "ingest" + ], + "summary": "Returns information about one or more IP location database configurations", + "operationId": "ingest-get-ip-location-database", + "parameters": [ + { + "$ref": "#/components/parameters/ingest.get_ip_location_database#master_timeout" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/ingest.get_ip_location_database#200" + } + }, + "x-state": "Added in 8.15.0" + } + }, "/_ingest/pipeline": { "get": { "tags": [ @@ -69765,6 +69936,29 @@ "account_id" ] }, + "ingest.get_ip_location_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._types:DatabaseConfiguration" + } + }, + "required": [ + "id", + "version", + "modified_date_millis", + "database" + ] + }, "ingest._types:Pipeline": { "type": "object", "properties": { @@ -90150,6 +90344,27 @@ } } }, + "ingest.get_ip_location_database#200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "databases": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ingest.get_ip_location_database:DatabaseConfigurationMetadata" + } + } + }, + "required": [ + "databases" + ] + } + } + } + }, "ingest.get_pipeline#200": { "description": "", "content": { @@ -97280,6 +97495,27 @@ }, "style": "form" }, + "ingest.get_ip_location_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_ip_location_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", diff --git a/output/schema/schema.json b/output/schema/schema.json index a6e57cb842..9f70a7ed4e 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -8558,6 +8558,40 @@ } ] }, + { + "availability": { + "serverless": { + "visibility": "private" + }, + "stack": { + "since": "8.15.0", + "stability": "stable" + } + }, + "description": "Deletes a geoip database configuration.", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-ip-location-database-api.html", + "name": "ingest.delete_ip_location_database", + "request": { + "name": "Request", + "namespace": "ingest.delete_ip_location_database" + }, + "requestBodyRequired": false, + "response": { + "name": "Response", + "namespace": "ingest.delete_ip_location_database" + }, + "responseMediaType": [ + "application/json" + ], + "urls": [ + { + "methods": [ + "DELETE" + ], + "path": "/_ingest/ip_location/database/{id}" + } + ] + }, { "availability": { "serverless": { @@ -8669,6 +8703,46 @@ } ] }, + { + "availability": { + "serverless": { + "visibility": "private" + }, + "stack": { + "since": "8.15.0", + "stability": "stable" + } + }, + "description": "Returns information about one or more IP location database configurations.", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-ip-location-database-api.html", + "name": "ingest.get_ip_location_database", + "request": { + "name": "Request", + "namespace": "ingest.get_ip_location_database" + }, + "requestBodyRequired": false, + "response": { + "name": "Response", + "namespace": "ingest.get_ip_location_database" + }, + "responseMediaType": [ + "application/json" + ], + "urls": [ + { + "methods": [ + "GET" + ], + "path": "/_ingest/ip_location/database" + }, + { + "methods": [ + "GET" + ], + "path": "/_ingest/ip_location/database/{id}" + } + ] + }, { "availability": { "serverless": { @@ -8783,6 +8857,43 @@ } ] }, + { + "availability": { + "serverless": { + "visibility": "private" + }, + "stack": { + "since": "8.15.0", + "stability": "stable" + } + }, + "description": "Returns information about one or more IP location database configurations.", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-ip-location-database-api.html", + "name": "ingest.put_ip_location_database", + "request": { + "name": "Request", + "namespace": "ingest.put_ip_location_database" + }, + "requestBodyRequired": true, + "requestMediaType": [ + "application/json" + ], + "response": { + "name": "Response", + "namespace": "ingest.put_ip_location_database" + }, + "responseMediaType": [ + "application/json" + ], + "urls": [ + { + "methods": [ + "PUT" + ], + "path": "/_ingest/ip_location/database/{id}" + } + ] + }, { "availability": { "serverless": { @@ -146013,6 +146124,87 @@ }, "specLocation": "ingest/delete_geoip_database/DeleteGeoipDatabaseResponse.ts#L22-L24" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Deletes a geoip database configuration.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "ingest.delete_ip_location_database" + }, + "path": [ + { + "description": "A comma-separated list of IP location database configurations to delete", + "name": "id", + "required": true, + "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" + } + } + }, + { + "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.", + "name": "timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "ingest/delete_ip_location_database/DeleteIpLocationDatabaseRequest.ts#L24-L48" + }, + { + "kind": "response", + "body": { + "kind": "value", + "value": { + "kind": "instance_of", + "type": { + "name": "AcknowledgedResponseBase", + "namespace": "_types" + } + } + }, + "name": { + "name": "Response", + "namespace": "ingest.delete_ip_location_database" + }, + "specLocation": "ingest/delete_ip_location_database/DeleteIpLocationDatabaseResponse.ts#L22-L24" + }, { "kind": "request", "attachedBehaviors": [ @@ -146459,6 +146651,146 @@ }, "specLocation": "ingest/get_geoip_database/GetGeoipDatabaseResponse.ts#L25-L27" }, + { + "kind": "interface", + "name": { + "name": "DatabaseConfigurationMetadata", + "namespace": "ingest.get_ip_location_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._types" + } + } + } + ], + "specLocation": "ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts#L29-L34" + }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Returns information about one or more IP location database configurations.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "ingest.get_ip_location_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_ip_location_database/GetIpLocationDatabaseRequest.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_ip_location_database" + } + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "ingest.get_ip_location_database" + }, + "specLocation": "ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts#L25-L27" + }, { "kind": "request", "attachedBehaviors": [ @@ -146716,6 +147048,113 @@ }, "specLocation": "ingest/put_geoip_database/PutGeoipDatabaseResponse.ts#L22-L24" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "properties", + "properties": [ + { + "description": "The provider-assigned name of the IP geolocation database to download.", + "name": "name", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Name", + "namespace": "_types" + } + } + }, + { + "description": "The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported provider is maxmind, and the maxmind provider requires that an account_id (string) is configured.", + "name": "maxmind", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Maxmind", + "namespace": "ingest._types" + } + } + } + ] + }, + "description": "Returns information about one or more IP location database configurations.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "ingest.put_ip_location_database" + }, + "path": [ + { + "description": "ID of the database configuration to create or update.", + "name": "id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Id", + "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" + } + } + }, + { + "description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.", + "name": "timeout", + "required": false, + "serverDefault": "30s", + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "ingest/put_ip_location_database/PutGeoipDatabaseRequest.ts#L25-L57" + }, + { + "kind": "response", + "body": { + "kind": "value", + "value": { + "kind": "instance_of", + "type": { + "name": "AcknowledgedResponseBase", + "namespace": "_types" + } + } + }, + "name": { + "name": "Response", + "namespace": "ingest.put_ip_location_database" + }, + "specLocation": "ingest/put_ip_location_database/PutGeoipDatabaseResponse.ts#L22-L24" + }, { "kind": "request", "attachedBehaviors": [ diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index 7582be8d50..132d4b9f74 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -873,12 +873,25 @@ ], "response": [] }, + "ingest.delete_ip_location_database": { + "request": [ + "Request: query parameter 'master_timeout' does not exist in the json spec", + "Request: query parameter 'timeout' does not exist in the json spec" + ], + "response": [] + }, "ingest.get_geoip_database": { "request": [ "Request: query parameter 'master_timeout' does not exist in the json spec" ], "response": [] }, + "ingest.get_ip_location_database": { + "request": [ + "Request: query parameter 'master_timeout' does not exist in the json spec" + ], + "response": [] + }, "ingest.put_geoip_database": { "request": [ "Request: query parameter 'master_timeout' does not exist in the json spec", @@ -886,6 +899,13 @@ ], "response": [] }, + "ingest.put_ip_location_database": { + "request": [ + "Request: query parameter 'master_timeout' does not exist in the json spec", + "Request: query parameter 'timeout' does not exist in the json spec" + ], + "response": [] + }, "license.delete": { "request": [ "Request: missing json spec query parameter 'master_timeout'", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 71da122a94..c07564ead4 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -13244,6 +13244,14 @@ export interface IngestDeleteGeoipDatabaseRequest extends RequestBase { export type IngestDeleteGeoipDatabaseResponse = AcknowledgedResponseBase +export interface IngestDeleteIpLocationDatabaseRequest extends RequestBase { + id: Ids + master_timeout?: Duration + timeout?: Duration +} + +export type IngestDeleteIpLocationDatabaseResponse = AcknowledgedResponseBase + export interface IngestDeletePipelineRequest extends RequestBase { id: Id master_timeout?: Duration @@ -13294,6 +13302,22 @@ export interface IngestGetGeoipDatabaseResponse { databases: IngestGetGeoipDatabaseDatabaseConfigurationMetadata[] } +export interface IngestGetIpLocationDatabaseDatabaseConfigurationMetadata { + id: Id + version: long + modified_date_millis: EpochTime + database: IngestDatabaseConfiguration +} + +export interface IngestGetIpLocationDatabaseRequest extends RequestBase { + id?: Ids + master_timeout?: Duration +} + +export interface IngestGetIpLocationDatabaseResponse { + databases: IngestGetIpLocationDatabaseDatabaseConfigurationMetadata[] +} + export interface IngestGetPipelineRequest extends RequestBase { id?: Id master_timeout?: Duration @@ -13321,6 +13345,18 @@ export interface IngestPutGeoipDatabaseRequest extends RequestBase { export type IngestPutGeoipDatabaseResponse = AcknowledgedResponseBase +export interface IngestPutIpLocationDatabaseRequest extends RequestBase { + id: Id + master_timeout?: Duration + timeout?: Duration + body?: { + name: Name + maxmind: IngestMaxmind + } +} + +export type IngestPutIpLocationDatabaseResponse = AcknowledgedResponseBase + export interface IngestPutPipelineRequest extends RequestBase { id: Id master_timeout?: Duration diff --git a/specification/_json_spec/ingest.delete_ip_location_database.json b/specification/_json_spec/ingest.delete_ip_location_database.json new file mode 100644 index 0000000000..629ea86961 --- /dev/null +++ b/specification/_json_spec/ingest.delete_ip_location_database.json @@ -0,0 +1,28 @@ +{ + "ingest.delete_ip_location_database": { + "documentation": { + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-ip-location-database-api.html", + "description": "Deletes an ip location database configuration" + }, + "stability": "stable", + "visibility": "public", + "headers": { + "accept": ["application/json"] + }, + "url": { + "paths": [ + { + "path": "/_ingest/ip_location/database/{id}", + "methods": ["DELETE"], + "parts": { + "id": { + "type": "list", + "description": "A comma-separated list of ip location database configurations to delete" + } + } + } + ] + }, + "params": {} + } +} diff --git a/specification/_json_spec/ingest.get_ip_location_database.json b/specification/_json_spec/ingest.get_ip_location_database.json new file mode 100644 index 0000000000..d6dda6573b --- /dev/null +++ b/specification/_json_spec/ingest.get_ip_location_database.json @@ -0,0 +1,32 @@ +{ + "ingest.get_ip_location_database": { + "documentation": { + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-ip-location-database-api.html", + "description": "Returns the specified ip location database configuration" + }, + "stability": "stable", + "visibility": "public", + "headers": { + "accept": ["application/json"] + }, + "url": { + "paths": [ + { + "path": "/_ingest/ip_location/database", + "methods": ["GET"] + }, + { + "path": "/_ingest/ip_location/database/{id}", + "methods": ["GET"], + "parts": { + "id": { + "type": "list", + "description": "A comma-separated list of ip location database configurations to get; use `*` to get all ip location database configurations" + } + } + } + ] + }, + "params": {} + } +} diff --git a/specification/_json_spec/ingest.put_ip_location_database.json b/specification/_json_spec/ingest.put_ip_location_database.json new file mode 100644 index 0000000000..b10e290bd4 --- /dev/null +++ b/specification/_json_spec/ingest.put_ip_location_database.json @@ -0,0 +1,33 @@ +{ + "ingest.put_ip_location_database": { + "documentation": { + "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-ip-location-database-api.html", + "description": "Puts the configuration for a ip location database to be downloaded" + }, + "stability": "stable", + "visibility": "public", + "headers": { + "accept": ["application/json"], + "content_type": ["application/json"] + }, + "url": { + "paths": [ + { + "path": "/_ingest/ip_location/database/{id}", + "methods": ["PUT"], + "parts": { + "id": { + "type": "string", + "description": "The id of the database configuration" + } + } + } + ] + }, + "params": {}, + "body": { + "description": "The database configuration definition", + "required": true + } + } +} diff --git a/specification/ingest/delete_ip_location_database/DeleteIpLocationDatabaseRequest.ts b/specification/ingest/delete_ip_location_database/DeleteIpLocationDatabaseRequest.ts new file mode 100644 index 0000000000..0ad7b8221f --- /dev/null +++ b/specification/ingest/delete_ip_location_database/DeleteIpLocationDatabaseRequest.ts @@ -0,0 +1,48 @@ +/* + * 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' + +/** + * Deletes a geoip database configuration. + * @rest_spec_name ingest.delete_ip_location_database + * @availability stack since=8.15.0 stability=stable + * @availability serverless visibility=private + */ +export interface Request extends RequestBase { + path_parts: { + /** + * A comma-separated list of IP location database configurations to delete + */ + 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 + /** + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * @server_default 30s */ + timeout?: Duration + } +} diff --git a/specification/ingest/delete_ip_location_database/DeleteIpLocationDatabaseResponse.ts b/specification/ingest/delete_ip_location_database/DeleteIpLocationDatabaseResponse.ts new file mode 100644 index 0000000000..7374da4a4c --- /dev/null +++ b/specification/ingest/delete_ip_location_database/DeleteIpLocationDatabaseResponse.ts @@ -0,0 +1,24 @@ +/* + * 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 { AcknowledgedResponseBase } from '@_types/Base' + +export class Response { + body: AcknowledgedResponseBase +} diff --git a/specification/ingest/get_ip_location_database/GetIpLocationDatabaseRequest.ts b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseRequest.ts new file mode 100644 index 0000000000..41e4700f37 --- /dev/null +++ b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseRequest.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 IP location database configurations. + * @rest_spec_name ingest.get_ip_location_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_ip_location_database/GetIpLocationDatabaseResponse.ts b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts new file mode 100644 index 0000000000..2b1f36be23 --- /dev/null +++ b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts @@ -0,0 +1,34 @@ +/* + * 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 { DatabaseConfiguration } from '@ingest/_types/Database' +import { Id } 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 +} diff --git a/specification/ingest/put_ip_location_database/PutGeoipDatabaseRequest.ts b/specification/ingest/put_ip_location_database/PutGeoipDatabaseRequest.ts new file mode 100644 index 0000000000..34c71e9b15 --- /dev/null +++ b/specification/ingest/put_ip_location_database/PutGeoipDatabaseRequest.ts @@ -0,0 +1,57 @@ +/* + * 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 { Maxmind } from '@ingest/_types/Database' +import { RequestBase } from '@_types/Base' +import { Id, Name } from '@_types/common' +import { Duration } from '@_types/Time' + +/** + * Returns information about one or more IP location database configurations. + * @rest_spec_name ingest.put_ip_location_database + * @availability stack since=8.15.0 stability=stable + * @availability serverless visibility=private + */ +export interface Request extends RequestBase { + path_parts: { + /** + * ID of the database configuration to create or update. + */ + id: Id + } + 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 + /** + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + * @server_default 30s */ + timeout?: Duration + } + body: { + /** The provider-assigned name of the IP geolocation database to download. */ + name: Name + /** The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading. + * At present, the only supported provider is maxmind, and the maxmind provider requires that an account_id (string) is configured. + */ + maxmind: Maxmind + } +} diff --git a/specification/ingest/put_ip_location_database/PutGeoipDatabaseResponse.ts b/specification/ingest/put_ip_location_database/PutGeoipDatabaseResponse.ts new file mode 100644 index 0000000000..7374da4a4c --- /dev/null +++ b/specification/ingest/put_ip_location_database/PutGeoipDatabaseResponse.ts @@ -0,0 +1,24 @@ +/* + * 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 { AcknowledgedResponseBase } from '@_types/Base' + +export class Response { + body: AcknowledgedResponseBase +} From d83e2490adee513eb46c2c3d2bd6300676306122 Mon Sep 17 00:00:00 2001 From: Joe Gallo Date: Fri, 8 Nov 2024 17:02:03 -0500 Subject: [PATCH 02/13] Rename these files --- output/schema/schema.json | 4 ++-- ...eoipDatabaseRequest.ts => PutIpLocationDatabaseRequest.ts} | 0 ...ipDatabaseResponse.ts => PutIpLocationDatabaseResponse.ts} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename specification/ingest/put_ip_location_database/{PutGeoipDatabaseRequest.ts => PutIpLocationDatabaseRequest.ts} (100%) rename specification/ingest/put_ip_location_database/{PutGeoipDatabaseResponse.ts => PutIpLocationDatabaseResponse.ts} (100%) diff --git a/output/schema/schema.json b/output/schema/schema.json index 9f70a7ed4e..85ca581b87 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -147135,7 +147135,7 @@ } } ], - "specLocation": "ingest/put_ip_location_database/PutGeoipDatabaseRequest.ts#L25-L57" + "specLocation": "ingest/put_ip_location_database/PutIpLocationDatabaseRequest.ts#L25-L57" }, { "kind": "response", @@ -147153,7 +147153,7 @@ "name": "Response", "namespace": "ingest.put_ip_location_database" }, - "specLocation": "ingest/put_ip_location_database/PutGeoipDatabaseResponse.ts#L22-L24" + "specLocation": "ingest/put_ip_location_database/PutIpLocationDatabaseResponse.ts#L22-L24" }, { "kind": "request", diff --git a/specification/ingest/put_ip_location_database/PutGeoipDatabaseRequest.ts b/specification/ingest/put_ip_location_database/PutIpLocationDatabaseRequest.ts similarity index 100% rename from specification/ingest/put_ip_location_database/PutGeoipDatabaseRequest.ts rename to specification/ingest/put_ip_location_database/PutIpLocationDatabaseRequest.ts diff --git a/specification/ingest/put_ip_location_database/PutGeoipDatabaseResponse.ts b/specification/ingest/put_ip_location_database/PutIpLocationDatabaseResponse.ts similarity index 100% rename from specification/ingest/put_ip_location_database/PutGeoipDatabaseResponse.ts rename to specification/ingest/put_ip_location_database/PutIpLocationDatabaseResponse.ts From 01e941ce6e0f9a00efc24633c33f667622fe4bdb Mon Sep 17 00:00:00 2001 From: Joe Gallo Date: Fri, 8 Nov 2024 17:05:40 -0500 Subject: [PATCH 03/13] Reword this description --- output/openapi/elasticsearch-openapi.json | 2 +- output/schema/schema.json | 4 ++-- .../DeleteIpLocationDatabaseRequest.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index c213846a56..0ecf2aa6c9 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -15265,7 +15265,7 @@ "tags": [ "ingest" ], - "summary": "Deletes a geoip database configuration", + "summary": "Deletes an IP location database configuration", "operationId": "ingest-delete-ip-location-database", "parameters": [ { diff --git a/output/schema/schema.json b/output/schema/schema.json index 85ca581b87..0b79cd3fd8 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -8568,7 +8568,7 @@ "stability": "stable" } }, - "description": "Deletes a geoip database configuration.", + "description": "Deletes an IP location database configuration.", "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-ip-location-database-api.html", "name": "ingest.delete_ip_location_database", "request": { @@ -146132,7 +146132,7 @@ "body": { "kind": "no_body" }, - "description": "Deletes a geoip database configuration.", + "description": "Deletes an IP location database configuration.", "inherits": { "type": { "name": "RequestBase", diff --git a/specification/ingest/delete_ip_location_database/DeleteIpLocationDatabaseRequest.ts b/specification/ingest/delete_ip_location_database/DeleteIpLocationDatabaseRequest.ts index 0ad7b8221f..e582550a23 100644 --- a/specification/ingest/delete_ip_location_database/DeleteIpLocationDatabaseRequest.ts +++ b/specification/ingest/delete_ip_location_database/DeleteIpLocationDatabaseRequest.ts @@ -22,7 +22,7 @@ import { Ids } from '@_types/common' import { Duration } from '@_types/Time' /** - * Deletes a geoip database configuration. + * Deletes an IP location database configuration. * @rest_spec_name ingest.delete_ip_location_database * @availability stack since=8.15.0 stability=stable * @availability serverless visibility=private From 9f1d7837e5849f747403949d79fae50fe5d7e278 Mon Sep 17 00:00:00 2001 From: Joe Gallo Date: Mon, 18 Nov 2024 12:01:28 -0500 Subject: [PATCH 04/13] Handle ipinfo in addition to maxmind --- output/openapi/elasticsearch-openapi.json | 9 ++++++-- output/schema/schema.json | 28 +++++++++++++++++++---- output/typescript/types.ts | 7 +++++- specification/ingest/_types/Database.ts | 8 +++++-- 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 0923f19f2e..1097778294 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -69905,11 +69905,13 @@ }, "maxmind": { "$ref": "#/components/schemas/ingest._types:Maxmind" + }, + "ipinfo": { + "$ref": "#/components/schemas/ingest._types:Ipinfo" } }, "required": [ - "name", - "maxmind" + "name" ] }, "ingest._types:Maxmind": { @@ -69923,6 +69925,9 @@ "account_id" ] }, + "ingest._types:Ipinfo": { + "type": "object" + }, "ingest.get_ip_location_database:DatabaseConfigurationMetadata": { "type": "object", "properties": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 9cd25f7ff4..01e8b61fa6 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -142202,9 +142202,9 @@ } }, { - "description": "The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported provider is maxmind, and the maxmind provider requires that an account_id (string) is configured.", + "description": "The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured.\nA provider (either maxmind or ipinfo) must be specified.", "name": "maxmind", - "required": true, + "required": false, "type": { "kind": "instance_of", "type": { @@ -142212,9 +142212,20 @@ "namespace": "ingest._types" } } + }, + { + "name": "ipinfo", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Ipinfo", + "namespace": "ingest._types" + } + } } ], - "specLocation": "ingest/_types/Database.ts#L22-L29" + "specLocation": "ingest/_types/Database.ts#L22-L31" }, { "kind": "interface", @@ -143677,6 +143688,15 @@ ], "specLocation": "ingest/_types/Processors.ts#L478-L512" }, + { + "kind": "interface", + "name": { + "name": "Ipinfo", + "namespace": "ingest._types" + }, + "properties": [], + "specLocation": "ingest/_types/Database.ts#L37-L37" + }, { "kind": "interface", "inherits": { @@ -144057,7 +144077,7 @@ } } ], - "specLocation": "ingest/_types/Database.ts#L31-L33" + "specLocation": "ingest/_types/Database.ts#L33-L35" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 81c96e2fce..09c29d9595 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -12857,7 +12857,8 @@ export interface IngestCsvProcessor extends IngestProcessorBase { export interface IngestDatabaseConfiguration { name: Name - maxmind: IngestMaxmind + maxmind?: IngestMaxmind + ipinfo?: IngestIpinfo } export interface IngestDateIndexNameProcessor extends IngestProcessorBase { @@ -13009,6 +13010,10 @@ export interface IngestIpLocationProcessor extends IngestProcessorBase { download_database_on_pipeline_creation?: boolean } +export interface IngestIpinfo { + [key: string]: never +} + export interface IngestJoinProcessor extends IngestProcessorBase { field: Field separator: string diff --git a/specification/ingest/_types/Database.ts b/specification/ingest/_types/Database.ts index 8c20e3b871..d154c5103a 100644 --- a/specification/ingest/_types/Database.ts +++ b/specification/ingest/_types/Database.ts @@ -23,11 +23,15 @@ export class DatabaseConfiguration { /** The provider-assigned name of the IP geolocation database to download. */ name: Name /** The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading. - * At present, the only supported provider is maxmind, and the maxmind provider requires that an account_id (string) is configured. + * At present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured. + * A provider (either maxmind or ipinfo) must be specified. */ - maxmind: Maxmind + maxmind?: Maxmind + ipinfo?: Ipinfo } export class Maxmind { account_id: Id } + +export class Ipinfo {} From 74230fb3bc94b4d36f7ae3aeae9c0b077095c3b7 Mon Sep 17 00:00:00 2001 From: Joe Gallo Date: Mon, 18 Nov 2024 19:45:41 -0500 Subject: [PATCH 05/13] A slightly more faithful alternative approach --- output/openapi/elasticsearch-openapi.json | 47 +++++++++++----- output/schema/schema.json | 67 ++++++++++++++--------- output/typescript/types.ts | 11 ++-- specification/ingest/_types/Database.ts | 20 ++++--- 4 files changed, 91 insertions(+), 54 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 1097778294..e90fe4ef0c 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -69898,35 +69898,54 @@ ] }, "ingest._types:DatabaseConfiguration": { - "type": "object", - "properties": { - "name": { - "$ref": "#/components/schemas/_types:Name" - }, - "maxmind": { + "description": "The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured.\nA provider (either maxmind or ipinfo) must be specified.", + "oneOf": [ + { "$ref": "#/components/schemas/ingest._types:Maxmind" }, - "ipinfo": { + { "$ref": "#/components/schemas/ingest._types:Ipinfo" } - }, - "required": [ - "name" ] }, "ingest._types:Maxmind": { + "allOf": [ + { + "$ref": "#/components/schemas/ingest._types:DatabaseConfigurationBase" + }, + { + "type": "object", + "properties": { + "account_id": { + "$ref": "#/components/schemas/_types:Id" + } + }, + "required": [ + "account_id" + ] + } + ] + }, + "ingest._types:DatabaseConfigurationBase": { "type": "object", "properties": { - "account_id": { - "$ref": "#/components/schemas/_types:Id" + "name": { + "$ref": "#/components/schemas/_types:Name" } }, "required": [ - "account_id" + "name" ] }, "ingest._types:Ipinfo": { - "type": "object" + "allOf": [ + { + "$ref": "#/components/schemas/ingest._types:DatabaseConfigurationBase" + }, + { + "type": "object" + } + ] }, "ingest.get_ip_location_database:DatabaseConfigurationMetadata": { "type": "object", diff --git a/output/schema/schema.json b/output/schema/schema.json index 01e8b61fa6..a69191558d 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -142183,49 +142183,54 @@ "specLocation": "ingest/_types/Processors.ts#L694-L727" }, { - "kind": "interface", + "kind": "type_alias", + "description": "The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured.\nA provider (either maxmind or ipinfo) must be specified.", "name": { "name": "DatabaseConfiguration", "namespace": "ingest._types" }, - "properties": [ - { - "description": "The provider-assigned name of the IP geolocation database to download.", - "name": "name", - "required": true, - "type": { + "specLocation": "ingest/_types/Database.ts#L24-L28", + "type": { + "kind": "union_of", + "items": [ + { "kind": "instance_of", "type": { - "name": "Name", - "namespace": "_types" + "name": "Maxmind", + "namespace": "ingest._types" } - } - }, - { - "description": "The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured.\nA provider (either maxmind or ipinfo) must be specified.", - "name": "maxmind", - "required": false, - "type": { + }, + { "kind": "instance_of", "type": { - "name": "Maxmind", + "name": "Ipinfo", "namespace": "ingest._types" } } - }, + ] + } + }, + { + "kind": "interface", + "name": { + "name": "DatabaseConfigurationBase", + "namespace": "ingest._types" + }, + "properties": [ { - "name": "ipinfo", - "required": false, + "description": "The provider-assigned name of the IP geolocation database to download.", + "name": "name", + "required": true, "type": { "kind": "instance_of", "type": { - "name": "Ipinfo", - "namespace": "ingest._types" + "name": "Name", + "namespace": "_types" } } } ], - "specLocation": "ingest/_types/Database.ts#L22-L31" + "specLocation": "ingest/_types/Database.ts#L30-L33" }, { "kind": "interface", @@ -143690,12 +143695,18 @@ }, { "kind": "interface", + "inherits": { + "type": { + "name": "DatabaseConfigurationBase", + "namespace": "ingest._types" + } + }, "name": { "name": "Ipinfo", "namespace": "ingest._types" }, "properties": [], - "specLocation": "ingest/_types/Database.ts#L37-L37" + "specLocation": "ingest/_types/Database.ts#L39-L39" }, { "kind": "interface", @@ -144060,6 +144071,12 @@ }, { "kind": "interface", + "inherits": { + "type": { + "name": "DatabaseConfigurationBase", + "namespace": "ingest._types" + } + }, "name": { "name": "Maxmind", "namespace": "ingest._types" @@ -144077,7 +144094,7 @@ } } ], - "specLocation": "ingest/_types/Database.ts#L33-L35" + "specLocation": "ingest/_types/Database.ts#L35-L37" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 09c29d9595..4e6b930923 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -12855,10 +12855,10 @@ export interface IngestCsvProcessor extends IngestProcessorBase { trim?: boolean } -export interface IngestDatabaseConfiguration { +export type IngestDatabaseConfiguration = IngestMaxmind | IngestIpinfo + +export interface IngestDatabaseConfigurationBase { name: Name - maxmind?: IngestMaxmind - ipinfo?: IngestIpinfo } export interface IngestDateIndexNameProcessor extends IngestProcessorBase { @@ -13010,8 +13010,7 @@ export interface IngestIpLocationProcessor extends IngestProcessorBase { download_database_on_pipeline_creation?: boolean } -export interface IngestIpinfo { - [key: string]: never +export interface IngestIpinfo extends IngestDatabaseConfigurationBase { } export interface IngestJoinProcessor extends IngestProcessorBase { @@ -13050,7 +13049,7 @@ export interface IngestLowercaseProcessor extends IngestProcessorBase { target_field?: Field } -export interface IngestMaxmind { +export interface IngestMaxmind extends IngestDatabaseConfigurationBase { account_id: Id } diff --git a/specification/ingest/_types/Database.ts b/specification/ingest/_types/Database.ts index d154c5103a..53050501b9 100644 --- a/specification/ingest/_types/Database.ts +++ b/specification/ingest/_types/Database.ts @@ -19,19 +19,21 @@ import { Id, Name } from '@_types/common' -export class DatabaseConfiguration { +specification / ingest / _types / Database.ts + +/** The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading. + * At present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured. + * A provider (either maxmind or ipinfo) must be specified. + */ +export type DatabaseConfiguration = Maxmind | Ipinfo + +export class DatabaseConfigurationBase { /** The provider-assigned name of the IP geolocation database to download. */ name: Name - /** The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading. - * At present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured. - * A provider (either maxmind or ipinfo) must be specified. - */ - maxmind?: Maxmind - ipinfo?: Ipinfo } -export class Maxmind { +export class Maxmind extends DatabaseConfigurationBase { account_id: Id } -export class Ipinfo {} +export class Ipinfo extends DatabaseConfigurationBase {} From 91e9c648f2ffdb5184e1ad0f35d0d1af4c684519 Mon Sep 17 00:00:00 2001 From: Joe Gallo Date: Tue, 19 Nov 2024 13:22:45 -0500 Subject: [PATCH 06/13] Remove accidentally-added line --- output/schema/schema.json | 8 ++++---- specification/ingest/_types/Database.ts | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index a69191558d..ec45774697 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -142189,7 +142189,7 @@ "name": "DatabaseConfiguration", "namespace": "ingest._types" }, - "specLocation": "ingest/_types/Database.ts#L24-L28", + "specLocation": "ingest/_types/Database.ts#L22-L26", "type": { "kind": "union_of", "items": [ @@ -142230,7 +142230,7 @@ } } ], - "specLocation": "ingest/_types/Database.ts#L30-L33" + "specLocation": "ingest/_types/Database.ts#L28-L31" }, { "kind": "interface", @@ -143706,7 +143706,7 @@ "namespace": "ingest._types" }, "properties": [], - "specLocation": "ingest/_types/Database.ts#L39-L39" + "specLocation": "ingest/_types/Database.ts#L37-L37" }, { "kind": "interface", @@ -144094,7 +144094,7 @@ } } ], - "specLocation": "ingest/_types/Database.ts#L35-L37" + "specLocation": "ingest/_types/Database.ts#L33-L35" }, { "kind": "interface", diff --git a/specification/ingest/_types/Database.ts b/specification/ingest/_types/Database.ts index 53050501b9..d115d4cfba 100644 --- a/specification/ingest/_types/Database.ts +++ b/specification/ingest/_types/Database.ts @@ -19,8 +19,6 @@ import { Id, Name } from '@_types/common' -specification / ingest / _types / Database.ts - /** The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading. * At present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured. * A provider (either maxmind or ipinfo) must be specified. From 31fd86a38351c91a75cd67a0f05f1e0b93ee007c Mon Sep 17 00:00:00 2001 From: Joe Gallo Date: Tue, 19 Nov 2024 13:28:05 -0500 Subject: [PATCH 07/13] A more-correct implementation of the second approach --- output/openapi/elasticsearch-openapi.json | 40 ++++++++++---- output/schema/schema.json | 64 +++++++++++++++++++---- output/typescript/types.ts | 15 ++++-- specification/ingest/_types/Database.ts | 16 ++++-- 4 files changed, 108 insertions(+), 27 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index e90fe4ef0c..28aec4f682 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -69898,17 +69898,17 @@ ] }, "ingest._types:DatabaseConfiguration": { - "description": "The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured.\nA provider (either maxmind or ipinfo) must be specified.", + "description": "The configuration necessary to identify which IP geolocation provider to use to download a database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured.\nA provider (either maxmind or ipinfo) must be specified.", "oneOf": [ { - "$ref": "#/components/schemas/ingest._types:Maxmind" + "$ref": "#/components/schemas/ingest._types:MaxmindConfiguration" }, { - "$ref": "#/components/schemas/ingest._types:Ipinfo" + "$ref": "#/components/schemas/ingest._types:IpinfoConfiguration" } ] }, - "ingest._types:Maxmind": { + "ingest._types:MaxmindConfiguration": { "allOf": [ { "$ref": "#/components/schemas/ingest._types:DatabaseConfigurationBase" @@ -69916,16 +69916,27 @@ { "type": "object", "properties": { - "account_id": { - "$ref": "#/components/schemas/_types:Id" + "maxmind": { + "$ref": "#/components/schemas/ingest._types:Maxmind" } }, "required": [ - "account_id" + "maxmind" ] } ] }, + "ingest._types:Maxmind": { + "type": "object", + "properties": { + "account_id": { + "$ref": "#/components/schemas/_types:Id" + } + }, + "required": [ + "account_id" + ] + }, "ingest._types:DatabaseConfigurationBase": { "type": "object", "properties": { @@ -69937,16 +69948,27 @@ "name" ] }, - "ingest._types:Ipinfo": { + "ingest._types:IpinfoConfiguration": { "allOf": [ { "$ref": "#/components/schemas/ingest._types:DatabaseConfigurationBase" }, { - "type": "object" + "type": "object", + "properties": { + "ipinfo": { + "$ref": "#/components/schemas/ingest._types:Ipinfo" + } + }, + "required": [ + "ipinfo" + ] } ] }, + "ingest._types:Ipinfo": { + "type": "object" + }, "ingest.get_ip_location_database:DatabaseConfigurationMetadata": { "type": "object", "properties": { diff --git a/output/schema/schema.json b/output/schema/schema.json index ec45774697..0cb2eb99d0 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -142184,7 +142184,7 @@ }, { "kind": "type_alias", - "description": "The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured.\nA provider (either maxmind or ipinfo) must be specified.", + "description": "The configuration necessary to identify which IP geolocation provider to use to download a database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured.\nA provider (either maxmind or ipinfo) must be specified.", "name": { "name": "DatabaseConfiguration", "namespace": "ingest._types" @@ -142196,14 +142196,14 @@ { "kind": "instance_of", "type": { - "name": "Maxmind", + "name": "MaxmindConfiguration", "namespace": "ingest._types" } }, { "kind": "instance_of", "type": { - "name": "Ipinfo", + "name": "IpinfoConfiguration", "namespace": "ingest._types" } } @@ -143693,6 +143693,15 @@ ], "specLocation": "ingest/_types/Processors.ts#L478-L512" }, + { + "kind": "interface", + "name": { + "name": "Ipinfo", + "namespace": "ingest._types" + }, + "properties": [], + "specLocation": "ingest/_types/Database.ts#L41-L41" + }, { "kind": "interface", "inherits": { @@ -143702,11 +143711,23 @@ } }, "name": { - "name": "Ipinfo", + "name": "IpinfoConfiguration", "namespace": "ingest._types" }, - "properties": [], - "specLocation": "ingest/_types/Database.ts#L37-L37" + "properties": [ + { + "name": "ipinfo", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Ipinfo", + "namespace": "ingest._types" + } + } + } + ], + "specLocation": "ingest/_types/Database.ts#L43-L45" }, { "kind": "interface", @@ -144069,6 +144090,27 @@ ], "specLocation": "ingest/_types/Processors.ts#L1212-L1228" }, + { + "kind": "interface", + "name": { + "name": "Maxmind", + "namespace": "ingest._types" + }, + "properties": [ + { + "name": "account_id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Id", + "namespace": "_types" + } + } + } + ], + "specLocation": "ingest/_types/Database.ts#L33-L35" + }, { "kind": "interface", "inherits": { @@ -144078,23 +144120,23 @@ } }, "name": { - "name": "Maxmind", + "name": "MaxmindConfiguration", "namespace": "ingest._types" }, "properties": [ { - "name": "account_id", + "name": "maxmind", "required": true, "type": { "kind": "instance_of", "type": { - "name": "Id", - "namespace": "_types" + "name": "Maxmind", + "namespace": "ingest._types" } } } ], - "specLocation": "ingest/_types/Database.ts#L33-L35" + "specLocation": "ingest/_types/Database.ts#L37-L39" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 4e6b930923..d3e345ef12 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -12855,7 +12855,7 @@ export interface IngestCsvProcessor extends IngestProcessorBase { trim?: boolean } -export type IngestDatabaseConfiguration = IngestMaxmind | IngestIpinfo +export type IngestDatabaseConfiguration = IngestMaxmindConfiguration | IngestIpinfoConfiguration export interface IngestDatabaseConfigurationBase { name: Name @@ -13010,7 +13010,12 @@ export interface IngestIpLocationProcessor extends IngestProcessorBase { download_database_on_pipeline_creation?: boolean } -export interface IngestIpinfo extends IngestDatabaseConfigurationBase { +export interface IngestIpinfo { + [key: string]: never +} + +export interface IngestIpinfoConfiguration extends IngestDatabaseConfigurationBase { + ipinfo: IngestIpinfo } export interface IngestJoinProcessor extends IngestProcessorBase { @@ -13049,10 +13054,14 @@ export interface IngestLowercaseProcessor extends IngestProcessorBase { target_field?: Field } -export interface IngestMaxmind extends IngestDatabaseConfigurationBase { +export interface IngestMaxmind { account_id: Id } +export interface IngestMaxmindConfiguration extends IngestDatabaseConfigurationBase { + maxmind: IngestMaxmind +} + export interface IngestNetworkDirectionProcessor extends IngestProcessorBase { source_ip?: Field destination_ip?: Field diff --git a/specification/ingest/_types/Database.ts b/specification/ingest/_types/Database.ts index d115d4cfba..4a76c7c854 100644 --- a/specification/ingest/_types/Database.ts +++ b/specification/ingest/_types/Database.ts @@ -19,19 +19,27 @@ import { Id, Name } from '@_types/common' -/** The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading. +/** The configuration necessary to identify which IP geolocation provider to use to download a database, as well as any provider-specific configuration necessary for such downloading. * At present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured. * A provider (either maxmind or ipinfo) must be specified. */ -export type DatabaseConfiguration = Maxmind | Ipinfo +export type DatabaseConfiguration = MaxmindConfiguration | IpinfoConfiguration export class DatabaseConfigurationBase { /** The provider-assigned name of the IP geolocation database to download. */ name: Name } -export class Maxmind extends DatabaseConfigurationBase { +export class Maxmind { account_id: Id } -export class Ipinfo extends DatabaseConfigurationBase {} +export class MaxmindConfiguration extends DatabaseConfigurationBase { + maxmind: Maxmind +} + +export class Ipinfo {} + +export class IpinfoConfiguration extends DatabaseConfigurationBase { + ipinfo: Ipinfo +} From e1dea18cb8e270eb7b65e64d7b6d257212c47493 Mon Sep 17 00:00:00 2001 From: Joe Gallo Date: Fri, 22 Nov 2024 11:03:00 -0500 Subject: [PATCH 08/13] Another approach using @variants container --- output/openapi/elasticsearch-openapi.json | 71 ++++------ output/schema/schema.json | 163 +++++++++++----------- output/typescript/types.ts | 24 ++-- specification/ingest/_types/Database.ts | 30 ++-- 4 files changed, 142 insertions(+), 146 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 76d7b8c89a..1bdf370283 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -69970,31 +69970,37 @@ ] }, "ingest._types:DatabaseConfiguration": { - "description": "The configuration necessary to identify which IP geolocation provider to use to download a database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured.\nA provider (either maxmind or ipinfo) must be specified.", - "oneOf": [ - { - "$ref": "#/components/schemas/ingest._types:MaxmindConfiguration" - }, - { - "$ref": "#/components/schemas/ingest._types:IpinfoConfiguration" - } - ] - }, - "ingest._types:MaxmindConfiguration": { + "description": "The configuration necessary to identify which IP geolocation provider to use to download a database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured.\nA provider (either maxmind or ipinfo) must be specified. The web and local providers can be returned as read only configurations.", "allOf": [ { - "$ref": "#/components/schemas/ingest._types:DatabaseConfigurationBase" + "type": "object", + "properties": { + "name": { + "$ref": "#/components/schemas/_types:Name" + } + }, + "required": [ + "name" + ] }, { "type": "object", "properties": { "maxmind": { "$ref": "#/components/schemas/ingest._types:Maxmind" + }, + "ipinfo": { + "$ref": "#/components/schemas/ingest._types:Ipinfo" + }, + "web": { + "$ref": "#/components/schemas/ingest._types:Web" + }, + "local": { + "$ref": "#/components/schemas/ingest._types:Local" } }, - "required": [ - "maxmind" - ] + "minProperties": 1, + "maxProperties": 1 } ] }, @@ -70009,38 +70015,23 @@ "account_id" ] }, - "ingest._types:DatabaseConfigurationBase": { + "ingest._types:Ipinfo": { + "type": "object" + }, + "ingest._types:Web": { + "type": "object" + }, + "ingest._types:Local": { "type": "object", "properties": { - "name": { - "$ref": "#/components/schemas/_types:Name" + "type": { + "type": "string" } }, "required": [ - "name" - ] - }, - "ingest._types:IpinfoConfiguration": { - "allOf": [ - { - "$ref": "#/components/schemas/ingest._types:DatabaseConfigurationBase" - }, - { - "type": "object", - "properties": { - "ipinfo": { - "$ref": "#/components/schemas/ingest._types:Ipinfo" - } - }, - "required": [ - "ipinfo" - ] - } + "type" ] }, - "ingest._types:Ipinfo": { - "type": "object" - }, "ingest.get_ip_location_database:DatabaseConfigurationMetadata": { "type": "object", "properties": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 3e3fea4694..44e50144b0 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -142278,54 +142278,75 @@ "specLocation": "ingest/_types/Processors.ts#L694-L727" }, { - "kind": "type_alias", - "description": "The configuration necessary to identify which IP geolocation provider to use to download a database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured.\nA provider (either maxmind or ipinfo) must be specified.", + "kind": "interface", + "description": "The configuration necessary to identify which IP geolocation provider to use to download a database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured.\nA provider (either maxmind or ipinfo) must be specified. The web and local providers can be returned as read only configurations.", "name": { "name": "DatabaseConfiguration", "namespace": "ingest._types" }, - "specLocation": "ingest/_types/Database.ts#L22-L26", - "type": { - "kind": "union_of", - "items": [ - { + "properties": [ + { + "containerProperty": true, + "description": "The provider-assigned name of the IP geolocation database to download.", + "name": "name", + "required": true, + "type": { "kind": "instance_of", "type": { - "name": "MaxmindConfiguration", + "name": "Name", + "namespace": "_types" + } + } + }, + { + "name": "maxmind", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Maxmind", "namespace": "ingest._types" } - }, - { + } + }, + { + "name": "ipinfo", + "required": false, + "type": { "kind": "instance_of", "type": { - "name": "IpinfoConfiguration", + "name": "Ipinfo", "namespace": "ingest._types" } } - ] - } - }, - { - "kind": "interface", - "name": { - "name": "DatabaseConfigurationBase", - "namespace": "ingest._types" - }, - "properties": [ + }, { - "description": "The provider-assigned name of the IP geolocation database to download.", - "name": "name", - "required": true, + "name": "web", + "required": false, "type": { "kind": "instance_of", "type": { - "name": "Name", - "namespace": "_types" + "name": "Web", + "namespace": "ingest._types" + } + } + }, + { + "name": "local", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Local", + "namespace": "ingest._types" } } } ], - "specLocation": "ingest/_types/Database.ts#L28-L31" + "specLocation": "ingest/_types/Database.ts#L22-L39", + "variants": { + "kind": "container" + } }, { "kind": "interface", @@ -143795,34 +143816,7 @@ "namespace": "ingest._types" }, "properties": [], - "specLocation": "ingest/_types/Database.ts#L41-L41" - }, - { - "kind": "interface", - "inherits": { - "type": { - "name": "DatabaseConfigurationBase", - "namespace": "ingest._types" - } - }, - "name": { - "name": "IpinfoConfiguration", - "namespace": "ingest._types" - }, - "properties": [ - { - "name": "ipinfo", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "Ipinfo", - "namespace": "ingest._types" - } - } - } - ], - "specLocation": "ingest/_types/Database.ts#L43-L45" + "specLocation": "ingest/_types/Database.ts#L45-L45" }, { "kind": "interface", @@ -144131,6 +144125,27 @@ ], "specLocation": "ingest/_types/Processors.ts#L1158-L1210" }, + { + "kind": "interface", + "name": { + "name": "Local", + "namespace": "ingest._types" + }, + "properties": [ + { + "name": "type", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "ingest/_types/Database.ts#L49-L51" + }, { "kind": "interface", "inherits": { @@ -144204,34 +144219,7 @@ } } ], - "specLocation": "ingest/_types/Database.ts#L33-L35" - }, - { - "kind": "interface", - "inherits": { - "type": { - "name": "DatabaseConfigurationBase", - "namespace": "ingest._types" - } - }, - "name": { - "name": "MaxmindConfiguration", - "namespace": "ingest._types" - }, - "properties": [ - { - "name": "maxmind", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "Maxmind", - "namespace": "ingest._types" - } - } - } - ], - "specLocation": "ingest/_types/Database.ts#L37-L39" + "specLocation": "ingest/_types/Database.ts#L41-L43" }, { "kind": "interface", @@ -146341,6 +146329,15 @@ }, "specLocation": "ingest/_types/Processors.ts#L547-L553" }, + { + "kind": "interface", + "name": { + "name": "Web", + "namespace": "ingest._types" + }, + "properties": [], + "specLocation": "ingest/_types/Database.ts#L47-L47" + }, { "kind": "request", "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 5688febcd9..a71c4b1680 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -12862,10 +12862,12 @@ export interface IngestCsvProcessor extends IngestProcessorBase { trim?: boolean } -export type IngestDatabaseConfiguration = IngestMaxmindConfiguration | IngestIpinfoConfiguration - -export interface IngestDatabaseConfigurationBase { +export interface IngestDatabaseConfiguration { name: Name + maxmind?: IngestMaxmind + ipinfo?: IngestIpinfo + web?: IngestWeb + local?: IngestLocal } export interface IngestDateIndexNameProcessor extends IngestProcessorBase { @@ -13021,10 +13023,6 @@ export interface IngestIpinfo { [key: string]: never } -export interface IngestIpinfoConfiguration extends IngestDatabaseConfigurationBase { - ipinfo: IngestIpinfo -} - export interface IngestJoinProcessor extends IngestProcessorBase { field: Field separator: string @@ -13055,6 +13053,10 @@ export interface IngestKeyValueProcessor extends IngestProcessorBase { value_split: string } +export interface IngestLocal { + type: string +} + export interface IngestLowercaseProcessor extends IngestProcessorBase { field: Field ignore_missing?: boolean @@ -13065,10 +13067,6 @@ export interface IngestMaxmind { account_id: Id } -export interface IngestMaxmindConfiguration extends IngestDatabaseConfigurationBase { - maxmind: IngestMaxmind -} - export interface IngestNetworkDirectionProcessor extends IngestProcessorBase { source_ip?: Field destination_ip?: Field @@ -13266,6 +13264,10 @@ export interface IngestUserAgentProcessor extends IngestProcessorBase { export type IngestUserAgentProperty = 'name' | 'os' | 'device' | 'original' | 'version' +export interface IngestWeb { + [key: string]: never +} + export interface IngestDeleteGeoipDatabaseRequest extends RequestBase { id: Ids master_timeout?: Duration diff --git a/specification/ingest/_types/Database.ts b/specification/ingest/_types/Database.ts index 4a76c7c854..dc3a8308c9 100644 --- a/specification/ingest/_types/Database.ts +++ b/specification/ingest/_types/Database.ts @@ -19,27 +19,33 @@ import { Id, Name } from '@_types/common' -/** The configuration necessary to identify which IP geolocation provider to use to download a database, as well as any provider-specific configuration necessary for such downloading. +/** + * The configuration necessary to identify which IP geolocation provider to use to download a database, as well as any provider-specific configuration necessary for such downloading. * At present, the only supported providers are maxmind and ipinfo, and the maxmind provider requires that an account_id (string) is configured. - * A provider (either maxmind or ipinfo) must be specified. + * A provider (either maxmind or ipinfo) must be specified. The web and local providers can be returned as read only configurations. + * @variants container */ -export type DatabaseConfiguration = MaxmindConfiguration | IpinfoConfiguration - -export class DatabaseConfigurationBase { - /** The provider-assigned name of the IP geolocation database to download. */ +export class DatabaseConfiguration { + /** + * The provider-assigned name of the IP geolocation database to download. + * @variant container_property + */ name: Name + + maxmind?: Maxmind + ipinfo?: Ipinfo + readonly web?: Web + readonly local?: Local } export class Maxmind { account_id: Id } -export class MaxmindConfiguration extends DatabaseConfigurationBase { - maxmind: Maxmind -} - export class Ipinfo {} -export class IpinfoConfiguration extends DatabaseConfigurationBase { - ipinfo: Ipinfo +export class Web {} + +export class Local { + readonly type: string } From 242310bdc1fc4c37e5f7400d863710b1633492dd Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 10 Dec 2024 11:58:06 +0400 Subject: [PATCH 09/13] Fix IP location APIs --- output/openapi/elasticsearch-openapi.json | 68 +++++++++--------- output/schema/schema.json | 72 +++++++++---------- output/typescript/types.ts | 10 +-- specification/ingest/_types/Database.ts | 9 ++- .../GetIpLocationDatabaseResponse.ts | 4 +- .../PutIpLocationDatabaseRequest.ts | 14 ++-- 6 files changed, 86 insertions(+), 91 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 3d36bd6496..cc8828565d 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -15320,19 +15320,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "name": { - "$ref": "#/components/schemas/_types:Name" - }, - "maxmind": { - "$ref": "#/components/schemas/ingest._types:Maxmind" - } - }, - "required": [ - "name", - "maxmind" - ] + "$ref": "#/components/schemas/ingest._types:DatabaseConfiguration" } } }, @@ -70127,12 +70115,6 @@ }, "ipinfo": { "$ref": "#/components/schemas/ingest._types:Ipinfo" - }, - "web": { - "$ref": "#/components/schemas/ingest._types:Web" - }, - "local": { - "$ref": "#/components/schemas/ingest._types:Local" } }, "minProperties": 1, @@ -70154,20 +70136,6 @@ "ingest._types:Ipinfo": { "type": "object" }, - "ingest._types:Web": { - "type": "object" - }, - "ingest._types:Local": { - "type": "object", - "properties": { - "type": { - "type": "string" - } - }, - "required": [ - "type" - ] - }, "ingest.get_ip_location_database:DatabaseConfigurationMetadata": { "type": "object", "properties": { @@ -70181,7 +70149,7 @@ "$ref": "#/components/schemas/_types:EpochTimeUnitMillis" }, "database": { - "$ref": "#/components/schemas/ingest._types:DatabaseConfiguration" + "$ref": "#/components/schemas/ingest._types:DatabaseConfigurationFull" } }, "required": [ @@ -70191,6 +70159,38 @@ "database" ] }, + "ingest._types:DatabaseConfigurationFull": { + "allOf": [ + { + "$ref": "#/components/schemas/ingest._types:DatabaseConfiguration" + }, + { + "type": "object", + "properties": { + "web": { + "$ref": "#/components/schemas/ingest._types:Web" + }, + "local": { + "$ref": "#/components/schemas/ingest._types:Local" + } + } + } + ] + }, + "ingest._types:Web": { + "type": "object" + }, + "ingest._types:Local": { + "type": "object", + "properties": { + "type": { + "type": "string" + } + }, + "required": [ + "type" + ] + }, "ingest._types:Pipeline": { "type": "object", "properties": { diff --git a/output/schema/schema.json b/output/schema/schema.json index fb7d0a32a9..17e2371a47 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -142438,7 +142438,26 @@ "namespace": "ingest._types" } } - }, + } + ], + "specLocation": "ingest/_types/Database.ts#L22-L37", + "variants": { + "kind": "container" + } + }, + { + "kind": "interface", + "inherits": { + "type": { + "name": "DatabaseConfiguration", + "namespace": "ingest._types" + } + }, + "name": { + "name": "DatabaseConfigurationFull", + "namespace": "ingest._types" + }, + "properties": [ { "name": "web", "required": false, @@ -142462,10 +142481,7 @@ } } ], - "specLocation": "ingest/_types/Database.ts#L22-L39", - "variants": { - "kind": "container" - } + "specLocation": "ingest/_types/Database.ts#L39-L42" }, { "kind": "interface", @@ -143935,7 +143951,7 @@ "namespace": "ingest._types" }, "properties": [], - "specLocation": "ingest/_types/Database.ts#L45-L45" + "specLocation": "ingest/_types/Database.ts#L48-L48" }, { "kind": "interface", @@ -144263,7 +144279,7 @@ } } ], - "specLocation": "ingest/_types/Database.ts#L49-L51" + "specLocation": "ingest/_types/Database.ts#L52-L54" }, { "kind": "interface", @@ -144338,7 +144354,7 @@ } } ], - "specLocation": "ingest/_types/Database.ts#L41-L43" + "specLocation": "ingest/_types/Database.ts#L44-L46" }, { "kind": "interface", @@ -146455,7 +146471,7 @@ "namespace": "ingest._types" }, "properties": [], - "specLocation": "ingest/_types/Database.ts#L47-L47" + "specLocation": "ingest/_types/Database.ts#L50-L50" }, { "kind": "request", @@ -147120,7 +147136,7 @@ "type": { "kind": "instance_of", "type": { - "name": "DatabaseConfiguration", + "name": "DatabaseConfigurationFull", "namespace": "ingest._types" } } @@ -147468,33 +147484,15 @@ "CommonQueryParameters" ], "body": { - "kind": "properties", - "properties": [ - { - "description": "The provider-assigned name of the IP geolocation database to download.", - "name": "name", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "Name", - "namespace": "_types" - } - } - }, - { - "description": "The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading.\nAt present, the only supported provider is maxmind, and the maxmind provider requires that an account_id (string) is configured.", - "name": "maxmind", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "Maxmind", - "namespace": "ingest._types" - } - } + "kind": "value", + "codegenName": "configuration", + "value": { + "kind": "instance_of", + "type": { + "name": "DatabaseConfiguration", + "namespace": "ingest._types" } - ] + } }, "description": "Returns information about one or more IP location database configurations.", "inherits": { @@ -147549,7 +147547,7 @@ } } ], - "specLocation": "ingest/put_ip_location_database/PutIpLocationDatabaseRequest.ts#L25-L57" + "specLocation": "ingest/put_ip_location_database/PutIpLocationDatabaseRequest.ts#L25-L51" }, { "kind": "response", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index c9cef27598..b3ddd1a5a3 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -12876,6 +12876,9 @@ export interface IngestDatabaseConfiguration { name: Name maxmind?: IngestMaxmind ipinfo?: IngestIpinfo +} + +export interface IngestDatabaseConfigurationFull extends IngestDatabaseConfiguration { web?: IngestWeb local?: IngestLocal } @@ -13348,7 +13351,7 @@ export interface IngestGetIpLocationDatabaseDatabaseConfigurationMetadata { id: Id version: long modified_date_millis: EpochTime - database: IngestDatabaseConfiguration + database: IngestDatabaseConfigurationFull } export interface IngestGetIpLocationDatabaseRequest extends RequestBase { @@ -13391,10 +13394,7 @@ export interface IngestPutIpLocationDatabaseRequest extends RequestBase { id: Id master_timeout?: Duration timeout?: Duration - body?: { - name: Name - maxmind: IngestMaxmind - } + body?: IngestDatabaseConfiguration } export type IngestPutIpLocationDatabaseResponse = AcknowledgedResponseBase diff --git a/specification/ingest/_types/Database.ts b/specification/ingest/_types/Database.ts index dc3a8308c9..3210d86da8 100644 --- a/specification/ingest/_types/Database.ts +++ b/specification/ingest/_types/Database.ts @@ -34,8 +34,11 @@ export class DatabaseConfiguration { maxmind?: Maxmind ipinfo?: Ipinfo - readonly web?: Web - readonly local?: Local +} + +export class DatabaseConfigurationFull extends DatabaseConfiguration { + web?: Web + local?: Local } export class Maxmind { @@ -47,5 +50,5 @@ export class Ipinfo {} export class Web {} export class Local { - readonly type: string + type: string } diff --git a/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts index 2b1f36be23..458057424a 100644 --- a/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts +++ b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts @@ -17,7 +17,7 @@ * under the License. */ -import { DatabaseConfiguration } from '@ingest/_types/Database' +import { DatabaseConfigurationFull } from '@ingest/_types/Database' import { Id } from '@_types/common' import { long } from '@_types/Numeric' import { EpochTime, UnitMillis } from '@_types/Time' @@ -30,5 +30,5 @@ class DatabaseConfigurationMetadata { id: Id version: long modified_date_millis: EpochTime - database: DatabaseConfiguration + database: DatabaseConfigurationFull } diff --git a/specification/ingest/put_ip_location_database/PutIpLocationDatabaseRequest.ts b/specification/ingest/put_ip_location_database/PutIpLocationDatabaseRequest.ts index 34c71e9b15..e27b6ac5c4 100644 --- a/specification/ingest/put_ip_location_database/PutIpLocationDatabaseRequest.ts +++ b/specification/ingest/put_ip_location_database/PutIpLocationDatabaseRequest.ts @@ -17,9 +17,9 @@ * under the License. */ -import { Maxmind } from '@ingest/_types/Database' +import { DatabaseConfiguration } from '@ingest/_types/Database' import { RequestBase } from '@_types/Base' -import { Id, Name } from '@_types/common' +import { Id } from '@_types/common' import { Duration } from '@_types/Time' /** @@ -46,12 +46,6 @@ export interface Request extends RequestBase { * @server_default 30s */ timeout?: Duration } - body: { - /** The provider-assigned name of the IP geolocation database to download. */ - name: Name - /** The configuration necessary to identify which IP geolocation provider to use to download the database, as well as any provider-specific configuration necessary for such downloading. - * At present, the only supported provider is maxmind, and the maxmind provider requires that an account_id (string) is configured. - */ - maxmind: Maxmind - } + /** @codegen_name configuration */ + body: DatabaseConfiguration } From 944f4aa8c259161c6190d5fa170b9e44a20be92a Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 17 Dec 2024 10:43:17 +0400 Subject: [PATCH 10/13] Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com> --- .../get_ip_location_database/GetIpLocationDatabaseResponse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts index 458057424a..f8b6b0c123 100644 --- a/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts +++ b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts @@ -28,7 +28,7 @@ export class Response { class DatabaseConfigurationMetadata { id: Id - version: long + version: VersionNumber modified_date_millis: EpochTime database: DatabaseConfigurationFull } From f3a5f78d4a10961102e5b29dbae4d2d9c6139526 Mon Sep 17 00:00:00 2001 From: Laura Trotta <153528055+l-trotta@users.noreply.github.com> Date: Tue, 17 Dec 2024 09:54:01 +0100 Subject: [PATCH 11/13] Update specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts Co-authored-by: Quentin Pradet --- .../get_ip_location_database/GetIpLocationDatabaseResponse.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts index f8b6b0c123..24cdd9fed5 100644 --- a/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts +++ b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts @@ -29,6 +29,7 @@ export class Response { class DatabaseConfigurationMetadata { id: Id version: VersionNumber - modified_date_millis: EpochTime + modified_date_millis?: EpochTime + modified_date?: EpochTime database: DatabaseConfigurationFull } From c2c5f85c64c639af2a3789dd30121471ed7792b5 Mon Sep 17 00:00:00 2001 From: Joe Gallo Date: Tue, 17 Dec 2024 23:58:55 -0500 Subject: [PATCH 12/13] Fix an import and then make generate, etc --- output/openapi/elasticsearch-openapi.json | 6 +++-- output/schema/schema.json | 26 ++++++++++++++++--- output/typescript/types.ts | 5 ++-- .../GetIpLocationDatabaseResponse.ts | 2 +- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index fc5329f502..c3ede242cf 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -70489,11 +70489,14 @@ "$ref": "#/components/schemas/_types:Id" }, "version": { - "type": "number" + "$ref": "#/components/schemas/_types:VersionNumber" }, "modified_date_millis": { "$ref": "#/components/schemas/_types:EpochTimeUnitMillis" }, + "modified_date": { + "$ref": "#/components/schemas/_types:EpochTimeUnitMillis" + }, "database": { "$ref": "#/components/schemas/ingest._types:DatabaseConfigurationFull" } @@ -70501,7 +70504,6 @@ "required": [ "id", "version", - "modified_date_millis", "database" ] }, diff --git a/output/schema/schema.json b/output/schema/schema.json index e3959a6249..7bd60b362c 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -147515,14 +147515,34 @@ "type": { "kind": "instance_of", "type": { - "name": "long", + "name": "VersionNumber", "namespace": "_types" } } }, { "name": "modified_date_millis", - "required": true, + "required": false, + "type": { + "kind": "instance_of", + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "UnitMillis", + "namespace": "_types" + } + } + ], + "type": { + "name": "EpochTime", + "namespace": "_types" + } + } + }, + { + "name": "modified_date", + "required": false, "type": { "kind": "instance_of", "generics": [ @@ -147552,7 +147572,7 @@ } } ], - "specLocation": "ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts#L29-L34" + "specLocation": "ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts#L29-L35" }, { "kind": "request", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 698f991c67..a01d40e52f 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -13351,8 +13351,9 @@ export interface IngestGetGeoipDatabaseResponse { export interface IngestGetIpLocationDatabaseDatabaseConfigurationMetadata { id: Id - version: long - modified_date_millis: EpochTime + version: VersionNumber + modified_date_millis?: EpochTime + modified_date?: EpochTime database: IngestDatabaseConfigurationFull } diff --git a/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts index 24cdd9fed5..36f2b39aa8 100644 --- a/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts +++ b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts @@ -18,7 +18,7 @@ */ import { DatabaseConfigurationFull } from '@ingest/_types/Database' -import { Id } from '@_types/common' +import { Id, VersionNumber } from '@_types/common' import { long } from '@_types/Numeric' import { EpochTime, UnitMillis } from '@_types/Time' From be050a8823eafed08bcb50ae65955f5f8e824fe3 Mon Sep 17 00:00:00 2001 From: Joe Gallo Date: Wed, 18 Dec 2024 00:00:49 -0500 Subject: [PATCH 13/13] Remove unused import --- .../get_ip_location_database/GetIpLocationDatabaseResponse.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts index 36f2b39aa8..6f194ba8bb 100644 --- a/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts +++ b/specification/ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts @@ -19,7 +19,6 @@ import { DatabaseConfigurationFull } from '@ingest/_types/Database' import { Id, VersionNumber } from '@_types/common' -import { long } from '@_types/Numeric' import { EpochTime, UnitMillis } from '@_types/Time' export class Response {