From 629b4d4006d7d121f7a2d66a0718d68943e9f54c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 17:55:20 +0100 Subject: [PATCH] Expand snapshot repository types (#2255) (#2441) (cherry picked from commit c45e69e81dc10e95176638cb415c2c3143faccfa) Co-authored-by: Josh Mock --- compiler/src/model/build-model.ts | 6 +- output/schema/schema.json | 782 +++++++++++++++--- output/typescript/types.ts | 101 ++- .../snapshot/_types/SnapshotRepository.ts | 104 ++- .../SnapshotCreateRepositoryRequest.ts | 12 +- 5 files changed, 867 insertions(+), 138 deletions(-) diff --git a/compiler/src/model/build-model.ts b/compiler/src/model/build-model.ts index 74d5e7773e..7c87f19fd0 100644 --- a/compiler/src/model/build-model.ts +++ b/compiler/src/model/build-model.ts @@ -270,14 +270,14 @@ function compileClassOrInterfaceDeclaration (declaration: ClassDeclaration | Int const queryType = type.query.find(property => property != null && property.name === part.name) as model.Property if (!deepEqual(queryType.type, part.type)) { assert(pathMember as Node, part.codegenName != null, `'${part.name}' already exist in the query_parameters with a different type, you should define an @codegen_name.`) - assert(pathMember as Node, !type.query.map(p => p.name).includes(part.codegenName), `The codegen_name '${part.codegenName}' already exists as parameter in query_parameters.`) + assert(pathMember as Node, !type.query.map(p => p.codegenName ?? p.name).includes(part.codegenName), `The codegen_name '${part.codegenName}' already exists as parameter in query_parameters.`) } } if (bodyProperties.map(p => p.name).includes(part.name)) { const bodyType = bodyProperties.find(property => property != null && property.name === part.name) as model.Property if (!deepEqual(bodyType.type, part.type)) { assert(pathMember as Node, part.codegenName != null, `'${part.name}' already exist in the body with a different type, you should define an @codegen_name.`) - assert(pathMember as Node, !bodyProperties.map(p => p.name).includes(part.codegenName), `The codegen_name '${part.codegenName}' already exists as parameter in body.`) + assert(pathMember as Node, !bodyProperties.map(p => p.codegenName ?? p.name).includes(part.codegenName), `The codegen_name '${part.codegenName}' already exists as parameter in body.`) } } } @@ -296,7 +296,7 @@ function compileClassOrInterfaceDeclaration (declaration: ClassDeclaration | Int ) assert( (bodyMember as PropertySignature).getJsDocs(), - !type.path.map(p => p.name).concat(type.query.map(p => p.name)).includes(tags.codegen_name), + !type.path.map(p => p.codegenName ?? p.name).concat(type.query.map(p => p.codegenName ?? p.name)).includes(tags.codegen_name), `The codegen_name '${tags.codegen_name}' already exists as a property in the path or query.` ) type.body = { diff --git a/output/schema/schema.json b/output/schema/schema.json index 56c65df3d1..94907ef6bc 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -181948,6 +181948,112 @@ }, "specLocation": "slm/stop/StopSnapshotLifecycleManagementResponse.ts#L22-L24" }, + { + "inherits": { + "type": { + "name": "RepositoryBase", + "namespace": "snapshot._types" + } + }, + "kind": "interface", + "name": { + "name": "AzureRepository", + "namespace": "snapshot._types" + }, + "properties": [ + { + "name": "type", + "required": true, + "type": { + "kind": "literal_value", + "value": "azure" + } + }, + { + "name": "settings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "AzureRepositorySettings", + "namespace": "snapshot._types" + } + } + } + ], + "specLocation": "snapshot/_types/SnapshotRepository.ts#L40-L43" + }, + { + "inherits": { + "type": { + "name": "RepositorySettingsBase", + "namespace": "snapshot._types" + } + }, + "kind": "interface", + "name": { + "name": "AzureRepositorySettings", + "namespace": "snapshot._types" + }, + "properties": [ + { + "name": "client", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "container", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "base_path", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "readonly", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "location_mode", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "snapshot/_types/SnapshotRepository.ts#L77-L83" + }, { "kind": "interface", "name": { @@ -181980,6 +182086,112 @@ ], "specLocation": "snapshot/_types/FileCountSnapshotStats.ts#L22-L25" }, + { + "inherits": { + "type": { + "name": "RepositoryBase", + "namespace": "snapshot._types" + } + }, + "kind": "interface", + "name": { + "name": "GcsRepository", + "namespace": "snapshot._types" + }, + "properties": [ + { + "name": "type", + "required": true, + "type": { + "kind": "literal_value", + "value": "gcs" + } + }, + { + "name": "settings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "GcsRepositorySettings", + "namespace": "snapshot._types" + } + } + } + ], + "specLocation": "snapshot/_types/SnapshotRepository.ts#L45-L48" + }, + { + "inherits": { + "type": { + "name": "RepositorySettingsBase", + "namespace": "snapshot._types" + } + }, + "kind": "interface", + "name": { + "name": "GcsRepositorySettings", + "namespace": "snapshot._types" + }, + "properties": [ + { + "name": "bucket", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "client", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "base_path", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "readonly", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "application_name", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "snapshot/_types/SnapshotRepository.ts#L85-L91" + }, { "kind": "interface", "name": { @@ -182067,15 +182279,89 @@ "specLocation": "snapshot/_types/SnapshotInfoFeatureState.ts#L22-L25" }, { + "inherits": { + "type": { + "name": "RepositoryBase", + "namespace": "snapshot._types" + } + }, "kind": "interface", "name": { - "name": "Repository", + "name": "ReadOnlyUrlRepository", "namespace": "snapshot._types" }, "properties": [ { "name": "type", "required": true, + "type": { + "kind": "literal_value", + "value": "url" + } + }, + { + "name": "settings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "ReadOnlyUrlRepositorySettings", + "namespace": "snapshot._types" + } + } + } + ], + "specLocation": "snapshot/_types/SnapshotRepository.ts#L60-L63" + }, + { + "inherits": { + "type": { + "name": "RepositorySettingsBase", + "namespace": "snapshot._types" + } + }, + "kind": "interface", + "name": { + "name": "ReadOnlyUrlRepositorySettings", + "namespace": "snapshot._types" + }, + "properties": [ + { + "name": "http_max_retries", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "name": "http_socket_timeout", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, + { + "name": "max_number_of_snapshots", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "name": "url", + "required": true, "type": { "kind": "instance_of", "type": { @@ -182083,7 +182369,77 @@ "namespace": "_builtins" } } - }, + } + ], + "specLocation": "snapshot/_types/SnapshotRepository.ts#L110-L115" + }, + { + "kind": "type_alias", + "name": { + "name": "Repository", + "namespace": "snapshot._types" + }, + "specLocation": "snapshot/_types/SnapshotRepository.ts#L24-L34", + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "AzureRepository", + "namespace": "snapshot._types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "GcsRepository", + "namespace": "snapshot._types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "S3Repository", + "namespace": "snapshot._types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "SharedFileSystemRepository", + "namespace": "snapshot._types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "ReadOnlyUrlRepository", + "namespace": "snapshot._types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "SourceOnlyRepository", + "namespace": "snapshot._types" + } + } + ], + "kind": "union_of" + }, + "variants": { + "kind": "internal_tag", + "nonExhaustive": true, + "tag": "type" + } + }, + { + "kind": "interface", + "name": { + "name": "RepositoryBase", + "namespace": "snapshot._types" + }, + "properties": [ { "name": "uuid", "required": false, @@ -182094,6 +182450,84 @@ "namespace": "_types" } } + } + ], + "specLocation": "snapshot/_types/SnapshotRepository.ts#L36-L38" + }, + { + "kind": "interface", + "name": { + "name": "RepositorySettingsBase", + "namespace": "snapshot._types" + }, + "properties": [ + { + "name": "chunk_size", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ByteSize", + "namespace": "_types" + } + } + }, + { + "name": "compress", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "max_restore_bytes_per_sec", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ByteSize", + "namespace": "_types" + } + } + }, + { + "name": "max_snapshot_bytes_per_sec", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ByteSize", + "namespace": "_types" + } + } + } + ], + "specLocation": "snapshot/_types/SnapshotRepository.ts#L70-L75" + }, + { + "inherits": { + "type": { + "name": "RepositoryBase", + "namespace": "snapshot._types" + } + }, + "kind": "interface", + "name": { + "name": "S3Repository", + "namespace": "snapshot._types" + }, + "properties": [ + { + "name": "type", + "required": true, + "type": { + "kind": "literal_value", + "value": "s3" + } }, { "name": "settings", @@ -182101,23 +182535,40 @@ "type": { "kind": "instance_of", "type": { - "name": "RepositorySettings", + "name": "S3RepositorySettings", "namespace": "snapshot._types" } } } ], - "specLocation": "snapshot/_types/SnapshotRepository.ts#L23-L27" + "specLocation": "snapshot/_types/SnapshotRepository.ts#L50-L53" }, { + "inherits": { + "type": { + "name": "RepositorySettingsBase", + "namespace": "snapshot._types" + } + }, "kind": "interface", "name": { - "name": "RepositorySettings", + "name": "S3RepositorySettings", "namespace": "snapshot._types" }, "properties": [ { - "name": "chunk_size", + "name": "bucket", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "client", "required": false, "type": { "kind": "instance_of", @@ -182128,54 +182579,52 @@ } }, { - "name": "compress", + "name": "base_path", "required": false, "type": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - }, - { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "_builtins" - } - } - ], - "kind": "union_of" + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "readonly", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } } }, { - "name": "concurrent_streams", + "name": "server_side_encryption", "required": false, "type": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - }, - { - "kind": "instance_of", - "type": { - "name": "integer", - "namespace": "_types" - } - } - ], - "kind": "union_of" + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } } }, { - "name": "location", - "required": true, + "name": "buffer_size", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ByteSize", + "namespace": "_types" + } + } + }, + { + "name": "canned_acl", + "required": false, "type": { "kind": "instance_of", "type": { @@ -182185,33 +182634,18 @@ } }, { - "aliases": [ - "readonly" - ], - "name": "read_only", + "name": "storage_class", "required": false, "type": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - }, - { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "_builtins" - } - } - ], - "kind": "union_of" + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } } } ], - "specLocation": "snapshot/_types/SnapshotRepository.ts#L29-L38" + "specLocation": "snapshot/_types/SnapshotRepository.ts#L93-L102" }, { "kind": "interface", @@ -182434,6 +182868,90 @@ ], "specLocation": "snapshot/_types/SnapshotShardsStatus.ts#L37-L40" }, + { + "inherits": { + "type": { + "name": "RepositoryBase", + "namespace": "snapshot._types" + } + }, + "kind": "interface", + "name": { + "name": "SharedFileSystemRepository", + "namespace": "snapshot._types" + }, + "properties": [ + { + "name": "type", + "required": true, + "type": { + "kind": "literal_value", + "value": "fs" + } + }, + { + "name": "settings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "SharedFileSystemRepositorySettings", + "namespace": "snapshot._types" + } + } + } + ], + "specLocation": "snapshot/_types/SnapshotRepository.ts#L55-L58" + }, + { + "inherits": { + "type": { + "name": "RepositorySettingsBase", + "namespace": "snapshot._types" + } + }, + "kind": "interface", + "name": { + "name": "SharedFileSystemRepositorySettings", + "namespace": "snapshot._types" + }, + "properties": [ + { + "name": "location", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "max_number_of_snapshots", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "name": "readonly", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "snapshot/_types/SnapshotRepository.ts#L104-L108" + }, { "kind": "interface", "name": { @@ -183025,6 +183543,93 @@ ], "specLocation": "snapshot/_types/SnapshotStats.ts#L23-L29" }, + { + "inherits": { + "type": { + "name": "RepositoryBase", + "namespace": "snapshot._types" + } + }, + "kind": "interface", + "name": { + "name": "SourceOnlyRepository", + "namespace": "snapshot._types" + }, + "properties": [ + { + "name": "type", + "required": true, + "type": { + "kind": "literal_value", + "value": "source" + } + }, + { + "name": "settings", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "SourceOnlyRepositorySettings", + "namespace": "snapshot._types" + } + } + } + ], + "specLocation": "snapshot/_types/SnapshotRepository.ts#L65-L68" + }, + { + "inherits": { + "type": { + "name": "RepositorySettingsBase", + "namespace": "snapshot._types" + } + }, + "kind": "interface", + "name": { + "name": "SourceOnlyRepositorySettings", + "namespace": "snapshot._types" + }, + "properties": [ + { + "name": "delegate_type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "max_number_of_snapshots", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "aliases": [ + "readonly" + ], + "name": "read_only", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "snapshot/_types/SnapshotRepository.ts#L117-L124" + }, { "kind": "interface", "name": { @@ -183576,42 +184181,15 @@ "CommonQueryParameters" ], "body": { - "kind": "properties", - "properties": [ - { - "name": "repository", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "Repository", - "namespace": "snapshot._types" - } - } - }, - { - "name": "type", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "name": "settings", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "RepositorySettings", - "namespace": "snapshot._types" - } - } + "codegenName": "repository", + "kind": "value", + "value": { + "kind": "instance_of", + "type": { + "name": "Repository", + "namespace": "snapshot._types" } - ] + } }, "description": "Creates a repository.", "inherits": { @@ -183678,7 +184256,7 @@ } } ], - "specLocation": "snapshot/create_repository/SnapshotCreateRepositoryRequest.ts#L28-L48" + "specLocation": "snapshot/create_repository/SnapshotCreateRepositoryRequest.ts#L25-L42" }, { "body": { diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 7aa543633e..045995b862 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -17220,11 +17220,37 @@ export interface SlmStopRequest extends RequestBase { export type SlmStopResponse = AcknowledgedResponseBase +export interface SnapshotAzureRepository extends SnapshotRepositoryBase { + type: 'azure' + settings: SnapshotAzureRepositorySettings +} + +export interface SnapshotAzureRepositorySettings extends SnapshotRepositorySettingsBase { + client?: string + container?: string + base_path?: string + readonly?: boolean + location_mode?: string +} + export interface SnapshotFileCountSnapshotStats { file_count: integer size_in_bytes: long } +export interface SnapshotGcsRepository extends SnapshotRepositoryBase { + type: 'gcs' + settings: SnapshotGcsRepositorySettings +} + +export interface SnapshotGcsRepositorySettings extends SnapshotRepositorySettingsBase { + bucket: string + client?: string + base_path?: string + readonly?: boolean + application_name?: string +} + export interface SnapshotIndexDetails { shard_count: integer size?: ByteSize @@ -17237,19 +17263,45 @@ export interface SnapshotInfoFeatureState { indices: Indices } -export interface SnapshotRepository { - type: string +export interface SnapshotReadOnlyUrlRepository extends SnapshotRepositoryBase { + type: 'url' + settings: SnapshotReadOnlyUrlRepositorySettings +} + +export interface SnapshotReadOnlyUrlRepositorySettings extends SnapshotRepositorySettingsBase { + http_max_retries?: integer + http_socket_timeout?: Duration + max_number_of_snapshots?: integer + url: string +} + +export type SnapshotRepository = SnapshotAzureRepository | SnapshotGcsRepository | SnapshotS3Repository | SnapshotSharedFileSystemRepository | SnapshotReadOnlyUrlRepository | SnapshotSourceOnlyRepository + +export interface SnapshotRepositoryBase { uuid?: Uuid - settings: SnapshotRepositorySettings } -export interface SnapshotRepositorySettings { - chunk_size?: string - compress?: string | boolean - concurrent_streams?: string | integer - location: string - read_only?: string | boolean - readonly?: string | boolean +export interface SnapshotRepositorySettingsBase { + chunk_size?: ByteSize + compress?: boolean + max_restore_bytes_per_sec?: ByteSize + max_snapshot_bytes_per_sec?: ByteSize +} + +export interface SnapshotS3Repository extends SnapshotRepositoryBase { + type: 's3' + settings: SnapshotS3RepositorySettings +} + +export interface SnapshotS3RepositorySettings extends SnapshotRepositorySettingsBase { + bucket: string + client?: string + base_path?: string + readonly?: boolean + server_side_encryption?: boolean + buffer_size?: ByteSize + canned_acl?: string + storage_class?: string } export interface SnapshotShardsStats { @@ -17276,6 +17328,17 @@ export interface SnapshotShardsStatsSummaryItem { size_in_bytes: long } +export interface SnapshotSharedFileSystemRepository extends SnapshotRepositoryBase { + type: 'fs' + settings: SnapshotSharedFileSystemRepositorySettings +} + +export interface SnapshotSharedFileSystemRepositorySettings extends SnapshotRepositorySettingsBase { + location: string + max_number_of_snapshots?: integer + readonly?: boolean +} + export interface SnapshotSnapshotIndexStats { shards: Record shards_stats: SnapshotShardsStats @@ -17329,6 +17392,18 @@ export interface SnapshotSnapshotStats { total: SnapshotFileCountSnapshotStats } +export interface SnapshotSourceOnlyRepository extends SnapshotRepositoryBase { + type: 'source' + settings: SnapshotSourceOnlyRepositorySettings +} + +export interface SnapshotSourceOnlyRepositorySettings extends SnapshotRepositorySettingsBase { + delegate_type?: string + max_number_of_snapshots?: integer + read_only?: boolean + readonly?: boolean +} + export interface SnapshotStatus { include_global_state: boolean indices: Record @@ -17393,11 +17468,7 @@ export interface SnapshotCreateRepositoryRequest extends RequestBase { master_timeout?: Duration timeout?: Duration verify?: boolean - body?: { - repository?: SnapshotRepository - type: string - settings: SnapshotRepositorySettings - } + body?: SnapshotRepository } export type SnapshotCreateRepositoryResponse = AcknowledgedResponseBase diff --git a/specification/snapshot/_types/SnapshotRepository.ts b/specification/snapshot/_types/SnapshotRepository.ts index 0692524f2e..67b294bcfc 100644 --- a/specification/snapshot/_types/SnapshotRepository.ts +++ b/specification/snapshot/_types/SnapshotRepository.ts @@ -17,22 +17,108 @@ * under the License. */ -import { Uuid } from '@_types/common' +import { ByteSize, Uuid } from '@_types/common' import { integer } from '@_types/Numeric' +import { Duration } from '@_types/Time' -export class Repository { - type: string +/** + * @variants internal tag='type' + * @non_exhaustive + */ +export type Repository = + | AzureRepository + | GcsRepository + | S3Repository + | SharedFileSystemRepository + | ReadOnlyUrlRepository + | SourceOnlyRepository + +export class RepositoryBase { uuid?: Uuid - settings: RepositorySettings } -export class RepositorySettings { - chunk_size?: string - compress?: string | boolean - concurrent_streams?: string | integer +export class AzureRepository extends RepositoryBase { + type: 'azure' + settings: AzureRepositorySettings +} + +export class GcsRepository extends RepositoryBase { + type: 'gcs' + settings: GcsRepositorySettings +} + +export class S3Repository extends RepositoryBase { + type: 's3' + settings: S3RepositorySettings +} + +export class SharedFileSystemRepository extends RepositoryBase { + type: 'fs' + settings: SharedFileSystemRepositorySettings +} + +export class ReadOnlyUrlRepository extends RepositoryBase { + type: 'url' + settings: ReadOnlyUrlRepositorySettings +} + +export class SourceOnlyRepository extends RepositoryBase { + type: 'source' + settings: SourceOnlyRepositorySettings +} + +export class RepositorySettingsBase { + chunk_size?: ByteSize + compress?: boolean + max_restore_bytes_per_sec?: ByteSize + max_snapshot_bytes_per_sec?: ByteSize +} + +export class AzureRepositorySettings extends RepositorySettingsBase { + client?: string + container?: string + base_path?: string + readonly?: boolean + location_mode?: string +} + +export class GcsRepositorySettings extends RepositorySettingsBase { + bucket: string + client?: string + base_path?: string + readonly?: boolean + application_name?: string +} + +export class S3RepositorySettings extends RepositorySettingsBase { + bucket: string + client?: string + base_path?: string + readonly?: boolean + server_side_encryption?: boolean + buffer_size?: ByteSize + canned_acl?: string + storage_class?: string +} + +export class SharedFileSystemRepositorySettings extends RepositorySettingsBase { location: string + max_number_of_snapshots?: integer + readonly?: boolean +} + +export class ReadOnlyUrlRepositorySettings extends RepositorySettingsBase { + http_max_retries?: integer + http_socket_timeout?: Duration + max_number_of_snapshots?: integer + url: string +} + +export class SourceOnlyRepositorySettings extends RepositorySettingsBase { + delegate_type?: string + max_number_of_snapshots?: integer /** * @aliases readonly */ - read_only?: string | boolean + read_only?: boolean } diff --git a/specification/snapshot/create_repository/SnapshotCreateRepositoryRequest.ts b/specification/snapshot/create_repository/SnapshotCreateRepositoryRequest.ts index 68185c27b2..93e836180e 100644 --- a/specification/snapshot/create_repository/SnapshotCreateRepositoryRequest.ts +++ b/specification/snapshot/create_repository/SnapshotCreateRepositoryRequest.ts @@ -17,10 +17,7 @@ * under the License. */ -import { - Repository, - RepositorySettings -} from '@snapshot/_types/SnapshotRepository' +import { Repository } from '@snapshot/_types/SnapshotRepository' import { RequestBase } from '@_types/Base' import { Name } from '@_types/common' import { Duration } from '@_types/Time' @@ -40,9 +37,6 @@ export interface Request extends RequestBase { timeout?: Duration verify?: boolean } - body: { - repository?: Repository - type: string - settings: RepositorySettings - } + /** @codegen_name repository */ + body: Repository }