mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-19 05:31:10 +02:00
* Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License. Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUS-1.1 * Fix test that expected exact offset on hcl file --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Sarah Thompson <sthompson@hashicorp.com> Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
37 lines
1010 B
JavaScript
37 lines
1010 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import ApplicationAdapter from './application';
|
|
|
|
export default ApplicationAdapter.extend({
|
|
createRecord(store, type, snapshot) {
|
|
const ttl = snapshot.attr('ttl');
|
|
const roleArn = snapshot.attr('roleArn');
|
|
const roleType = snapshot.attr('credentialType');
|
|
let method = 'POST';
|
|
let options;
|
|
const data = {};
|
|
if (roleType === 'iam_user') {
|
|
method = 'GET';
|
|
} else {
|
|
if (ttl !== undefined) {
|
|
data.ttl = ttl;
|
|
}
|
|
if (roleType === 'assumed_role' && roleArn) {
|
|
data.role_arn = roleArn;
|
|
}
|
|
options = data.ttl || data.role_arn ? { data } : {};
|
|
}
|
|
const role = snapshot.attr('role');
|
|
const url = `/v1/${role.backend}/creds/${role.name}`;
|
|
|
|
return this.ajax(url, method, options).then((response) => {
|
|
response.id = snapshot.id;
|
|
response.modelName = type.modelName;
|
|
store.pushPayload(type.modelName, response);
|
|
});
|
|
},
|
|
});
|