cloudflare
Version:
The official TypeScript library for the Cloudflare API
59 lines • 2.29 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
import * as ACLsAPI from 'cloudflare/resources/magic-transit/sites/acls';
import * as LANsAPI from 'cloudflare/resources/magic-transit/sites/lans';
import * as WANsAPI from 'cloudflare/resources/magic-transit/sites/wans';
export class Sites extends APIResource {
constructor() {
super(...arguments);
this.acls = new ACLsAPI.ACLs(this._client);
this.lans = new LANsAPI.LANs(this._client);
this.wans = new WANsAPI.WANs(this._client);
}
/**
* Creates a new Site
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(`/accounts/${account_id}/magic/sites`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Update a specific Site.
*/
update(siteId, params, options) {
const { account_id, ...body } = params;
return this._client.put(`/accounts/${account_id}/magic/sites/${siteId}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists Sites associated with an account. Use connector_identifier query param to
* return sites where connector_identifier matches either site.ConnectorID or
* site.SecondaryConnectorID.
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.get(`/accounts/${account_id}/magic/sites`, { query, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Remove a specific Site.
*/
delete(siteId, params, options) {
const { account_id } = params;
return this._client.delete(`/accounts/${account_id}/magic/sites/${siteId}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Get a specific Site.
*/
get(siteId, params, options) {
const { account_id } = params;
return this._client.get(`/accounts/${account_id}/magic/sites/${siteId}`, options)._thenUnwrap((obj) => obj.result);
}
}
(function (Sites) {
Sites.ACLs = ACLsAPI.ACLs;
Sites.LANs = LANsAPI.LANs;
Sites.WANs = WANsAPI.WANs;
})(Sites || (Sites = {}));
//# sourceMappingURL=sites.mjs.map