the-moby-effect
Version:
Moby/Docker API client built using effect-ts
355 lines • 15.5 kB
TypeScript
import type * as HttpBody from "@effect/platform/HttpBody";
import type * as HttpClientError from "@effect/platform/HttpClientError";
import type * as Layer from "effect/Layer";
import type * as ParseResult from "effect/ParseResult";
import * as HttpClient from "@effect/platform/HttpClient";
import * as Effect from "effect/Effect";
import * as Stream from "effect/Stream";
import { ContainerConfig, IDResponse, ImageDeleteResponse as ImageDeleteResponseItem, ImageHistoryResponseItem, ImageInspectResponse as ImageInspect, ImagePruneResponse, RegistrySearchResponse as ImageSearchResponseItem, ImageSummary, JSONMessage } from "../generated/index.js";
/**
* @since 1.0.0
* @category Errors
*/
export declare const ImagesErrorTypeId: unique symbol;
/**
* @since 1.0.0
* @category Errors
*/
export type ImagesErrorTypeId = typeof ImagesErrorTypeId;
/**
* @since 1.0.0
* @category Errors
*/
export declare const isImagesError: (u: unknown) => u is ImagesError;
declare const ImagesError_base: new <A extends Record<string, any>>(args: import("effect/Types").Simplify<A>) => import("effect/Cause").YieldableError & Record<typeof ImagesErrorTypeId, typeof ImagesErrorTypeId> & {
readonly _tag: "ImagesError";
} & Readonly<A>;
/**
* @since 1.0.0
* @category Errors
*/
export declare class ImagesError extends ImagesError_base<{
method: string;
cause: ParseResult.ParseError | HttpClientError.HttpClientError | HttpBody.HttpBodyError | unknown;
}> {
get message(): string;
}
/**
* @since 1.0.0
* @category Params
* @see https://docs.docker.com/reference/api/engine/latest/#tag/Image
*/
export interface ImageBuildOptions<E1> {
/**
* A tar archive compressed with one of the following algorithms: identity
* (no compression), gzip, bzip2, xz.
*/
readonly context: Stream.Stream<Uint8Array, E1, never>;
/**
* Path within the build context to the `Dockerfile`. This is ignored if
* `remote` is specified and points to an external `Dockerfile`.
*/
readonly dockerfile?: string | undefined;
/**
* A name and optional tag to apply to the image in the `name:tag` format.
* If you omit the tag the default `latest` value is assumed. You can
* provide several `t` parameters.
*/
readonly t?: string | undefined;
/** Extra hosts to add to /etc/hosts */
readonly extrahosts?: string | undefined;
/**
* A Git repository URI or HTTP/HTTPS context URI. If the URI points to a
* single text file, the file’s contents are placed into a file called
* `Dockerfile` and the image is built from that file. If the URI points to
* a tarball, the file is downloaded by the daemon and the contents therein
* used as the context for the build. If the URI points to a tarball and the
* `dockerfile` parameter is also specified, there must be a file with the
* corresponding path inside the tarball.
*/
readonly remote?: string | undefined;
/** Suppress verbose build output. */
readonly q?: boolean | undefined;
/** Do not use the cache when building the image. */
readonly nocache?: boolean | undefined;
/** JSON array of images used for build cache resolution. */
readonly cachefrom?: string | undefined;
/** Attempt to pull the image even if an older image exists locally. */
readonly pull?: string | undefined;
/** Remove intermediate containers after a successful build. */
readonly rm?: boolean | undefined;
/** Always remove intermediate containers, even upon failure. */
readonly forcerm?: boolean | undefined;
/** Set memory limit for build. */
readonly memory?: number | undefined;
/** Total memory (memory + swap). Set as `-1` to disable swap. */
readonly memswap?: number | undefined;
/** CPU shares (relative weight). */
readonly cpushares?: number | undefined;
/** CPUs in which to allow execution (e.g., `0-3`, `0,1`). */
readonly cpusetcpus?: string | undefined;
/** The length of a CPU period in microseconds. */
readonly cpuperiod?: number | undefined;
/** Microseconds of CPU time that the container can get in a CPU period. */
readonly cpuquota?: number | undefined;
/**
* JSON map of string pairs for build-time variables. Users pass these
* values at build-time. Docker uses the buildargs as the environment
* context for commands run via the `Dockerfile` RUN instruction, or for
* variable expansion in other `Dockerfile` instructions. This is not meant
* for passing secret values.
*
* For example, the build arg `FOO=bar` would become `{"FOO":"bar"}` in
* JSON. This would result in the query parameter `buildargs={"FOO":"bar"}`.
* Note that `{"FOO":"bar"}` should be URI component encoded.
*
* [Read more about the buildargs
* instruction.](https://docs.docker.com/engine/reference/builder/#arg)
*/
readonly buildArgs?: Record<string, string | undefined> | undefined;
/**
* Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted
* the system uses 64MB.
*/
readonly shmsize?: number | undefined;
/**
* Squash the resulting images layers into a single layer. _(Experimental
* release only.)_
*/
readonly squash?: boolean | undefined;
/**
* Arbitrary key/value labels to set on the image, as a JSON map of string
* pairs.
*/
readonly labels?: string | undefined;
/**
* Sets the networking mode for the run commands during build. Supported
* standard values are: `bridge`, `host`, `none`, and `container:<name|id>`.
* Any other value is taken as a custom network's name or ID to which this
* container should connect to.
*/
readonly networkmode?: string | undefined;
readonly "Content-type"?: string | undefined;
/**
* This is a base64-encoded JSON object with auth configurations for
* multiple registries that a build may refer to.
*
* The key is a registry URL, and the value is an auth configuration object,
* [as described in the authentication section](#section/Authentication).
* For example:
*
* {
* "docker.example.com": {
* "username": "janedoe",
* "password": "hunter2"
* },
* "https://index.docker.io/v1/": {
* "username": "mobydock",
* "password": "conta1n3rize14"
* }
* }
*
* Only the registry domain name (and port if not the default 443) are
* required. However, for legacy reasons, the Docker Hub registry must be
* specified with both a `https://` prefix and a `/v1/` suffix even though
* Docker will prefer to use the v2 registry API.
*/
readonly "X-Registry-Config"?: string | undefined;
/** Platform in the format os[/arch[/variant]] */
readonly platform?: string | undefined;
/** Target build stage */
readonly target?: string | undefined;
/** BuildKit output configuration */
readonly outputs?: string | undefined;
}
declare const Images_base: Effect.Service.Class<Images, "@the-moby-effect/endpoints/Images", {
readonly accessors: false;
readonly dependencies: readonly [];
readonly effect: Effect.Effect<{
list: (options?: {
/**
* Show all images. Only images from a final layer (no
* children) are shown by default.
*/
readonly all?: boolean;
/**
* A JSON encoded value of the filters (a
* `map[string][]string`) to process on the images list.
*
* Available filters:
*
* - `before`=(`<image-name>[:<tag>]`, `<image id>` or
* `<image@digest>`)
* - `dangling=true`
* - `label=key` or `label="key=value"` of an image label
* - `reference`=(`<image-name>[:<tag>]`)
* - `since`=(`<image-name>[:<tag>]`, `<image id>` or
* `<image@digest>`)
* - `until=<timestamp>`
*/
readonly filters?: string | undefined;
/**
* Compute and show shared size as a `SharedSize` field on
* each image.
*/
readonly "shared-size"?: boolean | undefined;
/**
* Show digest information as a `RepoDigests` field on
* each image.
*/
readonly digests?: boolean | undefined;
} | undefined) => Effect.Effect<ReadonlyArray<ImageSummary>, ImagesError, never>;
build: <E1>(options: ImageBuildOptions<E1>) => Stream.Stream<JSONMessage, ImagesError, never>;
buildPrune: (options?: {
readonly "keep-storage"?: number;
readonly all?: boolean;
readonly filters?: {
until?: string | undefined;
id?: string | undefined;
parent?: string | undefined;
type?: string | undefined;
description?: string | undefined;
inuse?: boolean | undefined;
shared?: boolean | undefined;
private?: boolean | undefined;
} | undefined;
} | undefined) => Effect.Effect<ImagePruneResponse, ImagesError, never>;
create: (options: {
/**
* Name of the image to pull. The name may include a tag or digest.
* This parameter may only be used when pulling an image. The pull
* is cancelled if the HTTP connection is closed.
*/
readonly fromImage?: string | undefined;
/**
* Source to import. The value may be a URL from which the image can
* be retrieved or `-` to read the image from the request body. This
* parameter may only be used when importing an image.
*/
readonly fromSrc?: string | undefined;
/**
* Repository name given to an image when it is imported. The repo
* may include a tag. This parameter may only be used when importing
* an image.
*/
readonly repo?: string | undefined;
/**
* Tag or digest. If empty when pulling an image, this causes all
* tags for the given image to be pulled.
*/
readonly tag?: string | undefined;
/** Set commit message for imported image. */
readonly message?: string | undefined;
/**
* Image content if the value `-` has been specified in fromSrc
* query parameter
*/
readonly inputImage?: string | undefined;
/**
* A base64url-encoded auth configuration.
*
* Refer to the [authentication section](#section/Authentication)
* for details.
*/
readonly "X-Registry-Auth"?: string | undefined;
/**
* Apply `Dockerfile` instructions to the image that is created, for
* example: `changes=ENV DEBUG=true`. Note that `ENV DEBUG=true`
* should be URI component encoded.
*
* Supported `Dockerfile` instructions:
* `CMD`|`ENTRYPOINT`|`ENV`|`EXPOSE`|`ONBUILD`|`USER`|`VOLUME`|`WORKDIR`
*/
readonly changes?: string | undefined;
/**
* Platform in the format os[/arch[/variant]].
*
* When used in combination with the `fromImage` option, the daemon
* checks if the given image is present in the local image cache
* with the given OS and Architecture, and otherwise attempts to
* pull the image. If the option is not set, the host's native OS
* and Architecture are used. If the given image does not exist in
* the local image cache, the daemon attempts to pull the image with
* the host's native OS and Architecture. If the given image does
* exists in the local image cache, but its OS or architecture does
* not match, a warning is produced.
*
* When used with the `fromSrc` option to import an image from an
* archive, this option sets the platform information for the
* imported image. If the option is not set, the host's native OS
* and Architecture are used for the imported image.
*/
readonly platform?: string | undefined;
}) => Stream.Stream<JSONMessage, ImagesError, never>;
inspect: (options: {
readonly name: string;
}) => Effect.Effect<Readonly<ImageInspect>, ImagesError, never>;
history: (options: {
readonly name: string;
}) => Effect.Effect<ReadonlyArray<ImageHistoryResponseItem>, ImagesError, never>;
push: (options: {
readonly name: string;
readonly tag?: string;
readonly "X-Registry-Auth": string;
}) => Stream.Stream<string, ImagesError, never>;
tag: (options: {
readonly name: string;
readonly repo?: string;
readonly tag?: string;
}) => Effect.Effect<void, ImagesError, never>;
delete: (options: {
readonly name: string;
readonly force?: boolean;
readonly noprune?: boolean;
}) => Effect.Effect<ReadonlyArray<ImageDeleteResponseItem>, ImagesError, never>;
search: (options: {
readonly term: string;
readonly limit?: number | undefined;
readonly stars?: number | undefined;
readonly "is-official"?: boolean | undefined;
}) => Effect.Effect<ReadonlyArray<ImageSearchResponseItem>, ImagesError, never>;
prune: (options?: {
readonly filters?: {
dangling?: ["true" | "false"] | undefined;
until?: [string] | undefined;
label?: Array<string> | undefined;
};
} | undefined) => Effect.Effect<ImagePruneResponse, ImagesError, never>;
commit: (options: {
readonly containerConfig: ContainerConfig;
readonly container?: string;
readonly repo?: string;
readonly tag?: string;
readonly comment?: string;
readonly author?: string;
readonly pause?: boolean;
readonly changes?: string;
}) => Effect.Effect<Readonly<IDResponse>, ImagesError, never>;
get: (options: {
readonly name: string;
}) => Stream.Stream<string, ImagesError, never>;
getall: (options?: {
readonly names?: Array<string> | undefined;
} | undefined) => Stream.Stream<string, ImagesError, never>;
load: <E1>(options: {
readonly imagesTarball: Stream.Stream<Uint8Array, E1, never>;
readonly quiet?: boolean;
}) => Effect.Effect<void, ImagesError, never>;
}, never, HttpClient.HttpClient>;
}>;
/**
* Images service
*
* @since 1.0.0
* @category Tags
*/
export declare class Images extends Images_base {
}
/**
* @since 1.0.0
* @category Layers
* @see https://docs.docker.com/reference/api/engine/latest/#tag/Image
*/
export declare const ImagesLayer: Layer.Layer<Images, never, HttpClient.HttpClient>;
export {};
//# sourceMappingURL=images.d.ts.map