2018-06-12 21:06:37 +00:00
|
|
|
<PageHeader as |p|>
|
|
|
|
<p.top>
|
2021-12-17 03:44:29 +00:00
|
|
|
<KeyValueHeader
|
|
|
|
@baseKey={{this.model}}
|
|
|
|
@path="vault.cluster.secrets.backend.list"
|
|
|
|
@mode={{this.mode}}
|
|
|
|
@root={{this.root}}
|
|
|
|
@showCurrent={{true}}
|
|
|
|
/>
|
2018-06-12 21:06:37 +00:00
|
|
|
</p.top>
|
|
|
|
<p.levelLeft>
|
|
|
|
<h1 class="title is-3" data-test-secret-header="true">
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if (eq this.mode "create")}}
|
2018-06-12 21:06:37 +00:00
|
|
|
Create an AWS Role
|
2021-12-17 03:44:29 +00:00
|
|
|
{{else if (eq this.mode "edit")}}
|
|
|
|
Edit AWS Role
|
|
|
|
<code>{{this.model.id}}</code>
|
2018-06-12 21:06:37 +00:00
|
|
|
{{else}}
|
2021-12-17 03:44:29 +00:00
|
|
|
AWS Role
|
|
|
|
<code>{{this.model.id}}</code>
|
2018-06-12 21:06:37 +00:00
|
|
|
{{/if}}
|
|
|
|
</h1>
|
|
|
|
</p.levelLeft>
|
|
|
|
</PageHeader>
|
2018-04-03 14:16:57 +00:00
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if (eq this.mode "show")}}
|
2019-05-17 17:29:21 +00:00
|
|
|
<Toolbar>
|
|
|
|
<ToolbarActions>
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if this.model.canDelete}}
|
|
|
|
<ConfirmAction @buttonClasses="toolbar-link" @onConfirmAction={{action "delete"}}>
|
2021-10-22 14:11:14 +00:00
|
|
|
Delete role
|
|
|
|
</ConfirmAction>
|
2021-12-17 03:44:29 +00:00
|
|
|
<div class="toolbar-separator"></div>
|
2021-10-22 14:11:14 +00:00
|
|
|
{{/if}}
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if this.model.canGenerate}}
|
|
|
|
<ToolbarSecretLink @secret={{this.model.id}} @mode="credentials" @data-test-backend-credentials="iam">
|
2019-05-17 17:29:21 +00:00
|
|
|
Generate credentials
|
2019-02-14 16:04:46 +00:00
|
|
|
</ToolbarSecretLink>
|
|
|
|
{{/if}}
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if this.model.canEdit}}
|
|
|
|
<ToolbarSecretLink @secret={{this.model.id}} @mode="edit" @replace={{true}}>
|
2019-05-17 17:29:21 +00:00
|
|
|
Edit role
|
2019-02-14 16:04:46 +00:00
|
|
|
</ToolbarSecretLink>
|
|
|
|
{{/if}}
|
2019-05-17 17:29:21 +00:00
|
|
|
</ToolbarActions>
|
|
|
|
</Toolbar>
|
|
|
|
{{/if}}
|
2019-02-14 16:04:46 +00:00
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if (or (eq this.mode "edit") (eq this.mode "create"))}}
|
2021-05-26 18:29:52 +00:00
|
|
|
<form onsubmit={{action "createOrUpdate" "create"}}>
|
|
|
|
<div class="box is-sideless is-fullwidth is-marginless">
|
2021-12-17 03:44:29 +00:00
|
|
|
<MessageError @model={{this.model}} />
|
|
|
|
<NamespaceReminder @mode={{this.mode}} @noun="AWS role" />
|
|
|
|
{{#if (gt this.model.credentialTypes.length 1)}}
|
2021-05-26 18:29:52 +00:00
|
|
|
<AlertBanner
|
|
|
|
@type="warning"
|
2021-12-17 03:44:29 +00:00
|
|
|
@message="This role has more than one credential_type, currently: {{join ", " this.model.credentialTypes}}.
|
2021-05-26 18:29:52 +00:00
|
|
|
Multiple credential types is deprecated and you must choose one in order to save this role."
|
|
|
|
/>
|
|
|
|
{{/if}}
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#each (if (eq this.mode "edit") (drop 1 (or this.model.fields (array))) this.model.fields) as |attr|}}
|
|
|
|
<FormField data-test-field={{true}} @attr={{attr}} @model={{@model}} />
|
2021-05-26 18:29:52 +00:00
|
|
|
{{/each}}
|
|
|
|
</div>
|
|
|
|
<div class="field is-grouped-split box is-fullwidth is-bottomless">
|
|
|
|
<div class="control">
|
2021-12-17 03:44:29 +00:00
|
|
|
<button type="submit" disabled={{this.buttonDisabled}} class="button is-primary" data-test-role-aws-create={{true}}>
|
|
|
|
{{#if (eq this.mode "create")}}
|
2021-05-26 18:29:52 +00:00
|
|
|
Create role
|
2021-12-17 03:44:29 +00:00
|
|
|
{{else if (eq this.mode "edit")}}
|
2021-05-26 18:29:52 +00:00
|
|
|
Save
|
|
|
|
{{/if}}
|
|
|
|
</button>
|
2021-12-17 03:44:29 +00:00
|
|
|
<SecretLink @mode={{if (eq this.mode "create") "list" "show"}} @class="button" @secret={{this.model.id}}>
|
2021-05-26 18:29:52 +00:00
|
|
|
Cancel
|
|
|
|
</SecretLink>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
2018-04-03 14:16:57 +00:00
|
|
|
{{else}}
|
2021-05-26 18:29:52 +00:00
|
|
|
<div class="box is-fullwidth is-sideless is-paddingless is-marginless">
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if (gt this.model.credentialTypes.length 1)}}
|
2021-05-26 18:29:52 +00:00
|
|
|
<AlertBanner
|
|
|
|
@type="warning"
|
2021-12-17 03:44:29 +00:00
|
|
|
@message="This role has more than one credential_type, currently: {{join ", " this.model.credentialTypes}}.
|
2021-05-26 18:29:52 +00:00
|
|
|
When you next edit this role, you will have to choose a single credential type."
|
|
|
|
/>
|
|
|
|
{{/if}}
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#each this.model.fields as |attr|}}
|
2021-05-26 18:29:52 +00:00
|
|
|
{{#if (eq attr.name "policyDocument")}}
|
2021-12-17 03:44:29 +00:00
|
|
|
<InfoTableRow
|
|
|
|
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
|
|
|
|
@value={{this.model.policyDocument}}
|
|
|
|
>
|
|
|
|
<pre><code class="is-paddingless">{{stringify (jsonify this.model.policyDocument)}}</code></pre>
|
2021-05-26 18:29:52 +00:00
|
|
|
</InfoTableRow>
|
|
|
|
{{else}}
|
2021-12-17 03:44:29 +00:00
|
|
|
<InfoTableRow
|
|
|
|
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
|
|
|
|
@value={{get this.model attr.name}}
|
|
|
|
/>
|
2021-05-26 18:29:52 +00:00
|
|
|
{{/if}}
|
|
|
|
{{/each}}
|
|
|
|
</div>
|
2021-12-17 03:44:29 +00:00
|
|
|
{{/if}}
|