vault/ui/app/adapters/azure/config.js
Angel Garbarino 2631ae67d4
Allow Configuration of Azure Secret Engine, including WIF for enterprise users (#29047)
* transfer over all changes from original pr

* changelog

* add serialize catch for no empty string environment

* move ttl format logic to parent route

* Update 29047.txt

* clean up some comments

* Update changelog/29047.txt

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* Update changelog/29047.txt

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* Update ui/app/components/secret-engine/configure-azure.hbs

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* first round of addressing pr comments, holding off on the issue save flow for error messaging to keep separate

* Update CODEOWNERS

merge issue

* small clean up tasks

* updates

* test coverage

* small cleanup

* small clean up

* clean up

* clean up getters on model

---------

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
2024-12-18 16:28:07 -07:00

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 AzureConfig 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);
}
}