kv

package
v7.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const AuditLogActorTypeAdmin = shared.AuditLogActorTypeAdmin

This is an alias to an internal value.

View Source
const AuditLogActorTypeCloudflare = shared.AuditLogActorTypeCloudflare

This is an alias to an internal value.

View Source
const AuditLogActorTypeUser = shared.AuditLogActorTypeUser

This is an alias to an internal value.

View Source
const CertificateCADigicert = shared.CertificateCADigicert

This is an alias to an internal value.

View Source
const CertificateCAGoogle = shared.CertificateCAGoogle

This is an alias to an internal value.

View Source
const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt

This is an alias to an internal value.

View Source
const CertificateCASSLCom = shared.CertificateCASSLCom

This is an alias to an internal value.

View Source
const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate

This is an alias to an internal value.

View Source
const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC

This is an alias to an internal value.

View Source
const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA

This is an alias to an internal value.

View Source
const CloudflareTunnelConfigSrcCloudflare = shared.CloudflareTunnelConfigSrcCloudflare

This is an alias to an internal value.

View Source
const CloudflareTunnelConfigSrcLocal = shared.CloudflareTunnelConfigSrcLocal

This is an alias to an internal value.

View Source
const CloudflareTunnelStatusDegraded = shared.CloudflareTunnelStatusDegraded

This is an alias to an internal value.

View Source
const CloudflareTunnelStatusDown = shared.CloudflareTunnelStatusDown

This is an alias to an internal value.

View Source
const CloudflareTunnelStatusHealthy = shared.CloudflareTunnelStatusHealthy

This is an alias to an internal value.

View Source
const CloudflareTunnelStatusInactive = shared.CloudflareTunnelStatusInactive

This is an alias to an internal value.

View Source
const CloudflareTunnelTunTypeCNI = shared.CloudflareTunnelTunTypeCNI

This is an alias to an internal value.

View Source
const CloudflareTunnelTunTypeCfdTunnel = shared.CloudflareTunnelTunTypeCfdTunnel

This is an alias to an internal value.

View Source
const CloudflareTunnelTunTypeGRE = shared.CloudflareTunnelTunTypeGRE

This is an alias to an internal value.

View Source
const CloudflareTunnelTunTypeIPSec = shared.CloudflareTunnelTunTypeIPSec

This is an alias to an internal value.

View Source
const CloudflareTunnelTunTypeMagic = shared.CloudflareTunnelTunTypeMagic

This is an alias to an internal value.

View Source
const CloudflareTunnelTunTypeWARP = shared.CloudflareTunnelTunTypeWARP

This is an alias to an internal value.

View Source
const CloudflareTunnelTunTypeWARPConnector = shared.CloudflareTunnelTunTypeWARPConnector

This is an alias to an internal value.

View Source
const MemberPoliciesAccessAllow = shared.MemberPoliciesAccessAllow

This is an alias to an internal value.

View Source
const MemberPoliciesAccessDeny = shared.MemberPoliciesAccessDeny

This is an alias to an internal value.

View Source
const MemberStatusAccepted = shared.MemberStatusAccepted

This is an alias to an internal value.

View Source
const MemberStatusPending = shared.MemberStatusPending

This is an alias to an internal value.

View Source
const RatePlanIDBusiness = shared.RatePlanIDBusiness

This is an alias to an internal value.

View Source
const RatePlanIDEnterprise = shared.RatePlanIDEnterprise

This is an alias to an internal value.

View Source
const RatePlanIDFree = shared.RatePlanIDFree

This is an alias to an internal value.

View Source
const RatePlanIDLite = shared.RatePlanIDLite

This is an alias to an internal value.

View Source
const RatePlanIDPartnersBusiness = shared.RatePlanIDPartnersBusiness

This is an alias to an internal value.

View Source
const RatePlanIDPartnersEnterprise = shared.RatePlanIDPartnersEnterprise

This is an alias to an internal value.

View Source
const RatePlanIDPartnersFree = shared.RatePlanIDPartnersFree

This is an alias to an internal value.

View Source
const RatePlanIDPartnersPro = shared.RatePlanIDPartnersPro

This is an alias to an internal value.

View Source
const RatePlanIDPro = shared.RatePlanIDPro

This is an alias to an internal value.

View Source
const RatePlanIDProPlus = shared.RatePlanIDProPlus

This is an alias to an internal value.

View Source
const SortDirectionAsc = shared.SortDirectionAsc

This is an alias to an internal value.

View Source
const SortDirectionDesc = shared.SortDirectionDesc

This is an alias to an internal value.

View Source
const SubscriptionFrequencyMonthly = shared.SubscriptionFrequencyMonthly

This is an alias to an internal value.

View Source
const SubscriptionFrequencyQuarterly = shared.SubscriptionFrequencyQuarterly

This is an alias to an internal value.

View Source
const SubscriptionFrequencyWeekly = shared.SubscriptionFrequencyWeekly

This is an alias to an internal value.

View Source
const SubscriptionFrequencyYearly = shared.SubscriptionFrequencyYearly

This is an alias to an internal value.

View Source
const SubscriptionStateAwaitingPayment = shared.SubscriptionStateAwaitingPayment

This is an alias to an internal value.

View Source
const SubscriptionStateCancelled = shared.SubscriptionStateCancelled

This is an alias to an internal value.

View Source
const SubscriptionStateExpired = shared.SubscriptionStateExpired

This is an alias to an internal value.

View Source
const SubscriptionStateFailed = shared.SubscriptionStateFailed

This is an alias to an internal value.

View Source
const SubscriptionStatePaid = shared.SubscriptionStatePaid

This is an alias to an internal value.

View Source
const SubscriptionStateProvisioned = shared.SubscriptionStateProvisioned

This is an alias to an internal value.

View Source
const SubscriptionStateTrial = shared.SubscriptionStateTrial

This is an alias to an internal value.

View Source
const TokenPolicyEffectAllow = shared.TokenPolicyEffectAllow

This is an alias to an internal value.

View Source
const TokenPolicyEffectDeny = shared.TokenPolicyEffectDeny

This is an alias to an internal value.

View Source
const TokenStatusActive = shared.TokenStatusActive

This is an alias to an internal value.

View Source
const TokenStatusDisabled = shared.TokenStatusDisabled

This is an alias to an internal value.

View Source
const TokenStatusExpired = shared.TokenStatusExpired

This is an alias to an internal value.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASN

type ASN = shared.ASN

This is an alias to an internal type.

type ASNParam

type ASNParam = shared.ASNParam

This is an alias to an internal type.

type AuditLog

type AuditLog = shared.AuditLog

This is an alias to an internal type.

type AuditLogAction

type AuditLogAction = shared.AuditLogAction

This is an alias to an internal type.

type AuditLogActor

type AuditLogActor = shared.AuditLogActor

This is an alias to an internal type.

type AuditLogActorType

type AuditLogActorType = shared.AuditLogActorType

The type of actor, whether a User, Cloudflare Admin, or an Automated System.

This is an alias to an internal type.

type AuditLogOwner

type AuditLogOwner = shared.AuditLogOwner

This is an alias to an internal type.

type AuditLogResource

type AuditLogResource = shared.AuditLogResource

This is an alias to an internal type.

type CertificateCA

type CertificateCA = shared.CertificateCA

The Certificate Authority that will issue the certificate.

This is an alias to an internal type.

type CertificateRequestType

type CertificateRequestType = shared.CertificateRequestType

Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), or "keyless-certificate" (for Keyless SSL servers).

This is an alias to an internal type.

type CloudflareTunnel

type CloudflareTunnel = shared.CloudflareTunnel

A Cloudflare Tunnel that connects your origin to Cloudflare's edge.

This is an alias to an internal type.

type CloudflareTunnelConfigSrc

type CloudflareTunnelConfigSrc = shared.CloudflareTunnelConfigSrc

Indicates if this is a locally or remotely configured tunnel. If `local`, manage the tunnel using a YAML file on the origin machine. If `cloudflare`, manage the tunnel on the Zero Trust dashboard.

This is an alias to an internal type.

type CloudflareTunnelConnection

type CloudflareTunnelConnection = shared.CloudflareTunnelConnection

