|
|
@ -3,19 +3,13 @@ import Now from '../lib'; |
|
|
|
export default class Secrets extends Now { |
|
|
|
|
|
|
|
ls () { |
|
|
|
return this.retry(async (bail, attempt) => { |
|
|
|
if (this._debug) console.time(`> [debug] #${attempt} GET /secrets`); |
|
|
|
const res = await this._fetch('/secrets'); |
|
|
|
if (this._debug) console.timeEnd(`> [debug] #${attempt} GET /secrets`); |
|
|
|
const body = await res.json(); |
|
|
|
return body.secrets; |
|
|
|
}); |
|
|
|
return this.listSecrets(); |
|
|
|
} |
|
|
|
|
|
|
|
rm (nameOrId) { |
|
|
|
return this.retry(async (bail, attempt) => { |
|
|
|
if (this._debug) console.time(`> [debug] #${attempt} DELETE /secrets/${nameOrId}`); |
|
|
|
const res = await this._fetch(`/secrets/${nameOrId}`, { method: 'DELETE' }); |
|
|
|
const res = await this._fetch(`/now/secrets/${nameOrId}`, { method: 'DELETE' }); |
|
|
|
if (this._debug) console.timeEnd(`> [debug] #${attempt} DELETE /secrets/${nameOrId}`); |
|
|
|
|
|
|
|
if (403 === res.status) { |
|
|
@ -41,7 +35,7 @@ export default class Secrets extends Now { |
|
|
|
add (name, value) { |
|
|
|
return this.retry(async (bail, attempt) => { |
|
|
|
if (this._debug) console.time(`> [debug] #${attempt} POST /secrets`); |
|
|
|
const res = await this._fetch('/secrets', { |
|
|
|
const res = await this._fetch('/now/secrets', { |
|
|
|
method: 'POST', |
|
|
|
body: { |
|
|
|
name, |
|
|
@ -73,7 +67,7 @@ export default class Secrets extends Now { |
|
|
|
rename (nameOrId, newName) { |
|
|
|
return this.retry(async (bail, attempt) => { |
|
|
|
if (this._debug) console.time(`> [debug] #${attempt} PATCH /secrets/${nameOrId}`); |
|
|
|
const res = await this._fetch(`/secrets/${nameOrId}`, { |
|
|
|
const res = await this._fetch(`/now/secrets/${nameOrId}`, { |
|
|
|
method: 'PATCH', |
|
|
|
body: { |
|
|
|
name: newName |
|
|
|