cloudflare
Version:
The official TypeScript library for the Cloudflare API
108 lines • 4.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HostnameRoutes = exports.BaseHostnameRoutes = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const pagination_1 = require("../../../core/pagination.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseHostnameRoutes = /* @__PURE__ */ (() => {
class BaseHostnameRoutes extends resource_1.APIResource {
/**
* Create a hostname route.
*
* @example
* ```ts
* const hostnameRoute =
* await client.zeroTrust.networks.hostnameRoutes.create({
* account_id: '699d98642c564d2e855e9661899b7252',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/zerotrust/routes/hostname`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists and filters hostname routes in an account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const hostnameRoute of client.zeroTrust.networks.hostnameRoutes.list(
* { account_id: '699d98642c564d2e855e9661899b7252' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/zerotrust/routes/hostname`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Delete a hostname route.
*
* @example
* ```ts
* const hostnameRoute =
* await client.zeroTrust.networks.hostnameRoutes.delete(
* 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* );
* ```
*/
delete(hostnameRouteID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/zerotrust/routes/hostname/${hostnameRouteID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Updates a hostname route.
*
* @example
* ```ts
* const hostnameRoute =
* await client.zeroTrust.networks.hostnameRoutes.edit(
* 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* );
* ```
*/
edit(hostnameRouteID, params, options) {
const { account_id, ...body } = params;
return this._client.patch((0, path_1.path) `/accounts/${account_id}/zerotrust/routes/hostname/${hostnameRouteID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Get a hostname route.
*
* @example
* ```ts
* const hostnameRoute =
* await client.zeroTrust.networks.hostnameRoutes.get(
* 'f70ff985-a4ef-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* );
* ```
*/
get(hostnameRouteID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/zerotrust/routes/hostname/${hostnameRouteID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseHostnameRoutes._key = Object.freeze([
'zeroTrust',
'networks',
'hostnameRoutes',
]);
return BaseHostnameRoutes;
})();
exports.BaseHostnameRoutes = BaseHostnameRoutes;
class HostnameRoutes extends BaseHostnameRoutes {
}
exports.HostnameRoutes = HostnameRoutes;
//# sourceMappingURL=hostname-routes.js.map