@clevercloud/client
Advanced tools
Comparing version 8.2.0 to 8.3.0
@@ -798,3 +798,2 @@ "use strict"; | ||
* @param {String} params.appId | ||
* @param {String} params.payment | ||
* @param {Object} body | ||
@@ -813,3 +812,3 @@ */ | ||
}, | ||
queryParams: (0, _pickNonNull.pickNonNull)(params, ['payment']), | ||
// no query params | ||
body | ||
@@ -816,0 +815,0 @@ }); |
@@ -372,2 +372,9 @@ "use strict"; | ||
}, | ||
udpRedirs: { | ||
get: prepareRequest(organisation.listApplicationUDPRedirections, ['id', 'appId']), | ||
post: prepareRequest(organisation.createApplicationUDPRedirection, ['id', 'appId']), | ||
_: { | ||
delete: prepareRequest(organisation.deleteApplicationUDPRedirection, ['id', 'appId', 'sourcePort']) | ||
} | ||
}, | ||
vhosts: { | ||
@@ -374,0 +381,0 @@ get: prepareRequest(application.getAllDomains, ['id', 'appId']), |
@@ -12,2 +12,5 @@ "use strict"; | ||
exports.updateApplicationTags = updateApplicationTags; | ||
exports.listApplicationUDPRedirections = listApplicationUDPRedirections; | ||
exports.createApplicationUDPRedirection = createApplicationUDPRedirection; | ||
exports.deleteApplicationUDPRedirection = deleteApplicationUDPRedirection; | ||
exports.updateAvatar = updateAvatar; | ||
@@ -181,2 +184,66 @@ exports.getConsumptions = getConsumptions; | ||
/** | ||
* GET /organisations/{id}/applications/{appId}/udpRedirs | ||
* @param {Object} params | ||
* @param {String} params.id | ||
* @param {String} params.appId | ||
*/ | ||
function listApplicationUDPRedirections(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'get', | ||
url: `/v2/organisations/${params.id}/applications/${params.appId}/udpRedirs`, | ||
headers: { | ||
Accept: 'application/json' | ||
} // no query params | ||
// no body | ||
}); | ||
} | ||
/** | ||
* POST /organisations/{id}/applications/{appId}/udpRedirs | ||
* @param {Object} params | ||
* @param {String} params.id | ||
* @param {String} params.appId | ||
* @param {Object} body | ||
*/ | ||
function createApplicationUDPRedirection(params, body) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'post', | ||
url: `/v2/organisations/${params.id}/applications/${params.appId}/udpRedirs`, | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json' | ||
}, | ||
// no query params | ||
body | ||
}); | ||
} | ||
/** | ||
* DELETE /organisations/{id}/applications/{appId}/udpRedirs/{sourcePort} | ||
* @param {Object} params | ||
* @param {String} params.id | ||
* @param {String} params.appId | ||
* @param {String} params.sourcePort | ||
* @param {String} params.namespace | ||
*/ | ||
function deleteApplicationUDPRedirection(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'delete', | ||
url: `/v2/organisations/${params.id}/applications/${params.appId}/udpRedirs/${params.sourcePort}`, | ||
headers: { | ||
Accept: 'application/json' | ||
}, | ||
queryParams: (0, _pickNonNull.pickNonNull)(params, ['namespace']) // no body | ||
}); | ||
} | ||
/** | ||
* PUT /organisations/{id}/avatar | ||
@@ -183,0 +250,0 @@ * PUT /self/avatar |
@@ -6,3 +6,7 @@ "use strict"; | ||
}); | ||
exports.listApiKeyRevocation = listApiKeyRevocation; | ||
exports.createMateriaDBKVToken = createMateriaDBKVToken; | ||
exports.listOrganisationTokens = listOrganisationTokens; | ||
exports.revokeToken = revokeToken; | ||
exports.getOrganisationToken = getOrganisationToken; | ||
exports.listTokenRevocations = listTokenRevocations; | ||
@@ -12,12 +16,33 @@ var _pickNonNull = require("../../pick-non-null.js"); | ||
/** | ||
* GET /iam/api-keys/revocation-list | ||
* POST /iam/organisations/{ownerId}/iam/materia-db-kv/{KVId}/tokens | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {String} params.undefined | ||
*/ | ||
function createMateriaDBKVToken(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'post', | ||
url: `/v4/iam/organisations/${params.ownerId}/iam/materia-db-kv/${params.KVId}/tokens`, | ||
headers: { | ||
Accept: 'application/json' | ||
} // no query params | ||
// no body | ||
}); | ||
} | ||
/** | ||
* GET /iam/organisations/{ownerId}/iam/tokens | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {String} params.from | ||
* @param {String} params.size | ||
*/ | ||
function listApiKeyRevocation(params) { | ||
function listOrganisationTokens(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'get', | ||
url: `/v4/iam/api-keys/revocation-list`, | ||
url: `/v4/iam/organisations/${params.ownerId}/iam/tokens`, | ||
headers: { | ||
@@ -29,2 +54,60 @@ Accept: 'application/json' | ||
}); | ||
} | ||
/** | ||
* DELETE /iam/organisations/{ownerId}/iam/tokens/{tokenId} | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {String} params.undefined | ||
*/ | ||
function revokeToken(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'delete', | ||
url: `/v4/iam/organisations/${params.ownerId}/iam/tokens/${params.tokenId}`, | ||
headers: {} // no query params | ||
// no body | ||
}); | ||
} | ||
/** | ||
* GET /iam/organisations/{ownerId}/iam/tokens/{tokenId} | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {String} params.undefined | ||
*/ | ||
function getOrganisationToken(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'get', | ||
url: `/v4/iam/organisations/${params.ownerId}/iam/tokens/${params.tokenId}`, | ||
headers: { | ||
Accept: 'application/json' | ||
} // no query params | ||
// no body | ||
}); | ||
} | ||
/** | ||
* GET /iam/tokens/revocations | ||
* @param {Object} params | ||
* @param {String} params.from | ||
* @param {String} params.size | ||
*/ | ||
function listTokenRevocations(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'get', | ||
url: `/v4/iam/tokens/revocations`, | ||
headers: { | ||
Accept: 'application/json' | ||
}, | ||
queryParams: (0, _pickNonNull.pickNonNull)(params, ['from', 'size']) // no body | ||
}); | ||
} |
@@ -18,3 +18,2 @@ "use strict"; | ||
* @param {String} params.until | ||
* @param {String} params.excludeDeleted | ||
* @param {String} params.includeState | ||
@@ -34,3 +33,3 @@ * @param {String} params.excludeState | ||
}, | ||
queryParams: (0, _pickNonNull.pickNonNull)(params, ['since', 'until', 'excludeDeleted', 'includeState', 'excludeState', 'limit', 'order']) // no body | ||
queryParams: (0, _pickNonNull.pickNonNull)(params, ['since', 'until', 'includeState', 'excludeState', 'limit', 'order']) // no body | ||
@@ -37,0 +36,0 @@ }); |
@@ -11,2 +11,3 @@ "use strict"; | ||
exports.getPulsarStoragePolicy = getPulsarStoragePolicy; | ||
exports.patchStoragePolicies = patchStoragePolicies; | ||
exports.deleteTopic = deleteTopic; | ||
@@ -108,2 +109,22 @@ exports.getPulsarCluster = getPulsarCluster; | ||
/** | ||
* PATCH /addon-providers/addon-pulsar/addons/{pulsarId}/storage-policies | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {Object} body | ||
*/ | ||
function patchStoragePolicies(params, body) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'patch', | ||
url: `/v4/addon-providers/addon-pulsar/addons/${params.pulsarId}/storage-policies`, | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
// no query params | ||
body | ||
}); | ||
} | ||
/** | ||
* DELETE /addon-providers/addon-pulsar/addons/{pulsarId}/topics/{topicName} | ||
@@ -110,0 +131,0 @@ * @param {Object} params |
@@ -12,5 +12,7 @@ "use strict"; | ||
const APPLICATION_LOG_EVENT_NAME = 'APPLICATION_LOG'; | ||
/** | ||
* CleverCloud Application' logs stream | ||
*/ | ||
class ApplicationLogStream extends _cleverCloudSse.default { | ||
@@ -90,3 +92,3 @@ /** | ||
transform(event, data) { | ||
if (event !== 'APPLICATION_LOG') { | ||
if (event !== APPLICATION_LOG_EVENT_NAME) { | ||
return data; | ||
@@ -111,3 +113,3 @@ } | ||
onLog(fn) { | ||
return this.on('APPLICATION_LOG', event => fn(event.data)); | ||
return this.on(APPLICATION_LOG_EVENT_NAME, event => fn(event.data)); | ||
} | ||
@@ -114,0 +116,0 @@ |
@@ -170,6 +170,9 @@ "use strict"; | ||
* @param {any} reason | ||
* @param {string} reason.type | ||
*/ | ||
close(reason) { | ||
close(reason = { | ||
type: 'UNKNOW' | ||
}) { | ||
if (this.state === 'closed') { | ||
@@ -183,5 +186,3 @@ return; | ||
this._resolve({ | ||
reason | ||
}); | ||
this._resolve(reason); | ||
} | ||
@@ -280,3 +281,5 @@ | ||
const reason = JSON.parse(msg.data); | ||
this.close(reason); | ||
this.close({ | ||
type: reason.endedBy | ||
}); | ||
} catch (e) { | ||
@@ -283,0 +286,0 @@ this._onError(new ServerError(`Expect JSON for END_OF_STREAM event but got "${msg.data}"`, { |
@@ -642,3 +642,2 @@ import { pickNonNull } from '../../pick-non-null.js'; | ||
* @param {String} params.appId | ||
* @param {String} params.payment | ||
* @param {Object} body | ||
@@ -652,3 +651,3 @@ */ | ||
headers: { Accept: 'application/json', 'Content-Type': 'application/json' }, | ||
queryParams: pickNonNull(params, ['payment']), | ||
// no query params | ||
body, | ||
@@ -655,0 +654,0 @@ }); |
@@ -346,2 +346,9 @@ import * as addon from './addon.js'; | ||
}, | ||
udpRedirs: { | ||
get: prepareRequest(organisation.listApplicationUDPRedirections, ['id', 'appId']), | ||
post: prepareRequest(organisation.createApplicationUDPRedirection, ['id', 'appId']), | ||
_: { | ||
delete: prepareRequest(organisation.deleteApplicationUDPRedirection, ['id', 'appId', 'sourcePort']), | ||
}, | ||
}, | ||
vhosts: { | ||
@@ -348,0 +355,0 @@ get: prepareRequest(application.getAllDomains, ['id', 'appId']), |
@@ -106,2 +106,56 @@ import { pickNonNull } from '../../pick-non-null.js'; | ||
/** | ||
* GET /organisations/{id}/applications/{appId}/udpRedirs | ||
* @param {Object} params | ||
* @param {String} params.id | ||
* @param {String} params.appId | ||
*/ | ||
export function listApplicationUDPRedirections(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'get', | ||
url: `/v2/organisations/${params.id}/applications/${params.appId}/udpRedirs`, | ||
headers: { Accept: 'application/json' }, | ||
// no query params | ||
// no body | ||
}); | ||
} | ||
/** | ||
* POST /organisations/{id}/applications/{appId}/udpRedirs | ||
* @param {Object} params | ||
* @param {String} params.id | ||
* @param {String} params.appId | ||
* @param {Object} body | ||
*/ | ||
export function createApplicationUDPRedirection(params, body) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'post', | ||
url: `/v2/organisations/${params.id}/applications/${params.appId}/udpRedirs`, | ||
headers: { Accept: 'application/json', 'Content-Type': 'application/json' }, | ||
// no query params | ||
body, | ||
}); | ||
} | ||
/** | ||
* DELETE /organisations/{id}/applications/{appId}/udpRedirs/{sourcePort} | ||
* @param {Object} params | ||
* @param {String} params.id | ||
* @param {String} params.appId | ||
* @param {String} params.sourcePort | ||
* @param {String} params.namespace | ||
*/ | ||
export function deleteApplicationUDPRedirection(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'delete', | ||
url: `/v2/organisations/${params.id}/applications/${params.appId}/udpRedirs/${params.sourcePort}`, | ||
headers: { Accept: 'application/json' }, | ||
queryParams: pickNonNull(params, ['namespace']), | ||
// no body | ||
}); | ||
} | ||
/** | ||
* PUT /organisations/{id}/avatar | ||
@@ -108,0 +162,0 @@ * PUT /self/avatar |
import { pickNonNull } from '../../pick-non-null.js'; | ||
/** | ||
* GET /iam/api-keys/revocation-list | ||
* POST /iam/organisations/{ownerId}/iam/materia-db-kv/{KVId}/tokens | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {String} params.undefined | ||
*/ | ||
export function createMateriaDBKVToken(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'post', | ||
url: `/v4/iam/organisations/${params.ownerId}/iam/materia-db-kv/${params.KVId}/tokens`, | ||
headers: { Accept: 'application/json' }, | ||
// no query params | ||
// no body | ||
}); | ||
} | ||
/** | ||
* GET /iam/organisations/{ownerId}/iam/tokens | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {String} params.from | ||
* @param {String} params.size | ||
*/ | ||
export function listApiKeyRevocation(params) { | ||
export function listOrganisationTokens(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'get', | ||
url: `/v4/iam/api-keys/revocation-list`, | ||
url: `/v4/iam/organisations/${params.ownerId}/iam/tokens`, | ||
headers: { Accept: 'application/json' }, | ||
@@ -19,1 +37,52 @@ queryParams: pickNonNull(params, ['from', 'size']), | ||
} | ||
/** | ||
* DELETE /iam/organisations/{ownerId}/iam/tokens/{tokenId} | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {String} params.undefined | ||
*/ | ||
export function revokeToken(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'delete', | ||
url: `/v4/iam/organisations/${params.ownerId}/iam/tokens/${params.tokenId}`, | ||
headers: {}, | ||
// no query params | ||
// no body | ||
}); | ||
} | ||
/** | ||
* GET /iam/organisations/{ownerId}/iam/tokens/{tokenId} | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {String} params.undefined | ||
*/ | ||
export function getOrganisationToken(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'get', | ||
url: `/v4/iam/organisations/${params.ownerId}/iam/tokens/${params.tokenId}`, | ||
headers: { Accept: 'application/json' }, | ||
// no query params | ||
// no body | ||
}); | ||
} | ||
/** | ||
* GET /iam/tokens/revocations | ||
* @param {Object} params | ||
* @param {String} params.from | ||
* @param {String} params.size | ||
*/ | ||
export function listTokenRevocations(params) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'get', | ||
url: `/v4/iam/tokens/revocations`, | ||
headers: { Accept: 'application/json' }, | ||
queryParams: pickNonNull(params, ['from', 'size']), | ||
// no body | ||
}); | ||
} |
@@ -10,3 +10,2 @@ import { pickNonNull } from '../../pick-non-null.js'; | ||
* @param {String} params.until | ||
* @param {String} params.excludeDeleted | ||
* @param {String} params.includeState | ||
@@ -24,3 +23,3 @@ * @param {String} params.excludeState | ||
headers: { Accept: 'application/json' }, | ||
queryParams: pickNonNull(params, ['since', 'until', 'excludeDeleted', 'includeState', 'excludeState', 'limit', 'order']), | ||
queryParams: pickNonNull(params, ['since', 'until', 'includeState', 'excludeState', 'limit', 'order']), | ||
// no body | ||
@@ -27,0 +26,0 @@ }); |
@@ -83,2 +83,19 @@ import { pickNonNull } from '../../pick-non-null.js'; | ||
/** | ||
* PATCH /addon-providers/addon-pulsar/addons/{pulsarId}/storage-policies | ||
* @param {Object} params | ||
* @param {String} params.undefined | ||
* @param {Object} body | ||
*/ | ||
export function patchStoragePolicies(params, body) { | ||
// no multipath for /self or /organisations/{id} | ||
return Promise.resolve({ | ||
method: 'patch', | ||
url: `/v4/addon-providers/addon-pulsar/addons/${params.pulsarId}/storage-policies`, | ||
headers: { 'Content-Type': 'application/json' }, | ||
// no query params | ||
body, | ||
}); | ||
} | ||
/** | ||
* DELETE /addon-providers/addon-pulsar/addons/{pulsarId}/topics/{topicName} | ||
@@ -85,0 +102,0 @@ * @param {Object} params |
import CleverCloudSse from './clever-cloud-sse.js'; | ||
const APPLICATION_LOG_EVENT_NAME = 'APPLICATION_LOG'; | ||
/** | ||
@@ -75,3 +77,3 @@ * CleverCloud Application' logs stream | ||
if (event !== 'APPLICATION_LOG') { | ||
if (event !== APPLICATION_LOG_EVENT_NAME) { | ||
return data; | ||
@@ -93,4 +95,4 @@ } | ||
onLog (fn) { | ||
return this.on('APPLICATION_LOG', (event) => fn(event.data)); | ||
return this.on(APPLICATION_LOG_EVENT_NAME, (event) => fn(event.data)); | ||
} | ||
} |
@@ -167,4 +167,5 @@ import { CustomEventTarget } from './custom-event-target.js'; | ||
* @param {any} reason | ||
* @param {string} reason.type | ||
*/ | ||
close (reason) { | ||
close (reason = { type: 'UNKNOW' }) { | ||
if (this.state === 'closed') { | ||
@@ -175,3 +176,3 @@ return; | ||
this._cleanup(); | ||
this._resolve({ reason }); | ||
this._resolve(reason); | ||
} | ||
@@ -271,3 +272,3 @@ | ||
const reason = JSON.parse(msg.data); | ||
this.close(reason); | ||
this.close({ type: reason.endedBy }); | ||
} | ||
@@ -274,0 +275,0 @@ catch (e) { |
{ | ||
"name": "@clevercloud/client", | ||
"version": "8.2.0", | ||
"version": "8.3.0", | ||
"description": "JavaScript REST client and utils for Clever Cloud's API", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/CleverCloud/clever-client.js", |
610441
18776
131