Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
feat(api): add Argo Tunnels endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
akowalsk authored and terinjokes committed Sep 22, 2021
1 parent 7170ef3 commit b168f5d
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const proxy = require('./lib/proxy');

/* eslint-disable global-require */
const resources = {
argoTunnels: require('./lib/resources/ArgoTunnels'),
dnsRecords: require('./lib/resources/DNSRecords'),
enterpriseZoneWorkersScripts: require('./lib/resources/EnterpriseZoneWorkersScripts'),
enterpriseZoneWorkersRoutes: require('./lib/resources/EnterpriseZoneWorkersRoutes'),
Expand Down
90 changes: 90 additions & 0 deletions lib/resources/ArgoTunnels.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Copyright (C) 2014-present Cloudflare, Inc.
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/

'use strict';

const prototypal = require('es-class');
const auto = require('autocreate');

const Resource = require('../Resource');
const method = require('../method');

/**
* Argo Tunnels represents the /accounts/:accountId/tunnels API endpoint.
*
* @class ArgoTunnels
* @hideconstructor
* @extends Resource
*/
module.exports = auto(
prototypal({
extends: Resource,
path: 'accounts/:accountId/tunnels',

includeBasic: ['browse', 'read', 'add', 'del'],

/**
* clean removes stale connection resources from an Argo Tunnel
*
* @function clean
* @memberof ArgoTunnels
* @instance
* @async
* @param {string} accountId - The account ID
* @param {string} id - The tunnel ID being modified
* @returns {Promise<Object>} The response object.
*/
clean: method({
method: 'DELETE',
path: ':id/connections',
}),

/**
* browse allows for listing all Argo Tunnels for an account
*
* @function browse
* @memberof ArgoTunnels
* @instance
* @async
* @param {string} accountId - The account ID
* @returns {Promise<Object>} The Argo Tunnels response object.
*/
/**
* read allows for retrieving the specified Argo Tunnel
*
* @function read
* @memberof ArgoTunnels
* @instance
* @async
* @param {string} accountId - The account ID
* @param {string} id - The Argo Tunnel ID
* @returns {Promise<Object>} The Argo Tunnel object.
*/
/**
* add allows for creating a new Argo Tunnel for an account.
*
* @function add
* @memberof ArgoTunnels
* @instance
* @async
* @param {string} accountId - The account ID
* @param {Object} tunnel - The new Argo Tunnel object
* @returns {Promise<Object>} The created Argo Tunnel object.
*/
/**
* del allows for deleting the specified Tunnel
*
* @function del
* @memberof ArgoTunnels
* @instance
* @async
* @param {string} accountId - The account ID
* @param {string} id - The Argo Tunnel ID
* @returns {Promise<Object>} The deleted Argo Tunnel object.
*/
})
);

0 comments on commit b168f5d

Please sign in to comment.