mirror of
https://github.com/hashicorp/vault.git
synced 2025-09-19 12:51:08 +02:00
* gcp initial changes * acceptance test coverage for gcp * update config-wif component test so tests are passing * specific gcp test coverage * changelog * comment clean up * one more test * comment things * address pr comments
47 lines
1.0 KiB
JavaScript
47 lines
1.0 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import ApplicationAdapter from '../application';
|
|
import { encodePath } from 'vault/utils/path-encoding-helpers';
|
|
|
|
export default class GcpConfig extends ApplicationAdapter {
|
|
namespace = 'v1';
|
|
|
|
_url(backend) {
|
|
return `${this.buildURL()}/${encodePath(backend)}/config`;
|
|
}
|
|
|
|
queryRecord(store, type, query) {
|
|
const { backend } = query;
|
|
return this.ajax(this._url(backend), 'GET').then((resp) => {
|
|
return {
|
|
...resp,
|
|
id: backend,
|
|
backend,
|
|
};
|
|
});
|
|
}
|
|
|
|
createOrUpdate(store, type, snapshot) {
|
|
const serializer = store.serializerFor(type.modelName);
|
|
const data = serializer.serialize(snapshot);
|
|
const backend = snapshot.record.backend;
|
|
return this.ajax(this._url(backend), 'POST', { data }).then((resp) => {
|
|
return {
|
|
...resp,
|
|
id: backend,
|
|
};
|
|
});
|
|
}
|
|
|
|
createRecord() {
|
|
return this.createOrUpdate(...arguments);
|
|
}
|
|
|
|
updateRecord() {
|
|
return this.createOrUpdate(...arguments);
|
|
}
|
|
}
|