cloudflare
Version:
The official TypeScript library for the Cloudflare API
95 lines • 3.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OwnershipResource = exports.BaseOwnershipResource = 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 headers_1 = require("../../../internal/headers.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseOwnershipResource = /* @__PURE__ */ (() => {
class BaseOwnershipResource extends resource_1.APIResource {
/**
* Adds an AWS or GCP bucket to use with full packet captures.
*
* @example
* ```ts
* const ownership =
* await client.magicTransit.pcaps.ownership.create({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* destination_conf: 's3://pcaps-bucket?region=us-east-1',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/pcaps/ownership`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Deletes buckets added to the packet captures API.
*
* @example
* ```ts
* await client.magicTransit.pcaps.ownership.delete(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(ownershipID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/pcaps/ownership/${ownershipID}`, {
...options,
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
});
}
/**
* List all buckets configured for use with PCAPs API.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const ownership of client.magicTransit.pcaps.ownership.get(
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
get(params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/pcaps/ownership`, (pagination_1.SinglePage), options);
}
/**
* Validates buckets added to the packet captures API.
*
* @example
* ```ts
* const ownership =
* await client.magicTransit.pcaps.ownership.validate({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* destination_conf: 's3://pcaps-bucket?region=us-east-1',
* ownership_challenge:
* 'ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt',
* });
* ```
*/
validate(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/pcaps/ownership/validate`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseOwnershipResource._key = Object.freeze([
'magicTransit',
'pcaps',
'ownership',
]);
return BaseOwnershipResource;
})();
exports.BaseOwnershipResource = BaseOwnershipResource;
class OwnershipResource extends BaseOwnershipResource {
}
exports.OwnershipResource = OwnershipResource;
//# sourceMappingURL=ownership.js.map