This is an alias to an internal type.

type CloudflareTunnelStatus

type CloudflareTunnelStatus = shared.CloudflareTunnelStatus

The status of the tunnel. Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy state), `healthy` (tunnel is active and able to serve traffic), or `down` (tunnel can not serve traffic as it has no connections to the Cloudflare Edge).

This is an alias to an internal type.

type CloudflareTunnelTunType

type CloudflareTunnelTunType = shared.CloudflareTunnelTunType

The type of tunnel.

This is an alias to an internal type.

type Error

type Error = apierror.Error

type ErrorData

type ErrorData = shared.ErrorData

This is an alias to an internal type.

type ErrorDataSource

type ErrorDataSource = shared.ErrorDataSource

This is an alias to an internal type.

type KVService

type KVService struct {
	Options    []option.RequestOption
	Namespaces *NamespaceService
}

KVService contains methods and other services that help with interacting with the cloudflare API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewKVService method instead.

func NewKVService

func NewKVService(opts ...option.RequestOption) (r *KVService)

NewKVService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type Key

type Key struct {
	// A key's name. The name may be at most 512 bytes. All printable, non-whitespace
	// characters are valid. Use percent-encoding to define key names as part of a URL.
	Name string `json:"name" api:"required"`
	// The time, measured in number of seconds since the UNIX epoch, at which the key
	// will expire. This property is omitted for keys that will not expire.
	Expiration float64 `json:"expiration"`
	// Arbitrary JSON that is associated with a key.
	Metadata interface{} `json:"metadata"`
	JSON     keyJSON     `json:"-"`
}

A name for a value. A value stored under a given key may be retrieved via the same key.

func (*Key) UnmarshalJSON

func (r *Key) UnmarshalJSON(data []byte) (err error)

type Member

type Member = shared.Member

This is an alias to an internal type.

type MemberPoliciesAccess

type MemberPoliciesAccess = shared.MemberPoliciesAccess

Allow or deny operations against the resources.

This is an alias to an internal type.

type MemberPoliciesPermissionGroup

type MemberPoliciesPermissionGroup = shared.MemberPoliciesPermissionGroup

A named group of permissions that map to a group of operations against resources.

This is an alias to an internal type.

type MemberPoliciesPermissionGroupsMeta

type MemberPoliciesPermissionGroupsMeta = shared.MemberPoliciesPermissionGroupsMeta

Attributes associated to the permission group.

This is an alias to an internal type.

type MemberPoliciesResourceGroup

type MemberPoliciesResourceGroup = shared.MemberPoliciesResourceGroup

A group of scoped resources.

This is an alias to an internal type.

type MemberPoliciesResourceGroupsMeta

type MemberPoliciesResourceGroupsMeta = shared.MemberPoliciesResourceGroupsMeta

Attributes associated to the resource group.

This is an alias to an internal type.

type MemberPoliciesResourceGroupsScope

type MemberPoliciesResourceGroupsScope = shared.MemberPoliciesResourceGroupsScope

A scope is a combination of scope objects which provides additional context.

This is an alias to an internal type.

type MemberPoliciesResourceGroupsScopeObject

type MemberPoliciesResourceGroupsScopeObject = shared.MemberPoliciesResourceGroupsScopeObject

A scope object represents any resource that can have actions applied against invite.

This is an alias to an internal type.

type MemberPolicy

type MemberPolicy = shared.MemberPolicy

This is an alias to an internal type.

type MemberStatus

type MemberStatus = shared.MemberStatus

A member's status in the account.

This is an alias to an internal type.

type MemberUser

type MemberUser = shared.MemberUser

Details of the user associated to the membership.

This is an alias to an internal type.

type Namespace

type Namespace struct {
	// ID of the Workers KV namespace.
	ID string `json:"id" api:"required"`
	// Human-readable string name for a Workers KV namespace.
	Title string `json:"title" api:"required"`
	// Specify the jurisdiction to restrict the KV namespace to durably store data
	// within. Can only be set at namespace creation time.
	Jurisdiction NamespaceJurisdiction `json:"jurisdiction"`
	// The mode of the Workers KV namespace. Specify `instant` when creating a
	// namespace to create a KV Instant namespace. Omit this field when creating a
	// namespace to create a classic namespace. Currently, `instant` is the only
	// supported explicit value.
	Mode NamespaceMode `json:"mode"`
	// True if keys written on the URL will be URL-decoded before storing. For example,
	// if set to "true", a key written on the URL as "%3F" will be stored as "?".
	SupportsURLEncoding bool          `json:"supports_url_encoding"`
	JSON                namespaceJSON `json:"-"`
}

func (*Namespace) UnmarshalJSON

func (r *Namespace) UnmarshalJSON(data []byte) (err error)

type NamespaceBulkDeleteParams

type NamespaceBulkDeleteParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
	Body      []string            `json:"body" api:"required"`
}

func (NamespaceBulkDeleteParams) MarshalJSON

func (r NamespaceBulkDeleteParams) MarshalJSON() (data []byte, err error)

type NamespaceBulkDeleteResponse

type NamespaceBulkDeleteResponse struct {
	// Number of keys successfully written or deleted by the bulk operation.
	SuccessfulKeyCount float64 `json:"successful_key_count"`
	// Names of keys that failed to be written or deleted. Retry the operation for
	// these keys.
	UnsuccessfulKeys []string                        `json:"unsuccessful_keys"`
	JSON             namespaceBulkDeleteResponseJSON `json:"-"`
}

func (*NamespaceBulkDeleteResponse) UnmarshalJSON

func (r *NamespaceBulkDeleteResponse) UnmarshalJSON(data []byte) (err error)

type NamespaceBulkDeleteResponseEnvelope

type NamespaceBulkDeleteResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors" api:"required"`
	Messages []shared.ResponseInfo `json:"messages" api:"required"`
	// Whether the API call was successful.
	Success NamespaceBulkDeleteResponseEnvelopeSuccess `json:"success" api:"required"`
	Result  NamespaceBulkDeleteResponse                `json:"result" api:"nullable"`
	JSON    namespaceBulkDeleteResponseEnvelopeJSON    `json:"-"`
}

func (*NamespaceBulkDeleteResponseEnvelope) UnmarshalJSON

func (r *NamespaceBulkDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type NamespaceBulkDeleteResponseEnvelopeSuccess

type NamespaceBulkDeleteResponseEnvelopeSuccess bool

Whether the API call was successful.

const (
	NamespaceBulkDeleteResponseEnvelopeSuccessTrue NamespaceBulkDeleteResponseEnvelopeSuccess = true
)

func (NamespaceBulkDeleteResponseEnvelopeSuccess) IsKnown

type NamespaceBulkGetParams

type NamespaceBulkGetParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
	// Array of keys to retrieve (maximum of 100).
	Keys param.Field[[]string] `json:"keys" api:"required"`
	// Return values as strings with `text`, or parse stored JSON values with `json`.
	Type param.Field[NamespaceBulkGetParamsType] `json:"type"`
	// Whether to include metadata in the response.
	WithMetadata param.Field[bool] `json:"withMetadata"`
}

func (NamespaceBulkGetParams) MarshalJSON

func (r NamespaceBulkGetParams) MarshalJSON() (data []byte, err error)

type NamespaceBulkGetParamsType

type NamespaceBulkGetParamsType string

Return values as strings with `text`, or parse stored JSON values with `json`.

const (
	NamespaceBulkGetParamsTypeText NamespaceBulkGetParamsType = "text"
	NamespaceBulkGetParamsTypeJson NamespaceBulkGetParamsType = "json"
)

func (NamespaceBulkGetParamsType) IsKnown

func (r NamespaceBulkGetParamsType) IsKnown() bool

type NamespaceBulkGetResponse

type NamespaceBulkGetResponse struct {
	// This field can have the runtime type of
	// [map[string]NamespaceBulkGetResponseWorkersKVBulkGetResultValuesUnion],
	// [map[string]NamespaceBulkGetResponseWorkersKVBulkGetResultWithMetadataValue].
	Values interface{}                  `json:"values"`
	JSON   namespaceBulkGetResponseJSON `json:"-"`
	// contains filtered or unexported fields
}

