cloudflare
Version:
The official TypeScript library for the Cloudflare API
91 lines (79 loc) • 2.53 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 OpportunisticEncryptionAPI from "./opportunistic-encryption";
export class OpportunisticEncryption extends APIResource {
/**
* Changes Opportunistic Encryption setting.
*/
edit(
params: OpportunisticEncryptionEditParams,
options?: Core.RequestOptions,
): Core.APIPromise<ZoneSettingOpportunisticEncryption> {
const { zone_id, ...body } = params;
return (
this._client.patch(`/zones/${zone_id}/settings/opportunistic_encryption`, {
body,
...options,
}) as Core.APIPromise<{ result: ZoneSettingOpportunisticEncryption }>
)._thenUnwrap((obj) => obj.result);
}
/**
* Gets Opportunistic Encryption setting.
*/
get(
params: OpportunisticEncryptionGetParams,
options?: Core.RequestOptions,
): Core.APIPromise<ZoneSettingOpportunisticEncryption> {
const { zone_id } = params;
return (
this._client.get(`/zones/${zone_id}/settings/opportunistic_encryption`, options) as Core.APIPromise<{
result: ZoneSettingOpportunisticEncryption;
}>
)._thenUnwrap((obj) => obj.result);
}
}
/**
* Enables the Opportunistic Encryption feature for a zone.
*/
export interface ZoneSettingOpportunisticEncryption {
/**
* ID of the zone setting.
*/
id: 'opportunistic_encryption';
/**
* Current value of the zone setting.
*/
value: 'on' | 'off';
/**
* Whether or not this setting can be modified for this zone (based on your
* Cloudflare plan level).
*/
editable?: true | false;
/**
* last time this setting was modified.
*/
modified_on?: string | null;
}
export interface OpportunisticEncryptionEditParams {
/**
* Path param: Identifier
*/
zone_id: string;
/**
* Body param: Value of the zone setting. Notes: Default value depends on the
* zone's plan level.
*/
value: 'on' | 'off';
}
export interface OpportunisticEncryptionGetParams {
/**
* Identifier
*/
zone_id: string;
}
export namespace OpportunisticEncryption {
export import ZoneSettingOpportunisticEncryption = OpportunisticEncryptionAPI.ZoneSettingOpportunisticEncryption;
export import OpportunisticEncryptionEditParams = OpportunisticEncryptionAPI.OpportunisticEncryptionEditParams;
export import OpportunisticEncryptionGetParams = OpportunisticEncryptionAPI.OpportunisticEncryptionGetParams;
}