cloudflare
Version:
The official TypeScript library for the Cloudflare API
109 lines • 3.87 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { V4PagePaginationArray, } from "../../../core/pagination.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseIPProfiles = /* @__PURE__ */ (() => {
class BaseIPProfiles extends APIResource {
/**
* Creates a WARP Device IP profile. Currently, only IPv4 Device subnets can be
* associated.
*
* @example
* ```ts
* const ipProfile =
* await client.zeroTrust.devices.ipProfiles.create({
* account_id: 'account_id',
* match: 'identity.email == "test@cloudflare.com"',
* name: 'IPv4 Cloudflare Source IPs',
* precedence: 100,
* subnet_id: 'b70ff985-a4ef-4643-bbbc-4a0ed4fc8415',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/devices/ip-profiles`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Updates a WARP Device IP profile. Currently, only IPv4 Device subnets can be
* associated.
*
* @example
* ```ts
* const ipProfile =
* await client.zeroTrust.devices.ipProfiles.update(
* 'profile_id',
* { account_id: 'account_id' },
* );
* ```
*/
update(profileID, params, options) {
const { account_id, ...body } = params;
return this._client.patch(path `/accounts/${account_id}/devices/ip-profiles/${profileID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists WARP Device IP profiles.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const ipProfile of client.zeroTrust.devices.ipProfiles.list(
* { account_id: 'account_id' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList(path `/accounts/${account_id}/devices/ip-profiles`, (V4PagePaginationArray), { query, ...options });
}
/**
* Delete a WARP Device IP profile.
*
* @example
* ```ts
* const ipProfile =
* await client.zeroTrust.devices.ipProfiles.delete(
* 'profile_id',
* { account_id: 'account_id' },
* );
* ```
*/
delete(profileID, params, options) {
const { account_id } = params;
return this._client.delete(path `/accounts/${account_id}/devices/ip-profiles/${profileID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Fetches a single WARP Device IP profile.
*
* @example
* ```ts
* const ipProfile =
* await client.zeroTrust.devices.ipProfiles.get(
* 'profile_id',
* { account_id: 'account_id' },
* );
* ```
*/
get(profileID, params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/devices/ip-profiles/${profileID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseIPProfiles._key = Object.freeze([
'zeroTrust',
'devices',
'ipProfiles',
]);
return BaseIPProfiles;
})();
export class IPProfiles extends BaseIPProfiles {
}
//# sourceMappingURL=ip-profiles.mjs.map