func (NamespaceBulkGetResponse) AsUnion

AsUnion returns a NamespaceBulkGetResponseUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are NamespaceBulkGetResponseWorkersKVBulkGetResult, NamespaceBulkGetResponseWorkersKVBulkGetResultWithMetadata.

func (*NamespaceBulkGetResponse) UnmarshalJSON

func (r *NamespaceBulkGetResponse) UnmarshalJSON(data []byte) (err error)

type NamespaceBulkGetResponseEnvelope

type NamespaceBulkGetResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors" api:"required"`
	Messages []shared.ResponseInfo `json:"messages" api:"required"`
	// Whether the API call was successful.
	Success NamespaceBulkGetResponseEnvelopeSuccess `json:"success" api:"required"`
	Result  NamespaceBulkGetResponse                `json:"result" api:"nullable"`
	JSON    namespaceBulkGetResponseEnvelopeJSON    `json:"-"`
}

func (*NamespaceBulkGetResponseEnvelope) UnmarshalJSON

func (r *NamespaceBulkGetResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type NamespaceBulkGetResponseEnvelopeSuccess

type NamespaceBulkGetResponseEnvelopeSuccess bool

Whether the API call was successful.

const (
	NamespaceBulkGetResponseEnvelopeSuccessTrue NamespaceBulkGetResponseEnvelopeSuccess = true
)

func (NamespaceBulkGetResponseEnvelopeSuccess) IsKnown

type NamespaceBulkGetResponseUnion

type NamespaceBulkGetResponseUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by NamespaceBulkGetResponseWorkersKVBulkGetResult or NamespaceBulkGetResponseWorkersKVBulkGetResultWithMetadata.

type NamespaceBulkGetResponseWorkersKVBulkGetResult

type NamespaceBulkGetResponseWorkersKVBulkGetResult struct {
	// Requested keys are paired with their values in an object.
	Values map[string]NamespaceBulkGetResponseWorkersKVBulkGetResultValuesUnion `json:"values"`
	JSON   namespaceBulkGetResponseWorkersKVBulkGetResultJSON                   `json:"-"`
}

func (*NamespaceBulkGetResponseWorkersKVBulkGetResult) UnmarshalJSON

func (r *NamespaceBulkGetResponseWorkersKVBulkGetResult) UnmarshalJSON(data []byte) (err error)

type NamespaceBulkGetResponseWorkersKVBulkGetResultValuesMap

type NamespaceBulkGetResponseWorkersKVBulkGetResultValuesMap map[string]interface{}

func (NamespaceBulkGetResponseWorkersKVBulkGetResultValuesMap) ImplementsNamespaceBulkGetResponseWorkersKVBulkGetResultValuesUnion

func (r NamespaceBulkGetResponseWorkersKVBulkGetResultValuesMap) ImplementsNamespaceBulkGetResponseWorkersKVBulkGetResultValuesUnion()

type NamespaceBulkGetResponseWorkersKVBulkGetResultValuesUnion

type NamespaceBulkGetResponseWorkersKVBulkGetResultValuesUnion interface {
	ImplementsNamespaceBulkGetResponseWorkersKVBulkGetResultValuesUnion()
}

The value associated with the key.

Union satisfied by shared.UnionString, shared.UnionFloat, shared.UnionBool or NamespaceBulkGetResponseWorkersKVBulkGetResultValuesMap.

type NamespaceBulkGetResponseWorkersKVBulkGetResultWithMetadata

type NamespaceBulkGetResponseWorkersKVBulkGetResultWithMetadata struct {
	// Requested keys are paired with their values and metadata in an object.
	Values map[string]NamespaceBulkGetResponseWorkersKVBulkGetResultWithMetadataValue `json:"values"`
	JSON   namespaceBulkGetResponseWorkersKVBulkGetResultWithMetadataJSON             `json:"-"`
}

func (*NamespaceBulkGetResponseWorkersKVBulkGetResultWithMetadata) UnmarshalJSON

type NamespaceBulkGetResponseWorkersKVBulkGetResultWithMetadataValue

type NamespaceBulkGetResponseWorkersKVBulkGetResultWithMetadataValue struct {
	// The metadata associated with the key.
	Metadata interface{} `json:"metadata" api:"required"`
	// The value associated with the key.
	Value interface{} `json:"value" api:"required"`
	// Expires the key at a certain time, measured in number of seconds since the UNIX
	// epoch.
	Expiration float64                                                             `json:"expiration"`
	JSON       namespaceBulkGetResponseWorkersKVBulkGetResultWithMetadataValueJSON `json:"-"`
}

func (*NamespaceBulkGetResponseWorkersKVBulkGetResultWithMetadataValue) UnmarshalJSON

type NamespaceBulkUpdateParams

type NamespaceBulkUpdateParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string]             `path:"account_id" api:"required"`
	Body      []NamespaceBulkUpdateParamsBody `json:"body" api:"required"`
}

func (NamespaceBulkUpdateParams) MarshalJSON

func (r NamespaceBulkUpdateParams) MarshalJSON() (data []byte, err error)

type NamespaceBulkUpdateParamsBody

type NamespaceBulkUpdateParamsBody struct {
	// A key's name. The name may be at most 512 bytes. All printable, non-whitespace
	// characters are valid.
	Key param.Field[string] `json:"key" api:"required"`
	// A UTF-8 encoded string to be stored, up to 25 MiB in length.
	Value param.Field[string] `json:"value" api:"required"`
	// Indicates whether or not the server should base64 decode the value before
	// storing it. Useful for writing values that wouldn't otherwise be valid JSON
	// strings, such as images.
	Base64 param.Field[bool] `json:"base64"`
	// Expires the key at a certain time, measured in number of seconds since the UNIX
	// epoch.
	Expiration param.Field[float64] `json:"expiration"`
	// Number of seconds until the key expires. Must be at least 60. Takes precedence
	// over `expiration` when both are specified.
	ExpirationTTL param.Field[float64] `json:"expiration_ttl"`
	// Arbitrary JSON that is associated with a key.
	Metadata param.Field[interface{}] `json:"metadata"`
}

func (NamespaceBulkUpdateParamsBody) MarshalJSON

func (r NamespaceBulkUpdateParamsBody) MarshalJSON() (data []byte, err error)

type NamespaceBulkUpdateResponse

type NamespaceBulkUpdateResponse struct {
	// Number of keys successfully written or deleted by the bulk operation.
	SuccessfulKeyCount float64 `json:"successful_key_count"`
	// Names of keys that failed to be written or deleted. Retry the operation for
	// these keys.
	UnsuccessfulKeys []string                        `json:"unsuccessful_keys"`
	JSON             namespaceBulkUpdateResponseJSON `json:"-"`
}

func (*NamespaceBulkUpdateResponse) UnmarshalJSON

func (r *NamespaceBulkUpdateResponse) UnmarshalJSON(data []byte) (err error)

type NamespaceBulkUpdateResponseEnvelope

type NamespaceBulkUpdateResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors" api:"required"`
	Messages []shared.ResponseInfo `json:"messages" api:"required"`
	// Whether the API call was successful.
	Success NamespaceBulkUpdateResponseEnvelopeSuccess `json:"success" api:"required"`
	Result  NamespaceBulkUpdateResponse                `json:"result" api:"nullable"`
	JSON    namespaceBulkUpdateResponseEnvelopeJSON    `json:"-"`
}

func (*NamespaceBulkUpdateResponseEnvelope) UnmarshalJSON

func (r *NamespaceBulkUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type NamespaceBulkUpdateResponseEnvelopeSuccess

type NamespaceBulkUpdateResponseEnvelopeSuccess bool

Whether the API call was successful.

const (
	NamespaceBulkUpdateResponseEnvelopeSuccessTrue NamespaceBulkUpdateResponseEnvelopeSuccess = true
)

func (NamespaceBulkUpdateResponseEnvelopeSuccess) IsKnown

type NamespaceDeleteParams

type NamespaceDeleteParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
}

type NamespaceDeleteResponse

type NamespaceDeleteResponse struct {
	JSON namespaceDeleteResponseJSON `json:"-"`
}

func (*NamespaceDeleteResponse) UnmarshalJSON

