cloudflare
Version:
The official TypeScript library for the Cloudflare API
971 lines • 31 kB
TypeScript
import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import * as SettingsAPI from 'cloudflare/resources/workers/scripts/settings';
export declare class Settings extends APIResource {
/**
* Patch script metadata or config, such as bindings or usage model
*/
edit(scriptName: string, params: SettingEditParams, options?: Core.RequestOptions): Core.APIPromise<SettingEditResponse>;
/**
* Get script metadata and config, such as bindings or usage model
*/
get(scriptName: string, params: SettingGetParams, options?: Core.RequestOptions): Core.APIPromise<SettingGetResponse>;
}
export interface SettingEditResponse {
/**
* List of bindings attached to this Worker
*/
bindings?: Array<SettingEditResponse.WorkersKVNamespaceBinding | SettingEditResponse.WorkersServiceBinding | SettingEditResponse.WorkersDoBinding | SettingEditResponse.WorkersR2Binding | SettingEditResponse.WorkersQueueBinding | SettingEditResponse.WorkersD1Binding | SettingEditResponse.WorkersDispatchNamespaceBinding | SettingEditResponse.WorkersMTLSCERTBinding>;
/**
* Opt your Worker into changes after this date
*/
compatibility_date?: string;
/**
* Opt your Worker into specific changes
*/
compatibility_flags?: Array<string>;
/**
* Whether Logpush is turned on for the Worker.
*/
logpush?: boolean;
/**
* Migrations to apply for Durable Objects associated with this Worker.
*/
migrations?: SettingEditResponse.WorkersSingleStepMigrations | SettingEditResponse.WorkersSteppedMigrations;
placement?: SettingEditResponse.Placement;
/**
* Tags to help you manage your Workers
*/
tags?: Array<string>;
/**
* List of Workers that will consume logs from the attached Worker.
*/
tail_consumers?: Array<SettingEditResponse.TailConsumer>;
/**
* Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').
*/
usage_model?: string;
}
export declare namespace SettingEditResponse {
interface WorkersKVNamespaceBinding {
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* Namespace identifier tag.
*/
namespace_id: string;
/**
* The class of resource that the binding provides.
*/
type: 'kv_namespace';
}
interface WorkersServiceBinding {
/**
* Optional environment if the Worker utilizes one.
*/
environment: string;
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* Name of Worker to bind to
*/
service: string;
/**
* The class of resource that the binding provides.
*/
type: 'service';
}
interface WorkersDoBinding {
/**
* The exported class name of the Durable Object
*/
class_name: string;
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* The class of resource that the binding provides.
*/
type: 'durable_object_namespace';
/**
* The environment of the script_name to bind to
*/
environment?: string;
/**
* Namespace identifier tag.
*/
namespace_id?: string;
/**
* The script where the Durable Object is defined, if it is external to this Worker
*/
script_name?: string;
}
interface WorkersR2Binding {
/**
* R2 bucket to bind to
*/
bucket_name: string;
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* The class of resource that the binding provides.
*/
type: 'r2_bucket';
}
interface WorkersQueueBinding {
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* Name of the Queue to bind to
*/
queue_name: string;
/**
* The class of resource that the binding provides.
*/
type: 'queue';
}
interface WorkersD1Binding {
/**
* ID of the D1 database to bind to
*/
id: string;
/**
* A JavaScript variable name for the binding.
*/
binding: string;
/**
* The name of the D1 database associated with the 'id' provided.
*/
name: string;
/**
* The class of resource that the binding provides.
*/
type: 'd1';
}
interface WorkersDispatchNamespaceBinding {
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* Namespace to bind to
*/
namespace: string;
/**
* The class of resource that the binding provides.
*/
type: 'dispatch_namespace';
/**
* Outbound worker
*/
outbound?: WorkersDispatchNamespaceBinding.Outbound;
}
namespace WorkersDispatchNamespaceBinding {
/**
* Outbound worker
*/
interface Outbound {
/**
* Pass information from the Dispatch Worker to the Outbound Worker through the
* parameters
*/
params?: Array<string>;
/**
* Outbound worker
*/
worker?: Outbound.Worker;
}
namespace Outbound {
/**
* Outbound worker
*/
interface Worker {
/**
* Environment of the outbound worker
*/
environment?: string;
/**
* Name of the outbound worker
*/
service?: string;
}
}
}
interface WorkersMTLSCERTBinding {
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* The class of resource that the binding provides.
*/
type: 'mtls_certificate';
/**
* ID of the certificate to bind to
*/
certificate_id?: string;
}
/**
* A single set of migrations to apply.
*/
interface WorkersSingleStepMigrations {
/**
* A list of classes to delete Durable Object namespaces from.
*/
deleted_classes?: Array<string>;
/**
* A list of classes to create Durable Object namespaces from.
*/
new_classes?: Array<string>;
/**
* Tag to set as the latest migration tag.
*/
new_tag?: string;
/**
* Tag used to verify against the latest migration tag for this Worker. If they
* don't match, the upload is rejected.
*/
old_tag?: string;
/**
* A list of classes with Durable Object namespaces that were renamed.
*/
renamed_classes?: Array<WorkersSingleStepMigrations.RenamedClass>;
/**
* A list of transfers for Durable Object namespaces from a different Worker and
* class to a class defined in this Worker.
*/
transferred_classes?: Array<WorkersSingleStepMigrations.TransferredClass>;
}
namespace WorkersSingleStepMigrations {
interface RenamedClass {
from?: string;
to?: string;
}
interface TransferredClass {
from?: string;
from_script?: string;
to?: string;
}
}
interface WorkersSteppedMigrations {
/**
* Tag to set as the latest migration tag.
*/
new_tag?: string;
/**
* Tag used to verify against the latest migration tag for this Worker. If they
* don't match, the upload is rejected.
*/
old_tag?: string;
/**
* Migrations to apply in order.
*/
steps?: Array<WorkersSteppedMigrations.Step>;
}
namespace WorkersSteppedMigrations {
interface Step {
/**
* A list of classes to delete Durable Object namespaces from.
*/
deleted_classes?: Array<string>;
/**
* A list of classes to create Durable Object namespaces from.
*/
new_classes?: Array<string>;
/**
* A list of classes with Durable Object namespaces that were renamed.
*/
renamed_classes?: Array<Step.RenamedClass>;
/**
* A list of transfers for Durable Object namespaces from a different Worker and
* class to a class defined in this Worker.
*/
transferred_classes?: Array<Step.TransferredClass>;
}
namespace Step {
interface RenamedClass {
from?: string;
to?: string;
}
interface TransferredClass {
from?: string;
from_script?: string;
to?: string;
}
}
}
interface Placement {
/**
* Enables
* [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
* Only `"smart"` is currently supported
*/
mode?: 'smart';
}
/**
* A reference to a script that will consume logs from the attached Worker.
*/
interface TailConsumer {
/**
* Name of Worker that is to be the consumer.
*/
service: string;
/**
* Optional environment if the Worker utilizes one.
*/
environment?: string;
/**
* Optional dispatch namespace the script belongs to.
*/
namespace?: string;
}
}
export interface SettingGetResponse {
/**
* List of bindings attached to this Worker
*/
bindings?: Array<SettingGetResponse.WorkersKVNamespaceBinding | SettingGetResponse.WorkersServiceBinding | SettingGetResponse.WorkersDoBinding | SettingGetResponse.WorkersR2Binding | SettingGetResponse.WorkersQueueBinding | SettingGetResponse.WorkersD1Binding | SettingGetResponse.WorkersDispatchNamespaceBinding | SettingGetResponse.WorkersMTLSCERTBinding>;
/**
* Opt your Worker into changes after this date
*/
compatibility_date?: string;
/**
* Opt your Worker into specific changes
*/
compatibility_flags?: Array<string>;
/**
* Whether Logpush is turned on for the Worker.
*/
logpush?: boolean;
/**
* Migrations to apply for Durable Objects associated with this Worker.
*/
migrations?: SettingGetResponse.WorkersSingleStepMigrations | SettingGetResponse.WorkersSteppedMigrations;
placement?: SettingGetResponse.Placement;
/**
* Tags to help you manage your Workers
*/
tags?: Array<string>;
/**
* List of Workers that will consume logs from the attached Worker.
*/
tail_consumers?: Array<SettingGetResponse.TailConsumer>;
/**
* Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').
*/
usage_model?: string;
}
export declare namespace SettingGetResponse {
interface WorkersKVNamespaceBinding {
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* Namespace identifier tag.
*/
namespace_id: string;
/**
* The class of resource that the binding provides.
*/
type: 'kv_namespace';
}
interface WorkersServiceBinding {
/**
* Optional environment if the Worker utilizes one.
*/
environment: string;
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* Name of Worker to bind to
*/
service: string;
/**
* The class of resource that the binding provides.
*/
type: 'service';
}
interface WorkersDoBinding {
/**
* The exported class name of the Durable Object
*/
class_name: string;
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* The class of resource that the binding provides.
*/
type: 'durable_object_namespace';
/**
* The environment of the script_name to bind to
*/
environment?: string;
/**
* Namespace identifier tag.
*/
namespace_id?: string;
/**
* The script where the Durable Object is defined, if it is external to this Worker
*/
script_name?: string;
}
interface WorkersR2Binding {
/**
* R2 bucket to bind to
*/
bucket_name: string;
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* The class of resource that the binding provides.
*/
type: 'r2_bucket';
}
interface WorkersQueueBinding {
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* Name of the Queue to bind to
*/
queue_name: string;
/**
* The class of resource that the binding provides.
*/
type: 'queue';
}
interface WorkersD1Binding {
/**
* ID of the D1 database to bind to
*/
id: string;
/**
* A JavaScript variable name for the binding.
*/
binding: string;
/**
* The name of the D1 database associated with the 'id' provided.
*/
name: string;
/**
* The class of resource that the binding provides.
*/
type: 'd1';
}
interface WorkersDispatchNamespaceBinding {
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* Namespace to bind to
*/
namespace: string;
/**
* The class of resource that the binding provides.
*/
type: 'dispatch_namespace';
/**
* Outbound worker
*/
outbound?: WorkersDispatchNamespaceBinding.Outbound;
}
namespace WorkersDispatchNamespaceBinding {
/**
* Outbound worker
*/
interface Outbound {
/**
* Pass information from the Dispatch Worker to the Outbound Worker through the
* parameters
*/
params?: Array<string>;
/**
* Outbound worker
*/
worker?: Outbound.Worker;
}
namespace Outbound {
/**
* Outbound worker
*/
interface Worker {
/**
* Environment of the outbound worker
*/
environment?: string;
/**
* Name of the outbound worker
*/
service?: string;
}
}
}
interface WorkersMTLSCERTBinding {
/**
* A JavaScript variable name for the binding.
*/
name: string;
/**
* The class of resource that the binding provides.
*/
type: 'mtls_certificate';
/**
* ID of the certificate to bind to
*/
certificate_id?: string;
}
/**
* A single set of migrations to apply.
*/
interface WorkersSingleStepMigrations {
/**
* A list of classes to delete Durable Object namespaces from.
*/
deleted_classes?: Array<string>;
/**
* A list of classes to create Durable Object namespaces from.
*/
new_classes?: Array<string>;
/**
* Tag to set as the latest migration tag.
*/
new_tag?: string;
/**
* Tag used to verify against the latest migration tag for this Worker. If they
* don't match, the upload is rejected.
*/
old_tag?: string;
/**
* A list of classes with Durable Object namespaces that were renamed.
*/
renamed_classes?: Array<WorkersSingleStepMigrations.RenamedClass>;
/**
* A list of transfers for Durable Object namespaces from a different Worker and
* class to a class defined in this Worker.
*/
transferred_classes?: Array<WorkersSingleStepMigrations.TransferredClass>;
}
namespace WorkersSingleStepMigrations {
interface RenamedClass {
from?: string;
to?: string;
}
interface TransferredClass {
from?: string;
from_script?: string;
to?: string;
}
}
interface WorkersSteppedMigrations {
/**
* Tag to set as the latest migration tag.
*/
new_tag?: string;
/**
* Tag used to verify against the latest migration tag for this Worker. If they
* don't match, the upload is rejected.
*/
old_tag?: string;
/**
* Migrations to apply in order.
*/
steps?: Array<WorkersSteppedMigrations.Step>;
}
namespace WorkersSteppedMigrations {
interface Step {
/**
* A list of classes to delete Durable Object namespaces from.
*/
deleted_classes?: Array<string>;
/**
* A list of classes to create Durable Object namespaces from.
*/
new_classes?: Array<string>;
/**
* A list of classes with Durable Object namespaces that were renamed.
*/
renamed_classes?: Array<Step.RenamedClass>;
/**
* A list of transfers for Durable Object namespaces from a different Worker and
* class to a class defined in this Worker.
*/
transferred_classes?: Array<Step.TransferredClass>;
}
namespace Step {
interface RenamedClass {
from?: string;
to?: string;
}
interface TransferredClass {
from?: string;
from_script?: string;
to?: string;
}
}
}
interface Placement {
/**
* Enables
* [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
* Only `"smart"` is currently supported
*/
mode?: 'smart';
}
/**
* A reference to a script that will consume logs from the attached Worker.
*/
interface TailConsumer {
/**
* Name of Worker that is to be the consumer.
*/
service: string;
/**
* Optional environment if the Worker utilizes one.
*/
environment?: string;
/**
* Optional dispatch namespace the script belongs to.
*/
namespace?: string;
}
}
export interface SettingEditParams {
/**
* Path param: Identifier
*/
account_id: string;
/**
* Body param:
*/
settings?: SettingEditParams.Settings;
}
export declare namespace SettingEditParams {
interface Settings {
errors: Array<Settings.Error>;
messages: Array<Settings.Message>;
result: Settings.Result;
/**
* Whether the API call was successful
*/
success: true;
}
namespace Settings {
interface Error {
code: number;
message: string;
}
interface Message {
code: number;
message: string;
}
interface Result {
/**
* List of bindings attached to this Worker
*/
bindings?: Array<Result.WorkersKVNamespaceBinding | Result.WorkersServiceBinding | Result.WorkersDoBinding | Result.WorkersR2Binding | Result.WorkersQueueBinding | Result.WorkersD1Binding | Result.WorkersDispatchNamespaceBinding | Result.WorkersMTLSCERTBinding>;
/**
* Opt your Worker into changes after this date
*/
compatibility_date?: string;
/**
* Opt your Worker into specific changes
*/
compatibility_flags?: Array<string>;
/**
* Whether Logpush is turned on for the Worker.
*/
logpush?: boolean;
/**
* Migrations to apply for Durable Objects associated with this Worker.
*/
migrations?: Result.WorkersSingleStepMigrations | Result.WorkersSteppedMigrations;
placement?: Result.Placement;
/**
* Tags to help you manage your Workers
*/
tags?: Array<string>;
/**
* List of Workers that will consume logs from the attached Worker.
*/
tail_consumers?: Array<Result.TailConsumer>;
/**
* Specifies the usage model for the Worker (e.g. 'bundled' or 'unbound').
*/
usage_model?: string;
}
namespace Result {
interface WorkersKVNamespaceBinding {
/**
* The class of resource that the binding provides.
*/
type: 'kv_namespace';
}
interface WorkersServiceBinding {
/**
* Optional environment if the Worker utilizes one.
*/
environment: string;
/**
* Name of Worker to bind to
*/
service: string;
/**
* The class of resource that the binding provides.
*/
type: 'service';
}
interface WorkersDoBinding {
/**
* The exported class name of the Durable Object
*/
class_name: string;
/**
* The class of resource that the binding provides.
*/
type: 'durable_object_namespace';
/**
* The environment of the script_name to bind to
*/
environment?: string;
/**
* The script where the Durable Object is defined, if it is external to this Worker
*/
script_name?: string;
}
interface WorkersR2Binding {
/**
* R2 bucket to bind to
*/
bucket_name: string;
/**
* The class of resource that the binding provides.
*/
type: 'r2_bucket';
}
interface WorkersQueueBinding {
/**
* Name of the Queue to bind to
*/
queue_name: string;
/**
* The class of resource that the binding provides.
*/
type: 'queue';
}
interface WorkersD1Binding {
/**
* ID of the D1 database to bind to
*/
id: string;
/**
* The name of the D1 database associated with the 'id' provided.
*/
name: string;
/**
* The class of resource that the binding provides.
*/
type: 'd1';
}
interface WorkersDispatchNamespaceBinding {
/**
* Namespace to bind to
*/
namespace: string;
/**
* The class of resource that the binding provides.
*/
type: 'dispatch_namespace';
/**
* Outbound worker
*/
outbound?: WorkersDispatchNamespaceBinding.Outbound;
}
namespace WorkersDispatchNamespaceBinding {
/**
* Outbound worker
*/
interface Outbound {
/**
* Pass information from the Dispatch Worker to the Outbound Worker through the
* parameters
*/
params?: Array<string>;
/**
* Outbound worker
*/
worker?: Outbound.Worker;
}
namespace Outbound {
/**
* Outbound worker
*/
interface Worker {
/**
* Environment of the outbound worker
*/
environment?: string;
/**
* Name of the outbound worker
*/
service?: string;
}
}
}
interface WorkersMTLSCERTBinding {
/**
* The class of resource that the binding provides.
*/
type: 'mtls_certificate';
/**
* ID of the certificate to bind to
*/
certificate_id?: string;
}
/**
* A single set of migrations to apply.
*/
interface WorkersSingleStepMigrations {
/**
* A list of classes to delete Durable Object namespaces from.
*/
deleted_classes?: Array<string>;
/**
* A list of classes to create Durable Object namespaces from.
*/
new_classes?: Array<string>;
/**
* Tag to set as the latest migration tag.
*/
new_tag?: string;
/**
* Tag used to verify against the latest migration tag for this Worker. If they
* don't match, the upload is rejected.
*/
old_tag?: string;
/**
* A list of classes with Durable Object namespaces that were renamed.
*/
renamed_classes?: Array<WorkersSingleStepMigrations.RenamedClass>;
/**
* A list of transfers for Durable Object namespaces from a different Worker and
* class to a class defined in this Worker.
*/
transferred_classes?: Array<WorkersSingleStepMigrations.TransferredClass>;
}
namespace WorkersSingleStepMigrations {
interface RenamedClass {
from?: string;
to?: string;
}
interface TransferredClass {
from?: string;
from_script?: string;
to?: string;
}
}
interface WorkersSteppedMigrations {
/**
* Tag to set as the latest migration tag.
*/
new_tag?: string;
/**
* Tag used to verify against the latest migration tag for this Worker. If they
* don't match, the upload is rejected.
*/
old_tag?: string;
/**
* Migrations to apply in order.
*/
steps?: Array<WorkersSteppedMigrations.Step>;
}
namespace WorkersSteppedMigrations {
interface Step {
/**
* A list of classes to delete Durable Object namespaces from.
*/
deleted_classes?: Array<string>;
/**
* A list of classes to create Durable Object namespaces from.
*/
new_classes?: Array<string>;
/**
* A list of classes with Durable Object namespaces that were renamed.
*/
renamed_classes?: Array<Step.RenamedClass>;
/**
* A list of transfers for Durable Object namespaces from a different Worker and
* class to a class defined in this Worker.
*/
transferred_classes?: Array<Step.TransferredClass>;
}
namespace Step {
interface RenamedClass {
from?: string;
to?: string;
}
interface TransferredClass {
from?: string;
from_script?: string;
to?: string;
}
}
}
interface Placement {
/**
* Enables
* [Smart Placement](https://developers.cloudflare.com/workers/configuration/smart-placement).
* Only `"smart"` is currently supported
*/
mode?: 'smart';
}
/**
* A reference to a script that will consume logs from the attached Worker.
*/
interface TailConsumer {
/**
* Name of Worker that is to be the consumer.
*/
service: string;
/**
* Optional environment if the Worker utilizes one.
*/
environment?: string;
/**
* Optional dispatch namespace the script belongs to.
*/
namespace?: string;
}
}
}
}
export interface SettingGetParams {
/**
* Identifier
*/
account_id: string;
}
export declare namespace Settings {
export import SettingEditResponse = SettingsAPI.SettingEditResponse;
export import SettingGetResponse = SettingsAPI.SettingGetResponse;
export import SettingEditParams = SettingsAPI.SettingEditParams;
export import SettingGetParams = SettingsAPI.SettingGetParams;
}
//# sourceMappingURL=settings.d.ts.map