2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2021-06-07 17:57:36 +00:00
|
|
|
import Component from '@glimmer/component';
|
|
|
|
import { action } from '@ember/object';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @module ConfigureAwsSecretComponent
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* ```js
|
2022-12-01 15:33:30 +00:00
|
|
|
* <ConfigureAwsSecret
|
|
|
|
@model={{model}}
|
|
|
|
@tab={{tab}}
|
2021-06-07 17:57:36 +00:00
|
|
|
@accessKey={{accessKey}}
|
|
|
|
@secretKey={{secretKey}}
|
|
|
|
@region={{region}}
|
|
|
|
@iamEndpoint={{iamEndpoint}}
|
|
|
|
@stsEndpoint={{stsEndpoint}}
|
|
|
|
@saveAWSRoot={{action "save" "saveAWSRoot"}}
|
|
|
|
@saveAWSLease={{action "save" "saveAWSLease"}} />
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* @param {object} model - aws secret engine model
|
|
|
|
* @param {string} tab - current tab selection
|
|
|
|
* @param {string} accessKey - AWS access key
|
|
|
|
* @param {string} secretKey - AWS secret key
|
|
|
|
* @param {string} region - AWS region
|
|
|
|
* @param {string} iamEndpoint - IAM endpoint
|
|
|
|
* @param {string} stsEndpoint - Sts endpoint
|
|
|
|
* @param {Function} saveAWSRoot - parent action which saves AWS root credentials
|
|
|
|
* @param {Function} saveAWSLease - parent action which updates AWS lease information
|
2022-12-01 15:33:30 +00:00
|
|
|
*
|
2021-06-07 17:57:36 +00:00
|
|
|
*/
|
|
|
|
export default class ConfigureAwsSecretComponent extends Component {
|
|
|
|
@action
|
2022-10-18 15:46:02 +00:00
|
|
|
saveRootCreds(data, event) {
|
|
|
|
event.preventDefault();
|
2021-06-07 17:57:36 +00:00
|
|
|
this.args.saveAWSRoot(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
2022-10-18 15:46:02 +00:00
|
|
|
saveLease(data, event) {
|
|
|
|
event.preventDefault();
|
2021-06-07 17:57:36 +00:00
|
|
|
this.args.saveAWSLease(data);
|
|
|
|
}
|
2022-12-01 15:33:30 +00:00
|
|
|
|
|
|
|
@action
|
|
|
|
handleTtlChange(name, ttlObj) {
|
|
|
|
// lease values cannot be undefined, set to 0 to use default
|
|
|
|
const valueToSet = ttlObj.enabled ? ttlObj.goSafeTimeString : 0;
|
|
|
|
this.args.model.set(name, valueToSet);
|
|
|
|
}
|
2021-06-07 17:57:36 +00:00
|
|
|
}
|