func (r *NamespaceDeleteResponse) UnmarshalJSON(data []byte) (err error)

type NamespaceDeleteResponseEnvelope

type NamespaceDeleteResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors" api:"required"`
	Messages []shared.ResponseInfo `json:"messages" api:"required"`
	// Whether the API call was successful.
	Success NamespaceDeleteResponseEnvelopeSuccess `json:"success" api:"required"`
	Result  NamespaceDeleteResponse                `json:"result" api:"nullable"`
	JSON    namespaceDeleteResponseEnvelopeJSON    `json:"-"`
}

func (*NamespaceDeleteResponseEnvelope) UnmarshalJSON

func (r *NamespaceDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type NamespaceDeleteResponseEnvelopeSuccess

type NamespaceDeleteResponseEnvelopeSuccess bool

Whether the API call was successful.

const (
	NamespaceDeleteResponseEnvelopeSuccessTrue NamespaceDeleteResponseEnvelopeSuccess = true
)

func (NamespaceDeleteResponseEnvelopeSuccess) IsKnown

type NamespaceGetParams

type NamespaceGetParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
}

type NamespaceGetResponseEnvelope

type NamespaceGetResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors" api:"required"`
	Messages []shared.ResponseInfo `json:"messages" api:"required"`
	// Whether the API call was successful.
	Success NamespaceGetResponseEnvelopeSuccess `json:"success" api:"required"`
	Result  Namespace                           `json:"result"`
	JSON    namespaceGetResponseEnvelopeJSON    `json:"-"`
}

func (*NamespaceGetResponseEnvelope) UnmarshalJSON

func (r *NamespaceGetResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type NamespaceGetResponseEnvelopeSuccess

type NamespaceGetResponseEnvelopeSuccess bool

Whether the API call was successful.

const (
	NamespaceGetResponseEnvelopeSuccessTrue NamespaceGetResponseEnvelopeSuccess = true
)

func (NamespaceGetResponseEnvelopeSuccess) IsKnown

type NamespaceJurisdiction added in v7.10.0

type NamespaceJurisdiction string

Specify the jurisdiction to restrict the KV namespace to durably store data within. Can only be set at namespace creation time.

const (
	NamespaceJurisdictionEu      NamespaceJurisdiction = "eu"
	NamespaceJurisdictionFedramp NamespaceJurisdiction = "fedramp"
	NamespaceJurisdictionUs      NamespaceJurisdiction = "us"
)

func (NamespaceJurisdiction) IsKnown added in v7.10.0

func (r NamespaceJurisdiction) IsKnown() bool

type NamespaceKeyBulkDeleteParams

type NamespaceKeyBulkDeleteParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
	Body      []string            `json:"body" api:"required"`
}

func (NamespaceKeyBulkDeleteParams) MarshalJSON

func (r NamespaceKeyBulkDeleteParams) MarshalJSON() (data []byte, err error)

type NamespaceKeyBulkDeleteResponse

type NamespaceKeyBulkDeleteResponse struct {
	// Number of keys successfully written or deleted by the bulk operation.
	SuccessfulKeyCount float64 `json:"successful_key_count"`
	// Names of keys that failed to be written or deleted. Retry the operation for
	// these keys.
	UnsuccessfulKeys []string                           `json:"unsuccessful_keys"`
	JSON             namespaceKeyBulkDeleteResponseJSON `json:"-"`
}

func (*NamespaceKeyBulkDeleteResponse) UnmarshalJSON

func (r *NamespaceKeyBulkDeleteResponse) UnmarshalJSON(data []byte) (err error)

type NamespaceKeyBulkDeleteResponseEnvelope

type NamespaceKeyBulkDeleteResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors" api:"required"`
	Messages []shared.ResponseInfo `json:"messages" api:"required"`
	// Whether the API call was successful.
	Success NamespaceKeyBulkDeleteResponseEnvelopeSuccess `json:"success" api:"required"`
	Result  NamespaceKeyBulkDeleteResponse                `json:"result" api:"nullable"`
	JSON    namespaceKeyBulkDeleteResponseEnvelopeJSON    `json:"-"`
}

func (*NamespaceKeyBulkDeleteResponseEnvelope) UnmarshalJSON

func (r *NamespaceKeyBulkDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type NamespaceKeyBulkDeleteResponseEnvelopeSuccess

type NamespaceKeyBulkDeleteResponseEnvelopeSuccess bool

Whether the API call was successful.

const (
	NamespaceKeyBulkDeleteResponseEnvelopeSuccessTrue NamespaceKeyBulkDeleteResponseEnvelopeSuccess = true
)

func (NamespaceKeyBulkDeleteResponseEnvelopeSuccess) IsKnown

type NamespaceKeyBulkGetParams

type NamespaceKeyBulkGetParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
	// Array of keys to retrieve (maximum of 100).
	Keys param.Field[[]string] `json:"keys" api:"required"`
	// Return values as strings with `text`, or parse stored JSON values with `json`.
	Type param.Field[NamespaceKeyBulkGetParamsType] `json:"type"`
	// Whether to include metadata in the response.
	WithMetadata param.Field[bool] `json:"withMetadata"`
}

func (NamespaceKeyBulkGetParams) MarshalJSON

func (r NamespaceKeyBulkGetParams) MarshalJSON() (data []byte, err error)

type NamespaceKeyBulkGetParamsType

type NamespaceKeyBulkGetParamsType string

Return values as strings with `text`, or parse stored JSON values with `json`.

const (
	NamespaceKeyBulkGetParamsTypeText NamespaceKeyBulkGetParamsType = "text"
	NamespaceKeyBulkGetParamsTypeJson NamespaceKeyBulkGetParamsType = "json"
)

func (NamespaceKeyBulkGetParamsType) IsKnown

func (r NamespaceKeyBulkGetParamsType) IsKnown() bool

type NamespaceKeyBulkGetResponse

type NamespaceKeyBulkGetResponse struct {
	// This field can have the runtime type of
	// [map[string]NamespaceKeyBulkGetResponseWorkersKVBulkGetResultValuesUnion],
	// [map[string]NamespaceKeyBulkGetResponseWorkersKVBulkGetResultWithMetadataValue].
	Values interface{}                     `json:"values"`
	JSON   namespaceKeyBulkGetResponseJSON `json:"-"`
	// contains filtered or unexported fields
}

func (NamespaceKeyBulkGetResponse) AsUnion

AsUnion returns a NamespaceKeyBulkGetResponseUnion interface which you can cast to the specific types for more type safety.

Possible runtime types of the union are NamespaceKeyBulkGetResponseWorkersKVBulkGetResult, NamespaceKeyBulkGetResponseWorkersKVBulkGetResultWithMetadata.

func (*NamespaceKeyBulkGetResponse) UnmarshalJSON

func (r *NamespaceKeyBulkGetResponse) UnmarshalJSON(data []byte) (err error)

type NamespaceKeyBulkGetResponseEnvelope

type NamespaceKeyBulkGetResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors" api:"required"`
	Messages []shared.ResponseInfo `json:"messages" api:"required"`
	// Whether the API call was successful.
	Success NamespaceKeyBulkGetResponseEnvelopeSuccess `json:"success" api:"required"`
	Result  NamespaceKeyBulkGetResponse                `json:"result" api:"nullable"`
	JSON    namespaceKeyBulkGetResponseEnvelopeJSON    `json:"-"`
}

func (*NamespaceKeyBulkGetResponseEnvelope) UnmarshalJSON

func (r *NamespaceKeyBulkGetResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type NamespaceKeyBulkGetResponseEnvelopeSuccess

type NamespaceKeyBulkGetResponseEnvelopeSuccess bool

Whether the API call was successful.

const (
	NamespaceKeyBulkGetResponseEnvelopeSuccessTrue NamespaceKeyBulkGetResponseEnvelopeSuccess = true
)

func (NamespaceKeyBulkGetResponseEnvelopeSuccess) IsKnown

type NamespaceKeyBulkGetResponseUnion

type NamespaceKeyBulkGetResponseUnion interface {
	// contains filtered or unexported methods
}

Union satisfied by NamespaceKeyBulkGetResponseWorkersKVBulkGetResult or NamespaceKeyBulkGetResponseWorkersKVBulkGetResultWithMetadata.

type NamespaceKeyBulkGetResponseWorkersKVBulkGetResult

type NamespaceKeyBulkGetResponseWorkersKVBulkGetResult struct {
	// Requested keys are paired with their values in an object.
	Values map[string]NamespaceKeyBulkGetResponseWorkersKVBulkGetResultValuesUnion `json:"values"`
	JSON   namespaceKeyBulkGetResponseWorkersKVBulkGetResultJSON                   `json:"-"`
}

func (*NamespaceKeyBulkGetResponseWorkersKVBulkGetResult) UnmarshalJSON

func (r *NamespaceKeyBulkGetResponseWorkersKVBulkGetResult) UnmarshalJSON(data []byte) (err error)

type NamespaceKeyBulkGetResponseWorkersKVBulkGetResultValuesMap

type NamespaceKeyBulkGetResponseWorkersKVBulkGetResultValuesMap map[string]interface{}

func (NamespaceKeyBulkGetResponseWorkersKVBulkGetResultValuesMap) ImplementsNamespaceKeyBulkGetResponseWorkersKVBulkGetResultValuesUnion

func (r NamespaceKeyBulkGetResponseWorkersKVBulkGetResultValuesMap) ImplementsNamespaceKeyBulkGetResponseWorkersKVBulkGetResultValuesUnion()

type NamespaceKeyBulkGetResponseWorkersKVBulkGetResultValuesUnion

type NamespaceKeyBulkGetResponseWorkersKVBulkGetResultValuesUnion interface {
	ImplementsNamespaceKeyBulkGetResponseWorkersKVBulkGetResultValuesUnion()
}

The value associated with the key.

Union satisfied by shared.UnionString, shared.UnionFloat, shared.UnionBool or NamespaceKeyBulkGetResponseWorkersKVBulkGetResultValuesMap.

type NamespaceKeyBulkGetResponseWorkersKVBulkGetResultWithMetadata

type NamespaceKeyBulkGetResponseWorkersKVBulkGetResultWithMetadata struct {
	// Requested keys are paired with their values and metadata in an object.
	Values map[string]NamespaceKeyBulkGetResponseWorkersKVBulkGetResultWithMetadataValue `json:"values"`
	JSON   namespaceKeyBulkGetResponseWorkersKVBulkGetResultWithMetadataJSON             `json:"-"`
}

func (*NamespaceKeyBulkGetResponseWorkersKVBulkGetResultWithMetadata) UnmarshalJSON

type NamespaceKeyBulkGetResponseWorkersKVBulkGetResultWithMetadataValue

type NamespaceKeyBulkGetResponseWorkersKVBulkGetResultWithMetadataValue struct {
	// The metadata associated with the key.
	Metadata interface{} `json:"metadata" api:"required"`
	// The value associated with the key.
	Value interface{} `json:"value" api:"required"`
	// Expires the key at a certain time, measured in number of seconds since the UNIX
	// epoch.
	Expiration float64                                                                `json:"expiration"`
	JSON       namespaceKeyBulkGetResponseWorkersKVBulkGetResultWithMetadataValueJSON `json:"-"`
}

func (*NamespaceKeyBulkGetResponseWorkersKVBulkGetResultWithMetadataValue) UnmarshalJSON

type NamespaceKeyBulkUpdateParams

type NamespaceKeyBulkUpdateParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string]                `path:"account_id" api:"required"`
	Body      []NamespaceKeyBulkUpdateParamsBody `json:"body" api:"required"`
}

func (NamespaceKeyBulkUpdateParams) MarshalJSON

func (r NamespaceKeyBulkUpdateParams) MarshalJSON() (data []byte, err error)

type NamespaceKeyBulkUpdateParamsBody

type NamespaceKeyBulkUpdateParamsBody struct {
	// A key's name. The name may be at most 512 bytes. All printable, non-whitespace
	// characters are valid.
	Key param.Field[string] `json:"key" api:"required"`
	// A UTF-8 encoded string to be stored, up to 25 MiB in length.
	Value param.Field[string] `json:"value" api:"required"`
	// Indicates whether or not the server should base64 decode the value before
	// storing it. Useful for writing values that wouldn't otherwise be valid JSON
	// strings, such as images.
	Base64 param.Field[bool] `json:"base64"`
	// Expires the key at a certain time, measured in number of seconds since the UNIX
	// epoch.
	Expiration param.Field[float64] `json:"expiration"`
	// Number of seconds until the key expires. Must be at least 60. Takes precedence
	// over `expiration` when both are specified.
	ExpirationTTL param.Field[float64] `json:"expiration_ttl"`
	// Arbitrary JSON that is associated with a key.
	Metadata param.Field[interface{}] `json:"metadata"`
}

func (NamespaceKeyBulkUpdateParamsBody) MarshalJSON

func (r NamespaceKeyBulkUpdateParamsBody) MarshalJSON() (data []byte, err error)

type NamespaceKeyBulkUpdateResponse

type NamespaceKeyBulkUpdateResponse struct {
	// Number of keys successfully written or deleted by the bulk operation.
	SuccessfulKeyCount float64 `json:"successful_key_count"`
	// Names of keys that failed to be written or deleted. Retry the operation for
	// these keys.
	UnsuccessfulKeys []string                           `json:"unsuccessful_keys"`
	JSON             namespaceKeyBulkUpdateResponseJSON `json:"-"`
}

func (*NamespaceKeyBulkUpdateResponse) UnmarshalJSON

func (r *NamespaceKeyBulkUpdateResponse) UnmarshalJSON(data []byte) (err error)

type NamespaceKeyBulkUpdateResponseEnvelope

type NamespaceKeyBulkUpdateResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors" api:"required"`
	Messages []shared.ResponseInfo `json:"messages" api:"required"`
	// Whether the API call was successful.
	Success NamespaceKeyBulkUpdateResponseEnvelopeSuccess `json:"success" api:"required"`
	Result  NamespaceKeyBulkUpdateResponse                `json:"result" api:"nullable"`
	JSON    namespaceKeyBulkUpdateResponseEnvelopeJSON    `json:"-"`
}

func (*NamespaceKeyBulkUpdateResponseEnvelope) UnmarshalJSON

func (r *NamespaceKeyBulkUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type NamespaceKeyBulkUpdateResponseEnvelopeSuccess

type NamespaceKeyBulkUpdateResponseEnvelopeSuccess bool

Whether the API call was successful.

const (
	NamespaceKeyBulkUpdateResponseEnvelopeSuccessTrue NamespaceKeyBulkUpdateResponseEnvelopeSuccess = true
)

func (NamespaceKeyBulkUpdateResponseEnvelopeSuccess) IsKnown

type NamespaceKeyListParams

type NamespaceKeyListParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
	// Opaque pagination token from `result_info.cursor` in the previous response. Pass
	// it unchanged to request the next page of keys.
	Cursor param.Field[string] `query:"cursor"`
	// Maximum number of keys to return in one response. Pass `result_info.cursor` from
	// the response as `cursor` to request the next page.
	Limit param.Field[float64] `query:"limit"`
	// Filters returned keys by a name prefix. Exact matches and any key names that
	// begin with the prefix will be returned.
	Prefix param.Field[string] `query:"prefix"`
}

func (NamespaceKeyListParams) URLQuery

func (r NamespaceKeyListParams) URLQuery() (v url.Values)

URLQuery serializes NamespaceKeyListParams's query parameters as `url.Values`.

type NamespaceKeyService

type NamespaceKeyService struct {
	Options []option.RequestOption
}

NamespaceKeyService contains methods and other services that help with interacting with the cloudflare API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewNamespaceKeyService method instead.

func NewNamespaceKeyService

func NewNamespaceKeyService(opts ...option.RequestOption) (r *NamespaceKeyService)

NewNamespaceKeyService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*NamespaceKeyService) BulkDelete deprecated

Deletes up to 10,000 key-value pairs from the specified Workers KV namespace. Send a JSON array of the key names to delete. The result reports the number of successful deletions and any keys that failed and should be retried.

Deprecated: Please use kv.namespaces.bulk_delete instead

