diff --git a/packages/clients/src/api/container/v1beta1/index.gen.ts b/packages/clients/src/api/container/v1beta1/index.gen.ts index 9f501f6e8..db7ee347b 100644 --- a/packages/clients/src/api/container/v1beta1/index.gen.ts +++ b/packages/clients/src/api/container/v1beta1/index.gen.ts @@ -4,6 +4,9 @@ export { API } from './api.gen' export * from './content.gen' export type { Container, + ContainerHealthCheckSpec, + ContainerHealthCheckSpecHTTPProbe, + ContainerHealthCheckSpecTCPProbe, ContainerHttpOption, ContainerPrivacy, ContainerProtocol, diff --git a/packages/clients/src/api/container/v1beta1/marshalling.gen.ts b/packages/clients/src/api/container/v1beta1/marshalling.gen.ts index b4aff9324..ce9921037 100644 --- a/packages/clients/src/api/container/v1beta1/marshalling.gen.ts +++ b/packages/clients/src/api/container/v1beta1/marshalling.gen.ts @@ -10,6 +10,9 @@ import { import type { DefaultValues } from '../../../bridge' import type { Container, + ContainerHealthCheckSpec, + ContainerHealthCheckSpecHTTPProbe, + ContainerHealthCheckSpecTCPProbe, ContainerScalingOption, CreateContainerRequest, CreateCronRequest, @@ -43,6 +46,53 @@ import type { UpdateTriggerRequestSqsClientConfig, } from './types.gen' +const unmarshalContainerHealthCheckSpecHTTPProbe = ( + data: unknown, +): ContainerHealthCheckSpecHTTPProbe => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ContainerHealthCheckSpecHTTPProbe' failed as data isn't a dictionary.`, + ) + } + + return { + path: data.path, + } as ContainerHealthCheckSpecHTTPProbe +} + +const unmarshalContainerHealthCheckSpecTCPProbe = ( + data: unknown, +): ContainerHealthCheckSpecTCPProbe => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ContainerHealthCheckSpecTCPProbe' failed as data isn't a dictionary.`, + ) + } + + return {} as ContainerHealthCheckSpecTCPProbe +} + +const unmarshalContainerHealthCheckSpec = ( + data: unknown, +): ContainerHealthCheckSpec => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ContainerHealthCheckSpec' failed as data isn't a dictionary.`, + ) + } + + return { + failureThreshold: data.failure_threshold, + http: data.http + ? unmarshalContainerHealthCheckSpecHTTPProbe(data.http) + : undefined, + interval: data.interval, + tcp: data.tcp + ? unmarshalContainerHealthCheckSpecTCPProbe(data.tcp) + : undefined, + } as ContainerHealthCheckSpec +} + const unmarshalContainerScalingOption = ( data: unknown, ): ContainerScalingOption => { @@ -85,6 +135,9 @@ export const unmarshalContainer = (data: unknown): Container => { domainName: data.domain_name, environmentVariables: data.environment_variables, errorMessage: data.error_message, + healthCheck: data.health_check + ? unmarshalContainerHealthCheckSpec(data.health_check) + : undefined, httpOption: data.http_option, id: data.id, localStorageLimit: data.local_storage_limit, @@ -363,6 +416,42 @@ export const unmarshalListTriggersResponse = ( } as ListTriggersResponse } +const marshalContainerHealthCheckSpecHTTPProbe = ( + request: ContainerHealthCheckSpecHTTPProbe, + defaults: DefaultValues, +): Record => ({ + path: request.path, +}) + +const marshalContainerHealthCheckSpecTCPProbe = ( + request: ContainerHealthCheckSpecTCPProbe, + defaults: DefaultValues, +): Record => ({}) + +const marshalContainerHealthCheckSpec = ( + request: ContainerHealthCheckSpec, + defaults: DefaultValues, +): Record => ({ + failure_threshold: request.failureThreshold, + interval: request.interval, + ...resolveOneOf([ + { + param: 'http', + value: + request.http !== undefined + ? marshalContainerHealthCheckSpecHTTPProbe(request.http, defaults) + : undefined, + }, + { + param: 'tcp', + value: + request.tcp !== undefined + ? marshalContainerHealthCheckSpecTCPProbe(request.tcp, defaults) + : undefined, + }, + ]), +}) + const marshalContainerScalingOption = ( request: ContainerScalingOption, defaults: DefaultValues, @@ -391,6 +480,10 @@ export const marshalCreateContainerRequest = ( cpu_limit: request.cpuLimit, description: request.description, environment_variables: request.environmentVariables, + health_check: + request.healthCheck !== undefined + ? marshalContainerHealthCheckSpec(request.healthCheck, defaults) + : undefined, http_option: request.httpOption, local_storage_limit: request.localStorageLimit, max_concurrency: request.maxConcurrency, @@ -541,6 +634,10 @@ export const marshalUpdateContainerRequest = ( cpu_limit: request.cpuLimit, description: request.description, environment_variables: request.environmentVariables, + health_check: + request.healthCheck !== undefined + ? marshalContainerHealthCheckSpec(request.healthCheck, defaults) + : undefined, http_option: request.httpOption, local_storage_limit: request.localStorageLimit, max_concurrency: request.maxConcurrency, diff --git a/packages/clients/src/api/container/v1beta1/types.gen.ts b/packages/clients/src/api/container/v1beta1/types.gen.ts index ffbb90204..0d6a0bfe2 100644 --- a/packages/clients/src/api/container/v1beta1/types.gen.ts +++ b/packages/clients/src/api/container/v1beta1/types.gen.ts @@ -95,6 +95,36 @@ export type TriggerStatus = | 'creating' | 'pending' +export interface ContainerHealthCheckSpecHTTPProbe { + /** Path to use for the HTTP health check. */ + path: string +} + +export interface ContainerHealthCheckSpecTCPProbe {} + +export interface ContainerHealthCheckSpec { + /** + * HTTP health check configuration. + * + * One-of ('probe'): at most one of 'http', 'tcp' could be set. + */ + http?: ContainerHealthCheckSpecHTTPProbe + /** + * TCP health check configuration. + * + * One-of ('probe'): at most one of 'http', 'tcp' could be set. + */ + tcp?: ContainerHealthCheckSpecTCPProbe + /** + * During a deployment, if a newly created container fails to pass the health + * check, the deployment is aborted. As a result, lowering this value can help + * to reduce the time it takes to detect a failed deployment. + */ + failureThreshold: number + /** Period between health checks. */ + interval?: string +} + export interface ContainerScalingOption { /** * One-of ('scalingRule'): at most one of 'concurrentRequestsThreshold', @@ -245,6 +275,8 @@ export interface Container { * instance. */ scalingOption?: ContainerScalingOption + /** Health check configuration of the container. */ + healthCheck?: ContainerHealthCheckSpec /** Creation date of the container. */ createdAt?: Date /** Last update date of the container. */ @@ -444,6 +476,8 @@ export type CreateContainerRequest = { * instance. */ scalingOption?: ContainerScalingOption + /** Health check configuration of the container. */ + healthCheck?: ContainerHealthCheckSpec } export type CreateCronRequest = { @@ -907,6 +941,8 @@ export type UpdateContainerRequest = { * instance. */ scalingOption?: ContainerScalingOption + /** Health check configuration of the container. */ + healthCheck?: ContainerHealthCheckSpec } export type UpdateCronRequest = { diff --git a/packages/clients/src/api/container/v1beta1/validation-rules.gen.ts b/packages/clients/src/api/container/v1beta1/validation-rules.gen.ts index 03c156a61..e50fd5e5c 100644 --- a/packages/clients/src/api/container/v1beta1/validation-rules.gen.ts +++ b/packages/clients/src/api/container/v1beta1/validation-rules.gen.ts @@ -1,6 +1,20 @@ // This file was automatically generated. DO NOT EDIT. // If you have any remark or suggestion do not hesitate to open an issue. +export const ContainerHealthCheckSpec = { + failureThreshold: { + greaterThanOrEqual: 3, + lessThanOrEqual: 50, + }, +} + +export const ContainerHealthCheckSpecHTTPProbe = { + path: { + maxLength: 100, + minLength: 1, + }, +} + export const ContainerScalingOption = {} export const CreateTriggerRequest = {