UNPKG

@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) • 2.26 kB
var s=[{scope:"api",label:"Portal",description:"Everything you can do in the portal"},{scope:"aws",label:"AWS",description:"List your AWS accounts and roles and get credentials"},{scope:"network",label:"Network devices",description:"Enroll your own devices on the private network and list or remove them"},{scope:"shares",label:"Shares",description:"Share ports of your devices and stop shares"}],a=[{scope:"aws",label:"AWS",description:"List the roles granted to it and get AWS credentials"},{scope:"network",label:"Network devices",description:"Enroll machines on the private network and list or remove them"},{scope:"shares",label:"Shares",description:"Share ports of its machines and stop shares"},{scope:"admin.read.all",label:"Admin (read)",description:"Read every administration page \u2014 users, groups, accounts, requests, activity \u2014 without changing anything"},{scope:"admin.write.all",label:"Admin (read + write)",description:"Every admin action \u2014 create users and service users, grant roles, approve requests; includes Admin (read)"}];function p(e,r){return e.scope==="api"&&r?`${e.description} \u2014 admin actions too, while you are an admin`:e.description}var o=1440*60*1e3;function l(e,r=Date.now()){let n=Date.parse(e.expiresAt);if(!(n>r))return"expired";let t=(n-Date.parse(e.createdAt))/2,i=Number.isNaN(t)?o:Math.min(o,t);return n-r<=i?"soon":"ok"}function d(e){return s.find(r=>r.scope===e)?.label??a.find(r=>r.scope===e)?.label??e}function u(e){return e.includes("aws")||e.includes("api")}var c=[7,30,60,90];function m(e){let r=Math.max(1,Math.floor(e));return[...c.filter(n=>n<r),r]}function h(e){return Math.min(30,Math.max(1,Math.floor(e)))}function S(e){return e===1?"1 day":`${e} days`}function f(e,r){let n=e.name.trim();if(!n)return"Give the token a name.";if(n.length>60)return"The name can be at most 60 characters.";if(e.description.trim().length>200)return"The description can be at most 200 characters.";if(e.scopes.length===0)return"Pick at least one scope.";let t=e.expiresInDays;return!Number.isInteger(t)||t<1||t>r?`Expiry must be a whole number of days from 1 to ${r}.`:null}function b(e){return`${e.accountNumber}#${e.roleName}`}export{s as a,a as b,p as c,l as d,d as e,u as f,m as g,h,S as i,f as j,b as k};