func (*NamespaceKeyService) BulkGet deprecated

Retrieves the text-based values of up to 100 keys from the specified Workers KV namespace. The result maps each requested key to its value. Set `type` to `json` to parse JSON values instead of returning strings, and set `withMetadata` to `true` to include metadata with each value. Binary values are not supported by this operation.

Deprecated: Please use kv.namespaces.bulk_get instead

func (*NamespaceKeyService) BulkUpdate deprecated

Writes up to 10,000 key-value pairs to the specified Workers KV namespace from a JSON array, with optional metadata and expiration settings for each pair. Existing values and expirations are overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will not expire. If both are set, `expiration_ttl` takes precedence. The entire request must be 100 megabytes or less. The result reports the number of successful writes and any keys that failed and should be retried.

Deprecated: Please use kv.namespaces.bulk_update instead

func (*NamespaceKeyService) List

Lists key names in the specified Workers KV namespace, with expiration times and metadata when present. Use `prefix` to filter names and `cursor` to request the next page. Values are not included.

func (*NamespaceKeyService) ListAutoPaging

Lists key names in the specified Workers KV namespace, with expiration times and metadata when present. Use `prefix` to filter names and `cursor` to request the next page. Values are not included.

type NamespaceListParams

type NamespaceListParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
	// Sort namespaces in ascending (`asc`) or descending (`desc`) order.
	Direction param.Field[NamespaceListParamsDirection] `query:"direction"`
	// Namespace field to sort by (`id` or `title`).
	Order param.Field[NamespaceListParamsOrder] `query:"order"`
	// Page number of paginated results.
	Page param.Field[float64] `query:"page"`
	// Maximum number of results per page.
	PerPage param.Field[float64] `query:"per_page"`
}

func (NamespaceListParams) URLQuery

func (r NamespaceListParams) URLQuery() (v url.Values)

URLQuery serializes NamespaceListParams's query parameters as `url.Values`.

type NamespaceListParamsDirection

type NamespaceListParamsDirection string

Sort namespaces in ascending (`asc`) or descending (`desc`) order.

const (
	NamespaceListParamsDirectionAsc  NamespaceListParamsDirection = "asc"
	NamespaceListParamsDirectionDesc NamespaceListParamsDirection = "desc"
)

func (NamespaceListParamsDirection) IsKnown

func (r NamespaceListParamsDirection) IsKnown() bool

type NamespaceListParamsOrder

type NamespaceListParamsOrder string

Namespace field to sort by (`id` or `title`).

const (
	NamespaceListParamsOrderID    NamespaceListParamsOrder = "id"
	NamespaceListParamsOrderTitle NamespaceListParamsOrder = "title"
)

func (NamespaceListParamsOrder) IsKnown

func (r NamespaceListParamsOrder) IsKnown() bool

type NamespaceMetadataGetParams

type NamespaceMetadataGetParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
}

type NamespaceMetadataGetResponse

type NamespaceMetadataGetResponse = interface{}

type NamespaceMetadataGetResponseEnvelope

type NamespaceMetadataGetResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors" api:"required"`
	Messages []shared.ResponseInfo `json:"messages" api:"required"`
	// Whether the API call was successful.
	Success NamespaceMetadataGetResponseEnvelopeSuccess `json:"success" api:"required"`
	// Arbitrary JSON that is associated with a key.
	Result NamespaceMetadataGetResponse             `json:"result"`
	JSON   namespaceMetadataGetResponseEnvelopeJSON `json:"-"`
}

func (*NamespaceMetadataGetResponseEnvelope) UnmarshalJSON

func (r *NamespaceMetadataGetResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type NamespaceMetadataGetResponseEnvelopeSuccess

type NamespaceMetadataGetResponseEnvelopeSuccess bool

Whether the API call was successful.

const (
	NamespaceMetadataGetResponseEnvelopeSuccessTrue NamespaceMetadataGetResponseEnvelopeSuccess = true
)

func (NamespaceMetadataGetResponseEnvelopeSuccess) IsKnown

type NamespaceMetadataService

type NamespaceMetadataService struct {
	Options []option.RequestOption
}

NamespaceMetadataService contains methods and other services that help with interacting with the cloudflare API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewNamespaceMetadataService method instead.

func NewNamespaceMetadataService

func NewNamespaceMetadataService(opts ...option.RequestOption) (r *NamespaceMetadataService)

NewNamespaceMetadataService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*NamespaceMetadataService) Get

Returns the JSON metadata associated with the specified key in the Workers KV namespace, without retrieving its value. Use URL-encoding for special characters (for example, `:`, `!`, `%`) in the key name when constructing the request URL.

type NamespaceMode

type NamespaceMode string

The mode of the Workers KV namespace. Specify `instant` when creating a namespace to create a KV Instant namespace. Omit this field when creating a namespace to create a classic namespace. Currently, `instant` is the only supported explicit value.

const (
	NamespaceModeInstant NamespaceMode = "instant"
)

func (NamespaceMode) IsKnown

func (r NamespaceMode) IsKnown() bool

type NamespaceNewParams

type NamespaceNewParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
	// Human-readable string name for a Workers KV namespace.
	Title param.Field[string] `json:"title" api:"required"`
	// Specify the jurisdiction to restrict the KV namespace to durably store data
	// within. Can only be set at namespace creation time.
	Jurisdiction param.Field[NamespaceNewParamsJurisdiction] `json:"jurisdiction"`
	// The mode of the Workers KV namespace. Specify `instant` when creating a
	// namespace to create a KV Instant namespace. Omit this field when creating a
	// namespace to create a classic namespace. Currently, `instant` is the only
	// supported explicit value.
	Mode param.Field[NamespaceNewParamsMode] `json:"mode"`
}

func (NamespaceNewParams) MarshalJSON

func (r NamespaceNewParams) MarshalJSON() (data []byte, err error)

type NamespaceNewParamsJurisdiction added in v7.10.0

type NamespaceNewParamsJurisdiction string

Specify the jurisdiction to restrict the KV namespace to durably store data within. Can only be set at namespace creation time.

const (
	NamespaceNewParamsJurisdictionEu      NamespaceNewParamsJurisdiction = "eu"
	NamespaceNewParamsJurisdictionFedramp NamespaceNewParamsJurisdiction = "fedramp"
	NamespaceNewParamsJurisdictionUs      NamespaceNewParamsJurisdiction = "us"
)

func (NamespaceNewParamsJurisdiction) IsKnown added in v7.10.0

type NamespaceNewParamsMode

type NamespaceNewParamsMode string

The mode of the Workers KV namespace. Specify `instant` when creating a namespace to create a KV Instant namespace. Omit this field when creating a namespace to create a classic namespace. Currently, `instant` is the only supported explicit value.

const (
	NamespaceNewParamsModeInstant NamespaceNewParamsMode = "instant"
)

func (NamespaceNewParamsMode) IsKnown

func (r NamespaceNewParamsMode) IsKnown() bool

type NamespaceNewResponseEnvelope

type NamespaceNewResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors" api:"required"`
	Messages []shared.ResponseInfo `json:"messages" api:"required"`
	// Whether the API call was successful.
	Success NamespaceNewResponseEnvelopeSuccess `json:"success" api:"required"`
	Result  Namespace                           `json:"result"`
	JSON    namespaceNewResponseEnvelopeJSON    `json:"-"`
}

func (*NamespaceNewResponseEnvelope) UnmarshalJSON

func (r *NamespaceNewResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type NamespaceNewResponseEnvelopeSuccess

type NamespaceNewResponseEnvelopeSuccess bool

Whether the API call was successful.

const (
	NamespaceNewResponseEnvelopeSuccessTrue NamespaceNewResponseEnvelopeSuccess = true
)

func (NamespaceNewResponseEnvelopeSuccess) IsKnown

type NamespaceService

type NamespaceService struct {
	Options  []option.RequestOption
	Keys     *NamespaceKeyService
	Metadata *NamespaceMetadataService
	Values   *NamespaceValueService
}

NamespaceService contains methods and other services that help with interacting with the cloudflare API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewNamespaceService method instead.

func NewNamespaceService

func NewNamespaceService(opts ...option.RequestOption) (r *NamespaceService)

NewNamespaceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*NamespaceService) BulkDelete

