cloudflare
Version:
The official TypeScript library for the Cloudflare API
124 lines (111 loc) • 2.92 kB
text/typescript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import * as Core from "../../../core";
import { APIResource } from "../../../resource";
import * as ByTagAPI from "./by-tag";
import * as RulesAPI from "../rules";
export class ByTag extends APIResource {
/**
* Fetches the rules of a managed account ruleset version for a given tag.
*/
get(
rulesetId: string,
rulesetVersion: string,
ruleTag: string,
params: ByTagGetParams,
options?: Core.RequestOptions,
): Core.APIPromise<ByTagGetResponse> {
const { account_id } = params;
return (
this._client.get(
`/accounts/${account_id}/rulesets/${rulesetId}/versions/${rulesetVersion}/by_tag/${ruleTag}`,
options,
) as Core.APIPromise<{ result: ByTagGetResponse }>
)._thenUnwrap((obj) => obj.result);
}
}
/**
* A ruleset object.
*/
export interface ByTagGetResponse {
/**
* The unique ID of the ruleset.
*/
id: string;
/**
* The kind of the ruleset.
*/
kind: 'managed' | 'custom' | 'root' | 'zone';
/**
* The timestamp of when the ruleset was last modified.
*/
last_updated: string;
/**
* The human-readable name of the ruleset.
*/
name: string;
/**
* The phase of the ruleset.
*/
phase:
| 'ddos_l4'
| 'ddos_l7'
| 'http_config_settings'
| 'http_custom_errors'
| 'http_log_custom_fields'
| 'http_ratelimit'
| 'http_request_cache_settings'
| 'http_request_dynamic_redirect'
| 'http_request_firewall_custom'
| 'http_request_firewall_managed'
| 'http_request_late_transform'
| 'http_request_origin'
| 'http_request_redirect'
| 'http_request_sanitize'
| 'http_request_sbfm'
| 'http_request_select_configuration'
| 'http_request_transform'
| 'http_response_compression'
| 'http_response_firewall_managed'
| 'http_response_headers_transform'
| 'magic_transit'
| 'magic_transit_ids_managed'
| 'magic_transit_managed';
/**
* The list of rules in the ruleset.
*/
rules: Array<
| RulesAPI.BlockRule
| RulesAPI.ChallengeRule
| RulesAPI.CompressResponseRule
| RulesAPI.ExecuteRule
| RulesAPI.JSChallengeRule
| RulesAPI.LogRule
| RulesAPI.ManagedChallengeRule
| RulesAPI.RedirectRule
| RulesAPI.RewriteRule
| RulesAPI.RouteRule
| RulesAPI.ScoreRule
| RulesAPI.ServeErrorRule
| RulesAPI.SetConfigRule
| RulesAPI.SkipRule
| RulesAPI.SetCacheSettingsRule
>;
/**
* The version of the ruleset.
*/
version: string;
/**
* An informative description of the ruleset.
*/
description?: string;
}
export interface ByTagGetParams {
/**
* The unique ID of the account.
*/
account_id: string;
}
export namespace ByTag {
export import ByTagGetResponse = ByTagAPI.ByTagGetResponse;
export import ByTagGetParams = ByTagAPI.ByTagGetParams;
}