Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/clients/src/api/container/v1beta1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ export { API } from './api.gen'
export * from './content.gen'
export type {
Container,
ContainerHealthCheckSpec,
ContainerHealthCheckSpecHTTPProbe,
ContainerHealthCheckSpecTCPProbe,
ContainerHttpOption,
ContainerPrivacy,
ContainerProtocol,
Expand Down
97 changes: 97 additions & 0 deletions packages/clients/src/api/container/v1beta1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import {
import type { DefaultValues } from '../../../bridge'
import type {
Container,
ContainerHealthCheckSpec,
ContainerHealthCheckSpecHTTPProbe,
ContainerHealthCheckSpecTCPProbe,
ContainerScalingOption,
CreateContainerRequest,
CreateCronRequest,
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -363,6 +416,42 @@ export const unmarshalListTriggersResponse = (
} as ListTriggersResponse
}

const marshalContainerHealthCheckSpecHTTPProbe = (
request: ContainerHealthCheckSpecHTTPProbe,
defaults: DefaultValues,
): Record<string, unknown> => ({
path: request.path,
})

const marshalContainerHealthCheckSpecTCPProbe = (
request: ContainerHealthCheckSpecTCPProbe,
defaults: DefaultValues,
): Record<string, unknown> => ({})

const marshalContainerHealthCheckSpec = (
request: ContainerHealthCheckSpec,
defaults: DefaultValues,
): Record<string, unknown> => ({
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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
36 changes: 36 additions & 0 deletions packages/clients/src/api/container/v1beta1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -444,6 +476,8 @@ export type CreateContainerRequest = {
* instance.
*/
scalingOption?: ContainerScalingOption
/** Health check configuration of the container. */
healthCheck?: ContainerHealthCheckSpec
}

export type CreateCronRequest = {
Expand Down Expand Up @@ -907,6 +941,8 @@ export type UpdateContainerRequest = {
* instance.
*/
scalingOption?: ContainerScalingOption
/** Health check configuration of the container. */
healthCheck?: ContainerHealthCheckSpec
}

export type UpdateCronRequest = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down