@fntio/infra-client
Version:
Self-hosted AWS access portal: credential vending, target-account trust, and grant-driven private networking as CDK stacks and constructs.
2 lines (1 loc) • 7.77 kB
JavaScript
import{a as Y,l as X}from"./chunk-K4OFWFQE.js";import{a as j}from"./chunk-XPF5YBGU.js";import{e as z}from"./chunk-BADG46IJ.js";import{a as G}from"./chunk-6HVGPPAG.js";import{a as $}from"./chunk-IVXFG5AJ.js";import{a as Q,b as U}from"./chunk-2SO4BVIT.js";import{a as T,b as V,e as D,i as I,j as P,k as L,n as O,o as B,p as q}from"./chunk-T5HLFYHP.js";import{c as F}from"./chunk-KCJ5HNXP.js";import{a as H}from"./chunk-B67EMZ2H.js";import{a as w}from"./chunk-7A4HO4AV.js";import{Aa as r,Ba as a,I as b,Ja as f,K as u,L as m,La as _,Na as c,R as p,Xa as i,Ya as g,Za as k,_ as l,ga as A,qb as C,sb as N,ta as h,tb as S,ua as v,wa as E,xa as R,ya as y,za as d}from"./chunk-FYA6QUPZ.js";import{a as M}from"./chunk-WFIHWVQO.js";var K=(t,o)=>o.roleName;function W(t,o){if(t&1&&(i(0," for "),r(1,"strong"),i(2),a()),t&2){let e=c(2);l(2),g(e.label(e.duration()))}}function Z(t,o){if(t&1){let e=f();r(0,"app-banner",1)(1,"span",2)(2,"span"),i(3,"\u2713"),a(),r(4,"span"),i(5," Your request for "),r(6,"strong"),i(7),a(),i(8," in "),r(9,"strong"),i(10),a(),h(11,W,3,1),i(12," is with the admins. You'll see the decision in the activity bell, and the role appears in your list once it's approved. "),a()()(),r(13,"div",3)(14,"app-button",4),_("click",function(){u(e);let s=c();return m(s.closed.emit())}),i(15,"Done"),a()()}if(t&2){let e=c();l(7),g(e.targetRole()),l(3),g(e.accountLabel()),l(),v(e.duration()!=="long"?11:-1)}}function ee(t,o){t&1&&(r(0,"p",0),i(1,"Loading available roles\u2026"),a())}function te(t,o){if(t&1){let e=f();r(0,"app-banner",5),i(1),a(),r(2,"div",3)(3,"app-button",6),_("click",function(){u(e);let s=c();return m(s.closed.emit())}),i(4,"Close"),a()()}if(t&2){let e=c();l(),g(e.loadError())}}function ne(t,o){if(t&1){let e=f();r(0,"app-empty-state",7),i(1," You already have \u2014 or have already requested \u2014 every role in the catalog. "),a(),r(2,"div",3)(3,"app-button",6),_("click",function(){u(e);let s=c();return m(s.closed.emit())}),i(4,"Close"),a()()}}function oe(t,o){if(t&1&&(i(0," Your access to "),r(1,"strong"),i(2),a(),i(3," in "),r(4,"strong"),i(5),a(),i(6," has expired. This asks the admins to grant it again. ")),t&2){let e=c(),n=c(2);l(2),g(e.roleName),l(3),g(n.names.label(e.accountNumber))}}function ie(t,o){if(t&1&&(i(0," Your access to "),r(1,"strong"),i(2),a(),i(3," in "),r(4,"strong"),i(5),a(),i(6," is ending soon. This asks the admins for more time \u2014 an approval replaces the current end date. ")),t&2){let e=c(),n=c(2);l(2),g(e.roleName),l(3),g(n.names.label(e.accountNumber))}}function re(t,o){if(t&1&&(r(0,"app-banner",9),h(1,oe,7,2)(2,ie,7,2),a()),t&2){let e=o;d("tone",e.expired?"danger":"warning"),l(),v(e.expired?1:2)}}function ae(t,o){if(t&1&&(r(0,"option",22),i(1),a()),t&2){let e=o.$implicit;d("value",e.roleName),l(),k(" ",(e.displayName||e.roleName)+(e.description?" \xB7 "+e.description:"")," ")}}function le(t,o){if(t&1){let e=f();r(0,"app-field",17)(1,"app-account-picker",18),_("picked",function(s){u(e);let x=c(2);return m(x.pickAccount(s))}),a()(),r(2,"app-field",19)(3,"select",20),_("ngModelChange",function(s){u(e);let x=c(2);return m(x.roleName.set(s))}),r(4,"option",21),i(5,"Select a role\u2026"),a(),R(6,ae,2,2,"option",22,K),a()()}if(t&2){let e=c(2);l(),d("source",e.catalogPage)("selected",e.pickedAccount())("dimensionFilters",!0),l(),d("hint",e.accountNumber()?"\u2014 what you want to assume":"\u2014 pick an account first"),l(),d("disabled",!e.accountNumber())("ngModel",e.roleName()),l(3),y(e.rolesForAccount())}}function se(t,o){if(t&1&&(r(0,"option",12),i(1),a()),t&2){let e=o.$implicit,n=c(2);d("ngValue",e),l(),g(n.label(e))}}function ce(t,o){if(t&1){let e=f();r(0,"div",8),h(1,re,3,2,"app-banner",9)(2,le,8,6),r(3,"app-field",10)(4,"select",11),_("ngModelChange",function(s){u(e);let x=c();return m(x.duration.set(s))}),R(5,se,2,2,"option",12,E),r(7,"option",12),i(8,"Long-term (indefinite)"),a()()(),r(9,"app-field",13)(10,"textarea",14),_("ngModelChange",function(s){u(e);let x=c();return m(x.reason.set(s))}),a()()(),r(11,"div",15)(12,"app-button",6),_("click",function(){u(e);let s=c();return m(s.closed.emit())}),i(13,"Cancel"),a(),r(14,"app-button",16),_("click",function(){u(e);let s=c();return m(s.submit())}),i(15," Send request "),a()()}if(t&2){let e,n=c();l(),v((e=n.preset())?1:2,e),l(3),d("ngModel",n.duration()),l(),y(n.PRESETS),l(2),d("ngValue","long"),l(2),d("error",n.error()),l(),d("maxlength",n.REASON_MAX)("ngModel",n.reason()),l(4),d("loading",n.busy())("disabled",!n.canSubmit())}}var J=class t{api=b(Y);names=b(j);constructor(){this.names.ensure()}toast=b(F);notifications=b(X);preset=S(null);presetAccount=S(null);created=N();closed=N();REASON_MAX=500;PRESETS=Q;label(o){return o==="long"?"long-term":U(o)}catalog=p(null);loadError=p("");catalogPage=o=>this.api.listCatalogPage(o);pickedAccount=p(null);accountNumber=C(()=>this.pickedAccount()?.accountNumber??"");roleName=p("");duration=p("long");reason=p("");busy=p(!1);error=p("");sent=p(!1);rolesForAccount=C(()=>this.pickedAccount()?.roles??[]);targetAccount=C(()=>this.preset()?.accountNumber??this.accountNumber());targetRole=C(()=>this.preset()?.roleName??this.roleName());canSubmit=C(()=>!!this.targetAccount()&&!!this.targetRole());accountLabel=C(()=>{let o=this.pickedAccount();return o?.name?`${o.name} (${o.accountNumber})`:this.targetAccount()});ngOnInit(){if(this.preset()){this.duration.set(24);return}let e=this.presetAccount();this.api.listCatalogPage(M({limit:5},e?{q:e}:{})).subscribe({next:n=>{if(this.catalog.set(n.items),e){let s=n.items.find(x=>x.accountNumber===e);s&&this.pickAccount(s)}},error:n=>{this.catalog.set([]),this.loadError.set(q(n,"Could not load the role catalog. Try again shortly."))}})}pickAccount(o){this.pickedAccount.set(o),this.roleName.set("")}submit(){if(!this.canSubmit())return;this.error.set(""),this.busy.set(!0);let o=this.duration();this.api.create(this.targetAccount(),this.targetRole(),this.reason().trim()||void 0,o==="long"?void 0:o).subscribe({next:()=>{this.busy.set(!1),this.sent.set(!0),this.toast.success(`Requested ${this.targetRole()}`),this.notifications.load(),this.created.emit()},error:e=>{this.busy.set(!1),this.error.set(q(e,"Could not send the request."))}})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=A({type:t,selectors:[["app-request-role-form"]],inputs:{preset:[1,"preset"],presetAccount:[1,"presetAccount"]},outputs:{created:"created",closed:"closed"},decls:5,vars:1,consts:[[1,"py-4","text-xs","text-muted-foreground"],["tone","success"],[1,"flex","items-start","gap-2"],[1,"mt-5","flex","justify-end"],[3,"click"],["tone","danger"],["variant","outline",3,"click"],["title","Nothing left to request","size","dialog"],[1,"space-y-5"],[3,"tone"],["label","Access duration","hint","temporary access expires on its own; the admin has the final say"],[1,"ui-input",3,"ngModelChange","ngModel"],[3,"ngValue"],["label","Reason","hint","optional, but it's what the admin decides on",3,"error"],["rows","3","placeholder","e.g. Debugging the payment queue in staging this week.",1,"ui-input",3,"ngModelChange","maxlength","ngModel"],[1,"mt-5","flex","justify-end","gap-2"],[3,"click","loading","disabled"],["label","Account","hint","where the role lives \u2014 type a name or number"],["placeholder","Search accounts you could ask for",3,"picked","source","selected","dimensionFilters"],["label","Role",3,"hint"],[1,"ui-input",3,"ngModelChange","disabled","ngModel"],["value","","disabled",""],[3,"value"]],template:function(e,n){e&1&&h(0,Z,16,3)(1,ee,2,0,"p",0)(2,te,5,1)(3,ne,5,0)(4,ce,16,8),e&2&&v(n.sent()?0:!n.preset()&&n.catalog()===null?1:!n.preset()&&n.loadError()?2:!n.preset()&&!n.presetAccount()&&n.catalog().length===0?3:4)},dependencies:[B,P,L,T,I,V,O,D,w,$,H,G,z],encapsulation:2})};export{J as a};