UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

179 lines • 5.19 kB
import { APIResource } from "../../../../core/resource.js"; import { APIPromise } from "../../../../core/api-promise.js"; import { RequestOptions } from "../../../../internal/request-options.js"; export declare class BaseRules extends APIResource { static readonly _key: readonly ['zones', 'observability', 'tracing', 'rules']; /** * Replace all sampling overrides in a zone's managed Cloudflare Traces ruleset. * Rules are evaluated in the supplied order. * * @example * ```ts * const rule = * await client.zones.observability.tracing.rules.update({ * zone_id: 'zone_id', * rules: [ * { * action: 'set_trace_settings', * action_parameters: { sampling_ratio: 0 }, * description: 'description', * enabled: true, * expression: 'x', * }, * ], * }); * ``` */ update(params: RuleUpdateParams, options?: RequestOptions): APIPromise<RuleUpdateResponse>; /** * Delete every sampling override from a zone's managed Cloudflare Traces ruleset. * * @example * ```ts * const rule = * await client.zones.observability.tracing.rules.delete({ * zone_id: 'zone_id', * }); * ``` */ delete(params: RuleDeleteParams, options?: RequestOptions): APIPromise<RuleDeleteResponse>; /** * Retrieve the ordered sampling overrides for a zone's managed Cloudflare Traces * ruleset. * * @example * ```ts * const rule = * await client.zones.observability.tracing.rules.get({ * zone_id: 'zone_id', * }); * ``` */ get(params: RuleGetParams, options?: RequestOptions): APIPromise<RuleGetResponse>; } export declare class Rules extends BaseRules { } export interface RuleUpdateResponse { /** * Trace rules in evaluation order. */ rules: Array<RuleUpdateResponse.Rule>; } export declare namespace RuleUpdateResponse { interface Rule { action: 'set_trace_settings'; action_parameters: Rule.ActionParameters; description: string; enabled: boolean; /** * A Rules language expression that selects requests. */ expression: string; } namespace Rule { interface ActionParameters { /** * The ratio of requests sampled for tracing, from 0 to 1. */ sampling_ratio: number; } } } export interface RuleDeleteResponse { /** * Trace rules in evaluation order. */ rules: Array<RuleDeleteResponse.Rule>; } export declare namespace RuleDeleteResponse { interface Rule { action: 'set_trace_settings'; action_parameters: Rule.ActionParameters; description: string; enabled: boolean; /** * A Rules language expression that selects requests. */ expression: string; } namespace Rule { interface ActionParameters { /** * The ratio of requests sampled for tracing, from 0 to 1. */ sampling_ratio: number; } } } export interface RuleGetResponse { /** * Trace rules in evaluation order. */ rules: Array<RuleGetResponse.Rule>; } export declare namespace RuleGetResponse { interface Rule { action: 'set_trace_settings'; action_parameters: Rule.ActionParameters; description: string; enabled: boolean; /** * A Rules language expression that selects requests. */ expression: string; } namespace Rule { interface ActionParameters { /** * The ratio of requests sampled for tracing, from 0 to 1. */ sampling_ratio: number; } } } export interface RuleUpdateParams { /** * Path param: Specify the zone ID. */ zone_id: string; /** * Body param: Trace rules in evaluation order. */ rules: Array<RuleUpdateParams.Rule>; } export declare namespace RuleUpdateParams { interface Rule { action: 'set_trace_settings'; action_parameters: Rule.ActionParameters; description: string; enabled: boolean; /** * A Rules language expression that selects requests. */ expression: string; } namespace Rule { interface ActionParameters { /** * The ratio of requests sampled for tracing, from 0 to 1. */ sampling_ratio: number; } } } export interface RuleDeleteParams { /** * Specify the zone ID. */ zone_id: string; } export interface RuleGetParams { /** * Specify the zone ID. */ zone_id: string; } export declare namespace Rules { export { type RuleUpdateResponse as RuleUpdateResponse, type RuleDeleteResponse as RuleDeleteResponse, type RuleGetResponse as RuleGetResponse, type RuleUpdateParams as RuleUpdateParams, type RuleDeleteParams as RuleDeleteParams, type RuleGetParams as RuleGetParams, }; } //# sourceMappingURL=rules.d.ts.map