Working codegen
Some checks failed
Lint / lint (push) Failing after 11s

This commit is contained in:
Julien Valverdé
2026-02-03 14:28:23 +01:00
parent 0e46ef8bb3
commit 3e30179370
159 changed files with 5098 additions and 1 deletions

View File

@@ -41,6 +41,7 @@
"@effect/platform-bun": "^0.87.1",
"@effect/platform-node": "^0.104.1",
"openapi-to-effect": "^0.9.3",
"prettier-plugin-jsdoc": "^1.8.0",
"tsx": "^4.21.0",
"undici": "^7.19.0"
},

View File

@@ -29,7 +29,7 @@ const generate = Effect.fn("generate")(function*(
const outputDirPath = path.join(tempOutputDirPath, version)
yield* fs.makeDirectory(outputDirPath)
run(["gen", specFilePath, outputDirPath])
yield* Effect.promise(() => run(["gen", specFilePath, outputDirPath]))
})
Effect.gen(function*() {

View File

@@ -0,0 +1,13 @@
import { pipe, Option, Schema as S } from 'effect';
/** Address represents an IPv4 or IPv6 IP address. */
export const Address = S.Struct({
/** IP address. */
Addr: S.optional(S.String),
/** Mask length of the IP address. */
PrefixLen: S.optional(pipe(S.Number, S.int())),
});
export type Address = S.Schema.Type<typeof Address>;
export const AddressEncoded = S.encodedSchema(Address);
export type AddressEncoded = S.Schema.Encoded<typeof Address>;

View File

@@ -0,0 +1,11 @@
import { pipe, Option, Schema as S } from 'effect';
export const AuthConfig = S.Struct({
username: S.optional(S.String),
password: S.optional(S.String),
serveraddress: S.optional(S.String),
});
export type AuthConfig = S.Schema.Type<typeof AuthConfig>;
export const AuthConfigEncoded = S.encodedSchema(AuthConfig);
export type AuthConfigEncoded = S.Schema.Encoded<typeof AuthConfig>;

View File

@@ -0,0 +1,13 @@
import { pipe, Option, Schema as S } from 'effect';
/** An identity token was generated successfully. */
export const AuthResponse = S.Struct({
/** The status of the authentication */
Status: S.String,
/** An opaque token used to authenticate a user after a successful login */
IdentityToken: S.optional(S.String),
});
export type AuthResponse = S.Schema.Type<typeof AuthResponse>;
export const AuthResponseEncoded = S.encodedSchema(AuthResponse);
export type AuthResponseEncoded = S.Schema.Encoded<typeof AuthResponse>;

View File

@@ -0,0 +1,43 @@
import { pipe, Option, Schema as S } from 'effect';
/** BuildCache contains information about a build cache record. */
export const BuildCache = S.Struct({
/** Unique ID of the build cache record. */
ID: S.optional(S.String),
/** List of parent build cache record IDs. */
Parents: S.optional(S.Array(S.String)),
/** Cache record type. */
Type: S.optional(
S.Literal(
'internal',
'frontend',
'source.local',
'source.git.checkout',
'exec.cachemount',
'regular',
),
),
/** Description of the build-step that produced the build cache. */
Description: S.optional(S.String),
/** Indicates if the build cache is in use. */
InUse: S.optional(S.Boolean),
/** Indicates if the build cache is shared. */
Shared: S.optional(S.Boolean),
/** Amount of disk space used by the build cache (in bytes). */
Size: S.optional(pipe(S.Number, S.int())),
/**
* Date and time at which the build cache was created in [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
*/
CreatedAt: S.optional(S.String),
/**
* Date and time at which the build cache was last used in [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
*/
LastUsedAt: S.optional(S.String),
UsageCount: S.optional(pipe(S.Number, S.int())),
});
export type BuildCache = S.Schema.Type<typeof BuildCache>;
export const BuildCacheEncoded = S.encodedSchema(BuildCache);
export type BuildCacheEncoded = S.Schema.Encoded<typeof BuildCache>;

View File

@@ -0,0 +1,19 @@
import { pipe, Option, Schema as S } from 'effect';
/** Represents system data usage for build cache resources. */
export const BuildCacheDiskUsage = S.Struct({
/** Count of active build cache records. */
ActiveCount: S.optional(pipe(S.Number, S.int())),
/** Count of all build cache records. */
TotalCount: S.optional(pipe(S.Number, S.int())),
/** Disk space that can be reclaimed by removing inactive build cache records. */
Reclaimable: S.optional(pipe(S.Number, S.int())),
/** Disk space in use by build cache records. */
TotalSize: S.optional(pipe(S.Number, S.int())),
/** List of build cache records. */
Items: S.optional(S.Array(S.Struct({}))),
});
export type BuildCacheDiskUsage = S.Schema.Type<typeof BuildCacheDiskUsage>;
export const BuildCacheDiskUsageEncoded = S.encodedSchema(BuildCacheDiskUsage);
export type BuildCacheDiskUsageEncoded = S.Schema.Encoded<typeof BuildCacheDiskUsage>;

View File

@@ -0,0 +1,16 @@
import { pipe, Option, Schema as S } from 'effect';
/** BuildIdentity contains build reference information if image was created via build. */
export const BuildIdentity = S.Struct({
/**
* Ref is the identifier for the build request. This reference can be used to look up the build
* details in BuildKit history API.
*/
Ref: S.optional(S.String),
/** CreatedAt is the time when the build ran. */
CreatedAt: S.optional(S.Date),
});
export type BuildIdentity = S.Schema.Type<typeof BuildIdentity>;
export const BuildIdentityEncoded = S.encodedSchema(BuildIdentity);
export type BuildIdentityEncoded = S.Schema.Encoded<typeof BuildIdentity>;

View File

@@ -0,0 +1,18 @@
import { pipe, Option, Schema as S } from 'effect';
import { ErrorDetail } from './ErrorDetail.ts';
import { ProgressDetail } from './ProgressDetail.ts';
import { ImageID } from './ImageID.ts';
export const BuildInfo = S.Struct({
id: S.optional(S.String),
stream: S.optional(S.String),
errorDetail: S.optional(ErrorDetail),
status: S.optional(S.String),
progressDetail: S.optional(ProgressDetail),
aux: S.optional(ImageID),
});
export type BuildInfo = S.Schema.Type<typeof BuildInfo>;
export const BuildInfoEncoded = S.encodedSchema(BuildInfo);
export type BuildInfoEncoded = S.Schema.Encoded<typeof BuildInfo>;

View File

@@ -0,0 +1,16 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* Kind of change
*
* Can be one of:
*
* - `0`: Modified ("C")
* - `1`: Added ("A")
* - `2`: Deleted ("D")
*/
export const ChangeType = S.Literal(0, 1, 2);
export type ChangeType = S.Schema.Type<typeof ChangeType>;
export const ChangeTypeEncoded = S.encodedSchema(ChangeType);
export type ChangeTypeEncoded = S.Schema.Encoded<typeof ChangeType>;

View File

@@ -0,0 +1,42 @@
import { pipe, Option, Schema as S } from 'effect';
import { ObjectVersion } from './ObjectVersion.ts';
import { SwarmSpec } from './SwarmSpec.ts';
import { TLSInfo } from './TLSInfo.ts';
/**
* ClusterInfo represents information about the swarm as is returned by the "/info" endpoint.
* Join-tokens are not included.
*/
export const ClusterInfo = S.Struct({
/** The ID of the swarm. */
ID: S.optional(S.String),
Version: S.optional(ObjectVersion),
/**
* Date and time at which the swarm was initialised in [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
*/
CreatedAt: S.optional(S.String),
/**
* Date and time at which the swarm was last updated in [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
*/
UpdatedAt: S.optional(S.String),
Spec: S.optional(SwarmSpec),
TLSInfo: S.optional(TLSInfo),
/** Whether there is currently a root CA rotation in progress for the swarm */
RootRotationInProgress: S.optional(S.Boolean),
/**
* DataPathPort specifies the data path port number for data traffic. Acceptable port range is
* 1024 to 49151. If no port is set or is set to 0, the default port (4789) is used.
*/
DataPathPort: S.optional(pipe(S.Number, S.int())),
/** Default Address Pool specifies default subnet pools for global scope networks. */
DefaultAddrPool: S.optional(S.Array(S.String)),
/** SubnetSize specifies the subnet size of the networks created from the default subnet pool. */
SubnetSize: S.optional(pipe(S.Number, S.int(), S.lessThanOrEqualTo(29))),
});
export type ClusterInfo = S.Schema.Type<typeof ClusterInfo>;
export const ClusterInfoEncoded = S.encodedSchema(ClusterInfo);
export type ClusterInfoEncoded = S.Schema.Encoded<typeof ClusterInfo>;

View File

@@ -0,0 +1,67 @@
import { pipe, Option, Schema as S } from 'effect';
import { ObjectVersion } from './ObjectVersion.ts';
import { ClusterVolumeSpec } from './ClusterVolumeSpec.ts';
import { Topology } from './Topology.ts';
/** Options and information specific to, and only present on, Swarm CSI cluster volumes. */
export const ClusterVolume = S.Struct({
/**
* The Swarm ID of this volume. Because cluster volumes are Swarm objects, they have an ID, unlike
* non-cluster volumes. This ID can be used to refer to the Volume instead of the name.
*/
ID: S.optional(S.String),
Version: S.optional(ObjectVersion),
CreatedAt: S.optional(S.String),
UpdatedAt: S.optional(S.String),
Spec: S.optional(ClusterVolumeSpec),
/** Information about the global status of the volume. */
Info: S.optional(
S.Struct({
/** The capacity of the volume in bytes. A value of 0 indicates that the capacity is unknown. */
CapacityBytes: S.optional(pipe(S.Number, S.int())),
/** A map of strings to strings returned from the storage plugin when the volume is created. */
VolumeContext: S.optional(S.Record({ key: S.String, value: S.String })),
/**
* The ID of the volume as returned by the CSI storage plugin. This is distinct from the
* volume's ID as provided by Docker. This ID is never used by the user when communicating with
* Docker to refer to this volume. If the ID is blank, then the Volume has not been successfully
* created in the plugin yet.
*/
VolumeID: S.optional(S.String),
/** The topology this volume is actually accessible from. */
AccessibleTopology: S.optional(S.Array(Topology)),
}),
),
/** The status of the volume as it pertains to its publishing and use on specific nodes */
PublishStatus: S.optional(
S.Array(
S.Struct({
/** The ID of the Swarm node the volume is published on. */
NodeID: S.optional(S.String),
/**
* The published state of the volume. `pending-publish` The volume should be published to this
* node, but the call to the controller plugin to do so has not yet been successfully completed.
* `published` The volume is published successfully to the node. `pending-node-unpublish` The
* volume should be unpublished from the node, and the manager is awaiting confirmation from the
* worker that it has done so. `pending-controller-unpublish` The volume is successfully
* unpublished from the node, but has not yet been successfully unpublished on the controller.
*/
State: S.optional(
S.Literal(
'pending-publish',
'published',
'pending-node-unpublish',
'pending-controller-unpublish',
),
),
/** A map of strings to strings returned by the CSI controller plugin when a volume is published. */
PublishContext: S.optional(S.Record({ key: S.String, value: S.String })),
}),
),
),
});
export type ClusterVolume = S.Schema.Type<typeof ClusterVolume>;
export const ClusterVolumeEncoded = S.encodedSchema(ClusterVolume);
export type ClusterVolumeEncoded = S.Schema.Encoded<typeof ClusterVolume>;

View File

@@ -0,0 +1,113 @@
import { pipe, Option, Schema as S } from 'effect';
import { Topology } from './Topology.ts';
/** Cluster-specific options used to create the volume. */
export const ClusterVolumeSpec = S.Struct({
/**
* Group defines the volume group of this volume. Volumes belonging to the same group can be
* referred to by group name when creating Services. Referring to a volume by group instructs
* Swarm to treat volumes in that group interchangeably for the purpose of scheduling. Volumes
* with an empty string for a group technically all belong to the same, emptystring group.
*/
Group: S.optional(S.String),
/** Defines how the volume is used by tasks. */
AccessMode: S.optional(
S.Struct({
/**
* The set of nodes this volume can be used on at one time. - `single` The volume may only be
* scheduled to one node at a time. - `multi` the volume may be scheduled to any supported
* number of nodes at a time.
*/
Scope: S.optionalWith(S.Literal('single', 'multi'), {
default: () => 'single',
}),
/**
* The number and way that different tasks can use this volume at one time. - `none` The volume
* may only be used by one task at a time. - `readonly` The volume may be used by any number of
* tasks, but they all must mount the volume as readonly - `onewriter` The volume may be used by
* any number of tasks, but only one may mount it as read/write. - `all` The volume may have any
* number of readers and writers.
*/
Sharing: S.optionalWith(S.Literal('none', 'readonly', 'onewriter', 'all'), {
default: () => 'none',
}),
/**
* Options for using this volume as a Mount-type volume.
*
* Either MountVolume or BlockVolume, but not both, must be
* present.
* properties:
* FsType:
* type: "string"
* description: |
* Specifies the filesystem type for the mount volume.
* Optional.
* MountFlags:
* type: "array"
* description: |
* Flags to pass when mounting the volume. Optional.
* items:
* type: "string"
* BlockVolume:
* type: "object"
* description: |
* Options for using this volume as a Block-type volume.
* Intentionally empty.
*/
MountVolume: S.optional(S.Struct({})),
/** Swarm Secrets that are passed to the CSI storage plugin when operating on this volume. */
Secrets: S.optional(
S.Array(
S.Struct({
/** Key is the name of the key of the key-value pair passed to the plugin. */
Key: S.optional(S.String),
/**
* Secret is the swarm Secret object from which to read data. This can be a Secret name or ID.
* The Secret data is retrieved by swarm and used as the value of the key-value pair passed to
* the plugin.
*/
Secret: S.optional(S.String),
}),
),
),
/**
* Requirements for the accessible topology of the volume. These fields are optional. For an
* in-depth description of what these fields mean, see the CSI specification.
*/
AccessibilityRequirements: S.optional(
S.Struct({
/** A list of required topologies, at least one of which the volume must be accessible from. */
Requisite: S.optional(S.Array(Topology)),
/** A list of topologies that the volume should attempt to be provisioned in. */
Preferred: S.optional(S.Array(Topology)),
}),
),
/**
* The desired capacity that the volume should be created with. If empty, the plugin will decide
* the capacity.
*/
CapacityRange: S.optional(
S.Struct({
/** The volume must be at least this big. The value of 0 indicates an unspecified minimum */
RequiredBytes: S.optional(pipe(S.Number, S.int())),
/** The volume must not be bigger than this. The value of 0 indicates an unspecified maximum. */
LimitBytes: S.optional(pipe(S.Number, S.int())),
}),
),
/**
* The availability of the volume for use in tasks. - `active` The volume is fully available for
* scheduling on the cluster - `pause` No new workloads should use the volume, but existing
* workloads are not stopped. - `drain` All workloads using this volume should be stopped and
* rescheduled, and no new ones should be started.
*/
Availability: S.optionalWith(S.Literal('active', 'pause', 'drain'), {
default: () => 'active',
}),
}),
),
});
export type ClusterVolumeSpec = S.Schema.Type<typeof ClusterVolumeSpec>;
export const ClusterVolumeSpecEncoded = S.encodedSchema(ClusterVolumeSpec);
export type ClusterVolumeSpecEncoded = S.Schema.Encoded<typeof ClusterVolumeSpec>;

View File

@@ -0,0 +1,14 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* Commit holds the Git-commit (SHA1) that a binary was built from, as reported in the
* version-string of external tools, such as `containerd`, or `runC`.
*/
export const Commit = S.Struct({
/** Actual commit ID of external tool. */
ID: S.optional(S.String),
});
export type Commit = S.Schema.Type<typeof Commit>;
export const CommitEncoded = S.encodedSchema(Commit);
export type CommitEncoded = S.Schema.Encoded<typeof Commit>;

View File

@@ -0,0 +1,16 @@
import { pipe, Option, Schema as S } from 'effect';
import { ObjectVersion } from './ObjectVersion.ts';
import { ConfigSpec } from './ConfigSpec.ts';
export const Config = S.Struct({
ID: S.optional(S.String),
Version: S.optional(ObjectVersion),
CreatedAt: S.optional(S.String),
UpdatedAt: S.optional(S.String),
Spec: S.optional(ConfigSpec),
});
export type Config = S.Schema.Type<typeof Config>;
export const ConfigEncoded = S.encodedSchema(Config);
export type ConfigEncoded = S.Schema.Encoded<typeof Config>;

View File

@@ -0,0 +1,15 @@
import { pipe, Option, Schema as S } from 'effect';
/** The config-only network source to provide the configuration for this network. */
export const ConfigReference = S.Struct({
/**
* The name of the config-only network that provides the network's configuration. The specified
* network must be an existing config-only network. Only network names are allowed, not network
* IDs.
*/
Network: S.optional(S.String),
});
export type ConfigReference = S.Schema.Type<typeof ConfigReference>;
export const ConfigReferenceEncoded = S.encodedSchema(ConfigReference);
export type ConfigReferenceEncoded = S.Schema.Encoded<typeof ConfigReference>;

View File

@@ -0,0 +1,22 @@
import { pipe, Option, Schema as S } from 'effect';
import { Driver } from './Driver.ts';
export const ConfigSpec = S.Struct({
/** User-defined name of the config. */
Name: S.optional(S.String),
/** User-defined key/value metadata. */
Labels: S.optional(S.Record({ key: S.String, value: S.String })),
/**
* Data is the data to store as a config, formatted as a standard base64-encoded ([RFC
* 4648](https://tools.ietf.org/html/rfc4648#section-4)) string. The maximum allowed size is
* 1000KB, as defined in
* [MaxConfigSize](https://pkg.go.dev/github.com/moby/swarmkit/v2@v2.0.0-20250103191802-8c1959736554/manager/controlapi#MaxConfigSize).
*/
Data: S.optional(S.String),
Templating: S.optional(Driver),
});
export type ConfigSpec = S.Schema.Type<typeof ConfigSpec>;
export const ConfigSpecEncoded = S.encodedSchema(ConfigSpec);
export type ConfigSpecEncoded = S.Schema.Encoded<typeof ConfigSpec>;

View File

@@ -0,0 +1,17 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* Blkio stats entry.
*
* This type is Linux-specific and omitted for Windows containers.
*/
export const ContainerBlkioStatEntry = S.Struct({
major: S.optional(pipe(S.Number, S.int())),
minor: S.optional(pipe(S.Number, S.int())),
op: S.optional(S.String),
value: S.optional(pipe(S.Number, S.int())),
});
export type ContainerBlkioStatEntry = S.Schema.Type<typeof ContainerBlkioStatEntry>;
export const ContainerBlkioStatEntryEncoded = S.encodedSchema(ContainerBlkioStatEntry);
export type ContainerBlkioStatEntryEncoded = S.Schema.Encoded<typeof ContainerBlkioStatEntry>;

View File

@@ -0,0 +1,54 @@
import { pipe, Option, Schema as S } from 'effect';
import { ContainerBlkioStatEntry } from './ContainerBlkioStatEntry.ts';
/**
* BlkioStats stores all IO service stats for data read and write.
*
* This type is Linux-specific and holds many fields that are specific to cgroups v1. On a cgroup v2
* host, all fields other than `io_service_bytes_recursive` are omitted or `null`.
*
* This type is only populated on Linux and omitted for Windows containers.
*/
export const ContainerBlkioStats = S.Struct({
io_service_bytes_recursive: S.optional(S.Array(ContainerBlkioStatEntry)),
/**
* This field is only available when using Linux containers with cgroups v1. It is omitted or
* `null` when using cgroups v2.
*/
io_serviced_recursive: S.optional(S.Array(ContainerBlkioStatEntry)),
/**
* This field is only available when using Linux containers with cgroups v1. It is omitted or
* `null` when using cgroups v2.
*/
io_queue_recursive: S.optional(S.Array(ContainerBlkioStatEntry)),
/**
* This field is only available when using Linux containers with cgroups v1. It is omitted or
* `null` when using cgroups v2.
*/
io_service_time_recursive: S.optional(S.Array(ContainerBlkioStatEntry)),
/**
* This field is only available when using Linux containers with cgroups v1. It is omitted or
* `null` when using cgroups v2.
*/
io_wait_time_recursive: S.optional(S.Array(ContainerBlkioStatEntry)),
/**
* This field is only available when using Linux containers with cgroups v1. It is omitted or
* `null` when using cgroups v2.
*/
io_merged_recursive: S.optional(S.Array(ContainerBlkioStatEntry)),
/**
* This field is only available when using Linux containers with cgroups v1. It is omitted or
* `null` when using cgroups v2.
*/
io_time_recursive: S.optional(S.Array(ContainerBlkioStatEntry)),
/**
* This field is only available when using Linux containers with cgroups v1. It is omitted or
* `null` when using cgroups v2.
*/
sectors_recursive: S.optional(S.Array(ContainerBlkioStatEntry)),
});
export type ContainerBlkioStats = S.Schema.Type<typeof ContainerBlkioStats>;
export const ContainerBlkioStatsEncoded = S.encodedSchema(ContainerBlkioStats);
export type ContainerBlkioStatsEncoded = S.Schema.Encoded<typeof ContainerBlkioStats>;

View File

@@ -0,0 +1,26 @@
import { pipe, Option, Schema as S } from 'effect';
import { ContainerCPUUsage } from './ContainerCPUUsage.ts';
import { ContainerThrottlingData } from './ContainerThrottlingData.ts';
/** CPU related info of the container */
export const ContainerCPUStats = S.Struct({
cpu_usage: S.optional(ContainerCPUUsage),
/**
* System Usage.
*
* This field is Linux-specific and omitted for Windows containers.
*/
system_cpu_usage: S.optional(pipe(S.Number, S.int())),
/**
* Number of online CPUs.
*
* This field is Linux-specific and omitted for Windows containers.
*/
online_cpus: S.optional(pipe(S.Number, S.int())),
throttling_data: S.optional(ContainerThrottlingData),
});
export type ContainerCPUStats = S.Schema.Type<typeof ContainerCPUStats>;
export const ContainerCPUStatsEncoded = S.encodedSchema(ContainerCPUStats);
export type ContainerCPUStatsEncoded = S.Schema.Encoded<typeof ContainerCPUStats>;

View File

@@ -0,0 +1,32 @@
import { pipe, Option, Schema as S } from 'effect';
/** All CPU stats aggregated since container inception. */
export const ContainerCPUUsage = S.Struct({
/** Total CPU time consumed in nanoseconds (Linux) or 100's of nanoseconds (Windows). */
total_usage: S.optional(pipe(S.Number, S.int())),
/**
* Total CPU time (in nanoseconds) consumed per core (Linux).
*
* This field is Linux-specific when using cgroups v1. It is omitted when using cgroups v2 and
* Windows containers.
*/
percpu_usage: S.optional(S.Array(pipe(S.Number, S.int()))),
/**
* Time (in nanoseconds) spent by tasks of the cgroup in kernel mode (Linux), or time spent (in
* 100's of nanoseconds) by all container processes in kernel mode (Windows).
*
* Not populated for Windows containers using Hyper-V isolation.
*/
usage_in_kernelmode: S.optional(pipe(S.Number, S.int())),
/**
* Time (in nanoseconds) spent by tasks of the cgroup in user mode (Linux), or time spent (in
* 100's of nanoseconds) by all container processes in kernel mode (Windows).
*
* Not populated for Windows containers using Hyper-V isolation.
*/
usage_in_usermode: S.optional(pipe(S.Number, S.int())),
});
export type ContainerCPUUsage = S.Schema.Type<typeof ContainerCPUUsage>;
export const ContainerCPUUsageEncoded = S.encodedSchema(ContainerCPUUsage);
export type ContainerCPUUsageEncoded = S.Schema.Encoded<typeof ContainerCPUUsage>;

View File

@@ -0,0 +1,94 @@
import { pipe, Option, Schema as S } from 'effect';
import { HealthConfig } from './HealthConfig.ts';
/** Configuration for a container that is portable between hosts. */
export const ContainerConfig = S.Struct({
/** The hostname to use for the container, as a valid RFC 1123 hostname. */
Hostname: S.optional(S.String),
/** The domain name to use for the container. */
Domainname: S.optional(S.String),
/**
* Commands run as this user inside the container. If omitted, commands run as the user specified
* in the image the container was started from.
*
* Can be either user-name or UID, and optional group-name or GID, separated by a colon
* (`<user-name|UID>[<:group-name|GID>]`).
*/
User: S.optional(S.String),
/** Whether to attach to `stdin`. */
AttachStdin: S.optionalWith(S.Boolean, {
default: () => false,
}),
/** Whether to attach to `stdout`. */
AttachStdout: S.optionalWith(S.Boolean, {
default: () => true,
}),
/** Whether to attach to `stderr`. */
AttachStderr: S.optionalWith(S.Boolean, {
default: () => true,
}),
/**
* An object mapping ports to an empty object in the form:
*
* `{"<port>/<tcp|udp|sctp>": {}}`
*/
ExposedPorts: S.optional(S.Record({ key: S.String, value: S.Struct({}) })),
/** Attach standard streams to a TTY, including `stdin` if it is not closed. */
Tty: S.optionalWith(S.Boolean, {
default: () => false,
}),
/** Open `stdin` */
OpenStdin: S.optionalWith(S.Boolean, {
default: () => false,
}),
/** Close `stdin` after one attached client disconnects */
StdinOnce: S.optionalWith(S.Boolean, {
default: () => false,
}),
/**
* A list of environment variables to set inside the container in the form `["VAR=value", ...]`. A
* variable without `=` is removed from the environment, rather than to have an empty value.
*/
Env: S.optional(S.Array(S.String)),
/** Command to run specified as a string or an array of strings. */
Cmd: S.optional(S.Array(S.String)),
Healthcheck: S.optional(HealthConfig),
/** Command is already escaped (Windows only) */
ArgsEscaped: S.optionalWith(S.Boolean, {
default: () => false,
}),
/**
* The name (or reference) of the image to use when creating the container, or which was used when
* the container was created.
*/
Image: S.optional(S.String),
/** An object mapping mount point paths inside the container to empty objects. */
Volumes: S.optional(S.Record({ key: S.String, value: S.Struct({}) })),
/** The working directory for commands to run in. */
WorkingDir: S.optional(S.String),
/**
* The entry point for the container as a string or an array of strings.
*
* If the array consists of exactly one empty string (`[""]`) then the entry point is reset to
* system default (i.e., the entry point used by docker when there is no `ENTRYPOINT` instruction
* in the `Dockerfile`).
*/
Entrypoint: S.optional(S.Array(S.String)),
/** Disable networking for the container. */
NetworkDisabled: S.optional(S.Boolean),
/** `ONBUILD` metadata that were defined in the image's `Dockerfile`. */
OnBuild: S.optional(S.Array(S.String)),
/** User-defined key/value metadata. */
Labels: S.optional(S.Record({ key: S.String, value: S.String })),
/** Signal to stop a container as a string or unsigned integer. */
StopSignal: S.optional(S.String),
/** Timeout to stop a container in seconds. */
StopTimeout: S.optional(pipe(S.Number, S.int())),
/** Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. */
Shell: S.optional(S.Array(S.String)),
});
export type ContainerConfig = S.Schema.Type<typeof ContainerConfig>;
export const ContainerConfigEncoded = S.encodedSchema(ContainerConfig);
export type ContainerConfigEncoded = S.Schema.Encoded<typeof ContainerConfig>;

View File

@@ -0,0 +1,13 @@
import { pipe, Option, Schema as S } from 'effect';
/** OK response to ContainerCreate operation */
export const ContainerCreateResponse = S.Struct({
/** The ID of the created container */
Id: S.String,
/** Warnings encountered when creating the container */
Warnings: S.Array(S.String),
}); // ContainerCreateResponse
export type ContainerCreateResponse = S.Schema.Type<typeof ContainerCreateResponse>;
export const ContainerCreateResponseEncoded = S.encodedSchema(ContainerCreateResponse);
export type ContainerCreateResponseEncoded = S.Schema.Encoded<typeof ContainerCreateResponse>;

View File

@@ -0,0 +1,109 @@
import { pipe, Option, Schema as S } from 'effect';
import { ContainerState } from './ContainerState.ts';
import { OCIDescriptor } from './OCIDescriptor.ts';
import { HostConfig } from './HostConfig.ts';
import { DriverData } from './DriverData.ts';
import { Storage } from './Storage.ts';
import { MountPoint } from './MountPoint.ts';
import { ContainerConfig } from './ContainerConfig.ts';
import { NetworkSettings } from './NetworkSettings.ts';
export const ContainerInspectResponse = S.Struct({
/** The ID of this container as a 128-bit (64-character) hexadecimal string (32 bytes). */
Id: S.optional(
pipe(S.String, S.pattern(new RegExp('^[0-9a-fA-F]{64}$')), S.minLength(64), S.maxLength(64)),
),
/**
* Date and time at which the container was created, formatted in [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
*/
Created: S.optional(S.String),
/** The path to the command being run */
Path: S.optional(S.String),
/** The arguments to the command being run */
Args: S.optional(S.Array(S.String)),
State: S.optional(ContainerState),
/** The ID (digest) of the image that this container was created from. */
Image: S.optional(S.String),
/**
* Location of the `/etc/resolv.conf` generated for the container on the host.
*
* This file is managed through the docker daemon, and should not be accessed or modified by other
* tools.
*/
ResolvConfPath: S.optional(S.String),
/**
* Location of the `/etc/hostname` generated for the container on the host.
*
* This file is managed through the docker daemon, and should not be accessed or modified by other
* tools.
*/
HostnamePath: S.optional(S.String),
/**
* Location of the `/etc/hosts` generated for the container on the host.
*
* This file is managed through the docker daemon, and should not be accessed or modified by other
* tools.
*/
HostsPath: S.optional(S.String),
/**
* Location of the file used to buffer the container's logs. Depending on the logging-driver used
* for the container, this field may be omitted.
*
* This file is managed through the docker daemon, and should not be accessed or modified by other
* tools.
*/
LogPath: S.optional(S.String),
/**
* The name associated with this container.
*
* For historic reasons, the name may be prefixed with a forward-slash (`/`).
*/
Name: S.optional(S.String),
/** Number of times the container was restarted since it was created, or since daemon was started. */
RestartCount: S.optional(pipe(S.Number, S.int())),
/** The storage-driver used for the container's filesystem (graph-driver or snapshotter). */
Driver: S.optional(S.String),
/**
* The platform (operating system) for which the container was created.
*
* This field was introduced for the experimental "LCOW" (Linux Containers On Windows) features,
* which has been removed. In most cases, this field is equal to the host's operating system
* (`linux` or `windows`).
*/
Platform: S.optional(S.String),
ImageManifestDescriptor: S.optional(OCIDescriptor),
/** SELinux mount label set for the container. */
MountLabel: S.optional(S.String),
/** SELinux process label set for the container. */
ProcessLabel: S.optional(S.String),
/** The AppArmor profile set for the container. */
AppArmorProfile: S.optional(S.String),
/** IDs of exec instances that are running in the container. */
ExecIDs: S.optional(S.Array(S.String)),
HostConfig: S.optional(HostConfig),
GraphDriver: S.optional(DriverData),
Storage: S.optional(Storage),
/**
* The size of files that have been created or changed by this container.
*
* This field is omitted by default, and only set when size is requested in the API request.
*/
SizeRw: S.optional(pipe(S.Number, S.int())),
/**
* The total size of all files in the read-only layers from the image that the container uses.
* These layers can be shared between containers.
*
* This field is omitted by default, and only set when size is requested in the API request.
*/
SizeRootFs: S.optional(pipe(S.Number, S.int())),
/** List of mounts used by the container. */
Mounts: S.optional(S.Array(MountPoint)),
Config: S.optional(ContainerConfig),
NetworkSettings: S.optional(NetworkSettings),
}); // ContainerInspectResponse
export type ContainerInspectResponse = S.Schema.Type<typeof ContainerInspectResponse>;
export const ContainerInspectResponseEncoded = S.encodedSchema(ContainerInspectResponse);
export type ContainerInspectResponseEncoded = S.Schema.Encoded<typeof ContainerInspectResponse>;

View File

@@ -0,0 +1,62 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* Aggregates all memory stats since container inception on Linux. Windows returns stats for commit
* and private working set only.
*/
export const ContainerMemoryStats = S.Struct({
/**
* Current `res_counter` usage for memory.
*
* This field is Linux-specific and omitted for Windows containers.
*/
usage: S.optional(pipe(S.Number, S.int())),
/**
* Maximum usage ever recorded.
*
* This field is Linux-specific and only supported on cgroups v1. It is omitted when using cgroups
* v2 and for Windows containers.
*/
max_usage: S.optional(pipe(S.Number, S.int())),
/**
* All the stats exported via memory.stat.
*
* The fields in this object differ between cgroups v1 and v2. On cgroups v1, fields such as
* `cache`, `rss`, `mapped_file` are available. On cgroups v2, fields such as `file`, `anon`,
* `inactive_file` are available.
*
* This field is Linux-specific and omitted for Windows containers.
*/
stats: S.optional(S.Record({ key: S.String, value: pipe(S.Number, S.int()) })),
/**
* Number of times memory usage hits limits.
*
* This field is Linux-specific and only supported on cgroups v1. It is omitted when using cgroups
* v2 and for Windows containers.
*/
failcnt: S.optional(pipe(S.Number, S.int())),
/** This field is Linux-specific and omitted for Windows containers. */
limit: S.optional(pipe(S.Number, S.int())),
/**
* Committed bytes.
*
* This field is Windows-specific and omitted for Linux containers.
*/
commitbytes: S.optional(pipe(S.Number, S.int())),
/**
* Peak committed bytes.
*
* This field is Windows-specific and omitted for Linux containers.
*/
commitpeakbytes: S.optional(pipe(S.Number, S.int())),
/**
* Private working set.
*
* This field is Windows-specific and omitted for Linux containers.
*/
privateworkingset: S.optional(pipe(S.Number, S.int())),
});
export type ContainerMemoryStats = S.Schema.Type<typeof ContainerMemoryStats>;
export const ContainerMemoryStatsEncoded = S.encodedSchema(ContainerMemoryStats);
export type ContainerMemoryStatsEncoded = S.Schema.Encoded<typeof ContainerMemoryStats>;

View File

@@ -0,0 +1,45 @@
import { pipe, Option, Schema as S } from 'effect';
/** Aggregates the network stats of one container */
export const ContainerNetworkStats = S.Struct({
/** Bytes received. Windows and Linux. */
rx_bytes: S.optional(pipe(S.Number, S.int())),
/** Packets received. Windows and Linux. */
rx_packets: S.optional(pipe(S.Number, S.int())),
/**
* Received errors. Not used on Windows.
*
* This field is Linux-specific and always zero for Windows containers.
*/
rx_errors: S.optional(pipe(S.Number, S.int())),
/** Incoming packets dropped. Windows and Linux. */
rx_dropped: S.optional(pipe(S.Number, S.int())),
/** Bytes sent. Windows and Linux. */
tx_bytes: S.optional(pipe(S.Number, S.int())),
/** Packets sent. Windows and Linux. */
tx_packets: S.optional(pipe(S.Number, S.int())),
/**
* Sent errors. Not used on Windows.
*
* This field is Linux-specific and always zero for Windows containers.
*/
tx_errors: S.optional(pipe(S.Number, S.int())),
/** Outgoing packets dropped. Windows and Linux. */
tx_dropped: S.optional(pipe(S.Number, S.int())),
/**
* Endpoint ID. Not used on Linux.
*
* This field is Windows-specific and omitted for Linux containers.
*/
endpoint_id: S.optional(S.String),
/**
* Instance ID. Not used on Linux.
*
* This field is Windows-specific and omitted for Linux containers.
*/
instance_id: S.optional(S.String),
});
export type ContainerNetworkStats = S.Schema.Type<typeof ContainerNetworkStats>;
export const ContainerNetworkStatsEncoded = S.encodedSchema(ContainerNetworkStats);
export type ContainerNetworkStatsEncoded = S.Schema.Encoded<typeof ContainerNetworkStats>;

View File

@@ -0,0 +1,20 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* PidsStats contains Linux-specific stats of a container's process-IDs (PIDs).
*
* This type is Linux-specific and omitted for Windows containers.
*/
export const ContainerPidsStats = S.Struct({
/** Current is the number of PIDs in the cgroup. */
current: S.optional(pipe(S.Number, S.int())),
/**
* Limit is the hard limit on the number of pids in the cgroup. A "Limit" of 0 means that there is
* no limit.
*/
limit: S.optional(pipe(S.Number, S.int())),
});
export type ContainerPidsStats = S.Schema.Type<typeof ContainerPidsStats>;
export const ContainerPidsStatsEncoded = S.encodedSchema(ContainerPidsStats);
export type ContainerPidsStatsEncoded = S.Schema.Encoded<typeof ContainerPidsStats>;

View File

@@ -0,0 +1,54 @@
import { pipe, Option, Schema as S } from 'effect';
import { Health } from './Health.ts';
/**
* ContainerState stores container's running state. It's part of ContainerJSONBase and will be
* returned by the "inspect" command.
*/
export const ContainerState = S.Struct({
/**
* String representation of the container state. Can be one of "created", "running", "paused",
* "restarting", "removing", "exited", or "dead".
*/
Status: S.optional(
S.Literal('created', 'running', 'paused', 'restarting', 'removing', 'exited', 'dead'),
),
/**
* Whether this container is running.
*
* Note that a running container can be _paused_. The `Running` and `Paused` booleans are not
* mutually exclusive:
*
* When pausing a container (on Linux), the freezer cgroup is used to suspend all processes in the
* container. Freezing the process requires the process to be running. As a result, paused
* containers are both `Running` _and_ `Paused`.
*
* Use the `Status` field instead to determine if a container's state is "running".
*/
Running: S.optional(S.Boolean),
/** Whether this container is paused. */
Paused: S.optional(S.Boolean),
/** Whether this container is restarting. */
Restarting: S.optional(S.Boolean),
/**
* Whether a process within this container has been killed because it ran out of memory since the
* container was last started.
*/
OOMKilled: S.optional(S.Boolean),
Dead: S.optional(S.Boolean),
/** The process ID of this container */
Pid: S.optional(pipe(S.Number, S.int())),
/** The last exit code of this container */
ExitCode: S.optional(pipe(S.Number, S.int())),
Error: S.optional(S.String),
/** The time when this container was last started. */
StartedAt: S.optional(S.String),
/** The time when this container last exited. */
FinishedAt: S.optional(S.String),
Health: S.optional(Health),
});
export type ContainerState = S.Schema.Type<typeof ContainerState>;
export const ContainerStateEncoded = S.encodedSchema(ContainerState);
export type ContainerStateEncoded = S.Schema.Encoded<typeof ContainerState>;

View File

@@ -0,0 +1,55 @@
import { pipe, Option, Schema as S } from 'effect';
import { ContainerCPUStats } from './ContainerCPUStats.ts';
import { ContainerMemoryStats } from './ContainerMemoryStats.ts';
import { ContainerPidsStats } from './ContainerPidsStats.ts';
import { ContainerBlkioStats } from './ContainerBlkioStats.ts';
import { ContainerStorageStats } from './ContainerStorageStats.ts';
/** Statistics sample for a container. */
export const ContainerStatsResponse = S.Struct({
/** ID of the container for which the stats were collected. */
id: S.optional(S.String),
/** Name of the container for which the stats were collected. */
name: S.optional(S.String),
/**
* OSType is the OS of the container ("linux" or "windows") to allow platform-specific handling of
* stats.
*/
os_type: S.optional(S.String),
/**
* Date and time at which this sample was collected. The value is formatted as [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) with nano-seconds.
*/
read: S.optional(S.Date),
cpu_stats: S.optional(ContainerCPUStats),
memory_stats: S.optional(ContainerMemoryStats),
/**
* Network statistics for the container per interface.
*
* This field is omitted if the container has no networking enabled.
*/
networks: S.optional(S.Struct({})),
pids_stats: S.optional(ContainerPidsStats),
blkio_stats: S.optional(ContainerBlkioStats),
/**
* The number of processors on the system.
*
* This field is Windows-specific and always zero for Linux containers.
*/
num_procs: S.optional(pipe(S.Number, S.int())),
storage_stats: S.optional(ContainerStorageStats),
/**
* Date and time at which this first sample was collected. This field is not propagated if the
* "one-shot" option is set. If the "one-shot" option is set, this field may be omitted, empty, or
* set to a default date (`0001-01-01T00:00:00Z`).
*
* The value is formatted as [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) with nano-seconds.
*/
preread: S.optional(S.Date),
precpu_stats: S.optional(ContainerCPUStats),
}); // ContainerStatsResponse
export type ContainerStatsResponse = S.Schema.Type<typeof ContainerStatsResponse>;
export const ContainerStatsResponseEncoded = S.encodedSchema(ContainerStatsResponse);
export type ContainerStatsResponseEncoded = S.Schema.Encoded<typeof ContainerStatsResponse>;

View File

@@ -0,0 +1,12 @@
import { pipe, Option, Schema as S } from 'effect';
/** Represents the status of a container. */
export const ContainerStatus = S.Struct({
ContainerID: S.optional(S.String),
PID: S.optional(pipe(S.Number, S.int())),
ExitCode: S.optional(pipe(S.Number, S.int())),
});
export type ContainerStatus = S.Schema.Type<typeof ContainerStatus>;
export const ContainerStatusEncoded = S.encodedSchema(ContainerStatus);
export type ContainerStatusEncoded = S.Schema.Encoded<typeof ContainerStatus>;

View File

@@ -0,0 +1,17 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* StorageStats is the disk I/O stats for read/write on Windows.
*
* This type is Windows-specific and omitted for Linux containers.
*/
export const ContainerStorageStats = S.Struct({
read_count_normalized: S.optional(pipe(S.Number, S.int())),
read_size_bytes: S.optional(pipe(S.Number, S.int())),
write_count_normalized: S.optional(pipe(S.Number, S.int())),
write_size_bytes: S.optional(pipe(S.Number, S.int())),
});
export type ContainerStorageStats = S.Schema.Type<typeof ContainerStorageStats>;
export const ContainerStorageStatsEncoded = S.encodedSchema(ContainerStorageStats);
export type ContainerStorageStatsEncoded = S.Schema.Encoded<typeof ContainerStorageStats>;

View File

@@ -0,0 +1,115 @@
import { pipe, Option, Schema as S } from 'effect';
import { OCIDescriptor } from './OCIDescriptor.ts';
import { PortSummary } from './PortSummary.ts';
import { EndpointSettings } from './EndpointSettings.ts';
import { MountPoint } from './MountPoint.ts';
export const ContainerSummary = S.Struct({
/** The ID of this container as a 128-bit (64-character) hexadecimal string (32 bytes). */
Id: S.optional(
pipe(S.String, S.pattern(new RegExp('^[0-9a-fA-F]{64}$')), S.minLength(64), S.maxLength(64)),
),
/**
* The names associated with this container. Most containers have a single name, but when using
* legacy "links", the container can have multiple names.
*
* For historic reasons, names are prefixed with a forward-slash (`/`).
*/
Names: S.optional(S.Array(S.String)),
/**
* The name or ID of the image used to create the container.
*
* This field shows the image reference as was specified when creating the container, which can be
* in its canonical form (e.g., `docker.io/library/ubuntu:latest` or
* `docker.io/library/ubuntu@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782`),
* short form (e.g., `ubuntu:latest`)), or the ID(-prefix) of the image (e.g., `72297848456d`).
*
* The content of this field can be updated at runtime if the image used to create the container
* is untagged, in which case the field is updated to contain the the image ID (digest) it was
* resolved to in its canonical, non-truncated form (e.g.,
* `sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782`).
*/
Image: S.optional(S.String),
/** The ID (digest) of the image that this container was created from. */
ImageID: S.optional(S.String),
ImageManifestDescriptor: S.optional(OCIDescriptor),
/** Command to run when starting the container */
Command: S.optional(S.String),
/**
* Date and time at which the container was created as a Unix timestamp (number of seconds since
* EPOCH).
*/
Created: S.optional(pipe(S.Number, S.int())),
/** Port-mappings for the container. */
Ports: S.optional(S.Array(PortSummary)),
/**
* The size of files that have been created or changed by this container.
*
* This field is omitted by default, and only set when size is requested in the API request.
*/
SizeRw: S.optional(pipe(S.Number, S.int())),
/**
* The total size of all files in the read-only layers from the image that the container uses.
* These layers can be shared between containers.
*
* This field is omitted by default, and only set when size is requested in the API request.
*/
SizeRootFs: S.optional(pipe(S.Number, S.int())),
/** User-defined key/value metadata. */
Labels: S.optional(S.Record({ key: S.String, value: S.String })),
/** The state of this container. */
State: S.optional(
S.Literal('created', 'running', 'paused', 'restarting', 'exited', 'removing', 'dead'),
),
/** Additional human-readable status of this container (e.g. `Exit 0`) */
Status: S.optional(S.String),
/**
* Summary of host-specific runtime information of the container. This is a reduced set of
* information in the container's "HostConfig" as available in the container "inspect" response.
*/
HostConfig: S.optional(
S.Struct({
/**
* Networking mode (`host`, `none`, `container:<id>`) or name of the primary network the
* container is using.
*
* This field is primarily for backward compatibility. The container
* can be connected to multiple networks for which information can be
* found in the `NetworkSettings.Networks` field, which enumerates
* settings per network.
*/
NetworkMode: S.optional(S.String),
/** Arbitrary key-value metadata attached to the container. */
Annotations: S.optional(S.Record({ key: S.String, value: S.String })),
}),
),
/** Summary of the container's network settings */
NetworkSettings: S.optional(
S.Struct({
/** Summary of network-settings for each network the container is attached to. */
Networks: S.optional(S.Record({ key: S.String, value: EndpointSettings })),
}),
),
/** List of mounts used by the container. */
Mounts: S.optional(S.Array(MountPoint)),
/**
* Summary of health status
*
* Added in v1.52, before that version all container summary not include Health. After this
* attribute introduced, it includes containers with no health checks configured, or containers
* that are not running with none
*/
Health: S.optional(
S.Struct({
/** The health status of the container */
Status: S.optional(S.Literal('none', 'starting', 'healthy', 'unhealthy')),
/** FailingStreak is the number of consecutive failures */
FailingStreak: S.optional(pipe(S.Number, S.int())),
}),
),
});
export type ContainerSummary = S.Schema.Type<typeof ContainerSummary>;
export const ContainerSummaryEncoded = S.encodedSchema(ContainerSummary);
export type ContainerSummaryEncoded = S.Schema.Encoded<typeof ContainerSummary>;

View File

@@ -0,0 +1,19 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* CPU throttling stats of the container.
*
* This type is Linux-specific and omitted for Windows containers.
*/
export const ContainerThrottlingData = S.Struct({
/** Number of periods with throttling active. */
periods: S.optional(pipe(S.Number, S.int())),
/** Number of periods when the container hit its throttling limit. */
throttled_periods: S.optional(pipe(S.Number, S.int())),
/** Aggregated time (in nanoseconds) the container was throttled for. */
throttled_time: S.optional(pipe(S.Number, S.int())),
});
export type ContainerThrottlingData = S.Schema.Type<typeof ContainerThrottlingData>;
export const ContainerThrottlingDataEncoded = S.encodedSchema(ContainerThrottlingData);
export type ContainerThrottlingDataEncoded = S.Schema.Encoded<typeof ContainerThrottlingData>;

View File

@@ -0,0 +1,16 @@
import { pipe, Option, Schema as S } from 'effect';
/** Container "top" response. */
export const ContainerTopResponse = S.Struct({
/** The ps column titles */
Titles: S.optional(S.Array(S.String)),
/**
* Each process running in the container, where each process is an array of values corresponding
* to the titles.
*/
Processes: S.optional(S.Array(S.Array(S.String))),
}); // ContainerTopResponse
export type ContainerTopResponse = S.Schema.Type<typeof ContainerTopResponse>;
export const ContainerTopResponseEncoded = S.encodedSchema(ContainerTopResponse);
export type ContainerTopResponseEncoded = S.Schema.Encoded<typeof ContainerTopResponse>;

View File

@@ -0,0 +1,11 @@
import { pipe, Option, Schema as S } from 'effect';
/** Response for a successful container-update. */
export const ContainerUpdateResponse = S.Struct({
/** Warnings encountered when updating the container. */
Warnings: S.optional(S.Array(S.String)),
}); // ContainerUpdateResponse
export type ContainerUpdateResponse = S.Schema.Type<typeof ContainerUpdateResponse>;
export const ContainerUpdateResponseEncoded = S.encodedSchema(ContainerUpdateResponse);
export type ContainerUpdateResponseEncoded = S.Schema.Encoded<typeof ContainerUpdateResponse>;

View File

@@ -0,0 +1,11 @@
import { pipe, Option, Schema as S } from 'effect';
/** Container waiting error, if any */
export const ContainerWaitExitError = S.Struct({
/** Details of an error */
Message: S.optional(S.String),
});
export type ContainerWaitExitError = S.Schema.Type<typeof ContainerWaitExitError>;
export const ContainerWaitExitErrorEncoded = S.encodedSchema(ContainerWaitExitError);
export type ContainerWaitExitErrorEncoded = S.Schema.Encoded<typeof ContainerWaitExitError>;

View File

@@ -0,0 +1,14 @@
import { pipe, Option, Schema as S } from 'effect';
import { ContainerWaitExitError } from './ContainerWaitExitError.ts';
/** OK response to ContainerWait operation */
export const ContainerWaitResponse = S.Struct({
/** Exit code of the container */
StatusCode: pipe(S.Number, S.int()),
Error: S.optional(ContainerWaitExitError),
}); // ContainerWaitResponse
export type ContainerWaitResponse = S.Schema.Type<typeof ContainerWaitResponse>;
export const ContainerWaitResponseEncoded = S.encodedSchema(ContainerWaitResponse);
export type ContainerWaitResponseEncoded = S.Schema.Encoded<typeof ContainerWaitResponse>;

View File

@@ -0,0 +1,50 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* Information for connecting to the containerd instance that is used by the daemon. This is
* included for debugging purposes only.
*/
export const ContainerdInfo = S.Struct({
/** The address of the containerd socket. */
Address: S.optional(S.String),
/**
* The namespaces that the daemon uses for running containers and plugins in containerd. These
* namespaces can be configured in the daemon configuration, and are considered to be used
* exclusively by the daemon, Tampering with the containerd instance may cause unexpected
* behavior.
*
* As these namespaces are considered to be exclusively accessed by the daemon, it is not
* recommended to change these values, or to change them to a value that is used by other systems,
* such as cri-containerd.
*/
Namespaces: S.optional(
S.Struct({
/**
* The default containerd namespace used for containers managed by the daemon.
*
* The default namespace for containers is "moby", but will be
* suffixed with the `<uid>.<gid>` of the remapped `root` if
* user-namespaces are enabled and the containerd image-store
* is used.
*/
Containers: S.optionalWith(S.String, {
default: () => 'moby',
}),
/**
* The default containerd namespace used for plugins managed by the daemon.
*
* The default namespace for plugins is "plugins.moby", but will be
* suffixed with the `<uid>.<gid>` of the remapped `root` if
* user-namespaces are enabled and the containerd image-store
* is used.
*/
Plugins: S.optionalWith(S.String, {
default: () => 'plugins.moby',
}),
}),
),
});
export type ContainerdInfo = S.Schema.Type<typeof ContainerdInfo>;
export const ContainerdInfoEncoded = S.encodedSchema(ContainerdInfo);
export type ContainerdInfoEncoded = S.Schema.Encoded<typeof ContainerdInfo>;

View File

@@ -0,0 +1,19 @@
import { pipe, Option, Schema as S } from 'effect';
/** Represents system data usage information for container resources. */
export const ContainersDiskUsage = S.Struct({
/** Count of active containers. */
ActiveCount: S.optional(pipe(S.Number, S.int())),
/** Count of all containers. */
TotalCount: S.optional(pipe(S.Number, S.int())),
/** Disk space that can be reclaimed by removing inactive containers. */
Reclaimable: S.optional(pipe(S.Number, S.int())),
/** Disk space in use by containers. */
TotalSize: S.optional(pipe(S.Number, S.int())),
/** List of container summaries. */
Items: S.optional(S.Array(S.Struct({}))),
});
export type ContainersDiskUsage = S.Schema.Type<typeof ContainersDiskUsage>;
export const ContainersDiskUsageEncoded = S.encodedSchema(ContainersDiskUsage);
export type ContainersDiskUsageEncoded = S.Schema.Encoded<typeof ContainersDiskUsage>;

View File

@@ -0,0 +1,15 @@
import { pipe, Option, Schema as S } from 'effect';
import { ErrorDetail } from './ErrorDetail.ts';
import { ProgressDetail } from './ProgressDetail.ts';
export const CreateImageInfo = S.Struct({
id: S.optional(S.String),
errorDetail: S.optional(ErrorDetail),
status: S.optional(S.String),
progressDetail: S.optional(ProgressDetail),
});
export type CreateImageInfo = S.Schema.Type<typeof CreateImageInfo>;
export const CreateImageInfoEncoded = S.encodedSchema(CreateImageInfo);
export type CreateImageInfoEncoded = S.Schema.Encoded<typeof CreateImageInfo>;

View File

@@ -0,0 +1,16 @@
import { pipe, Option, Schema as S } from 'effect';
/** DeviceInfo represents a device that can be used by a container. */
export const DeviceInfo = S.Struct({
/** The origin device driver. */
Source: S.optional(S.String),
/**
* The unique identifier for the device within its source driver. For CDI devices, this would be
* an FQDN like "vendor.com/gpu=0".
*/
ID: S.optional(S.String),
});
export type DeviceInfo = S.Schema.Type<typeof DeviceInfo>;
export const DeviceInfoEncoded = S.encodedSchema(DeviceInfo);
export type DeviceInfoEncoded = S.Schema.Encoded<typeof DeviceInfo>;

View File

@@ -0,0 +1,12 @@
import { pipe, Option, Schema as S } from 'effect';
/** A device mapping between the host and container */
export const DeviceMapping = S.Struct({
PathOnHost: S.optional(S.String),
PathInContainer: S.optional(S.String),
CgroupPermissions: S.optional(S.String),
});
export type DeviceMapping = S.Schema.Type<typeof DeviceMapping>;
export const DeviceMappingEncoded = S.encodedSchema(DeviceMapping);
export type DeviceMappingEncoded = S.Schema.Encoded<typeof DeviceMapping>;

View File

@@ -0,0 +1,32 @@
import { pipe, Option, Schema as S } from 'effect';
/** A request for devices to be sent to device drivers */
export const DeviceRequest = S.Struct({
/**
* The name of the device driver to use for this request.
*
* Note that if this is specified the capabilities are ignored when selecting a device driver.
*/
Driver: S.optional(S.String),
Count: S.optional(pipe(S.Number, S.int())),
DeviceIDs: S.optional(S.Array(S.String)),
/**
* A list of capabilities; an OR list of AND lists of capabilities.
*
* Note that if a driver is specified the capabilities have no effect on selecting a driver as the
* driver name is used directly.
*
* Note that if no driver is specified the capabilities are used to select a driver with the
* required capabilities.
*/
Capabilities: S.optional(S.Array(S.Array(S.String))),
/**
* Driver-specific options, specified as a key/value pairs. These options are passed directly to
* the driver.
*/
Options: S.optional(S.Record({ key: S.String, value: S.String })),
});
export type DeviceRequest = S.Schema.Type<typeof DeviceRequest>;
export const DeviceRequestEncoded = S.encodedSchema(DeviceRequest);
export type DeviceRequestEncoded = S.Schema.Encoded<typeof DeviceRequest>;

View File

@@ -0,0 +1,15 @@
import { pipe, Option, Schema as S } from 'effect';
import { OCIDescriptor } from './OCIDescriptor.ts';
import { OCIPlatform } from './OCIPlatform.ts';
/** Describes the result obtained from contacting the registry to retrieve image metadata. */
export const DistributionInspect = S.Struct({
Descriptor: OCIDescriptor,
/** An array containing all platforms supported by the image. */
Platforms: S.Array(OCIPlatform),
}); // DistributionInspectResponse
export type DistributionInspect = S.Schema.Type<typeof DistributionInspect>;
export const DistributionInspectEncoded = S.encodedSchema(DistributionInspect);
export type DistributionInspectEncoded = S.Schema.Encoded<typeof DistributionInspect>;

View File

@@ -0,0 +1,13 @@
import { pipe, Option, Schema as S } from 'effect';
/** Driver represents a driver (network, logging, secrets). */
export const Driver = S.Struct({
/** Name of the driver. */
Name: S.String,
/** Key/value map of driver-specific options. */
Options: S.optional(S.Record({ key: S.String, value: S.String })),
});
export type Driver = S.Schema.Type<typeof Driver>;
export const DriverEncoded = S.encodedSchema(Driver);
export type DriverEncoded = S.Schema.Encoded<typeof Driver>;

View File

@@ -0,0 +1,18 @@
import { pipe, Option, Schema as S } from 'effect';
/** Information about the storage driver used to store the container's and image's filesystem. */
export const DriverData = S.Struct({
/** Name of the storage driver. */
Name: S.String,
/**
* Low-level storage metadata, provided as key/value pairs.
*
* This information is driver-specific, and depends on the storage-driver in use, and should be
* used for informational purposes only.
*/
Data: S.Record({ key: S.String, value: S.String }),
});
export type DriverData = S.Schema.Type<typeof DriverData>;
export const DriverDataEncoded = S.encodedSchema(DriverData);
export type DriverDataEncoded = S.Schema.Encoded<typeof DriverData>;

View File

@@ -0,0 +1,12 @@
import { pipe, Option, Schema as S } from 'effect';
/** EndpointIPAMConfig represents an endpoint's IPAM configuration. */
export const EndpointIPAMConfig = S.Struct({
IPv4Address: S.optional(S.String),
IPv6Address: S.optional(S.String),
LinkLocalIPs: S.optional(S.Array(S.String)),
});
export type EndpointIPAMConfig = S.Schema.Type<typeof EndpointIPAMConfig>;
export const EndpointIPAMConfigEncoded = S.encodedSchema(EndpointIPAMConfig);
export type EndpointIPAMConfigEncoded = S.Schema.Encoded<typeof EndpointIPAMConfig>;

View File

@@ -0,0 +1,25 @@
import { pipe, Option, Schema as S } from 'effect';
export const EndpointPortConfig = S.Struct({
Name: S.optional(S.String),
Protocol: S.optional(S.Literal('tcp', 'udp', 'sctp')),
/** The port inside the container. */
TargetPort: S.optional(pipe(S.Number, S.int())),
/** The port on the swarm hosts. */
PublishedPort: S.optional(pipe(S.Number, S.int())),
/**
* The mode in which port is published. <p><br /></p>
*
* - "ingress" makes the target port accessible on every node, regardless of whether there is a task
* for the service running on that node or not.
* - "host" bypasses the routing mesh and publish the port directly on the swarm node where that
* service is running.
*/
PublishMode: S.optionalWith(S.Literal('ingress', 'host'), {
default: () => 'ingress',
}),
});
export type EndpointPortConfig = S.Schema.Type<typeof EndpointPortConfig>;
export const EndpointPortConfigEncoded = S.encodedSchema(EndpointPortConfig);
export type EndpointPortConfigEncoded = S.Schema.Encoded<typeof EndpointPortConfig>;

View File

@@ -0,0 +1,14 @@
import { pipe, Option, Schema as S } from 'effect';
/** Contains network resources allocated and used for a container in a network. */
export const EndpointResource = S.Struct({
Name: S.optional(S.String),
EndpointID: S.optional(S.String),
MacAddress: S.optional(S.String),
IPv4Address: S.optional(S.String),
IPv6Address: S.optional(S.String),
});
export type EndpointResource = S.Schema.Type<typeof EndpointResource>;
export const EndpointResourceEncoded = S.encodedSchema(EndpointResource);
export type EndpointResourceEncoded = S.Schema.Encoded<typeof EndpointResource>;

View File

@@ -0,0 +1,54 @@
import { pipe, Option, Schema as S } from 'effect';
import { EndpointIPAMConfig } from './EndpointIPAMConfig.ts';
/** Configuration for a network endpoint. */
export const EndpointSettings = S.Struct({
IPAMConfig: S.optional(EndpointIPAMConfig),
Links: S.optional(S.Array(S.String)),
/** MAC address for the endpoint on this network. The network driver might ignore this parameter. */
MacAddress: S.optional(S.String),
Aliases: S.optional(S.Array(S.String)),
/**
* DriverOpts is a mapping of driver options and values. These options are passed directly to the
* driver and are driver specific.
*/
DriverOpts: S.optional(S.Record({ key: S.String, value: S.String })),
/**
* This property determines which endpoint will provide the default gateway for a container. The
* endpoint with the highest priority will be used. If multiple endpoints have the same priority,
* endpoints are lexicographically sorted based on their network name, and the one that sorts
* first is picked.
*/
GwPriority: S.optional(pipe(S.Number, S.int())),
/** Unique ID of the network. */
NetworkID: S.optional(S.String),
/** Unique ID for the service endpoint in a Sandbox. */
EndpointID: S.optional(S.String),
/** Gateway address for this network. */
Gateway: S.optional(S.String),
/** IPv4 address. */
IPAddress: S.optional(S.String),
/** Mask length of the IPv4 address. */
IPPrefixLen: S.optional(pipe(S.Number, S.int())),
/** IPv6 gateway address. */
IPv6Gateway: S.optional(S.String),
/** Global IPv6 address. */
GlobalIPv6Address: S.optional(S.String),
/** Mask length of the global IPv6 address. */
GlobalIPv6PrefixLen: S.optional(pipe(S.Number, S.int())),
/**
* List of all DNS names an endpoint has on a specific network. This list is based on the
* container name, network aliases, container short ID, and hostname.
*
* These DNS names are non-fully qualified but can contain several dots. You can get fully
* qualified DNS names by appending `.<network-name>`. For instance, if container name is `my.ctr`
* and the network is named `testnet`, `DNSNames` will contain `my.ctr` and the FQDN will be
* `my.ctr.testnet`.
*/
DNSNames: S.optional(S.Array(S.String)),
});
export type EndpointSettings = S.Schema.Type<typeof EndpointSettings>;
export const EndpointSettingsEncoded = S.encodedSchema(EndpointSettings);
export type EndpointSettingsEncoded = S.Schema.Encoded<typeof EndpointSettings>;

View File

@@ -0,0 +1,20 @@
import { pipe, Option, Schema as S } from 'effect';
import { EndpointPortConfig } from './EndpointPortConfig.ts';
/** Properties that can be configured to access and load balance a service. */
export const EndpointSpec = S.Struct({
/** The mode of resolution to use for internal load balancing between tasks. */
Mode: S.optionalWith(S.Literal('vip', 'dnsrr'), {
default: () => 'vip',
}),
/**
* List of exposed ports that this service is accessible on from the outside. Ports can only be
* provided if `vip` resolution mode is used.
*/
Ports: S.optional(S.Array(EndpointPortConfig)),
});
export type EndpointSpec = S.Schema.Type<typeof EndpointSpec>;
export const EndpointSpecEncoded = S.encodedSchema(EndpointSpec);
export type EndpointSpecEncoded = S.Schema.Encoded<typeof EndpointSpec>;

View File

@@ -0,0 +1,19 @@
import { pipe, Option, Schema as S } from 'effect';
/** EngineDescription provides information about an engine. */
export const EngineDescription = S.Struct({
EngineVersion: S.optional(S.String),
Labels: S.optional(S.Record({ key: S.String, value: S.String })),
Plugins: S.optional(
S.Array(
S.Struct({
Type: S.optional(S.String),
Name: S.optional(S.String),
}),
),
),
});
export type EngineDescription = S.Schema.Type<typeof EngineDescription>;
export const EngineDescriptionEncoded = S.encodedSchema(EngineDescription);
export type EngineDescriptionEncoded = S.Schema.Encoded<typeof EngineDescription>;

View File

@@ -0,0 +1,10 @@
import { pipe, Option, Schema as S } from 'effect';
export const ErrorDetail = S.Struct({
code: S.optional(pipe(S.Number, S.int())),
message: S.optional(S.String),
});
export type ErrorDetail = S.Schema.Type<typeof ErrorDetail>;
export const ErrorDetailEncoded = S.encodedSchema(ErrorDetail);
export type ErrorDetailEncoded = S.Schema.Encoded<typeof ErrorDetail>;

View File

@@ -0,0 +1,11 @@
import { pipe, Option, Schema as S } from 'effect';
/** Represents an error. */
export const ErrorResponse = S.Struct({
/** The error message. */
message: S.String,
});
export type ErrorResponse = S.Schema.Type<typeof ErrorResponse>;
export const ErrorResponseEncoded = S.encodedSchema(ErrorResponse);
export type ErrorResponseEncoded = S.Schema.Encoded<typeof ErrorResponse>;

View File

@@ -0,0 +1,13 @@
import { pipe, Option, Schema as S } from 'effect';
/** Actor describes something that generates events, like a container, network, or a volume. */
export const EventActor = S.Struct({
/** The ID of the object emitting the event */
ID: S.optional(S.String),
/** Various key/value attributes of the object, depending on its type. */
Attributes: S.optional(S.Record({ key: S.String, value: S.String })),
});
export type EventActor = S.Schema.Type<typeof EventActor>;
export const EventActorEncoded = S.encodedSchema(EventActor);
export type EventActorEncoded = S.Schema.Encoded<typeof EventActor>;

View File

@@ -0,0 +1,36 @@
import { pipe, Option, Schema as S } from 'effect';
import { EventActor } from './EventActor.ts';
/** EventMessage represents the information an event contains. */
export const EventMessage = S.Struct({
/** The type of object emitting the event */
Type: S.optional(
S.Literal(
'builder',
'config',
'container',
'daemon',
'image',
'network',
'node',
'plugin',
'secret',
'service',
'volume',
),
),
/** The type of event */
Action: S.optional(S.String),
Actor: S.optional(EventActor),
/** Scope of the event. Engine events are `local` scope. Cluster (Swarm) events are `swarm` scope. */
scope: S.optional(S.Literal('local', 'swarm')),
/** Timestamp of event */
time: S.optional(pipe(S.Number, S.int())),
/** Timestamp of event, with nanosecond accuracy */
timeNano: S.optional(pipe(S.Number, S.int())),
}); // SystemEventsResponse
export type EventMessage = S.Schema.Type<typeof EventMessage>;
export const EventMessageEncoded = S.encodedSchema(EventMessage);
export type EventMessageEncoded = S.Schema.Encoded<typeof EventMessage>;

View File

@@ -0,0 +1,14 @@
import { pipe, Option, Schema as S } from 'effect';
import { ChangeType } from './ChangeType.ts';
/** Change in the container's filesystem. */
export const FilesystemChange = S.Struct({
/** Path to file or directory that has changed. */
Path: S.String,
Kind: ChangeType,
});
export type FilesystemChange = S.Schema.Type<typeof FilesystemChange>;
export const FilesystemChangeEncoded = S.encodedSchema(FilesystemChange);
export type FilesystemChangeEncoded = S.Schema.Encoded<typeof FilesystemChange>;

View File

@@ -0,0 +1,22 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* Information about the daemon's firewalling configuration.
*
* This field is currently only used on Linux, and omitted on other platforms.
*/
export const FirewallInfo = S.Struct({
/** The name of the firewall backend driver. */
Driver: S.optional(S.String),
/**
* Information about the firewall backend, provided as "label" / "value" pairs. <p><br /></p>
*
* > **Note**: The information returned in this field, including the formatting of values and
* > labels, should not be considered stable, and may change without notice.
*/
Info: S.optional(S.Array(S.Array(S.String))),
});
export type FirewallInfo = S.Schema.Type<typeof FirewallInfo>;
export const FirewallInfoEncoded = S.encodedSchema(FirewallInfo);
export type FirewallInfoEncoded = S.Schema.Encoded<typeof FirewallInfo>;

View File

@@ -0,0 +1,26 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* User-defined resources can be either Integer resources (e.g, `SSD=3`) or String resources (e.g,
* `GPU=UUID1`).
*/
export const GenericResources = S.Array(
S.Struct({
NamedResourceSpec: S.optional(
S.Struct({
Kind: S.optional(S.String),
Value: S.optional(S.String),
}),
),
DiscreteResourceSpec: S.optional(
S.Struct({
Kind: S.optional(S.String),
Value: S.optional(pipe(S.Number, S.int())),
}),
),
}),
);
export type GenericResources = S.Schema.Type<typeof GenericResources>;
export const GenericResourcesEncoded = S.encodedSchema(GenericResources);
export type GenericResourcesEncoded = S.Schema.Encoded<typeof GenericResources>;

View File

@@ -0,0 +1,24 @@
import { pipe, Option, Schema as S } from 'effect';
import { HealthcheckResult } from './HealthcheckResult.ts';
/** Health stores information about the container's healthcheck results. */
export const Health = S.Struct({
/**
* Status is one of `none`, `starting`, `healthy` or `unhealthy`
*
* - "none" Indicates there is no healthcheck
* - "starting" Starting indicates that the container is not yet ready
* - "healthy" Healthy indicates that the container is running correctly
* - "unhealthy" Unhealthy indicates that the container has a problem
*/
Status: S.optional(S.Literal('none', 'starting', 'healthy', 'unhealthy')),
/** FailingStreak is the number of consecutive failures */
FailingStreak: S.optional(pipe(S.Number, S.int())),
/** Log contains the last few results (oldest first) */
Log: S.optional(S.Array(HealthcheckResult)),
});
export type Health = S.Schema.Type<typeof Health>;
export const HealthEncoded = S.encodedSchema(Health);
export type HealthEncoded = S.Schema.Encoded<typeof Health>;

View File

@@ -0,0 +1,56 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* A test to perform to check that the container is healthy. Healthcheck commands should be
* side-effect free.
*/
export const HealthConfig = S.Struct({
/**
* The test to perform. Possible values are:
*
* - `[]` inherit healthcheck from image or parent image
* - `["NONE"]` disable healthcheck
* - `["CMD", args...]` exec arguments directly
* - `["CMD-SHELL", command]` run command with system's default shell
*
* A non-zero exit code indicates a failed healthcheck:
*
* - `0` healthy
* - `1` unhealthy
* - `2` reserved (treated as unhealthy)
* - Other values: error running probe
*/
Test: S.optional(S.Array(S.String)),
/**
* The time to wait between checks in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0
* means inherit.
*/
Interval: S.optional(pipe(S.Number, S.int())),
/**
* The time to wait before considering the check to have hung. It should be 0 or at least 1000000
* (1 ms). 0 means inherit.
*
* If the health check command does not complete within this timeout, the check is considered
* failed and the health check process is forcibly terminated without a graceful shutdown.
*/
Timeout: S.optional(pipe(S.Number, S.int())),
/**
* The number of consecutive failures needed to consider a container as unhealthy. 0 means
* inherit.
*/
Retries: S.optional(pipe(S.Number, S.int())),
/**
* Start period for the container to initialize before starting health-retries countdown in
* nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
*/
StartPeriod: S.optional(pipe(S.Number, S.int())),
/**
* The time to wait between checks in nanoseconds during the start period. It should be 0 or at
* least 1000000 (1 ms). 0 means inherit.
*/
StartInterval: S.optional(pipe(S.Number, S.int())),
});
export type HealthConfig = S.Schema.Type<typeof HealthConfig>;
export const HealthConfigEncoded = S.encodedSchema(HealthConfig);
export type HealthConfigEncoded = S.Schema.Encoded<typeof HealthConfig>;

View File

@@ -0,0 +1,30 @@
import { pipe, Option, Schema as S } from 'effect';
/** HealthcheckResult stores information about a single run of a healthcheck probe */
export const HealthcheckResult = S.Struct({
/**
* Date and time at which this check started in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt)
* format with nano-seconds.
*/
Start: S.optional(S.Date),
/**
* Date and time at which this check ended in [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt)
* format with nano-seconds.
*/
End: S.optional(S.String),
/**
* ExitCode meanings:
*
* - `0` healthy
* - `1` unhealthy
* - `2` reserved (considered unhealthy)
* - Other values: error running probe
*/
ExitCode: S.optional(pipe(S.Number, S.int())),
/** Output from last check */
Output: S.optional(S.String),
});
export type HealthcheckResult = S.Schema.Type<typeof HealthcheckResult>;
export const HealthcheckResultEncoded = S.encodedSchema(HealthcheckResult);
export type HealthcheckResultEncoded = S.Schema.Encoded<typeof HealthcheckResult>;

View File

@@ -0,0 +1,11 @@
import { pipe, Option, Schema as S } from 'effect';
/** Response to an API call that returns just an Id */
export const IDResponse = S.Struct({
/** The id of the newly created object. */
Id: S.String,
});
export type IDResponse = S.Schema.Type<typeof IDResponse>;
export const IDResponseEncoded = S.encodedSchema(IDResponse);
export type IDResponseEncoded = S.Schema.Encoded<typeof IDResponse>;

View File

@@ -0,0 +1,22 @@
import { pipe, Option, Schema as S } from 'effect';
import { IPAMConfig } from './IPAMConfig.ts';
export const IPAM = S.Struct({
/** Name of the IPAM driver to use. */
Driver: S.optionalWith(S.String, {
default: () => 'default',
}),
/**
* List of IPAM configuration options, specified as a map:
*
* {"Subnet": <CIDR>, "IPRange": <CIDR>, "Gateway": <IP address>, "AuxAddress": <device_name:IP address>}
*/
Config: S.optional(S.Array(IPAMConfig)),
/** Driver-specific options, specified as a map. */
Options: S.optional(S.Record({ key: S.String, value: S.String })),
});
export type IPAM = S.Schema.Type<typeof IPAM>;
export const IPAMEncoded = S.encodedSchema(IPAM);
export type IPAMEncoded = S.Schema.Encoded<typeof IPAM>;

View File

@@ -0,0 +1,12 @@
import { pipe, Option, Schema as S } from 'effect';
export const IPAMConfig = S.Struct({
Subnet: S.optional(S.String),
IPRange: S.optional(S.String),
Gateway: S.optional(S.String),
AuxiliaryAddresses: S.optional(S.Record({ key: S.String, value: S.String })),
});
export type IPAMConfig = S.Schema.Type<typeof IPAMConfig>;
export const IPAMConfigEncoded = S.encodedSchema(IPAMConfig);
export type IPAMConfigEncoded = S.Schema.Encoded<typeof IPAMConfig>;

View File

@@ -0,0 +1,11 @@
import { pipe, Option, Schema as S } from 'effect';
import { SubnetStatus } from './SubnetStatus.ts';
export const IPAMStatus = S.Struct({
Subnets: S.optional(S.Record({ key: S.String, value: SubnetStatus })),
});
export type IPAMStatus = S.Schema.Type<typeof IPAMStatus>;
export const IPAMStatusEncoded = S.encodedSchema(IPAMStatus);
export type IPAMStatusEncoded = S.Schema.Encoded<typeof IPAMStatus>;

View File

@@ -0,0 +1,27 @@
import { pipe, Option, Schema as S } from 'effect';
import { SignatureIdentity } from './SignatureIdentity.ts';
import { PullIdentity } from './PullIdentity.ts';
import { BuildIdentity } from './BuildIdentity.ts';
/**
* Identity holds information about the identity and origin of the image. This is trusted
* information verified by the daemon and cannot be modified by tagging an image to a different
* name.
*/
export const Identity = S.Struct({
/** Signature contains the properties of verified signatures for the image. */
Signature: S.optional(S.Array(SignatureIdentity)),
/**
* Pull contains remote location information if image was created via pull. If image was pulled
* via mirror, this contains the original repository location. After successful push this images
* also contains the pushed repository location.
*/
Pull: S.optional(S.Array(PullIdentity)),
/** Build contains build reference information if image was created via build. */
Build: S.optional(S.Array(BuildIdentity)),
});
export type Identity = S.Schema.Type<typeof Identity>;
export const IdentityEncoded = S.encodedSchema(Identity);
export type IdentityEncoded = S.Schema.Encoded<typeof Identity>;

View File

@@ -0,0 +1,54 @@
import { pipe, Option, Schema as S } from 'effect';
import { HealthConfig } from './HealthConfig.ts';
/**
* Configuration of the image. These fields are used as defaults when starting a container from the
* image.
*/
export const ImageConfig = S.Struct({
/** The user that commands are run as inside the container. */
User: S.optional(S.String),
/**
* An object mapping ports to an empty object in the form:
*
* `{"<port>/<tcp|udp|sctp>": {}}`
*/
ExposedPorts: S.optional(S.Record({ key: S.String, value: S.Struct({}) })),
/**
* A list of environment variables to set inside the container in the form `["VAR=value", ...]`. A
* variable without `=` is removed from the environment, rather than to have an empty value.
*/
Env: S.optional(S.Array(S.String)),
/** Command to run specified as a string or an array of strings. */
Cmd: S.optional(S.Array(S.String)),
Healthcheck: S.optional(HealthConfig),
/** Command is already escaped (Windows only) */
ArgsEscaped: S.optionalWith(S.Boolean, {
default: () => false,
}),
/** An object mapping mount point paths inside the container to empty objects. */
Volumes: S.optional(S.Record({ key: S.String, value: S.Struct({}) })),
/** The working directory for commands to run in. */
WorkingDir: S.optional(S.String),
/**
* The entry point for the container as a string or an array of strings.
*
* If the array consists of exactly one empty string (`[""]`) then the entry point is reset to
* system default (i.e., the entry point used by docker when there is no `ENTRYPOINT` instruction
* in the `Dockerfile`).
*/
Entrypoint: S.optional(S.Array(S.String)),
/** `ONBUILD` metadata that were defined in the image's `Dockerfile`. */
OnBuild: S.optional(S.Array(S.String)),
/** User-defined key/value metadata. */
Labels: S.optional(S.Record({ key: S.String, value: S.String })),
/** Signal to stop a container as a string or unsigned integer. */
StopSignal: S.optional(S.String),
/** Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell. */
Shell: S.optional(S.Array(S.String)),
});
export type ImageConfig = S.Schema.Type<typeof ImageConfig>;
export const ImageConfigEncoded = S.encodedSchema(ImageConfig);
export type ImageConfigEncoded = S.Schema.Encoded<typeof ImageConfig>;

View File

@@ -0,0 +1,12 @@
import { pipe, Option, Schema as S } from 'effect';
export const ImageDeleteResponseItem = S.Struct({
/** The image ID of an image that was untagged */
Untagged: S.optional(S.String),
/** The image ID of an image that was deleted */
Deleted: S.optional(S.String),
});
export type ImageDeleteResponseItem = S.Schema.Type<typeof ImageDeleteResponseItem>;
export const ImageDeleteResponseItemEncoded = S.encodedSchema(ImageDeleteResponseItem);
export type ImageDeleteResponseItemEncoded = S.Schema.Encoded<typeof ImageDeleteResponseItem>;

View File

@@ -0,0 +1,15 @@
import { pipe, Option, Schema as S } from 'effect';
/** Individual image layer information in response to ImageHistory operation */
export const ImageHistoryResponseItem = S.Struct({
Id: S.String,
Created: pipe(S.Number, S.int()),
CreatedBy: S.String,
Tags: S.Array(S.String),
Size: pipe(S.Number, S.int()),
Comment: S.String,
}); // HistoryResponseItem
export type ImageHistoryResponseItem = S.Schema.Type<typeof ImageHistoryResponseItem>;
export const ImageHistoryResponseItemEncoded = S.encodedSchema(ImageHistoryResponseItem);
export type ImageHistoryResponseItemEncoded = S.Schema.Encoded<typeof ImageHistoryResponseItem>;

View File

@@ -0,0 +1,10 @@
import { pipe, Option, Schema as S } from 'effect';
/** Image ID or Digest */
export const ImageID = S.Struct({
ID: S.optional(S.String),
});
export type ImageID = S.Schema.Type<typeof ImageID>;
export const ImageIDEncoded = S.encodedSchema(ImageID);
export type ImageIDEncoded = S.Schema.Encoded<typeof ImageID>;

View File

@@ -0,0 +1,104 @@
import { pipe, Option, Schema as S } from 'effect';
import { OCIDescriptor } from './OCIDescriptor.ts';
import { ImageManifestSummary } from './ImageManifestSummary.ts';
import { Identity } from './Identity.ts';
import { ImageConfig } from './ImageConfig.ts';
import { DriverData } from './DriverData.ts';
/** Information about an image in the local image cache. */
export const ImageInspect = S.Struct({
/**
* ID is the content-addressable ID of an image.
*
* This identifier is a content-addressable digest calculated from the image's configuration
* (which includes the digests of layers used by the image).
*
* Note that this digest differs from the `RepoDigests` below, which holds digests of image
* manifests that reference the image.
*/
Id: S.optional(S.String),
Descriptor: S.optional(OCIDescriptor),
/**
* Manifests is a list of image manifests available in this image. It provides a more detailed
* view of the platform-specific image manifests or other image-attached data like build
* attestations.
*
* Only available if the daemon provides a multi-platform image store and the `manifests` option
* is set in the inspect request.
*
* WARNING: This is experimental and may change at any time without any backward compatibility.
*/
Manifests: S.optional(S.Array(ImageManifestSummary)),
Identity: S.optional(Identity),
/**
* List of image names/tags in the local image cache that reference this image.
*
* Multiple image tags can refer to the same image, and this list may be empty if no tags
* reference the image, in which case the image is "untagged", in which case it can still be
* referenced by its ID.
*/
RepoTags: S.optional(S.Array(S.String)),
/**
* List of content-addressable digests of locally available image manifests that the image is
* referenced from. Multiple manifests can refer to the same image.
*
* These digests are usually only available if the image was either pulled from a registry, or if
* the image was pushed to a registry, which is when the manifest is generated and its digest
* calculated.
*/
RepoDigests: S.optional(S.Array(S.String)),
/** Optional message that was set when committing or importing the image. */
Comment: S.optional(S.String),
/**
* Date and time at which the image was created, formatted in [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
*
* This information is only available if present in the image, and omitted otherwise.
*/
Created: S.optional(S.String),
/**
* Name of the author that was specified when committing the image, or as specified through
* MAINTAINER (deprecated) in the Dockerfile.
*/
Author: S.optional(S.String),
Config: S.optional(ImageConfig),
/** Hardware CPU architecture that the image runs on. */
Architecture: S.optional(S.String),
/** CPU architecture variant (presently ARM-only). */
Variant: S.optional(S.String),
/** Operating System the image is built to run on. */
Os: S.optional(S.String),
/** Operating System version the image is built to run on (especially for Windows). */
OsVersion: S.optional(S.String),
/** Total size of the image including all layers it is composed of. */
Size: S.optional(pipe(S.Number, S.int())),
GraphDriver: S.optional(DriverData),
/** Information about the image's RootFS, including the layer IDs. */
RootFS: S.optional(
S.Struct({
Type: S.String,
Layers: S.optional(S.Array(S.String)),
}),
),
/**
* Additional metadata of the image in the local cache. This information is local to the daemon,
* and not part of the image itself.
*/
Metadata: S.optional(
S.Struct({
/**
* Date and time at which the image was last tagged in [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
*
* This information is only available if the image was tagged locally,
* and omitted otherwise.
*/
LastTagTime: S.optional(S.String),
}),
),
});
export type ImageInspect = S.Schema.Type<typeof ImageInspect>;
export const ImageInspectEncoded = S.encodedSchema(ImageInspect);
export type ImageInspectEncoded = S.Schema.Encoded<typeof ImageInspect>;

View File

@@ -0,0 +1,71 @@
import { pipe, Option, Schema as S } from 'effect';
import { OCIDescriptor } from './OCIDescriptor.ts';
import { OCIPlatform } from './OCIPlatform.ts';
/** ImageManifestSummary represents a summary of an image manifest. */
export const ImageManifestSummary = S.Struct({
/**
* ID is the content-addressable ID of an image and is the same as the digest of the image
* manifest.
*/
ID: S.String,
Descriptor: OCIDescriptor,
/** Indicates whether all the child content (image config, layers) is fully available locally. */
Available: S.Boolean,
Size: S.Struct({
/**
* Total is the total size (in bytes) of all the locally present data (both distributable and
* non-distributable) that's related to this manifest and its children. This equal to the sum of
* [Content] size AND all the sizes in the [Size] struct present in the Kind-specific data
* struct. For example, for an image kind (Kind == "image") this would include the size of the
* image content and unpacked image snapshots ([Size.Content] + [ImageData.Size.Unpacked]).
*/
Total: pipe(S.Number, S.int()),
/**
* Content is the size (in bytes) of all the locally present content in the content store (e.g.
* image config, layers) referenced by this manifest and its children. This only includes blobs
* in the content store.
*/
Content: pipe(S.Number, S.int()),
}),
/**
* The kind of the manifest.
*
* Kind | description -------------|-----------------------------------------------------------
* image | Image manifest that can be used to start a container. attestation | Attestation
* manifest produced by the Buildkit builder for a specific image manifest.
*/
Kind: S.Literal('image', 'attestation', 'unknown'),
/** The image data for the image manifest. This field is only populated when Kind is "image". */
ImageData: S.optional(
S.Struct({
Platform: OCIPlatform,
/** The IDs of the containers that are using this image. */
Containers: S.Array(S.String),
Size: S.Struct({
/**
* Unpacked is the size (in bytes) of the locally unpacked (uncompressed) image content that's
* directly usable by the containers running this image. It's independent of the distributable
* content - e.g. the image might still have an unpacked data that's still used by some
* container even when the distributable/compressed content is already gone.
*/
Unpacked: pipe(S.Number, S.int()),
}),
}),
),
/**
* The image data for the attestation manifest. This field is only populated when Kind is
* "attestation".
*/
AttestationData: S.optional(
S.Struct({
/** The digest of the image manifest that this attestation is for. */
For: S.String,
}),
),
});
export type ImageManifestSummary = S.Schema.Type<typeof ImageManifestSummary>;
export const ImageManifestSummaryEncoded = S.encodedSchema(ImageManifestSummary);
export type ImageManifestSummaryEncoded = S.Schema.Encoded<typeof ImageManifestSummary>;

View File

@@ -0,0 +1,76 @@
import { pipe, Option, Schema as S } from 'effect';
import { ImageManifestSummary } from './ImageManifestSummary.ts';
import { OCIDescriptor } from './OCIDescriptor.ts';
export const ImageSummary = S.Struct({
/**
* ID is the content-addressable ID of an image.
*
* This identifier is a content-addressable digest calculated from the image's configuration
* (which includes the digests of layers used by the image).
*
* Note that this digest differs from the `RepoDigests` below, which holds digests of image
* manifests that reference the image.
*/
Id: S.String,
/**
* ID of the parent image.
*
* Depending on how the image was created, this field may be empty and is only set for images that
* were built/created locally. This field is empty if the image was pulled from an image
* registry.
*/
ParentId: S.String,
/**
* List of image names/tags in the local image cache that reference this image.
*
* Multiple image tags can refer to the same image, and this list may be empty if no tags
* reference the image, in which case the image is "untagged", in which case it can still be
* referenced by its ID.
*/
RepoTags: S.Array(S.String),
/**
* List of content-addressable digests of locally available image manifests that the image is
* referenced from. Multiple manifests can refer to the same image.
*
* These digests are usually only available if the image was either pulled from a registry, or if
* the image was pushed to a registry, which is when the manifest is generated and its digest
* calculated.
*/
RepoDigests: S.Array(S.String),
/**
* Date and time at which the image was created as a Unix timestamp (number of seconds since
* EPOCH).
*/
Created: pipe(S.Number, S.int()),
/** Total size of the image including all layers it is composed of. */
Size: pipe(S.Number, S.int()),
/**
* Total size of image layers that are shared between this image and other images.
*
* This size is not calculated by default. `-1` indicates that the value has not been set /
* calculated.
*/
SharedSize: pipe(S.Number, S.int()),
/** User-defined key/value metadata. */
Labels: S.Record({ key: S.String, value: S.String }),
/**
* Number of containers using this image. Includes both stopped and running containers.
*
* `-1` indicates that the value has not been set / calculated.
*/
Containers: pipe(S.Number, S.int()),
/**
* Manifests is a list of manifests available in this image. It provides a more detailed view of
* the platform-specific image manifests or other image-attached data like build attestations.
*
* WARNING: This is experimental and may change at any time without any backward compatibility.
*/
Manifests: S.optional(S.Array(ImageManifestSummary)),
Descriptor: S.optional(OCIDescriptor),
});
export type ImageSummary = S.Schema.Type<typeof ImageSummary>;
export const ImageSummaryEncoded = S.encodedSchema(ImageSummary);
export type ImageSummaryEncoded = S.Schema.Encoded<typeof ImageSummary>;

View File

@@ -0,0 +1,19 @@
import { pipe, Option, Schema as S } from 'effect';
/** Represents system data usage for image resources. */
export const ImagesDiskUsage = S.Struct({
/** Count of active images. */
ActiveCount: S.optional(pipe(S.Number, S.int())),
/** Count of all images. */
TotalCount: S.optional(pipe(S.Number, S.int())),
/** Disk space that can be reclaimed by removing unused images. */
Reclaimable: S.optional(pipe(S.Number, S.int())),
/** Disk space in use by images. */
TotalSize: S.optional(pipe(S.Number, S.int())),
/** List of image summaries. */
Items: S.optional(S.Array(S.Struct({}))),
});
export type ImagesDiskUsage = S.Schema.Type<typeof ImagesDiskUsage>;
export const ImagesDiskUsageEncoded = S.encodedSchema(ImagesDiskUsage);
export type ImagesDiskUsageEncoded = S.Schema.Encoded<typeof ImagesDiskUsage>;

View File

@@ -0,0 +1,27 @@
import { pipe, Option, Schema as S } from 'effect';
/** IndexInfo contains information about a registry. */
export const IndexInfo = S.Struct({
/** Name of the registry, such as "docker.io". */
Name: S.optional(S.String),
/** List of mirrors, expressed as URIs. */
Mirrors: S.optional(S.Array(S.String)),
/**
* Indicates if the registry is part of the list of insecure registries.
*
* If `false`, the registry is insecure. Insecure registries accept un-encrypted (HTTP) and/or
* untrusted (HTTPS with certificates from unknown CAs) communication.
*
* > **Warning**: Insecure registries can be useful when running a local registry. However, because
* > its use creates security vulnerabilities it should ONLY be enabled for testing purposes. For
* > increased security, users should add their CA to their system's list of trusted CAs instead of
* > enabling this option.
*/
Secure: S.optional(S.Boolean),
/** Indicates whether this is an official registry (i.e., Docker Hub / docker.io) */
Official: S.optional(S.Boolean),
});
export type IndexInfo = S.Schema.Type<typeof IndexInfo>;
export const IndexInfoEncoded = S.encodedSchema(IndexInfo);
export type IndexInfoEncoded = S.Schema.Encoded<typeof IndexInfo>;

View File

@@ -0,0 +1,13 @@
import { pipe, Option, Schema as S } from 'effect';
/** JoinTokens contains the tokens workers and managers need to join the swarm. */
export const JoinTokens = S.Struct({
/** The token workers can use to join the swarm. */
Worker: S.optional(S.String),
/** The token managers can use to join the swarm. */
Manager: S.optional(S.String),
});
export type JoinTokens = S.Schema.Type<typeof JoinTokens>;
export const JoinTokensEncoded = S.encodedSchema(JoinTokens);
export type JoinTokensEncoded = S.Schema.Encoded<typeof JoinTokens>;

View File

@@ -0,0 +1,11 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* KnownSignerIdentity is an identifier for a special signer identity that is known to the
* implementation.
*/
export const KnownSignerIdentity = S.Literal('DHI');
export type KnownSignerIdentity = S.Schema.Type<typeof KnownSignerIdentity>;
export const KnownSignerIdentityEncoded = S.encodedSchema(KnownSignerIdentity);
export type KnownSignerIdentityEncoded = S.Schema.Encoded<typeof KnownSignerIdentity>;

View File

@@ -0,0 +1,15 @@
import { pipe, Option, Schema as S } from 'effect';
/** An object describing a limit on resources which can be requested by a task. */
export const Limit = S.Struct({
NanoCPUs: S.optional(pipe(S.Number, S.int())),
MemoryBytes: S.optional(pipe(S.Number, S.int())),
/** Limits the maximum number of PIDs in the container. Set `0` for unlimited. */
Pids: S.optionalWith(pipe(S.Number, S.int()), {
default: () => 0,
}),
});
export type Limit = S.Schema.Type<typeof Limit>;
export const LimitEncoded = S.encodedSchema(Limit);
export type LimitEncoded = S.Schema.Encoded<typeof Limit>;

View File

@@ -0,0 +1,8 @@
import { pipe, Option, Schema as S } from 'effect';
/** Current local status of this node. */
export const LocalNodeState = S.Literal('', 'inactive', 'pending', 'active', 'error', 'locked');
export type LocalNodeState = S.Schema.Type<typeof LocalNodeState>;
export const LocalNodeStateEncoded = S.encodedSchema(LocalNodeState);
export type LocalNodeStateEncoded = S.Schema.Encoded<typeof LocalNodeState>;

View File

@@ -0,0 +1,21 @@
import { pipe, Option, Schema as S } from 'effect';
import { Reachability } from './Reachability.ts';
/**
* ManagerStatus represents the status of a manager.
*
* It provides the current status of a node's manager component, if the node is a manager.
*/
export const ManagerStatus = S.Struct({
Leader: S.optionalWith(S.Boolean, {
default: () => false,
}),
Reachability: S.optional(Reachability),
/** The IP address and port at which the manager is reachable. */
Addr: S.optional(S.String),
});
export type ManagerStatus = S.Schema.Type<typeof ManagerStatus>;
export const ManagerStatusEncoded = S.encodedSchema(ManagerStatus);
export type ManagerStatusEncoded = S.Schema.Encoded<typeof ManagerStatus>;

View File

@@ -0,0 +1,104 @@
import { pipe, Option, Schema as S } from 'effect';
import { MountType } from './MountType.ts';
export const Mount = S.Struct({
/** Container path. */
Target: S.optional(S.String),
/**
* Mount source (e.g. a volume name, a host path). The source cannot be specified when using
* `Type=tmpfs`. For `Type=bind`, the source path must either exist, or the `CreateMountpoint`
* must be set to `true` to create the source path on the host if missing.
*
* For `Type=npipe`, the pipe must exist prior to creating the container.
*/
Source: S.optional(S.String),
Type: S.optional(MountType),
/** Whether the mount should be read-only. */
ReadOnly: S.optional(S.Boolean),
/** The consistency requirement for the mount: `default`, `consistent`, `cached`, or `delegated`. */
Consistency: S.optional(S.String),
/** Optional configuration for the `bind` type. */
BindOptions: S.optional(
S.Struct({
/** A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`. */
Propagation: S.optional(
S.Literal('private', 'rprivate', 'shared', 'rshared', 'slave', 'rslave'),
),
/** Disable recursive bind mount. */
NonRecursive: S.optionalWith(S.Boolean, {
default: () => false,
}),
/** Create mount point on host if missing */
CreateMountpoint: S.optionalWith(S.Boolean, {
default: () => false,
}),
/**
* Make the mount non-recursively read-only, but still leave the mount recursive (unless
* NonRecursive is set to `true` in conjunction).
*
* Added in v1.44, before that version all read-only mounts were
* non-recursive by default. To match the previous behaviour this
* will default to `true` for clients on versions prior to v1.44.
*/
ReadOnlyNonRecursive: S.optionalWith(S.Boolean, {
default: () => false,
}),
/** Raise an error if the mount cannot be made recursively read-only. */
ReadOnlyForceRecursive: S.optionalWith(S.Boolean, {
default: () => false,
}),
}),
),
/** Optional configuration for the `volume` type. */
VolumeOptions: S.optional(
S.Struct({
/** Populate volume with data from the target. */
NoCopy: S.optionalWith(S.Boolean, {
default: () => false,
}),
/** User-defined key/value metadata. */
Labels: S.optional(S.Record({ key: S.String, value: S.String })),
/** Map of driver specific options */
DriverConfig: S.optional(
S.Struct({
/** Name of the driver to use to create the volume. */
Name: S.optional(S.String),
/** Key/value map of driver specific options. */
Options: S.optional(S.Record({ key: S.String, value: S.String })),
}),
),
/** Source path inside the volume. Must be relative without any back traversals. */
Subpath: S.optional(S.String),
}),
),
/** Optional configuration for the `image` type. */
ImageOptions: S.optional(
S.Struct({
/** Source path inside the image. Must be relative without any back traversals. */
Subpath: S.optional(S.String),
}),
),
/** Optional configuration for the `tmpfs` type. */
TmpfsOptions: S.optional(
S.Struct({
/** The size for the tmpfs mount in bytes. */
SizeBytes: S.optional(pipe(S.Number, S.int())),
/**
* The permission mode for the tmpfs mount in an integer. The value must not be in octal format
* (e.g. 755) but rather the decimal representation of the octal value (e.g. 493).
*/
Mode: S.optional(pipe(S.Number, S.int())),
/**
* The options to be passed to the tmpfs mount. An array of arrays. Flag options should be
* provided as 1-length arrays. Other types should be provided as as 2-length arrays, where the
* first item is the key and the second the value.
*/
Options: S.optional(S.Array(S.Array(S.String))),
}),
),
});
export type Mount = S.Schema.Type<typeof Mount>;
export const MountEncoded = S.encodedSchema(Mount);
export type MountEncoded = S.Schema.Encoded<typeof Mount>;

View File

@@ -0,0 +1,48 @@
import { pipe, Option, Schema as S } from 'effect';
import { MountType } from './MountType.ts';
/**
* MountPoint represents a mount point configuration inside the container. This is used for
* reporting the mountpoints in use by a container.
*/
export const MountPoint = S.Struct({
Type: S.optional(MountType),
/** Name is the name reference to the underlying data defined by `Source` e.g., the volume name. */
Name: S.optional(S.String),
/**
* Source location of the mount.
*
* For volumes, this contains the storage location of the volume (within
* `/var/lib/docker/volumes/`). For bind-mounts, and `npipe`, this contains the source (host) part
* of the bind-mount. For `tmpfs` mount points, this field is empty.
*/
Source: S.optional(S.String),
/**
* Destination is the path relative to the container root (`/`) where the `Source` is mounted
* inside the container.
*/
Destination: S.optional(S.String),
/** Driver is the volume driver used to create the volume (if it is a volume). */
Driver: S.optional(S.String),
/**
* Mode is a comma separated list of options supplied by the user when creating the bind/volume
* mount.
*
* The default is platform-specific (`"z"` on Linux, empty on Windows).
*/
Mode: S.optional(S.String),
/** Whether the mount is mounted writable (read-write). */
RW: S.optional(S.Boolean),
/**
* Propagation describes how mounts are propagated from the host into the mount point, and
* vice-versa. Refer to the [Linux kernel
* documentation](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) for
* details. This field is not used on Windows.
*/
Propagation: S.optional(S.String),
});
export type MountPoint = S.Schema.Type<typeof MountPoint>;
export const MountPointEncoded = S.encodedSchema(MountPoint);
export type MountPointEncoded = S.Schema.Encoded<typeof MountPoint>;

View File

@@ -0,0 +1,17 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* The mount type. Available types:
*
* - `bind` a mount of a file or directory from the host into the container.
* - `cluster` a Swarm cluster volume.
* - `image` an OCI image.
* - `npipe` a named pipe from the host into the container.
* - `tmpfs` a `tmpfs`.
* - `volume` a docker volume with the given `Name`.
*/
export const MountType = S.Literal('bind', 'cluster', 'image', 'npipe', 'tmpfs', 'volume');
export type MountType = S.Schema.Type<typeof MountType>;
export const MountTypeEncoded = S.encodedSchema(MountType);
export type MountTypeEncoded = S.Schema.Encoded<typeof MountType>;

View File

@@ -0,0 +1,20 @@
import { pipe, Option, Schema as S } from 'effect';
/**
* Information about the Node Resource Interface (NRI).
*
* This field is only present if NRI is enabled.
*/
export const NRIInfo = S.Struct({
/**
* Information about NRI, provided as "label" / "value" pairs. <p><br /></p>
*
* > **Note**: The information returned in this field, including the formatting of values and
* > labels, should not be considered stable, and may change without notice.
*/
Info: S.optional(S.Array(S.Array(S.String))),
});
export type NRIInfo = S.Schema.Type<typeof NRIInfo>;
export const NRIInfoEncoded = S.encodedSchema(NRIInfo);
export type NRIInfoEncoded = S.Schema.Encoded<typeof NRIInfo>;

View File

@@ -0,0 +1,66 @@
import { pipe, Option, Schema as S } from 'effect';
import { IPAM } from './IPAM.ts';
import { ConfigReference } from './ConfigReference.ts';
import { PeerInfo } from './PeerInfo.ts';
export const Network = S.Struct({
/** Name of the network. */
Name: S.optional(S.String),
/** ID that uniquely identifies a network on a single machine. */
Id: S.optional(S.String),
/**
* Date and time at which the network was created in [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
*/
Created: S.optional(S.String),
/**
* The level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine
* level)
*/
Scope: S.optional(S.String),
/** The name of the driver used to create the network (e.g. `bridge`, `overlay`). */
Driver: S.optional(S.String),
/** Whether the network was created with IPv4 enabled. */
EnableIPv4: S.optional(S.Boolean),
/** Whether the network was created with IPv6 enabled. */
EnableIPv6: S.optional(S.Boolean),
IPAM: S.optional(IPAM),
/** Whether the network is created to only allow internal networking connectivity. */
Internal: S.optionalWith(S.Boolean, {
default: () => false,
}),
/**
* Whether a global / swarm scope network is manually attachable by regular containers from
* workers in swarm mode.
*/
Attachable: S.optionalWith(S.Boolean, {
default: () => false,
}),
/** Whether the network is providing the routing-mesh for the swarm cluster. */
Ingress: S.optionalWith(S.Boolean, {
default: () => false,
}),
ConfigFrom: S.optional(ConfigReference),
/**
* Whether the network is a config-only network. Config-only networks are placeholder networks for
* network configurations to be used by other networks. Config-only networks cannot be used
* directly to run containers or services.
*/
ConfigOnly: S.optionalWith(S.Boolean, {
default: () => false,
}),
/** Network-specific options uses when creating the network. */
Options: S.optional(S.Record({ key: S.String, value: S.String })),
/** Metadata specific to the network being created. */
Labels: S.optional(S.Record({ key: S.String, value: S.String })),
/**
* List of peer nodes for an overlay network. This field is only present for overlay networks, and
* omitted for other network types.
*/
Peers: S.optional(S.Array(PeerInfo)),
});
export type Network = S.Schema.Type<typeof Network>;
export const NetworkEncoded = S.encodedSchema(Network);
export type NetworkEncoded = S.Schema.Encoded<typeof Network>;

View File

@@ -0,0 +1,15 @@
import { pipe, Option, Schema as S } from 'effect';
/** Specifies how a service should be attached to a particular network. */
export const NetworkAttachmentConfig = S.Struct({
/** The target network for attachment. Must be a network name or ID. */
Target: S.optional(S.String),
/** Discoverable alternate names for the service on this network. */
Aliases: S.optional(S.Array(S.String)),
/** Driver attachment options for the network target. */
DriverOpts: S.optional(S.Record({ key: S.String, value: S.String })),
});
export type NetworkAttachmentConfig = S.Schema.Type<typeof NetworkAttachmentConfig>;
export const NetworkAttachmentConfigEncoded = S.encodedSchema(NetworkAttachmentConfig);
export type NetworkAttachmentConfigEncoded = S.Schema.Encoded<typeof NetworkAttachmentConfig>;

View File

@@ -0,0 +1,14 @@
import { pipe, Option, Schema as S } from 'effect';
import { EndpointSettings } from './EndpointSettings.ts';
/** NetworkConnectRequest represents the data to be used to connect a container to a network. */
export const NetworkConnectRequest = S.Struct({
/** The ID or name of the container to connect to the network. */
Container: S.String,
EndpointConfig: S.optional(EndpointSettings),
});
export type NetworkConnectRequest = S.Schema.Type<typeof NetworkConnectRequest>;
export const NetworkConnectRequestEncoded = S.encodedSchema(NetworkConnectRequest);
export type NetworkConnectRequestEncoded = S.Schema.Encoded<typeof NetworkConnectRequest>;

View File

@@ -0,0 +1,13 @@
import { pipe, Option, Schema as S } from 'effect';
/** OK response to NetworkCreate operation */
export const NetworkCreateResponse = S.Struct({
/** The ID of the created network. */
Id: S.String,
/** Warnings encountered when creating the container */
Warning: S.String,
}); // NetworkCreateResponse
export type NetworkCreateResponse = S.Schema.Type<typeof NetworkCreateResponse>;
export const NetworkCreateResponseEncoded = S.encodedSchema(NetworkCreateResponse);
export type NetworkCreateResponseEncoded = S.Schema.Encoded<typeof NetworkCreateResponse>;

View File

@@ -0,0 +1,15 @@
import { pipe, Option, Schema as S } from 'effect';
/** NetworkDisconnectRequest represents the data to be used to disconnect a container from a network. */
export const NetworkDisconnectRequest = S.Struct({
/** The ID or name of the container to disconnect from the network. */
Container: S.String,
/** Force the container to disconnect from the network. */
Force: S.optionalWith(S.Boolean, {
default: () => false,
}),
});
export type NetworkDisconnectRequest = S.Schema.Type<typeof NetworkDisconnectRequest>;
export const NetworkDisconnectRequestEncoded = S.encodedSchema(NetworkDisconnectRequest);
export type NetworkDisconnectRequestEncoded = S.Schema.Encoded<typeof NetworkDisconnectRequest>;

View File

@@ -0,0 +1,9 @@
import { pipe, Option, Schema as S } from 'effect';
import { Network } from './Network.ts';
export const NetworkInspect = Network;
export type NetworkInspect = S.Schema.Type<typeof NetworkInspect>;
export const NetworkInspectEncoded = S.encodedSchema(NetworkInspect);
export type NetworkInspectEncoded = S.Schema.Encoded<typeof NetworkInspect>;

View File

@@ -0,0 +1,19 @@
import { pipe, Option, Schema as S } from 'effect';
import { PortMap } from './PortMap.ts';
import { EndpointSettings } from './EndpointSettings.ts';
/** NetworkSettings exposes the network settings in the API */
export const NetworkSettings = S.Struct({
/** SandboxID uniquely represents a container's network stack. */
SandboxID: S.optional(S.String),
/** SandboxKey is the full path of the netns handle */
SandboxKey: S.optional(S.String),
Ports: S.optional(PortMap),
/** Information about all networks that the container is connected to. */
Networks: S.optional(S.Record({ key: S.String, value: EndpointSettings })),
});
export type NetworkSettings = S.Schema.Type<typeof NetworkSettings>;
export const NetworkSettingsEncoded = S.encodedSchema(NetworkSettings);
export type NetworkSettingsEncoded = S.Schema.Encoded<typeof NetworkSettings>;

View File

@@ -0,0 +1,12 @@
import { pipe, Option, Schema as S } from 'effect';
import { IPAMStatus } from './IPAMStatus.ts';
/** Provides runtime information about the network such as the number of allocated IPs. */
export const NetworkStatus = S.Struct({
IPAM: S.optional(IPAMStatus),
});
export type NetworkStatus = S.Schema.Type<typeof NetworkStatus>;
export const NetworkStatusEncoded = S.encodedSchema(NetworkStatus);
export type NetworkStatusEncoded = S.Schema.Encoded<typeof NetworkStatus>;

View File

@@ -0,0 +1,9 @@
import { pipe, Option, Schema as S } from 'effect';
import { Network } from './Network.ts';
export const NetworkSummary = Network;
export type NetworkSummary = S.Schema.Type<typeof NetworkSummary>;
export const NetworkSummaryEncoded = S.encodedSchema(NetworkSummary);
export type NetworkSummaryEncoded = S.Schema.Encoded<typeof NetworkSummary>;

View File

@@ -0,0 +1,13 @@
import { pipe, Option, Schema as S } from 'effect';
/** Carries the information about one backend task */
export const NetworkTaskInfo = S.Struct({
Name: S.optional(S.String),
EndpointID: S.optional(S.String),
EndpointIP: S.optional(S.String),
Info: S.optional(S.Record({ key: S.String, value: S.String })),
});
export type NetworkTaskInfo = S.Schema.Type<typeof NetworkTaskInfo>;
export const NetworkTaskInfoEncoded = S.encodedSchema(NetworkTaskInfo);
export type NetworkTaskInfoEncoded = S.Schema.Encoded<typeof NetworkTaskInfo>;

View File

@@ -0,0 +1,21 @@
import { pipe, Option, Schema as S } from 'effect';
import { EndpointSettings } from './EndpointSettings.ts';
/**
* NetworkingConfig represents the container's networking configuration for each of its interfaces.
* It is used for the networking configs specified in the `docker create` and `docker network
* connect` commands.
*/
export const NetworkingConfig = S.Struct({
/**
* A mapping of network name to endpoint configuration for that network. The endpoint
* configuration can be left empty to connect to that network with no particular endpoint
* configuration.
*/
EndpointsConfig: S.optional(S.Record({ key: S.String, value: EndpointSettings })),
});
export type NetworkingConfig = S.Schema.Type<typeof NetworkingConfig>;
export const NetworkingConfigEncoded = S.encodedSchema(NetworkingConfig);
export type NetworkingConfigEncoded = S.Schema.Encoded<typeof NetworkingConfig>;

View File

@@ -0,0 +1,30 @@
import { pipe, Option, Schema as S } from 'effect';
import { ObjectVersion } from './ObjectVersion.ts';
import { NodeSpec } from './NodeSpec.ts';
import { NodeDescription } from './NodeDescription.ts';
import { NodeStatus } from './NodeStatus.ts';
import { ManagerStatus } from './ManagerStatus.ts';
export const Node = S.Struct({
ID: S.optional(S.String),
Version: S.optional(ObjectVersion),
/**
* Date and time at which the node was added to the swarm in [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
*/
CreatedAt: S.optional(S.String),
/**
* Date and time at which the node was last updated in [RFC
* 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
*/
UpdatedAt: S.optional(S.String),
Spec: S.optional(NodeSpec),
Description: S.optional(NodeDescription),
Status: S.optional(NodeStatus),
ManagerStatus: S.optional(ManagerStatus),
});
export type Node = S.Schema.Type<typeof Node>;
export const NodeEncoded = S.encodedSchema(Node);
export type NodeEncoded = S.Schema.Encoded<typeof Node>;

View File

@@ -0,0 +1,19 @@
import { pipe, Option, Schema as S } from 'effect';
import { Platform } from './Platform.ts';
import { ResourceObject } from './ResourceObject.ts';
import { EngineDescription } from './EngineDescription.ts';
import { TLSInfo } from './TLSInfo.ts';
/** NodeDescription encapsulates the properties of the Node as reported by the agent. */
export const NodeDescription = S.Struct({
Hostname: S.optional(S.String),
Platform: S.optional(Platform),
Resources: S.optional(ResourceObject),
Engine: S.optional(EngineDescription),
TLSInfo: S.optional(TLSInfo),
});
export type NodeDescription = S.Schema.Type<typeof NodeDescription>;
export const NodeDescriptionEncoded = S.encodedSchema(NodeDescription);
export type NodeDescriptionEncoded = S.Schema.Encoded<typeof NodeDescription>;

View File

@@ -0,0 +1,16 @@
import { pipe, Option, Schema as S } from 'effect';
export const NodeSpec = S.Struct({
/** Name for the node. */
Name: S.optional(S.String),
/** User-defined key/value metadata. */
Labels: S.optional(S.Record({ key: S.String, value: S.String })),
/** Role of the node. */
Role: S.optional(S.Literal('worker', 'manager')),
/** Availability of the node. */
Availability: S.optional(S.Literal('active', 'pause', 'drain')),
});
export type NodeSpec = S.Schema.Type<typeof NodeSpec>;
export const NodeSpecEncoded = S.encodedSchema(NodeSpec);
export type NodeSpecEncoded = S.Schema.Encoded<typeof NodeSpec>;

View File

@@ -0,0 +1,8 @@
import { pipe, Option, Schema as S } from 'effect';
/** NodeState represents the state of a node. */
export const NodeState = S.Literal('unknown', 'down', 'ready', 'disconnected');
export type NodeState = S.Schema.Type<typeof NodeState>;
export const NodeStateEncoded = S.encodedSchema(NodeState);
export type NodeStateEncoded = S.Schema.Encoded<typeof NodeState>;

Some files were not shown because too many files have changed in this diff Show More