func (r *NamespaceService) BulkDelete(ctx context.Context, namespaceID string, params NamespaceBulkDeleteParams, opts ...option.RequestOption) (res *NamespaceBulkDeleteResponse, err error)

Deletes up to 10,000 key-value pairs from the specified Workers KV namespace. Send a JSON array of the key names to delete. The result reports the number of successful deletions and any keys that failed and should be retried.

func (*NamespaceService) BulkGet

func (r *NamespaceService) BulkGet(ctx context.Context, namespaceID string, params NamespaceBulkGetParams, opts ...option.RequestOption) (res *NamespaceBulkGetResponse, err error)

Retrieves the text-based values of up to 100 keys from the specified Workers KV namespace. The result maps each requested key to its value. Set `type` to `json` to parse JSON values instead of returning strings, and set `withMetadata` to `true` to include metadata with each value. Binary values are not supported by this operation.

func (*NamespaceService) BulkUpdate

func (r *NamespaceService) BulkUpdate(ctx context.Context, namespaceID string, params NamespaceBulkUpdateParams, opts ...option.RequestOption) (res *NamespaceBulkUpdateResponse, err error)

Writes up to 10,000 key-value pairs to the specified Workers KV namespace from a JSON array, with optional metadata and expiration settings for each pair. Existing values and expirations are overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will not expire. If both are set, `expiration_ttl` takes precedence. The entire request must be 100 megabytes or less. The result reports the number of successful writes and any keys that failed and should be retried.

func (*NamespaceService) Delete

func (r *NamespaceService) Delete(ctx context.Context, namespaceID string, body NamespaceDeleteParams, opts ...option.RequestOption) (res *NamespaceDeleteResponse, err error)

Deletes the specified Workers KV namespace and its stored key-value pairs from the account.

func (*NamespaceService) Get

func (r *NamespaceService) Get(ctx context.Context, namespaceID string, query NamespaceGetParams, opts ...option.RequestOption) (res *Namespace, err error)

Returns the Workers KV namespace for the specified account and namespace ID.

func (*NamespaceService) List

Lists Workers KV namespaces owned by the specified account. Use `page` and `per_page` to select a page of results, and `order` and `direction` to control sorting.

func (*NamespaceService) ListAutoPaging

Lists Workers KV namespaces owned by the specified account. Use `page` and `per_page` to select a page of results, and `order` and `direction` to control sorting.

func (*NamespaceService) New

func (r *NamespaceService) New(ctx context.Context, params NamespaceNewParams, opts ...option.RequestOption) (res *Namespace, err error)

Creates a Workers KV namespace in the specified account with the given title. Returns `400` if the account already owns a namespace with that title; an existing namespace must be explicitly deleted before it can be replaced. An optional jurisdiction restricts where data is durably stored and can only be set at creation time.

func (*NamespaceService) Update

func (r *NamespaceService) Update(ctx context.Context, namespaceID string, params NamespaceUpdateParams, opts ...option.RequestOption) (res *Namespace, err error)

Changes the title of the specified Workers KV namespace and returns the updated namespace. The namespace ID and stored key-value pairs are unchanged.

type NamespaceUpdateParams

type NamespaceUpdateParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
	// Human-readable string name for a Workers KV namespace.
	Title param.Field[string] `json:"title" api:"required"`
}

func (NamespaceUpdateParams) MarshalJSON

func (r NamespaceUpdateParams) MarshalJSON() (data []byte, err error)

type NamespaceUpdateResponseEnvelope

type NamespaceUpdateResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors" api:"required"`
	Messages []shared.ResponseInfo `json:"messages" api:"required"`
	Result   Namespace             `json:"result" api:"required"`
	// Whether the API call was successful.
	Success NamespaceUpdateResponseEnvelopeSuccess `json:"success" api:"required"`
	JSON    namespaceUpdateResponseEnvelopeJSON    `json:"-"`
}

func (*NamespaceUpdateResponseEnvelope) UnmarshalJSON

func (r *NamespaceUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type NamespaceUpdateResponseEnvelopeSuccess

type NamespaceUpdateResponseEnvelopeSuccess bool

Whether the API call was successful.

const (
	NamespaceUpdateResponseEnvelopeSuccessTrue NamespaceUpdateResponseEnvelopeSuccess = true
)

func (NamespaceUpdateResponseEnvelopeSuccess) IsKnown

type NamespaceValueDeleteParams

type NamespaceValueDeleteParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
}

type NamespaceValueDeleteResponse

type NamespaceValueDeleteResponse struct {
	JSON namespaceValueDeleteResponseJSON `json:"-"`
}

func (*NamespaceValueDeleteResponse) UnmarshalJSON

func (r *NamespaceValueDeleteResponse) UnmarshalJSON(data []byte) (err error)

type NamespaceValueDeleteResponseEnvelope

type NamespaceValueDeleteResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors" api:"required"`
	Messages []shared.ResponseInfo `json:"messages" api:"required"`
	// Whether the API call was successful.
	Success NamespaceValueDeleteResponseEnvelopeSuccess `json:"success" api:"required"`
	Result  NamespaceValueDeleteResponse                `json:"result" api:"nullable"`
	JSON    namespaceValueDeleteResponseEnvelopeJSON    `json:"-"`
}

func (*NamespaceValueDeleteResponseEnvelope) UnmarshalJSON

func (r *NamespaceValueDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type NamespaceValueDeleteResponseEnvelopeSuccess

type NamespaceValueDeleteResponseEnvelopeSuccess bool

Whether the API call was successful.

const (
	NamespaceValueDeleteResponseEnvelopeSuccessTrue NamespaceValueDeleteResponseEnvelopeSuccess = true
)

func (NamespaceValueDeleteResponseEnvelopeSuccess) IsKnown

type NamespaceValueGetParams

type NamespaceValueGetParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
}

type NamespaceValueService

type NamespaceValueService struct {
	Options []option.RequestOption
}

NamespaceValueService contains methods and other services that help with interacting with the cloudflare API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewNamespaceValueService method instead.

func NewNamespaceValueService

func NewNamespaceValueService(opts ...option.RequestOption) (r *NamespaceValueService)

NewNamespaceValueService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*NamespaceValueService) Delete

Deletes the specified key and its value from the Workers KV namespace. Use URL-encoding for special characters (for example, `:`, `!`, `%`) in the key name when constructing the request URL.

func (*NamespaceValueService) Get

func (r *NamespaceValueService) Get(ctx context.Context, namespaceID string, keyName string, query NamespaceValueGetParams, opts ...option.RequestOption) (res *http.Response, err error)

Returns the value stored under the specified key in the Workers KV namespace as raw bytes. Use URL-encoding for special characters (for example, `:`, `!`, `%`) in the key name when constructing the request URL. If the key-value pair expires, the `expiration` response header contains its expiration time in seconds since the UNIX epoch.

func (*NamespaceValueService) Update

func (r *NamespaceValueService) Update(ctx context.Context, namespaceID string, keyName string, params NamespaceValueUpdateParams, opts ...option.RequestOption) (res *NamespaceValueUpdateResponse, err error)

Writes a value under the specified key in the Workers KV namespace, creating the key-value pair or replacing its existing value, expiration, and metadata. Send the value as an `application/octet-stream` request body, or use `multipart/form-data` with a `value` part and an optional JSON `metadata` part. Use URL-encoding for special characters (for example, `:`, `!`, `%`) in the key name when constructing the request URL. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will not expire. If both are set, `expiration_ttl` takes precedence.

type NamespaceValueUpdateParams

type NamespaceValueUpdateParams struct {
	// ID of the Cloudflare account that owns the Workers KV namespaces.
	AccountID param.Field[string] `path:"account_id" api:"required"`
	// A byte sequence to be stored, up to 25 MiB in length.
	Value param.Field[NamespaceValueUpdateParamsValueUnion] `json:"value" api:"required" format:"binary"`
	// Expires the key at a certain time, measured in number of seconds since the UNIX
	// epoch.
	Expiration param.Field[float64] `query:"expiration"`
	// Number of seconds until the key expires. Must be at least 60. Takes precedence
	// over `expiration` when both are specified.
	ExpirationTTL param.Field[float64] `query:"expiration_ttl"`
	// Associates arbitrary JSON data with a key/value pair.
	Metadata param.Field[interface{}] `json:"metadata"`
}

func (NamespaceValueUpdateParams) MarshalMultipart

func (r NamespaceValueUpdateParams) MarshalMultipart() (data []byte, contentType string, err error)

func (NamespaceValueUpdateParams) URLQuery

func (r NamespaceValueUpdateParams) URLQuery() (v url.Values)

URLQuery serializes NamespaceValueUpdateParams's query parameters as `url.Values`.

type NamespaceValueUpdateParamsValueUnion

type NamespaceValueUpdateParamsValueUnion interface {
	ImplementsNamespaceValueUpdateParamsValueUnion()
}

A byte sequence to be stored, up to 25 MiB in length.

Satisfied by shared.UnionString, shared.UnionString.

type NamespaceValueUpdateResponse

type NamespaceValueUpdateResponse struct {
	JSON namespaceValueUpdateResponseJSON `json:"-"`
}

func (*NamespaceValueUpdateResponse) UnmarshalJSON

func (r *NamespaceValueUpdateResponse) UnmarshalJSON(data []byte) (err error)

type NamespaceValueUpdateResponseEnvelope

type NamespaceValueUpdateResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors" api:"required"`
	Messages []shared.ResponseInfo `json:"messages" api:"required"`
	// Whether the API call was successful.
	Success NamespaceValueUpdateResponseEnvelopeSuccess `json:"success" api:"required"`
	Result  NamespaceValueUpdateResponse                `json:"result" api:"nullable"`
	JSON    namespaceValueUpdateResponseEnvelopeJSON    `json:"-"`
}

func (*NamespaceValueUpdateResponseEnvelope) UnmarshalJSON

func (r *NamespaceValueUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type NamespaceValueUpdateResponseEnvelopeSuccess

type NamespaceValueUpdateResponseEnvelopeSuccess bool

Whether the API call was successful.

const (
	NamespaceValueUpdateResponseEnvelopeSuccessTrue NamespaceValueUpdateResponseEnvelopeSuccess = true
)

func (NamespaceValueUpdateResponseEnvelopeSuccess) IsKnown

type Permission

type Permission = shared.Permission

This is an alias to an internal type.

type PermissionGrant

type PermissionGrant = shared.PermissionGrant

This is an alias to an internal type.

type PermissionGrantParam

type PermissionGrantParam = shared.PermissionGrantParam

This is an alias to an internal type.

type RatePlan

type RatePlan = shared.RatePlan

The rate plan applied to the subscription.

This is an alias to an internal type.

type RatePlanID

type RatePlanID = shared.RatePlanID

The ID of the rate plan.

This is an alias to an internal type.

type RatePlanParam

type RatePlanParam = shared.RatePlanParam

The rate plan applied to the subscription.

This is an alias to an internal type.

type ResponseInfo

type ResponseInfo = shared.ResponseInfo

This is an alias to an internal type.

type ResponseInfoSource

type ResponseInfoSource = shared.ResponseInfoSource

This is an alias to an internal type.

type Role

type Role = shared.Role

This is an alias to an internal type.

type RoleParam

type RoleParam = shared.RoleParam

This is an alias to an internal type.

type RolePermissions

type RolePermissions = shared.RolePermissions

This is an alias to an internal type.

type RolePermissionsParam

type RolePermissionsParam = shared.RolePermissionsParam

This is an alias to an internal type.

type SortDirection

type SortDirection = shared.SortDirection

Direction to order DNS records in.

This is an alias to an internal type.

type Subscription

type Subscription = shared.Subscription

This is an alias to an internal type.

type SubscriptionFrequency

type SubscriptionFrequency = shared.SubscriptionFrequency

How often the subscription is renewed automatically.

This is an alias to an internal type.

type SubscriptionParam

type SubscriptionParam = shared.SubscriptionParam

This is an alias to an internal type.

type SubscriptionState

type SubscriptionState = shared.SubscriptionState

The state that the subscription is in.

This is an alias to an internal type.

type Token

type Token = shared.Token

This is an alias to an internal type.

type TokenCondition

type TokenCondition = shared.TokenCondition

This is an alias to an internal type.

type TokenConditionCIDRList

type TokenConditionCIDRList = shared.TokenConditionCIDRList

IPv4/IPv6 CIDR.

This is an alias to an internal type.

type TokenConditionCIDRListParam

type TokenConditionCIDRListParam = shared.TokenConditionCIDRListParam

IPv4/IPv6 CIDR.

This is an alias to an internal type.

type TokenConditionParam

type TokenConditionParam = shared.TokenConditionParam

This is an alias to an internal type.

type TokenConditionRequestIP

type TokenConditionRequestIP = shared.TokenConditionRequestIP

Client IP restrictions.

This is an alias to an internal type.

type TokenConditionRequestIPParam

type TokenConditionRequestIPParam = shared.TokenConditionRequestIPParam

Client IP restrictions.

This is an alias to an internal type.

type TokenParam

type TokenParam = shared.TokenParam

This is an alias to an internal type.

type TokenPolicy

type TokenPolicy = shared.TokenPolicy

This is an alias to an internal type.

type TokenPolicyEffect

type TokenPolicyEffect = shared.TokenPolicyEffect

Allow or deny operations against the resources.

This is an alias to an internal type.

type TokenPolicyParam

type TokenPolicyParam = shared.TokenPolicyParam

This is an alias to an internal type.

type TokenPolicyPermissionGroup

type TokenPolicyPermissionGroup = shared.TokenPolicyPermissionGroup

A named group of permissions that map to a group of operations against resources.

This is an alias to an internal type.

type TokenPolicyPermissionGroupParam

type TokenPolicyPermissionGroupParam = shared.TokenPolicyPermissionGroupParam

A named group of permissions that map to a group of operations against resources.

This is an alias to an internal type.

type TokenPolicyPermissionGroupsMeta

type TokenPolicyPermissionGroupsMeta = shared.TokenPolicyPermissionGroupsMeta

Attributes associated to the permission group.

This is an alias to an internal type.

type TokenPolicyPermissionGroupsMetaParam

type TokenPolicyPermissionGroupsMetaParam = shared.TokenPolicyPermissionGroupsMetaParam

Attributes associated to the permission group.

This is an alias to an internal type.

type TokenPolicyResourcesIAMResourcesTypeObjectNested

type TokenPolicyResourcesIAMResourcesTypeObjectNested = shared.TokenPolicyResourcesIAMResourcesTypeObjectNested

Map of nested resource permissions

This is an alias to an internal type.

type TokenPolicyResourcesIAMResourcesTypeObjectNestedParam

type TokenPolicyResourcesIAMResourcesTypeObjectNestedParam = shared.TokenPolicyResourcesIAMResourcesTypeObjectNestedParam

Map of nested resource permissions

This is an alias to an internal type.

type TokenPolicyResourcesIAMResourcesTypeObjectString

type TokenPolicyResourcesIAMResourcesTypeObjectString = shared.TokenPolicyResourcesIAMResourcesTypeObjectString

Map of simple string resource permissions

This is an alias to an internal type.

type TokenPolicyResourcesIAMResourcesTypeObjectStringParam

type TokenPolicyResourcesIAMResourcesTypeObjectStringParam = shared.TokenPolicyResourcesIAMResourcesTypeObjectStringParam

Map of simple string resource permissions

This is an alias to an internal type.

type TokenPolicyResourcesUnion

type TokenPolicyResourcesUnion = shared.TokenPolicyResourcesUnion

A list of resource names that the policy applies to.

This is an alias to an internal type.

type TokenPolicyResourcesUnionParam

type TokenPolicyResourcesUnionParam = shared.TokenPolicyResourcesUnionParam

A list of resource names that the policy applies to.

This is an alias to an internal type.

type TokenStatus

type TokenStatus = shared.TokenStatus

Status of the token.

This is an alias to an internal type.

type TokenValue

type TokenValue = shared.TokenValue

The token value.

This is an alias to an internal type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL