@spinnaker/amazon 2026.4.0 → 2026.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/awsSdkFieldNames.d.ts +24 -0
- package/dist/domain/IAmazonFunction.d.ts +2 -1
- package/dist/domain/IAmazonFunctionSourceData.d.ts +2 -1
- package/dist/domain/IAmazonLoadBalancerSourceData.d.ts +5 -2
- package/dist/domain/IAmazonServerGroup.d.ts +1 -0
- package/dist/domain/IScalingPolicy.d.ts +1 -0
- package/dist/index.js +193 -193
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/common/awsSdkFieldNames.spec.ts +47 -0
- package/src/common/awsSdkFieldNames.ts +26 -0
- package/src/domain/IAmazonFunction.ts +2 -1
- package/src/domain/IAmazonFunctionSourceData.ts +2 -1
- package/src/domain/IAmazonLoadBalancerSourceData.ts +6 -6
- package/src/domain/IAmazonServerGroup.ts +2 -1
- package/src/domain/IScalingPolicy.ts +2 -1
- package/src/function/function.transformer.spec.ts +23 -0
- package/src/function/function.transformer.ts +4 -1
- package/src/loadBalancer/TargetGroupDetails.tsx +2 -1
- package/src/loadBalancer/details/amazonLoadBalancerDetails.tsx +3 -2
- package/src/loadBalancer/loadBalancer.transformer.spec.ts +50 -0
- package/src/loadBalancer/loadBalancer.transformer.ts +13 -10
- package/src/serverGroup/configure/serverGroupCommandBuilder.aws.service.spec.js +27 -3
- package/src/serverGroup/configure/serverGroupCommandBuilder.service.ts +3 -2
- package/src/serverGroup/configure/serverGroupCommandBuilder.spec.js +4 -4
- package/src/serverGroup/details/amazonServerGroupDetailsGetter.ts +3 -2
- package/src/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingChart.tsx +1 -1
- package/src/serverGroup/details/scalingPolicy/upsert/ScalingPolicyCommandBuilderService.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -2,172 +2,172 @@
|
|
|
2
2
|
var e,t,a,n,r,l,s,i;import{SETTINGS as o,HelpField as c,DeploymentStrategyRegistry as d,FormValidator as m,FormikFormField as u,TextInput as p,AccountService as h,ReactSelectInput as g,CheckboxInput as v,MapEditorInput as f,NumberInput as E,NetworkReader as y,useData as b,DeckRuntimeContext as C,SubnetReader as N,TetheredSelect as S,TaskMonitor as w,FunctionWriter as k,noop as T,ReactModal as I,WizardModal as P,WizardPage as A,withRouter as G,ConfirmationModalService as x,ApplicationReader as D,AddEntityTagLinks as B,REST as F,FunctionReader as M,Details as R,AccountTag as L,CollapsibleSection as z,HelpContentsRegistry as O,LabeledValue as U,timestamp as V,SubnetTag as H,LabeledValueList as q,LinkWithClipboard as W,FirewallLabels as j,robotToHuman as Z,Tooltip as _,InstanceLoadBalancerHealth as K,InstanceWriter as Y,TaskExecutor as X,RecentHistoryService as J,InstanceDetailsHeader as Q,InstanceInsights as ee,ConsoleOutputLink as te,InstanceLinks as ae,InstanceReader as ne,InstanceActions as re,LoadBalancerServerGroup as le,HealthCounts as se,LoadBalancerInstances as ie,LoadBalancerClusterContainer as oe,logger as ce,LoadBalancerDataUtils as de,Spinner as me,HoverablePopover as ue,NameUtils as pe,CopyToClipboard as he,ManagedResourceDetailsIndicator as ge,relativeTime as ve,Overridable as fe,SpinFormik as Ee,ModalClose as ye,SubmitButton as be,SelectInput as Ce,CertificateReader as Ne,ValidationMessage as Se,CustomLabels as we,Validators as ke,spelNumberCheck as Te,SpInput as Ie,SpelNumberInput as Pe,ChecklistInput as Ae,useDeepObjectDiff as Ge,useMountStatusRef as xe,createFakeReactSyntheticEvent as De,Markdown as Be,AccountSelectInput as Fe,RegionSelectField as Me,InfrastructureCaches as Re,LoadBalancerWriter as Le,CloudProviderRegistry as ze,ManagedMenuItem as Oe,useDeckRuntimeServices as $e,useDataSource as Ue,BakeryReader as Ve,AuthenticationService as He,StageConfigField as qe,Registry as We,BakeExecutionLabel as je,ExecutionDetailsTasks as Ze,ExecutionDetailsSection as _e,StageFailureMessage as Ke,StageConstants as Ye,AppListExtractor as Xe,AccountRegionClusterSelector as Je,TargetSelect as Qe,PlatformHealthOverride as et,DeploymentStrategySelector as tt,FormikStageConfig as at,YamlEditor as nt,StageArtifactSelectorDelegate as rt,MapEditor as lt,yamlDocumentsToString as st,ExecutionStepDetails as it,ExecutionBarLabel as ot,ArtifactReferenceService as ct,ExpectedArtifactService as dt,TetheredCreatable as mt,excludeAllTypesExcept as ut,ArtifactTypePatterns as pt,PipelineConfigService as ht,SecurityGroupWriter as gt,TaskMonitorWrapper as vt,confirmNotManaged as ft,setMatchingResourceSummary as Et,DeployInitializer as yt,DeployingIntoManagedClusterWarning as bt,ServerGroupDetailsField as Ct,ServerGroupNamePreview as Nt,TaskReason as St,parseNum as wt,ToggleButtonGroup as kt,ToggleSize as Tt,usePrevious as It,InstanceArchetypeSelector as Pt,InstanceTypeSelector as At,UserVerification as Gt,MinMaxDesiredChanges as xt,ServerGroupWarningMessageService as Dt,ClusterTargetBuilder as Bt,ServerGroupReader as Ft,CloudMetricsReader as Mt,TaskMonitorModal as Rt,EntitySource as Lt,ViewChangesLink as zt,CapacityDetailsSection as Ot,ViewScalingActivitiesLink as $t,ShowUserData as Ut,ApplicationNameValidator as Vt}from"@spinnaker/core";import*as Ht from"react";import qt,{useState as Wt,useEffect as jt}from"react";import Zt,{isEmpty as _t,forOwn as Kt,uniqBy as Yt,cloneDeep as Xt,orderBy as Jt,flatten as Qt,isNil as ea,flatMap as ta,isEqual as aa,sortBy as na,filter as ra,chain as la,map as sa,pickBy as ia,groupBy as oa,get as ca,uniq as da,difference as ma,some as ua,isNumber as pa,set as ha,partition as ga,every as va,values as fa,head as Ea,isString as ya,clone as ba,has as Ca,keys as Na,intersection as Sa,extend as wa,find as ka,xor as Ta,keyBy as Ia}from"lodash";import Pa from"classnames";import{Subject as Aa,from as Ga,combineLatest as xa,BehaviorSubject as Da,of as Ba,Observable as Fa}from"rxjs";import{map as Ma,distinctUntilChanged as Ra,shareReplay as La,switchMap as za,withLatestFrom as Oa,takeUntil as $a,tap as Ua,mergeMap as Va,catchError as Ha,debounceTime as qa,take as Wa}from"rxjs/operators";import{Dropdown as ja,Modal as Za,Button as _a,MenuItem as Ka,Tooltip as Ya,OverlayTrigger as Xa,Checkbox as Ja,ModalFooter as Qa}from"react-bootstrap";import{UISref as en,UISrefActive as tn}from"@uirouter/react";import an from"react-select";import{SortableHandle as nn,arrayMove as rn,SortableElement as ln,SortableContainer as sn}from"react-sortable-hoc";import{Form as on,Field as cn}from"formik";import dn from"react-virtualized-select";import{Chart as mn,LineController as un,LineElement as pn,PointElement as hn,LinearScale as gn,Title as vn,TimeScale as fn,Tooltip as En,Legend as yn,Filler as bn}from"chart.js";import"chartjs-adapter-luxon";const Cn=o.providers.aws||{defaults:{}};Cn&&(Cn.adHocInfraWritesEnabled=null==(e=Cn.adHocInfraWritesEnabled)||e,Cn.resetToOriginal=o.resetProvider("aws"));class Nn extends qt.Component{constructor(){super(...arguments),this.handleChange=(e,t)=>{this.props.command.termination[e]=t,this.forceUpdate()}}render(){var e;const{command:t}=this.props;/* @__PURE__ */
|
|
3
3
|
return qt.createElement("div",{className:"form-group",style:{marginTop:"20px"}},/* @__PURE__ */qt.createElement("div",{className:"well-compact alert alert-warning"},/* @__PURE__ */qt.createElement("strong",null,"Note:")," a rolling push only updates the"," ",/* @__PURE__ */qt.createElement("em",null,"launch ",Boolean(null==(e=Cn.serverGroups)?void 0:e.enableLaunchTemplates)?"template":"configuration")," ","for the auto scaling group.",/* @__PURE__ */qt.createElement("br",null)," Changes to the following fields will be ignored:",/* @__PURE__ */qt.createElement("ul",null,/* @__PURE__ */qt.createElement("li",null,"Account, Region, Subnet Type"),/* @__PURE__ */qt.createElement("li",null,"Capacity"),/* @__PURE__ */qt.createElement("li",null,"Load Balancers"),/* @__PURE__ */qt.createElement("li",null,"Health Check Configuration"),/* @__PURE__ */qt.createElement("li",null,"Termination Policies, Enable Traffic flag"))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:t.termination.relaunchAllInstances,onChange:e=>this.handleChange("relaunchAllInstances",e.target.checked)}),/* @__PURE__ */qt.createElement("b",null,"Relaunch all instances"),/* @__PURE__ */qt.createElement(c,{id:"strategy.rollingPush.relaunchAll"})))),!t.termination.relaunchAllInstances&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-5 sm-label-right"},"Total relaunches",/* @__PURE__ */qt.createElement(c,{id:"strategy.rollingPush.totalRelaunches"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",value:t.termination.totalRelaunches,onChange:e=>this.handleChange("totalRelaunches",e.target.value),min:"0"}))),(t.termination.totalRelaunches>0||t.termination.relaunchAllInstances)&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-5 sm-label-right"},"Concurrent relaunches",/* @__PURE__ */qt.createElement(c,{id:"strategy.rollingPush.concurrentRelaunches"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",value:t.termination.concurrentRelaunches,onChange:e=>this.handleChange("concurrentRelaunches",e.target.value),min:"1"}))),(t.termination.totalRelaunches>0||t.termination.relaunchAllInstances)&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-5 sm-label-right"},"Order",/* @__PURE__ */qt.createElement(c,{id:"strategy.rollingPush.order"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-3"},/* @__PURE__ */qt.createElement("select",{className:"input input-sm",style:{width:"100px"},value:t.termination.order,onChange:e=>this.handleChange("order",e.target.value)},
|
|
4
4
|
/* @__PURE__ */qt.createElement("option",{value:"oldest"},"oldest first"),
|
|
5
|
-
/* @__PURE__ */qt.createElement("option",{value:"newest"},"newest first")))))}}d.registerStrategy({label:"Rolling Push (not recommended)",description:`Updates the launch ${(null==(t=Cn.serverGroups)?void 0:t.enableLaunchTemplates)?"template":"configuration"} for this server group, then terminates instances incrementally,\n replacing them with instances launched with the updated configuration. This is not a best practice - it goes against\n the principles of immutable infrastructure - but may be necessary in some cases.`,key:"rollingpush",providerRestricted:!0,additionalFields:["termination.totalRelaunches","termination.concurrentRelaunches","termination.order","termination.relaunchAllInstances"],AdditionalFieldsComponent:Nn,initializationMethod:e=>{var t,a;e.termination=e.termination||{order:"oldest",relaunchAllInstances:!0,concurrentRelaunches:1,totalRelaunches:Number(null!=(a=null==(t=null==e?void 0:e.capacity)?void 0:t.max)?a:1)}}});
|
|
6
|
-
return qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-11"},/* @__PURE__ */qt.createElement("div",{className:"sp-margin-m-bottom"},/* @__PURE__ */qt.createElement(u,{name:"role",label:"Role ARN",input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter role ARN",name:"role"}),required:!0}))))}}const
|
|
7
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal "},e&&/* @__PURE__ */qt.createElement("div",{className:l},/* @__PURE__ */qt.createElement("strong",null,"Your function will be named: "),/* @__PURE__ */qt.createElement(c,{id:"aws.function.name"}),/* @__PURE__ */qt.createElement("span",null,this.props.app.name,"-",a.functionName),/* @__PURE__ */qt.createElement(u,{name:"functionName",input:()=>null})),/* @__PURE__ */qt.createElement(u,{name:"credentials",label:"Account",input:e=>/* @__PURE__ */qt.createElement(g,{...e,stringOptions:n.map(e=>e.name),clearable:!0})}),/* @__PURE__ */qt.createElement(u,{name:"region",label:"Region",input:e=>/* @__PURE__ */qt.createElement(g,{...e,stringOptions:r.map(e=>e.name),clearable:!0})}),/* @__PURE__ */qt.createElement(u,{name:"functionName",label:"Function Name",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.name"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),/* @__PURE__ */qt.createElement(u,{name:"runtime",label:"Runtime",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.runtime"}),input:e=>/* @__PURE__ */qt.createElement(g,{...e,stringOptions:
|
|
8
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal "},"Dead Letter Config",/* @__PURE__ */qt.createElement(u,{name:"deadLetterConfig.targetArn",label:"Target ARN",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.deadletterqueue"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),"X-Ray Tracing",/* @__PURE__ */qt.createElement(u,{name:"tracingConfig.mode",label:"Mode",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.tracingConfig.mode"}),input:e=>/* @__PURE__ */qt.createElement(g,{...e,stringOptions:["Active","PassThrough"],clearable:!0})}))}}class
|
|
9
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal "},/* @__PURE__ */qt.createElement(u,{name:"envVariables",label:"Env Variables",input:e=>/* @__PURE__ */qt.createElement(f,{...e,allowEmptyValues:!0,addButtonLabel:"Add"})}),/* @__PURE__ */qt.createElement(u,{name:"kmskeyArn",label:"Key ARN",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.kmsKeyArn"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e})}))}}class
|
|
10
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal "},/* @__PURE__ */qt.createElement(u,{name:"description",label:"Description",input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),/* @__PURE__ */qt.createElement(u,{name:"memorySize",label:"Memory (MB)",help:/* @__PURE__ */qt.createElement(c,{id:"aws.functionBasicSettings.memorySize"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:128,max:3008})}),/* @__PURE__ */qt.createElement(u,{name:"timeout",label:"Timeout (seconds)",help:/* @__PURE__ */qt.createElement(c,{id:"aws.functionBasicSettings.timeout"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:1,max:900})}),/* @__PURE__ */qt.createElement(u,{name:"targetGroups",label:"Target Group Name",input:e=>/* @__PURE__ */qt.createElement(p,{...e})}))}}class
|
|
11
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal "},/* @__PURE__ */qt.createElement(u,{name:"tags",input:e=>/* @__PURE__ */qt.createElement(f,{...e,allowEmptyValues:!1,addButtonLabel:"Add"})}))}}class
|
|
12
|
-
return qt.createElement("span",{className:"vpc-tag"},n)}const
|
|
13
|
-
return qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-11"},/* @__PURE__ */qt.createElement("div",{className:"sp-margin-m-bottom"},a.credentials&&/* @__PURE__ */qt.createElement(u,{name:"vpcId",label:"VPC Id",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.vpc.id"}),input:t=>/* @__PURE__ */qt.createElement(g,{...t,stringOptions:e.filter(e=>e.account===a.credentials).map(e=>e.id),clearable:!0}),onChange:this.setVpc,required:!1})),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-4 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Subnets "),/* @__PURE__ */qt.createElement(c,{id:"aws.function.subnet"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},0===n.length&&/* @__PURE__ */qt.createElement("div",{className:"form-control-static"},"No subnets found in the selected account/region/VPC"),a.vpcId?/* @__PURE__ */qt.createElement(S,{multi:!0,options:n,value:a.subnetIds,onChange:this.handleSubnetUpdate}):null)),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-4 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Security Groups "),/* @__PURE__ */qt.createElement(c,{id:"aws.function.subnet"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},0===r.length&&/* @__PURE__ */qt.createElement("div",{className:"form-control-static"},"No security groups found in the selected account/region/VPC"),a.credentials&&a.vpcId?/* @__PURE__ */qt.createElement(S,{multi:!0,options:r,value:a.securityGroupIds,onChange:this.handleSecurityGroupsUpdate}):null))))}};
|
|
14
|
-
return qt.createElement("div",{style:{display:"inline-block"}},Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement(ja,{className:"dropdown",id:"function-actions-dropdown"},/* @__PURE__ */qt.createElement(ja.Toggle,{className:"btn btn-sm btn-primary dropdown-toggle"},/* @__PURE__ */qt.createElement("span",null,"Function Actions")),/* @__PURE__ */qt.createElement(ja.Menu,{className:"dropdown-menu"},/* @__PURE__ */qt.createElement("li",{className:a?"":"disabled"},/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.editFunction},"Edit Function")),t.functionName&&/* @__PURE__ */qt.createElement("li",null,/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.deleteFunction},"Delete Function")),o&&o.feature.entityTags&&/* @__PURE__ */qt.createElement(B,{component:t,application:e,entityType:"function",onUpdate:this.entityTagUpdate}))))}};jn.contextType=C;let Zn=jn;const _n={type:"m5",description:"m5 instances provide a balance of compute, memory, and network resources. They are a good choice for most applications.",instanceTypes:[{name:"m5.large",label:"Large",cpu:2,memory:8,storage:{type:"EBS"},costFactor:2},{name:"m5.xlarge",label:"XLarge",cpu:4,memory:16,storage:{type:"EBS"},costFactor:3},{name:"m5.2xlarge",label:"2XLarge",cpu:8,memory:32,storage:{type:"EBS"},costFactor:4}]},Kn=[{type:"general",label:"General Purpose",families:[_n,{type:"t2",description:"t2 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases).",instanceTypes:[{name:"t2.small",label:"Small",cpu:1,memory:2,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:12},{name:"t2.medium",label:"Medium",cpu:2,memory:4,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:24},{name:"t2.large",label:"Large",cpu:2,memory:8,storage:{type:"EBS"},costFactor:2,cpuCreditsPerHour:36},{name:"t2.xlarge",label:"XLarge",cpu:4,memory:16,storage:{type:"EBS"},costFactor:3,cpuCreditsPerHour:54},{name:"t2.2xlarge",label:"2XLarge",cpu:8,memory:32,storage:{type:"EBS"},costFactor:4,cpuCreditsPerHour:81}]},{type:"t3",description:"t3 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases).",instanceTypes:[{name:"t3.small",label:"Small",cpu:2,memory:2,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:24},{name:"t3.medium",label:"Medium",cpu:2,memory:4,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:24},{name:"t3.large",label:"Large",cpu:2,memory:8,storage:{type:"EBS"},costFactor:2,cpuCreditsPerHour:36},{name:"t3.xlarge",label:"XLarge",cpu:4,memory:16,storage:{type:"EBS"},costFactor:3,cpuCreditsPerHour:96},{name:"t3.2xlarge",label:"2XLarge",cpu:8,memory:32,storage:{type:"EBS"},costFactor:4,cpuCreditsPerHour:192}]}],icon:"hdd",showCpuCredits:!0,descriptionListOverride:[_n.description,"t2/t3 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases)."]},{type:"memory",label:"High Memory",families:[{type:"r5",description:"r5 instances are optimized for memory-intensive applications and have the lowest cost per GiB of RAM among Amazon EC2 instance types.",instanceTypes:[{name:"r5.large",label:"Large",cpu:2,memory:16,storage:{type:"EBS"},costFactor:1},{name:"r5.xlarge",label:"XLarge",cpu:4,memory:32,storage:{type:"EBS"},costFactor:2},{name:"r5.2xlarge",label:"2XLarge",cpu:8,memory:64,storage:{type:"EBS"},costFactor:2},{name:"r5.4xlarge",label:"4XLarge",cpu:16,memory:128,storage:{type:"EBS"},costFactor:3}]}],icon:"hdd"},{type:"micro",label:"Micro Utility",families:[{type:"t2",description:"t2 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases).",instanceTypes:[{name:"t2.nano",label:"Nano",cpu:1,memory:.5,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:3},{name:"t2.micro",label:"Micro",cpu:1,memory:1,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:6},{name:"t2.small",label:"Small",cpu:1,memory:2,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:12}]},{type:"t3",description:"t3 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases).",instanceTypes:[{name:"t3.nano",label:"Nano",cpu:2,memory:.5,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:6},{name:"t3.micro",label:"Micro",cpu:2,memory:1,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:12},{name:"t3.small",label:"Small",cpu:2,memory:2,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:24}]}],icon:"hdd",showCpuCredits:!0,descriptionListOverride:["t2/t3 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases)."]},{type:"custom",label:"Custom Type",families:[],icon:"asterisk"}],Yn=null!=(r=null==(n=null==(a=Cn.instanceTypes)?void 0:a.exclude)?void 0:n.categories)?r:[],Xn=null!=(i=null==(s=null==(l=Cn.instanceTypes)?void 0:l.exclude)?void 0:s.families)?i:[],Jn=Kn.filter(({type:e})=>!Yn.includes(e)).map(e=>Object.assign({},e,{families:e.families.filter(({type:e})=>!Xn.includes(e))}));class Qn{constructor(){this.instanceClassOrder=["xlarge","large","medium","small","micro","nano"],this.families={ec2ClassicSupported:["m1","m3","t1","c1","c3","cc2","cr1","m2","r3","d2","hs1","i2","g2"],ebsOptimized:["c4","d2","f1","g3","i3","m4","m5","p2","r4","r5","x1"],burstablePerf:["t2","t3","t3a","t4g"]}}getCategories(){return Promise.resolve(Jn)}getAllTypesByRegion(){return F("/instanceTypes").get().then(function(e){return Zt.chain(e).map(function(e){return{...e,key:[e.region,e.account,e.name].join(":")}}).uniqBy("key").groupBy("region").value()})}sortTypesByFamilyAndSize(e,t){const a=e.split("."),n=t.split("."),[r,l=""]=a,[s,i=""]=n;if(r!==s)return r>s?1:r<s?-1:0;const o=this.instanceClassOrder.findIndex(e=>l.endsWith(e)),c=this.instanceClassOrder.findIndex(e=>i.endsWith(e));if(-1===o||-1===c)return 0;if(0===o&&0===c){const e=parseInt(l.replace("xlarge",""))||0,t=parseInt(i.replace("xlarge",""))||0;return t<e?1:t>e?-1:0}return o>c?-1:o<c?1:0}getAvailableTypesForRegions(e,t){let a=[];return(t=t||[])&&t.length&&(a=e[t[0]]||[]),t.forEach(function(t){e[t]&&(a=Zt.intersectionBy(a,e[t],"name"))}),null==a?void 0:a.sort((e,t)=>this.sortTypesByFamilyAndSize(e.name,t.name))}filterInstanceTypes(e,t,a,n){const r=(e,t)=>e.some(e=>e.toLowerCase()===t.toLowerCase());return Zt.filter(e,e=>"*"===t&&"*"===n||!(!a&&!this.families.ec2ClassicSupported.includes(e.name.split(".")[0]))&&(!(t&&e.supportedVirtualizationTypes&&!r(e.supportedVirtualizationTypes,t))&&!(n&&e.supportedArchitectures&&!r(e.supportedArchitectures,n))))}isEbsOptimized(e){if(!e)return!1;const t=Zt.split(e,".",1)[0];return this.families.ebsOptimized.includes(t)}isBurstingSupportedForAllTypes(e){return!(!e||!e.length)&&e.every(e=>this.isBurstingSupported(e))}isBurstingSupported(e){if(!e)return!1;const t=Zt.split(e,".",1)[0];return this.families.burstablePerf.includes(t)}getInstanceTypesInCategory(e,t){var a;if(!e||!e.length||!t)return[];if("custom"===t)return e;const n=Zt.flatten(null==(a=Zt.find(Kn,{type:t}))?void 0:a.families.map(e=>e.instanceTypes.map(e=>e.name)));return Zt.intersection(e,n)}}class er{addComparator(e){if(e.comparisonOperator)switch(e.comparisonOperator){case"LessThanThreshold":e.comparator="<";break;case"GreaterThanThreshold":e.comparator=">";break;case"LessThanOrEqualToThreshold":e.comparator="≤";break;case"GreaterThanOrEqualToThreshold":e.comparator="≥"}}addAdjustmentAttributes(e){e.operator=e.scalingAdjustment<0?"decrease":"increase",e.absAdjustment=Math.abs(e.scalingAdjustment)}transformScalingPolicy(e){const t={...e},a=(e,t)=>t.metricIntervalUpperBound-e.metricIntervalUpperBound,n=(e,t)=>e.metricIntervalLowerBound-t.metricIntervalLowerBound;if(t.alarms=e.alarms||[],t.alarms.forEach(e=>this.addComparator(e)),this.addAdjustmentAttributes(t),t.stepAdjustments&&t.stepAdjustments.length){t.stepAdjustments.forEach(e=>this.addAdjustmentAttributes(e));const r=e.stepAdjustments.every(e=>void 0!==e.metricIntervalUpperBound)?a:n;t.stepAdjustments.sort((e,t)=>r(e,t))}return t}normalizeServerGroupDetails(e){const t={...e};return e.scalingPolicies&&(t.scalingPolicies=e.scalingPolicies.map(e=>this.transformScalingPolicy(e))),t}normalizeServerGroup(e){return e.instances.forEach(t=>{t.vpcId=e.vpcId}),zn.listVpcs().then(t=>this.addVpcNameToServerGroup(e)(t))}addVpcNameToServerGroup(e){return t=>{const a=t.find(t=>t.id===e.vpcId);return e.vpcName=a?a.name:"",e}}convertServerGroupCommandToDeployConfiguration(e){const t={...e};t.cloudProvider="aws",t.availabilityZones={[t.region]:e.availabilityZones},t.loadBalancers=(e.loadBalancers||[]).concat(e.vpcLoadBalancers||[]),t.targetGroups=e.targetGroups||[],t.account=t.credentials,t.subnetType=t.subnetType||"",t.instanceType=t.instanceType||t.launchTemplateOverridesForInstanceType&&t.launchTemplateOverridesForInstanceType[0].instanceType,"clone"!==e.viewState.mode&&delete t.source,t.ramdiskId||delete t.ramdiskId;return["region","viewState","backingData","selectedProvider","instanceProfile","vpcId"].forEach(e=>{delete t[e]}),t}constructNewStepScalingPolicyTemplate(e){return{alarms:[{namespace:"AWS/EC2",metricName:"CPUUtilization",threshold:50,statistic:"Average",comparisonOperator:"GreaterThanThreshold",evaluationPeriods:1,dimensions:[{name:"AutoScalingGroupName",value:e.name}],period:60}],adjustmentType:"ChangeInCapacity",stepAdjustments:[{scalingAdjustment:1,metricIntervalLowerBound:0}],estimatedInstanceWarmup:600}}constructNewTargetTrackingPolicyTemplate(){return{alarms:[],estimatedInstanceWarmup:300,targetTrackingConfiguration:{targetValue:null,predefinedMetricSpecification:{predefinedMetricType:"ASGAverageCPUUtilization"}}}}}let tr,ar,nr;const rr={get awsInstanceTypeService(){return tr=tr||new Qn},get awsServerGroupTransformer(){return ar=ar||new er},get functionReader(){return nr=nr||new M(new Sn)}};class lr extends qt.Component{constructor(e){super(e),this.destroy$=new Aa,this.state={loading:!0}}extractFunction(){const{app:e,functionObj:t}=this.props;e.functions.data.find(e=>e.functionName===t.functionName&&e.region===t.region&&e.account===t.account)?Ga(rr.functionReader.getFunctionDetails("aws",t.account,t.region,t.functionName)).pipe($a(this.destroy$)).subscribe(e=>{e.length&&this.setState({functionDef:e[0],loading:!1})}):this.setState({functionDef:{},loading:!1})}componentDidMount(){const{app:e}=this.props,t=e.functions;Ga(t.ready()).pipe($a(this.destroy$)).subscribe(()=>{const e=t.onRefresh(()=>this.extractFunction());this.setState({dataSourceUnsubscribe:e}),this.extractFunction()})}componentWillUnmount(){this.state.dataSourceUnsubscribe&&this.state.dataSourceUnsubscribe(),this.destroy$.next()}render(){const{app:e}=this.props,{loading:t,functionDef:a}=this.state;if(t)/* @__PURE__ */
|
|
5
|
+
/* @__PURE__ */qt.createElement("option",{value:"newest"},"newest first")))))}}d.registerStrategy({label:"Rolling Push (not recommended)",description:`Updates the launch ${(null==(t=Cn.serverGroups)?void 0:t.enableLaunchTemplates)?"template":"configuration"} for this server group, then terminates instances incrementally,\n replacing them with instances launched with the updated configuration. This is not a best practice - it goes against\n the principles of immutable infrastructure - but may be necessary in some cases.`,key:"rollingpush",providerRestricted:!0,additionalFields:["termination.totalRelaunches","termination.concurrentRelaunches","termination.order","termination.relaunchAllInstances"],AdditionalFieldsComponent:Nn,initializationMethod:e=>{var t,a;e.termination=e.termination||{order:"oldest",relaunchAllInstances:!0,concurrentRelaunches:1,totalRelaunches:Number(null!=(a=null==(t=null==e?void 0:e.capacity)?void 0:t.max)?a:1)}}});const Sn=e=>{var t;return null!=(t=null==e?void 0:e.vpcZoneIdentifier)?t:null==e?void 0:e.vpczoneIdentifier},wn=e=>{var t;return null!=(t=null==e?void 0:e.dnsName)?t:null==e?void 0:e.dnsname},kn=e=>(null==e?void 0:e.vpcId)||(null==e?void 0:e.vpcid),Tn=e=>{var t;return null!=(t=null==e?void 0:e.kmsKeyArn)?t:null==e?void 0:e.kmskeyArn},In=e=>{var t;return null!=(t=null==e?void 0:e.okActions)?t:null==e?void 0:e.okactions};class Pn{constructor(){this.convertFunctionForEditing=e=>({...e,envVariables:e.environment?e.environment.variables:{},credentials:e.account,tracingConfig:{mode:e.tracingConfig?e.tracingConfig.mode:""},deadLetterConfig:{targetArn:e.deadLetterConfig?e.deadLetterConfig.targetArn:""},kmskeyArn:Tn(e),KMSKeyArn:Tn(e)||"",subnetIds:e.vpcConfig?e.vpcConfig.subnetIds:[],securityGroupIds:e.vpcConfig?e.vpcConfig.securityGroupIds:[],vpcId:e.vpcConfig?e.vpcConfig.vpcId:"",operation:"",cloudProvider:e.cloudProvider,region:e.region,targetGroups:_t(e.targetGroups)?"":e.targetGroups})}normalizeFunction(e){const t=e;return t.credentials=e.account,t}normalizeFunctionSet(e){return e.map(e=>this.normalizeFunction(e))}constructNewAwsFunctionTemplate(e){return{role:"",runtime:"",s3bucket:"",s3key:"",handler:"",functionName:"",publish:!1,tags:{},memorySize:128,description:"",credentials:e.defaultCredentials.aws||Cn.defaults.account,cloudProvider:"aws",detail:"",region:e.defaultRegions.aws||Cn.defaults.region,envVariables:{},tracingConfig:{mode:"PassThrough"},kmskeyArn:"",vpcId:"",subnetIds:[],securityGroupIds:[],timeout:3,deadLetterConfig:{targetArn:""},operation:"",targetGroups:""}}}const An=(e,t)=>e.match(/^arn:aws:iam::\d{12}:role\/?\/[a-zA-Z_0-9+=,.@\-/]+/)?void 0:`Invalid role. ${t} must match regular expression: arn:aws:iam::d{12}:role/?[a-zA-Z_0-9+=,.@-_/]+`,Gn=(e,t)=>e.match(/^[0-9A-Za-z.-]*[^.]$/)?void 0:`Invalid S3 Bucket name. ${t} must match regular expression: [0-9A-Za-z.-]*[^.]$`,xn=(e,t)=>e.match(/arn:aws[a-zA-Z-]?:[a-zA-Z_0-9.-]+:./)?void 0:`Invalid ARN. ${t} must match regular expression: /arn:aws[a-zA-Z-]?:[a-zA-Z_0-9.-]+:./`,Dn=(e,t)=>_t(e)?`At least one ${t} is required`:void 0,Bn=(e,t)=>e.match(/^[0-9A-Za-z]*$/)?void 0:`Invalid String Value. ${t} must match regular expression: [0-9A-Za-z]`;class Fn extends qt.Component{constructor(e){super(e)}validate(e){const t=new m(e);return t.field("role","Role ARN").required().withValidators(An),t.validateForm()}render(){/* @__PURE__ */
|
|
6
|
+
return qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-11"},/* @__PURE__ */qt.createElement("div",{className:"sp-margin-m-bottom"},/* @__PURE__ */qt.createElement(u,{name:"role",label:"Role ARN",input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter role ARN",name:"role"}),required:!0}))))}}const Mn=["nodejs24.x","nodejs22.x","java25","java21","java17","java11","java8.al2","python3.14","python3.13","python3.12","python3.11","python3.10","dotnet10","dotnet9","dotnet8","ruby4.0","ruby3.4","ruby3.3","provided.al2023","provided.al2"],Rn="(Optional) Stack is naming components of a function, used to create vertical stacks of dependent services for integration testing.",Ln="(Optional) Detail is a string of free-form alphanumeric characters to describe any other variables in naming a function.";class zn extends qt.Component{constructor(){super(...arguments),this.state={accounts:[],existingFunctionNames:[],regions:[]},this.props$=new Aa,this.destroy$=new Aa}validate(e){const t=new m(e);t.field("s3bucket","S3 Bucket Name").optional().withValidators(Gn);const a=t.validateForm();return this.props.isNew&&this.state.existingFunctionNames.includes(this.props.app.name.concat("-").concat(e.functionName))&&(a.functionName=`There is already a function in ${e.credentials}:${e.region} with that name.`),a}componentDidUpdate(){this.props$.next(this.props)}componentWillUnmount(){this.destroy$.next()}componentDidMount(){const e=this.props$.pipe(Ma(e=>e.formik.values)),t={account$:e.pipe(Ma(e=>e.credentials),Ra()),region$:e.pipe(Ma(e=>e.region),Ra()),functionName$:e.pipe(Ma(e=>e.functionName),Ra()),runtime$:e.pipe(Ma(e=>e.runtime),Ra()),s3bucket$:e.pipe(Ma(e=>e.s3bucket),Ra()),s3key$:e.pipe(Ma(e=>e.s3key),Ra()),handler$:e.pipe(Ma(e=>e.handler),Ra())},a=Ga(h.listAccounts("aws")).pipe(La(1)),n=xa([t.account$,a]).pipe(za(([e,t])=>h.getRegionsForAccount(e)),La(1)),r=this.props.app.getDataSource("functions").data$,l=xa([r,t.account$,t.region$]).pipe(Ma(([e,t,a])=>e.filter(e=>e.account===t&&e.region===a).map(e=>e.functionName)),La(1));n.pipe(Oa(t.region$),$a(this.destroy$)).subscribe(([e,t])=>{e.some(e=>e.name===t)||this.props.formik.setFieldValue("region",e[0]&&e[0].name)}),xa([a,n,l]).pipe($a(this.destroy$)).subscribe(([e,t,a])=>this.setState({accounts:e,regions:t,existingFunctionNames:a}))}render(){const{isNew:e}=this.props,{errors:t,values:a}=this.props.formik,{accounts:n,regions:r}=this.state,l=Pa({well:!0,"alert-danger":!!t.functionName,"alert-info":!t.functionName});/* @__PURE__ */
|
|
7
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal "},e&&/* @__PURE__ */qt.createElement("div",{className:l},/* @__PURE__ */qt.createElement("strong",null,"Your function will be named: "),/* @__PURE__ */qt.createElement(c,{id:"aws.function.name"}),/* @__PURE__ */qt.createElement("span",null,this.props.app.name,"-",a.functionName),/* @__PURE__ */qt.createElement(u,{name:"functionName",input:()=>null})),/* @__PURE__ */qt.createElement(u,{name:"credentials",label:"Account",input:e=>/* @__PURE__ */qt.createElement(g,{...e,stringOptions:n.map(e=>e.name),clearable:!0})}),/* @__PURE__ */qt.createElement(u,{name:"region",label:"Region",input:e=>/* @__PURE__ */qt.createElement(g,{...e,stringOptions:r.map(e=>e.name),clearable:!0})}),/* @__PURE__ */qt.createElement(u,{name:"functionName",label:"Function Name",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.name"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),/* @__PURE__ */qt.createElement(u,{name:"runtime",label:"Runtime",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.runtime"}),input:e=>/* @__PURE__ */qt.createElement(g,{...e,stringOptions:Mn,clearable:!0})}),/* @__PURE__ */qt.createElement(u,{name:"s3bucket",label:"S3 Bucket",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.s3bucket"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"S3 bucket name"})}),/* @__PURE__ */qt.createElement(u,{name:"s3key",label:"S3 Key",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.s3key"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"object.zip"})}),/* @__PURE__ */qt.createElement(u,{name:"handler",label:"Handler",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.handler"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"filename.method"})}),/* @__PURE__ */qt.createElement(u,{name:"publish",label:"Publish",input:e=>/* @__PURE__ */qt.createElement(v,{...e})}))}}class On extends qt.Component{constructor(e){super(e),this.validate=e=>{const t=new m(e);return t.field("deadLetterConfig.targetArn","Target ARN").optional().withValidators(xn),t.validateForm()}}render(){/* @__PURE__ */
|
|
8
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal "},"Dead Letter Config",/* @__PURE__ */qt.createElement(u,{name:"deadLetterConfig.targetArn",label:"Target ARN",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.deadletterqueue"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),"X-Ray Tracing",/* @__PURE__ */qt.createElement(u,{name:"tracingConfig.mode",label:"Mode",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.tracingConfig.mode"}),input:e=>/* @__PURE__ */qt.createElement(g,{...e,stringOptions:["Active","PassThrough"],clearable:!0})}))}}class $n extends qt.Component{constructor(){super(...arguments),this.validate=e=>{const t=new m(e);return t.field("kmskeyArn","KMS Key ARN").optional().withValidators(xn),t.validateForm()}}render(){/* @__PURE__ */
|
|
9
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal "},/* @__PURE__ */qt.createElement(u,{name:"envVariables",label:"Env Variables",input:e=>/* @__PURE__ */qt.createElement(f,{...e,allowEmptyValues:!0,addButtonLabel:"Add"})}),/* @__PURE__ */qt.createElement(u,{name:"kmskeyArn",label:"Key ARN",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.kmsKeyArn"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e})}))}}class Un extends qt.Component{constructor(){super(...arguments),this.validate=()=>({})}render(){/* @__PURE__ */
|
|
10
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal "},/* @__PURE__ */qt.createElement(u,{name:"description",label:"Description",input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),/* @__PURE__ */qt.createElement(u,{name:"memorySize",label:"Memory (MB)",help:/* @__PURE__ */qt.createElement(c,{id:"aws.functionBasicSettings.memorySize"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:128,max:3008})}),/* @__PURE__ */qt.createElement(u,{name:"timeout",label:"Timeout (seconds)",help:/* @__PURE__ */qt.createElement(c,{id:"aws.functionBasicSettings.timeout"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:1,max:900})}),/* @__PURE__ */qt.createElement(u,{name:"targetGroups",label:"Target Group Name",input:e=>/* @__PURE__ */qt.createElement(p,{...e})}))}}class Vn extends qt.Component{constructor(){super(...arguments),this.validate=e=>{const t=new m(e);return t.field("tags","Tag").required().withValidators(Dn),t.validateForm()}}render(){/* @__PURE__ */
|
|
11
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal "},/* @__PURE__ */qt.createElement(u,{name:"tags",input:e=>/* @__PURE__ */qt.createElement(f,{...e,allowEmptyValues:!1,addButtonLabel:"Add"})}))}}class Hn{static listVpcs(){return this.cache||(this.cache=y.listNetworksByProvider("aws").then(e=>e.map(e=>(e.label=e.name,e.deprecated=!!e.deprecated,e.deprecated&&(e.label+=" (deprecated)"),e)))),this.cache}static resetCache(){this.cache=null}static getVpcName(e){return this.listVpcs().then(t=>{const a=t.find(t=>t.id===e);return a?a.name:null})}}const qn="None (EC2 Classic)";function Wn(e){const{vpcId:t}=e,a=b(async()=>{const t=await Hn.getVpcName(e.vpcId);return t?`${t} (${e.vpcId})`:`(${e.vpcId})`},qn,[t]),n=t?a.result:qn;/* @__PURE__ */
|
|
12
|
+
return qt.createElement("span",{className:"vpc-tag"},n)}const jn=class extends qt.Component{constructor(e){super(e),this.state={vpcOptions:[],accounts:null,regions:[],subnets:[],availableSubnets:[],securityGroups:null},this.props$=new Aa,this.destroy$=new Aa,this.handleSubnetUpdate=e=>{const t=e.map(e=>e.value);this.props.formik.setFieldValue("subnetIds",t)},this.handleSecurityGroupsUpdate=e=>{const t=e.map(e=>e.value);this.props.formik.setFieldValue("securityGroupIds",t)},this.setVpc=e=>{this.props.formik.setFieldValue("vpcId",e),this.props.formik.setFieldValue("subnetIds",[]);const{availableSubnets:t}=this.state,a=t.filter(function(t){return t.vpcId.includes(e)});this.setState({subnets:a})},this.toSubnetOption=e=>({value:e.subnetId,label:e.subnetId}),this.getSecurityGroupsByVpc=e=>{const{values:t}=this.props.formik,a=[];return Kt(e,function(e,n){n===t.credentials&&Kt(e,function(e,n){"aws"===n&&Kt(e,function(e,n){n===t.region&&e.forEach(function(e){e.vpcId===t.vpcId&&a.push({value:e.id,label:e.name})})})})}),a},this.getSubnetOptions=()=>{const{subnets:e,availableSubnets:t}=this.state,{values:a}=this.props.formik;return!this.props.isNew&&a.vpcId?t.filter(function(e){return e.vpcId.includes(a.vpcId)}).map(this.toSubnetOption):e.map(this.toSubnetOption)},this.getAllVpcs()}getAllVpcs(){Ga(Hn.listVpcs()).pipe($a(this.destroy$)).subscribe(e=>{this.setState({vpcOptions:e})})}validate(){return{}}getAvailableSubnets(){return N.listSubnetsByProvider("aws")}getAvailableSecurityGroups(){return this.context.services.securityGroupReader.getAllSecurityGroups()}makeSubnetOptions(e){const t=e.map(e=>({subnetId:e.id,vpcId:e.vpcId}));return Yt(t,"subnetId")}componentDidUpdate(){this.props$.next(this.props)}componentWillUnmount(){this.destroy$.next()}componentDidMount(){const e=Promise.resolve(this.getAvailableSubnets()).then(e=>(e.forEach(e=>{e.label=e.id,e.deprecated=!!e.deprecated,e.deprecated&&(e.label+=" (deprecated)")}),e.filter(e=>e.label))).then(e=>this.makeSubnetOptions(e)),t=Promise.resolve(this.getAvailableSecurityGroups());xa([e,t]).pipe($a(this.destroy$)).subscribe(([e,t])=>this.setState({availableSubnets:e,securityGroups:t}))}render(){const{vpcOptions:e,securityGroups:t}=this.state,{values:a}=this.props.formik,n=this.getSubnetOptions(),r=t?this.getSecurityGroupsByVpc(t):[];/* @__PURE__ */
|
|
13
|
+
return qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-11"},/* @__PURE__ */qt.createElement("div",{className:"sp-margin-m-bottom"},a.credentials&&/* @__PURE__ */qt.createElement(u,{name:"vpcId",label:"VPC Id",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.vpc.id"}),input:t=>/* @__PURE__ */qt.createElement(g,{...t,stringOptions:e.filter(e=>e.account===a.credentials).map(e=>e.id),clearable:!0}),onChange:this.setVpc,required:!1})),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-4 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Subnets "),/* @__PURE__ */qt.createElement(c,{id:"aws.function.subnet"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},0===n.length&&/* @__PURE__ */qt.createElement("div",{className:"form-control-static"},"No subnets found in the selected account/region/VPC"),a.vpcId?/* @__PURE__ */qt.createElement(S,{multi:!0,options:n,value:a.subnetIds,onChange:this.handleSubnetUpdate}):null)),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-4 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Security Groups "),/* @__PURE__ */qt.createElement(c,{id:"aws.function.subnet"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},0===r.length&&/* @__PURE__ */qt.createElement("div",{className:"form-control-static"},"No security groups found in the selected account/region/VPC"),a.credentials&&a.vpcId?/* @__PURE__ */qt.createElement(S,{multi:!0,options:r,value:a.securityGroupIds,onChange:this.handleSecurityGroupsUpdate}):null))))}};jn.contextType=C;let Zn=jn;const _n=class extends qt.Component{constructor(e){super(e),this._isUnmounted=!1,this.submit=e=>{const{app:t}=this.props,{isNew:a}=this.state,n=Xt(e),r=a?"Create":"Update",l=new w({application:t,title:(a?"Creating":"Updating")+" your function",onDismiss:()=>this.props.dismissModal(),onTaskComplete:()=>{this.checkForS3Update(n,r)}});l.submit(()=>(n.type="lambdaFunction",n.operation=a?"createLambdaFunction":"updateLambdaFunctionConfiguration",k.upsertFunction(n,t,r))),this.setState({taskMonitor:l})};const t=new Pn,a=e.functionDef?t.convertFunctionForEditing(e.functionDef):t.constructNewAwsFunctionTemplate(e.app);this.state={isNew:!e.functionDef,functionCommand:a,taskMonitor:null}}static show(e,t){return I.show(Yn,e,{dialogClassName:"wizard-modal modal-lg"},t)}componentWillUnmount(){var e;this._isUnmounted=!0,null==(e=this.refreshUnsubscribe)||e.call(this),this.refreshUnsubscribe=void 0}onApplicationRefresh(e){var t;if(null==(t=this.refreshUnsubscribe)||t.call(this),this.refreshUnsubscribe=void 0,this._isUnmounted)return;this.props.dismissModal(),this.setState({taskMonitor:void 0});const a={name:e.name,accountId:e.credentials,region:e.region,vpcId:e.vpcId,provider:"aws"};this.props.stateService.includes("**.functionDetails")?this.props.stateService.go("^.functionDetails",a):this.props.stateService.go(".functionDetails",a)}onTaskComplete(e){var t;null==(t=this.refreshUnsubscribe)||t.call(this),this.refreshUnsubscribe=void 0,this.refreshUnsubscribe=this.props.app.functions.onNextRefresh(()=>this.onApplicationRefresh(e)),this.props.app.functions.refresh()}checkForS3Update(e,t){const{isNew:a}=this.state;if(!a&&(e.s3bucket||e.s3key)){e.operation="updateLambdaFunctionCode";const{app:a}=this.props;k.upsertFunction(e,a,t)}this.onTaskComplete(e)}render(){const{app:e,dismissModal:t,forPipelineConfig:a,functionDef:n}=this.props,{isNew:r,functionCommand:l,taskMonitor:s}=this.state;let i=a?"Configure Existing Function":"Create New Function";return r||(i=`Edit ${l.functionName}: ${l.region}: ${l.credentials}`),/* @__PURE__ */qt.createElement(P,{heading:i,initialValues:l,taskMonitor:s,dismissModal:t,closeModal:this.submit,submitButtonLabel:a?r?"Add":"Done":r?"Create":"Update",render:({formik:t,nextIdx:a,wizard:l})=>/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(A,{label:"Basic information",wizard:l,order:a(),render:({innerRef:a})=>/* @__PURE__ */qt.createElement(zn,{ref:a,app:e,formik:t,isNew:r,functionDef:n})}),/* @__PURE__ */qt.createElement(A,{label:"Execution Role",wizard:l,order:a(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(Fn,{ref:e,formik:t,isNew:r,functionDef:n})}),/* @__PURE__ */qt.createElement(A,{label:"Environment",wizard:l,order:a(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement($n,{ref:e,formik:t,isNew:r,functionDef:n})}),/* @__PURE__ */qt.createElement(A,{label:"Tags",wizard:l,order:a(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(Vn,{ref:e,formik:t,isNew:r,functionDef:n})}),/* @__PURE__ */qt.createElement(A,{label:"Settings",wizard:l,order:a(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(Un,{ref:e,formik:t,isNew:r,functionDef:n})}),/* @__PURE__ */qt.createElement(A,{label:"Network",wizard:l,order:a(),render:({innerRef:a})=>/* @__PURE__ */qt.createElement(Zn,{ref:a,app:e,formik:t,isNew:r})}),/* @__PURE__ */qt.createElement(A,{label:"Debugging and Error Handling",wizard:l,order:a(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(On,{ref:e,formik:t,isNew:r,functionDef:n})}))})}};_n.defaultProps={closeModal:T,dismissModal:T};let Kn=_n;const Yn=Object.assign(G(Kn),{show:Kn.show}),Xn=class extends qt.Component{constructor(e){super(e),this.editFunction=()=>{const{functionDef:e}=this.props,{application:t}=this.state;Yn.show({app:t,functionDef:e},this.context.services)},this.deleteFunction=()=>{const{app:e,functionDef:t,functionFromParams:a}=this.props,n={application:e,title:"Deleting "+a.functionName},r={cloudProvider:t.cloudProvider,functionName:t.functionName,region:t.region,credentials:t.credentials};x.confirm({header:`Really delete ${a.functionName} in ${a.region}: ${a.account}?`,buttonText:`Delete ${a.functionName}`,account:a.account,taskMonitorConfig:n,submitMethod:()=>k.deleteFunction(r,e)})},this.entityTagUpdate=()=>{this.props.app.functions.refresh()},this.state={application:e.app}}componentDidMount(){const{app:e,functionDef:t}=this.props;let a;const n=t.functionName.split("-")[0];n===e.name?a=e:D.getApplication(n).then(e=>{this.setState({application:e})}).catch(()=>{this.setState({application:this.props.app})}),this.setState({application:a})}render(){const{app:e,functionDef:t}=this.props,{application:a}=this.state;/* @__PURE__ */
|
|
14
|
+
return qt.createElement("div",{style:{display:"inline-block"}},Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement(ja,{className:"dropdown",id:"function-actions-dropdown"},/* @__PURE__ */qt.createElement(ja.Toggle,{className:"btn btn-sm btn-primary dropdown-toggle"},/* @__PURE__ */qt.createElement("span",null,"Function Actions")),/* @__PURE__ */qt.createElement(ja.Menu,{className:"dropdown-menu"},/* @__PURE__ */qt.createElement("li",{className:a?"":"disabled"},/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.editFunction},"Edit Function")),t.functionName&&/* @__PURE__ */qt.createElement("li",null,/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.deleteFunction},"Delete Function")),o&&o.feature.entityTags&&/* @__PURE__ */qt.createElement(B,{component:t,application:e,entityType:"function",onUpdate:this.entityTagUpdate}))))}};Xn.contextType=C;let Jn=Xn;const Qn={type:"m5",description:"m5 instances provide a balance of compute, memory, and network resources. They are a good choice for most applications.",instanceTypes:[{name:"m5.large",label:"Large",cpu:2,memory:8,storage:{type:"EBS"},costFactor:2},{name:"m5.xlarge",label:"XLarge",cpu:4,memory:16,storage:{type:"EBS"},costFactor:3},{name:"m5.2xlarge",label:"2XLarge",cpu:8,memory:32,storage:{type:"EBS"},costFactor:4}]},er=[{type:"general",label:"General Purpose",families:[Qn,{type:"t2",description:"t2 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases).",instanceTypes:[{name:"t2.small",label:"Small",cpu:1,memory:2,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:12},{name:"t2.medium",label:"Medium",cpu:2,memory:4,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:24},{name:"t2.large",label:"Large",cpu:2,memory:8,storage:{type:"EBS"},costFactor:2,cpuCreditsPerHour:36},{name:"t2.xlarge",label:"XLarge",cpu:4,memory:16,storage:{type:"EBS"},costFactor:3,cpuCreditsPerHour:54},{name:"t2.2xlarge",label:"2XLarge",cpu:8,memory:32,storage:{type:"EBS"},costFactor:4,cpuCreditsPerHour:81}]},{type:"t3",description:"t3 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases).",instanceTypes:[{name:"t3.small",label:"Small",cpu:2,memory:2,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:24},{name:"t3.medium",label:"Medium",cpu:2,memory:4,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:24},{name:"t3.large",label:"Large",cpu:2,memory:8,storage:{type:"EBS"},costFactor:2,cpuCreditsPerHour:36},{name:"t3.xlarge",label:"XLarge",cpu:4,memory:16,storage:{type:"EBS"},costFactor:3,cpuCreditsPerHour:96},{name:"t3.2xlarge",label:"2XLarge",cpu:8,memory:32,storage:{type:"EBS"},costFactor:4,cpuCreditsPerHour:192}]}],icon:"hdd",showCpuCredits:!0,descriptionListOverride:[Qn.description,"t2/t3 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases)."]},{type:"memory",label:"High Memory",families:[{type:"r5",description:"r5 instances are optimized for memory-intensive applications and have the lowest cost per GiB of RAM among Amazon EC2 instance types.",instanceTypes:[{name:"r5.large",label:"Large",cpu:2,memory:16,storage:{type:"EBS"},costFactor:1},{name:"r5.xlarge",label:"XLarge",cpu:4,memory:32,storage:{type:"EBS"},costFactor:2},{name:"r5.2xlarge",label:"2XLarge",cpu:8,memory:64,storage:{type:"EBS"},costFactor:2},{name:"r5.4xlarge",label:"4XLarge",cpu:16,memory:128,storage:{type:"EBS"},costFactor:3}]}],icon:"hdd"},{type:"micro",label:"Micro Utility",families:[{type:"t2",description:"t2 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases).",instanceTypes:[{name:"t2.nano",label:"Nano",cpu:1,memory:.5,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:3},{name:"t2.micro",label:"Micro",cpu:1,memory:1,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:6},{name:"t2.small",label:"Small",cpu:1,memory:2,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:12}]},{type:"t3",description:"t3 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases).",instanceTypes:[{name:"t3.nano",label:"Nano",cpu:2,memory:.5,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:6},{name:"t3.micro",label:"Micro",cpu:2,memory:1,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:12},{name:"t3.small",label:"Small",cpu:2,memory:2,storage:{type:"EBS"},costFactor:1,cpuCreditsPerHour:24}]}],icon:"hdd",showCpuCredits:!0,descriptionListOverride:["t2/t3 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases)."]},{type:"custom",label:"Custom Type",families:[],icon:"asterisk"}],tr=null!=(r=null==(n=null==(a=Cn.instanceTypes)?void 0:a.exclude)?void 0:n.categories)?r:[],ar=null!=(i=null==(s=null==(l=Cn.instanceTypes)?void 0:l.exclude)?void 0:s.families)?i:[],nr=er.filter(({type:e})=>!tr.includes(e)).map(e=>Object.assign({},e,{families:e.families.filter(({type:e})=>!ar.includes(e))}));class rr{constructor(){this.instanceClassOrder=["xlarge","large","medium","small","micro","nano"],this.families={ec2ClassicSupported:["m1","m3","t1","c1","c3","cc2","cr1","m2","r3","d2","hs1","i2","g2"],ebsOptimized:["c4","d2","f1","g3","i3","m4","m5","p2","r4","r5","x1"],burstablePerf:["t2","t3","t3a","t4g"]}}getCategories(){return Promise.resolve(nr)}getAllTypesByRegion(){return F("/instanceTypes").get().then(function(e){return Zt.chain(e).map(function(e){return{...e,key:[e.region,e.account,e.name].join(":")}}).uniqBy("key").groupBy("region").value()})}sortTypesByFamilyAndSize(e,t){const a=e.split("."),n=t.split("."),[r,l=""]=a,[s,i=""]=n;if(r!==s)return r>s?1:r<s?-1:0;const o=this.instanceClassOrder.findIndex(e=>l.endsWith(e)),c=this.instanceClassOrder.findIndex(e=>i.endsWith(e));if(-1===o||-1===c)return 0;if(0===o&&0===c){const e=parseInt(l.replace("xlarge",""))||0,t=parseInt(i.replace("xlarge",""))||0;return t<e?1:t>e?-1:0}return o>c?-1:o<c?1:0}getAvailableTypesForRegions(e,t){let a=[];return(t=t||[])&&t.length&&(a=e[t[0]]||[]),t.forEach(function(t){e[t]&&(a=Zt.intersectionBy(a,e[t],"name"))}),null==a?void 0:a.sort((e,t)=>this.sortTypesByFamilyAndSize(e.name,t.name))}filterInstanceTypes(e,t,a,n){const r=(e,t)=>e.some(e=>e.toLowerCase()===t.toLowerCase());return Zt.filter(e,e=>"*"===t&&"*"===n||!(!a&&!this.families.ec2ClassicSupported.includes(e.name.split(".")[0]))&&(!(t&&e.supportedVirtualizationTypes&&!r(e.supportedVirtualizationTypes,t))&&!(n&&e.supportedArchitectures&&!r(e.supportedArchitectures,n))))}isEbsOptimized(e){if(!e)return!1;const t=Zt.split(e,".",1)[0];return this.families.ebsOptimized.includes(t)}isBurstingSupportedForAllTypes(e){return!(!e||!e.length)&&e.every(e=>this.isBurstingSupported(e))}isBurstingSupported(e){if(!e)return!1;const t=Zt.split(e,".",1)[0];return this.families.burstablePerf.includes(t)}getInstanceTypesInCategory(e,t){var a;if(!e||!e.length||!t)return[];if("custom"===t)return e;const n=Zt.flatten(null==(a=Zt.find(er,{type:t}))?void 0:a.families.map(e=>e.instanceTypes.map(e=>e.name)));return Zt.intersection(e,n)}}class lr{addComparator(e){if(e.comparisonOperator)switch(e.comparisonOperator){case"LessThanThreshold":e.comparator="<";break;case"GreaterThanThreshold":e.comparator=">";break;case"LessThanOrEqualToThreshold":e.comparator="≤";break;case"GreaterThanOrEqualToThreshold":e.comparator="≥"}}addAdjustmentAttributes(e){e.operator=e.scalingAdjustment<0?"decrease":"increase",e.absAdjustment=Math.abs(e.scalingAdjustment)}transformScalingPolicy(e){const t={...e},a=(e,t)=>t.metricIntervalUpperBound-e.metricIntervalUpperBound,n=(e,t)=>e.metricIntervalLowerBound-t.metricIntervalLowerBound;if(t.alarms=e.alarms||[],t.alarms.forEach(e=>this.addComparator(e)),this.addAdjustmentAttributes(t),t.stepAdjustments&&t.stepAdjustments.length){t.stepAdjustments.forEach(e=>this.addAdjustmentAttributes(e));const r=e.stepAdjustments.every(e=>void 0!==e.metricIntervalUpperBound)?a:n;t.stepAdjustments.sort((e,t)=>r(e,t))}return t}normalizeServerGroupDetails(e){const t={...e};return e.scalingPolicies&&(t.scalingPolicies=e.scalingPolicies.map(e=>this.transformScalingPolicy(e))),t}normalizeServerGroup(e){return e.instances.forEach(t=>{t.vpcId=e.vpcId}),Hn.listVpcs().then(t=>this.addVpcNameToServerGroup(e)(t))}addVpcNameToServerGroup(e){return t=>{const a=t.find(t=>t.id===e.vpcId);return e.vpcName=a?a.name:"",e}}convertServerGroupCommandToDeployConfiguration(e){const t={...e};t.cloudProvider="aws",t.availabilityZones={[t.region]:e.availabilityZones},t.loadBalancers=(e.loadBalancers||[]).concat(e.vpcLoadBalancers||[]),t.targetGroups=e.targetGroups||[],t.account=t.credentials,t.subnetType=t.subnetType||"",t.instanceType=t.instanceType||t.launchTemplateOverridesForInstanceType&&t.launchTemplateOverridesForInstanceType[0].instanceType,"clone"!==e.viewState.mode&&delete t.source,t.ramdiskId||delete t.ramdiskId;return["region","viewState","backingData","selectedProvider","instanceProfile","vpcId"].forEach(e=>{delete t[e]}),t}constructNewStepScalingPolicyTemplate(e){return{alarms:[{namespace:"AWS/EC2",metricName:"CPUUtilization",threshold:50,statistic:"Average",comparisonOperator:"GreaterThanThreshold",evaluationPeriods:1,dimensions:[{name:"AutoScalingGroupName",value:e.name}],period:60}],adjustmentType:"ChangeInCapacity",stepAdjustments:[{scalingAdjustment:1,metricIntervalLowerBound:0}],estimatedInstanceWarmup:600}}constructNewTargetTrackingPolicyTemplate(){return{alarms:[],estimatedInstanceWarmup:300,targetTrackingConfiguration:{targetValue:null,predefinedMetricSpecification:{predefinedMetricType:"ASGAverageCPUUtilization"}}}}}let sr,ir,or;const cr={get awsInstanceTypeService(){return sr=sr||new rr},get awsServerGroupTransformer(){return ir=ir||new lr},get functionReader(){return or=or||new M(new Pn)}};class dr extends qt.Component{constructor(e){super(e),this.destroy$=new Aa,this.state={loading:!0}}extractFunction(){const{app:e,functionObj:t}=this.props;e.functions.data.find(e=>e.functionName===t.functionName&&e.region===t.region&&e.account===t.account)?Ga(cr.functionReader.getFunctionDetails("aws",t.account,t.region,t.functionName)).pipe($a(this.destroy$)).subscribe(e=>{e.length&&this.setState({functionDef:e[0],loading:!1})}):this.setState({functionDef:{},loading:!1})}componentDidMount(){const{app:e}=this.props,t=e.functions;Ga(t.ready()).pipe($a(this.destroy$)).subscribe(()=>{const e=t.onRefresh(()=>this.extractFunction());this.setState({dataSourceUnsubscribe:e}),this.extractFunction()})}componentWillUnmount(){this.state.dataSourceUnsubscribe&&this.state.dataSourceUnsubscribe(),this.destroy$.next()}render(){const{app:e}=this.props,{loading:t,functionDef:a}=this.state;if(t)/* @__PURE__ */
|
|
15
15
|
return qt.createElement(R,{loading:t});const n=/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed dl-horizontal dl-narrow"},/* @__PURE__ */qt.createElement("dt",null,"Last Modified "),/* @__PURE__ */qt.createElement("dd",null,a.lastModified),/* @__PURE__ */qt.createElement("dt",null,"In"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(L,{account:a.account})," ",a.region),/* @__PURE__ */qt.createElement("dt",null,"VPC"),/* @__PURE__ */qt.createElement("dd",null,a.vpcConfig?a.vpcConfig.vpcId:"Default"),/* @__PURE__ */qt.createElement("dt",null,"Function ARN"),/* @__PURE__ */qt.createElement("dd",null,a.functionArn),/* @__PURE__ */qt.createElement("dt",null,"Revision ID"),/* @__PURE__ */qt.createElement("dd",null,a.revisionId),/* @__PURE__ */qt.createElement("dt",null,"Version"),/* @__PURE__ */qt.createElement("dd",null,a.version)),r=/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed dl-horizontal dl-narrow"},a.eventSourceMappings&&0!==a.eventSourceMappings.length?a.eventSourceMappings.map(e=>/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("h5",null,/* @__PURE__ */qt.createElement("strong",null,"Event Source")),/* @__PURE__ */qt.createElement("dl",null,/* @__PURE__ */qt.createElement("dt",null,"ARN"),/* @__PURE__ */qt.createElement("dd",null,e.eventSourceArn),/* @__PURE__ */qt.createElement("dt",null,"State"),/* @__PURE__ */qt.createElement("dd",null,e.state)))):"None"),l=/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed dl-horizontal dl-narrow"},a.aliasConfigurations&&0!==a.aliasConfigurations.length?a.aliasConfigurations.map(e=>/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("h5",null,/* @__PURE__ */qt.createElement("strong",null,"Alias Details")),/* @__PURE__ */qt.createElement("dl",null,/* @__PURE__ */qt.createElement("dt",null,"Name"),/* @__PURE__ */qt.createElement("dd",null,e.name),/* @__PURE__ */qt.createElement("dt",null,"ARN"),/* @__PURE__ */qt.createElement("dd",null,e.aliasArn)))):"None"),s=/* @__PURE__ */qt.createElement(z,{heading:"Function Details"},n),i=/* @__PURE__ */qt.createElement(z,{heading:"Event Source Details"},r),o=/* @__PURE__ */qt.createElement(z,{heading:"Alias Configuration Details"},l);/* @__PURE__ */
|
|
16
16
|
return qt.createElement(R,{loading:this.state.loading},_t(this.state.functionDef)?"Function not found.":/* @__PURE__ */qt.createElement(R.Header,{icon:/* @__PURE__ */qt.createElement("i",{className:"fa fa-xs fa-fw fa-asterisk"}),name:this.state.functionDef.functionName},
|
|
17
|
-
/* @__PURE__ */qt.createElement("div",{className:"actions"},/* @__PURE__ */qt.createElement(Zn,{app:e,functionDef:a,functionFromParams:{account:this.state.functionDef.account,region:this.state.functionDef.region,functionName:this.state.functionDef.functionName}}))),_t(this.state.functionDef)?"":s,_t(this.state.functionDef)||_t(this.state.functionDef.eventSourceMappings)?"":i,_t(this.state.functionDef)||_t(this.state.functionDef.aliasConfigurations)?"":o)}}const sr={"aws.associateElasticIp.elasticIp":"<p>(Optional) <b>Elastic IP</b> is an IP address that Spinnaker will associate with this cluster.</p>\n <p>If specified, this elastic IP must exist and not already be attached to an instance or cluster.</p>\n <p>If left blank, Spinnaker will make a selection from the list of available elastic IPs in the provided account and region.</p>","aws.associateElasticIp.type":"<p><b>Type</b> of elastic IP to associate:'\n <ul>\n <li><b>standard</b> is usable in EC2 Classic</li>\n <li><b>vpc</b> is usable in VPC</li>\n </ul>","aws.serverGroup.subnet":"The subnet selection determines the VPC in which your server group will run. Options vary by account and region; the most common ones are:\n <ul>\n <li><b>None (EC2 Classic)</b>: instances will not run in a VPC</li>\n <li><b>internal</b> instances will be restricted to internal clients (i.e. require VPN access)</li>\n <li><b>external</b> instances will be publicly accessible and running in VPC</li>\n </ul>","aws.loadBalancer.subnet":"The subnet selection determines the VPC in which your load balancer will run.<br/>\n This also restricts the server groups which can be serviced by the load balancer.\n Options vary by account and region; the most common ones are:\n <ul>\n <li><b>None (EC2 Classic)</b>: the load balancer will not run in a VPC</li>\n <li><b>internal</b> access to the load balancer will be restricted to internal clients (i.e. require VPN access)</li>\n <li><b>external</b> the load balancer will be publicly accessible and running in VPC</li>\n </ul>","aws.loadBalancer.detail":'<p>(Optional) <b>Detail</b> is a string of free-form alphanumeric characters; by convention, we recommend using "frontend".</p>\n <p>However, if your stack name needs to be longer (load balancer names are limited to 32 characters), consider changing it to "elb", or omit it altogether.</p>',"aws.loadBalancer.internal":"Controls the load balancer scheme, <strong>not</strong> the subnet. By default, load balancers are created with a DNS name that resolves to public IP addresses. Specify internal to create a load balancer with a DNS name that resolves to private IP addresses.","aws.loadBalancer.stack":"(Optional) <b>Stack</b> is one of the core naming components of a cluster, used to create vertical stacks of dependent services for integration testing.","aws.loadBalancer.name":"<p>The load balancer name is formed by combining the application name, the <b>Stack</b> field, and the <b>Detail</b> field.</p>","aws.loadBalancer.targetGroups":"Add a target group if you want to associate this with an Application Load Balancer (ALB) or Network Load Balancer (NLB)","aws.loadBalancer.loadBalancers":"Add a load balancer directly if you created a Classic Load Balancer (a classic load balancer does not have target groups)","aws.loadBalancer.ruleCondition.host":"<p>You can specify a single host name (for example, <em>my.example.com</em>). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. Note that you can include up to three wildcard characters.</p>\n <ul>\n <li>A-Z, a-z, 0-9</li>\n <li>- .</li>\n <li>* (matches 0 or more characters)</li>\n <li>? (matches exactly 1 character)</li>\n </ul>\n <p>Note that <strong>*.example.com</strong> will match <strong>test.example.com</strong> but won't match <strong>example.com</strong>.</p>","aws.loadBalancer.ruleCondition.path":"<p>You can specify a single path pattern (for example, <em>/img/*</em>). A path pattern is case sensitive, can be up to 128 characters in length, and can contain any of the following characters. Note that you can include up to three wildcard characters.</p>\n <ul>\n <li>A-Z, a-z, 0-9</li>\n <li>_ - . $ / ~ \" ' @ : +</li>\n <li>& (using &amp;)</li>\n <li>* (matches 0 or more characters)</li>\n <li>? (matches exactly 1 character)</li>\n </ul>\n <p>Note that the path pattern is used to route requests but does not alter them. For example, if a rule has a path pattern of <em>/img/*</em>, the rule would forward a request for <em>/img/picture.jpg</em> to the specified target group as a request for <em>/img/picture.jpg</em>.</p>","aws.loadBalancer.oidcAuthentication":"Authentication requires a configured OIDC client.","aws.serverGroup.stack":"(Optional) <b>Stack</b> is one of the core naming components of a cluster, used to create vertical stacks of dependent services for integration testing.","aws.serverGroup.detail":"(Optional) <b>Detail</b> is a string of free-form alphanumeric characters and hyphens to describe any other variables.","aws.serverGroup.imageName":"(Required) <b>Image</b> is the deployable Amazon Machine Image. Images are restricted to the account and region selected.","aws.serverGroup.storageType":"AWS offers various storage options like temporary block-level storage via instance store (SSD, HDD) and Amazon Elastic Block Store (EBS). This column lists the storage type supported for the instance type.","aws.serverGroup.instancesDistribution":'Learn more in <a target="_blank" href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html">AWS docs</a>.',"aws.serverGroup.spotMaxPrice":"The maximum price per unit hour to pay for a Spot instance. By <b>default (empty)</b>, Amazon EC2 Auto Scaling uses the On-Demand price as the maximum Spot price.","aws.serverGroup.spotAllocationStrategy":"<p>Indicates how to allocate instances across Spot Instance pools.</p>\n <ul>\n <li><b>capacity-optimized (recommended)</b>: Instances launched using Spot pools that are optimally chosen based on the available Spot capacity.</li>\n <li><b>capacity-optimized-prioritized</b>: Instances launched using the priority on a best-effort basis to determine which launch template override to use first, but AWS optimizes for capacity first.</li>\n <li><b>lowest-price (default)</b>: Instances launched using Spot pools with the lowest price, and evenly allocated across the number of Spot pools specified</li>\n </ul>","aws.serverGroup.spotInstancePoolCount":"Number of lowest priced Spot Instance pools to diversify across. Only applicable for strategy 'lowest-price'. <b>Default: 2.</b>","aws.serverGroup.odAllocationStrategy":"The only strategy / <b>default is 'prioritized'</b>. The order specified in the list of selected instance types is used to determine which instance type to use first when fulfilling On-Demand capacity.","aws.serverGroup.odBase":"Minimum amount of the Auto Scaling Group's capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as the group scales. <b>Default: 0.</b>","aws.serverGroup.odPercentAboveBase":"Percentages of On-Demand and Spot instances for additional capacity beyond OnDemandBaseCapacity.<b>Default: 100.</b>","aws.serverGroup.instanceTypeWeight":'The number of capacity units gives the instance type a proportional weight to other instance types. When specified, weights count towards desired capacity.\nLearn more in <a target="_blank" href="https://spinnaker.io/docs/setup/other_config/server-group-launch-settings/aws-ec2/launch-templates/#convert-a-server-group-with-launch-template-to-use-mixed-instances-policy-with-multiple-instance-types-and-capacity-weighting">examples and docs</a>.',"aws.serverGroup.instanceTypes":"Specify up to 20 instance types.","aws.serverGroup.instanceTypesSelect":"<p>Filter instance types on one or more criteria, comma separated:\n <ul>\n <li>Minimum vCPU e.g. 16vcpu</li>\n <li>Minimum memory e.g. 32gib</li>\n <li>Spot support</li>\n <li>EBS support</li>\n <li>GPU support</li>\n <li>Instance storage type e.g. ssd</li>\n <li>Generation with 'currentGen' / 'oldGen'</li>\n <li>Instance family / size / type e.g. c3 / large / c3.large</li>\n </ul>\n Examples:\n <ul>\n <li>16vcpu, 32gib, spot, oldGen</li>\n <li>medium, ebs</li>\n <li>ssd,ebs,gpu,currentgen</li>\n </ul>","aws.serverGroup.multipleInstanceTypes":"Instance types a server group can launch, first (highest priority) to last (lowest priority).","aws.serverGroup.unlimitedCpuCredits":"<p>CPU credits can be configured with 2 modes:</p><br/>\n <ul>\n <li><b>Unlimited (i.e. Unlimited On)</b>: Can sustain high CPU utilization for any period of time whenever required.<br/>\n If the average CPU usage over a rolling 24-hour period exceeds the baseline, charges for surplus credits will apply.</li>\n <li><b>Standard (i.e. Unlimited Off)</b>: <b>Default mode in Spinnaker.</b> Suited to workloads with an average CPU utilization that is consistently below the baseline CPU utilization of the instance.<br/>\n To burst above the baseline, the instance spends credits that it has accrued in its CPU credit balance.</li>\n </ul>","aws.serverGroup.capacityRebalance":"Enabling <b>Capacity Rebalance</b> allows EC2 Auto Scaling to proactively replace Spot Instances that have received a rebalance recommendation, <b>before</b> it is interrupted by AWS EC2.","aws.serverGroup.advancedMode":'Advanced mode allows you to configure allocation strategies, multiple instance types with weighting, instance distribution across Spot / On-Demand and their proportions in the server group. Learn more in <a target="_blank" href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html">AWS docs</a>.',"aws.serverGroup.legacyUdf":"<p>(Optional) <b>User Data Format</b> allows overriding of the format used when generating user data during deployment. The default format used is configured\n in the application's attributes, editable via the 'Config' tab.</p>\n <p><b>Default</b> will use the value from the application's configuration.</p>\n <p><b>Modern</b> will use the modern template.</p>\n <p><b>Legacy</b> will use the legacy (<b>deprecated</b>) template.</p>\n <p>This option is intended to allow testing migration from legacy to modern before configuring it for the entire application. If unsure, pick <b>Default</b>.</p>","aws.serverGroup.base64UserData":"(Optional) <b>UserData</b> is a base64 encoded string.","aws.serverGroup.enabledMetrics":"(Optional) <b>Enabled Metrics</b> are the Auto Scaling Group metrics to enable on this group. Existing metrics are not modified.","aws.serverGroup.imdsv2":"(Recommended) <b>IMDSv2</b> helps mitigate AWS credential theft from the exploitation of SSRF vulnerabilities in web applications. All modern AWS SDKs support IMDSv2 and it should not be disabled unless you're using a legacy SDK.","aws.serverGroup.instanceMonitoring":"(Optional) <b>Instance Monitoring</b> whether to enable detailed monitoring of instances. Group metrics must be disabled to update an ASG with Instance Monitoring set to false.","aws.serverGroup.tags":"(Optional) <b>Tags</b> are propagated to the instances in this cluster.","aws.serverGroup.allImages":"Search for an image that does not match the name of your application.","aws.serverGroup.filterImages":"Select from a pre-filtered list of images matching the name of your application.","aws.serverGroup.traffic":'<p>Enables the "AddToLoadBalancer" scaling process, which is used by Spinnaker and discovery services to determine if the server group is enabled.</p>\n <p>Will be automatically enabled when any non "custom" deployment strategy is selected.</p>',"aws.securityGroup.vpc":'\n <p>The VPC to which this {{firewall}} will apply.</p>\n <p>If you wish to use VPC but are unsure which VPC to use, the most common one is "Main".</p>\n <p>If you do not wish to use VPC, select "None".</p>',"aws.securityGroup.name":"<p>The {{firewall}} name is formed by combining the application name, the <b>Stack</b> field, and the <b>Detail</b> field.</p>","aws.securityGroup.cross.account.ingress.help":"<p>Accounts that are excluded will not show up in this list</p>","aws.scalingPolicy.search.restricted":'<p>Resets dimensions to "AutoScalingGroupName: {name of the ASG}" and provides\n a simpler, combined input for the namespace and metric name fields.</p>',"aws.scalingPolicy.search.all":"\n <p>Allows you to edit the dimensions and namespace to find a specific metric for this alarm.</p>","aws.blockDeviceMappings.useSource":'\n <p>Spinnaker will use the block device mappings of the existing server group when deploying a new server group.</p>\n <p>In the event that there is no existing server group, the\n <a target="_blank" href="https://github.com/spinnaker/clouddriver/blob/master/clouddriver-aws/src/main/groovy/com/netflix/spinnaker/clouddriver/aws/deploy/InstanceTypeUtils.java">defaults</a>\n for the selected instance type will be used.</p>',"aws.blockDeviceMappings.useAMI":"<p>Spinnaker will use the block device mappings from the selected AMI when deploying a new server group.</p>","aws.blockDeviceMappings.useDefaults":'<p>Spinnaker will use the <a target="_blank" href="https://github.com/spinnaker/clouddriver/blob/master/clouddriver-aws/src/main/groovy/com/netflix/spinnaker/clouddriver/aws/deploy/InstanceTypeUtils.java">default block device mappings</a> for the selected instance type when deploying a new server group.</p>',"aws.targetGroup.protocol":"The protocol to use for routing traffic to the targets. Cannot be edited after being saved; if you want to use a different protocol, create a new target group, save the load balancer, move your targets, and then delete this target group.","aws.targetGroup.targetType":"Determines how targets are specified. Only set to ip if you need to attach individual ips. Cannot be edited after being saved; if you want to use a different target type, create a new target group, save the load balancer, move your targets, and then delete this target group.","aws.targetGroup.port":"The port on which the targets receive traffic. Cannot be edited after being saved; if you want to use a different port, create a new target group, save the load balancer, move your targets, and then delete this target group.","aws.targetGroup.attributes.deregistrationDelay":"The amount of time for the load balancer to wait before changing the state of a deregistering target from draining to unused. The range is 0-3600 seconds. The default value is 300 seconds.","aws.targetGroup.attributes.stickinessEnabled":" Indicates whether sticky sessions are enabled.","aws.targetGroup.attributes.deregistrationDelayConnectionTermination":"If enabled, your Network Load Balancer will terminate active connections when deregistration delay is reached.","aws.targetGroup.attributes.preserveClientIp":"If enabled, your Network Load Balancer will preserve client IP addresses to the target.","aws.targetGroup.attributes.stickinessType":"The type of sticky sessions. The only current possible value is <code>lb_cookie</code>.","aws.targetGroup.attributes.stickinessDuration":"The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the load balancer-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds).","aws.targetGroup.attributes.healthCheckPort.trafficPort":"The port the load balancer uses when performing health checks on targets. The default is <b>traffic-port</b>, which is the port on which each target receives traffic from the load balancer.","aws.targetGroup.healthCheckProtocol":"TCP health checks only support 10s and 30s intervals","aws.targetGroup.healthCheckTimeout":"Target groups with TCP or TLS protocol must have a 6s timeout for HTTP health checks or a 10s timeout for HTTPS/TLS health checks.","aws.targetGroup.nlbHealthcheckThreshold":"The healthy and unhealthy threshold for NLBs must be equal. This represents the number of successful and failed healthchecks required for healthy and unhealthy targets, respectively.","aws.serverGroup.capacityConstraint":"\n <p>Ensures that the capacity of this server group has not changed in the background (i.e. due to autoscaling activity).</p>\n <p>If the capacity has changed, this resize operation will be rejected.</p>","aws.tagImage.consideredStages":"Limit which previous stages will be considered when locating AMI's to tag. If left unchecked, AMI's generated by any upstream stage will be tagged.","aws.loadBalancer.redirect.host":"The hostname. This component is not percent-encoded. The hostname can contain <code>#{host}</code>.","aws.loadBalancer.redirect.path":'The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain <code>#{host}</code>, <code>#{path}</code>, and <code>#{port}</code>.',"aws.loadBalancer.redirect.port":"The port. You can specify a value from 1 to 65535 or <code>#{port}</code>.","aws.loadBalancer.redirect.protocol":"The protocol. You can specify HTTP, HTTPS, or <code>#{protocol}</code>. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.","aws.loadBalancer.redirect.query":'The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.',"aws.loadBalancer.redirect.statusCode":"The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).","aws.loadBalancer.redirect":'<p>A URI consists of the following components: protocol://hostname:port/path?query. You must modify at least one of the following components to avoid a redirect loop: protocol, hostname, port, or path. Any components that you do not modify retain their original values.\n\n <p>You can reuse URI components using the following reserved keywords:\n\n <ul><li>#{protocol}\n <li>#{host}\n <li>#{port}\n <li>#{path} (the leading "/" is removed)\n <li>#{query}\n </ul>\n <p>For example, you can change the path to "/new/#{path}", the hostname to "example.#{host}", or the query to "#{query}&value=xyz".',"aws.cloudformation.source":"\n <p>Where the template file content is read from.</p>\n <p>\n <b>text:</b> The template is supplied statically to the pipeline from the below text-box.\n </p>\n <p>\n <b>artifact:</b> The template is read from an artifact supplied/created upstream. The expected artifact must be referenced here, and will be bound at runtime.\n </p>\n ","aws.cloudformation.expectedArtifact":"The artifact that is to be applied to this stage. The artifact should represent a valid cloudformation template.","aws.function.name":"Enter a name that describes the purpose of your function. Function name will be prefixed with the application name.","aws.function.runtime":"Choose the language to use to write your function","aws.function.s3key":"The Amazon S3 key of the deployment package","aws.function.handler":"The name of the method within your code that Lambda calls to execute your function. The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime.","aws.function.s3bucket":"An Amazon S3 bucket in the same AWS Region as your function. The bucket can be in a different AWS account.","aws.function.execution.role":"Lambda will create an execution role with permission to upload logs to Amazon CloudWatch Logs. You can also choose an existing role that defines the permissions of your function.","aws.function.env.vars":"You can define environment variables as key-value pairs that are accessible from your function code. These are useful to store configuration settings without the need to change function code","aws.function.tags":"You can use tags to group and filter your functions. A tag consists of a case-sensitive key-value pair","aws.functionBasicSettings.memorySize":"Your function is allocated CPU proportional to the memory configured.","aws.functionBasicSettings.timeout":"The amount of time that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds.","aws.function.publish":"Set to true to publish the first version of the function during creation.","aws.function.deadletterqueue":"A dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing. (SNS or SQS)","aws.function.tracingConfig.mode":"The function's AWS X-Ray tracing configuration.","aws.function.kmsKeyArn":"The ARN of the AWS Key Management Service (AWS KMS) key that's used to encrypt your function's environment variables. If it's not provided, AWS Lambda uses a default service key.","aws.cloudformation.changeSet.options":"<p>Action to take when the created ChangeSet contains a replacement.</p>\n <p>\n <b>ask:</b> Execution will be put on hold asking for user feedback.\n </p>\n <p>\n <b>skip it:</b> ChangeSet will not be executed and stage will continue.\n </p>\n <p>\n <b>execute it</b> ChangeSet will be executed.\n </p>\n <p>\n <b>fail stage</b> ChangeSet will not be executed and the stage will fail.\n </p>"};Object.keys(sr).forEach(e=>O.register(e,sr[e]));class ir{findImages(e){return!e.q||e.q.length<3?Promise.resolve([{message:"Please enter at least 3 characters...",disabled:!0}]):F("/images/find").query(e).get().catch(()=>[])}getImage(e,t,a){return F("/images").path(a,t,e).query({provider:"aws"}).get().then(e=>e&&e.length?e[0]:null).catch(()=>null)}}const or=({account:e,availabilityZone:t,instanceType:a,capacityType:n,launchTime:r,provider:l,region:s,serverGroup:i,showInstanceType:o})=>/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(U,{label:"Launched",value:r?V(r):"Unknown"}),/* @__PURE__ */qt.createElement(U,{label:"In",value:/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement(L,{account:e}),t||"Unknown")}),o&&/* @__PURE__ */qt.createElement(U,{label:"Type",value:a||"Unknown"}),o&&n&&/* @__PURE__ */qt.createElement(U,{label:"Capacity Type",value:n||"Unknown"}),i&&/* @__PURE__ */qt.createElement(U,{label:"Server Group",value:/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement(en,{to:"^.serverGroup",params:{region:s,accountId:e,serverGroup:i,provider:l}},
|
|
18
|
-
/* @__PURE__ */qt.createElement("a",null,i)))})),
|
|
19
|
-
return qt.createElement(z,{heading:"Instance Information",defaultExpanded:!0},/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-narrow"},/* @__PURE__ */qt.createElement(
|
|
20
|
-
return Ht.createElement(q,{className:"horizontal-when-filters-collapsed"},n&&/* @__PURE__ */Ht.createElement(U,{label:"Private DNS Name",value:/* @__PURE__ */Ht.createElement(W,{text:n,url:`http://${n}${i}`})}),l&&/* @__PURE__ */Ht.createElement(U,{label:"Public DNS Name",value:/* @__PURE__ */Ht.createElement(W,{text:l,url:`http://${l}${i}`})}),r&&/* @__PURE__ */Ht.createElement(U,{label:"Private IP Address",value:/* @__PURE__ */Ht.createElement(W,{text:r,url:`http://${r}${i}`})}),Boolean(null==a?void 0:a.length)&&/* @__PURE__ */Ht.createElement(U,{label:"Permanent IP Address",value:a.map(e=>/* @__PURE__ */Ht.createElement(W,{key:e,text:e,url:`http://${e}${i}`}))}),s&&/* @__PURE__ */Ht.createElement(U,{label:"Public IP Address",value:/* @__PURE__ */Ht.createElement(W,{text:s,url:`http://${s}${i}`})}),Boolean(null==t?void 0:t.length)&&/* @__PURE__ */Ht.createElement(U,{label:"IPv6 Address"+(t.length>1?"es":""),value:t.map(e=>/* @__PURE__ */Ht.createElement(W,{key:e.ip,text:e.ip,url:e.url}))}))},
|
|
17
|
+
/* @__PURE__ */qt.createElement("div",{className:"actions"},/* @__PURE__ */qt.createElement(Jn,{app:e,functionDef:a,functionFromParams:{account:this.state.functionDef.account,region:this.state.functionDef.region,functionName:this.state.functionDef.functionName}}))),_t(this.state.functionDef)?"":s,_t(this.state.functionDef)||_t(this.state.functionDef.eventSourceMappings)?"":i,_t(this.state.functionDef)||_t(this.state.functionDef.aliasConfigurations)?"":o)}}const mr={"aws.associateElasticIp.elasticIp":"<p>(Optional) <b>Elastic IP</b> is an IP address that Spinnaker will associate with this cluster.</p>\n <p>If specified, this elastic IP must exist and not already be attached to an instance or cluster.</p>\n <p>If left blank, Spinnaker will make a selection from the list of available elastic IPs in the provided account and region.</p>","aws.associateElasticIp.type":"<p><b>Type</b> of elastic IP to associate:'\n <ul>\n <li><b>standard</b> is usable in EC2 Classic</li>\n <li><b>vpc</b> is usable in VPC</li>\n </ul>","aws.serverGroup.subnet":"The subnet selection determines the VPC in which your server group will run. Options vary by account and region; the most common ones are:\n <ul>\n <li><b>None (EC2 Classic)</b>: instances will not run in a VPC</li>\n <li><b>internal</b> instances will be restricted to internal clients (i.e. require VPN access)</li>\n <li><b>external</b> instances will be publicly accessible and running in VPC</li>\n </ul>","aws.loadBalancer.subnet":"The subnet selection determines the VPC in which your load balancer will run.<br/>\n This also restricts the server groups which can be serviced by the load balancer.\n Options vary by account and region; the most common ones are:\n <ul>\n <li><b>None (EC2 Classic)</b>: the load balancer will not run in a VPC</li>\n <li><b>internal</b> access to the load balancer will be restricted to internal clients (i.e. require VPN access)</li>\n <li><b>external</b> the load balancer will be publicly accessible and running in VPC</li>\n </ul>","aws.loadBalancer.detail":'<p>(Optional) <b>Detail</b> is a string of free-form alphanumeric characters; by convention, we recommend using "frontend".</p>\n <p>However, if your stack name needs to be longer (load balancer names are limited to 32 characters), consider changing it to "elb", or omit it altogether.</p>',"aws.loadBalancer.internal":"Controls the load balancer scheme, <strong>not</strong> the subnet. By default, load balancers are created with a DNS name that resolves to public IP addresses. Specify internal to create a load balancer with a DNS name that resolves to private IP addresses.","aws.loadBalancer.stack":"(Optional) <b>Stack</b> is one of the core naming components of a cluster, used to create vertical stacks of dependent services for integration testing.","aws.loadBalancer.name":"<p>The load balancer name is formed by combining the application name, the <b>Stack</b> field, and the <b>Detail</b> field.</p>","aws.loadBalancer.targetGroups":"Add a target group if you want to associate this with an Application Load Balancer (ALB) or Network Load Balancer (NLB)","aws.loadBalancer.loadBalancers":"Add a load balancer directly if you created a Classic Load Balancer (a classic load balancer does not have target groups)","aws.loadBalancer.ruleCondition.host":"<p>You can specify a single host name (for example, <em>my.example.com</em>). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. Note that you can include up to three wildcard characters.</p>\n <ul>\n <li>A-Z, a-z, 0-9</li>\n <li>- .</li>\n <li>* (matches 0 or more characters)</li>\n <li>? (matches exactly 1 character)</li>\n </ul>\n <p>Note that <strong>*.example.com</strong> will match <strong>test.example.com</strong> but won't match <strong>example.com</strong>.</p>","aws.loadBalancer.ruleCondition.path":"<p>You can specify a single path pattern (for example, <em>/img/*</em>). A path pattern is case sensitive, can be up to 128 characters in length, and can contain any of the following characters. Note that you can include up to three wildcard characters.</p>\n <ul>\n <li>A-Z, a-z, 0-9</li>\n <li>_ - . $ / ~ \" ' @ : +</li>\n <li>& (using &amp;)</li>\n <li>* (matches 0 or more characters)</li>\n <li>? (matches exactly 1 character)</li>\n </ul>\n <p>Note that the path pattern is used to route requests but does not alter them. For example, if a rule has a path pattern of <em>/img/*</em>, the rule would forward a request for <em>/img/picture.jpg</em> to the specified target group as a request for <em>/img/picture.jpg</em>.</p>","aws.loadBalancer.oidcAuthentication":"Authentication requires a configured OIDC client.","aws.serverGroup.stack":"(Optional) <b>Stack</b> is one of the core naming components of a cluster, used to create vertical stacks of dependent services for integration testing.","aws.serverGroup.detail":"(Optional) <b>Detail</b> is a string of free-form alphanumeric characters and hyphens to describe any other variables.","aws.serverGroup.imageName":"(Required) <b>Image</b> is the deployable Amazon Machine Image. Images are restricted to the account and region selected.","aws.serverGroup.storageType":"AWS offers various storage options like temporary block-level storage via instance store (SSD, HDD) and Amazon Elastic Block Store (EBS). This column lists the storage type supported for the instance type.","aws.serverGroup.instancesDistribution":'Learn more in <a target="_blank" href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html">AWS docs</a>.',"aws.serverGroup.spotMaxPrice":"The maximum price per unit hour to pay for a Spot instance. By <b>default (empty)</b>, Amazon EC2 Auto Scaling uses the On-Demand price as the maximum Spot price.","aws.serverGroup.spotAllocationStrategy":"<p>Indicates how to allocate instances across Spot Instance pools.</p>\n <ul>\n <li><b>capacity-optimized (recommended)</b>: Instances launched using Spot pools that are optimally chosen based on the available Spot capacity.</li>\n <li><b>capacity-optimized-prioritized</b>: Instances launched using the priority on a best-effort basis to determine which launch template override to use first, but AWS optimizes for capacity first.</li>\n <li><b>lowest-price (default)</b>: Instances launched using Spot pools with the lowest price, and evenly allocated across the number of Spot pools specified</li>\n </ul>","aws.serverGroup.spotInstancePoolCount":"Number of lowest priced Spot Instance pools to diversify across. Only applicable for strategy 'lowest-price'. <b>Default: 2.</b>","aws.serverGroup.odAllocationStrategy":"The only strategy / <b>default is 'prioritized'</b>. The order specified in the list of selected instance types is used to determine which instance type to use first when fulfilling On-Demand capacity.","aws.serverGroup.odBase":"Minimum amount of the Auto Scaling Group's capacity that must be fulfilled by On-Demand Instances. This base portion is provisioned first as the group scales. <b>Default: 0.</b>","aws.serverGroup.odPercentAboveBase":"Percentages of On-Demand and Spot instances for additional capacity beyond OnDemandBaseCapacity.<b>Default: 100.</b>","aws.serverGroup.instanceTypeWeight":'The number of capacity units gives the instance type a proportional weight to other instance types. When specified, weights count towards desired capacity.\nLearn more in <a target="_blank" href="https://spinnaker.io/docs/setup/other_config/server-group-launch-settings/aws-ec2/launch-templates/#convert-a-server-group-with-launch-template-to-use-mixed-instances-policy-with-multiple-instance-types-and-capacity-weighting">examples and docs</a>.',"aws.serverGroup.instanceTypes":"Specify up to 20 instance types.","aws.serverGroup.instanceTypesSelect":"<p>Filter instance types on one or more criteria, comma separated:\n <ul>\n <li>Minimum vCPU e.g. 16vcpu</li>\n <li>Minimum memory e.g. 32gib</li>\n <li>Spot support</li>\n <li>EBS support</li>\n <li>GPU support</li>\n <li>Instance storage type e.g. ssd</li>\n <li>Generation with 'currentGen' / 'oldGen'</li>\n <li>Instance family / size / type e.g. c3 / large / c3.large</li>\n </ul>\n Examples:\n <ul>\n <li>16vcpu, 32gib, spot, oldGen</li>\n <li>medium, ebs</li>\n <li>ssd,ebs,gpu,currentgen</li>\n </ul>","aws.serverGroup.multipleInstanceTypes":"Instance types a server group can launch, first (highest priority) to last (lowest priority).","aws.serverGroup.unlimitedCpuCredits":"<p>CPU credits can be configured with 2 modes:</p><br/>\n <ul>\n <li><b>Unlimited (i.e. Unlimited On)</b>: Can sustain high CPU utilization for any period of time whenever required.<br/>\n If the average CPU usage over a rolling 24-hour period exceeds the baseline, charges for surplus credits will apply.</li>\n <li><b>Standard (i.e. Unlimited Off)</b>: <b>Default mode in Spinnaker.</b> Suited to workloads with an average CPU utilization that is consistently below the baseline CPU utilization of the instance.<br/>\n To burst above the baseline, the instance spends credits that it has accrued in its CPU credit balance.</li>\n </ul>","aws.serverGroup.capacityRebalance":"Enabling <b>Capacity Rebalance</b> allows EC2 Auto Scaling to proactively replace Spot Instances that have received a rebalance recommendation, <b>before</b> it is interrupted by AWS EC2.","aws.serverGroup.advancedMode":'Advanced mode allows you to configure allocation strategies, multiple instance types with weighting, instance distribution across Spot / On-Demand and their proportions in the server group. Learn more in <a target="_blank" href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html">AWS docs</a>.',"aws.serverGroup.legacyUdf":"<p>(Optional) <b>User Data Format</b> allows overriding of the format used when generating user data during deployment. The default format used is configured\n in the application's attributes, editable via the 'Config' tab.</p>\n <p><b>Default</b> will use the value from the application's configuration.</p>\n <p><b>Modern</b> will use the modern template.</p>\n <p><b>Legacy</b> will use the legacy (<b>deprecated</b>) template.</p>\n <p>This option is intended to allow testing migration from legacy to modern before configuring it for the entire application. If unsure, pick <b>Default</b>.</p>","aws.serverGroup.base64UserData":"(Optional) <b>UserData</b> is a base64 encoded string.","aws.serverGroup.enabledMetrics":"(Optional) <b>Enabled Metrics</b> are the Auto Scaling Group metrics to enable on this group. Existing metrics are not modified.","aws.serverGroup.imdsv2":"(Recommended) <b>IMDSv2</b> helps mitigate AWS credential theft from the exploitation of SSRF vulnerabilities in web applications. All modern AWS SDKs support IMDSv2 and it should not be disabled unless you're using a legacy SDK.","aws.serverGroup.instanceMonitoring":"(Optional) <b>Instance Monitoring</b> whether to enable detailed monitoring of instances. Group metrics must be disabled to update an ASG with Instance Monitoring set to false.","aws.serverGroup.tags":"(Optional) <b>Tags</b> are propagated to the instances in this cluster.","aws.serverGroup.allImages":"Search for an image that does not match the name of your application.","aws.serverGroup.filterImages":"Select from a pre-filtered list of images matching the name of your application.","aws.serverGroup.traffic":'<p>Enables the "AddToLoadBalancer" scaling process, which is used by Spinnaker and discovery services to determine if the server group is enabled.</p>\n <p>Will be automatically enabled when any non "custom" deployment strategy is selected.</p>',"aws.securityGroup.vpc":'\n <p>The VPC to which this {{firewall}} will apply.</p>\n <p>If you wish to use VPC but are unsure which VPC to use, the most common one is "Main".</p>\n <p>If you do not wish to use VPC, select "None".</p>',"aws.securityGroup.name":"<p>The {{firewall}} name is formed by combining the application name, the <b>Stack</b> field, and the <b>Detail</b> field.</p>","aws.securityGroup.cross.account.ingress.help":"<p>Accounts that are excluded will not show up in this list</p>","aws.scalingPolicy.search.restricted":'<p>Resets dimensions to "AutoScalingGroupName: {name of the ASG}" and provides\n a simpler, combined input for the namespace and metric name fields.</p>',"aws.scalingPolicy.search.all":"\n <p>Allows you to edit the dimensions and namespace to find a specific metric for this alarm.</p>","aws.blockDeviceMappings.useSource":'\n <p>Spinnaker will use the block device mappings of the existing server group when deploying a new server group.</p>\n <p>In the event that there is no existing server group, the\n <a target="_blank" href="https://github.com/spinnaker/clouddriver/blob/master/clouddriver-aws/src/main/groovy/com/netflix/spinnaker/clouddriver/aws/deploy/InstanceTypeUtils.java">defaults</a>\n for the selected instance type will be used.</p>',"aws.blockDeviceMappings.useAMI":"<p>Spinnaker will use the block device mappings from the selected AMI when deploying a new server group.</p>","aws.blockDeviceMappings.useDefaults":'<p>Spinnaker will use the <a target="_blank" href="https://github.com/spinnaker/clouddriver/blob/master/clouddriver-aws/src/main/groovy/com/netflix/spinnaker/clouddriver/aws/deploy/InstanceTypeUtils.java">default block device mappings</a> for the selected instance type when deploying a new server group.</p>',"aws.targetGroup.protocol":"The protocol to use for routing traffic to the targets. Cannot be edited after being saved; if you want to use a different protocol, create a new target group, save the load balancer, move your targets, and then delete this target group.","aws.targetGroup.targetType":"Determines how targets are specified. Only set to ip if you need to attach individual ips. Cannot be edited after being saved; if you want to use a different target type, create a new target group, save the load balancer, move your targets, and then delete this target group.","aws.targetGroup.port":"The port on which the targets receive traffic. Cannot be edited after being saved; if you want to use a different port, create a new target group, save the load balancer, move your targets, and then delete this target group.","aws.targetGroup.attributes.deregistrationDelay":"The amount of time for the load balancer to wait before changing the state of a deregistering target from draining to unused. The range is 0-3600 seconds. The default value is 300 seconds.","aws.targetGroup.attributes.stickinessEnabled":" Indicates whether sticky sessions are enabled.","aws.targetGroup.attributes.deregistrationDelayConnectionTermination":"If enabled, your Network Load Balancer will terminate active connections when deregistration delay is reached.","aws.targetGroup.attributes.preserveClientIp":"If enabled, your Network Load Balancer will preserve client IP addresses to the target.","aws.targetGroup.attributes.stickinessType":"The type of sticky sessions. The only current possible value is <code>lb_cookie</code>.","aws.targetGroup.attributes.stickinessDuration":"The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the load balancer-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds).","aws.targetGroup.attributes.healthCheckPort.trafficPort":"The port the load balancer uses when performing health checks on targets. The default is <b>traffic-port</b>, which is the port on which each target receives traffic from the load balancer.","aws.targetGroup.healthCheckProtocol":"TCP health checks only support 10s and 30s intervals","aws.targetGroup.healthCheckTimeout":"Target groups with TCP or TLS protocol must have a 6s timeout for HTTP health checks or a 10s timeout for HTTPS/TLS health checks.","aws.targetGroup.nlbHealthcheckThreshold":"The healthy and unhealthy threshold for NLBs must be equal. This represents the number of successful and failed healthchecks required for healthy and unhealthy targets, respectively.","aws.serverGroup.capacityConstraint":"\n <p>Ensures that the capacity of this server group has not changed in the background (i.e. due to autoscaling activity).</p>\n <p>If the capacity has changed, this resize operation will be rejected.</p>","aws.tagImage.consideredStages":"Limit which previous stages will be considered when locating AMI's to tag. If left unchecked, AMI's generated by any upstream stage will be tagged.","aws.loadBalancer.redirect.host":"The hostname. This component is not percent-encoded. The hostname can contain <code>#{host}</code>.","aws.loadBalancer.redirect.path":'The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain <code>#{host}</code>, <code>#{path}</code>, and <code>#{port}</code>.',"aws.loadBalancer.redirect.port":"The port. You can specify a value from 1 to 65535 or <code>#{port}</code>.","aws.loadBalancer.redirect.protocol":"The protocol. You can specify HTTP, HTTPS, or <code>#{protocol}</code>. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You cannot redirect HTTPS to HTTP.","aws.loadBalancer.redirect.query":'The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.',"aws.loadBalancer.redirect.statusCode":"The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).","aws.loadBalancer.redirect":'<p>A URI consists of the following components: protocol://hostname:port/path?query. You must modify at least one of the following components to avoid a redirect loop: protocol, hostname, port, or path. Any components that you do not modify retain their original values.\n\n <p>You can reuse URI components using the following reserved keywords:\n\n <ul><li>#{protocol}\n <li>#{host}\n <li>#{port}\n <li>#{path} (the leading "/" is removed)\n <li>#{query}\n </ul>\n <p>For example, you can change the path to "/new/#{path}", the hostname to "example.#{host}", or the query to "#{query}&value=xyz".',"aws.cloudformation.source":"\n <p>Where the template file content is read from.</p>\n <p>\n <b>text:</b> The template is supplied statically to the pipeline from the below text-box.\n </p>\n <p>\n <b>artifact:</b> The template is read from an artifact supplied/created upstream. The expected artifact must be referenced here, and will be bound at runtime.\n </p>\n ","aws.cloudformation.expectedArtifact":"The artifact that is to be applied to this stage. The artifact should represent a valid cloudformation template.","aws.function.name":"Enter a name that describes the purpose of your function. Function name will be prefixed with the application name.","aws.function.runtime":"Choose the language to use to write your function","aws.function.s3key":"The Amazon S3 key of the deployment package","aws.function.handler":"The name of the method within your code that Lambda calls to execute your function. The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime.","aws.function.s3bucket":"An Amazon S3 bucket in the same AWS Region as your function. The bucket can be in a different AWS account.","aws.function.execution.role":"Lambda will create an execution role with permission to upload logs to Amazon CloudWatch Logs. You can also choose an existing role that defines the permissions of your function.","aws.function.env.vars":"You can define environment variables as key-value pairs that are accessible from your function code. These are useful to store configuration settings without the need to change function code","aws.function.tags":"You can use tags to group and filter your functions. A tag consists of a case-sensitive key-value pair","aws.functionBasicSettings.memorySize":"Your function is allocated CPU proportional to the memory configured.","aws.functionBasicSettings.timeout":"The amount of time that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds.","aws.function.publish":"Set to true to publish the first version of the function during creation.","aws.function.deadletterqueue":"A dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing. (SNS or SQS)","aws.function.tracingConfig.mode":"The function's AWS X-Ray tracing configuration.","aws.function.kmsKeyArn":"The ARN of the AWS Key Management Service (AWS KMS) key that's used to encrypt your function's environment variables. If it's not provided, AWS Lambda uses a default service key.","aws.cloudformation.changeSet.options":"<p>Action to take when the created ChangeSet contains a replacement.</p>\n <p>\n <b>ask:</b> Execution will be put on hold asking for user feedback.\n </p>\n <p>\n <b>skip it:</b> ChangeSet will not be executed and stage will continue.\n </p>\n <p>\n <b>execute it</b> ChangeSet will be executed.\n </p>\n <p>\n <b>fail stage</b> ChangeSet will not be executed and the stage will fail.\n </p>"};Object.keys(mr).forEach(e=>O.register(e,mr[e]));class ur{findImages(e){return!e.q||e.q.length<3?Promise.resolve([{message:"Please enter at least 3 characters...",disabled:!0}]):F("/images/find").query(e).get().catch(()=>[])}getImage(e,t,a){return F("/images").path(a,t,e).query({provider:"aws"}).get().then(e=>e&&e.length?e[0]:null).catch(()=>null)}}const pr=({account:e,availabilityZone:t,instanceType:a,capacityType:n,launchTime:r,provider:l,region:s,serverGroup:i,showInstanceType:o})=>/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(U,{label:"Launched",value:r?V(r):"Unknown"}),/* @__PURE__ */qt.createElement(U,{label:"In",value:/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement(L,{account:e}),t||"Unknown")}),o&&/* @__PURE__ */qt.createElement(U,{label:"Type",value:a||"Unknown"}),o&&n&&/* @__PURE__ */qt.createElement(U,{label:"Capacity Type",value:n||"Unknown"}),i&&/* @__PURE__ */qt.createElement(U,{label:"Server Group",value:/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement(en,{to:"^.serverGroup",params:{region:s,accountId:e,serverGroup:i,provider:l}},
|
|
18
|
+
/* @__PURE__ */qt.createElement("a",null,i)))})),hr=({instance:e})=>{const{imageId:t,serverGroup:a,subnetId:n,vpcId:r}=e;/* @__PURE__ */
|
|
19
|
+
return qt.createElement(z,{heading:"Instance Information",defaultExpanded:!0},/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-narrow"},/* @__PURE__ */qt.createElement(pr,{account:e.account,availabilityZone:e.availabilityZone,instanceType:e.instanceType,capacityType:e.capacityType,launchTime:e.launchTime,provider:e.provider,region:e.region,serverGroup:e.serverGroup,showInstanceType:!0}),a&&/* @__PURE__ */qt.createElement(U,{label:"VPC",value:/* @__PURE__ */qt.createElement(Wn,{vpcId:r})}),n&&/* @__PURE__ */qt.createElement(U,{label:"Subnet",value:/* @__PURE__ */qt.createElement(H,{subnetId:n})}),t&&/* @__PURE__ */qt.createElement(U,{label:"Image ID",value:t})))},gr=({instancePort:e,ipv6Addresses:t,permanentIps:a,privateDnsName:n,privateIpAddress:r,publicDnsName:l,publicIpAddress:s})=>{const i=e?`:${e}`:"";/* @__PURE__ */
|
|
20
|
+
return Ht.createElement(q,{className:"horizontal-when-filters-collapsed"},n&&/* @__PURE__ */Ht.createElement(U,{label:"Private DNS Name",value:/* @__PURE__ */Ht.createElement(W,{text:n,url:`http://${n}${i}`})}),l&&/* @__PURE__ */Ht.createElement(U,{label:"Public DNS Name",value:/* @__PURE__ */Ht.createElement(W,{text:l,url:`http://${l}${i}`})}),r&&/* @__PURE__ */Ht.createElement(U,{label:"Private IP Address",value:/* @__PURE__ */Ht.createElement(W,{text:r,url:`http://${r}${i}`})}),Boolean(null==a?void 0:a.length)&&/* @__PURE__ */Ht.createElement(U,{label:"Permanent IP Address",value:a.map(e=>/* @__PURE__ */Ht.createElement(W,{key:e,text:e,url:`http://${e}${i}`}))}),s&&/* @__PURE__ */Ht.createElement(U,{label:"Public IP Address",value:/* @__PURE__ */Ht.createElement(W,{text:s,url:`http://${s}${i}`})}),Boolean(null==t?void 0:t.length)&&/* @__PURE__ */Ht.createElement(U,{label:"IPv6 Address"+(t.length>1?"es":""),value:t.map(e=>/* @__PURE__ */Ht.createElement(W,{key:e.ip,text:e.ip,url:e.url}))}))},vr=({instance:e})=>{const{account:t,region:a,provider:n,securityGroups:r,vpcId:l}=e,s=Jt(r,["groupName"],["asc"]),i=j.get("Firewalls");/* @__PURE__ */
|
|
21
21
|
return qt.createElement(z,{heading:i,defaultExpanded:!0},/* @__PURE__ */qt.createElement("ul",null,(s||[]).map(e=>/* @__PURE__ */qt.createElement("li",{key:e.groupId},/* @__PURE__ */qt.createElement(en,{to:"^.firewallDetails",params:{name:e.groupName,accountId:t,region:a,vpcId:l,provider:n}},
|
|
22
|
-
/* @__PURE__ */qt.createElement("a",null,e.groupName," (",e.groupId,")"))))))},
|
|
23
|
-
return qt.createElement(z,{heading:"Status",defaultExpanded:!0},!e.length&&/* @__PURE__ */qt.createElement("p",null,"Starting"===t?"Starting":"No health metrics found for this instance"),/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},e.sort((e,t)=>e.type<t.type?-1:e.type>t.type?1:0).map(e=>/* @__PURE__ */qt.createElement(qt.Fragment,{key:`${e.type}-${e.description}`},/* @__PURE__ */qt.createElement("dt",null,Z(e.type)),/* @__PURE__ */qt.createElement("dd",null,!a.includes(e.type)&&/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement(_,{value:"down"===e.state.toLowerCase()?e.description:"",placement:"left"},/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:`glyphicon glyphicon-${e.state}-triangle`}),/* @__PURE__ */qt.createElement("span",null,Z(e.state)))),/* @__PURE__ */qt.createElement("span",{className:"pad-left small"},e.healthCheckUrl&&/* @__PURE__ */qt.createElement("a",{target:"_blank",href:e.healthCheckUrl},"Health Check"),e.healthCheckUrl&&e.statusPageUrl&&/* @__PURE__ */qt.createElement("span",null," | "),e.statusPageUrl&&/* @__PURE__ */qt.createElement("a",{target:"_blank",href:e.statusPageUrl},"Status"),n&&e.type===n.type&&/* @__PURE__ */qt.createElement("span",null," ","|"," ",/* @__PURE__ */qt.createElement("a",{target:"_blank",href:n.href},n.text)))),l&&"LoadBalancer"===e.type&&(e.loadBalancers||[]).map(e=>/* @__PURE__ */qt.createElement(K,{key:`lb-${e.name}`,loadBalancer:e})),s&&"TargetGroup"===e.type&&(e.targetGroups||[]).map(e=>/* @__PURE__ */qt.createElement(K,{key:`tg-${e.name}`,loadBalancer:e,ipAddress:r})))))))},
|
|
24
|
-
return qt.createElement(z,{heading:"Tags",defaultExpanded:!0},!t.length&&/* @__PURE__ */qt.createElement("div",null,"No tags associated with this server"),Boolean(t.length)&&a.map(e=>/* @__PURE__ */qt.createElement(U,{key:e.key,label:e.key,value:e.value})))};class hr extends Y{static deregisterInstancesFromTargetGroup(e,t,a,n){const r=super.buildMultiInstanceJob(e,n,"deregisterInstancesFromLoadBalancer");r.forEach(e=>e.targetGroupNames=a);const l=super.buildMultiInstanceDescriptor(r,"Deregister",`from ${a.join(" and ")}`);return X.executeTask({job:r,application:t,description:l})}static deregisterInstanceFromTargetGroup(e,t,a={}){return a.type="deregisterInstancesFromLoadBalancer",a.instanceIds=[e.id],a.targetGroupNames=e.targetGroups,a.region=e.region,a.credentials=e.account,a.cloudProvider=e.cloudProvider,X.executeTask({job:[a],application:t,description:`Deregister instance: ${e.id}`})}static registerInstancesWithTargetGroup(e,t,a,n){const r=super.buildMultiInstanceJob(e,n,"registerInstancesWithLoadBalancer");r.forEach(e=>e.targetGroupNames=a);const l=super.buildMultiInstanceDescriptor(r,"Register",`with ${a.join(" and ")}`);return X.executeTask({job:r,application:t,description:l})}static registerInstanceWithTargetGroup(e,t,a={}){return a.type="registerInstancesWithLoadBalancer",a.instanceIds=[e.id],a.targetGroupNames=e.targetGroups,a.region=e.region,a.credentials=e.account,a.cloudProvider=e.cloudProvider,X.executeTask({job:[a],application:t,description:`Register instance: ${e.id}`})}}const gr=e=>{const t=e.map(e=>e.targetGroups);return Qt(t)},vr=(e,t,a)=>{e.forEach(e=>{"TargetGroup"===e.type&&e.targetGroups.forEach(e=>{var n,r,l;const s=null!=(n=t.find(t=>t.name===e.name&&t.account===a))?n:{},i="traffic-port"===s.healthCheckPort||ea(s.healthCheckPort)?s.port:s.healthCheckPort;e.healthCheckProtocol=null==(r=s.healthCheckProtocol)?void 0:r.toLowerCase(),e.healthCheckPath=`:${i}${null!=(l=s.healthCheckPath)?l:""}`})})};function fr(e,t,a,n){var r;e.isStandalone&&(t.health=a.health);const l=(t.health||[]).filter(e=>"Amazon"!==e.type||"Unknown"!==e.state);if(!e.isStandalone){const t=gr(((null==(r=e.loadBalancers)?void 0:r.data)||[]).filter(e=>"aws"===e.cloudProvider));vr(l,t,n)}return(a.health||[]).forEach(e=>{const t=l.find(t=>t.type===e.type);t&&Object.assign(t,{...e,...t})}),l}async function Er({app:e,instance:t}){var a,n;const r=function(e,t){return e.serverGroups?function(e,t){var a,n;const r=(null==(a=e.serverGroups)?void 0:a.data)||[];for(const l of r){const e=null==(n=l.instances)?void 0:n.find(e=>e.id===t);if(e)return{account:l.account,extraData:{serverGroup:l.name,vpcId:l.vpcId},loadBalancers:l.loadBalancers,region:l.region,serverGroupDisabled:l.isDisabled,summary:e,targetGroups:l.targetGroups,vpcId:l.vpcId}}}(e,t.instanceId)||function(e,t){var a,n,r;const l=(null==(a=e.loadBalancers)?void 0:a.data)||[];for(const s of l){const e=null==(n=s.instances)?void 0:n.find(e=>e.id===t);if(e)return{account:s.account,loadBalancers:[s.name],region:s.region,summary:e,vpcId:s.vpcId};const a=null==(r=s.targetGroups)?void 0:r.find(e=>{var a;return null==(a=e.instances)?void 0:a.some(e=>e.id===t)});if(a){const e=a.instances.find(e=>e.id===t);return{account:s.account,region:s.region,summary:e,targetGroups:[a.name],vpcId:s.vpcId}}}}(e,t.instanceId)||function(e,t){var a,n,r;const l=(null==(a=e.loadBalancers)?void 0:a.data)||[];for(const s of l){const e=(s.serverGroups||[]).filter(e=>e.isDisabled);for(const r of e){const e=null==(n=r.instances)?void 0:n.find(e=>e.id===t);if(e)return{account:s.account,loadBalancers:[s.name],region:s.region,summary:e,vpcId:s.vpcId}}const a=null==(r=s.targetGroups)?void 0:r.find(e=>(e.serverGroups||[]).some(e=>{var a;return e.isDisabled&&(null==(a=e.instances)?void 0:a.some(e=>e.id===t))}));if(a){const e=a.serverGroups.find(e=>{var a;return null==(a=e.instances)?void 0:a.some(e=>e.id===t)}).instances.find(e=>e.id===t);return{account:s.account,loadBalancers:[s.name],region:s.region,summary:e,vpcId:s.vpcId}}}}(e,t.instanceId):{account:t.account,loadBalancers:[],region:t.region,summary:{id:t.instanceId}}}(e,t);if(!(null==r?void 0:r.summary)||!r.account||!r.region)return{instanceIdNotFound:t.instanceId};J.addExtraDataToLatest("instances",{...r.extraData,account:r.account,region:r.region});const l=await ne.getInstanceDetails(r.account,r.region,t.instanceId),s={...r.summary,...l,account:r.account,baseIpAddress:l.publicDnsName||l.privateIpAddress,healthMetrics:fr(e,r.summary,l,r.account),instanceId:l.instanceId||r.summary.instanceId||r.summary.id||t.instanceId,loadBalancers:r.loadBalancers,region:r.region,serverGroupDisabled:r.serverGroupDisabled,targetGroups:r.targetGroups,vpcId:r.vpcId};if((null==(a=r.extraData)?void 0:a.serverGroup)&&(s.serverGroup=r.extraData.serverGroup),s.networkInterfaces){const t=(null==(n=e.attributes)?void 0:n.instancePort)||o.defaultInstancePort||80;s.ipv6Addresses=ta(s.networkInterfaces,e=>(e.ipv6Addresses||[]).map(e=>({ip:e.ipv6Address,url:`http://${e.ipv6Address}:${t}`}))),s.permanentIps=s.networkInterfaces.filter(e=>{var t;return!1===(null==(t=e.attachment)?void 0:t.deleteOnTermination)}).map(e=>e.privateIpAddress)}return s}function yr(e,t,a){return(e.health||[]).some(e=>e.type===t&&e.state===a)}function br({app:e,instance:t,stateService:a}){if(!Cn.adHocInfraWritesEnabled)return null;const n=()=>{a.includes("**.instanceDetails",{instanceId:t.instanceId})&&a.go("^")},r=(a,r,l,s,i=!1,o={})=>{x.confirm({header:a,buttonText:r,account:t.account,taskMonitorConfig:{application:e,title:l,onTaskComplete:i?n:void 0},submitMethod:s,...o})},l=(t.loadBalancers||[]).join(" and "),s=(t.targetGroups||[]).join(" and "),i=[{label:"Reboot",triggerAction:()=>{var a;return r(`Really reboot ${t.instanceId}?`,`Reboot ${t.instanceId}`,`Rebooting ${t.instanceId}`,(a={})=>{var n,r;return(null==(n=e.attributes)?void 0:n.platformHealthOnlyShowOverride)&&(null==(r=e.attributes)?void 0:r.platformHealthOnly)&&(a.interestingHealthProviderNames=["Amazon"]),hr.rebootInstance(t,e,a)},!1,{platformHealthOnlyShowOverride:null==(a=e.attributes)?void 0:a.platformHealthOnlyShowOverride,platformHealthType:"Amazon"})}},{label:"Terminate",triggerAction:()=>r(`Really terminate ${t.instanceId}?`,`Terminate ${t.instanceId}`,`Terminating ${t.instanceId}`,()=>hr.terminateInstance(t,e),!0)}];return t.serverGroup&&i.push({label:"Terminate and Shrink Server Group",triggerAction:()=>r(`Really terminate ${t.instanceId} and shrink ${t.serverGroup}?`,`Terminate ${t.instanceId} and shrink ${t.serverGroup}`,`Terminating ${t.instanceId} and shrinking server group`,()=>hr.terminateInstanceAndShrinkServerGroup(t,e),!0)}),yr(t,"Discovery","OutOfService")&&!t.serverGroupDisabled&&i.unshift({label:"Enable In Discovery",triggerAction:()=>r(`Really enable ${t.instanceId} in discovery?`,`Enable ${t.instanceId}`,`Enabling ${t.instanceId} in discovery`,()=>hr.enableInstanceInDiscovery(t,e))}),(yr(t,"Discovery","Up")||yr(t,"Discovery","Down"))&&i.unshift({label:"Disable in Discovery",triggerAction:()=>r(`Really disable ${t.instanceId} in discovery?`,`Disable ${t.instanceId}`,`Disabling ${t.instanceId} in discovery`,()=>hr.disableInstanceInDiscovery(t,e))}),function(e){var t;return!!(null==(t=e.loadBalancers)?void 0:t.length)&&(yr(e,"LoadBalancer","OutOfService")||!(e.health||[]).some(e=>"LoadBalancer"===e.type))}(t)&&i.unshift({label:"Register with Load Balancer",triggerAction:()=>r(`Really register ${t.instanceId} with ${l}?`,`Register ${t.instanceId}`,`Registering ${t.instanceId} with ${l}`,()=>hr.registerInstanceWithLoadBalancer(t,e))}),(t.health||[]).some(e=>"LoadBalancer"===e.type)&&i.unshift({label:"Deregister from Load Balancer",triggerAction:()=>r(`Really deregister ${t.instanceId} from ${l}?`,`Deregister ${t.instanceId}`,`Deregistering ${t.instanceId} from ${l}`,()=>hr.deregisterInstanceFromLoadBalancer(t,e))}),function(e){var t;return!!(null==(t=e.targetGroups)?void 0:t.length)&&(yr(e,"TargetGroup","OutOfService")||!(e.health||[]).some(e=>"TargetGroup"===e.type))}(t)&&i.unshift({label:"Register with Target Group",triggerAction:()=>r(`Really register ${t.instanceId} with ${s}?`,`Register ${t.instanceId}`,`Registering ${t.instanceId} with ${s}`,()=>hr.registerInstanceWithTargetGroup(t,e))}),function(e){return(e.health||[]).some(e=>"TargetGroup"===e.type&&"OutOfService"!==e.state)}(t)&&i.unshift({label:"Deregister from Target Group",triggerAction:()=>r(`Really deregister ${t.instanceId} from ${s}?`,`Deregister ${t.instanceId}`,`Deregistering ${t.instanceId} from ${s}`,()=>hr.deregisterInstanceFromTargetGroup(t,e))}),/* @__PURE__ */qt.createElement(re,{actions:i})}class Cr extends qt.Component{constructor(){super(...arguments),this.state={instance:this.props.initialInstance,loading:!this.props.initialInstance},this.activeRequestId=0,this.isUnmounted=!1,this.retrieveInstance=(e=!1)=>{const t=++this.activeRequestId;this.setState(e?{instance:void 0,loading:!0}:{loading:!0}),Er({app:this.props.app,instance:this.getInstanceParams()}).then(e=>{this.isUnmounted||t!==this.activeRequestId||this.setState({instance:e,loading:!1})},()=>{this.isUnmounted||t!==this.activeRequestId||(this.props.app.isStandalone?(J.removeLastItem("instances"),this.setState({instance:{instanceIdNotFound:this.getInstanceParams().instanceId},loading:!1})):this.closeDetails())})}}componentDidMount(){if(this.props.initialInstance)return;const{app:e}=this.props;(e.isStandalone?Promise.resolve():Promise.all([e.serverGroups.ready(),e.loadBalancers.ready()])).then(()=>{var t;this.isUnmounted||(this.retrieveInstance(),!e.isStandalone&&(null==(t=e.serverGroups)?void 0:t.onRefresh)&&(this.unsubscribeFromRefresh=e.serverGroups.onRefresh(this.retrieveInstance)))}).catch(()=>{this.isUnmounted||this.closeDetails()})}closeDetails(){this.props.stateService.go("^",{allowModalToStayOpen:!0},{location:"replace"})}componentDidUpdate(e){const t=this.getInstanceParams(e),a=this.getInstanceParams();t.account===a.account&&t.instanceId===a.instanceId&&t.region===a.region||this.retrieveInstance(!0)}componentWillUnmount(){this.isUnmounted=!0,this.unsubscribeFromRefresh&&this.unsubscribeFromRefresh()}getInstanceParams(e=this.props){const t=e.instance||e.$stateParams||e.stateParams;return{account:null==t?void 0:t.account,instanceId:null==t?void 0:t.instanceId,provider:null==t?void 0:t.provider,region:null==t?void 0:t.region}}render(){var e;const{app:t,environment:a,moniker:n}=this.props,{instance:r,loading:l}=this.state,s=(null==r?void 0:r.instanceId)||(null==r?void 0:r.instanceIdNotFound)||this.getInstanceParams().instanceId,i=(null==(e=t.attributes)?void 0:e.instancePort)||o.defaultInstancePort||80;/* @__PURE__ */
|
|
25
|
-
return qt.createElement("div",{className:"details-panel"},/* @__PURE__ */qt.createElement("div",{className:"header"},/* @__PURE__ */qt.createElement(Q,{cloudProvider:"aws",healthState:null==r?void 0:r.healthState,instanceId:s,loading:l,standalone:t.isStandalone}),!l&&r&&!r.instanceIdNotFound&&r.placement&&/* @__PURE__ */qt.createElement("div",{className:"actions"},/* @__PURE__ */qt.createElement(
|
|
26
|
-
return qt.createElement("div",{className:"target-group-container container-fluid no-padding"},/* @__PURE__ */qt.createElement(tn,{class:"active"},/* @__PURE__ */qt.createElement(en,{to:".targetGroupDetails",params:l},/* @__PURE__ */qt.createElement("div",{className:"clickable clickable-row row no-margin-y target-group-header"},/* @__PURE__ */qt.createElement("div",{className:"col-md-8 target-group-title"},e.name),/* @__PURE__ */qt.createElement("div",{className:"col-md-4 text-right"},/* @__PURE__ */qt.createElement(se,{container:e.instanceCounts}))))),a&&r,!a&&t&&/* @__PURE__ */qt.createElement(ie,{serverGroups:e.serverGroups,instances:e.instances}))}}class
|
|
22
|
+
/* @__PURE__ */qt.createElement("a",null,e.groupName," (",e.groupId,")"))))))},fr=({healthMetrics:e,healthState:t,metricTypes:a,customHealthUrl:n,privateIpAddress:r})=>{const l=a.includes("LoadBalancer"),s=a.includes("TargetGroup");/* @__PURE__ */
|
|
23
|
+
return qt.createElement(z,{heading:"Status",defaultExpanded:!0},!e.length&&/* @__PURE__ */qt.createElement("p",null,"Starting"===t?"Starting":"No health metrics found for this instance"),/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},e.sort((e,t)=>e.type<t.type?-1:e.type>t.type?1:0).map(e=>/* @__PURE__ */qt.createElement(qt.Fragment,{key:`${e.type}-${e.description}`},/* @__PURE__ */qt.createElement("dt",null,Z(e.type)),/* @__PURE__ */qt.createElement("dd",null,!a.includes(e.type)&&/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement(_,{value:"down"===e.state.toLowerCase()?e.description:"",placement:"left"},/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:`glyphicon glyphicon-${e.state}-triangle`}),/* @__PURE__ */qt.createElement("span",null,Z(e.state)))),/* @__PURE__ */qt.createElement("span",{className:"pad-left small"},e.healthCheckUrl&&/* @__PURE__ */qt.createElement("a",{target:"_blank",href:e.healthCheckUrl},"Health Check"),e.healthCheckUrl&&e.statusPageUrl&&/* @__PURE__ */qt.createElement("span",null," | "),e.statusPageUrl&&/* @__PURE__ */qt.createElement("a",{target:"_blank",href:e.statusPageUrl},"Status"),n&&e.type===n.type&&/* @__PURE__ */qt.createElement("span",null," ","|"," ",/* @__PURE__ */qt.createElement("a",{target:"_blank",href:n.href},n.text)))),l&&"LoadBalancer"===e.type&&(e.loadBalancers||[]).map(e=>/* @__PURE__ */qt.createElement(K,{key:`lb-${e.name}`,loadBalancer:e})),s&&"TargetGroup"===e.type&&(e.targetGroups||[]).map(e=>/* @__PURE__ */qt.createElement(K,{key:`tg-${e.name}`,loadBalancer:e,ipAddress:r})))))))},Er=({tags:e})=>{const t=e||[],a=Jt(t,["key"],["asc"]);/* @__PURE__ */
|
|
24
|
+
return qt.createElement(z,{heading:"Tags",defaultExpanded:!0},!t.length&&/* @__PURE__ */qt.createElement("div",null,"No tags associated with this server"),Boolean(t.length)&&a.map(e=>/* @__PURE__ */qt.createElement(U,{key:e.key,label:e.key,value:e.value})))};class yr extends Y{static deregisterInstancesFromTargetGroup(e,t,a,n){const r=super.buildMultiInstanceJob(e,n,"deregisterInstancesFromLoadBalancer");r.forEach(e=>e.targetGroupNames=a);const l=super.buildMultiInstanceDescriptor(r,"Deregister",`from ${a.join(" and ")}`);return X.executeTask({job:r,application:t,description:l})}static deregisterInstanceFromTargetGroup(e,t,a={}){return a.type="deregisterInstancesFromLoadBalancer",a.instanceIds=[e.id],a.targetGroupNames=e.targetGroups,a.region=e.region,a.credentials=e.account,a.cloudProvider=e.cloudProvider,X.executeTask({job:[a],application:t,description:`Deregister instance: ${e.id}`})}static registerInstancesWithTargetGroup(e,t,a,n){const r=super.buildMultiInstanceJob(e,n,"registerInstancesWithLoadBalancer");r.forEach(e=>e.targetGroupNames=a);const l=super.buildMultiInstanceDescriptor(r,"Register",`with ${a.join(" and ")}`);return X.executeTask({job:r,application:t,description:l})}static registerInstanceWithTargetGroup(e,t,a={}){return a.type="registerInstancesWithLoadBalancer",a.instanceIds=[e.id],a.targetGroupNames=e.targetGroups,a.region=e.region,a.credentials=e.account,a.cloudProvider=e.cloudProvider,X.executeTask({job:[a],application:t,description:`Register instance: ${e.id}`})}}const br=e=>{const t=e.map(e=>e.targetGroups);return Qt(t)},Cr=(e,t,a)=>{e.forEach(e=>{"TargetGroup"===e.type&&e.targetGroups.forEach(e=>{var n,r,l;const s=null!=(n=t.find(t=>t.name===e.name&&t.account===a))?n:{},i="traffic-port"===s.healthCheckPort||ea(s.healthCheckPort)?s.port:s.healthCheckPort;e.healthCheckProtocol=null==(r=s.healthCheckProtocol)?void 0:r.toLowerCase(),e.healthCheckPath=`:${i}${null!=(l=s.healthCheckPath)?l:""}`})})};function Nr(e,t,a,n){var r;e.isStandalone&&(t.health=a.health);const l=(t.health||[]).filter(e=>"Amazon"!==e.type||"Unknown"!==e.state);if(!e.isStandalone){const t=br(((null==(r=e.loadBalancers)?void 0:r.data)||[]).filter(e=>"aws"===e.cloudProvider));Cr(l,t,n)}return(a.health||[]).forEach(e=>{const t=l.find(t=>t.type===e.type);t&&Object.assign(t,{...e,...t})}),l}async function Sr({app:e,instance:t}){var a,n;const r=function(e,t){return e.serverGroups?function(e,t){var a,n;const r=(null==(a=e.serverGroups)?void 0:a.data)||[];for(const l of r){const e=null==(n=l.instances)?void 0:n.find(e=>e.id===t);if(e)return{account:l.account,extraData:{serverGroup:l.name,vpcId:l.vpcId},loadBalancers:l.loadBalancers,region:l.region,serverGroupDisabled:l.isDisabled,summary:e,targetGroups:l.targetGroups,vpcId:l.vpcId}}}(e,t.instanceId)||function(e,t){var a,n,r;const l=(null==(a=e.loadBalancers)?void 0:a.data)||[];for(const s of l){const e=null==(n=s.instances)?void 0:n.find(e=>e.id===t);if(e)return{account:s.account,loadBalancers:[s.name],region:s.region,summary:e,vpcId:s.vpcId};const a=null==(r=s.targetGroups)?void 0:r.find(e=>{var a;return null==(a=e.instances)?void 0:a.some(e=>e.id===t)});if(a){const e=a.instances.find(e=>e.id===t);return{account:s.account,region:s.region,summary:e,targetGroups:[a.name],vpcId:s.vpcId}}}}(e,t.instanceId)||function(e,t){var a,n,r;const l=(null==(a=e.loadBalancers)?void 0:a.data)||[];for(const s of l){const e=(s.serverGroups||[]).filter(e=>e.isDisabled);for(const r of e){const e=null==(n=r.instances)?void 0:n.find(e=>e.id===t);if(e)return{account:s.account,loadBalancers:[s.name],region:s.region,summary:e,vpcId:s.vpcId}}const a=null==(r=s.targetGroups)?void 0:r.find(e=>(e.serverGroups||[]).some(e=>{var a;return e.isDisabled&&(null==(a=e.instances)?void 0:a.some(e=>e.id===t))}));if(a){const e=a.serverGroups.find(e=>{var a;return null==(a=e.instances)?void 0:a.some(e=>e.id===t)}).instances.find(e=>e.id===t);return{account:s.account,loadBalancers:[s.name],region:s.region,summary:e,vpcId:s.vpcId}}}}(e,t.instanceId):{account:t.account,loadBalancers:[],region:t.region,summary:{id:t.instanceId}}}(e,t);if(!(null==r?void 0:r.summary)||!r.account||!r.region)return{instanceIdNotFound:t.instanceId};J.addExtraDataToLatest("instances",{...r.extraData,account:r.account,region:r.region});const l=await ne.getInstanceDetails(r.account,r.region,t.instanceId),s={...r.summary,...l,account:r.account,baseIpAddress:l.publicDnsName||l.privateIpAddress,healthMetrics:Nr(e,r.summary,l,r.account),instanceId:l.instanceId||r.summary.instanceId||r.summary.id||t.instanceId,loadBalancers:r.loadBalancers,region:r.region,serverGroupDisabled:r.serverGroupDisabled,targetGroups:r.targetGroups,vpcId:r.vpcId};if((null==(a=r.extraData)?void 0:a.serverGroup)&&(s.serverGroup=r.extraData.serverGroup),s.networkInterfaces){const t=(null==(n=e.attributes)?void 0:n.instancePort)||o.defaultInstancePort||80;s.ipv6Addresses=ta(s.networkInterfaces,e=>(e.ipv6Addresses||[]).map(e=>({ip:e.ipv6Address,url:`http://${e.ipv6Address}:${t}`}))),s.permanentIps=s.networkInterfaces.filter(e=>{var t;return!1===(null==(t=e.attachment)?void 0:t.deleteOnTermination)}).map(e=>e.privateIpAddress)}return s}function wr(e,t,a){return(e.health||[]).some(e=>e.type===t&&e.state===a)}function kr({app:e,instance:t,stateService:a}){if(!Cn.adHocInfraWritesEnabled)return null;const n=()=>{a.includes("**.instanceDetails",{instanceId:t.instanceId})&&a.go("^")},r=(a,r,l,s,i=!1,o={})=>{x.confirm({header:a,buttonText:r,account:t.account,taskMonitorConfig:{application:e,title:l,onTaskComplete:i?n:void 0},submitMethod:s,...o})},l=(t.loadBalancers||[]).join(" and "),s=(t.targetGroups||[]).join(" and "),i=[{label:"Reboot",triggerAction:()=>{var a;return r(`Really reboot ${t.instanceId}?`,`Reboot ${t.instanceId}`,`Rebooting ${t.instanceId}`,(a={})=>{var n,r;return(null==(n=e.attributes)?void 0:n.platformHealthOnlyShowOverride)&&(null==(r=e.attributes)?void 0:r.platformHealthOnly)&&(a.interestingHealthProviderNames=["Amazon"]),yr.rebootInstance(t,e,a)},!1,{platformHealthOnlyShowOverride:null==(a=e.attributes)?void 0:a.platformHealthOnlyShowOverride,platformHealthType:"Amazon"})}},{label:"Terminate",triggerAction:()=>r(`Really terminate ${t.instanceId}?`,`Terminate ${t.instanceId}`,`Terminating ${t.instanceId}`,()=>yr.terminateInstance(t,e),!0)}];return t.serverGroup&&i.push({label:"Terminate and Shrink Server Group",triggerAction:()=>r(`Really terminate ${t.instanceId} and shrink ${t.serverGroup}?`,`Terminate ${t.instanceId} and shrink ${t.serverGroup}`,`Terminating ${t.instanceId} and shrinking server group`,()=>yr.terminateInstanceAndShrinkServerGroup(t,e),!0)}),wr(t,"Discovery","OutOfService")&&!t.serverGroupDisabled&&i.unshift({label:"Enable In Discovery",triggerAction:()=>r(`Really enable ${t.instanceId} in discovery?`,`Enable ${t.instanceId}`,`Enabling ${t.instanceId} in discovery`,()=>yr.enableInstanceInDiscovery(t,e))}),(wr(t,"Discovery","Up")||wr(t,"Discovery","Down"))&&i.unshift({label:"Disable in Discovery",triggerAction:()=>r(`Really disable ${t.instanceId} in discovery?`,`Disable ${t.instanceId}`,`Disabling ${t.instanceId} in discovery`,()=>yr.disableInstanceInDiscovery(t,e))}),function(e){var t;return!!(null==(t=e.loadBalancers)?void 0:t.length)&&(wr(e,"LoadBalancer","OutOfService")||!(e.health||[]).some(e=>"LoadBalancer"===e.type))}(t)&&i.unshift({label:"Register with Load Balancer",triggerAction:()=>r(`Really register ${t.instanceId} with ${l}?`,`Register ${t.instanceId}`,`Registering ${t.instanceId} with ${l}`,()=>yr.registerInstanceWithLoadBalancer(t,e))}),(t.health||[]).some(e=>"LoadBalancer"===e.type)&&i.unshift({label:"Deregister from Load Balancer",triggerAction:()=>r(`Really deregister ${t.instanceId} from ${l}?`,`Deregister ${t.instanceId}`,`Deregistering ${t.instanceId} from ${l}`,()=>yr.deregisterInstanceFromLoadBalancer(t,e))}),function(e){var t;return!!(null==(t=e.targetGroups)?void 0:t.length)&&(wr(e,"TargetGroup","OutOfService")||!(e.health||[]).some(e=>"TargetGroup"===e.type))}(t)&&i.unshift({label:"Register with Target Group",triggerAction:()=>r(`Really register ${t.instanceId} with ${s}?`,`Register ${t.instanceId}`,`Registering ${t.instanceId} with ${s}`,()=>yr.registerInstanceWithTargetGroup(t,e))}),function(e){return(e.health||[]).some(e=>"TargetGroup"===e.type&&"OutOfService"!==e.state)}(t)&&i.unshift({label:"Deregister from Target Group",triggerAction:()=>r(`Really deregister ${t.instanceId} from ${s}?`,`Deregister ${t.instanceId}`,`Deregistering ${t.instanceId} from ${s}`,()=>yr.deregisterInstanceFromTargetGroup(t,e))}),/* @__PURE__ */qt.createElement(re,{actions:i})}class Tr extends qt.Component{constructor(){super(...arguments),this.state={instance:this.props.initialInstance,loading:!this.props.initialInstance},this.activeRequestId=0,this.isUnmounted=!1,this.retrieveInstance=(e=!1)=>{const t=++this.activeRequestId;this.setState(e?{instance:void 0,loading:!0}:{loading:!0}),Sr({app:this.props.app,instance:this.getInstanceParams()}).then(e=>{this.isUnmounted||t!==this.activeRequestId||this.setState({instance:e,loading:!1})},()=>{this.isUnmounted||t!==this.activeRequestId||(this.props.app.isStandalone?(J.removeLastItem("instances"),this.setState({instance:{instanceIdNotFound:this.getInstanceParams().instanceId},loading:!1})):this.closeDetails())})}}componentDidMount(){if(this.props.initialInstance)return;const{app:e}=this.props;(e.isStandalone?Promise.resolve():Promise.all([e.serverGroups.ready(),e.loadBalancers.ready()])).then(()=>{var t;this.isUnmounted||(this.retrieveInstance(),!e.isStandalone&&(null==(t=e.serverGroups)?void 0:t.onRefresh)&&(this.unsubscribeFromRefresh=e.serverGroups.onRefresh(this.retrieveInstance)))}).catch(()=>{this.isUnmounted||this.closeDetails()})}closeDetails(){this.props.stateService.go("^",{allowModalToStayOpen:!0},{location:"replace"})}componentDidUpdate(e){const t=this.getInstanceParams(e),a=this.getInstanceParams();t.account===a.account&&t.instanceId===a.instanceId&&t.region===a.region||this.retrieveInstance(!0)}componentWillUnmount(){this.isUnmounted=!0,this.unsubscribeFromRefresh&&this.unsubscribeFromRefresh()}getInstanceParams(e=this.props){const t=e.instance||e.$stateParams||e.stateParams;return{account:null==t?void 0:t.account,instanceId:null==t?void 0:t.instanceId,provider:null==t?void 0:t.provider,region:null==t?void 0:t.region}}render(){var e;const{app:t,environment:a,moniker:n}=this.props,{instance:r,loading:l}=this.state,s=(null==r?void 0:r.instanceId)||(null==r?void 0:r.instanceIdNotFound)||this.getInstanceParams().instanceId,i=(null==(e=t.attributes)?void 0:e.instancePort)||o.defaultInstancePort||80;/* @__PURE__ */
|
|
25
|
+
return qt.createElement("div",{className:"details-panel"},/* @__PURE__ */qt.createElement("div",{className:"header"},/* @__PURE__ */qt.createElement(Q,{cloudProvider:"aws",healthState:null==r?void 0:r.healthState,instanceId:s,loading:l,standalone:t.isStandalone}),!l&&r&&!r.instanceIdNotFound&&r.placement&&/* @__PURE__ */qt.createElement("div",{className:"actions"},/* @__PURE__ */qt.createElement(kr,{app:t,instance:r,router:this.props.router,stateParams:this.props.stateParams,stateService:this.props.stateService}),/* @__PURE__ */qt.createElement(ee,{insights:r.insightActions,instance:r}))),!l&&r&&!r.instanceIdNotFound&&/* @__PURE__ */qt.createElement("div",{className:"content"},/* @__PURE__ */qt.createElement(hr,{instance:r}),/* @__PURE__ */qt.createElement(fr,{healthMetrics:r.healthMetrics||[],healthState:r.healthState,metricTypes:["LoadBalancer","TargetGroup"],privateIpAddress:r.privateIpAddress}),/* @__PURE__ */qt.createElement(z,{heading:"DNS"},/* @__PURE__ */qt.createElement(gr,{instancePort:String(r.instancePort||i),ipv6Addresses:r.ipv6Addresses||[],permanentIps:r.permanentIps||[],privateDnsName:r.privateDnsName||"",privateIpAddress:r.privateIpAddress||"",publicDnsName:r.publicDnsName||"",publicIpAddress:r.publicIpAddress||""})),/* @__PURE__ */qt.createElement(vr,{instance:r}),/* @__PURE__ */qt.createElement(Er,{tags:r.tags||[]}),r.baseIpAddress&&/* @__PURE__ */qt.createElement(z,{heading:"Console Output"},/* @__PURE__ */qt.createElement("ul",null,/* @__PURE__ */qt.createElement("li",null,/* @__PURE__ */qt.createElement(te,{instance:r})))),/* @__PURE__ */qt.createElement(ae,{address:r.baseIpAddress,application:t,instance:r,moniker:n,environment:a})),!l&&(null==r?void 0:r.instanceIdNotFound)&&/* @__PURE__ */qt.createElement("div",{className:"content"},/* @__PURE__ */qt.createElement("div",{className:"content-section"},/* @__PURE__ */qt.createElement("div",{className:"content-body text-center"},/* @__PURE__ */qt.createElement("h3",null,"Instance not found.")))))}}const Ir=G(kr),Pr=G(Tr);class Ar extends qt.Component{render(){const{targetGroup:e,showInstances:t,showServerGroups:a,loadBalancer:n}=this.props,r=Jt(e.serverGroups,["isDisabled","name"],["asc","desc"]).map(e=>/* @__PURE__ */qt.createElement(le,{key:e.name,account:e.account,region:e.region,serverGroup:e,showInstances:t})),l={loadBalancerName:n.name,region:e.region,accountId:e.account,name:e.name,vpcId:e.vpcId,provider:e.cloudProvider};/* @__PURE__ */
|
|
26
|
+
return qt.createElement("div",{className:"target-group-container container-fluid no-padding"},/* @__PURE__ */qt.createElement(tn,{class:"active"},/* @__PURE__ */qt.createElement(en,{to:".targetGroupDetails",params:l},/* @__PURE__ */qt.createElement("div",{className:"clickable clickable-row row no-margin-y target-group-header"},/* @__PURE__ */qt.createElement("div",{className:"col-md-8 target-group-title"},e.name),/* @__PURE__ */qt.createElement("div",{className:"col-md-4 text-right"},/* @__PURE__ */qt.createElement(se,{container:e.instanceCounts}))))),a&&r,!a&&t&&/* @__PURE__ */qt.createElement(ie,{serverGroups:e.serverGroups,instances:e.instances}))}}class Gr extends qt.Component{shouldComponentUpdate(e){return e.showInstances!==this.props.showInstances||e.showServerGroups!==this.props.showServerGroups||e.loadBalancer!==this.props.loadBalancer||(()=>!aa((e.serverGroups||[]).map(e=>e.name),(this.props.serverGroups||[]).map(e=>e.name)))()||(()=>!aa((e.loadBalancer.targetGroups||[]).map(e=>e.name),(this.props.loadBalancer.targetGroups||[]).map(e=>e.name)))()}render(){const{loadBalancer:e,showInstances:t,showServerGroups:a}=this.props;if("classic"!==e.loadBalancerType){const n=e.targetGroups.map(n=>/* @__PURE__ */qt.createElement(Ar,{key:n.name,loadBalancer:e,targetGroup:n,showInstances:t,showServerGroups:a}));/* @__PURE__ */
|
|
27
27
|
return qt.createElement("div",{className:"cluster-container"},n)}/* @__PURE__ */
|
|
28
|
-
return qt.createElement(oe,{...this.props})}}class
|
|
29
|
-
return qt.createElement("a",{onClick:this.onClick},/* @__PURE__ */qt.createElement("span",{className:"name"},this.props.loadBalancer.name),/* @__PURE__ */qt.createElement(se,{container:this.props.loadBalancer.instanceCounts}))}}class
|
|
30
|
-
return qt.createElement(_,{value:`${this.props.label||"Load Balancer"}: ${this.props.loadBalancer.name}`},/* @__PURE__ */qt.createElement("button",{className:"btn btn-link no-padding",onClick:this.onClick},/* @__PURE__ */qt.createElement("span",{className:"badge badge-counter"},/* @__PURE__ */qt.createElement("span",{className:"icon"},/* @__PURE__ */qt.createElement("i",{className:"fa icon-sitemap"})))))}}class
|
|
28
|
+
return qt.createElement(oe,{...this.props})}}class xr{static buildTargetGroup(e,t){if(!e)return null;const a={name:e.name,vpcId:e.vpcId,cloudProvider:e.cloudProvider,account:e.account,region:e.region,loadBalancerNames:e.loadBalancerNames,instanceCounts:{up:0,down:0,succeeded:0,failed:0,outOfService:0,unknown:0,starting:0}};return t.instances.forEach(t=>{const n=t.health.find(e=>"TargetGroup"===e.type);if(n){const t=n.targetGroups.find(t=>t.name===e.name);if(void 0!==t&&void 0!==t.healthState){const e=t.healthState.toLowerCase();void 0!==a.instanceCounts[e]&&a.instanceCounts[e]++}}}),a}static populateTargetGroups(e,t){return Promise.all([h.getAccountDetails(t.account),e.getDataSource("loadBalancers").ready()]).then(a=>{const n=a[0]&&a[0].awsAccount||t.account,r=e.loadBalancers.data.filter(e=>"application"===e.loadBalancerType||"network"===e.loadBalancerType);return t.targetGroups.map(e=>{const a=Qt(r.map(e=>e.targetGroups||[])).find(a=>a.name===e&&a.region===t.region&&a.account===n);return this.buildTargetGroup(a,t)}).filter(e=>e)})}}class Dr extends qt.Component{constructor(){super(...arguments),this.onClick=e=>{this.props.onItemClick(this.props.loadBalancer),e.nativeEvent.preventDefault()}}render(){/* @__PURE__ */
|
|
29
|
+
return qt.createElement("a",{onClick:this.onClick},/* @__PURE__ */qt.createElement("span",{className:"name"},this.props.loadBalancer.name),/* @__PURE__ */qt.createElement(se,{container:this.props.loadBalancer.instanceCounts}))}}class Br extends qt.Component{constructor(){super(...arguments),this.onClick=e=>{this.props.onItemClick(this.props.loadBalancer),e.nativeEvent.preventDefault()}}render(){/* @__PURE__ */
|
|
30
|
+
return qt.createElement(_,{value:`${this.props.label||"Load Balancer"}: ${this.props.loadBalancer.name}`},/* @__PURE__ */qt.createElement("button",{className:"btn btn-link no-padding",onClick:this.onClick},/* @__PURE__ */qt.createElement("span",{className:"badge badge-counter"},/* @__PURE__ */qt.createElement("span",{className:"icon"},/* @__PURE__ */qt.createElement("i",{className:"fa icon-sitemap"})))))}}class Fr extends qt.Component{constructor(e){super(e),this.mounted=!1,this.showLoadBalancerDetails=e=>{const{stateService:t}=this.props,a=this.props.serverGroup;ce.log({category:"Cluster Pod",action:"Load Load Balancer Details (multiple menu)"});const n=t.current.name.endsWith(".clusters")?".loadBalancerDetails":"^.loadBalancerDetails";t.go(n,{region:a.region,accountId:a.account,name:e.name,provider:a.type})},this.showTargetGroupDetails=e=>{const{stateService:t}=this.props;ce.log({category:"Cluster Pod",action:"Load Target Group Details (multiple menu)"});const a=t.current.name.endsWith(".clusters")?".targetGroupDetails":"^.targetGroupDetails";t.go(a,{region:e.region,accountId:e.account,name:e.name,provider:"aws",loadBalancerName:e.loadBalancerNames[0]})},this.handleShowPopover=()=>{ce.log({category:"Cluster Pod",action:"Show Load Balancers Menu"})},this.handleClick=e=>{e.preventDefault(),e.stopPropagation()},this.state={loadBalancers:[],targetGroups:[],isLoading:!0}}componentDidMount(){this.mounted=!0,this.loadBalancersRefreshUnsubscribe=this.props.application.getDataSource("loadBalancers").onRefresh(()=>{this.forceUpdate()}),de.populateLoadBalancers(this.props.application,this.props.serverGroup).then(e=>{this.mounted&&this.setState({loadBalancers:e,isLoading:!1})}),xr.populateTargetGroups(this.props.application,this.props.serverGroup).then(e=>{this.mounted&&this.setState({targetGroups:e})})}componentWillUnmount(){this.mounted=!1,this.loadBalancersRefreshUnsubscribe()}render(){const{loadBalancers:e,targetGroups:t,isLoading:a}=this.state,n=t&&t.length||0,r=e&&e.length||0,l=n+r;if(!l)return a?/* @__PURE__ */qt.createElement(me,{size:"nano"}):null;const s="load-balancers-tag "+(l>1?"overflowing":""),i=/* @__PURE__ */qt.createElement("div",{className:"menu-load-balancers"},r>0&&/* @__PURE__ */qt.createElement("div",{className:"menu-load-balancers-header"},"Load Balancers"),na(e,"name").map(e=>/* @__PURE__ */qt.createElement(Dr,{key:e.name,loadBalancer:e,onItemClick:this.showLoadBalancerDetails})),n>0&&/* @__PURE__ */qt.createElement("div",{className:"menu-load-balancers-header"},"Target Groups"),na(t,"name").map(e=>/* @__PURE__ */qt.createElement(Dr,{key:e.name,loadBalancer:e,onItemClick:this.showTargetGroupDetails})));/* @__PURE__ */
|
|
31
31
|
return qt.createElement("span",{className:s},l>1&&/* @__PURE__ */qt.createElement(ue,{delayShow:100,delayHide:150,onShow:this.handleShowPopover,placement:"bottom",template:i,hOffsetPercent:"80%",container:this.props.container,className:"no-padding menu-load-balancers"},
|
|
32
|
-
/* @__PURE__ */qt.createElement("button",{onClick:this.handleClick,className:"btn btn-link btn-multiple-load-balancers clearfix no-padding"},/* @__PURE__ */qt.createElement("span",{className:"badge badge-counter"},/* @__PURE__ */qt.createElement("span",{className:"icon"},/* @__PURE__ */qt.createElement("i",{className:"fa icon-sitemap"}))," ",l))),1===e.length&&0===t.length&&/* @__PURE__ */qt.createElement("span",{className:"btn-load-balancer"},/* @__PURE__ */qt.createElement(Pr,{key:e[0].name,label:"Load Balancer",loadBalancer:e[0],onItemClick:this.showLoadBalancerDetails})),1===t.length&&0===e.length&&/* @__PURE__ */qt.createElement("span",{className:"btn-load-balancer"},/* @__PURE__ */qt.createElement(Pr,{key:t[0].name,label:"Target Group",loadBalancer:t[0],onItemClick:this.showTargetGroupDetails})))}}const Gr=G(Ar);class xr{updateHealthCounts(e){const t=e.instances;if(e.instanceCounts={up:t.filter(e=>"InService"===e.health[0].state).length,down:t.filter(e=>"Down"===e.healthState).length,outOfService:t.filter(e=>"OutOfService"===e.healthState).length,starting:void 0,succeeded:void 0,failed:void 0,unknown:void 0},e.serverGroups){const t=Qt(e.serverGroups.map(e=>e.instances));e.instanceCounts.up=t.filter(e=>"InService"===e.health[0].state).length,e.instanceCounts.down=t.filter(e=>"Down"===e.healthState).length,e.instanceCounts.outOfService=t.filter(e=>"OutOfService"===e.healthState).length}}transformInstance(e,t,a,n){const r=e.health||{};"healthy"===r.state&&(r.state="InService"),e.provider=t,e.account=a,e.region=n,e.healthState=r.state?"InService"===r.state?"Up":"Down":"OutOfService",e.health=[r]}addVpcNameToContainer(e){return t=>{const a=t.find(t=>t.id===e.vpcId);return e.vpcName=a?a.name:"",e}}normalizeServerGroups(e,t,a,n){e.forEach(e=>{e.account=e.account||t.account,e.region=e.region||t.region,e.cloudProvider=e.cloudProvider||t.cloudProvider,e.detachedInstances?(e.detachedInstances=e.detachedInstances.map(e=>({id:e})),e.instances=e.instances.concat(e.detachedInstances)):e.detachedInstances=[],e.instances.forEach(e=>{this.transformInstance(e,t.type,t.account,t.region),e[a]=[t.name],e.health.type=n}),this.updateHealthCounts(e)})}normalizeTargetGroup(e){this.normalizeServerGroups(e.serverGroups,e,"targetGroups","TargetGroup");const t=ra(e.serverGroups,{isDisabled:!1});return e.provider=e.type,e.instances=la(t).map("instances").flatten().value(),e.detachedInstances=la(t).map("detachedInstances").flatten().value(),this.updateHealthCounts(e),Promise.all([zn.listVpcs(),h.listAllAccounts()]).then(([t,a])=>{const n=this.addVpcNameToContainer(e)(t);return n.serverGroups=n.serverGroups.map(e=>{const t=a.find(t=>t.name===e.account),n=t&&t.cloudProvider||e.cloudProvider;return e.cloudProvider=n,e.instances.forEach(e=>{e.cloudProvider=n,e.provider=n}),{...e,cloudProvider:n}}),n})}normalizeActions(e){if("application"===e.loadBalancerType){e.listeners.forEach(e=>{e.defaultActions.sort((e,t)=>e.order-t.order),e.rules.forEach(e=>e.actions.sort((e,t)=>e.order-t.order))})}}normalizeLoadBalancer(e){this.normalizeServerGroups(e.serverGroups,e,"loadBalancers","LoadBalancer");let t=e.serverGroups;if(e.targetGroups){const a=e;a.targetGroups.forEach(e=>this.normalizeTargetGroup(e)),t=Qt(sa(a.targetGroups,"serverGroups"))}e.loadBalancerType=e.loadBalancerType||"classic",e.provider=e.type,this.normalizeActions(e);const a=ra(t,{isDisabled:!1});return e.instances=la(a).map("instances").flatten().value(),e.detachedInstances=la(a).map("detachedInstances").flatten().value(),this.updateHealthCounts(e),zn.listVpcs().then(t=>this.addVpcNameToContainer(e)(t))}static convertClassicLoadBalancerForEditing(e){const t={availabilityZones:void 0,isInternal:e.isInternal,region:e.region,cloudProvider:e.cloudProvider,credentials:e.credentials||e.account,listeners:e.listeners,loadBalancerType:"classic",name:e.name,regionZones:e.availabilityZones,securityGroups:e.securityGroups,vpcId:e.vpcId,healthCheck:void 0,healthTimeout:e.healthTimeout,healthInterval:e.healthInterval,healthyThreshold:e.healthyThreshold,unhealthyThreshold:e.unhealthyThreshold,healthCheckProtocol:e.healthCheckProtocol,healthCheckPort:e.healthCheckPort,healthCheckPath:e.healthCheckPath,idleTimeout:e.idleTimeout||60,subnetType:e.subnetType};if(e.elb){const a=e.elb;if(t.securityGroups=a.securityGroups,t.vpcId=a.vpcid||a.vpcId,a.listenerDescriptions&&(t.listeners=a.listenerDescriptions.map(e=>{const t=e.listener;if(t.sslcertificateId){const e=t.sslcertificateId.split("/");t.sslcertificateId=e[1],t.sslCertificateType=e[0].split(":")[2]}return{internalProtocol:t.instanceProtocol,internalPort:t.instancePort,externalProtocol:t.protocol,externalPort:t.loadBalancerPort,sslCertificateId:t.sslcertificateId,sslCertificateName:t.sslcertificateId,sslCertificateType:t.sslCertificateType,policyNames:e.policyNames}})),a.healthCheck&&a.healthCheck.target){t.healthTimeout=a.healthCheck.timeout,t.healthInterval=a.healthCheck.interval,t.healthyThreshold=a.healthCheck.healthyThreshold,t.unhealthyThreshold=a.healthCheck.unhealthyThreshold;const e=a.healthCheck.target,n=e.indexOf(":");let r=e.indexOf("/");if(-1===r&&(r=e.length),-1!==n){t.healthCheckProtocol=e.substring(0,n);const a=Number(e.substring(n+1,r));t.healthCheckPath=e.substring(r),isNaN(a)||(t.healthCheckPort=a)}}}return t}static convertApplicationLoadBalancerForEditing(e){const t=pe.parseLoadBalancerName(e.name).application,a={availabilityZones:void 0,isInternal:e.isInternal,region:e.region,loadBalancerType:"application",cloudProvider:e.cloudProvider,credentials:e.account||e.credentials,listeners:[],targetGroups:[],name:e.name,regionZones:e.availabilityZones,securityGroups:[],subnetType:e.subnetType,vpcId:void 0,idleTimeout:e.idleTimeout||60,deletionProtection:e.deletionProtection||!1,ipAddressType:e.ipAddressType||"ipv4",dualstack:"dualstack"===e.ipAddressType};if(e.elb){const n=e.elb;a.securityGroups=n.securityGroups,a.vpcId=n.vpcid||n.vpcId,n.listeners&&(a.listeners=n.listeners.map(e=>{const a=[];return e.certificates&&e.certificates.forEach(e=>{const t=e.certificateArn.split(":"),n=t[5].split("/");a.push({certificateArn:e.certificateArn,type:t[2],name:n[1]})}),(e.defaultActions||[]).forEach(e=>{e.targetGroupName&&(e.targetGroupName=e.targetGroupName.replace(`${t}-`,"")),e.redirectActionConfig=e.redirectConfig}),e.rules=(e.rules||[]).filter(e=>!e.default),e.rules.forEach(e=>{(e.actions||[]).forEach(e=>{e.targetGroupName&&(e.targetGroupName=e.targetGroupName.replace(`${t}-`,"")),e.redirectActionConfig=e.redirectConfig}),(e.conditions||[]).forEach(e=>{"http-request-method"===e.field&&(e.values=e.httpRequestMethodConfig.values)}),e.conditions=e.conditions||[]}),e.rules.sort((e,t)=>e.priority-t.priority),{protocol:e.protocol,port:e.port,defaultActions:e.defaultActions,certificates:a,rules:e.rules||[],sslPolicy:e.sslPolicy}})),n.targetGroups&&(a.targetGroups=n.targetGroups.map(e=>({name:e.targetGroupName.replace(`${t}-`,""),protocol:e.protocol,port:e.port,targetType:e.targetType,healthCheckProtocol:e.healthCheckProtocol,healthCheckPort:e.healthCheckPort,healthCheckPath:e.healthCheckPath,healthCheckTimeout:e.healthCheckTimeoutSeconds,healthCheckInterval:e.healthCheckIntervalSeconds,healthyThreshold:e.healthyThresholdCount,unhealthyThreshold:e.unhealthyThresholdCount,attributes:{deregistrationDelay:Number(e.attributes["deregistration_delay.timeout_seconds"]),stickinessEnabled:"true"===e.attributes["stickiness.enabled"],stickinessType:e.attributes["stickiness.type"],stickinessDuration:Number(e.attributes["stickiness.lb_cookie.duration_seconds"]),multiValueHeadersEnabled:"true"===e.attributes["lambda.multi_value_headers.enabled"]}})))}return a}static convertNetworkLoadBalancerForEditing(e){const t=pe.parseLoadBalancerName(e.name).application,a={availabilityZones:void 0,isInternal:e.isInternal,region:e.region,loadBalancerType:"network",cloudProvider:e.cloudProvider,credentials:e.account||e.credentials,listeners:[],targetGroups:[],name:e.name,regionZones:e.availabilityZones,securityGroups:[],subnetType:e.subnetType,vpcId:void 0,deletionProtection:e.deletionProtection,loadBalancingCrossZone:e.loadBalancingCrossZone,ipAddressType:e.ipAddressType||"ipv4",dualstack:"dualstack"===e.ipAddressType};if(e.elb){const n=e.elb;a.securityGroups=n.securityGroups,a.vpcId=n.vpcid||n.vpcId,n.listeners&&(a.listeners=n.listeners.map(e=>{const a=[];return e.certificates&&e.certificates.forEach(e=>{const t=e.certificateArn.split(":"),n=t[5].split("/");a.push({certificateArn:e.certificateArn,type:t[2],name:n[1]})}),(e.defaultActions||[]).forEach(e=>{e.targetGroupName&&(e.targetGroupName=e.targetGroupName.replace(`${t}-`,""))}),e.rules=(e.rules||[]).filter(e=>!e.default),e.rules.forEach(e=>{(e.actions||[]).forEach(e=>{e.targetGroupName&&(e.targetGroupName=e.targetGroupName.replace(`${t}-`,""))}),e.conditions=e.conditions||[]}),e.rules.sort((e,t)=>e.priority-t.priority),{protocol:e.protocol,port:e.port,defaultActions:e.defaultActions,certificates:a,rules:e.rules||[],sslPolicy:e.sslPolicy}})),n.targetGroups&&(a.targetGroups=n.targetGroups.map(e=>({name:e.targetGroupName.replace(`${t}-`,""),protocol:e.protocol,port:e.port,targetType:e.targetType,healthCheckProtocol:e.healthCheckProtocol,healthCheckPort:e.healthCheckPort,healthCheckTimeout:e.healthCheckTimeoutSeconds,healthCheckInterval:e.healthCheckIntervalSeconds,healthyThreshold:e.healthyThresholdCount,unhealthyThreshold:e.unhealthyThresholdCount,healthCheckPath:e.healthCheckPath,attributes:{deregistrationDelay:Number(e.attributes["deregistration_delay.timeout_seconds"]),deregistrationDelayConnectionTermination:Boolean("true"===e.attributes["deregistration_delay.connection_termination.enabled"]),preserveClientIp:Boolean("true"===e.attributes["preserve_client_ip.enabled"])}})))}return a}static constructNewClassicLoadBalancerTemplate(e){return{availabilityZones:void 0,name:"",stack:"",detail:"",loadBalancerType:"classic",isInternal:!1,cloudProvider:"aws",credentials:e.defaultCredentials.aws||Cn.defaults.account,region:e.defaultRegions.aws||Cn.defaults.region,vpcId:null,subnetType:Cn.defaults.subnetType,healthCheck:void 0,healthCheckProtocol:"HTTP",healthCheckPort:7001,healthCheckPath:"/healthcheck",healthTimeout:5,healthInterval:10,healthyThreshold:10,unhealthyThreshold:2,idleTimeout:60,regionZones:[],securityGroups:[],listeners:[{externalPort:80,externalProtocol:"HTTP",internalPort:7001,internalProtocol:"HTTP"}]}}static constructNewApplicationLoadBalancerTemplate(e){const t="targetgroup";return{name:"",availabilityZones:void 0,stack:"",detail:"",loadBalancerType:"application",ipAddressType:"ipv4",dualstack:!1,isInternal:!1,cloudProvider:"aws",credentials:e.defaultCredentials.aws||Cn.defaults.account,region:e.defaultRegions.aws||Cn.defaults.region,vpcId:null,subnetType:Cn.defaults.subnetType,idleTimeout:60,deletionProtection:!1,targetGroups:[{name:t,protocol:"HTTP",port:e.attributes.instancePort||o.defaultInstancePort,targetType:"instance",healthCheckProtocol:"HTTP",healthCheckPort:"traffic-port",healthCheckPath:"/healthcheck",healthCheckTimeout:5,healthCheckInterval:10,healthyThreshold:10,unhealthyThreshold:2,attributes:{deregistrationDelay:300,stickinessEnabled:!1,stickinessType:"lb_cookie",stickinessDuration:8400,multiValueHeadersEnabled:!1}}],regionZones:[],securityGroups:[],listeners:[{certificates:[],protocol:"HTTP",port:80,defaultActions:[{type:"forward",targetGroupName:t}],rules:[]}]}}static constructNewNetworkLoadBalancerTemplate(e){const t="targetgroup";return{name:"",availabilityZones:void 0,stack:"",detail:"",loadBalancerType:"network",isInternal:!1,ipAddressType:"ipv4",dualstack:!1,cloudProvider:"aws",credentials:e.defaultCredentials.aws||Cn.defaults.account,region:e.defaultRegions.aws||Cn.defaults.region,vpcId:null,subnetType:Cn.defaults.subnetType,deletionProtection:!1,loadBalancingCrossZone:!0,securityGroups:[],targetGroups:[{name:t,protocol:"TCP",port:7001,targetType:"instance",healthCheckProtocol:"TCP",healthCheckPath:"/healthcheck",healthCheckPort:"traffic-port",healthCheckTimeout:5,healthCheckInterval:10,healthyThreshold:10,unhealthyThreshold:10,attributes:{deregistrationDelay:300}}],regionZones:[],listeners:[{certificates:[],protocol:"TCP",port:80,defaultActions:[{type:"forward",targetGroupName:t}],rules:[]}]}}}function Dr(e){var t;return(null==(t=e.listeners)?void 0:t.some(e=>"HTTPS"===e.protocol))?"https:":"http:"}class Br extends qt.Component{constructor(){super(...arguments),this.state={loading:!0},this.isUnmounted=!1,this.extractTargetGroup=()=>{var e;const{accountId:t,loadBalancerName:a,name:n,region:r}=this.props.targetGroup,l=this.props.app.getDataSource("loadBalancers").data.find(e=>e.name===a&&e.region===r&&e.account===t),s=null==(e=null==l?void 0:l.targetGroups)?void 0:e.find(e=>e.name===n);l&&s?this.isUnmounted||this.setState({loadBalancer:l,targetGroup:s,loading:!1}):this.autoClose()},this.autoClose=()=>{this.isUnmounted||(this.props.stateService.params.allowModalToStayOpen=!0,this.props.stateService.go("^",null,{location:"replace"}))},this.closeDetails=()=>{this.props.stateService.go("^")}}componentDidMount(){this.props.app.getDataSource("loadBalancers").ready().then(()=>{this.isUnmounted||(this.extractTargetGroup(),this.unsubscribeFromRefresh=this.props.app.getDataSource("loadBalancers").onRefresh(this.extractTargetGroup))}).catch(()=>{this.isUnmounted||this.setState({loading:!1})})}componentWillUnmount(){this.isUnmounted=!0,this.unsubscribeFromRefresh&&this.unsubscribeFromRefresh()}renderHeader(){const{name:e}=this.props,{loading:t}=this.state;/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */qt.createElement("button",{onClick:this.handleClick,className:"btn btn-link btn-multiple-load-balancers clearfix no-padding"},/* @__PURE__ */qt.createElement("span",{className:"badge badge-counter"},/* @__PURE__ */qt.createElement("span",{className:"icon"},/* @__PURE__ */qt.createElement("i",{className:"fa icon-sitemap"}))," ",l))),1===e.length&&0===t.length&&/* @__PURE__ */qt.createElement("span",{className:"btn-load-balancer"},/* @__PURE__ */qt.createElement(Br,{key:e[0].name,label:"Load Balancer",loadBalancer:e[0],onItemClick:this.showLoadBalancerDetails})),1===t.length&&0===e.length&&/* @__PURE__ */qt.createElement("span",{className:"btn-load-balancer"},/* @__PURE__ */qt.createElement(Br,{key:t[0].name,label:"Target Group",loadBalancer:t[0],onItemClick:this.showTargetGroupDetails})))}}const Mr=G(Fr);class Rr{updateHealthCounts(e){const t=e.instances;if(e.instanceCounts={up:t.filter(e=>"InService"===e.health[0].state).length,down:t.filter(e=>"Down"===e.healthState).length,outOfService:t.filter(e=>"OutOfService"===e.healthState).length,starting:void 0,succeeded:void 0,failed:void 0,unknown:void 0},e.serverGroups){const t=Qt(e.serverGroups.map(e=>e.instances));e.instanceCounts.up=t.filter(e=>"InService"===e.health[0].state).length,e.instanceCounts.down=t.filter(e=>"Down"===e.healthState).length,e.instanceCounts.outOfService=t.filter(e=>"OutOfService"===e.healthState).length}}transformInstance(e,t,a,n){const r=e.health||{};"healthy"===r.state&&(r.state="InService"),e.provider=t,e.account=a,e.region=n,e.healthState=r.state?"InService"===r.state?"Up":"Down":"OutOfService",e.health=[r]}addVpcNameToContainer(e){return t=>{const a=t.find(t=>t.id===e.vpcId);return e.vpcName=a?a.name:"",e}}normalizeServerGroups(e,t,a,n){e.forEach(e=>{e.account=e.account||t.account,e.region=e.region||t.region,e.cloudProvider=e.cloudProvider||t.cloudProvider,e.detachedInstances?(e.detachedInstances=e.detachedInstances.map(e=>({id:e})),e.instances=e.instances.concat(e.detachedInstances)):e.detachedInstances=[],e.instances.forEach(e=>{this.transformInstance(e,t.type,t.account,t.region),e[a]=[t.name],e.health.type=n}),this.updateHealthCounts(e)})}normalizeTargetGroup(e){this.normalizeServerGroups(e.serverGroups,e,"targetGroups","TargetGroup");const t=ra(e.serverGroups,{isDisabled:!1});return e.provider=e.type,e.instances=la(t).map("instances").flatten().value(),e.detachedInstances=la(t).map("detachedInstances").flatten().value(),this.updateHealthCounts(e),Promise.all([Hn.listVpcs(),h.listAllAccounts()]).then(([t,a])=>{const n=this.addVpcNameToContainer(e)(t);return n.serverGroups=n.serverGroups.map(e=>{const t=a.find(t=>t.name===e.account),n=t&&t.cloudProvider||e.cloudProvider;return e.cloudProvider=n,e.instances.forEach(e=>{e.cloudProvider=n,e.provider=n}),{...e,cloudProvider:n}}),n})}normalizeActions(e){if("application"===e.loadBalancerType){e.listeners.forEach(e=>{e.defaultActions.sort((e,t)=>e.order-t.order),e.rules.forEach(e=>e.actions.sort((e,t)=>e.order-t.order))})}}normalizeLoadBalancer(e){this.normalizeServerGroups(e.serverGroups,e,"loadBalancers","LoadBalancer");let t=e.serverGroups;if(e.targetGroups){const a=e;a.targetGroups.forEach(e=>this.normalizeTargetGroup(e)),t=Qt(sa(a.targetGroups,"serverGroups"))}e.loadBalancerType=e.loadBalancerType||"classic",e.provider=e.type,this.normalizeActions(e);const a=ra(t,{isDisabled:!1});return e.instances=la(a).map("instances").flatten().value(),e.detachedInstances=la(a).map("detachedInstances").flatten().value(),this.updateHealthCounts(e),Hn.listVpcs().then(t=>this.addVpcNameToContainer(e)(t))}static convertClassicLoadBalancerForEditing(e){const t={availabilityZones:void 0,isInternal:e.isInternal,region:e.region,cloudProvider:e.cloudProvider,credentials:e.credentials||e.account,listeners:e.listeners,loadBalancerType:"classic",name:e.name,regionZones:e.availabilityZones,securityGroups:e.securityGroups,vpcId:e.vpcId,healthCheck:void 0,healthTimeout:e.healthTimeout,healthInterval:e.healthInterval,healthyThreshold:e.healthyThreshold,unhealthyThreshold:e.unhealthyThreshold,healthCheckProtocol:e.healthCheckProtocol,healthCheckPort:e.healthCheckPort,healthCheckPath:e.healthCheckPath,idleTimeout:e.idleTimeout||60,subnetType:e.subnetType};if(e.elb){const a=e.elb;if(t.securityGroups=a.securityGroups,t.vpcId=kn(a),a.listenerDescriptions&&(t.listeners=a.listenerDescriptions.map(e=>{const t=e.listener;let a,n=(e=>{var t;return null!=(t=null==e?void 0:e.sslCertificateId)?t:null==e?void 0:e.sslcertificateId})(t);if(n){const e=n.split("/");n=e[1],a=e[0].split(":")[2]}return{internalProtocol:t.instanceProtocol,internalPort:t.instancePort,externalProtocol:t.protocol,externalPort:t.loadBalancerPort,sslCertificateId:n,sslCertificateName:n,sslCertificateType:a,policyNames:e.policyNames}})),a.healthCheck&&a.healthCheck.target){t.healthTimeout=a.healthCheck.timeout,t.healthInterval=a.healthCheck.interval,t.healthyThreshold=a.healthCheck.healthyThreshold,t.unhealthyThreshold=a.healthCheck.unhealthyThreshold;const e=a.healthCheck.target,n=e.indexOf(":");let r=e.indexOf("/");if(-1===r&&(r=e.length),-1!==n){t.healthCheckProtocol=e.substring(0,n);const a=Number(e.substring(n+1,r));t.healthCheckPath=e.substring(r),isNaN(a)||(t.healthCheckPort=a)}}}return t}static convertApplicationLoadBalancerForEditing(e){const t=pe.parseLoadBalancerName(e.name).application,a={availabilityZones:void 0,isInternal:e.isInternal,region:e.region,loadBalancerType:"application",cloudProvider:e.cloudProvider,credentials:e.account||e.credentials,listeners:[],targetGroups:[],name:e.name,regionZones:e.availabilityZones,securityGroups:[],subnetType:e.subnetType,vpcId:void 0,idleTimeout:e.idleTimeout||60,deletionProtection:e.deletionProtection||!1,ipAddressType:e.ipAddressType||"ipv4",dualstack:"dualstack"===e.ipAddressType};if(e.elb){const n=e.elb;a.securityGroups=n.securityGroups,a.vpcId=kn(n),n.listeners&&(a.listeners=n.listeners.map(e=>{const a=[];return e.certificates&&e.certificates.forEach(e=>{const t=e.certificateArn.split(":"),n=t[5].split("/");a.push({certificateArn:e.certificateArn,type:t[2],name:n[1]})}),(e.defaultActions||[]).forEach(e=>{e.targetGroupName&&(e.targetGroupName=e.targetGroupName.replace(`${t}-`,"")),e.redirectActionConfig=e.redirectConfig}),e.rules=(e.rules||[]).filter(e=>!e.default),e.rules.forEach(e=>{(e.actions||[]).forEach(e=>{e.targetGroupName&&(e.targetGroupName=e.targetGroupName.replace(`${t}-`,"")),e.redirectActionConfig=e.redirectConfig}),(e.conditions||[]).forEach(e=>{"http-request-method"===e.field&&(e.values=e.httpRequestMethodConfig.values)}),e.conditions=e.conditions||[]}),e.rules.sort((e,t)=>e.priority-t.priority),{protocol:e.protocol,port:e.port,defaultActions:e.defaultActions,certificates:a,rules:e.rules||[],sslPolicy:e.sslPolicy}})),n.targetGroups&&(a.targetGroups=n.targetGroups.map(e=>({name:e.targetGroupName.replace(`${t}-`,""),protocol:e.protocol,port:e.port,targetType:e.targetType,healthCheckProtocol:e.healthCheckProtocol,healthCheckPort:e.healthCheckPort,healthCheckPath:e.healthCheckPath,healthCheckTimeout:e.healthCheckTimeoutSeconds,healthCheckInterval:e.healthCheckIntervalSeconds,healthyThreshold:e.healthyThresholdCount,unhealthyThreshold:e.unhealthyThresholdCount,attributes:{deregistrationDelay:Number(e.attributes["deregistration_delay.timeout_seconds"]),stickinessEnabled:"true"===e.attributes["stickiness.enabled"],stickinessType:e.attributes["stickiness.type"],stickinessDuration:Number(e.attributes["stickiness.lb_cookie.duration_seconds"]),multiValueHeadersEnabled:"true"===e.attributes["lambda.multi_value_headers.enabled"]}})))}return a}static convertNetworkLoadBalancerForEditing(e){const t=pe.parseLoadBalancerName(e.name).application,a={availabilityZones:void 0,isInternal:e.isInternal,region:e.region,loadBalancerType:"network",cloudProvider:e.cloudProvider,credentials:e.account||e.credentials,listeners:[],targetGroups:[],name:e.name,regionZones:e.availabilityZones,securityGroups:[],subnetType:e.subnetType,vpcId:void 0,deletionProtection:e.deletionProtection,loadBalancingCrossZone:e.loadBalancingCrossZone,ipAddressType:e.ipAddressType||"ipv4",dualstack:"dualstack"===e.ipAddressType};if(e.elb){const n=e.elb;a.securityGroups=n.securityGroups,a.vpcId=kn(n),n.listeners&&(a.listeners=n.listeners.map(e=>{const a=[];return e.certificates&&e.certificates.forEach(e=>{const t=e.certificateArn.split(":"),n=t[5].split("/");a.push({certificateArn:e.certificateArn,type:t[2],name:n[1]})}),(e.defaultActions||[]).forEach(e=>{e.targetGroupName&&(e.targetGroupName=e.targetGroupName.replace(`${t}-`,""))}),e.rules=(e.rules||[]).filter(e=>!e.default),e.rules.forEach(e=>{(e.actions||[]).forEach(e=>{e.targetGroupName&&(e.targetGroupName=e.targetGroupName.replace(`${t}-`,""))}),e.conditions=e.conditions||[]}),e.rules.sort((e,t)=>e.priority-t.priority),{protocol:e.protocol,port:e.port,defaultActions:e.defaultActions,certificates:a,rules:e.rules||[],sslPolicy:e.sslPolicy}})),n.targetGroups&&(a.targetGroups=n.targetGroups.map(e=>({name:e.targetGroupName.replace(`${t}-`,""),protocol:e.protocol,port:e.port,targetType:e.targetType,healthCheckProtocol:e.healthCheckProtocol,healthCheckPort:e.healthCheckPort,healthCheckTimeout:e.healthCheckTimeoutSeconds,healthCheckInterval:e.healthCheckIntervalSeconds,healthyThreshold:e.healthyThresholdCount,unhealthyThreshold:e.unhealthyThresholdCount,healthCheckPath:e.healthCheckPath,attributes:{deregistrationDelay:Number(e.attributes["deregistration_delay.timeout_seconds"]),deregistrationDelayConnectionTermination:Boolean("true"===e.attributes["deregistration_delay.connection_termination.enabled"]),preserveClientIp:Boolean("true"===e.attributes["preserve_client_ip.enabled"])}})))}return a}static constructNewClassicLoadBalancerTemplate(e){return{availabilityZones:void 0,name:"",stack:"",detail:"",loadBalancerType:"classic",isInternal:!1,cloudProvider:"aws",credentials:e.defaultCredentials.aws||Cn.defaults.account,region:e.defaultRegions.aws||Cn.defaults.region,vpcId:null,subnetType:Cn.defaults.subnetType,healthCheck:void 0,healthCheckProtocol:"HTTP",healthCheckPort:7001,healthCheckPath:"/healthcheck",healthTimeout:5,healthInterval:10,healthyThreshold:10,unhealthyThreshold:2,idleTimeout:60,regionZones:[],securityGroups:[],listeners:[{externalPort:80,externalProtocol:"HTTP",internalPort:7001,internalProtocol:"HTTP"}]}}static constructNewApplicationLoadBalancerTemplate(e){const t="targetgroup";return{name:"",availabilityZones:void 0,stack:"",detail:"",loadBalancerType:"application",ipAddressType:"ipv4",dualstack:!1,isInternal:!1,cloudProvider:"aws",credentials:e.defaultCredentials.aws||Cn.defaults.account,region:e.defaultRegions.aws||Cn.defaults.region,vpcId:null,subnetType:Cn.defaults.subnetType,idleTimeout:60,deletionProtection:!1,targetGroups:[{name:t,protocol:"HTTP",port:e.attributes.instancePort||o.defaultInstancePort,targetType:"instance",healthCheckProtocol:"HTTP",healthCheckPort:"traffic-port",healthCheckPath:"/healthcheck",healthCheckTimeout:5,healthCheckInterval:10,healthyThreshold:10,unhealthyThreshold:2,attributes:{deregistrationDelay:300,stickinessEnabled:!1,stickinessType:"lb_cookie",stickinessDuration:8400,multiValueHeadersEnabled:!1}}],regionZones:[],securityGroups:[],listeners:[{certificates:[],protocol:"HTTP",port:80,defaultActions:[{type:"forward",targetGroupName:t}],rules:[]}]}}static constructNewNetworkLoadBalancerTemplate(e){const t="targetgroup";return{name:"",availabilityZones:void 0,stack:"",detail:"",loadBalancerType:"network",isInternal:!1,ipAddressType:"ipv4",dualstack:!1,cloudProvider:"aws",credentials:e.defaultCredentials.aws||Cn.defaults.account,region:e.defaultRegions.aws||Cn.defaults.region,vpcId:null,subnetType:Cn.defaults.subnetType,deletionProtection:!1,loadBalancingCrossZone:!0,securityGroups:[],targetGroups:[{name:t,protocol:"TCP",port:7001,targetType:"instance",healthCheckProtocol:"TCP",healthCheckPath:"/healthcheck",healthCheckPort:"traffic-port",healthCheckTimeout:5,healthCheckInterval:10,healthyThreshold:10,unhealthyThreshold:10,attributes:{deregistrationDelay:300}}],regionZones:[],listeners:[{certificates:[],protocol:"TCP",port:80,defaultActions:[{type:"forward",targetGroupName:t}],rules:[]}]}}}function Lr(e){var t;return(null==(t=e.listeners)?void 0:t.some(e=>"HTTPS"===e.protocol))?"https:":"http:"}class zr extends qt.Component{constructor(){super(...arguments),this.state={loading:!0},this.isUnmounted=!1,this.extractTargetGroup=()=>{var e;const{accountId:t,loadBalancerName:a,name:n,region:r}=this.props.targetGroup,l=this.props.app.getDataSource("loadBalancers").data.find(e=>e.name===a&&e.region===r&&e.account===t),s=null==(e=null==l?void 0:l.targetGroups)?void 0:e.find(e=>e.name===n);l&&s?this.isUnmounted||this.setState({loadBalancer:l,targetGroup:s,loading:!1}):this.autoClose()},this.autoClose=()=>{this.isUnmounted||(this.props.stateService.params.allowModalToStayOpen=!0,this.props.stateService.go("^",null,{location:"replace"}))},this.closeDetails=()=>{this.props.stateService.go("^")}}componentDidMount(){this.props.app.getDataSource("loadBalancers").ready().then(()=>{this.isUnmounted||(this.extractTargetGroup(),this.unsubscribeFromRefresh=this.props.app.getDataSource("loadBalancers").onRefresh(this.extractTargetGroup))}).catch(()=>{this.isUnmounted||this.setState({loading:!1})})}componentWillUnmount(){this.isUnmounted=!0,this.unsubscribeFromRefresh&&this.unsubscribeFromRefresh()}renderHeader(){const{name:e}=this.props,{loading:t}=this.state;/* @__PURE__ */
|
|
33
33
|
return qt.createElement("div",{className:"header"},/* @__PURE__ */qt.createElement("div",{className:"close-button"},/* @__PURE__ */qt.createElement("a",{className:"btn btn-link",onClick:this.closeDetails},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-remove"}))),t&&/* @__PURE__ */qt.createElement("div",{className:"horizontal center middle"},/* @__PURE__ */qt.createElement(me,{size:"small"})),!t&&/* @__PURE__ */qt.createElement("div",{className:"header-text horizontal middle"},/* @__PURE__ */qt.createElement("i",{className:"fa fa-crosshairs icon","aria-hidden":"true"}),/* @__PURE__ */qt.createElement("h3",{className:"horizontal middle space-between flex-1"},e)))}renderNotFound(){/* @__PURE__ */
|
|
34
|
-
return qt.createElement("div",{className:"content"},/* @__PURE__ */qt.createElement("div",{className:"content-section"},/* @__PURE__ */qt.createElement("div",{className:"content-body text-center"},/* @__PURE__ */qt.createElement("h3",null,"Target group not found."))))}renderDetails(e,t){var a,n,r,l,s
|
|
35
|
-
return qt.createElement("div",{className:"content"},/* @__PURE__ */qt.createElement(z,{heading:"Target Group Details",defaultExpanded:!0},/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-narrow"},/* @__PURE__ */qt.createElement("dt",null,"In"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(L,{account:t.account})," ",t.region),/* @__PURE__ */qt.createElement("dt",null,"VPC"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(
|
|
36
|
-
/* @__PURE__ */qt.createElement("a",null,e.name)))))),
|
|
37
|
-
/* @__PURE__ */qt.createElement("a",null,e.name)))))))),/* @__PURE__ */qt.createElement(z,{heading:"Status",defaultExpanded:!0},/* @__PURE__ */qt.createElement(se,{className:"pull-left",container:t.instanceCounts})),/* @__PURE__ */qt.createElement(z,{heading:"Health Checks"},/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Target"),/* @__PURE__ */qt.createElement("dd",null,t.healthCheckProtocol,":",t.healthCheckPort,t.healthCheckPath),/* @__PURE__ */qt.createElement("dt",null,"Timeout"),/* @__PURE__ */qt.createElement("dd",null,t.healthCheckTimeoutSeconds||t.healthTimeout," seconds"),/* @__PURE__ */qt.createElement("dt",null,"Interval"),/* @__PURE__ */qt.createElement("dd",null,t.healthCheckIntervalSeconds||t.healthInterval," seconds"),/* @__PURE__ */qt.createElement("dt",null,"Healthy Threshold"),/* @__PURE__ */qt.createElement("dd",null,t.healthyThresholdCount||t.healthyThreshold),/* @__PURE__ */qt.createElement("dt",null,"Unhealthy Threshold"),/* @__PURE__ */qt.createElement("dd",null,t.unhealthyThresholdCount||t.unhealthyThreshold),t.matcher&&/* @__PURE__ */qt.createElement("dt",null,"Matcher"),t.matcher&&/* @__PURE__ */qt.createElement("dd",null,"HTTP Code(s): ",t.matcher.httpCode))),/* @__PURE__ */qt.createElement(z,{heading:"Attributes",defaultExpanded:!0},/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Deregistration Delay Timeout"),/* @__PURE__ */qt.createElement("dd",null,
|
|
38
|
-
return qt.createElement("div",{className:"details-panel"},this.renderHeader(),!a&&(null==t?void 0:t.isManaged)&&/* @__PURE__ */qt.createElement(ge,{resourceSummary:t.managedResourceSummary,application:e}),!a&&!n&&this.renderNotFound(),!a&&n&&t&&this.renderDetails(t,n))}}const
|
|
39
|
-
return qt.createElement("div",{style:{width:"100%"}},/* @__PURE__ */qt.createElement(an,{className:"input-sm",wrapperStyle:{width:"100%"},clearable:!0,required:!0,options:l,onChange:e=>a(e.value),value:n}),s&&/* @__PURE__ */qt.createElement("div",{className:"small sp-margin-xs-top sp-margin-m-bottom sp-margin-m-left"},/* @__PURE__ */qt.createElement("div",null,"Uploaded ",ve(s.uploadDate)," (",V(s.uploadDate),")"),/* @__PURE__ */qt.createElement("b",null,"Expires ",ve(s.expiration))," (",V(s.expiration),")"))}};
|
|
40
|
-
return qt.createElement("div",{className:"configure-config-modal"},/* @__PURE__ */qt.createElement(Ee,{initialValues:e,onSubmit:this.submit,validate:this.validate,render:({isValid:e})=>/* @__PURE__ */qt.createElement(on,{className:"form-horizontal"},/* @__PURE__ */qt.createElement(ye,{dismiss:this.close}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Configure OIDC Client")),/* @__PURE__ */qt.createElement(Za.Body,null,/* @__PURE__ */qt.createElement(u,{name:"issuer",label:"Issuer",required:!0,input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter the OpenId Provider"})}),/* @__PURE__ */qt.createElement(u,{name:"authorizationEndpoint",label:"Authorization Endpoint",required:!0,input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter OpenID provider server endpoint"})}),/* @__PURE__ */qt.createElement(u,{name:"tokenEndpoint",label:"Token Endpoint",required:!0,input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter a URI for your token endpoint"})}),/* @__PURE__ */qt.createElement(u,{name:"userInfoEndpoint",label:"User info Endpoint",required:!0,input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter a URI for your user info endpoint"})}),/* @__PURE__ */qt.createElement(u,{name:"clientId",label:"Client ID",required:!0,input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter the client ID"})}),/* @__PURE__ */qt.createElement(u,{name:"clientSecret",label:"Client secret",required:!0,input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter the client secret"})})),/* @__PURE__ */qt.createElement(Za.Footer,null,/* @__PURE__ */qt.createElement("button",{className:"btn btn-default",onClick:this.close,type:"button"},"Cancel"),/* @__PURE__ */qt.createElement(be,{isDisabled:!e,submitting:!1,isFormSubmit:!0,label:"Save Client"})))}))}};
|
|
41
|
-
return qt.createElement("div",{className:"configure-config-modal"},/* @__PURE__ */qt.createElement(Ee,{initialValues:this.initialValues,onSubmit:this.submit,render:({isValid:e})=>/* @__PURE__ */qt.createElement(on,{className:"form-horizontal"},/* @__PURE__ */qt.createElement(ye,{dismiss:this.close}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Configure Redirect ",/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect"}))),/* @__PURE__ */qt.createElement(Za.Body,null,/* @__PURE__ */qt.createElement(u,{name:"host",label:"Host",required:!1,input:e=>/* @__PURE__ */qt.createElement(p,{...e}),help:/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect.host"})}),/* @__PURE__ */qt.createElement(u,{name:"path",label:"Path",required:!1,input:e=>/* @__PURE__ */qt.createElement(p,{...e}),help:/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect.path"})}),/* @__PURE__ */qt.createElement(u,{name:"port",label:"Port",required:!1,input:e=>/* @__PURE__ */qt.createElement(p,{...e}),help:/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect.port"})}),/* @__PURE__ */qt.createElement(u,{name:"protocol",label:"Protocol",required:!1,input:e=>/* @__PURE__ */qt.createElement(g,{...e,stringOptions:["HTTP","HTTPS","#{protocol}"],placeholder:"Select Protocol",clearable:!1,style:{width:"130px"}}),help:/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect.protocol"})}),/* @__PURE__ */qt.createElement(u,{name:"query",label:"Query",required:!1,input:e=>/* @__PURE__ */qt.createElement(p,{...e}),help:/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect.query"})}),/* @__PURE__ */qt.createElement(u,{name:"statusCode",label:"Status Code",required:!0,input:e=>/* @__PURE__ */qt.createElement(Ce,{...e,options:["HTTP_301","HTTP_302"]}),help:/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect.statusCode"})})),/* @__PURE__ */qt.createElement(Za.Footer,null,/* @__PURE__ */qt.createElement("button",{className:"btn btn-default",onClick:this.close,type:"button"},"Cancel"),/* @__PURE__ */qt.createElement(be,{isDisabled:!e,submitting:!1,isFormSubmit:!0,label:"Save Config"})))}))}}
|
|
42
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},t.listeners.map((e,l)=>/* @__PURE__ */qt.createElement("div",{key:l,className:"wizard-pod"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row header"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Listen On"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents spread"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Protocol"),/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",style:{width:"80px"},value:e.protocol,onChange:t=>this.listenerProtocolChanged(e,t.target.value)},this.protocols.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e)))),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Port"),/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",type:"text",min:0,value:e.port||"",onChange:t=>this.listenerPortChanged(e,t.target.value),style:{width:"80px"},required:!0}))),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("a",{className:"sm-label clickable",onClick:()=>this.removeListener(l)},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"}))))),this.needsCert(e)&&/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Certificate"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},e.certificates.map((e,r)=>/* @__PURE__ */qt.createElement("div",{key:r,style:{width:"100%",display:"flex",flexDirection:"row"}},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",style:{width:"45px"},value:e.type,onChange:t=>this.certificateTypeChanged(e,t.target.value)},n.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e))),this.showCertificateSelect(e)&&/* @__PURE__ */qt.createElement(
|
|
43
|
-
/* @__PURE__ */qt.createElement(_,{value:"Remove Condition"},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"})))))),1===e.rule.conditions.length&&/* @__PURE__ */qt.createElement("div",{className:"add-new-container"},/* @__PURE__ */qt.createElement("button",{type:"button",className:"add-new col-md-12",onClick:()=>e.addCondition(e.rule)},/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"})," Add new condition")),/* @__PURE__ */qt.createElement("span",{style:{minWidth:"15px"}}))),/* @__PURE__ */qt.createElement("td",null,e.rule.actions.map((t,a)=>/* @__PURE__ */qt.createElement(
|
|
34
|
+
return qt.createElement("div",{className:"content"},/* @__PURE__ */qt.createElement("div",{className:"content-section"},/* @__PURE__ */qt.createElement("div",{className:"content-body text-center"},/* @__PURE__ */qt.createElement("h3",null,"Target group not found."))))}renderDetails(e,t){var a,n,r,l,s;const i=wn(e)||wn(e.elb),o=t.attributes||{};/* @__PURE__ */
|
|
35
|
+
return qt.createElement("div",{className:"content"},/* @__PURE__ */qt.createElement(z,{heading:"Target Group Details",defaultExpanded:!0},/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-narrow"},/* @__PURE__ */qt.createElement("dt",null,"In"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(L,{account:t.account})," ",t.region),/* @__PURE__ */qt.createElement("dt",null,"VPC"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(Wn,{vpcId:t.vpcId})),/* @__PURE__ */qt.createElement("dt",null,"Protocol"),/* @__PURE__ */qt.createElement("dd",null,t.protocol),/* @__PURE__ */qt.createElement("dt",null,"Port"),/* @__PURE__ */qt.createElement("dd",null,t.port),/* @__PURE__ */qt.createElement("dt",null,"Target Type"),/* @__PURE__ */qt.createElement("dd",null,t.targetType)),/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Load Balancer"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement("ul",{className:"collapse-margin-on-filter-collapse"},/* @__PURE__ */qt.createElement("li",null,/* @__PURE__ */qt.createElement(en,{to:"^.loadBalancerDetails",params:{name:e.name,region:e.region,accountId:e.account,vpcId:e.vpcId,provider:"aws"}},
|
|
36
|
+
/* @__PURE__ */qt.createElement("a",null,e.name)))))),i&&/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Load Balancer DNS Name"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement("a",{target:"_blank",href:`${Lr(e)}//${i}`},i)," ",/* @__PURE__ */qt.createElement(he,{text:i,toolTip:"Copy DNS Name to clipboard"}))),!!(null==(a=t.serverGroups)?void 0:a.length)&&/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Server Groups"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement("ul",{className:"collapse-margin-on-filter-collapse"},t.serverGroups.map(e=>/* @__PURE__ */qt.createElement("li",{key:e.name},/* @__PURE__ */qt.createElement(en,{to:"^.serverGroup",params:{region:e.region,accountId:e.account,serverGroup:e.name,provider:e.cloudProvider}},
|
|
37
|
+
/* @__PURE__ */qt.createElement("a",null,e.name)))))))),/* @__PURE__ */qt.createElement(z,{heading:"Status",defaultExpanded:!0},/* @__PURE__ */qt.createElement(se,{className:"pull-left",container:t.instanceCounts})),/* @__PURE__ */qt.createElement(z,{heading:"Health Checks"},/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Target"),/* @__PURE__ */qt.createElement("dd",null,t.healthCheckProtocol,":",t.healthCheckPort,t.healthCheckPath),/* @__PURE__ */qt.createElement("dt",null,"Timeout"),/* @__PURE__ */qt.createElement("dd",null,t.healthCheckTimeoutSeconds||t.healthTimeout," seconds"),/* @__PURE__ */qt.createElement("dt",null,"Interval"),/* @__PURE__ */qt.createElement("dd",null,t.healthCheckIntervalSeconds||t.healthInterval," seconds"),/* @__PURE__ */qt.createElement("dt",null,"Healthy Threshold"),/* @__PURE__ */qt.createElement("dd",null,t.healthyThresholdCount||t.healthyThreshold),/* @__PURE__ */qt.createElement("dt",null,"Unhealthy Threshold"),/* @__PURE__ */qt.createElement("dd",null,t.unhealthyThresholdCount||t.unhealthyThreshold),t.matcher&&/* @__PURE__ */qt.createElement("dt",null,"Matcher"),t.matcher&&/* @__PURE__ */qt.createElement("dd",null,"HTTP Code(s): ",t.matcher.httpCode))),/* @__PURE__ */qt.createElement(z,{heading:"Attributes",defaultExpanded:!0},/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Deregistration Delay Timeout"),/* @__PURE__ */qt.createElement("dd",null,o["deregistration_delay.timeout_seconds"]||o.deregistrationDelay," seconds"),/* @__PURE__ */qt.createElement("dt",null,"Stickiness Enabled"),/* @__PURE__ */qt.createElement("dd",null,String(null!=(r=null!=(n=o["stickiness.enabled"])?n:o.stickinessEnabled)&&r)),("true"===o["stickiness.enabled"]||o.stickinessEnabled)&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("dt",null,"Stickiness Load Balancer Cookie Duration"),/* @__PURE__ */qt.createElement("dd",null,o["stickiness.lb_cookie.duration_seconds"]||o.stickinessDuration," seconds"),/* @__PURE__ */qt.createElement("dt",null,"Stickiness Type"),/* @__PURE__ */qt.createElement("dd",null,o["stickiness.type"]||o.stickinessType)),"network"===e.loadBalancerType&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("dt",null,"Preserve Client IP"),/* @__PURE__ */qt.createElement("dd",null,String(null!=(s=null!=(l=o["preserve_client_ip.enabled"])?l:o.preserveClientIp)&&s))))))}render(){const{app:e}=this.props,{loadBalancer:t,loading:a,targetGroup:n}=this.state;/* @__PURE__ */
|
|
38
|
+
return qt.createElement("div",{className:"details-panel"},this.renderHeader(),!a&&(null==t?void 0:t.isManaged)&&/* @__PURE__ */qt.createElement(ge,{resourceSummary:t.managedResourceSummary,application:e}),!a&&!n&&this.renderNotFound(),!a&&n&&t&&this.renderDetails(t,n))}}const Or=G(zr);var $r=Object.getOwnPropertyDescriptor;let Ur=class extends qt.Component{render(){const{certificates:e,accountName:t,onCertificateSelect:a,currentValue:n}=this.props,r=e[t]||[],l=r.map(e=>({label:e.serverCertificateName,value:e.serverCertificateName})),s=r.find(e=>e.serverCertificateName===n);/* @__PURE__ */
|
|
39
|
+
return qt.createElement("div",{style:{width:"100%"}},/* @__PURE__ */qt.createElement(an,{className:"input-sm",wrapperStyle:{width:"100%"},clearable:!0,required:!0,options:l,onChange:e=>a(e.value),value:n}),s&&/* @__PURE__ */qt.createElement("div",{className:"small sp-margin-xs-top sp-margin-m-bottom sp-margin-m-left"},/* @__PURE__ */qt.createElement("div",null,"Uploaded ",ve(s.uploadDate)," (",V(s.uploadDate),")"),/* @__PURE__ */qt.createElement("b",null,"Expires ",ve(s.expiration))," (",V(s.expiration),")"))}};Ur=((e,t,a,n)=>{for(var r,l=n>1?void 0:n?$r(t,a):t,s=e.length-1;s>=0;s--)(r=e[s])&&(l=r(l)||l);return l})([fe("amazon.certificateSelectField")],Ur);const Vr=qt.forwardRef((e,t)=>/* @__PURE__ */qt.createElement("div",{ref:t},/* @__PURE__ */qt.createElement(u,{name:"idleTimeout",label:"Idle Timeout",help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.idleTimeout"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0})}),/* @__PURE__ */qt.createElement(u,{name:"deletionProtection",label:"Protection",help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.deletionProtection"}),input:e=>/* @__PURE__ */qt.createElement(v,{...e,text:"Enable delete protection"})}),/* @__PURE__ */qt.createElement(u,{name:"dualstack",label:"Dualstack",help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.albIpAddressType"}),input:e=>/* @__PURE__ */qt.createElement(v,{...e,text:"Assign Ipv4 and IPv6"})}))),Hr=class e extends qt.Component{constructor(e){super(e),this.close=e=>{this.props.dismissModal(e)},this.submit=e=>{this.props.closeModal(e)},this.validate=()=>({});const t=e.config||{};this.state={initialValues:{authorizationEndpoint:t.authorizationEndpoint||"",clientId:t.clientId||"",clientSecret:t.clientSecret||"",issuer:t.issuer||"",scope:t.scope||"openid",sessionCookieName:t.sessionCookieName||"AWSELBAuthSessionCookie",tokenEndpoint:t.tokenEndpoint||"",userInfoEndpoint:t.userInfoEndpoint||""}}}static show(t){return I.show(e,t)}render(){const{initialValues:e}=this.state;/* @__PURE__ */
|
|
40
|
+
return qt.createElement("div",{className:"configure-config-modal"},/* @__PURE__ */qt.createElement(Ee,{initialValues:e,onSubmit:this.submit,validate:this.validate,render:({isValid:e})=>/* @__PURE__ */qt.createElement(on,{className:"form-horizontal"},/* @__PURE__ */qt.createElement(ye,{dismiss:this.close}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Configure OIDC Client")),/* @__PURE__ */qt.createElement(Za.Body,null,/* @__PURE__ */qt.createElement(u,{name:"issuer",label:"Issuer",required:!0,input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter the OpenId Provider"})}),/* @__PURE__ */qt.createElement(u,{name:"authorizationEndpoint",label:"Authorization Endpoint",required:!0,input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter OpenID provider server endpoint"})}),/* @__PURE__ */qt.createElement(u,{name:"tokenEndpoint",label:"Token Endpoint",required:!0,input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter a URI for your token endpoint"})}),/* @__PURE__ */qt.createElement(u,{name:"userInfoEndpoint",label:"User info Endpoint",required:!0,input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter a URI for your user info endpoint"})}),/* @__PURE__ */qt.createElement(u,{name:"clientId",label:"Client ID",required:!0,input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter the client ID"})}),/* @__PURE__ */qt.createElement(u,{name:"clientSecret",label:"Client secret",required:!0,input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter the client secret"})})),/* @__PURE__ */qt.createElement(Za.Footer,null,/* @__PURE__ */qt.createElement("button",{className:"btn btn-default",onClick:this.close,type:"button"},"Cancel"),/* @__PURE__ */qt.createElement(be,{isDisabled:!e,submitting:!1,isFormSubmit:!0,label:"Save Client"})))}))}};Hr.defaultProps={closeModal:T,dismissModal:T};let qr=Hr;const Wr=class e extends qt.Component{constructor(e){super(e),this.close=e=>{this.props.dismissModal(e)},this.submit=e=>{const t=ia(e,e=>e&&""!==e);this.props.closeModal(t)};const t=e.config||{};this.initialValues={host:t.host||"",path:t.path||"",port:t.port||"",protocol:t.protocol||void 0,query:t.query||"",statusCode:t.statusCode||"HTTP_301"}}static show(t){return I.show(e,t)}render(){/* @__PURE__ */
|
|
41
|
+
return qt.createElement("div",{className:"configure-config-modal"},/* @__PURE__ */qt.createElement(Ee,{initialValues:this.initialValues,onSubmit:this.submit,render:({isValid:e})=>/* @__PURE__ */qt.createElement(on,{className:"form-horizontal"},/* @__PURE__ */qt.createElement(ye,{dismiss:this.close}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Configure Redirect ",/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect"}))),/* @__PURE__ */qt.createElement(Za.Body,null,/* @__PURE__ */qt.createElement(u,{name:"host",label:"Host",required:!1,input:e=>/* @__PURE__ */qt.createElement(p,{...e}),help:/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect.host"})}),/* @__PURE__ */qt.createElement(u,{name:"path",label:"Path",required:!1,input:e=>/* @__PURE__ */qt.createElement(p,{...e}),help:/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect.path"})}),/* @__PURE__ */qt.createElement(u,{name:"port",label:"Port",required:!1,input:e=>/* @__PURE__ */qt.createElement(p,{...e}),help:/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect.port"})}),/* @__PURE__ */qt.createElement(u,{name:"protocol",label:"Protocol",required:!1,input:e=>/* @__PURE__ */qt.createElement(g,{...e,stringOptions:["HTTP","HTTPS","#{protocol}"],placeholder:"Select Protocol",clearable:!1,style:{width:"130px"}}),help:/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect.protocol"})}),/* @__PURE__ */qt.createElement(u,{name:"query",label:"Query",required:!1,input:e=>/* @__PURE__ */qt.createElement(p,{...e}),help:/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect.query"})}),/* @__PURE__ */qt.createElement(u,{name:"statusCode",label:"Status Code",required:!0,input:e=>/* @__PURE__ */qt.createElement(Ce,{...e,options:["HTTP_301","HTTP_302"]}),help:/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.redirect.statusCode"})})),/* @__PURE__ */qt.createElement(Za.Footer,null,/* @__PURE__ */qt.createElement("button",{className:"btn btn-default",onClick:this.close,type:"button"},"Cancel"),/* @__PURE__ */qt.createElement(be,{isDisabled:!e,submitting:!1,isFormSubmit:!0,label:"Save Config"})))}))}};Wr.defaultProps={closeModal:T,dismissModal:T};let jr=Wr;class Zr{static getOidcConfigsByApp(e){return F("/oidcConfigs").query({app:e}).get()}}class _r{static listCertificates(){return Ne.listCertificatesByProvider("aws").then(e=>h.listAllAccounts("aws").then(t=>{const a=t.reduce((e,t)=>(e[t.accountId]=t.name,e),{}),n=na(e,"serverCertificateName");return oa(n,e=>{const[,,,,t]=e.arn.split(":");return a[t]||"unknown"})}))}}const Kr=nn(()=>/* @__PURE__ */qt.createElement("span",{className:"pipeline-drag-handle clickable glyphicon glyphicon-resize-vertical"})),Yr={authenticateOidcConfig:{authorizationEndpoint:"",clientId:"",issuer:"",scope:"openid",sessionCookieName:"AWSELBAuthSessionCookie",tokenEndpoint:"",userInfoEndpoint:""},type:"authenticate-oidc"};class Xr extends qt.Component{constructor(e){super(e),this.protocols=["HTTP","HTTPS"],this.initialActionsWithAuth=/* @__PURE__ */new Set,this.initialListenersWithDefaultAuth=/* @__PURE__ */new Set,this.removedAuthActions=/* @__PURE__ */new Map,this.attachClientSecret=(e,t)=>{if("authenticate-oidc"===e.type){const a=t.find(t=>t.clientId===e.authenticateOidcConfig.clientId);a&&(e.authenticateOidcConfig.clientSecret=a.clientSecret)}},this.addListener=()=>{this.props.formik.values.listeners.push({certificates:[],protocol:"HTTP",port:80,defaultActions:[{type:"forward",targetGroupName:""}],rules:[]}),this.updateListeners()},this.addRule=e=>{e.rules.push({priority:null,actions:[{type:"forward",targetGroupName:""}],conditions:[{field:"path-pattern",values:[""]}]}),this.updateListeners()},this.removeRule=(e,t)=>{e.rules.splice(t,1),this.updateListeners()},this.handleConditionFieldChanged=(e,t)=>{e.field=t,"http-request-method"===t&&(e.values=[]),this.updateListeners()},this.handleConditionValueChanged=(e,t)=>{e.values[0]=t,this.updateListeners()},this.handleHttpRequestMethodChanged=(e,t,a)=>{let n=e.values||[];a?n.push(t):n=n.filter(e=>e!==t),e.values=n,e.httpRequestMethodConfig={values:n},this.updateListeners()},this.addCondition=e=>{if(1===e.conditions.length){const t="path-pattern"===e.conditions[0].field?"host-header":"path-pattern";e.conditions.push({field:t,values:[""]})}this.updateListeners()},this.removeCondition=(e,t)=>{e.conditions.splice(t,1),this.updateListeners()},this.handleRuleActionTargetChanged=(e,t)=>{e.targetGroupName=t,this.updateListeners()},this.handleRuleActionTypeChanged=(e,t)=>{e.type=t,"forward"===e.type?delete e.redirectActionConfig:"redirect"===e.type&&(e.redirectActionConfig={statusCode:"HTTP_301"},delete e.targetGroupName),this.updateListeners()},this.handleSortEnd=(e,t)=>{t.rules=rn(t.rules,e.oldIndex,e.newIndex),this.updateListeners()},this.configureOidcClient=e=>{qr.show({config:e.authenticateOidcConfig}).then(t=>{e.authenticateOidcConfig=t,this.updateListeners()}).catch(()=>{})},this.configureRedirect=e=>{jr.show({config:e.redirectActionConfig}).then(t=>{e.redirectActionConfig=t,this.updateListeners()}).catch(()=>{})},this.authenticateRuleToggle=(e,t)=>{const a=e.rules[t],n=a&&a.actions||e.defaultActions;if(n){const a=n.findIndex(e=>"authenticate-oidc"===e.type);if(-1!==a)this.removeAuthAction(e,n,a,t);else{const a=(this.removedAuthActions.has(e)?this.removedAuthActions.get(e)[t||-1]:void 0)||{...Yr};n.unshift({...a})}this.updateListeners()}},this.oidcConfigChanged=(e,t)=>{e.authenticateOidcConfig={...t},this.updateListeners()},this.redirectConfigChanged=(e,t)=>{e.redirectActionConfig={...t},this.updateListeners()},this.state={certificates:[],certificateTypes:ca(Cn,"loadBalancers.certificateTypes",["iam","acm"]),oidcConfigs:void 0},this.props.formik.initialValues.listeners.forEach(e=>{"authenticate-oidc"===e.defaultActions[0].type&&this.initialListenersWithDefaultAuth.add(e),e.rules.forEach(e=>{"authenticate-oidc"===e.actions[0].type&&this.initialActionsWithAuth.add(e.actions)})})}getAllTargetGroupsFromListeners(e){const t=Qt(e.map(e=>e.defaultActions)),a=Qt(e.map(e=>e.rules));return t.push(...Qt(a.map(e=>e.actions))),da(t.map(e=>e.targetGroupName))}validate(e){const t={},a=e.targetGroups.map(e=>e.name),n=this.getAllTargetGroupsFromListeners(e.listeners),r=ma(a,n);1===r.length?t.listeners=`Target group ${r[0]} is unused.`:r.length>1&&(t.listeners=`Target groups ${r.join(", ")} are unused.`);const{listeners:l}=e;Yt(l,"port").length<l.length&&(t.listenerPorts="Multiple listeners cannot use the same port.");return e.listeners.find(e=>{const t=!!e.defaultActions.find(e=>"forward"===e.type&&!e.targetGroupName||"authenticate-oidc"===e.type&&!e.authenticateOidcConfig.clientId||"redirect"===e.type&&(!e.redirectActionConfig||!ua(e.redirectActionConfig,e=>e&&""!==e))),a=!!e.rules.find(e=>{const t=!!e.actions.find(e=>"forward"===e.type&&!e.targetGroupName),a=!!e.actions.find(e=>"authenticate-oidc"===e.type&&!e.authenticateOidcConfig.clientId),n=!!e.conditions.find(e=>"http-request-method"===e.field?!e.values.length:e.values.includes(""));return t||a||n});return t||a})&&(t.listeners="Missing fields in rule configuration."),t}componentDidMount(){this.loadCertificates(),this.loadOidcClients()}loadCertificates(){_r.listCertificates().then(e=>{this.setState({certificates:e})})}loadOidcClients(){Zr.getOidcConfigsByApp(this.props.app.name).then(e=>{e&&e.length&&this.props.formik.values.listeners.forEach(t=>{t.defaultActions.forEach(t=>this.attachClientSecret(t,e)),t.rules.forEach(t=>t.actions.forEach(t=>this.attachClientSecret(t,e)))}),this.setState({oidcConfigs:e}),this.updateListeners()}).catch(()=>{})}updateListeners(){this.props.formik.setFieldValue("listeners",this.props.formik.values.listeners)}needsCert(e){return"HTTPS"===e.protocol}showCertificateSelect(e){return"iam"===e.type&&this.state.certificates&&Object.keys(this.state.certificates).length>0}addListenerCertificate(e){e.certificates=e.certificates||[],e.certificates.push({certificateArn:void 0,type:"iam",name:void 0})}removeAuthActions(e){const t=e.defaultActions.findIndex(e=>"authenticate-oidc"===e.type);-1!==t&&this.removeAuthAction(e,e.defaultActions,t,-1),e.rules.forEach((t,a)=>{const n=t.actions.findIndex(e=>"authenticate-oidc"===e.type);-1!==n&&this.removeAuthAction(e,t.actions,n,a)}),this.updateListeners()}reenableAuthActions(e){const t=this.removedAuthActions.has(e)?this.removedAuthActions.get(e):[],a=t[-1];a&&(t[-1]=void 0,e.defaultActions.unshift({...a})),e.rules.forEach((e,a)=>{const n=t[a];t[a]=void 0,n&&e.actions.unshift({...n})})}listenerProtocolChanged(e,t){e.protocol=t,"HTTPS"===e.protocol&&(e.port=443,e.certificates&&0!==e.certificates.length||this.addListenerCertificate(e),this.reenableAuthActions(e)),"HTTP"===e.protocol&&(e.port=80,e.certificates.length=0,this.removeAuthActions(e)),this.updateListeners()}listenerPortChanged(e,t){e.port=Number.parseInt(t,10),this.updateListeners()}certificateTypeChanged(e,t){e.type=t,this.updateListeners()}handleCertificateChanged(e,t){e.name=t,this.updateListeners()}removeListener(e){this.props.formik.values.listeners.splice(e,1),this.updateListeners()}removeAuthActionInternal(e,t,a,n=-1){const r=t.splice(a,1)[0];this.removedAuthActions.has(e)||this.removedAuthActions.set(e,[]),this.removedAuthActions.get(e)[n||-1]=r,this.updateListeners()}removeAuthAction(e,t,a,n=-1){const r=-1===n&&this.initialListenersWithDefaultAuth.has(e),l=n>-1&&this.initialActionsWithAuth.has(t);r||l?x.confirm({header:"Really remove authentication?",buttonText:"Remove Auth",submitMethod:()=>(this.removeAuthActionInternal(e,t,a,n),r&&this.initialListenersWithDefaultAuth.delete(e),l&&this.initialActionsWithAuth.delete(t),Promise.resolve())}):this.removeAuthActionInternal(e,t,a,n)}render(){const{errors:e,values:t}=this.props.formik,{certificates:a,certificateTypes:n,oidcConfigs:r}=this.state;/* @__PURE__ */
|
|
42
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},t.listeners.map((e,l)=>/* @__PURE__ */qt.createElement("div",{key:l,className:"wizard-pod"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row header"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Listen On"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents spread"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Protocol"),/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",style:{width:"80px"},value:e.protocol,onChange:t=>this.listenerProtocolChanged(e,t.target.value)},this.protocols.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e)))),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Port"),/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",type:"text",min:0,value:e.port||"",onChange:t=>this.listenerPortChanged(e,t.target.value),style:{width:"80px"},required:!0}))),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("a",{className:"sm-label clickable",onClick:()=>this.removeListener(l)},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"}))))),this.needsCert(e)&&/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Certificate"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},e.certificates.map((e,r)=>/* @__PURE__ */qt.createElement("div",{key:r,style:{width:"100%",display:"flex",flexDirection:"row"}},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",style:{width:"45px"},value:e.type,onChange:t=>this.certificateTypeChanged(e,t.target.value)},n.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e))),this.showCertificateSelect(e)&&/* @__PURE__ */qt.createElement(Ur,{certificates:a,accountName:t.credentials,currentValue:e.name,app:this.props.app,onCertificateSelect:t=>this.handleCertificateChanged(e,t)}),!this.showCertificateSelect(e)&&/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm no-spel",style:{display:"inline-block"},type:"text",value:e.name,onChange:t=>this.handleCertificateChanged(e,t.target.value),required:!0}))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents",style:{padding:"0"}},/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed rules-table"},/* @__PURE__ */qt.createElement("thead",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("th",{style:{width:"15px",padding:"0"}}),/* @__PURE__ */qt.createElement("th",null,"If"),/* @__PURE__ */qt.createElement("th",{style:{width:"315px"}},"Then"),/* @__PURE__ */qt.createElement("th",{style:{width:"45px"}}))),/* @__PURE__ */qt.createElement(tl,{addCondition:this.addCondition,addRule:this.addRule,authenticateRuleToggle:this.authenticateRuleToggle,distance:10,handleConditionFieldChanged:this.handleConditionFieldChanged,handleConditionValueChanged:this.handleConditionValueChanged,handleHttpRequestMethodChanged:this.handleHttpRequestMethodChanged,handleRuleActionTargetChanged:this.handleRuleActionTargetChanged,handleRuleActionTypeChanged:this.handleRuleActionTypeChanged,listener:e,helperClass:"rule-sortable-helper",removeRule:this.removeRule,removeCondition:this.removeCondition,targetGroups:t.targetGroups,oidcConfigs:r,oidcConfigChanged:this.oidcConfigChanged,redirectConfigChanged:this.redirectConfigChanged,onSortEnd:t=>this.handleSortEnd(t,e),configureOidcClient:this.configureOidcClient,configureRedirect:this.configureRedirect}))))))),e.listenerPorts&&/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-errors"},/* @__PURE__ */qt.createElement(Se,{type:"error",message:e.listenerPorts})),e.listeners&&/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-errors"},/* @__PURE__ */qt.createElement(Se,{type:"error",message:e.listeners})),/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed"},/* @__PURE__ */qt.createElement("tbody",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("button",{type:"button",className:"add-new col-md-12",onClick:this.addListener},/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"})," Add new listener")))))))))}}const Jr=ln(e=>/* @__PURE__ */qt.createElement("tr",{className:"listener-rule"},/* @__PURE__ */qt.createElement("td",{className:"handle"},/* @__PURE__ */qt.createElement(Kr,null)),/* @__PURE__ */qt.createElement("td",null,e.rule.conditions.map((t,a)=>/* @__PURE__ */qt.createElement("div",{key:a,className:"listener-rule-condition"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",value:t.field,onChange:a=>e.handleConditionFieldChanged(t,a.target.value),style:{width:"40%"},required:!0},(1===e.rule.conditions.length||"host-header"===t.field)&&/* @__PURE__ */qt.createElement("option",{value:"host-header"},"Host"),(1===e.rule.conditions.length||"path-pattern"===t.field)&&/* @__PURE__ */qt.createElement("option",{value:"path-pattern"},"Path"),(1===e.rule.conditions.length||"http-request-method"===t.field)&&/* @__PURE__ */qt.createElement("option",{value:"http-request-method"},"Method(s)")),"path-pattern"===t.field&&/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.ruleCondition.path"}),"host-header"===t.field&&/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.ruleCondition.host"}),"http-request-method"!==t.field&&/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"text",value:t.values[0],onChange:a=>e.handleConditionValueChanged(t,a.target.value),maxLength:128,required:!0,style:{width:"63%"}}),"http-request-method"===t.field&&/* @__PURE__ */qt.createElement("div",{className:"col-md-6 checkbox"},["DELETE","GET","PATCH","POST","PUT"].map(a=>/* @__PURE__ */qt.createElement("label",{key:`${a}-checkbox`},/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:t.values.includes(a),onChange:n=>e.handleHttpRequestMethodChanged(t,a,n.target.checked)}),a))),/* @__PURE__ */qt.createElement("span",{className:"remove-condition"},1===a&&/* @__PURE__ */qt.createElement("a",{className:"btn btn-sm btn-link clickable",onClick:()=>e.removeCondition(e.rule,a),style:{padding:"0"}},
|
|
43
|
+
/* @__PURE__ */qt.createElement(_,{value:"Remove Condition"},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"})))))),1===e.rule.conditions.length&&/* @__PURE__ */qt.createElement("div",{className:"add-new-container"},/* @__PURE__ */qt.createElement("button",{type:"button",className:"add-new col-md-12",onClick:()=>e.addCondition(e.rule)},/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"})," Add new condition")),/* @__PURE__ */qt.createElement("span",{style:{minWidth:"15px"}}))),/* @__PURE__ */qt.createElement("td",null,e.rule.actions.map((t,a)=>/* @__PURE__ */qt.createElement(Qr,{key:a,action:t,actionTypeChanged:a=>e.handleRuleActionTypeChanged(t,a),oidcConfigChanged:a=>e.oidcConfigChanged(t,a),redirectConfigChanged:a=>e.redirectConfigChanged(t,a),targetChanged:a=>e.handleRuleActionTargetChanged(t,a),targetGroups:e.targetGroups,oidcConfigs:e.oidcConfigs,configureOidcClient:e.configureOidcClient,configureRedirect:e.configureRedirect}))),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement(el,{ruleIndex:e.ruleIndex,listener:e.listener,authenticateRuleToggle:e.authenticateRuleToggle,removeRule:e.removeRule,actions:e.rule.actions})))),Qr=e=>{var t;if("authenticate-oidc"!==e.action.type){const t=e.action.redirectActionConfig||e.action.redirectConfig;/* @__PURE__ */
|
|
44
44
|
return qt.createElement("div",{className:"horizontal top"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",style:{width:"80px"},value:e.action.type,onChange:t=>e.actionTypeChanged(t.target.value)},
|
|
45
45
|
/* @__PURE__ */qt.createElement("option",{value:"forward"},"forward to"),
|
|
46
46
|
/* @__PURE__ */qt.createElement("option",{value:"redirect"},"redirect to")),"forward"===e.action.type&&/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",value:e.action.targetGroupName,onChange:t=>e.targetChanged(t.target.value),required:!0},
|
|
47
47
|
/* @__PURE__ */qt.createElement("option",{value:""}),da(e.targetGroups.map(e=>e.name)).map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e))),"redirect"===e.action.type&&/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-narrow"},/* @__PURE__ */qt.createElement("dt",null,"Host"),/* @__PURE__ */qt.createElement("dd",null,t.host),/* @__PURE__ */qt.createElement("dt",null,"Path"),/* @__PURE__ */qt.createElement("dd",null,t.path),/* @__PURE__ */qt.createElement("dt",null,"Port"),/* @__PURE__ */qt.createElement("dd",null,t.port),/* @__PURE__ */qt.createElement("dt",null,"Protocol"),/* @__PURE__ */qt.createElement("dd",null,t.protocol),/* @__PURE__ */qt.createElement("dt",null,"Query"),/* @__PURE__ */qt.createElement("dd",null,t.query),/* @__PURE__ */qt.createElement("dt",null,"Status Code"),/* @__PURE__ */qt.createElement("dd",null,t.statusCode),/* @__PURE__ */qt.createElement("dt",null,/* @__PURE__ */qt.createElement("button",{className:"btn btn-link no-padding",type:"button",onClick:()=>e.configureRedirect(e.action)},"Configure..."))))}if("authenticate-oidc"===e.action.type){const a=e.action.authenticateOidcConfig.clientId,n=ca(Cn,"loadBalancers.disableManualOidcDialog",!1)||e.oidcConfigs&&e.oidcConfigs.length>0&&(!a||e.oidcConfigs.find(e=>e.clientId===a)),r=(null==(t=e.oidcConfigs)?void 0:t.length)?e.oidcConfigs.map(e=>/* @__PURE__ */qt.createElement("option",{key:e.clientId},e.clientId)):/* @__PURE__ */qt.createElement("option",{disabled:!0},"No ",we.get("OIDC client")," config found");/* @__PURE__ */
|
|
48
48
|
return qt.createElement("div",{className:"horizontal middle",style:{height:"30px"}},/* @__PURE__ */qt.createElement("span",{style:{whiteSpace:"pre"}},"auth with ",we.get("OIDC client")," "),n&&/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",value:a,onChange:t=>e.oidcConfigChanged(e.oidcConfigs.find(e=>e.clientId===t.target.value)),required:!0},
|
|
49
49
|
/* @__PURE__ */qt.createElement("option",{value:""}),r),!n&&
|
|
50
|
-
/* @__PURE__ */qt.createElement("a",{onClick:()=>e.configureOidcClient(e.action),className:"clickable"},a||"Configure..."),/* @__PURE__ */qt.createElement("span",{style:{whiteSpace:"pre"}},/* @__PURE__ */qt.createElement("em",null," and then")))}return null},
|
|
50
|
+
/* @__PURE__ */qt.createElement("a",{onClick:()=>e.configureOidcClient(e.action),className:"clickable"},a||"Configure..."),/* @__PURE__ */qt.createElement("span",{style:{whiteSpace:"pre"}},/* @__PURE__ */qt.createElement("em",null," and then")))}return null},el=e=>{const t=Boolean(e.actions.find(e=>"authenticate-oidc"===e.type)),a="HTTPS"===e.listener.protocol,n=t?"Remove authentication from rule":"Authenticate rule",r=t?"fas fa-fw fa-lock-open":"fas fa-fw fa-user-lock";/* @__PURE__ */
|
|
51
51
|
return qt.createElement("span",null,a&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("a",{className:"btn btn-sm btn-link clickable",onClick:()=>e.authenticateRuleToggle(e.listener,e.ruleIndex),style:{padding:"0"}},
|
|
52
52
|
/* @__PURE__ */qt.createElement(_,{value:n},/* @__PURE__ */qt.createElement("i",{className:r}))),/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.oidcAuthentication"})),void 0!==e.ruleIndex&&e.ruleIndex>=0&&e.removeRule&&/* @__PURE__ */qt.createElement("a",{className:"btn btn-sm btn-link clickable",onClick:()=>e.removeRule(e.listener,e.ruleIndex),style:{padding:"0"}},
|
|
53
|
-
/* @__PURE__ */qt.createElement(_,{value:"Remove Rule"},/* @__PURE__ */qt.createElement("i",{className:"far fa-fw fa-trash-alt"}))))},
|
|
53
|
+
/* @__PURE__ */qt.createElement(_,{value:"Remove Rule"},/* @__PURE__ */qt.createElement("i",{className:"far fa-fw fa-trash-alt"}))))},tl=sn(e=>/* @__PURE__ */qt.createElement("tbody",null,/* @__PURE__ */qt.createElement("tr",{className:"not-sortable"},/* @__PURE__ */qt.createElement("td",null),/* @__PURE__ */qt.createElement("td",null,"Default"),/* @__PURE__ */qt.createElement("td",null,e.listener.defaultActions.map((t,a)=>/* @__PURE__ */qt.createElement(Qr,{key:a,action:t,actionTypeChanged:a=>e.handleRuleActionTypeChanged(t,a),targetChanged:a=>e.handleRuleActionTargetChanged(t,a),targetGroups:e.targetGroups,oidcConfigs:e.oidcConfigs,oidcConfigChanged:a=>e.oidcConfigChanged(t,a),redirectConfigChanged:a=>e.redirectConfigChanged(t,a),configureOidcClient:e.configureOidcClient,configureRedirect:e.configureRedirect}))),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement(el,{listener:e.listener,actions:e.listener.defaultActions,authenticateRuleToggle:e.authenticateRuleToggle}))),e.listener.rules.sort((e,t)=>e.priority-t.priority).map((t,a)=>/* @__PURE__ */qt.createElement(Jr,{key:a,rule:t,addCondition:e.addCondition,handleConditionFieldChanged:e.handleConditionFieldChanged,handleConditionValueChanged:e.handleConditionValueChanged,handleHttpRequestMethodChanged:e.handleHttpRequestMethodChanged,handleRuleActionTargetChanged:e.handleRuleActionTargetChanged,handleRuleActionTypeChanged:e.handleRuleActionTypeChanged,oidcConfigChanged:e.oidcConfigChanged,redirectConfigChanged:e.redirectConfigChanged,removeCondition:e.removeCondition,authenticateRuleToggle:e.authenticateRuleToggle,removeRule:e.removeRule,targetGroups:e.targetGroups,oidcConfigs:e.oidcConfigs,listener:e.listener,index:a,ruleIndex:a,configureOidcClient:e.configureOidcClient,configureRedirect:e.configureRedirect})),/* @__PURE__ */qt.createElement("tr",{className:"not-sortable"},/* @__PURE__ */qt.createElement("td",{colSpan:5},/* @__PURE__ */qt.createElement("button",{type:"button",className:"add-new col-md-12",onClick:()=>e.addRule(e.listener)},/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"})," Add new rule")))))),al=(e,t,a)=>n=>ca(e,[t,a],[]).includes(n.toLowerCase())?`There is already a target group in ${t}:${a} with that name.`:null,nl=e=>t=>t.length<32-e?null:"Target group names are automatically prefixed with their application name and cannot exceed 32 characters in length.";let rl=class extends qt.Component{constructor(e){super(e),this.protocols=["HTTP","HTTPS"],this.targetTypes=["instance","ip","lambda"],this.destroy$=new Aa,this.addTargetGroup=()=>{const{setFieldValue:e,values:t}=this.props.formik,a=t.targetGroups.length;t.targetGroups.push({name:"targetgroup"+(a?`${a}`:""),protocol:"HTTP",port:7001,targetType:"instance",healthCheckProtocol:"HTTP",healthCheckPort:"7001",healthCheckPath:"/healthcheck",healthCheckTimeout:5,healthCheckInterval:10,healthyThreshold:10,unhealthyThreshold:2,attributes:{deregistrationDelay:300,stickinessEnabled:!1,stickinessType:"lb_cookie",stickinessDuration:8400}}),e("targetGroups",t.targetGroups)};const t=e.isNew?0:e.formik.initialValues.targetGroups.length;this.state={existingTargetGroupNames:{},oldTargetGroupCount:t}}validate(e){const t=da(Qt(ra(oa(e.targetGroups,"name"),e=>e.length>1)).map(e=>e.name)),a=new m(e),{arrayForEach:n}=a;return a.field("targetGroups").withValidators(n((a,n)=>{var r;a.field("name","Name").withValidators(al(this.state.existingTargetGroupNames,e.credentials,e.region),nl(this.props.app.name.length),ke.valueUnique(t,"There is already a target group in this load balancer with the same name.")),a.field("healthCheckInterval","Health Check Interval").withValidators((r=n,e=>"TCP"!==r.healthCheckProtocol||"TCP"===r.healthCheckProtocol&&(10===Number.parseInt(e,10)||30===Number.parseInt(e,10))?null:"TCP health checks only support 10s and 30s intervals"),ke.checkBetween("healthCheckInterval",5,300)),a.field("healthyThreshold","Healthy Threshold").withValidators(ke.checkBetween("healthyThreshold",2,10)),a.field("unhealthyThreshold","Unhealthy Threshold").spelAware().withValidators(ke.checkBetween("unhealthyThreshold",2,10)),a.field("healthCheckTimeout","Timeout").withValidators((e=>t=>{const a=pa(t)?t:Number.parseInt(t,10),{protocol:n,healthCheckProtocol:r}=e;if("TCP"===n||"TLS"===n){if("HTTP"===r&&6!==a)return"HTTP health check timeouts for TCP/TLS target groups must be 6s";if(("HTTPS"===r||"TLS"===r)&&10!==a)return"HTTPS/TLS health check timeouts for TCP/TLS target groups must be 10s"}return null})(n),ke.checkBetween("healthCheckTimeout",2,120)),"lambda"!==n.targetType&&(a.field("protocol","Protocol").required(),a.field("healthCheckPath","Health Check Path").required(),a.field("healthCheckProtocol","Health Check Protocol").required(),a.field("name","Name").required(),a.field("healthyThreshold","Healthy Threshold").required().spelAware().withValidators(e=>Te(e)),a.field("unhealthyThreshold","Unhealthy Threshold").required().spelAware().withValidators(e=>Te(e)),a.field("healthCheckInterval","Health Check Interval").required().spelAware().withValidators(e=>Te(e)),a.field("healthCheckPort","Health Check Port").required().spelAware().withValidators(e=>"traffic-port"===e?null:Te(e)),a.field("port","Port").required().spelAware().withValidators(e=>Te(e)),a.field("healthyThreshold","Healthy Threshold").required().spelAware().withValidators(e=>Te(e),ke.checkBetween("healthyThreshold",2,10)),a.field("unhealthyThreshold","Unhealthy Threshold").required().spelAware().withValidators(e=>Te(e),ke.checkBetween("unhealthyThreshold",2,10)))})),a.validateForm()}removeAppName(e){return e.replace(`${this.props.app.name}-`,"")}updateLoadBalancerNames(e){const{app:t,loadBalancer:a}=e,n={};Ga(t.getDataSource("loadBalancers").refresh(!0)).pipe($a(this.destroy$)).subscribe(()=>{t.getDataSource("loadBalancers").data.forEach(e=>{"classic"!==e.loadBalancerType&&(a&&e.name===a.name||e.targetGroups.forEach(t=>{n[e.account]=n[e.account]||{},n[e.account][e.region]=n[e.account][e.region]||[],n[e.account][e.region].push(this.removeAppName(t.name))}))}),this.setState({existingTargetGroupNames:n},()=>this.props.formik.validateForm())})}targetGroupFieldChanged(e,t,a){const{setFieldValue:n,values:r}=this.props.formik,l=r.targetGroups[e];"targetType"===t&&"lambda"===a&&delete l.port,ha(l,t,a),n("targetGroups",r.targetGroups)}removeTargetGroup(e){const{setFieldValue:t,values:a}=this.props.formik,{oldTargetGroupCount:n}=this.state;a.targetGroups.splice(e,1),e<n&&this.setState({oldTargetGroupCount:n-1}),t("targetGroups",a.targetGroups)}componentDidMount(){this.updateLoadBalancerNames(this.props)}componentWillUnmount(){this.destroy$.next(),this.destroy$.complete()}render(){const{app:e}=this.props,{errors:t,values:a}=this.props.formik,{oldTargetGroupCount:n}=this.state,r=this.protocols.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e)),l=this.targetTypes.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e));/* @__PURE__ */
|
|
54
54
|
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},a.targetGroups.map((a,s)=>{const i=t.targetGroups&&t.targetGroups[s]||{},o=("TCP"===a.protocol||"TLS"===a.protocol)&&"HTTP"===a.healthCheckProtocol,d=("TCP"===a.protocol||"TLS"===a.protocol)&&"HTTPS"===a.healthCheckProtocol;/* @__PURE__ */
|
|
55
55
|
return qt.createElement("div",{key:s,className:"wizard-pod"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row header"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Group Name"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"group-name-prefix"},e.name,"-"),/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm target-group-name",type:"text",value:a.name,onChange:e=>this.targetGroupFieldChanged(s,"name",e.target.value),required:!0,disabled:s<n}),/* @__PURE__ */qt.createElement("a",{className:"sm-label clickable",onClick:()=>this.removeTargetGroup(s)},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"}))),i.name&&/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-errors"},/* @__PURE__ */qt.createElement(Se,{type:"error",message:i.name})))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.targetType"})," ",/* @__PURE__ */qt.createElement("span",null,"Target Type ")),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",value:a.targetType,onChange:e=>this.targetGroupFieldChanged(s,"targetType",e.target.value),disabled:s<n},l))))),"lambda"!==a.targetType&&/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Backend Connection"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Protocol "),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.protocol"})," ",/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",value:a.protocol,onChange:e=>this.targetGroupFieldChanged(s,"protocol",e.target.value),disabled:s<n},r)),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Port "),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.port"})," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",value:a.port,onChange:e=>this.targetGroupFieldChanged(s,"port",e.target.value),type:"text",required:!0,disabled:s<n}))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Healthcheck"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},"lambda"!==a.targetType&&/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Protocol "),"TCP"===a.healthCheckProtocol&&/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.healthCheckProtocol"})," ",/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",value:a.healthCheckProtocol,onChange:e=>this.targetGroupFieldChanged(s,"healthCheckProtocol",e.target.value)},r)),"lambda"!==a.targetType&&/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Port "),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.attributes.healthCheckPort.trafficPort"})," ",/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",style:{width:"90px"},value:"traffic-port"===a.healthCheckPort?"traffic-port":"manual",onChange:e=>this.targetGroupFieldChanged(s,"healthCheckPort","traffic-port"===e.target.value?"traffic-port":"")},
|
|
56
56
|
/* @__PURE__ */qt.createElement("option",{value:"traffic-port"},"Traffic Port"),
|
|
57
|
-
/* @__PURE__ */qt.createElement("option",{value:"manual"},"Manual"))," ",/* @__PURE__ */qt.createElement(Ie,{className:"form-control input-sm inline-number",error:i.healthCheckPort,style:{visibility:"traffic-port"===a.healthCheckPort?"hidden":"inherit"},name:"healthCheckPort",required:!0,value:a.healthCheckPort,onChange:e=>this.targetGroupFieldChanged(s,"healthCheckPort",e.target.value)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Path "),/* @__PURE__ */qt.createElement(Ie,{error:i.healthCheckPath,name:"healthCheckPath",required:!0,value:a.healthCheckPath,onChange:e=>this.targetGroupFieldChanged(s,"healthCheckPath",e.target.value)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Timeout "),(o||d)&&/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.healthCheckTimeout"}),/* @__PURE__ */qt.createElement(Pe,{error:i.healthCheckTimeout,disabled:o||d,required:!0,value:o?6:d?10:a.healthCheckTimeout,min:2,max:120,onChange:e=>this.targetGroupFieldChanged(s,"healthCheckTimeout",e)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Interval "),/* @__PURE__ */qt.createElement(Pe,{error:i.healthCheckInterval,required:!0,value:a.healthCheckInterval,min:5,max:300,onChange:e=>this.targetGroupFieldChanged(s,"healthCheckInterval",e)}))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Healthcheck Threshold"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Healthy "),/* @__PURE__ */qt.createElement(Pe,{error:i.healthyThreshold,value:a.healthyThreshold,min:2,max:10,onChange:e=>this.targetGroupFieldChanged(s,"healthyThreshold",e)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Unhealthy "),/* @__PURE__ */qt.createElement(Pe,{error:i.unhealthyThreshold,required:!0,value:a.unhealthyThreshold,min:2,max:10,onChange:e=>this.targetGroupFieldChanged(s,"unhealthyThreshold",e)}))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Attributes"),"lambda"!==a.targetType?/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Dereg. Delay"),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.attributes.deregistrationDelay"})," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",type:"text",value:a.attributes.deregistrationDelay,onChange:e=>this.targetGroupFieldChanged(s,"attributes.deregistrationDelay",e.target.value)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",{className:"checkbox-inline",style:{paddingTop:"2px"}},/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:a.attributes.stickinessEnabled,onChange:e=>this.targetGroupFieldChanged(s,"attributes.stickinessEnabled",e.target.checked)})," ",/* @__PURE__ */qt.createElement("label",null,"Sticky"),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.attributes.stickinessEnabled"}))),a.attributes.stickinessEnabled&&/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Duration "),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.attributes.stickinessDuration"})," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",value:a.attributes.stickinessDuration,onChange:e=>this.targetGroupFieldChanged(s,"attributes.stickinessDuration",e.target.value),type:"text"})))):/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",{className:"checkbox-inline",style:{paddingTop:"2px"}},/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:a.attributes.multiValueHeadersEnabled,onChange:e=>this.targetGroupFieldChanged(s,"attributes.multiValueHeadersEnabled",e.target.checked)})," ",/* @__PURE__ */qt.createElement("label",null,"Enable Multi Value Headers"))))))}),/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed"},/* @__PURE__ */qt.createElement("tbody",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("button",{type:"button",className:"add-new col-md-12",onClick:this.addTargetGroup},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"})," Add new target group"))))))))}};class
|
|
57
|
+
/* @__PURE__ */qt.createElement("option",{value:"manual"},"Manual"))," ",/* @__PURE__ */qt.createElement(Ie,{className:"form-control input-sm inline-number",error:i.healthCheckPort,style:{visibility:"traffic-port"===a.healthCheckPort?"hidden":"inherit"},name:"healthCheckPort",required:!0,value:a.healthCheckPort,onChange:e=>this.targetGroupFieldChanged(s,"healthCheckPort",e.target.value)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Path "),/* @__PURE__ */qt.createElement(Ie,{error:i.healthCheckPath,name:"healthCheckPath",required:!0,value:a.healthCheckPath,onChange:e=>this.targetGroupFieldChanged(s,"healthCheckPath",e.target.value)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Timeout "),(o||d)&&/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.healthCheckTimeout"}),/* @__PURE__ */qt.createElement(Pe,{error:i.healthCheckTimeout,disabled:o||d,required:!0,value:o?6:d?10:a.healthCheckTimeout,min:2,max:120,onChange:e=>this.targetGroupFieldChanged(s,"healthCheckTimeout",e)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Interval "),/* @__PURE__ */qt.createElement(Pe,{error:i.healthCheckInterval,required:!0,value:a.healthCheckInterval,min:5,max:300,onChange:e=>this.targetGroupFieldChanged(s,"healthCheckInterval",e)}))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Healthcheck Threshold"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Healthy "),/* @__PURE__ */qt.createElement(Pe,{error:i.healthyThreshold,value:a.healthyThreshold,min:2,max:10,onChange:e=>this.targetGroupFieldChanged(s,"healthyThreshold",e)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Unhealthy "),/* @__PURE__ */qt.createElement(Pe,{error:i.unhealthyThreshold,required:!0,value:a.unhealthyThreshold,min:2,max:10,onChange:e=>this.targetGroupFieldChanged(s,"unhealthyThreshold",e)}))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Attributes"),"lambda"!==a.targetType?/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Dereg. Delay"),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.attributes.deregistrationDelay"})," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",type:"text",value:a.attributes.deregistrationDelay,onChange:e=>this.targetGroupFieldChanged(s,"attributes.deregistrationDelay",e.target.value)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",{className:"checkbox-inline",style:{paddingTop:"2px"}},/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:a.attributes.stickinessEnabled,onChange:e=>this.targetGroupFieldChanged(s,"attributes.stickinessEnabled",e.target.checked)})," ",/* @__PURE__ */qt.createElement("label",null,"Sticky"),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.attributes.stickinessEnabled"}))),a.attributes.stickinessEnabled&&/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Duration "),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.attributes.stickinessDuration"})," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",value:a.attributes.stickinessDuration,onChange:e=>this.targetGroupFieldChanged(s,"attributes.stickinessDuration",e.target.value),type:"text"})))):/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",{className:"checkbox-inline",style:{paddingTop:"2px"}},/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:a.attributes.multiValueHeadersEnabled,onChange:e=>this.targetGroupFieldChanged(s,"attributes.multiValueHeadersEnabled",e.target.checked)})," ",/* @__PURE__ */qt.createElement("label",null,"Enable Multi Value Headers"))))))}),/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed"},/* @__PURE__ */qt.createElement("tbody",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("button",{type:"button",className:"add-new col-md-12",onClick:this.addTargetGroup},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"})," Add new target group"))))))))}};class ll extends qt.Component{constructor(e){super(e),this.handleUsePreferredZonesChanged=e=>{const t="true"===e.target.value;this.setState({usePreferredZones:t}),t&&this.setDefaultZones(t,this.props)},this.handleSelectedZonesChanged=e=>{this.props.onChange([...e])},this.state={defaultZones:[],usePreferredZones:e.usePreferredZones||!e.selectedZones||0===e.selectedZones.length},this.setDefaultZones(this.state.usePreferredZones,e)}componentWillReceiveProps(e){e.region===this.props.region&&e.credentials===this.props.credentials||this.setDefaultZones(this.state.usePreferredZones,e)}setDefaultZones(e,t){const{credentials:a,region:n}=t;h.getAvailabilityZonesForAccountAndRegion("aws",a,n).then(a=>{this.setState({defaultZones:a}),e&&a&&t.onChange(a.slice())})}render(){const{region:e,allZones:t,selectedZones:a}=this.props,{defaultZones:n,usePreferredZones:r}=this.state;/* @__PURE__ */
|
|
58
58
|
return qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Availability Zones"),e&&/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement("p",{className:"form-control-static"},"Automatic Availability Zone Balancing:"),/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",value:r?"true":"false",onChange:this.handleUsePreferredZonesChanged},
|
|
59
59
|
/* @__PURE__ */qt.createElement("option",{value:"true"},"Enabled"),
|
|
60
|
-
/* @__PURE__ */qt.createElement("option",{value:"false"},"Manual")),/* @__PURE__ */qt.createElement("br",null),r&&/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",{className:"form-control-static"},"Server group will be available in:"),/* @__PURE__ */qt.createElement("ul",null,n.map(e=>/* @__PURE__ */qt.createElement("li",{key:e},e)))),!r&&/* @__PURE__ */qt.createElement("div",null,"Restrict server group instances to:",/* @__PURE__ */qt.createElement(Ae,{stringOptions:t,value:a,onChange:e=>this.handleSelectedZonesChanged(e.target.value)}))))}}function
|
|
61
|
-
return Ht.createElement("div",{className:"form-group"},/* @__PURE__ */Ht.createElement("div",{className:`col-md-${i} sm-label-right`},"VPC Subnet ",/* @__PURE__ */Ht.createElement(c,{id:s})),/* @__PURE__ */Ht.createElement("div",{className:"col-md-7"},d?/* @__PURE__ */Ht.createElement(
|
|
62
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal"},!n&&/* @__PURE__ */qt.createElement("div",{style:{height:"200px"}},/* @__PURE__ */qt.createElement(me,{size:"medium"})),n&&/* @__PURE__ */qt.createElement("div",{className:"modal-body"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:o},/* @__PURE__ */qt.createElement("strong",null,"Your load balancer will be named: "),/* @__PURE__ */qt.createElement("span",null,a.name),/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.name"}),/* @__PURE__ */qt.createElement(cn,{type:"text",style:{display:"none"},className:"form-control input-sm no-spel",name:"name"}),t.name&&/* @__PURE__ */qt.createElement(Se,{type:"error",message:t.name}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Account"),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(Fe,{value:a.credentials,onChange:e=>this.accountUpdated(e.target.value),accounts:n,provider:"aws"}))),/* @__PURE__ */qt.createElement(Me,{labelColumns:3,component:a,field:"region",account:a.credentials,onChange:this.regionUpdated,regions:s}),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Stack ",/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.stack"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-3"},/* @__PURE__ */qt.createElement("input",{type:"text",className:"form-control input-sm no-spel "+(t.stack?"invalid":""),value:a.stack,name:"stack",onChange:this.stackChanged})),/* @__PURE__ */qt.createElement("div",{className:"col-md-6 form-inline"},/* @__PURE__ */qt.createElement("label",{className:"sm-label-right"},/* @__PURE__ */qt.createElement("span",null,"Detail ",/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.detail"})," ")),/* @__PURE__ */qt.createElement("input",{type:"text",className:"form-control input-sm no-spel "+(t.detail?"invalid":""),value:a.detail,name:"detail",onChange:this.detailChanged})),t.stack&&/* @__PURE__ */qt.createElement("div",{className:"col-md-7 col-md-offset-3"},/* @__PURE__ */qt.createElement(Se,{type:"error",message:t.stack})),t.detail&&/* @__PURE__ */qt.createElement("div",{className:"col-md-7 col-md-offset-3"},/* @__PURE__ */qt.createElement(Se,{type:"error",message:t.detail}))),/* @__PURE__ */qt.createElement(
|
|
63
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",null,r.length>0&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"}),"The following ",j.get("firewalls")," could not be found in the selected account/region/VPC and were removed:"),/* @__PURE__ */qt.createElement("ul",null,r.map(e=>/* @__PURE__ */qt.createElement("li",{key:e},e))),/* @__PURE__ */qt.createElement("p",{className:"text-right"},/* @__PURE__ */qt.createElement("a",{className:"btn btn-sm btn-default dirty-flag-dismiss clickable",onClick:this.clearRemoved},"Okay"))))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},j.get("Firewalls")),/* @__PURE__ */qt.createElement("div",{className:"col-md-9"},!a&&/* @__PURE__ */qt.createElement("div",{style:{paddingTop:"13px"}},/* @__PURE__ */qt.createElement(me,{size:"small"})),a&&/* @__PURE__ */qt.createElement(dn,{multi:!0,value:e,options:t,onChange:this.handleSecurityGroupsChanged,clearable:!1}))),/* @__PURE__ */qt.createElement("div",{className:"form-group small",style:{marginTop:"20px"}},/* @__PURE__ */qt.createElement("div",{className:"col-md-9 col-md-offset-3"},/* @__PURE__ */qt.createElement("p",null,n&&/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:"fa fa-sync-alt fa-spin"})," "),j.get("Firewalls"),!n&&/* @__PURE__ */qt.createElement("span",null," last refreshed ",V(l)),n&&/* @__PURE__ */qt.createElement("span",null," refreshing...")),/* @__PURE__ */qt.createElement("p",null,"If you're not finding a ",j.get("firewall")," that was recently added,"," ",/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:()=>this.refresh$.next()},"click here")," ","to refresh the list.")))))}};
|
|
64
|
-
return qt.createElement(qt.Fragment,null,i&&/* @__PURE__ */qt.createElement(A,{label:"Location",wizard:s,order:l(),render:({innerRef:l})=>/* @__PURE__ */qt.createElement(
|
|
65
|
-
return qt.createElement("div",{className:"form-group AmazonLoadBalancer-AdvancedSettings"},/* @__PURE__ */qt.createElement(u,{name:"healthTimeout",label:"Timeout",required:!0,help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.healthTimeout"}),input:t=>/* @__PURE__ */qt.createElement(E,{...t,min:0,max:e.healthInterval}),validate:t(e.healthInterval,"Timeout must be less than the health interval.")}),/* @__PURE__ */qt.createElement(u,{name:"healthInterval",label:"Interval",required:!0,help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.healthInterval"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0})}),/* @__PURE__ */qt.createElement(u,{name:"healthyThreshold",label:"Healthy Threshold",required:!0,help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.healthyThreshold"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0})}),/* @__PURE__ */qt.createElement(u,{name:"unhealthyThreshold",label:"Unhealthy Threshold",required:!0,help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.unhealthyThreshold"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0})}),/* @__PURE__ */qt.createElement(u,{name:"idleTimeout",label:"Idle Timeout",required:!0,help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.idleTimeout"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0})}),/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("p",null,"Additional configuration options (cross-zone load balancing, session stickiness, access logs) are available via the AWS console.")))}}class
|
|
66
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"col-md-4 sm-label-right"},"Ping"),/* @__PURE__ */qt.createElement("div",{className:"col-md-8"},/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed"},/* @__PURE__ */qt.createElement("thead",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("th",{style:{width:"35%"}},"Protocol"),/* @__PURE__ */qt.createElement("th",{style:{width:"30%"}},"Port"),/* @__PURE__ */qt.createElement("th",null,this.requiresHealthCheckPath()&&/* @__PURE__ */qt.createElement("span",null,"Path")))),/* @__PURE__ */qt.createElement("tbody",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement(u,{name:"healthCheckProtocol",required:!0,input:e=>/* @__PURE__ */qt.createElement(Ce,{...e,options:["HTTP","HTTPS","SSL","TCP"]})})),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement(u,{name:"healthCheckPort",required:!0,input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:1,max:65534})})),/* @__PURE__ */qt.createElement("td",null,this.requiresHealthCheckPath()&&/* @__PURE__ */qt.createElement(u,{name:"healthCheckPath",input:e=>/* @__PURE__ */qt.createElement(p,{...e}),required:!0,onChange:this.healthCheckPathChanged})))))))}}class
|
|
67
|
-
return qt.createElement(
|
|
60
|
+
/* @__PURE__ */qt.createElement("option",{value:"false"},"Manual")),/* @__PURE__ */qt.createElement("br",null),r&&/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",{className:"form-control-static"},"Server group will be available in:"),/* @__PURE__ */qt.createElement("ul",null,n.map(e=>/* @__PURE__ */qt.createElement("li",{key:e},e)))),!r&&/* @__PURE__ */qt.createElement("div",null,"Restrict server group instances to:",/* @__PURE__ */qt.createElement(Ae,{stringOptions:t,value:a,onChange:e=>this.handleSelectedZonesChanged(e.target.value)}))))}}function sl(e){const{application:t,credentials:a,defaultSubnetTypes:n,hideClassic:r,name:l,onChange:s,readOnly:i,region:o,subnets:c,value:d,...m}=e,u=Ge(c),p=qt.useMemo(()=>{const e=r||function(e,t,a){const{classicLaunchLockout:n,classicLaunchAllowlist:r}=Cn,l=Number(ca(a,"attributes.createTs",0))>(n||0),s=!!r&&r.some(a=>a.region===e&&a.credentials===t);return l||!s}(o,a,t);return function(e,t){const a=(e,t)=>e.label.localeCompare(t.label),n=e=>({value:e.purpose,label:e.label}),r=t?[]:[{label:"None (EC2 Classic)",value:""}],l=e.filter(e=>!e.deprecated).sort(a).map(n),s=e.filter(e=>e.deprecated).sort(a).map(n);return s.length&&s.unshift({label:"-----------",value:"",disabled:!0}),r.concat(l).concat(s)}(c,e)},[r,o,a,t,u]),h=function(e,t=[]){for(const a of t){const t=e.find(e=>a===e.purpose);if(t)return t}}(c,n)||c[0],g=xe().current;return qt.useEffect(()=>{const e=p.some(e=>e.value===d);h&&(!e||"FIRST_RENDER"!==g)&&s(De({name:l,value:h.purpose}))},[p]),i?/* @__PURE__ */qt.createElement("p",{className:"form-control-static"},e.value||"None (EC2 Classic)"):/* @__PURE__ */qt.createElement(Ce,{options:p,value:d,onChange:s,...m})}class il extends Ht.Component{constructor(){super(...arguments),this.handleChange=e=>{const{component:t,onChange:a,field:n}=this.props;t[n]=e.target.value,a()}}render(){var e,t,a;const{component:n,defaultSubnetTypes:r,field:l,helpKey:s,labelColumns:i,recommendedSubnetTypes:o,region:d,showSubnetWarning:m,...u}=this.props,p=n[l],h=null!=(t=null!=o?o:null==(e=Cn.serverGroups)?void 0:e.recommendedSubnets)?t:[],g=null!=r?r:[Cn.defaults.subnetType],v=h.some(e=>p&&p.includes(e)),f=null==(a=Cn.serverGroups)?void 0:a.subnetWarning;/* @__PURE__ */
|
|
61
|
+
return Ht.createElement("div",{className:"form-group"},/* @__PURE__ */Ht.createElement("div",{className:`col-md-${i} sm-label-right`},"VPC Subnet ",/* @__PURE__ */Ht.createElement(c,{id:s})),/* @__PURE__ */Ht.createElement("div",{className:"col-md-7"},d?/* @__PURE__ */Ht.createElement(sl,{...u,inputClassName:"form-control input-sm",credentials:n.credentials,defaultSubnetTypes:g,region:d,value:p,onChange:this.handleChange}):"(Select an account)",m&&!v&&Boolean(f)&&/* @__PURE__ */Ht.createElement("div",{className:"alert alert-warning sp-margin-s-top horizontal center"},/* @__PURE__ */Ht.createElement("i",{className:"fa fa-exclamation-triangle sp-margin-s-top"}),/* @__PURE__ */Ht.createElement("div",{className:"sp-margin-s-left"},/* @__PURE__ */Ht.createElement(Be,{message:f,style:{display:"inline-block",marginLeft:"2px"}})))))}}class ol extends qt.Component{constructor(){super(...arguments),this.state={accounts:void 0,availabilityZones:[],existingLoadBalancerNames:[],hideInternalFlag:!1,internalFlagToggled:!1,regions:[],subnets:[]},this.props$=new Aa,this.destroy$=new Aa,this.internalFlagChanged=e=>{this.setState({internalFlagToggled:!0}),this.props.formik.handleChange(e)},this.handleSubnetUpdated=e=>{this.props.formik.setFieldValue("subnetType",e)},this.accountUpdated=e=>{this.props.formik.setFieldValue("credentials",e)},this.regionUpdated=e=>{this.props.formik.setFieldValue("region",e)},this.stackChanged=e=>{this.props.formik.setFieldValue("stack",e.target.value)},this.detailChanged=e=>{this.props.formik.setFieldValue("detail",e.target.value)},this.handleAvailabilityZonesChanged=e=>{this.props.formik.setFieldValue("regionZones",e)}}validate(e){const t={};return this.state.existingLoadBalancerNames.includes(e.name)&&(t.name=`There is already a load balancer in ${e.credentials}:${e.region} with that name.`),e.name&&e.name.length>32&&(t.name="Load balancer names cannot exceed 32 characters in length"),e.stack&&!e.stack.match(/^[a-zA-Z0-9]*$/)&&(t.stack="Stack can only contain letters and numbers."),e.detail&&!e.detail.match(/^[a-zA-Z0-9-]*$/)&&(t.detail="Detail can only contain letters, numbers, and dashes."),t}buildName(){const{values:e}=this.props.formik;if(ea(e.moniker)){const t=pe.parseLoadBalancerName(e.name);e.stack=t.stack,e.detail=t.freeFormDetails}else e.stack=e.moniker.stack,e.detail=e.moniker.detail;delete e.name}shouldHideInternalFlag(){return!!(Cn&&Cn.loadBalancers&&Cn.loadBalancers.inferInternalFlagFromSubnet)&&(delete this.props.formik.values.isInternal,!0)}componentDidMount(){this.setState({hideInternalFlag:this.shouldHideInternalFlag()}),this.props.loadBalancer&&this.props.isNew&&this.buildName();const e=this.props$.pipe(Ma(e=>e.formik.values)),t=this.props$.pipe(Ma(e=>e.app.name),Ra()),a={account$:e.pipe(Ma(e=>e.credentials),Ra()),region$:e.pipe(Ma(e=>e.region),Ra()),subnetPurpose$:e.pipe(Ma(e=>e.subnetType),Ra()),stack$:e.pipe(Ma(e=>e.stack),Ra()),detail$:e.pipe(Ma(e=>e.detail),Ra())},n=Ga(h.listAccounts("aws")).pipe(La(1)),r=xa([a.account$,n]).pipe(za(([e,t])=>h.getRegionsForAccount(e)),La(1)),l=this.props.app.getDataSource("loadBalancers").data$,s=xa([l,a.account$,a.region$]).pipe(Ma(([e,t,a])=>e.filter(e=>e.account===t&&e.region===a).map(e=>e.name)),La(1)),i=xa([a.account$,a.region$]).pipe(za(([e,t])=>this.getAvailableSubnets(e,t)),Ma(e=>this.makeSubnetOptions(e)),La(1)),o=xa([i,a.subnetPurpose$]).pipe(Ma(([e,t])=>e&&e.find(e=>e.purpose===t))),c=o.pipe(Ma(e=>e?da(e.availabilityZones).sort():[])),d=a.region$.pipe(Oa(r),Ma(([e,t])=>t.find(t=>t.name===e)),Ma(e=>e?e.availabilityZones:[])),m=xa([t,a.stack$,a.detail$]).pipe(Ma(([e,t,a])=>({app:e,stack:t,detail:a,cluster:pe.getClusterName(e,t,a)})));r.pipe(Oa(a.region$),$a(this.destroy$)).subscribe(([e,t])=>{e.some(e=>e.name===t)||this.props.formik.setFieldValue("region",e[0]&&e[0].name)}),d.pipe($a(this.destroy$)).subscribe(e=>{this.props.formik.setFieldValue("regionZones",e)}),o.pipe($a(this.destroy$)).subscribe(e=>{this.props.formik.setFieldValue("vpcId",e&&e.vpcIds[0]),this.props.formik.setFieldValue("subnetType",e&&e.purpose),!this.state.hideInternalFlag&&!this.state.internalFlagToggled&&e&&e.purpose&&this.props.formik.setFieldValue("isInternal",e.purpose.includes("internal"))}),m.pipe($a(this.destroy$)).subscribe(e=>{this.props.formik.setFieldValue("moniker",e),this.props.formik.setFieldValue("name",e.cluster)}),xa([n,r,c,s,i]).pipe($a(this.destroy$)).subscribe(([e,t,a,n,r])=>this.setState({accounts:e,regions:t,availabilityZones:a,existingLoadBalancerNames:n,subnets:r}))}componentDidUpdate(){this.props$.next(this.props)}componentWillUnmount(){this.destroy$.next()}getAvailableSubnets(e,t){return N.listSubnets().then(a=>la(a).filter({account:e,region:t}).reject({target:"ec2"}).reject({purpose:null}).value())}makeSubnetOptions(e){const t=oa(e,e=>e.purpose);return Object.keys(t).map(e=>t[e]).map(e=>(e=>{const{purpose:t,label:a,deprecated:n}=e[0];return{purpose:t,label:a,deprecated:n,vpcIds:da(e.map(e=>e.vpcId)),availabilityZones:da(e.map(e=>e.availabilityZone))}})(e))}render(){const{app:e}=this.props,{errors:t,values:a}=this.props.formik,{accounts:n,availabilityZones:r,hideInternalFlag:l,regions:s,subnets:i}=this.state,o=Pa({"col-md-12":!0,well:!0,"alert-danger":!!t.name,"alert-info":!t.name});/* @__PURE__ */
|
|
62
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal"},!n&&/* @__PURE__ */qt.createElement("div",{style:{height:"200px"}},/* @__PURE__ */qt.createElement(me,{size:"medium"})),n&&/* @__PURE__ */qt.createElement("div",{className:"modal-body"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:o},/* @__PURE__ */qt.createElement("strong",null,"Your load balancer will be named: "),/* @__PURE__ */qt.createElement("span",null,a.name),/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.name"}),/* @__PURE__ */qt.createElement(cn,{type:"text",style:{display:"none"},className:"form-control input-sm no-spel",name:"name"}),t.name&&/* @__PURE__ */qt.createElement(Se,{type:"error",message:t.name}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Account"),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(Fe,{value:a.credentials,onChange:e=>this.accountUpdated(e.target.value),accounts:n,provider:"aws"}))),/* @__PURE__ */qt.createElement(Me,{labelColumns:3,component:a,field:"region",account:a.credentials,onChange:this.regionUpdated,regions:s}),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Stack ",/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.stack"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-3"},/* @__PURE__ */qt.createElement("input",{type:"text",className:"form-control input-sm no-spel "+(t.stack?"invalid":""),value:a.stack,name:"stack",onChange:this.stackChanged})),/* @__PURE__ */qt.createElement("div",{className:"col-md-6 form-inline"},/* @__PURE__ */qt.createElement("label",{className:"sm-label-right"},/* @__PURE__ */qt.createElement("span",null,"Detail ",/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.detail"})," ")),/* @__PURE__ */qt.createElement("input",{type:"text",className:"form-control input-sm no-spel "+(t.detail?"invalid":""),value:a.detail,name:"detail",onChange:this.detailChanged})),t.stack&&/* @__PURE__ */qt.createElement("div",{className:"col-md-7 col-md-offset-3"},/* @__PURE__ */qt.createElement(Se,{type:"error",message:t.stack})),t.detail&&/* @__PURE__ */qt.createElement("div",{className:"col-md-7 col-md-offset-3"},/* @__PURE__ */qt.createElement(Se,{type:"error",message:t.detail}))),/* @__PURE__ */qt.createElement(ll,{credentials:a.credentials,region:a.region,onChange:this.handleAvailabilityZonesChanged,selectedZones:a.regionZones,allZones:r}),/* @__PURE__ */qt.createElement(il,{labelColumns:3,helpKey:"aws.loadBalancer.subnet",component:a,field:"subnetType",region:a.region,subnets:i,application:e,onChange:()=>this.handleSubnetUpdated(a.subnetType)}),a.vpcId&&!l&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Internal")," ",/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.internal"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement(cn,{name:"isInternal",onChange:this.internalFlagChanged,render:({field:{value:e,...t}})=>/* @__PURE__ */qt.createElement("input",{type:"checkbox",...t,checked:!!e})}),"Create an internal load balancer")))))}}const cl=class extends qt.Component{constructor(e){super(e),this.destroy$=new Aa,this.props$=new Aa,this.refresh$=new Aa,this.getRefreshTime=()=>{var e;return(null==(e=Re.get("securityGroups"))?void 0:e.getStats().ageMax)||0},this.clearRemoved=()=>{this.setState({removed:[]},()=>this.props.formik.validateForm())},this.handleSecurityGroupsChanged=e=>{this.props.formik.setFieldValue("securityGroups",e.map(e=>e.value))};const t=ca(Cn,"defaultSecurityGroups",[]);this.state={availableSecurityGroups:[],defaultSecurityGroups:t,loaded:!1,refreshing:!1,removed:[],refreshTime:this.getRefreshTime()}}validate(){const{removed:e}=this.state;if(e&&e.length){return{securityGroupsRemoved:`${j.get("Firewalls")} removed: ${e.join(", ")}`}}return{}}updateRemovedSecurityGroups(e,t){const{isNew:a}=this.props,{defaultSecurityGroups:n,removed:r}=this.state,l=e=>t.find(t=>t.name===e||t.id===e),[s,i]=ga((()=>{const t=e.concat(r).sort();return da((a?n:[]).concat(t))})(),e=>!!l(e)),o=s.map(e=>l(e).name);aa(e,o)||this.props.formik.setFieldValue("securityGroups",o),this.setState({removed:i},()=>this.props.formik.validateForm())}onRefreshStart(){this.props.onLoadingChanged(!0),this.setState({refreshing:!0})}onRefreshComplete(){this.props.onLoadingChanged(!1);const e=this.getRefreshTime();this.setState({refreshing:!1,loaded:!0,refreshTime:e})}componentDidMount(){const e=this.refresh$.pipe(Ua(()=>this.onRefreshStart()),za(()=>this.context.services.cacheInitializer.refreshCache("securityGroups")),Va(()=>this.context.services.securityGroupReader.getAllSecurityGroups()),Ua(()=>this.onRefreshComplete())),t=this.props$.pipe(Ma(e=>e.formik.values)),a=t.pipe(Ma(e=>e.vpcId),Ra());xa([a,e]).pipe(Oa(t),Ma(([[e,t],a])=>{const n=t[a.credentials]||{};return(n.aws&&n.aws[a.region]||[]).filter(t=>e===t.vpcId).sort()})).pipe(Oa(t),$a(this.destroy$)).subscribe(([e,t])=>{this.setState({availableSecurityGroups:e.map(e=>({label:`${e.name} (${e.id})`,value:e.name}))}),this.updateRemovedSecurityGroups(t.securityGroups,e)}),this.refresh$.next()}componentDidUpdate(){this.props$.next(this.props)}componentWillUnmount(){this.destroy$.next(),this.destroy$.complete()}render(){const{securityGroups:e}=this.props.formik.values,{availableSecurityGroups:t,loaded:a,refreshing:n,removed:r,refreshTime:l}=this.state;/* @__PURE__ */
|
|
63
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",null,r.length>0&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"}),"The following ",j.get("firewalls")," could not be found in the selected account/region/VPC and were removed:"),/* @__PURE__ */qt.createElement("ul",null,r.map(e=>/* @__PURE__ */qt.createElement("li",{key:e},e))),/* @__PURE__ */qt.createElement("p",{className:"text-right"},/* @__PURE__ */qt.createElement("a",{className:"btn btn-sm btn-default dirty-flag-dismiss clickable",onClick:this.clearRemoved},"Okay"))))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},j.get("Firewalls")),/* @__PURE__ */qt.createElement("div",{className:"col-md-9"},!a&&/* @__PURE__ */qt.createElement("div",{style:{paddingTop:"13px"}},/* @__PURE__ */qt.createElement(me,{size:"small"})),a&&/* @__PURE__ */qt.createElement(dn,{multi:!0,value:e,options:t,onChange:this.handleSecurityGroupsChanged,clearable:!1}))),/* @__PURE__ */qt.createElement("div",{className:"form-group small",style:{marginTop:"20px"}},/* @__PURE__ */qt.createElement("div",{className:"col-md-9 col-md-offset-3"},/* @__PURE__ */qt.createElement("p",null,n&&/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:"fa fa-sync-alt fa-spin"})," "),j.get("Firewalls"),!n&&/* @__PURE__ */qt.createElement("span",null," last refreshed ",V(l)),n&&/* @__PURE__ */qt.createElement("span",null," refreshing...")),/* @__PURE__ */qt.createElement("p",null,"If you're not finding a ",j.get("firewall")," that was recently added,"," ",/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:()=>this.refresh$.next()},"click here")," ","to refresh the list.")))))}};cl.contextType=C;let dl=cl;const ml=class extends qt.Component{constructor(e){super(e),this._isUnmounted=!1,this.certificateTypes=ca(Cn,"loadBalancers.certificateTypes",["iam","acm"]),this.submit=e=>{const{app:t,forPipelineConfig:a,closeModal:n}=this.props,{isNew:r}=this.state,l=r?"Create":"Update",s=Xt(e);if(s.listeners.forEach(e=>{e.defaultActions.forEach(e=>{e.authenticateOidcConfig&&(e.authenticateOidcActionConfig=e.authenticateOidcConfig,delete e.authenticateOidcConfig)}),e.rules.forEach(e=>e.actions.forEach(e=>{e.authenticateOidcConfig&&(e.authenticateOidcActionConfig=e.authenticateOidcConfig,delete e.authenticateOidcConfig)}))}),a)this.formatListeners(s).then(()=>{this.setIpAddressType(s),n&&n(s)});else{const e=new w({application:t,title:(r?"Creating":"Updating")+" your load balancer",onDismiss:()=>this.props.dismissModal(),onTaskComplete:()=>this.onTaskComplete(s)});e.submit(()=>this.formatListeners(s).then(()=>(this.formatCommand(s),Le.upsertLoadBalancer(s,t,l)))),this.setState({taskMonitor:e})}};const t=e.command?e.command:e.loadBalancer?Rr.convertApplicationLoadBalancerForEditing(e.loadBalancer):Rr.constructNewApplicationLoadBalancerTemplate(e.app);this.state={includeSecurityGroups:!!t.vpcId,isNew:!e.loadBalancer,loadBalancerCommand:t,taskMonitor:null}}static show(e,t){return I.show(pl,e,{dialogClassName:"wizard-modal modal-lg"},t)}certificateIdAsARN(e,t,a,n){if(t&&(0!==t.indexOf("arn:aws:iam::")||0!==t.indexOf("arn:aws:acm:"))){if("iam"===n)return`arn:aws:iam::${e}:server-certificate/${t}`;if("acm"===n)return`arn:aws:acm:${a}:${e}:certificate/${t}`}return t}formatListeners(e){return h.getAccountDetails(e.credentials).then(t=>{e.listeners.forEach(a=>{"HTTP"===a.protocol&&(delete a.sslPolicy,a.certificates=[]),a.certificates.forEach(a=>{a.certificateArn=this.certificateIdAsARN(t.accountId,a.name,e.region,a.type||this.certificateTypes[0])})})})}setAvailabilityZones(e){const t={};t[e.region]=e.regionZones||[],e.availabilityZones=t}addAppName(e){return`${this.props.app.name}-${e}`}manageTargetGroupNames(e){(e.targetGroups||[]).forEach(e=>{e.name=this.addAppName(e.name)}),(e.listeners||[]).forEach(e=>{e.defaultActions.forEach(e=>{e.targetGroupName&&(e.targetGroupName=this.addAppName(e.targetGroupName))}),(e.rules||[]).forEach(e=>{e.actions.forEach(e=>{e.targetGroupName&&(e.targetGroupName=this.addAppName(e.targetGroupName))})})})}manageRules(e){e.listeners.forEach(e=>{e.rules.forEach((e,t)=>{e.priority=t+1,e.conditions=e.conditions.filter(e=>"http-request-method"!==e.field?e.values[0].length>0:e.values.length>0)})})}setIpAddressType(e){e.ipAddressType=e.dualstack?"dualstack":"ipv4",delete e.dualstack}formatCommand(e){this.setAvailabilityZones(e),this.manageTargetGroupNames(e),this.manageRules(e),this.setIpAddressType(e)}onApplicationRefresh(e){var t;if(null==(t=this.refreshUnsubscribe)||t.call(this),this.refreshUnsubscribe=void 0,this._isUnmounted)return;this.props.dismissModal(),this.setState({taskMonitor:void 0});const a={name:e.name,accountId:e.credentials,region:e.region,vpcId:e.vpcId,provider:"aws"};this.props.stateService.includes("**.loadBalancerDetails")?this.props.stateService.go("^.loadBalancerDetails",a):this.props.stateService.go(".loadBalancerDetails",a)}componentWillUnmount(){var e;this._isUnmounted=!0,null==(e=this.refreshUnsubscribe)||e.call(this),this.refreshUnsubscribe=void 0}onTaskComplete(e){var t;null==(t=this.refreshUnsubscribe)||t.call(this),this.refreshUnsubscribe=void 0,this.refreshUnsubscribe=this.props.app.loadBalancers.onNextRefresh(()=>this.onApplicationRefresh(e)),this.props.app.loadBalancers.refresh()}render(){const{app:e,dismissModal:t,forPipelineConfig:a,loadBalancer:n}=this.props,{isNew:r,loadBalancerCommand:l,taskMonitor:s}=this.state;let i=a?"Configure Application Load Balancer":"Create New Application Load Balancer";return r||(i=`Edit ${l.name}: ${l.region}: ${l.credentials}`),/* @__PURE__ */qt.createElement(P,{heading:i,initialValues:l,taskMonitor:s,dismissModal:t,closeModal:this.submit,submitButtonLabel:a?r?"Add":"Done":r?"Create":"Update",render:({formik:t,nextIdx:l,wizard:s})=>{const i=r||a,o=!!t.values.vpcId;/* @__PURE__ */
|
|
64
|
+
return qt.createElement(qt.Fragment,null,i&&/* @__PURE__ */qt.createElement(A,{label:"Location",wizard:s,order:l(),render:({innerRef:l})=>/* @__PURE__ */qt.createElement(ol,{app:e,forPipelineConfig:a,formik:t,isNew:r,loadBalancer:n,ref:l})}),o&&/* @__PURE__ */qt.createElement(A,{label:j.get("Firewalls"),wizard:s,order:l(),render:({innerRef:e,onLoadingChanged:a})=>/* @__PURE__ */qt.createElement(dl,{formik:t,isNew:r,onLoadingChanged:a,ref:e})}),/* @__PURE__ */qt.createElement(A,{label:"Target Groups",wizard:s,order:l(),render:({innerRef:a})=>/* @__PURE__ */qt.createElement(rl,{ref:a,app:e,formik:t,isNew:r,loadBalancer:n})}),/* @__PURE__ */qt.createElement(A,{label:"Listeners",wizard:s,order:l(),render:({innerRef:a})=>/* @__PURE__ */qt.createElement(Xr,{ref:a,app:e,formik:t})}),/* @__PURE__ */qt.createElement(A,{label:"Advanced Settings",wizard:s,order:l(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(Vr,{ref:e})}))}})}};ml.defaultProps={closeModal:T,dismissModal:T};let ul=ml;const pl=Object.assign(G(ul),{show:ul.show});class hl extends qt.Component{render(){const{values:e}=this.props.formik,{maxValue:t}=ke;/* @__PURE__ */
|
|
65
|
+
return qt.createElement("div",{className:"form-group AmazonLoadBalancer-AdvancedSettings"},/* @__PURE__ */qt.createElement(u,{name:"healthTimeout",label:"Timeout",required:!0,help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.healthTimeout"}),input:t=>/* @__PURE__ */qt.createElement(E,{...t,min:0,max:e.healthInterval}),validate:t(e.healthInterval,"Timeout must be less than the health interval.")}),/* @__PURE__ */qt.createElement(u,{name:"healthInterval",label:"Interval",required:!0,help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.healthInterval"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0})}),/* @__PURE__ */qt.createElement(u,{name:"healthyThreshold",label:"Healthy Threshold",required:!0,help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.healthyThreshold"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0})}),/* @__PURE__ */qt.createElement(u,{name:"unhealthyThreshold",label:"Unhealthy Threshold",required:!0,help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.unhealthyThreshold"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0})}),/* @__PURE__ */qt.createElement(u,{name:"idleTimeout",label:"Idle Timeout",required:!0,help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.idleTimeout"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0})}),/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("p",null,"Additional configuration options (cross-zone load balancing, session stickiness, access logs) are available via the AWS console.")))}}class gl extends qt.Component{constructor(){super(...arguments),this.healthCheckPathChanged=e=>{e&&0!==e.indexOf("/")&&this.props.formik.setFieldValue("healthCheckPath",`/${e}`)}}requiresHealthCheckPath(){const{values:e}=this.props.formik;return e.healthCheckProtocol&&0===e.healthCheckProtocol.indexOf("HTTP")}render(){/* @__PURE__ */
|
|
66
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"col-md-4 sm-label-right"},"Ping"),/* @__PURE__ */qt.createElement("div",{className:"col-md-8"},/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed"},/* @__PURE__ */qt.createElement("thead",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("th",{style:{width:"35%"}},"Protocol"),/* @__PURE__ */qt.createElement("th",{style:{width:"30%"}},"Port"),/* @__PURE__ */qt.createElement("th",null,this.requiresHealthCheckPath()&&/* @__PURE__ */qt.createElement("span",null,"Path")))),/* @__PURE__ */qt.createElement("tbody",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement(u,{name:"healthCheckProtocol",required:!0,input:e=>/* @__PURE__ */qt.createElement(Ce,{...e,options:["HTTP","HTTPS","SSL","TCP"]})})),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement(u,{name:"healthCheckPort",required:!0,input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:1,max:65534})})),/* @__PURE__ */qt.createElement("td",null,this.requiresHealthCheckPath()&&/* @__PURE__ */qt.createElement(u,{name:"healthCheckPath",input:e=>/* @__PURE__ */qt.createElement(p,{...e}),required:!0,onChange:this.healthCheckPathChanged})))))))}}class vl extends qt.Component{constructor(){super(...arguments),this.protocols=["HTTP","HTTPS","TCP","SSL"],this.secureProtocols=["HTTPS","SSL"],this.certificateTypes=ca(Cn,"loadBalancers.certificateTypes",["iam","acm"]),this.state={certificates:[]},this.addListener=()=>{this.props.formik.values.listeners.push({internalProtocol:"HTTP",externalProtocol:"HTTP",externalPort:80,internalPort:80}),this.updateListeners()}}componentDidMount(){this.loadCertificates()}loadCertificates(){_r.listCertificates().then(e=>{this.setState({certificates:e})})}updateListeners(){const{values:e,setFieldValue:t}=this.props.formik;t("listeners",e.listeners)}showCertificateSelect(e){return"iam"===e.sslCertificateType&&this.state.certificates&&Object.keys(this.state.certificates).length>0}listenerExternalProtocolChanged(e,t){e.externalProtocol=t,this.secureProtocols.includes(t)&&(e.externalPort=443,this.certificateTypes.length>=1&&(e.sslCertificateType=this.certificateTypes[0])),"HTTP"===t&&(e.externalPort=80),this.updateListeners()}listenerInternalProtocolChanged(e,t){e.internalProtocol=t,this.updateListeners()}listenerExternalPortChanged(e,t){e.externalPort=Number.parseInt(t,10),this.updateListeners()}listenerInternalPortChanged(e,t){e.internalPort=Number.parseInt(t,10),this.updateListeners()}listenerCertificateTypeChanged(e,t){e.sslCertificateType=t,this.updateListeners()}handleListenerCertificateChanged(e,t){e.sslCertificateName=t,this.updateListeners()}removeListener(e){this.props.formik.values.listeners.splice(e,1),this.updateListeners()}renderCertificateSelector(e){if(this.secureProtocols.includes(e.externalProtocol)){if(this.showCertificateSelect(e)){const{values:t}=this.props.formik,{certificates:a}=this.state;/* @__PURE__ */
|
|
67
|
+
return qt.createElement(Ur,{certificates:a,accountName:t.credentials,currentValue:e.sslCertificateName,app:this.props.app,onCertificateSelect:t=>this.handleListenerCertificateChanged(e,t)})}/* @__PURE__ */
|
|
68
68
|
return qt.createElement("input",{className:"input-sm",style:{width:"100%",marginLeft:"10px"},required:!0,onChange:t=>this.handleListenerCertificateChanged(e,t.target.value),value:e.sslCertificateName})}return null}render(){const{values:e}=this.props.formik;/* @__PURE__ */
|
|
69
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal create-classic-load-balancer-wizard-listeners"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed"},/* @__PURE__ */qt.createElement("thead",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("th",null,"External Protocol"),/* @__PURE__ */qt.createElement("th",null,"External Port"),/* @__PURE__ */qt.createElement("th",null),/* @__PURE__ */qt.createElement("th",null,"Internal Protocol"),/* @__PURE__ */qt.createElement("th",null,"Internal Port"),/* @__PURE__ */qt.createElement("th",null))),/* @__PURE__ */qt.createElement("tbody",null,e.listeners.map((e,t)=>/* @__PURE__ */qt.createElement(qt.Fragment,{key:t},/* @__PURE__ */qt.createElement("tr",{key:t+"-main"},/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",value:e.externalProtocol,onChange:t=>this.listenerExternalProtocolChanged(e,t.target.value)},this.protocols.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e)))),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",min:"0",value:e.externalPort,onChange:t=>this.listenerExternalPortChanged(e,t.target.value),required:!0})),/* @__PURE__ */qt.createElement("td",{className:"small",style:{paddingTop:"10px"}},"→"),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",value:e.internalProtocol,onChange:t=>this.listenerInternalProtocolChanged(e,t.target.value)},this.protocols.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e)))),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",min:"0",value:e.internalPort,onChange:t=>this.listenerInternalPortChanged(e,t.target.value),required:!0})),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("a",{className:"sm-label clickable",onClick:()=>this.removeListener(t)},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"})))),this.secureProtocols.includes(e.externalProtocol)&&/* @__PURE__ */qt.createElement("tr",{key:t+"-ssl"},/* @__PURE__ */qt.createElement("td",{colSpan:5,style:{borderTopWidth:0}},/* @__PURE__ */qt.createElement("div",{className:"horizontal space-between"},/* @__PURE__ */qt.createElement("div",{className:"sm-label-right"},"Certificate"),this.certificateTypes.length>1&&/* @__PURE__ */qt.createElement("select",{style:{width:"45px",marginLeft:"10px"},className:"form-control input-sm",value:e.sslCertificateType,onChange:t=>this.listenerCertificateTypeChanged(e,t.target.value)},this.certificateTypes.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e))),this.renderCertificateSelector(e))))))),/* @__PURE__ */qt.createElement("tfoot",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("td",{colSpan:5},/* @__PURE__ */qt.createElement("button",{className:"add-new col-md-12",onClick:this.addListener,type:"button"},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"}),/* @__PURE__ */qt.createElement("span",null," Add new port mapping")))))))))}}const
|
|
70
|
-
return qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Certificate"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},e.map((e,a)=>/* @__PURE__ */qt.createElement("div",{key:a,style:{width:"100%",display:"flex",flexDirection:"row"}},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",style:{width:"45px"},value:e.type,onChange:t=>function(e,t){e.type=t,l()}(e,t.target.value)},r.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e))),i(e)&&/* @__PURE__ */qt.createElement(
|
|
71
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},t.listeners.map((e,r)=>/* @__PURE__ */qt.createElement("div",{key:r,className:"wizard-pod"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row header"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Listen On"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents spread"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Protocol"),/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",style:{width:"80px"},value:e.protocol,onChange:t=>this.listenerProtocolChanged(e,t.target.value)},this.protocols.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e)))),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Port"),/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",type:"text",min:0,value:e.port||"",onChange:t=>this.listenerPortChanged(e,t.target.value),style:{width:"80px"},required:!0}))),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("a",{className:"sm-label clickable",onClick:()=>this.removeListener(r)},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"}))))),/* @__PURE__ */qt.createElement("div",null,"TLS"===e.protocol&&/* @__PURE__ */qt.createElement(
|
|
72
|
-
/* @__PURE__ */qt.createElement("option",{value:""}),da(t.targetGroups.map(e=>e.name)).map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e)))),/* @__PURE__ */qt.createElement("td",null))))))))),e.listenerPorts&&/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-errors"},/* @__PURE__ */qt.createElement(Se,{type:"error",message:e.listenerPorts})),e.listeners&&/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-errors"},/* @__PURE__ */qt.createElement(Se,{type:"error",message:e.listeners})),/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed"},/* @__PURE__ */qt.createElement("tbody",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("button",{type:"button",className:"add-new col-md-12",onClick:this.addListener},/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"})," Add new listener")))))))))}}class
|
|
69
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal create-classic-load-balancer-wizard-listeners"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed"},/* @__PURE__ */qt.createElement("thead",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("th",null,"External Protocol"),/* @__PURE__ */qt.createElement("th",null,"External Port"),/* @__PURE__ */qt.createElement("th",null),/* @__PURE__ */qt.createElement("th",null,"Internal Protocol"),/* @__PURE__ */qt.createElement("th",null,"Internal Port"),/* @__PURE__ */qt.createElement("th",null))),/* @__PURE__ */qt.createElement("tbody",null,e.listeners.map((e,t)=>/* @__PURE__ */qt.createElement(qt.Fragment,{key:t},/* @__PURE__ */qt.createElement("tr",{key:t+"-main"},/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",value:e.externalProtocol,onChange:t=>this.listenerExternalProtocolChanged(e,t.target.value)},this.protocols.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e)))),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",min:"0",value:e.externalPort,onChange:t=>this.listenerExternalPortChanged(e,t.target.value),required:!0})),/* @__PURE__ */qt.createElement("td",{className:"small",style:{paddingTop:"10px"}},"→"),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",value:e.internalProtocol,onChange:t=>this.listenerInternalProtocolChanged(e,t.target.value)},this.protocols.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e)))),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",min:"0",value:e.internalPort,onChange:t=>this.listenerInternalPortChanged(e,t.target.value),required:!0})),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("a",{className:"sm-label clickable",onClick:()=>this.removeListener(t)},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"})))),this.secureProtocols.includes(e.externalProtocol)&&/* @__PURE__ */qt.createElement("tr",{key:t+"-ssl"},/* @__PURE__ */qt.createElement("td",{colSpan:5,style:{borderTopWidth:0}},/* @__PURE__ */qt.createElement("div",{className:"horizontal space-between"},/* @__PURE__ */qt.createElement("div",{className:"sm-label-right"},"Certificate"),this.certificateTypes.length>1&&/* @__PURE__ */qt.createElement("select",{style:{width:"45px",marginLeft:"10px"},className:"form-control input-sm",value:e.sslCertificateType,onChange:t=>this.listenerCertificateTypeChanged(e,t.target.value)},this.certificateTypes.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e))),this.renderCertificateSelector(e))))))),/* @__PURE__ */qt.createElement("tfoot",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("td",{colSpan:5},/* @__PURE__ */qt.createElement("button",{className:"add-new col-md-12",onClick:this.addListener,type:"button"},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"}),/* @__PURE__ */qt.createElement("span",null," Add new port mapping")))))))))}}const fl=class extends qt.Component{constructor(e){super(e),this._isUnmounted=!1,this.certificateTypes=ca(Cn,"loadBalancers.certificateTypes",["iam","acm"]),this.submit=e=>{const{app:t,forPipelineConfig:a,closeModal:n}=this.props,{isNew:r}=this.state,l=r?"Create":"Update",s=Xt(e);if(a)this.formatListeners(s).then(()=>{n&&n(s)});else{const e=new w({application:t,title:(r?"Creating":"Updating")+" your load balancer",onDismiss:()=>this.props.dismissModal(),onTaskComplete:()=>this.onTaskComplete(s)});e.submit(()=>this.formatListeners(s).then(()=>(this.formatCommand(s),Le.upsertLoadBalancer(s,t,l)))),this.setState({taskMonitor:e})}},this.validate=e=>({});const t=e.command?e.command:e.loadBalancer?Rr.convertClassicLoadBalancerForEditing(e.loadBalancer):Rr.constructNewClassicLoadBalancerTemplate(e.app);this.state={isNew:!e.loadBalancer,loadBalancerCommand:t,taskMonitor:null}}static show(e,t){return I.show(yl,e,{dialogClassName:"wizard-modal modal-lg"},t)}certificateIdAsARN(e,t,a,n){if(t&&(0!==t.indexOf("arn:aws:iam::")||0!==t.indexOf("arn:aws:acm:"))){if("iam"===n)return`arn:aws:iam::${e}:server-certificate/${t}`;if("acm"===n)return`arn:aws:acm:${a}:${e}:certificate/${t}`}return t}formatListeners(e){return h.getAccountDetails(e.credentials).then(t=>{e.listeners.forEach(a=>{a.sslCertificateId=this.certificateIdAsARN(t.accountId,a.sslCertificateName,e.region,a.sslCertificateType||this.certificateTypes[0])})})}clearSecurityGroupsIfNotInVpc(e){e.vpcId||e.subnetType||(e.securityGroups=null)}addHealthCheckToCommand(e){let t=null;const a=e.healthCheckProtocol||"";t=a.startsWith("HTTP")?`${a}:${e.healthCheckPort}${e.healthCheckPath}`:`${a}:${e.healthCheckPort}`,e.healthCheck=t}setAvailabilityZones(e){const t={};t[e.region]=e.regionZones||[],e.availabilityZones=t}formatCommand(e){this.setAvailabilityZones(e),this.clearSecurityGroupsIfNotInVpc(e),this.addHealthCheckToCommand(e)}onApplicationRefresh(e){var t;if(null==(t=this.refreshUnsubscribe)||t.call(this),this.refreshUnsubscribe=void 0,this._isUnmounted)return;this.props.dismissModal(),this.setState({taskMonitor:void 0});const a={name:e.name,accountId:e.credentials,region:e.region,vpcId:e.vpcId,provider:"aws"};this.props.stateService.includes("**.loadBalancerDetails")?this.props.stateService.go("^.loadBalancerDetails",a):this.props.stateService.go(".loadBalancerDetails",a)}componentWillUnmount(){var e;this._isUnmounted=!0,null==(e=this.refreshUnsubscribe)||e.call(this),this.refreshUnsubscribe=void 0}onTaskComplete(e){var t;null==(t=this.refreshUnsubscribe)||t.call(this),this.refreshUnsubscribe=void 0,this.refreshUnsubscribe=this.props.app.loadBalancers.onNextRefresh(()=>this.onApplicationRefresh(e)),this.props.app.loadBalancers.refresh()}render(){const{app:e,dismissModal:t,forPipelineConfig:a,loadBalancer:n}=this.props,{isNew:r,loadBalancerCommand:l,taskMonitor:s}=this.state,i=r||a;let o=a?"Configure Classic Load Balancer":"Create New Classic Load Balancer";return r||(o=`Edit ${l.name}: ${l.region}: ${l.credentials}`),/* @__PURE__ */qt.createElement(P,{heading:o,initialValues:l,taskMonitor:s,dismissModal:t,closeModal:this.submit,submitButtonLabel:a?r?"Add":"Done":r?"Create":"Update",validate:this.validate,render:({formik:t,nextIdx:l,wizard:s})=>/* @__PURE__ */qt.createElement(qt.Fragment,null,i&&/* @__PURE__ */qt.createElement(A,{label:"Location",wizard:s,order:l(),render:({innerRef:l})=>/* @__PURE__ */qt.createElement(ol,{app:e,formik:t,isNew:r,forPipelineConfig:a,loadBalancer:n,ref:l})}),!!t.values.vpcId&&/* @__PURE__ */qt.createElement(A,{label:j.get("Firewall"),wizard:s,order:l(),render:({innerRef:e,onLoadingChanged:a})=>/* @__PURE__ */qt.createElement(dl,{formik:t,isNew:r,onLoadingChanged:a,ref:e})}),/* @__PURE__ */qt.createElement(A,{label:"Listeners",wizard:s,order:l(),render:({innerRef:a})=>/* @__PURE__ */qt.createElement(vl,{ref:a,formik:t,app:e})}),/* @__PURE__ */qt.createElement(A,{label:"Health Check",wizard:s,order:l(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(gl,{ref:e,formik:t})}),/* @__PURE__ */qt.createElement(A,{label:"Advanced Settings",wizard:s,order:l(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(hl,{ref:e,formik:t})}))})}};fl.defaultProps={closeModal:T,dismissModal:T};let El=fl;const yl=Object.assign(G(El),{show:El.show}),bl=qt.forwardRef((e,t)=>/* @__PURE__ */qt.createElement("div",{ref:t},/* @__PURE__ */qt.createElement(u,{name:"deletionProtection",label:"Protection",help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.deletionProtection"}),input:e=>/* @__PURE__ */qt.createElement(v,{...e,text:"Enable deletion protection"})}),/* @__PURE__ */qt.createElement(u,{name:"loadBalancingCrossZone",label:"Cross-Zone Load Balancing",help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.loadBalancingCrossZone"}),input:e=>/* @__PURE__ */qt.createElement(v,{...e,text:"Distribute traffic across zones"})}),e.showDualstack&&/* @__PURE__ */qt.createElement(u,{name:"dualstack",label:"Dualstack",help:/* @__PURE__ */qt.createElement(c,{id:"loadBalancer.advancedSettings.nlbIpAddressType"}),input:e=>/* @__PURE__ */qt.createElement(v,{...e,text:"Assign Ipv4 and IPv6"})})));function Cl({availableCertificates:e,certificates:t,formik:a,app:n,certificateTypes:r}){function l(){a.setFieldValue("listeners",a.values.listeners)}function s(e,t){e.name=t,l()}function i(e){return"iam"===e.type&&t&&Object.keys(t).length>0}const{values:o}=a;/* @__PURE__ */
|
|
70
|
+
return qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Certificate"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},e.map((e,a)=>/* @__PURE__ */qt.createElement("div",{key:a,style:{width:"100%",display:"flex",flexDirection:"row"}},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",style:{width:"45px"},value:e.type,onChange:t=>function(e,t){e.type=t,l()}(e,t.target.value)},r.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e))),i(e)&&/* @__PURE__ */qt.createElement(Ur,{certificates:t,accountName:o.credentials,currentValue:e.name,app:n,onCertificateSelect:t=>s(e,t)}),!i(e)&&/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm no-spel",style:{display:"inline-block"},type:"text",value:e.name,onChange:t=>s(e,t.target.value),required:!0})))))}class Nl extends qt.Component{constructor(e){super(e),this.protocols=["TCP","UDP","TLS"],this.removedAuthActions=/* @__PURE__ */new Map,this.addListener=()=>{this.props.formik.values.listeners.push({certificates:[],protocol:"TCP",port:80,defaultActions:[{type:"forward",targetGroupName:""}],rules:[]}),this.updateListeners()},this.handleDefaultTargetChanged=(e,t)=>{e.defaultActions[0].targetGroupName=t,this.updateListeners()},this.state={certificates:[],certificateTypes:ca(Cn,"loadBalancers.certificateTypes",["iam","acm"]),oidcConfigs:void 0}}getAllTargetGroupsFromListeners(e){const t=Qt(e.map(e=>e.defaultActions)),a=Qt(e.map(e=>e.rules));return t.push(...Qt(a.map(e=>e.actions))),da(t.map(e=>e.targetGroupName))}validate(e){const t={},a=e.targetGroups.map(e=>e.name),n=this.getAllTargetGroupsFromListeners(e.listeners),r=ma(a,n);1===r.length?t.listeners=`Target group ${r[0]} is unused.`:r.length>1&&(t.listeners=`Target groups ${r.join(", ")} are unused.`);const{listeners:l}=e;return Yt(l,"port").length<l.length&&(t.listenerPorts="Multiple listeners cannot use the same port."),t}updateListeners(){this.props.formik.setFieldValue("listeners",this.props.formik.values.listeners)}componentDidMount(){this.loadCertificates()}addListenerCertificate(e){e.certificates=e.certificates||[],e.certificates.push({certificateArn:void 0,type:"iam",name:void 0})}loadCertificates(){_r.listCertificates().then(e=>{this.setState({certificates:e})})}listenerProtocolChanged(e,t){e.protocol=t,"TCP"===e.protocol?e.port=80:"UDP"===e.protocol?e.port=53:"TLS"===e.protocol&&(e.port=443,e.certificates&&0!==e.certificates.length||this.addListenerCertificate(e),this.reenableAuthActions(e)),this.updateListeners()}reenableAuthActions(e){const t=this.removedAuthActions.has(e)?this.removedAuthActions.get(e):[],a=t[-1];a&&(t[-1]=void 0,e.defaultActions.unshift({...a})),e.rules.forEach((e,a)=>{const n=t[a];t[a]=void 0,n&&e.actions.unshift({...n})})}listenerPortChanged(e,t){e.port=Number.parseInt(t,10),this.updateListeners()}removeListener(e){this.props.formik.values.listeners.splice(e,1),this.updateListeners()}render(){const{errors:e,values:t}=this.props.formik,{certificates:a,certificateTypes:n}=this.state;/* @__PURE__ */
|
|
71
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},t.listeners.map((e,r)=>/* @__PURE__ */qt.createElement("div",{key:r,className:"wizard-pod"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row header"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Listen On"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents spread"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Protocol"),/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",style:{width:"80px"},value:e.protocol,onChange:t=>this.listenerProtocolChanged(e,t.target.value)},this.protocols.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e)))),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Port"),/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",type:"text",min:0,value:e.port||"",onChange:t=>this.listenerPortChanged(e,t.target.value),style:{width:"80px"},required:!0}))),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("a",{className:"sm-label clickable",onClick:()=>this.removeListener(r)},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"}))))),/* @__PURE__ */qt.createElement("div",null,"TLS"===e.protocol&&/* @__PURE__ */qt.createElement(Cl,{availableCertificates:e.certificates,formik:this.props.formik,app:this.props.app,certificateTypes:n,certificates:a})),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title",style:{height:"30px"}},"Rules"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents",style:{padding:"0"}},/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed rules-table"},/* @__PURE__ */qt.createElement("thead",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("th",{style:{width:"10px",padding:"0"}}),/* @__PURE__ */qt.createElement("th",{style:{width:"226px"}},"If"),/* @__PURE__ */qt.createElement("th",{style:{width:"75px"}},"Then"),/* @__PURE__ */qt.createElement("th",null,"Target"),/* @__PURE__ */qt.createElement("th",{style:{width:"30px"}}))),/* @__PURE__ */qt.createElement("tbody",null,/* @__PURE__ */qt.createElement("tr",{className:"not-sortable"},/* @__PURE__ */qt.createElement("td",null),/* @__PURE__ */qt.createElement("td",null,"Default"),/* @__PURE__ */qt.createElement("td",null,"forward to"),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",value:e.defaultActions[0].targetGroupName,onChange:t=>this.handleDefaultTargetChanged(e,t.target.value),required:!0},
|
|
72
|
+
/* @__PURE__ */qt.createElement("option",{value:""}),da(t.targetGroups.map(e=>e.name)).map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e)))),/* @__PURE__ */qt.createElement("td",null))))))))),e.listenerPorts&&/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-errors"},/* @__PURE__ */qt.createElement(Se,{type:"error",message:e.listenerPorts})),e.listeners&&/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-errors"},/* @__PURE__ */qt.createElement(Se,{type:"error",message:e.listeners})),/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed"},/* @__PURE__ */qt.createElement("tbody",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("button",{type:"button",className:"add-new col-md-12",onClick:this.addListener},/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"})," Add new listener")))))))))}}class Sl extends qt.Component{constructor(e){super(e),this.protocols=["TCP","UDP"],this.healthProtocols=["TCP","HTTP","HTTPS"],this.targetTypes=["instance","ip"],this.destroy$=new Aa,this.addTargetGroup=()=>{const{setFieldValue:e,values:t}=this.props.formik,a=t.targetGroups.length;t.targetGroups.push({name:"targetgroup"+(a?`${a}`:""),protocol:"TCP",port:7001,targetType:"instance",healthCheckProtocol:"TCP",healthCheckPort:"traffic-port",healthCheckPath:"/healthcheck",healthCheckTimeout:5,healthCheckInterval:10,healthyThreshold:10,unhealthyThreshold:10,attributes:{deregistrationDelay:300,preserveClientIp:!0}}),e("targetGroups",t.targetGroups)};const t=e.isNew?0:e.formik.initialValues.targetGroups.length;this.state={existingTargetGroupNames:{},oldTargetGroupCount:t}}validate(e){const t=da(Qt(ra(oa(e.targetGroups,"name"),e=>e.length>1)).map(e=>e.name)),a=new m(e),{arrayForEach:n}=a;return a.field("targetGroups").withValidators(n(a=>{a.field("name","Name").required().withValidators(al(this.state.existingTargetGroupNames,e.credentials,e.region),nl(this.props.app.name.length),ke.valueUnique(t,"There is already a target group in this load balancer with the same name.")),a.field("port","Port").required().spelAware().withValidators(e=>Te(e)),a.field("healthCheckInterval","Health Check Interval").required().spelAware().withValidators(e=>Te(e)),a.field("healthyThreshold","Healthy Threshold").required().spelAware().withValidators(e=>Te(e)),a.field("unhealthyThreshold","Unhealthy Threshold").required().spelAware().withValidators(e=>Te(e)),a.field("healthCheckPort","Health Check Port").required().spelAware().withValidators(e=>"traffic-port"===e?null:Te(e)),a.field("protocol","Protocol").required(),a.field("healthCheckProtocol","Health Check Protocol").required()})),a.validateForm()}removeAppName(e){return e.replace(`${this.props.app.name}-`,"")}updateLoadBalancerNames(e){const{app:t,loadBalancer:a}=e,n={};Ga(t.getDataSource("loadBalancers").refresh(!0)).pipe($a(this.destroy$)).subscribe(()=>{t.getDataSource("loadBalancers").data.forEach(e=>{"classic"!==e.loadBalancerType&&(a&&e.name===a.name||e.targetGroups.forEach(t=>{n[e.account]=n[e.account]||{},n[e.account][e.region]=n[e.account][e.region]||[],n[e.account][e.region].push(this.removeAppName(t.name))}))}),this.setState({existingTargetGroupNames:n},()=>this.props.formik.validateForm())})}targetGroupFieldChanged(e,t,a){const{setFieldValue:n,values:r}=this.props.formik,l=r.targetGroups[e];ha(l,t,a),"healthyThreshold"===t&&ha(l,"unhealthyThreshold",a),n("targetGroups",r.targetGroups)}removeTargetGroup(e){const{setFieldValue:t,values:a}=this.props.formik,{oldTargetGroupCount:n}=this.state;a.targetGroups.splice(e,1),e<n&&this.setState({oldTargetGroupCount:n-1}),t("targetGroups",a.targetGroups)}componentDidMount(){this.updateLoadBalancerNames(this.props)}componentWillUnmount(){this.destroy$.next(),this.destroy$.complete()}render(){const{app:e}=this.props,{errors:t,values:a}=this.props.formik,{oldTargetGroupCount:n}=this.state,r=this.protocols.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e)),l=this.healthProtocols.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e)),s=this.targetTypes.map(e=>/* @__PURE__ */qt.createElement("option",{key:e},e));/* @__PURE__ */
|
|
73
73
|
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},a.targetGroups.map((a,i)=>{const o=t.targetGroups&&t.targetGroups[i]||{};/* @__PURE__ */
|
|
74
|
-
return qt.createElement("div",{key:i,className:"wizard-pod"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row header"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Group Name"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"group-name-prefix"},e.name,"-"),/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm target-group-name",type:"text",value:a.name,onChange:e=>this.targetGroupFieldChanged(i,"name",e.target.value),required:!0,disabled:i<n}),/* @__PURE__ */qt.createElement("a",{className:"sm-label clickable",onClick:()=>this.removeTargetGroup(i)},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"}))),o.name&&/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-errors"},/* @__PURE__ */qt.createElement(Se,{type:"error",message:o.name})))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.targetType"})," ",/* @__PURE__ */qt.createElement("span",null,"Target Type ")),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",value:a.targetType,onChange:e=>this.targetGroupFieldChanged(i,"targetType",e.target.value),disabled:i<n},s))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Backend Connection"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Protocol "),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.protocol"})," ",/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",value:a.protocol,onChange:e=>this.targetGroupFieldChanged(i,"protocol",e.target.value),disabled:i<n},r)),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Port "),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.port"})," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",value:a.port,onChange:e=>this.targetGroupFieldChanged(i,"port",e.target.value),type:"text",required:!0,disabled:i<n}))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Healthcheck"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Protocol "),/* @__PURE__ */qt.createElement("select",{disabled:i<n,className:"form-control input-sm inline-number",value:a.healthCheckProtocol,onChange:e=>this.targetGroupFieldChanged(i,"healthCheckProtocol",e.target.value)},l)),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Port "),/* @__PURE__ */qt.createElement(Ie,{className:"form-control input-sm inline-number",error:o.healthCheckPort,name:"healthCheckPort",required:!0,value:a.healthCheckPort,onChange:e=>this.targetGroupFieldChanged(i,"healthCheckPort",e.target.value)})),"TCP"!==a.healthCheckProtocol&&/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Path "),/* @__PURE__ */qt.createElement(Ie,{className:"form-control input-sm inline-text",error:o.healthCheckPath,name:"healthCheckPath",required:!0,value:a.healthCheckPath,onChange:e=>this.targetGroupFieldChanged(i,"healthCheckPath",e.target.value)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Timeout "),/* @__PURE__ */qt.createElement(Pe,{error:o.healthCheckTimeout,required:!0,value:a.healthCheckTimeout,onChange:e=>this.targetGroupFieldChanged(i,"healthCheckTimeout",e)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Interval "),/* @__PURE__ */qt.createElement(Pe,{error:o.healthCheckInterval,required:!0,value:a.healthCheckInterval,onChange:e=>this.targetGroupFieldChanged(i,"healthCheckInterval",e)}))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.nlbHealthcheckThreshold"})," ",/* @__PURE__ */qt.createElement("span",null,"Healthcheck Threshold ")),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement(Pe,{error:o.healthyThreshold,value:a.healthyThreshold,onChange:e=>this.targetGroupFieldChanged(i,"healthyThreshold",e)}))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Attributes"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Dereg. Delay"),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.attributes.deregistrationDelay"})," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",type:"text",value:a.attributes.deregistrationDelay,onChange:e=>this.targetGroupFieldChanged(i,"attributes.deregistrationDelay",e.target.value)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement(v,{name:"deregistrationDelayConnectionTermination",text:"Connection Termination",checked:a.attributes.deregistrationDelayConnectionTermination,onChange:e=>{this.targetGroupFieldChanged(i,"attributes.deregistrationDelayConnectionTermination",e.target.checked)}}),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.attributes.deregistrationDelayConnectionTermination"})),"instance"!==a.targetType&&/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement(v,{name:"preserveClientIp",text:"Preserve Client IP",checked:a.attributes.preserveClientIp,onChange:e=>{this.targetGroupFieldChanged(i,"attributes.preserveClientIp",e.target.checked)}}),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.attributes.preserveClientIp"})))))))}),/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed"},/* @__PURE__ */qt.createElement("tbody",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("button",{type:"button",className:"add-new col-md-12",onClick:this.addTargetGroup},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"})," Add new target group"))))))))}}const yl=class extends qt.Component{constructor(e){super(e),this._isUnmounted=!1,this.certificateTypes=ca(Cn,"loadBalancers.certificateTypes",["iam","acm"]),this.submit=e=>{const{app:t,forPipelineConfig:a,closeModal:n}=this.props,{isNew:r}=this.state,l=r?"Create":"Update",s=Xt(e);if(s.ipAddressType=s.dualstack?"dualstack":"ipv4",delete s.dualstack,a)this.formatListeners(s).then(()=>{n&&n(s)});else{const e=new w({application:t,title:(r?"Creating":"Updating")+" your load balancer",onDismiss:()=>this.props.dismissModal(),onTaskComplete:()=>this.onTaskComplete(s)});e.submit(()=>this.formatListeners(s).then(()=>(this.formatCommand(s),Le.upsertLoadBalancer(s,t,l)))),this.setState({taskMonitor:e})}},this.validate=()=>({});const t=e.loadBalancer?xr.convertNetworkLoadBalancerForEditing(e.loadBalancer):xr.constructNewNetworkLoadBalancerTemplate(e.app);this.state={isNew:!e.loadBalancer,loadBalancerCommand:t,taskMonitor:null}}static show(e,t){return I.show(Cl,e,{dialogClassName:"wizard-modal modal-lg"},t)}certificateIdAsARN(e,t,a,n){if(t&&(0!==t.indexOf("arn:aws:iam::")||0!==t.indexOf("arn:aws:acm:"))){if("iam"===n)return`arn:aws:iam::${e}:server-certificate/${t}`;if("acm"===n)return`arn:aws:acm:${a}:${e}:certificate/${t}`}return t}formatListeners(e){return h.getAccountDetails(e.credentials).then(t=>{e.listeners.forEach(a=>{"TCP"===a.protocol&&(delete a.sslPolicy,a.certificates=[]),a.certificates.forEach(a=>{a.certificateArn=this.certificateIdAsARN(t.accountId,a.name,e.region,a.type||this.certificateTypes[0])})})})}setAvailabilityZones(e){const t={};t[e.region]=e.regionZones||[],e.availabilityZones=t}addAppName(e){return`${this.props.app.name}-${e}`}manageTargetGroupNames(e){(e.targetGroups||[]).forEach(e=>{e.name=this.addAppName(e.name)}),(e.listeners||[]).forEach(e=>{e.defaultActions.forEach(e=>{e.targetGroupName&&(e.targetGroupName=this.addAppName(e.targetGroupName))}),(e.rules||[]).forEach(e=>{e.actions.forEach(e=>{e.targetGroupName&&(e.targetGroupName=this.addAppName(e.targetGroupName))})})})}manageRules(e){e.listeners.forEach(e=>{e.rules.forEach((e,t)=>{e.priority=t+1,e.conditions=e.conditions.filter(e=>e.values[0].length>0)})})}formatCommand(e){this.setAvailabilityZones(e),this.manageTargetGroupNames(e),this.manageRules(e)}onApplicationRefresh(e){var t;if(null==(t=this.refreshUnsubscribe)||t.call(this),this.refreshUnsubscribe=void 0,this._isUnmounted)return;this.props.dismissModal(),this.setState({taskMonitor:void 0});const a={name:e.name,accountId:e.credentials,region:e.region,vpcId:e.vpcId,provider:"aws"};this.props.stateService.includes("**.loadBalancerDetails")?this.props.stateService.go("^.loadBalancerDetails",a):this.props.stateService.go(".loadBalancerDetails",a)}componentWillUnmount(){var e;this._isUnmounted=!0,null==(e=this.refreshUnsubscribe)||e.call(this),this.refreshUnsubscribe=void 0}onTaskComplete(e){var t;null==(t=this.refreshUnsubscribe)||t.call(this),this.refreshUnsubscribe=void 0,this.refreshUnsubscribe=this.props.app.loadBalancers.onNextRefresh(()=>this.onApplicationRefresh(e)),this.props.app.loadBalancers.refresh()}render(){const{app:e,dismissModal:t,forPipelineConfig:a,loadBalancer:n}=this.props,{isNew:r,loadBalancerCommand:l,taskMonitor:s}=this.state;let i=a?"Configure Network Load Balancer":"Create New Network Load Balancer";r||(i=`Edit ${l.name}: ${l.region}: ${l.credentials}`);const o=r||a;/* @__PURE__ */
|
|
75
|
-
return qt.createElement(P,{heading:i,initialValues:l,taskMonitor:s,dismissModal:t,closeModal:this.submit,submitButtonLabel:a?r?"Add":"Done":r?"Create":"Update",validate:this.validate,render:({formik:t,nextIdx:l,wizard:s})=>/* @__PURE__ */qt.createElement(qt.Fragment,null,o&&/* @__PURE__ */qt.createElement(A,{label:"Location",wizard:s,order:l(),render:({innerRef:l})=>/* @__PURE__ */qt.createElement(
|
|
74
|
+
return qt.createElement("div",{key:i,className:"wizard-pod"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row header"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Group Name"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"group-name-prefix"},e.name,"-"),/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm target-group-name",type:"text",value:a.name,onChange:e=>this.targetGroupFieldChanged(i,"name",e.target.value),required:!0,disabled:i<n}),/* @__PURE__ */qt.createElement("a",{className:"sm-label clickable",onClick:()=>this.removeTargetGroup(i)},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"}))),o.name&&/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-errors"},/* @__PURE__ */qt.createElement(Se,{type:"error",message:o.name})))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.targetType"})," ",/* @__PURE__ */qt.createElement("span",null,"Target Type ")),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",value:a.targetType,onChange:e=>this.targetGroupFieldChanged(i,"targetType",e.target.value),disabled:i<n},s))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Backend Connection"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Protocol "),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.protocol"})," ",/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm inline-number",value:a.protocol,onChange:e=>this.targetGroupFieldChanged(i,"protocol",e.target.value),disabled:i<n},r)),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Port "),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.port"})," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",value:a.port,onChange:e=>this.targetGroupFieldChanged(i,"port",e.target.value),type:"text",required:!0,disabled:i<n}))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Healthcheck"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Protocol "),/* @__PURE__ */qt.createElement("select",{disabled:i<n,className:"form-control input-sm inline-number",value:a.healthCheckProtocol,onChange:e=>this.targetGroupFieldChanged(i,"healthCheckProtocol",e.target.value)},l)),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Port "),/* @__PURE__ */qt.createElement(Ie,{className:"form-control input-sm inline-number",error:o.healthCheckPort,name:"healthCheckPort",required:!0,value:a.healthCheckPort,onChange:e=>this.targetGroupFieldChanged(i,"healthCheckPort",e.target.value)})),"TCP"!==a.healthCheckProtocol&&/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Path "),/* @__PURE__ */qt.createElement(Ie,{className:"form-control input-sm inline-text",error:o.healthCheckPath,name:"healthCheckPath",required:!0,value:a.healthCheckPath,onChange:e=>this.targetGroupFieldChanged(i,"healthCheckPath",e.target.value)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Timeout "),/* @__PURE__ */qt.createElement(Pe,{error:o.healthCheckTimeout,required:!0,value:a.healthCheckTimeout,onChange:e=>this.targetGroupFieldChanged(i,"healthCheckTimeout",e)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Interval "),/* @__PURE__ */qt.createElement(Pe,{error:o.healthCheckInterval,required:!0,value:a.healthCheckInterval,onChange:e=>this.targetGroupFieldChanged(i,"healthCheckInterval",e)}))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.nlbHealthcheckThreshold"})," ",/* @__PURE__ */qt.createElement("span",null,"Healthcheck Threshold ")),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement(Pe,{error:o.healthyThreshold,value:a.healthyThreshold,onChange:e=>this.targetGroupFieldChanged(i,"healthyThreshold",e)}))))),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-title"},"Attributes"),/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-contents"},/* @__PURE__ */qt.createElement("div",{className:"wizard-pod-row-data"},/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement("label",null,"Dereg. Delay"),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.attributes.deregistrationDelay"})," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",type:"text",value:a.attributes.deregistrationDelay,onChange:e=>this.targetGroupFieldChanged(i,"attributes.deregistrationDelay",e.target.value)})),/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement(v,{name:"deregistrationDelayConnectionTermination",text:"Connection Termination",checked:a.attributes.deregistrationDelayConnectionTermination,onChange:e=>{this.targetGroupFieldChanged(i,"attributes.deregistrationDelayConnectionTermination",e.target.checked)}}),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.attributes.deregistrationDelayConnectionTermination"})),"instance"!==a.targetType&&/* @__PURE__ */qt.createElement("span",{className:"wizard-pod-content"},/* @__PURE__ */qt.createElement(v,{name:"preserveClientIp",text:"Preserve Client IP",checked:a.attributes.preserveClientIp,onChange:e=>{this.targetGroupFieldChanged(i,"attributes.preserveClientIp",e.target.checked)}}),/* @__PURE__ */qt.createElement(c,{id:"aws.targetGroup.attributes.preserveClientIp"})))))))}),/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed"},/* @__PURE__ */qt.createElement("tbody",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("button",{type:"button",className:"add-new col-md-12",onClick:this.addTargetGroup},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"})," Add new target group"))))))))}}const wl=class extends qt.Component{constructor(e){super(e),this._isUnmounted=!1,this.certificateTypes=ca(Cn,"loadBalancers.certificateTypes",["iam","acm"]),this.submit=e=>{const{app:t,forPipelineConfig:a,closeModal:n}=this.props,{isNew:r}=this.state,l=r?"Create":"Update",s=Xt(e);if(s.ipAddressType=s.dualstack?"dualstack":"ipv4",delete s.dualstack,a)this.formatListeners(s).then(()=>{n&&n(s)});else{const e=new w({application:t,title:(r?"Creating":"Updating")+" your load balancer",onDismiss:()=>this.props.dismissModal(),onTaskComplete:()=>this.onTaskComplete(s)});e.submit(()=>this.formatListeners(s).then(()=>(this.formatCommand(s),Le.upsertLoadBalancer(s,t,l)))),this.setState({taskMonitor:e})}},this.validate=()=>({});const t=e.loadBalancer?Rr.convertNetworkLoadBalancerForEditing(e.loadBalancer):Rr.constructNewNetworkLoadBalancerTemplate(e.app);this.state={isNew:!e.loadBalancer,loadBalancerCommand:t,taskMonitor:null}}static show(e,t){return I.show(Tl,e,{dialogClassName:"wizard-modal modal-lg"},t)}certificateIdAsARN(e,t,a,n){if(t&&(0!==t.indexOf("arn:aws:iam::")||0!==t.indexOf("arn:aws:acm:"))){if("iam"===n)return`arn:aws:iam::${e}:server-certificate/${t}`;if("acm"===n)return`arn:aws:acm:${a}:${e}:certificate/${t}`}return t}formatListeners(e){return h.getAccountDetails(e.credentials).then(t=>{e.listeners.forEach(a=>{"TCP"===a.protocol&&(delete a.sslPolicy,a.certificates=[]),a.certificates.forEach(a=>{a.certificateArn=this.certificateIdAsARN(t.accountId,a.name,e.region,a.type||this.certificateTypes[0])})})})}setAvailabilityZones(e){const t={};t[e.region]=e.regionZones||[],e.availabilityZones=t}addAppName(e){return`${this.props.app.name}-${e}`}manageTargetGroupNames(e){(e.targetGroups||[]).forEach(e=>{e.name=this.addAppName(e.name)}),(e.listeners||[]).forEach(e=>{e.defaultActions.forEach(e=>{e.targetGroupName&&(e.targetGroupName=this.addAppName(e.targetGroupName))}),(e.rules||[]).forEach(e=>{e.actions.forEach(e=>{e.targetGroupName&&(e.targetGroupName=this.addAppName(e.targetGroupName))})})})}manageRules(e){e.listeners.forEach(e=>{e.rules.forEach((e,t)=>{e.priority=t+1,e.conditions=e.conditions.filter(e=>e.values[0].length>0)})})}formatCommand(e){this.setAvailabilityZones(e),this.manageTargetGroupNames(e),this.manageRules(e)}onApplicationRefresh(e){var t;if(null==(t=this.refreshUnsubscribe)||t.call(this),this.refreshUnsubscribe=void 0,this._isUnmounted)return;this.props.dismissModal(),this.setState({taskMonitor:void 0});const a={name:e.name,accountId:e.credentials,region:e.region,vpcId:e.vpcId,provider:"aws"};this.props.stateService.includes("**.loadBalancerDetails")?this.props.stateService.go("^.loadBalancerDetails",a):this.props.stateService.go(".loadBalancerDetails",a)}componentWillUnmount(){var e;this._isUnmounted=!0,null==(e=this.refreshUnsubscribe)||e.call(this),this.refreshUnsubscribe=void 0}onTaskComplete(e){var t;null==(t=this.refreshUnsubscribe)||t.call(this),this.refreshUnsubscribe=void 0,this.refreshUnsubscribe=this.props.app.loadBalancers.onNextRefresh(()=>this.onApplicationRefresh(e)),this.props.app.loadBalancers.refresh()}render(){const{app:e,dismissModal:t,forPipelineConfig:a,loadBalancer:n}=this.props,{isNew:r,loadBalancerCommand:l,taskMonitor:s}=this.state;let i=a?"Configure Network Load Balancer":"Create New Network Load Balancer";r||(i=`Edit ${l.name}: ${l.region}: ${l.credentials}`);const o=r||a;/* @__PURE__ */
|
|
75
|
+
return qt.createElement(P,{heading:i,initialValues:l,taskMonitor:s,dismissModal:t,closeModal:this.submit,submitButtonLabel:a?r?"Add":"Done":r?"Create":"Update",validate:this.validate,render:({formik:t,nextIdx:l,wizard:s})=>/* @__PURE__ */qt.createElement(qt.Fragment,null,o&&/* @__PURE__ */qt.createElement(A,{label:"Location",wizard:s,order:l(),render:({innerRef:l})=>/* @__PURE__ */qt.createElement(ol,{app:e,forPipelineConfig:a,formik:t,isNew:r,loadBalancer:n,ref:l})}),/* @__PURE__ */qt.createElement(A,{label:"Target Groups",wizard:s,order:l(),render:({innerRef:a})=>/* @__PURE__ */qt.createElement(Sl,{ref:a,formik:t,app:e,isNew:r,loadBalancer:n})}),/* @__PURE__ */qt.createElement(A,{label:"Listeners",wizard:s,order:l(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(Nl,{ref:e,formik:t})}),/* @__PURE__ */qt.createElement(A,{label:"Advanced Settings",wizard:s,order:l(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(bl,{ref:e,showDualstack:!t.values.isInternal&&va(t.values.targetGroups,{targetType:"instance"})})}))})}};wl.defaultProps={closeModal:T,dismissModal:T};let kl=wl;const Tl=Object.assign(G(kl),{show:kl.show}),Il=[{type:"application",label:"Application",sublabel:"ALB",description:"Highly configurable, application-focused balancer. HTTP and HTTPS only.",component:pl},{type:"network",label:"Network",sublabel:"NLB",description:"Basic, high-performance balancer with fixed IP.",component:Tl},{type:"classic",label:"Classic",sublabel:"Legacy",description:"Previous generation balancer (ELB).",component:yl}],Pl=class e extends qt.Component{constructor(e){super(e),this.choose=()=>{const{children:e,...t}=this.props;this.close(),this.state.selectedChoice.component.show(t,this.context.services).then(e=>{this.props.closeModal(e)}).catch(()=>{})},this.close=e=>{this.props.dismissModal(e)},this.state={choices:Il,selectedChoice:Il[0]}}static show(t,a){var n;if(!1===t.isNew&&(null==(n=t.loadBalancer)?void 0:n.loadBalancerType)){const e=Il.find(e=>e.type===t.loadBalancer.loadBalancerType);if(e)return e.component.show(t,a)}return I.show(e,{...t,className:"create-pipeline-modal-overflow-visible modal-lg"},{bsSize:"lg"},a)}choiceSelected(e){this.setState({selectedChoice:e})}getIncompatibility(e,t){const{loadBalancer:a={}}=ze.getProvider(t),{incompatibleLoadBalancerTypes:n=[]}=a;return n.find(t=>t.type===e.type)}isIncompatibleWithAllProviders(e){const{app:{attributes:t}}=this.props,{cloudProviders:a=[]}=t;return a.length>0&&a.every(t=>!!this.getIncompatibility(e,t))}render(){const{app:{attributes:e}}=this.props,{cloudProviders:t=[]}=e,{choices:a,selectedChoice:n}=this.state,r=a.filter(e=>!this.isIncompatibleWithAllProviders(e)),l=t.map(e=>this.getIncompatibility(n,e)).filter(e=>e),s=Cn.createLoadBalancerWarnings&&Cn.createLoadBalancerWarnings[n.type];/* @__PURE__ */
|
|
76
76
|
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(ye,{dismiss:this.close}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Select Type of Load Balancer")),/* @__PURE__ */qt.createElement(Za.Body,null,/* @__PURE__ */qt.createElement("div",{className:"modal-body"},/* @__PURE__ */qt.createElement("div",{className:"card-choices"},r.map(e=>/* @__PURE__ */qt.createElement("div",{key:e.type,className:"card "+(n===e?"active":""),onClick:()=>this.choiceSelected(e)},
|
|
77
77
|
/* @__PURE__ */qt.createElement("h3",{className:"load-balancer-label"},e.label),
|
|
78
78
|
/* @__PURE__ */qt.createElement("h3",null,"(",e.sublabel,")"),
|
|
79
|
-
/* @__PURE__ */qt.createElement("div",null,e.description)))),/* @__PURE__ */qt.createElement(qt.Fragment,null,l.length>0&&l.map(e=>/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"})," ",e.reason)))),!!s&&/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"}),/* @__PURE__ */qt.createElement(Be,{message:s,style:{display:"inline-block",marginLeft:"2px"}}))),/* @__PURE__ */qt.createElement("div",{className:"load-balancer-description"}))),/* @__PURE__ */qt.createElement(Za.Footer,null,/* @__PURE__ */qt.createElement(_a,{onClick:this.choose},"Configure Load Balancer ",/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-chevron-right"}))))}};
|
|
80
|
-
return qt.createElement("div",{style:{display:"inline-block"}},Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement(ja,{className:"dropdown",id:"load-balancer-actions-dropdown"},/* @__PURE__ */qt.createElement(ja.Toggle,{className:"btn btn-sm btn-primary dropdown-toggle"},/* @__PURE__ */qt.createElement("span",null,"Load Balancer Actions")),/* @__PURE__ */qt.createElement(ja.Menu,{className:"dropdown-menu"},a&&/* @__PURE__ */qt.createElement(Oe,{resource:t,application:e,onClick:this.editLoadBalancer},"Edit Load Balancer"),!a&&/* @__PURE__ */qt.createElement("li",{className:"disabled"},/* @__PURE__ */qt.createElement("a",null,"Edit Load Balancer"," ",/* @__PURE__ */qt.createElement(c,{content:`The application <b>${s}</b> must be configured before this load balancer can be edited.`}))),i&&/* @__PURE__ */qt.createElement(Oe,{resource:t,application:e,onClick:this.deleteLoadBalancer},"Delete Load Balancer"),!i&&/* @__PURE__ */qt.createElement("li",{className:"disabled"},/* @__PURE__ */qt.createElement("a",null,"Delete Load Balancer"," ",/* @__PURE__ */qt.createElement(c,{content:"You must detach all instances before you can delete this load balancer."}))),o&&o.feature.entityTags&&/* @__PURE__ */qt.createElement(B,{component:t,application:e,entityType:"loadBalancer",onUpdate:this.entityTagUpdate}))))}};
|
|
81
|
-
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(
|
|
82
|
-
return qt.createElement(qt.Fragment,null,l.isManaged&&/* @__PURE__ */qt.createElement(ge,{resourceSummary:l.managedResourceSummary,application:e}),/* @__PURE__ */qt.createElement(z,{heading:"Load Balancer Details",defaultExpanded:!0},/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-narrow"},/* @__PURE__ */qt.createElement("dt",null,"Created"),/* @__PURE__ */qt.createElement("dd",null,s.createdTime?V(s.createdTime):"-"),/* @__PURE__ */qt.createElement("dt",null,"In"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(L,{account:l.account})," ",l.region),/* @__PURE__ */qt.createElement("dt",null,"VPC"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(
|
|
83
|
-
/* @__PURE__ */qt.createElement("a",null,e.name))))))),!!(null==(r=l.targetGroups)?void 0:r.length)&&/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Target Groups"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement("ul",{className:"collapse-margin-on-filter-collapse"},l.targetGroups.slice().sort(
|
|
84
|
-
/* @__PURE__ */qt.createElement("a",null,e.name))))))),i&&/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"DNS Name"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement("a",{target:"_blank",href:`${l.elbProtocol||"http:"}//${i}`},i)," ",/* @__PURE__ */qt.createElement(he,{text:i,toolTip:"Copy DNS Name to clipboard"})))))}function
|
|
85
|
-
return qt.createElement(z,{heading:"Status",defaultExpanded:"classic"===e.loadBalancerType},"classic"===e.loadBalancerType?/* @__PURE__ */qt.createElement(se,{className:"pull-left",container:e.instanceCounts}):/* @__PURE__ */qt.createElement("span",null,"Select a target group to check the instance health status from the view of the target group."))}function
|
|
79
|
+
/* @__PURE__ */qt.createElement("div",null,e.description)))),/* @__PURE__ */qt.createElement(qt.Fragment,null,l.length>0&&l.map(e=>/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"})," ",e.reason)))),!!s&&/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"}),/* @__PURE__ */qt.createElement(Be,{message:s,style:{display:"inline-block",marginLeft:"2px"}}))),/* @__PURE__ */qt.createElement("div",{className:"load-balancer-description"}))),/* @__PURE__ */qt.createElement(Za.Footer,null,/* @__PURE__ */qt.createElement(_a,{onClick:this.choose},"Configure Load Balancer ",/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-chevron-right"}))))}};Pl.contextType=C,Pl.supportsPipelineConfig=!0,Pl.defaultProps={closeModal:T,dismissModal:T};let Al=Pl;const Gl=class extends qt.Component{constructor(e){super(e),this.editLoadBalancer=()=>{const{loadBalancer:e}=this.props,{application:t}=this.state;Il.find(t=>t.type===e.loadBalancerType).component.show({app:t,loadBalancer:e},this.context.services)},this.deleteLoadBalancer=()=>{const{app:e,loadBalancer:t}=this.props,a=this.props.loadBalancerFromParams||{accountId:t.account,region:t.region,name:t.name};if(t.instances&&t.instances.length)return;const n={application:e,title:"Deleting "+a.name},r={cloudProvider:t.cloudProvider,loadBalancerName:t.name,loadBalancerType:t.loadBalancerType||"classic",regions:[t.region],credentials:t.account,vpcId:ca(t,"elb.vpcId",null)};x.confirm({header:`Really delete ${a.name} in ${a.region}: ${a.accountId}?`,buttonText:`Delete ${a.name}`,account:a.accountId,taskMonitorConfig:n,submitMethod:()=>Le.deleteLoadBalancer(r,e)})},this.entityTagUpdate=()=>{this.props.app.loadBalancers.refresh()};const{app:t,loadBalancer:a}=this.props;let n;const r=a.name.split("-")[0];r===t.name?n=t:D.getApplication(r).then(e=>{this.setState({application:e})}).catch(()=>{}),this.state={application:n}}render(){const{app:e,loadBalancer:t}=this.props,{application:a}=this.state,{loadBalancerType:n,instances:r=[],instanceCounts:l}=t,s=t.name.split("-")[0],i=!("classic"===n&&fa(l).filter(e=>e).length)&&!r.length;/* @__PURE__ */
|
|
80
|
+
return qt.createElement("div",{style:{display:"inline-block"}},Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement(ja,{className:"dropdown",id:"load-balancer-actions-dropdown"},/* @__PURE__ */qt.createElement(ja.Toggle,{className:"btn btn-sm btn-primary dropdown-toggle"},/* @__PURE__ */qt.createElement("span",null,"Load Balancer Actions")),/* @__PURE__ */qt.createElement(ja.Menu,{className:"dropdown-menu"},a&&/* @__PURE__ */qt.createElement(Oe,{resource:t,application:e,onClick:this.editLoadBalancer},"Edit Load Balancer"),!a&&/* @__PURE__ */qt.createElement("li",{className:"disabled"},/* @__PURE__ */qt.createElement("a",null,"Edit Load Balancer"," ",/* @__PURE__ */qt.createElement(c,{content:`The application <b>${s}</b> must be configured before this load balancer can be edited.`}))),i&&/* @__PURE__ */qt.createElement(Oe,{resource:t,application:e,onClick:this.deleteLoadBalancer},"Delete Load Balancer"),!i&&/* @__PURE__ */qt.createElement("li",{className:"disabled"},/* @__PURE__ */qt.createElement("a",null,"Delete Load Balancer"," ",/* @__PURE__ */qt.createElement(c,{content:"You must detach all instances before you can delete this load balancer."}))),o&&o.feature.entityTags&&/* @__PURE__ */qt.createElement(B,{component:t,application:e,entityType:"loadBalancer",onUpdate:this.entityTagUpdate}))))}};Gl.contextType=C;let xl=Gl;async function Dl({app:e,autoClose:t,loadBalancerParams:a,loadBalancers:n,securityGroupReader:r}){const{accountId:l,name:s,region:i}=a,o=(n||e.loadBalancers.data).find(e=>e.name===s&&e.region===i&&e.account===l)||void 0;if(!o)return void t();const c=await F("/loadBalancers").path(l,i,s).query({provider:"aws"}).get();var d;return c.length&&(o.elb=c[0],o.elb.vpcId=kn(o.elb),o.account=l,o.securityGroups=function(e,t,a,n){var r;return((null==(r=t.elb)?void 0:r.securityGroups)||t.securityGroups||[]).map(t=>{var r,l,s;return n?n.getApplicationSecurityGroup(e,a.accountId,a.region,t):null==(s=null==(l=null==(r=e.securityGroupsIndex)?void 0:r[a.accountId])?void 0:l[a.region])?void 0:s[t]}).filter(Boolean).sort((e,t)=>e.name.localeCompare(t.name))}(e,o,a,r),o.elbProtocol=function(e,t){var a,n;return(null==(a=t.listenerDescriptions)?void 0:a.some(e=>"HTTPS"===e.listener.protocol))||(null==(n=e.listeners)?void 0:n.some(e=>"HTTPS"===e.protocol))?"https:":"http:"}(o,c[0]),o.ipAddressTypeDescription="dualstack"===(d=c[0].ipAddressType)?"IPv4 and IPv6":"ipv4"===d?"IPv4":"",o.listenerRows="classic"===o.loadBalancerType?[]:function(e){const t=e.listeners||[],a=[];return t.forEach(t=>{(t.rules||[]).forEach(n=>{let r=[t.protocol,(n.conditions.find(e=>"host-header"===e.field)||{values:[""]}).values[0],t.port].filter(e=>e).join(":");const l=(n.conditions.find(e=>"path-pattern"===e.field)||{values:[]}).values[0];l&&(r=`${r}${l}`);const s=(n.actions||[]).map(t=>{const a={...t};return"forward"===a.type&&(a.targetGroup=(e.targetGroups||[]).find(e=>e.name===a.targetGroupName)),a});a.push({in:r,actions:s})})}),a}(o),await async function(e){var t;(null==(t=e.subnets)?void 0:t.length)?e.subnetDetails=await Promise.all(e.subnets.map(t=>N.getSubnetByIdAndProvider(t,e.provider))):e.subnetDetails=e.subnetDetails||[]}(o)),o}function Bl({app:e,loadBalancerParams:t,autoClose:a}){const{securityGroupReader:n}=$e(),r=e.getDataSource("loadBalancers"),{data:l,loaded:s,refresh:i,error:o}=Ue(r),[c,d]=qt.useState(),[m,u]=qt.useState(!1),[p,h]=qt.useState(null),g=qt.useRef(a),v=qt.useRef(!0),{accountId:f,name:E,provider:y,region:b,vpcId:C}=t;qt.useEffect(()=>()=>{v.current=!1},[]),qt.useEffect(()=>{g.current=a},[a]);const N=qt.useCallback(async()=>{if(s&&!o){u(!0),h(null);try{const t=await Dl({app:e,autoClose:()=>g.current(),loadBalancerParams:{accountId:f,name:E,provider:y,region:b,vpcId:C},loadBalancers:l,securityGroupReader:n});v.current&&d(t)}catch(t){v.current&&h((null==t?void 0:t.message)||String(t))}finally{v.current&&u(!1)}}},[f,e,o,l,s,E,y,b,n,C]);return qt.useEffect(()=>{N()},[N]),{data:c,loading:!s||m,error:o||p,refetch:async()=>i()}}function Fl(e,t){return e.isDisabled!==t.isDisabled?e.isDisabled?1:-1:t.name.localeCompare(e.name)}function Ml(e,t){return e.isDisabled!==t.isDisabled?e.isDisabled?1:-1:t.name.localeCompare(e.name)}function Rl({app:e,loadBalancer:t}){var a;const n=t,r=(null==(a=n.elb)?void 0:a.insightActions)||[];/* @__PURE__ */
|
|
81
|
+
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(xl,{app:e,loadBalancer:n}),r.length>0&&/* @__PURE__ */qt.createElement(ja,{className:"dropdown",id:"amazon-load-balancer-insights-dropdown"},/* @__PURE__ */qt.createElement(ja.Toggle,{className:"btn btn-sm btn-default dropdown-toggle"},"Insight"),/* @__PURE__ */qt.createElement(ja.Menu,null,r.map(e=>/* @__PURE__ */qt.createElement(Ka,{key:e.url||e.label,href:e.url,target:"_blank"},e.label)))))}function Ll({app:e,loadBalancer:t}){var a,n,r;const l=t,s=l.elb||{},i=wn(s),o=Ea((l.subnetDetails||[]).map(e=>e.purpose))||"";/* @__PURE__ */
|
|
82
|
+
return qt.createElement(qt.Fragment,null,l.isManaged&&/* @__PURE__ */qt.createElement(ge,{resourceSummary:l.managedResourceSummary,application:e}),/* @__PURE__ */qt.createElement(z,{heading:"Load Balancer Details",defaultExpanded:!0},/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-narrow"},/* @__PURE__ */qt.createElement("dt",null,"Created"),/* @__PURE__ */qt.createElement("dd",null,s.createdTime?V(s.createdTime):"-"),/* @__PURE__ */qt.createElement("dt",null,"In"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(L,{account:l.account})," ",l.region),/* @__PURE__ */qt.createElement("dt",null,"VPC"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(Wn,{vpcId:s.vpcId||l.vpcId})),/* @__PURE__ */qt.createElement("dt",null,"Subnet"),/* @__PURE__ */qt.createElement("dd",null,o),/* @__PURE__ */qt.createElement("dt",null,"Scheme"),/* @__PURE__ */qt.createElement("dd",null,l.scheme||"-"),l.loadBalancerType&&/* @__PURE__ */qt.createElement("dt",null,"Type"),l.loadBalancerType&&/* @__PURE__ */qt.createElement("dd",null,l.loadBalancerType),l.ipAddressTypeDescription&&/* @__PURE__ */qt.createElement("dt",null,"IP Type"),l.ipAddressTypeDescription&&/* @__PURE__ */qt.createElement("dd",null,l.ipAddressTypeDescription)),!!(null==(a=s.availabilityZones)?void 0:a.length)&&/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Availability Zones"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement("ul",{className:"collapse-margin-on-filter-collapse"},s.availabilityZones.map(e=>/* @__PURE__ */qt.createElement("li",{key:e},e))))),!!(null==(n=l.serverGroups)?void 0:n.length)&&/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Server Groups"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement("ul",{className:"collapse-margin-on-filter-collapse"},l.serverGroups.slice().sort(Fl).map(e=>/* @__PURE__ */qt.createElement("li",{key:e.name},/* @__PURE__ */qt.createElement(en,{to:"^.serverGroup",params:{region:e.region,accountId:e.account,serverGroup:e.name,provider:"aws"}},
|
|
83
|
+
/* @__PURE__ */qt.createElement("a",null,e.name))))))),!!(null==(r=l.targetGroups)?void 0:r.length)&&/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Target Groups"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement("ul",{className:"collapse-margin-on-filter-collapse"},l.targetGroups.slice().sort(Ml).map(e=>/* @__PURE__ */qt.createElement("li",{key:e.name},/* @__PURE__ */qt.createElement(en,{to:"^.targetGroupDetails",params:{region:e.region,loadBalancerName:l.name,accountId:e.account,name:e.name,vpcId:e.vpcId,provider:"aws"}},
|
|
84
|
+
/* @__PURE__ */qt.createElement("a",null,e.name))))))),i&&/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"DNS Name"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement("a",{target:"_blank",href:`${l.elbProtocol||"http:"}//${i}`},i)," ",/* @__PURE__ */qt.createElement(he,{text:i,toolTip:"Copy DNS Name to clipboard"})))))}function zl({loadBalancer:e}){/* @__PURE__ */
|
|
85
|
+
return qt.createElement(z,{heading:"Status",defaultExpanded:"classic"===e.loadBalancerType},"classic"===e.loadBalancerType?/* @__PURE__ */qt.createElement(se,{className:"pull-left",container:e.instanceCounts}):/* @__PURE__ */qt.createElement("span",null,"Select a target group to check the instance health status from the view of the target group."))}function Ol({loadBalancer:e}){const t=e,a=t.elb;return"classic"===t.loadBalancerType?/* @__PURE__ */qt.createElement(z,{heading:"Listeners"},/* @__PURE__ */qt.createElement("dl",null,/* @__PURE__ */qt.createElement("dt",null,"Load Balancer -> Instance"),(a.listenerDescriptions||[]).map((e,t)=>/* @__PURE__ */qt.createElement("dd",{key:t},e.listener.protocol,":",e.listener.loadBalancerPort," ->"," ",e.listener.instanceProtocol,":",e.listener.instancePort)))):/* @__PURE__ */qt.createElement(z,{heading:"Listeners"},(t.listenerRows||[]).map(e=>/* @__PURE__ */qt.createElement("div",{key:e.in},/* @__PURE__ */qt.createElement("div",{className:"listener-targets"},e.in," ->"),/* @__PURE__ */qt.createElement("div",{className:"listener-targets"},e.actions.map((a,n)=>/* @__PURE__ */qt.createElement("div",{key:`${e.in}-${n}`},function(e,t){var a;if("redirect"===e.type){const t=e.redirectConfig;/* @__PURE__ */
|
|
86
86
|
return qt.createElement("span",null,"#{protocol}"!==t.protocol&&`${t.protocol}:`,"#{host}"!==t.host&&` ${t.host} `,"#{port}"!==t.port&&` ${t.port} `,"/#{path}"!==t.path&&` ${t.path} `,"#{query}"!==t.query&&` ?${t.query} `,"(",t.statusCode,")")}if("authenticate-oidc"===e.type){const t=null==(a=e.authenticateOidcConfig)?void 0:a.clientId;/* @__PURE__ */
|
|
87
87
|
return qt.createElement("span",null,/* @__PURE__ */qt.createElement("i",{className:"fas fa-fw fa-user-lock"})," ",t)}return e.targetGroupName&&e.targetGroup?/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("i",{className:"fa fa-fw fa-crosshairs icon","aria-hidden":"true"}),/* @__PURE__ */qt.createElement(en,{to:"^.targetGroupDetails",params:{region:e.targetGroup.region,loadBalancerName:t.name,accountId:e.targetGroup.account,name:e.targetGroup.name,vpcId:e.targetGroup.vpcId,provider:"aws"}},
|
|
88
|
-
/* @__PURE__ */qt.createElement("a",null,e.targetGroupName))):/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("i",{className:"fa fa-fw fa-crosshairs icon","aria-hidden":"true"})," ",e.targetGroupName||e.type)}(a,t)))))))}function
|
|
89
|
-
/* @__PURE__ */qt.createElement("a",null,e.name," (",e.id,")")))))):null}function
|
|
90
|
-
return qt.createElement(z,{heading:"Subnets"},!t.length&&/* @__PURE__ */qt.createElement("h5",null,"No subnets"),t.map(e=>/* @__PURE__ */qt.createElement("div",{key:e.id,className:"bottom-border"},/* @__PURE__ */qt.createElement("h5",null,/* @__PURE__ */qt.createElement("strong",null,e.id)),/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-narrow"},/* @__PURE__ */qt.createElement("dt",null,"Purpose"),/* @__PURE__ */qt.createElement("dd",null,e.purpose),/* @__PURE__ */qt.createElement("dt",null,"State"),/* @__PURE__ */qt.createElement("dd",null,e.state),/* @__PURE__ */qt.createElement("dt",null,"Cidr Block"),/* @__PURE__ */qt.createElement("dd",null,e.cidrBlock)))))}function
|
|
91
|
-
return qt.createElement(z,{heading:"Health Checks"},/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Target"),/* @__PURE__ */qt.createElement("dd",null,(null==a?void 0:a.target)||"-"),/* @__PURE__ */qt.createElement("dt",null,"Timeout"),/* @__PURE__ */qt.createElement("dd",null,null==a?void 0:a.timeout," seconds"),/* @__PURE__ */qt.createElement("dt",null,"Interval"),/* @__PURE__ */qt.createElement("dd",null,null==a?void 0:a.interval," seconds"),/* @__PURE__ */qt.createElement("dt",null,"Healthy Threshold"),/* @__PURE__ */qt.createElement("dd",null,null==a?void 0:a.healthyThreshold),/* @__PURE__ */qt.createElement("dt",null,"Unhealthy Threshold"),/* @__PURE__ */qt.createElement("dd",null,null==a?void 0:a.unhealthyThreshold)))}const
|
|
92
|
-
return qt.createElement(qt.Fragment,null,Cn.dockerBakeWarning&&/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning sp-margin-s-top horizontal middle"},/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"}),/* @__PURE__ */qt.createElement("div",{className:"sp-margin-s-left"},/* @__PURE__ */qt.createElement(Be,{message:Cn.dockerBakeWarning}))),/* @__PURE__ */qt.createElement("div",{className:"alert alert-info horizontal middle"},/* @__PURE__ */qt.createElement("i",{className:"fa fa-info-circle"}),/* @__PURE__ */qt.createElement("div",{className:"sp-margin-s-left"},/* @__PURE__ */qt.createElement(Be,{message:"To edit bake configuration or view advanced options, migrate to EBS store type."}))),t&&/* @__PURE__ */qt.createElement(qe,{label:"Store Type"}
|
|
88
|
+
/* @__PURE__ */qt.createElement("a",null,e.targetGroupName))):/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("i",{className:"fa fa-fw fa-crosshairs icon","aria-hidden":"true"})," ",e.targetGroupName||e.type)}(a,t)))))))}function $l({loadBalancer:e}){const t=e,a=na(t.securityGroups||[],"name");return"network"!==t.loadBalancerType||a.length?/* @__PURE__ */qt.createElement(z,{heading:j.get("Firewalls")},/* @__PURE__ */qt.createElement("ul",null,a.map(e=>/* @__PURE__ */qt.createElement("li",{key:e.id||e.name},/* @__PURE__ */qt.createElement(en,{to:"^.firewallDetails",params:{name:e.name,accountId:t.account,region:t.region,vpcId:t.vpcId,provider:t.provider}},
|
|
89
|
+
/* @__PURE__ */qt.createElement("a",null,e.name," (",e.id,")")))))):null}function Ul({loadBalancer:e}){const t=(e.subnetDetails||[]).filter(Boolean);/* @__PURE__ */
|
|
90
|
+
return qt.createElement(z,{heading:"Subnets"},!t.length&&/* @__PURE__ */qt.createElement("h5",null,"No subnets"),t.map(e=>/* @__PURE__ */qt.createElement("div",{key:e.id,className:"bottom-border"},/* @__PURE__ */qt.createElement("h5",null,/* @__PURE__ */qt.createElement("strong",null,e.id)),/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-narrow"},/* @__PURE__ */qt.createElement("dt",null,"Purpose"),/* @__PURE__ */qt.createElement("dd",null,e.purpose),/* @__PURE__ */qt.createElement("dt",null,"State"),/* @__PURE__ */qt.createElement("dd",null,e.state),/* @__PURE__ */qt.createElement("dt",null,"Cidr Block"),/* @__PURE__ */qt.createElement("dd",null,e.cidrBlock)))))}function Vl({loadBalancer:e}){var t;if("classic"!==e.loadBalancerType)return null;const a=null==(t=e.elb)?void 0:t.healthCheck;/* @__PURE__ */
|
|
91
|
+
return qt.createElement(z,{heading:"Health Checks"},/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Target"),/* @__PURE__ */qt.createElement("dd",null,(null==a?void 0:a.target)||"-"),/* @__PURE__ */qt.createElement("dt",null,"Timeout"),/* @__PURE__ */qt.createElement("dd",null,null==a?void 0:a.timeout," seconds"),/* @__PURE__ */qt.createElement("dt",null,"Interval"),/* @__PURE__ */qt.createElement("dd",null,null==a?void 0:a.interval," seconds"),/* @__PURE__ */qt.createElement("dt",null,"Healthy Threshold"),/* @__PURE__ */qt.createElement("dd",null,null==a?void 0:a.healthyThreshold),/* @__PURE__ */qt.createElement("dt",null,"Unhealthy Threshold"),/* @__PURE__ */qt.createElement("dd",null,null==a?void 0:a.unhealthyThreshold)))}const Hl=[Ll,zl,Ol,$l,Ul,Vl],ql=new URL("amazon.logoBzC5E-3F.svg",import.meta.url).href,Wl=["ebs","docker"];function jl(e){return Object.keys(e).reduce((t,a)=>(""!==e[a]&&(t[a]=e[a]),t),{})}function Zl(e){return o.feature.roscoMode||"function"==typeof o.feature.roscoSelector&&o.feature.roscoSelector(e)}function _l(e){return"Started"!==(null==e?void 0:e.migrationStatus)}class Kl extends qt.Component{constructor(){super(...arguments),this.mounted=!1,this.state={baseLabelOptions:[],baseOsOptions:[],extendedAttributeKey:"",extendedAttributeValue:"",loading:!0,loadError:!1,regions:[],roscoMode:!1,showAdvancedOptions:!1,vmTypes:["hvm","pv"]}}componentDidMount(){this.mounted=!0,this.initialize()}componentWillUnmount(){this.mounted=!1}initialize(){const e=this.props.stage;Promise.all([Ve.getRegions("aws"),Ve.getBaseOsOptions("aws"),Ve.getBaseLabelOptions()]).then(([t,a,n])=>{if(!this.mounted)return;const r=a.baseImages||[],l=this.applyDefaults(e,t,r,n);this.replaceStage(l),this.setState({baseLabelOptions:n,baseOsOptions:r,loading:!1,loadError:!1,regions:t,roscoMode:Zl(l),showAdvancedOptions:this.showAdvanced(l),vmTypes:this.computeVmTypes(r,l.baseOs)})}).catch(()=>{this.mounted&&this.setState({loading:!1,loadError:!0})})}applyDefaults(e,t,a,n){var r;const l=jl({...e});l.extendedAttributes=l.extendedAttributes||{},l.regions=l.regions&&[...l.regions].sort()||[],l.user||(l.user=null==(r=He.getAuthenticatedUser())?void 0:r.name),!l.storeType&&Wl.length&&(l.storeType=Wl[0]),1===t.length?l.region=t[0]:l.region&&!t.includes(l.region)&&delete l.region,!l.regions.length&&this.props.application.defaultRegions.aws&&(l.regions=[this.props.application.defaultRegions.aws]);let s=a;!l.baseOs&&a.length?l.baseOs=a[0].id:l.baseOs&&!a.find(e=>e.id===l.baseOs)&&(s=[...a,{id:l.baseOs,detailedDescription:"Custom",vmTypes:["hvm","pv"]}]),!l.baseLabel&&n.length&&(l.baseLabel=n[0]);const i=this.computeVmTypes(s,l.baseOs);return!l.vmType&&i.length&&(l.vmType=i[0]),l}computeVmTypes(e,t){if(e.length&&e.every(e=>e.vmTypes)){const a=e.find(e=>e.id===t);return(null==a?void 0:a.vmTypes)||["hvm","pv"]}return["hvm","pv"]}showAdvanced(e){return!!(e.templateFileName||e.extendedAttributes&&Object.keys(e.extendedAttributes).length>0||e.varFileName||e.baseName||e.baseAmi||e.amiName||e.amiSuffix||e.rootVolumeSize)}replaceStage(e){this.props.updateStage?this.props.updateStage(e):this.props.updateStageField(e)}updateStage(e){const t=jl({...this.props.stage,...e});if(this.replaceStage(t),this.setState({roscoMode:Zl(t)}),void 0!==e.baseOs){const a=this.computeVmTypes(this.state.baseOsOptions,e.baseOs);this.setState({vmTypes:a}),a.length&&!a.includes(t.vmType)&&this.updateStage({vmType:a[0]})}}updateExtendedAttribute(e,t){this.updateStage({extendedAttributes:{...this.props.stage.extendedAttributes||{},[e]:t}})}removeExtendedAttribute(e){const t={...this.props.stage.extendedAttributes||{}};delete t[e],this.updateStage({extendedAttributes:t})}addExtendedAttribute(){const e=this.state.extendedAttributeKey.trim();e&&(this.updateExtendedAttribute(e,this.state.extendedAttributeValue),this.setState({extendedAttributeKey:"",extendedAttributeValue:"",showAdvancedOptions:!0}))}renderDockerPreview(){const e=this.props.stage,t=!this.state.roscoMode&&_l(this.props.pipeline);/* @__PURE__ */
|
|
92
|
+
return qt.createElement(qt.Fragment,null,Cn.dockerBakeWarning&&/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning sp-margin-s-top horizontal middle"},/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"}),/* @__PURE__ */qt.createElement("div",{className:"sp-margin-s-left"},/* @__PURE__ */qt.createElement(Be,{message:Cn.dockerBakeWarning}))),/* @__PURE__ */qt.createElement("div",{className:"alert alert-info horizontal middle"},/* @__PURE__ */qt.createElement("i",{className:"fa fa-info-circle"}),/* @__PURE__ */qt.createElement("div",{className:"sp-margin-s-left"},/* @__PURE__ */qt.createElement(Be,{message:"To edit bake configuration or view advanced options, migrate to EBS store type."}))),t&&/* @__PURE__ */qt.createElement(qe,{label:"Store Type"},Wl.map(t=>/* @__PURE__ */qt.createElement("label",{className:"radio-inline",key:t},/* @__PURE__ */qt.createElement("input",{checked:e.storeType===t,name:"storeType",type:"radio",onChange:()=>this.updateStage({storeType:t})}),t.toUpperCase()))),/* @__PURE__ */qt.createElement(qe,{label:"Regions"},(e.regions||[]).map(e=>/* @__PURE__ */qt.createElement("span",{className:"sp-margin-xs-right",key:e},e))),/* @__PURE__ */qt.createElement(qe,{label:"Skip Region Detection"},String(!!e.skipRegionDetection)),/* @__PURE__ */qt.createElement(qe,{label:"Repo Path"},e.package),/* @__PURE__ */qt.createElement(qe,{label:"Base OS"},e.baseOs),/* @__PURE__ */qt.createElement(qe,{label:"VM Type"},e.vmType),/* @__PURE__ */qt.createElement(qe,{label:"Store Type"},e.storeType),/* @__PURE__ */qt.createElement(qe,{label:"Base Label"},e.baseLabel))}render(){if(this.state.loading)/* @__PURE__ */
|
|
93
93
|
return qt.createElement(me,null);if(this.state.loadError)/* @__PURE__ */
|
|
94
94
|
return qt.createElement("div",{className:"alert alert-danger"},"Unable to load bakery options.");const e=this.props.stage;if(function(e){return!!Cn.dockerBakeryDeprecated&&"docker"===e.storeType}(e))/* @__PURE__ */
|
|
95
|
-
return qt.createElement("div",{className:"form-horizontal"},this.renderDockerPreview());const t=
|
|
96
|
-
return qt.createElement("div",{className:"form-horizontal"},Cn.bakeWarning&&/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning sp-margin-s-top horizontal middle"},/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"}),/* @__PURE__ */qt.createElement("div",{className:"sp-margin-s-left"},/* @__PURE__ */qt.createElement(Be,{message:Cn.bakeWarning}))),/* @__PURE__ */qt.createElement(qe,{label:"Regions"},/* @__PURE__ */qt.createElement(Ae,{inline:!0,name:"regions",onChange:e=>this.updateStage({regions:e.target.value}),showSelectAll:!0,stringOptions:this.state.regions,value:e.regions||[]})),/* @__PURE__ */qt.createElement(qe,{label:"Skip Region Detection",helpKey:"pipeline.config.bake.skipRegionDetection"},/* @__PURE__ */qt.createElement("div",{className:"checkbox",style:{marginBottom:0}},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!!e.skipRegionDetection,type:"checkbox",onChange:e=>this.updateStage({skipRegionDetection:e.target.checked})}),"Only bake explicitly selected regions"))),/* @__PURE__ */qt.createElement(qe,{label:o,helpKey:"pipeline.config.bake.package"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.package||"",onChange:e=>this.updateStage({package:e.target.value})})),/* @__PURE__ */qt.createElement(qe,{label:"Base OS"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",value:e.baseOs||"",onChange:e=>this.updateStage({baseOs:e.target.value})},this.state.baseOsOptions.map(e=>/* @__PURE__ */qt.createElement("option",{key:e.id,value:e.id},function(e){const t=(null==e?void 0:e.displayName)||(null==e?void 0:e.id)||"";return(null==e?void 0:e.shortDescription)?`${t} (${e.shortDescription})`:t}(e))))),a&&/* @__PURE__ */qt.createElement(qe,{label:"VM Type"},this.state.vmTypes.map(t=>/* @__PURE__ */qt.createElement("label",{className:"radio-inline",key:t},/* @__PURE__ */qt.createElement("input",{checked:e.vmType===t,name:"vmType",type:"radio",onChange:()=>this.updateStage({vmType:t})}),t.toUpperCase()))),r&&/* @__PURE__ */qt.createElement(qe,{label:"Store Type"}
|
|
95
|
+
return qt.createElement("div",{className:"form-horizontal"},this.renderDockerPreview());const t=_l(this.props.pipeline),a=this.state.vmTypes.length>1&&t,n=!Cn.dockerBakeryDeprecated,r=!this.state.roscoMode&&t&&n,l=this.state.roscoMode||e.rebake,s=this.state.showAdvancedOptions,i=e.extendedAttributes||{},o="docker"===e.storeType?"Repo Path":"Package";/* @__PURE__ */
|
|
96
|
+
return qt.createElement("div",{className:"form-horizontal"},Cn.bakeWarning&&/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning sp-margin-s-top horizontal middle"},/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"}),/* @__PURE__ */qt.createElement("div",{className:"sp-margin-s-left"},/* @__PURE__ */qt.createElement(Be,{message:Cn.bakeWarning}))),/* @__PURE__ */qt.createElement(qe,{label:"Regions"},/* @__PURE__ */qt.createElement(Ae,{inline:!0,name:"regions",onChange:e=>this.updateStage({regions:e.target.value}),showSelectAll:!0,stringOptions:this.state.regions,value:e.regions||[]})),/* @__PURE__ */qt.createElement(qe,{label:"Skip Region Detection",helpKey:"pipeline.config.bake.skipRegionDetection"},/* @__PURE__ */qt.createElement("div",{className:"checkbox",style:{marginBottom:0}},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!!e.skipRegionDetection,type:"checkbox",onChange:e=>this.updateStage({skipRegionDetection:e.target.checked})}),"Only bake explicitly selected regions"))),/* @__PURE__ */qt.createElement(qe,{label:o,helpKey:"pipeline.config.bake.package"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.package||"",onChange:e=>this.updateStage({package:e.target.value})})),/* @__PURE__ */qt.createElement(qe,{label:"Base OS"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",value:e.baseOs||"",onChange:e=>this.updateStage({baseOs:e.target.value})},this.state.baseOsOptions.map(e=>/* @__PURE__ */qt.createElement("option",{key:e.id,value:e.id},function(e){const t=(null==e?void 0:e.displayName)||(null==e?void 0:e.id)||"";return(null==e?void 0:e.shortDescription)?`${t} (${e.shortDescription})`:t}(e))))),a&&/* @__PURE__ */qt.createElement(qe,{label:"VM Type"},this.state.vmTypes.map(t=>/* @__PURE__ */qt.createElement("label",{className:"radio-inline",key:t},/* @__PURE__ */qt.createElement("input",{checked:e.vmType===t,name:"vmType",type:"radio",onChange:()=>this.updateStage({vmType:t})}),t.toUpperCase()))),r&&/* @__PURE__ */qt.createElement(qe,{label:"Store Type"},Wl.map(t=>/* @__PURE__ */qt.createElement("label",{className:"radio-inline",key:t},/* @__PURE__ */qt.createElement("input",{checked:e.storeType===t,name:"storeType",type:"radio",onChange:()=>this.updateStage({storeType:t})}),t.toUpperCase()))),/* @__PURE__ */qt.createElement(qe,{label:"Base Label"},this.state.baseLabelOptions.map(t=>/* @__PURE__ */qt.createElement("label",{className:"radio-inline",key:t},/* @__PURE__ */qt.createElement("input",{checked:e.baseLabel===t,name:"baseLabel",type:"radio",onChange:()=>this.updateStage({baseLabel:t})}),t))),l&&/* @__PURE__ */qt.createElement(qe,{label:"Rebake"},/* @__PURE__ */qt.createElement("div",{className:"checkbox",style:{marginBottom:0}},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!!e.rebake,type:"checkbox",onChange:e=>this.updateStage({rebake:e.target.checked})}),"Rebake image without regard to the status of any existing bake"))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-9 col-md-offset-1"},/* @__PURE__ */qt.createElement("div",{className:"checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:this.state.showAdvancedOptions,type:"checkbox",onChange:e=>this.setState({showAdvancedOptions:e.target.checked})}),/* @__PURE__ */qt.createElement("strong",null,"Show Advanced Options"))))),s&&/* @__PURE__ */qt.createElement(qt.Fragment,null,t&&/* @__PURE__ */qt.createElement(qe,{label:"Template File Name",helpKey:"pipeline.config.bake.templateFileName"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.templateFileName||"",onChange:e=>this.updateStage({templateFileName:e.target.value})})),/* @__PURE__ */qt.createElement(qe,{label:"Extended Attributes",helpKey:"pipeline.config.bake.extendedAttributes"},/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed"},/* @__PURE__ */qt.createElement("thead",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("th",{style:{width:"40%"}},"Key"),/* @__PURE__ */qt.createElement("th",{style:{width:"60%"}},"Value"),/* @__PURE__ */qt.createElement("th",{className:"text-right"},"Actions"))),/* @__PURE__ */qt.createElement("tbody",null,Object.keys(i).map(e=>/* @__PURE__ */qt.createElement("tr",{key:e},/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("strong",{className:"small"},e)),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:i[e],onChange:t=>this.updateExtendedAttribute(e,t.target.value)})),/* @__PURE__ */qt.createElement("td",{className:"text-right"},/* @__PURE__ */qt.createElement("a",{className:"small",href:"",onClick:t=>{t.preventDefault(),this.removeExtendedAttribute(e)}},"Remove"))))),/* @__PURE__ */qt.createElement("tfoot",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",placeholder:"Key",value:this.state.extendedAttributeKey,onChange:e=>this.setState({extendedAttributeKey:e.target.value})})),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",placeholder:"Value",value:this.state.extendedAttributeValue,onChange:e=>this.setState({extendedAttributeValue:e.target.value})})),/* @__PURE__ */qt.createElement("td",{className:"text-right"},/* @__PURE__ */qt.createElement("button",{className:"btn btn-block btn-sm add-new",type:"button",onClick:()=>this.addExtendedAttribute()},
|
|
97
97
|
/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"})," Add Extended Attribute")))))),t&&/* @__PURE__ */qt.createElement(qe,{label:"Var File Name",helpKey:"pipeline.config.bake.varFileName"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.varFileName||"",onChange:e=>this.updateStage({varFileName:e.target.value})})),!!Cn.minRootVolumeSize&&t&&/* @__PURE__ */qt.createElement(qe,{label:"Root Volume Size"},/* @__PURE__ */qt.createElement("input",{type:"number",className:"form-control input-sm",style:{width:80,display:"inline-block"},min:Cn.minRootVolumeSize,value:e.rootVolumeSize||"",onChange:e=>this.updateStage({rootVolumeSize:e.target.value})})," ","GB ",/* @__PURE__ */qt.createElement("span",{className:"small"},"(minimum: ",Cn.minRootVolumeSize,")")),"docker"!==e.storeType&&t&&/* @__PURE__ */qt.createElement(qe,{label:"Base Name"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.baseName||"",onChange:e=>this.updateStage({baseName:e.target.value})})),"docker"!==e.storeType&&t&&/* @__PURE__ */qt.createElement(qe,{label:"Base AMI",helpKey:"pipeline.config.bake.baseAmi"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.baseAmi||"",onChange:e=>this.updateStage({baseAmi:e.target.value})})),t&&/* @__PURE__ */qt.createElement(qe,{label:"docker"===e.storeType?"Docker Image Name":"AMI Name",helpKey:"pipeline.config.bake.amiName"},
|
|
98
98
|
/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.amiName||"",onChange:e=>this.updateStage({amiName:e.target.value})})),t&&/* @__PURE__ */qt.createElement(qe,{label:"docker"===e.storeType?"Docker Image Prefix":"AMI Suffix",helpKey:"pipeline.config.bake.amiSuffix"},
|
|
99
|
-
/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.amiSuffix||"",onChange:e=>this.updateStage({amiSuffix:e.target.value})}))))}}function
|
|
100
|
-
return qt.createElement(_e,{name:a,current:e},/* @__PURE__ */qt.createElement("div",{className:"row"},/* @__PURE__ */qt.createElement("div",{className:"col-md-6"},/* @__PURE__ */qt.createElement("dl",{className:"dl-narrow dl-horizontal"},/* @__PURE__ */qt.createElement("dt",null,"Image"),/* @__PURE__ */qt.createElement("dd",null,d.ami),/* @__PURE__ */qt.createElement("dt",null,"Region"),/* @__PURE__ */qt.createElement("dd",null,d.region),/* @__PURE__ */qt.createElement("dt",null,"Package"),/* @__PURE__ */qt.createElement("dd",null,d.package))),/* @__PURE__ */qt.createElement("div",{className:"col-md-6"},/* @__PURE__ */qt.createElement("dl",{className:"dl-narrow dl-horizontal"},/* @__PURE__ */qt.createElement("dt",null,"Base OS"),/* @__PURE__ */qt.createElement("dd",null,d.baseOs),/* @__PURE__ */qt.createElement("dt",null,"VM Type"),/* @__PURE__ */qt.createElement("dd",null,(d.vmType||"").toUpperCase()),!m&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("dt",null,"Store Type"),/* @__PURE__ */qt.createElement("dd",null,(d.storeType||"").toUpperCase()),/* @__PURE__ */qt.createElement("dt",null,"Label"),/* @__PURE__ */qt.createElement("dd",null,d.baseLabel)),u&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("dt",null,"Rebake"),/* @__PURE__ */qt.createElement("dd",null,String((null==(i=null==t?void 0:t.trigger)?void 0:i.rebake)||d.rebake||!1))),d.templateFileName&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("dt",null,"Template"),/* @__PURE__ */qt.createElement("dd",null,d.templateFileName)),d.varFileName&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("dt",null,"Var File"),/* @__PURE__ */qt.createElement("dd",null,d.varFileName))))),/* @__PURE__ */qt.createElement(Ke,{stage:n,message:n.failureMessage}),d.region&&(null==(c=d.status)?void 0:c.resourceId)&&/* @__PURE__ */qt.createElement("div",{className:"row"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("div",{className:"alert alert-"+(n.isFailed?"danger":"info")},d.previouslyBaked&&/* @__PURE__ */qt.createElement("div",null,"No changes detected; reused existing bake"),d.imageName&&/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("strong",null,"Image:"),/* @__PURE__ */qt.createElement("div",null,d.imageName),/* @__PURE__ */qt.createElement("div",null,"(",d.ami,")")),p&&/* @__PURE__ */qt.createElement("span",null,"Bake failed. "),/* @__PURE__ */qt.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:h},"View Bakery Details"),p&&/* @__PURE__ */qt.createElement("span",null," for more info.")))))}
|
|
101
|
-
return qt.createElement("div",{className:"form-horizontal"},!a.strategy&&/* @__PURE__ */qt.createElement(Je,{accounts:s,application:t,clusterField:"targetCluster",component:n,onComponentUpdate:r,singleRegion:"true"}),/* @__PURE__ */qt.createElement(qe,{label:"Target"},/* @__PURE__ */qt.createElement(Qe,{model:{target:n.target},onChange:e=>l({target:e}),options:Ye.TARGET_LIST})),/* @__PURE__ */qt.createElement(qe,{label:"Capacity"},/* @__PURE__ */qt.createElement("div",{className:"radio"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!1!==n.useSourceCapacity,onChange:()=>l({useSourceCapacity:!0,capacity:void 0}),type:"radio"}),"Copy the capacity from the current server group ",/* @__PURE__ */qt.createElement(c,{id:"serverGroupCapacity.useSourceCapacityTrue"}))),/* @__PURE__ */qt.createElement("div",{className:"radio"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!1===n.useSourceCapacity,onChange:()=>l({useSourceCapacity:!1}),type:"radio"}),"Let me specify the capacity ",/* @__PURE__ */qt.createElement(c,{id:"serverGroupCapacity.useSourceCapacityFalse"})))),!1===n.useSourceCapacity&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-2 col-md-offset-3"},"Min"),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Max"),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Desired")),/* @__PURE__ */qt.createElement("div",{className:"form-group"},
|
|
102
|
-
return qt.createElement("div",{className:"col-md-2",style:"min"===e?{marginLeft:"25%"}:void 0,key:e},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",onChange:t=>l({capacity:{...n.capacity,[e]:""===t.target.value?void 0:Number(t.target.value)}}),required:!0,type:"number",value:null!=(a=null==(t=n.capacity)?void 0:t[e])?a:""}))}))),/* @__PURE__ */qt.createElement(qe,{label:"Traffic",helpKey:"aws.serverGroup.traffic"},/* @__PURE__ */qt.createElement("div",{className:"checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!(n.suspendedProcesses||[]).includes("AddToLoadBalancer"),onChange:()=>(e=>{const t=n.suspendedProcesses?[...n.suspendedProcesses]:[],a=t.indexOf(e);-1===a?t.push(e):t.splice(a,1),l({suspendedProcesses:t})})("AddToLoadBalancer"),type:"checkbox"}),"Send client requests to new instances"))),/* @__PURE__ */qt.createElement(qe,{label:"AMI Block Device Mappings"},/* @__PURE__ */qt.createElement("div",{className:"radio"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:"source"===o,name:"blockDeviceMappingsSource",onChange:()=>d("source"),type:"radio"}),"Copy from current server group ",/* @__PURE__ */qt.createElement(c,{id:"aws.blockDeviceMappings.useSource"}))),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:"ami"===o,name:"blockDeviceMappingsSource",onChange:()=>d("ami"),type:"radio"}),"Prefer AMI block device mappings ",/* @__PURE__ */qt.createElement(c,{id:"aws.blockDeviceMappings.useAMI"}))),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:"default"===o,name:"blockDeviceMappingsSource",onChange:()=>d("default"),type:"radio"}),"Defaults for selected instance type ",/* @__PURE__ */qt.createElement(c,{id:"aws.blockDeviceMappings.useDefaults"}))))),t.attributes.platformHealthOnlyShowOverride&&/* @__PURE__ */qt.createElement(qe,{label:"Task Completion"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:n.interestingHealthProviderNames||[],onChange:e=>l({interestingHealthProviderNames:e}),platformHealthType:"Amazon"})),/* @__PURE__ */qt.createElement(tt,{command:n,fieldColumns:"6",onFieldChange:(e,t)=>{ha(n,e,t),r()},onStrategyChange:()=>r()}))},accountExtractor:e=>[e.context.credentials],validators:[{type:"requiredField",fieldName:"targetCluster",fieldLabel:"cluster"},{type:"requiredField",fieldName:"target"},{type:"requiredField",fieldName:"region"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}]};function
|
|
103
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("b",null," ",this.state.label," "),/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("small",null," ",this.state.description," "))}}function
|
|
104
|
-
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement(u,{label:"Account",name:"account",onChange:(t,a)=>{e.formik.setFieldValue("region",null),e.formik.setFieldValue("functionName",null),e.formik.setFieldValue(t,a)},required:!0,input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,isLoading:"PENDING"===r,stringOptions:n.map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Region",name:"region",onChange:(t,a)=>{e.formik.setFieldValue("functionName",null),e.formik.setFieldValue(t,a)},input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!t.account,placeholder:t.account?"Select...":"Select an Account...",...e,isLoading:"PENDING"===r,stringOptions:n.filter(e=>e.name===t.account).flatMap(e=>e.regions).map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Function Name",name:"functionName",input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!(t.account&&t.region),placeholder:t.account&&t.region?"Select...":"Select an Account and Region...",...e,stringOptions:l})}),/* @__PURE__ */qt.createElement(u,{label:"Target Version",name:"version",input:t=>/* @__PURE__ */qt.createElement(g,{...t,clearable:!1,options:
|
|
105
|
-
return qt.createElement(_e,{name:a,current:n},/* @__PURE__ */qt.createElement(Ke,{stage:t,message:t.outputs.failureMessage}),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null," ",/* @__PURE__ */qt.createElement("b",null," Status: ")," ","done"===t.outputs.deleteTask?"COMPLETE":t.outputs.deleteTask," "),/* @__PURE__ */qt.createElement("p",null," ",/* @__PURE__ */qt.createElement("b",null," Deleted Version: ")," ",t.outputs["deleteTask:deleteVersion"]?t.outputs["deleteTask:deleteVersion"]:"N/A"," ")))}function
|
|
106
|
-
return qt.createElement("div",{className:"DeleteLambdaStageConfig"},/* @__PURE__ */qt.createElement(at,{...e,validate:
|
|
107
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("hr",null),/* @__PURE__ */qt.createElement("h4",null,"ChangeSet Configuration"),/* @__PURE__ */qt.createElement(qe,{label:"ChangeSet Name"},/* @__PURE__ */qt.createElement(p,{className:"form-control",type:"text",value:n,onChange:e=>{return t=e.target.value,void a({changeSetName:t});var t}})),/* @__PURE__ */qt.createElement(qe,{label:"Execute ChangeSet"},/* @__PURE__ */qt.createElement(v,{checked:t.executeChangeSet,onChange:e=>{return t=e.target.checked,void a({executeChangeSet:t});var t}})),t.executeChangeSet&&/* @__PURE__ */qt.createElement(qe,{label:"If ChangeSet contains a replacement",helpKey:"aws.cloudformation.changeSet.options"},/* @__PURE__ */qt.createElement(g,{clearable:!1,value:t.actionOnReplacement,options:[{value:"ask",label:"ask"},{value:"skip",label:"skip it"},{value:"execute",label:"execute it"},{value:"fail",label:"fail stage"}],onChange:e=>{return t=e.target.value,void a({actionOnReplacement:t});var t}})))},
|
|
108
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("h4",null,"Basic Settings"),/* @__PURE__ */qt.createElement(qe,{label:"Account"},/* @__PURE__ */qt.createElement(Fe,{accounts:v,name:"credentials",onChange:e=>n({credentials:e.target.value,account:e.target.value}),provider:"aws",value:p})),/* @__PURE__ */qt.createElement(qe,{label:"Regions"},/* @__PURE__ */qt.createElement(Ae,{inline:!0,name:"regions",onChange:e=>n({regions:e.target.value}),showSelectAll:!0,stringOptions:f,value:a.regions||[]})),/* @__PURE__ */qt.createElement("h4",null,"Template Configuration"),/* @__PURE__ */qt.createElement(qe,{label:"Stack name"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",name:"stackName",onChange:e=>n({stackName:e.target.value}),required:!0,type:"text",value:a.stackName||""}),/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!!a.isChangeSet,name:"isChangeSet",onChange:e=>n({isChangeSet:e.target.checked}),type:"checkbox"})," ",/* @__PURE__ */qt.createElement("strong",null,"Create CloudFormation ChangeSet"))),/* @__PURE__ */qt.createElement(qe,{label:"IAM role ARN"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",name:"roleARN",onChange:e=>n({roleARN:e.target.value}),type:"text",value:a.roleARN||""})),/* @__PURE__ */qt.createElement(qe,{label:"Source",helpKey:"aws.cloudformation.source"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:"text"===u,name:"source",onChange:()=>n({source:"text",stackArtifactId:null,stackArtifactAccount:null,stackArtifact:null}),type:"radio",value:"text"})," ","Text"),/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:"artifact"===u,name:"source",onChange:()=>n({source:"artifact"}),type:"radio",value:"artifact"})," ","Artifact")),"text"===u&&/* @__PURE__ */qt.createElement(nt,{ariaLabel:"CloudFormation template YAML",onChange:(e,t)=>{m({refId:a.refId,rawTemplateBody:e}),null!==t&&n({templateBody:t})},value:d.rawTemplateBody}),"artifact"===u&&/* @__PURE__ */qt.createElement(rt,{artifact:a.stackArtifact,excludedArtifactTypePatterns:[],expectedArtifactId:a.stackArtifactId,fieldColumns:8,helpKey:"aws.cloudformation.expectedArtifact",label:"Expected Artifact",onArtifactEdited:e=>{n({stackArtifactId:null,stackArtifact:e})},onExpectedArtifactSelected:e=>{var t;n({stackArtifactId:e.id,stackArtifactAccount:(null==(t=e.matchArtifact)?void 0:t.artifactAccount)||null,stackArtifact:null})},pipeline:t,stage:a}),a.isChangeSet&&/* @__PURE__ */qt.createElement(
|
|
109
|
-
return Ht.createElement(_e,{name:a,current:t},/* @__PURE__ */Ht.createElement(it,{item:e}),/* @__PURE__ */Ht.createElement(Ke,{stage:e,message:e.failureMessage}))}};
|
|
110
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null,"This ChangeSet contains a replacement, which means there will be ",/* @__PURE__ */qt.createElement("b",null,"potential data loss")," when executed."),/* @__PURE__ */qt.createElement("p",null,"How do you want to proceed?"),/* @__PURE__ */qt.createElement("div",{className:"action-buttons"},/* @__PURE__ */qt.createElement("button",{className:"btn btn-danger",onClick:()=>{m("execute")},disabled:l},u("Execute")&&/* @__PURE__ */qt.createElement(me,{mode:"circular"}),a.context.stopButtonLabel||"Execute"),/* @__PURE__ */qt.createElement("button",{className:"btn btn-primary",disabled:l,onClick:()=>{m("skip")}},u("Skip")&&/* @__PURE__ */qt.createElement(me,{mode:"circular"}),a.context.skipButtonLabel||"Skip"),/* @__PURE__ */qt.createElement("button",{className:"btn btn-primary",disabled:l,onClick:()=>{m("fail")}},u("Fail")&&/* @__PURE__ */qt.createElement(me,{mode:"circular"}),a.context.FailButtonLabel||"Fail"))),c&&/* @__PURE__ */qt.createElement("div",{className:"error-message"},"There was an error recording your decision. Please try again."))},
|
|
111
|
-
return Ht.createElement(_e,{name:r,current:n},s?/* @__PURE__ */Ht.createElement(
|
|
112
|
-
return Ht.createElement(ot,{...this.props});const{stage:e}=this.props;if(e.isRunning&&e.stages[0].context.changeSetContainsReplacement&&"ask"===e.stages[0].context.actionOnReplacement){const t=/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("b",null,e.name)),/* @__PURE__ */Ht.createElement(
|
|
99
|
+
/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.amiSuffix||"",onChange:e=>this.updateStage({amiSuffix:e.target.value})}))))}}function Yl({current:e,execution:t,name:a,stage:n}){var r,l,s,i,c;const d=n.context||{},m=Zl(d),u=m||(null==(r=null==t?void 0:t.trigger)?void 0:r.rebake)||d.rebake,p="FAILURE"===(null==(l=d.status)?void 0:l.result)&&!n.failureMessage,h=((m&&o.roscoDetailUrl?o.roscoDetailUrl:o.bakeryDetailUrl)||"").replace(/\{\{\s*context\.region\s*\}\}/g,d.region||"").replace(/\{\{\s*context\.status\.resourceId\s*\}\}/g,(null==(s=d.status)?void 0:s.resourceId)||"");/* @__PURE__ */
|
|
100
|
+
return qt.createElement(_e,{name:a,current:e},/* @__PURE__ */qt.createElement("div",{className:"row"},/* @__PURE__ */qt.createElement("div",{className:"col-md-6"},/* @__PURE__ */qt.createElement("dl",{className:"dl-narrow dl-horizontal"},/* @__PURE__ */qt.createElement("dt",null,"Image"),/* @__PURE__ */qt.createElement("dd",null,d.ami),/* @__PURE__ */qt.createElement("dt",null,"Region"),/* @__PURE__ */qt.createElement("dd",null,d.region),/* @__PURE__ */qt.createElement("dt",null,"Package"),/* @__PURE__ */qt.createElement("dd",null,d.package))),/* @__PURE__ */qt.createElement("div",{className:"col-md-6"},/* @__PURE__ */qt.createElement("dl",{className:"dl-narrow dl-horizontal"},/* @__PURE__ */qt.createElement("dt",null,"Base OS"),/* @__PURE__ */qt.createElement("dd",null,d.baseOs),/* @__PURE__ */qt.createElement("dt",null,"VM Type"),/* @__PURE__ */qt.createElement("dd",null,(d.vmType||"").toUpperCase()),!m&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("dt",null,"Store Type"),/* @__PURE__ */qt.createElement("dd",null,(d.storeType||"").toUpperCase()),/* @__PURE__ */qt.createElement("dt",null,"Label"),/* @__PURE__ */qt.createElement("dd",null,d.baseLabel)),u&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("dt",null,"Rebake"),/* @__PURE__ */qt.createElement("dd",null,String((null==(i=null==t?void 0:t.trigger)?void 0:i.rebake)||d.rebake||!1))),d.templateFileName&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("dt",null,"Template"),/* @__PURE__ */qt.createElement("dd",null,d.templateFileName)),d.varFileName&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("dt",null,"Var File"),/* @__PURE__ */qt.createElement("dd",null,d.varFileName))))),/* @__PURE__ */qt.createElement(Ke,{stage:n,message:n.failureMessage}),d.region&&(null==(c=d.status)?void 0:c.resourceId)&&/* @__PURE__ */qt.createElement("div",{className:"row"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("div",{className:"alert alert-"+(n.isFailed?"danger":"info")},d.previouslyBaked&&/* @__PURE__ */qt.createElement("div",null,"No changes detected; reused existing bake"),d.imageName&&/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("strong",null,"Image:"),/* @__PURE__ */qt.createElement("div",null,d.imageName),/* @__PURE__ */qt.createElement("div",null,"(",d.ami,")")),p&&/* @__PURE__ */qt.createElement("span",null,"Bake failed. "),/* @__PURE__ */qt.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:h},"View Bakery Details"),p&&/* @__PURE__ */qt.createElement("span",null," for more info.")))))}Yl.title="bakeConfig";const Xl={key:"bake",provides:"bake",cloudProvider:"aws",label:"Bake",description:"Bakes an image",component:Kl,executionDetailsSections:[Yl,Ze],executionLabelComponent:je,extraLabelLines:e=>e.masterStage.context.allPreviouslyBaked||e.masterStage.context.somePreviouslyBaked?1:0,supportsCustomTimeout:!0,validators:[{type:"requiredField",fieldName:"package"},{type:"requiredField",fieldName:"regions"},{type:"upstreamVersionProvided",checkParentTriggers:!0,getMessage:e=>"Bake stages should always have a stage or trigger preceding them that provides version information: <ul>"+e.map(e=>`<li>${e}</li>`).join("")+"</ul>Otherwise, Spinnaker will bake and deploy the most-recently built package."}],restartable:!0};function Jl(){We.pipeline.registerStage(Xl)}Jl();const Ql=["min","max","desired"];const es={key:"cloneServerGroup",provides:"cloneServerGroup",cloudProvider:"aws",component:function(e){const{application:t,pipeline:a,stage:n,stageFieldUpdated:r,updateStageField:l}=e,[s,i]=Wt([]);jt(()=>{var e;const a={};n.application||(a.application=t.name),"aws"!==n.cloudProvider&&(a.cloudProvider="aws"),"aws"!==n.cloudProviderType&&(a.cloudProviderType="aws"),!n.credentials&&(null==(e=t.defaultCredentials)?void 0:e.aws)&&(a.credentials=t.defaultCredentials.aws),void 0===n.target&&(a.target=Ye.TARGET_LIST[0].val),void 0===n.useSourceCapacity&&(a.useSourceCapacity=!0),n.isNew&&t.attributes.platformHealthOnlyShowOverride&&t.attributes.platformHealthOnly&&void 0===n.interestingHealthProviderNames&&(a.interestingHealthProviderNames=["Amazon"]),n.isNew&&(a.useAmiBlockDeviceMappings=ca(t,"attributes.providerSettings.aws.useAmiBlockDeviceMappings",!1),a.copySourceCustomBlockDeviceMappings=!1),Object.keys(a).length&&l(a)},[]),jt(()=>{let e=!0;return h.listAccounts("aws").then(t=>e&&i(t)),()=>{e=!1}},[]),jt(()=>{if(n.targetCluster){const e=Xe.monikerClusterNameFilter(n.targetCluster),a=Xe.getMonikers([t],e)[0];if(a)l({stack:a.stack,freeFormDetails:a.detail});else{const e=pe.parseClusterName(n.targetCluster);l({stack:e.stack,freeFormDetails:e.freeFormDetails})}}else(n.stack||n.freeFormDetails)&&l({stack:"",freeFormDetails:""})},[n.targetCluster]);const o=n.copySourceCustomBlockDeviceMappings?"source":n.useAmiBlockDeviceMappings?"ami":"default",d=e=>{l("source"===e?{copySourceCustomBlockDeviceMappings:!0,useAmiBlockDeviceMappings:!1}:"ami"===e?{copySourceCustomBlockDeviceMappings:!1,useAmiBlockDeviceMappings:!0}:{copySourceCustomBlockDeviceMappings:!1,useAmiBlockDeviceMappings:!1})};/* @__PURE__ */
|
|
101
|
+
return qt.createElement("div",{className:"form-horizontal"},!a.strategy&&/* @__PURE__ */qt.createElement(Je,{accounts:s,application:t,clusterField:"targetCluster",component:n,onComponentUpdate:r,singleRegion:"true"}),/* @__PURE__ */qt.createElement(qe,{label:"Target"},/* @__PURE__ */qt.createElement(Qe,{model:{target:n.target},onChange:e=>l({target:e}),options:Ye.TARGET_LIST})),/* @__PURE__ */qt.createElement(qe,{label:"Capacity"},/* @__PURE__ */qt.createElement("div",{className:"radio"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!1!==n.useSourceCapacity,onChange:()=>l({useSourceCapacity:!0,capacity:void 0}),type:"radio"}),"Copy the capacity from the current server group ",/* @__PURE__ */qt.createElement(c,{id:"serverGroupCapacity.useSourceCapacityTrue"}))),/* @__PURE__ */qt.createElement("div",{className:"radio"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!1===n.useSourceCapacity,onChange:()=>l({useSourceCapacity:!1}),type:"radio"}),"Let me specify the capacity ",/* @__PURE__ */qt.createElement(c,{id:"serverGroupCapacity.useSourceCapacityFalse"})))),!1===n.useSourceCapacity&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-2 col-md-offset-3"},"Min"),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Max"),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Desired")),/* @__PURE__ */qt.createElement("div",{className:"form-group"},Ql.map(e=>{var t,a;/* @__PURE__ */
|
|
102
|
+
return qt.createElement("div",{className:"col-md-2",style:"min"===e?{marginLeft:"25%"}:void 0,key:e},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",onChange:t=>l({capacity:{...n.capacity,[e]:""===t.target.value?void 0:Number(t.target.value)}}),required:!0,type:"number",value:null!=(a=null==(t=n.capacity)?void 0:t[e])?a:""}))}))),/* @__PURE__ */qt.createElement(qe,{label:"Traffic",helpKey:"aws.serverGroup.traffic"},/* @__PURE__ */qt.createElement("div",{className:"checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!(n.suspendedProcesses||[]).includes("AddToLoadBalancer"),onChange:()=>(e=>{const t=n.suspendedProcesses?[...n.suspendedProcesses]:[],a=t.indexOf(e);-1===a?t.push(e):t.splice(a,1),l({suspendedProcesses:t})})("AddToLoadBalancer"),type:"checkbox"}),"Send client requests to new instances"))),/* @__PURE__ */qt.createElement(qe,{label:"AMI Block Device Mappings"},/* @__PURE__ */qt.createElement("div",{className:"radio"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:"source"===o,name:"blockDeviceMappingsSource",onChange:()=>d("source"),type:"radio"}),"Copy from current server group ",/* @__PURE__ */qt.createElement(c,{id:"aws.blockDeviceMappings.useSource"}))),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:"ami"===o,name:"blockDeviceMappingsSource",onChange:()=>d("ami"),type:"radio"}),"Prefer AMI block device mappings ",/* @__PURE__ */qt.createElement(c,{id:"aws.blockDeviceMappings.useAMI"}))),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:"default"===o,name:"blockDeviceMappingsSource",onChange:()=>d("default"),type:"radio"}),"Defaults for selected instance type ",/* @__PURE__ */qt.createElement(c,{id:"aws.blockDeviceMappings.useDefaults"}))))),t.attributes.platformHealthOnlyShowOverride&&/* @__PURE__ */qt.createElement(qe,{label:"Task Completion"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:n.interestingHealthProviderNames||[],onChange:e=>l({interestingHealthProviderNames:e}),platformHealthType:"Amazon"})),/* @__PURE__ */qt.createElement(tt,{command:n,fieldColumns:"6",onFieldChange:(e,t)=>{ha(n,e,t),r()},onStrategyChange:()=>r()}))},accountExtractor:e=>[e.context.credentials],validators:[{type:"requiredField",fieldName:"targetCluster",fieldLabel:"cluster"},{type:"requiredField",fieldName:"target"},{type:"requiredField",fieldName:"region"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}]};function ts(){We.pipeline.registerStage(es)}ts();const as=[{label:"Newest Function Version",value:"$LATEST",description:"Delete the most recently deployed function version when this stage starts."},{label:"Previous Function Version",value:"$PREVIOUS",description:"Delete the second-most recently deployed function version when this stage starts."},{label:"Older Than N",value:"$MOVING",description:"Delete all version but the N most recent versions."},{label:"Provide Version Number",value:"$PROVIDED",description:"Provide a specific version number to delete."},{label:"All Function Versions",value:"$ALL",description:"Delete all function versions and function infrastructure. This will completely delete the Lambda function."}];class ns extends qt.Component{constructor(e){super(e);const{value:t}=this.props,a=as.filter(e=>e.value===t)[0];this.state={label:a.label,value:a.value,description:a.description}}render(){/* @__PURE__ */
|
|
103
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("b",null," ",this.state.label," "),/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("small",null," ",this.state.description," "))}}function rs(e){const{values:t}=e.formik,{functions:a}=e.application,{result:n,status:r}=b(()=>h.listAccounts("aws"),[],[]),l=t.account&&t.region?a.data.filter(e=>e.account===t.account).filter(e=>e.region===t.region).map(e=>e.functionName):[];/* @__PURE__ */
|
|
104
|
+
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement(u,{label:"Account",name:"account",onChange:(t,a)=>{e.formik.setFieldValue("region",null),e.formik.setFieldValue("functionName",null),e.formik.setFieldValue(t,a)},required:!0,input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,isLoading:"PENDING"===r,stringOptions:n.map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Region",name:"region",onChange:(t,a)=>{e.formik.setFieldValue("functionName",null),e.formik.setFieldValue(t,a)},input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!t.account,placeholder:t.account?"Select...":"Select an Account...",...e,isLoading:"PENDING"===r,stringOptions:n.filter(e=>e.name===t.account).flatMap(e=>e.regions).map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Function Name",name:"functionName",input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!(t.account&&t.region),placeholder:t.account&&t.region?"Select...":"Select an Account and Region...",...e,stringOptions:l})}),/* @__PURE__ */qt.createElement(u,{label:"Target Version",name:"version",input:t=>/* @__PURE__ */qt.createElement(g,{...t,clearable:!1,options:as,optionRenderer:t=>/* @__PURE__ */qt.createElement(ns,{config:e,value:t.value,showingDetails:!0})})}),"$PROVIDED"===t.version?/* @__PURE__ */qt.createElement(u,{label:"Version Number",name:"versionNumber",input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,stringOptions:a.data.filter(e=>e.account===t.account).filter(e=>e.region===t.region).filter(e=>e.functionName===t.functionName).flatMap(e=>Object.values(e.revisions).sort(function(e,t){return t-e})).filter(e=>"$LATEST"!==e)})}):null,"$MOVING"===t.version?/* @__PURE__ */qt.createElement(u,{name:"retentionNumber",help:/* @__PURE__ */qt.createElement(c,{content:"The number of Lambda versions to retain"}),label:"Prior Versions to Retain",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:1,max:100})}):null)}function ls(e){const{stage:t,name:a,current:n}=e;/* @__PURE__ */
|
|
105
|
+
return qt.createElement(_e,{name:a,current:n},/* @__PURE__ */qt.createElement(Ke,{stage:t,message:t.outputs.failureMessage}),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null," ",/* @__PURE__ */qt.createElement("b",null," Status: ")," ","done"===t.outputs.deleteTask?"COMPLETE":t.outputs.deleteTask," "),/* @__PURE__ */qt.createElement("p",null," ",/* @__PURE__ */qt.createElement("b",null," Deleted Version: ")," ",t.outputs["deleteTask:deleteVersion"]?t.outputs["deleteTask:deleteVersion"]:"N/A"," ")))}function ss(e){const t=new m(e);return t.field("account","Account Name").required(),t.field("region","Region").required(),t.field("functionName","Lambda Function Name").required(),t.field("version","Lambda Function Version").required(),t.validateForm()}(ls||(ls={})).title="Delete Lambda Stage";const is={key:"Aws.LambdaDeleteStage",label:"AWS Lambda Delete",description:"Delete an AWS Lambda Function",component:function(e){/* @__PURE__ */
|
|
106
|
+
return qt.createElement("div",{className:"DeleteLambdaStageConfig"},/* @__PURE__ */qt.createElement(at,{...e,validate:ss,onChange:e.updateStage,render:e=>/* @__PURE__ */qt.createElement(rs,{...e})}))},executionDetailsSections:[ls,Ze],validateFn:ss};function os(){o.feature.lambdaAdditionalStages&&We.pipeline.registerStage(is)}const cs=e=>{const{stage:t,updateStageField:a}=e,n=t.changeSetName||"ChangeSet-${execution['id']}";/* @__PURE__ */
|
|
107
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("hr",null),/* @__PURE__ */qt.createElement("h4",null,"ChangeSet Configuration"),/* @__PURE__ */qt.createElement(qe,{label:"ChangeSet Name"},/* @__PURE__ */qt.createElement(p,{className:"form-control",type:"text",value:n,onChange:e=>{return t=e.target.value,void a({changeSetName:t});var t}})),/* @__PURE__ */qt.createElement(qe,{label:"Execute ChangeSet"},/* @__PURE__ */qt.createElement(v,{checked:t.executeChangeSet,onChange:e=>{return t=e.target.checked,void a({executeChangeSet:t});var t}})),t.executeChangeSet&&/* @__PURE__ */qt.createElement(qe,{label:"If ChangeSet contains a replacement",helpKey:"aws.cloudformation.changeSet.options"},/* @__PURE__ */qt.createElement(g,{clearable:!1,value:t.actionOnReplacement,options:[{value:"ask",label:"ask"},{value:"skip",label:"skip it"},{value:"execute",label:"execute it"},{value:"fail",label:"fail stage"}],onChange:e=>{return t=e.target.value,void a({actionOnReplacement:t});var t}})))},ds=["CAPABILITY_IAM","CAPABILITY_NAMED_IAM","CAPABILITY_AUTO_EXPAND"];function ms(e){return"string"==typeof e?e:null==e?"":st(Array.isArray(e)?e:[e])}function us({application:e,pipeline:t,stage:a,updateStageField:n}){var r,l;const[s,i]=qt.useState([]),[o,c]=qt.useState([]),[d,m]=qt.useState(()=>({refId:a.refId,rawTemplateBody:ms(a.templateBody)})),u=a.source||"text",p=a.credentials||a.account||"",v=[p,...s.map(e=>e.name)].filter((e,t,a)=>e&&a.indexOf(e)===t),f=[...a.regions||[],...o].filter((e,t,a)=>e&&a.indexOf(e)===t);d.refId!==a.refId&&m({refId:a.refId,rawTemplateBody:ms(a.templateBody)}),qt.useEffect(()=>{var t,r;const l={},s={capabilities:[],cloudProvider:"aws",parameters:{},regions:(null==(t=e.defaultRegions)?void 0:t.aws)?[e.defaultRegions.aws]:[],source:"text",tags:{}};Object.entries(s).forEach(([e,t])=>{void 0===a[e]&&(l[e]=t)});const i=null==(r=e.defaultCredentials)?void 0:r.aws;i&&(void 0===a.credentials&&(l.credentials=i),void 0===a.account&&(l.account=i)),Object.keys(l).length&&n(l)},[]),qt.useEffect(()=>{let e=!0;return Promise.all([h.getAllAccountDetailsForProvider("aws"),h.getUniqueAttributeForAllAccounts("aws","regions")]).then(([t,a])=>{e&&(i(t),c(a))}),()=>{e=!1}},[]);/* @__PURE__ */
|
|
108
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("h4",null,"Basic Settings"),/* @__PURE__ */qt.createElement(qe,{label:"Account"},/* @__PURE__ */qt.createElement(Fe,{accounts:v,name:"credentials",onChange:e=>n({credentials:e.target.value,account:e.target.value}),provider:"aws",value:p})),/* @__PURE__ */qt.createElement(qe,{label:"Regions"},/* @__PURE__ */qt.createElement(Ae,{inline:!0,name:"regions",onChange:e=>n({regions:e.target.value}),showSelectAll:!0,stringOptions:f,value:a.regions||[]})),/* @__PURE__ */qt.createElement("h4",null,"Template Configuration"),/* @__PURE__ */qt.createElement(qe,{label:"Stack name"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",name:"stackName",onChange:e=>n({stackName:e.target.value}),required:!0,type:"text",value:a.stackName||""}),/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!!a.isChangeSet,name:"isChangeSet",onChange:e=>n({isChangeSet:e.target.checked}),type:"checkbox"})," ",/* @__PURE__ */qt.createElement("strong",null,"Create CloudFormation ChangeSet"))),/* @__PURE__ */qt.createElement(qe,{label:"IAM role ARN"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",name:"roleARN",onChange:e=>n({roleARN:e.target.value}),type:"text",value:a.roleARN||""})),/* @__PURE__ */qt.createElement(qe,{label:"Source",helpKey:"aws.cloudformation.source"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:"text"===u,name:"source",onChange:()=>n({source:"text",stackArtifactId:null,stackArtifactAccount:null,stackArtifact:null}),type:"radio",value:"text"})," ","Text"),/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:"artifact"===u,name:"source",onChange:()=>n({source:"artifact"}),type:"radio",value:"artifact"})," ","Artifact")),"text"===u&&/* @__PURE__ */qt.createElement(nt,{ariaLabel:"CloudFormation template YAML",onChange:(e,t)=>{m({refId:a.refId,rawTemplateBody:e}),null!==t&&n({templateBody:t})},value:d.rawTemplateBody}),"artifact"===u&&/* @__PURE__ */qt.createElement(rt,{artifact:a.stackArtifact,excludedArtifactTypePatterns:[],expectedArtifactId:a.stackArtifactId,fieldColumns:8,helpKey:"aws.cloudformation.expectedArtifact",label:"Expected Artifact",onArtifactEdited:e=>{n({stackArtifactId:null,stackArtifact:e})},onExpectedArtifactSelected:e=>{var t;n({stackArtifactId:e.id,stackArtifactAccount:(null==(t=e.matchArtifact)?void 0:t.artifactAccount)||null,stackArtifact:null})},pipeline:t,stage:a}),a.isChangeSet&&/* @__PURE__ */qt.createElement(cs,{stage:a,updateStageField:n}),/* @__PURE__ */qt.createElement("hr",null),/* @__PURE__ */qt.createElement(qe,{label:"Parameters",fieldColumns:6},/* @__PURE__ */qt.createElement(lt,{addButtonLabel:"Add parameter",model:null!=(r=a.parameters)?r:{},onChange:e=>n({parameters:e}),pipeline:t,valueCanContainSpel:!0})),/* @__PURE__ */qt.createElement("hr",null),/* @__PURE__ */qt.createElement(qe,{label:"Tags",fieldColumns:6},/* @__PURE__ */qt.createElement(lt,{addButtonLabel:"Add tag",model:null!=(l=a.tags)?l:{},onChange:e=>n({tags:e}),pipeline:t,valueCanContainSpel:!0})),/* @__PURE__ */qt.createElement("hr",null),/* @__PURE__ */qt.createElement(qe,{label:"Capabilities",fieldColumns:6},/* @__PURE__ */qt.createElement(g,{multi:!0,name:"capabilities",onChange:e=>n({capabilities:e.target.value}),stringOptions:ds,value:a.capabilities})))}const ps=class extends Ht.Component{constructor(e){super(e)}render(){const{stage:e,current:t,name:a}=this.props;/* @__PURE__ */
|
|
109
|
+
return Ht.createElement(_e,{name:a,current:t},/* @__PURE__ */Ht.createElement(it,{item:e}),/* @__PURE__ */Ht.createElement(Ke,{stage:e,message:e.failureMessage}))}};ps.title="Task Status";let hs=ps;class gs{constructor(e){this.executionService=e}evaluateExecution(e,t,a,n){const r=e=>{const t=e.stages.find(e=>e.id===a.id);return t&&"RUNNING"!==t.status};return this.executionService.patchExecution(t.id,a.id,{changeSetExecutionChoice:n}).then(()=>this.executionService.waitUntilExecutionMatches(t.id,r)).then(t=>this.executionService.updateExecution(e,t))}}const vs=e=>{const{execution:t,stage:a,application:n}=e,{executionService:r}=$e(),[l,s]=Wt(!1),[i,o]=Wt(""),[c,d]=Wt(!1),m=e=>{s(!0),o(e),d(!1),new gs(r).evaluateExecution(n,t,a,e)},u=e=>a.judgmentStatus===e||l&&i===e;/* @__PURE__ */
|
|
110
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null,"This ChangeSet contains a replacement, which means there will be ",/* @__PURE__ */qt.createElement("b",null,"potential data loss")," when executed."),/* @__PURE__ */qt.createElement("p",null,"How do you want to proceed?"),/* @__PURE__ */qt.createElement("div",{className:"action-buttons"},/* @__PURE__ */qt.createElement("button",{className:"btn btn-danger",onClick:()=>{m("execute")},disabled:l},u("Execute")&&/* @__PURE__ */qt.createElement(me,{mode:"circular"}),a.context.stopButtonLabel||"Execute"),/* @__PURE__ */qt.createElement("button",{className:"btn btn-primary",disabled:l,onClick:()=>{m("skip")}},u("Skip")&&/* @__PURE__ */qt.createElement(me,{mode:"circular"}),a.context.skipButtonLabel||"Skip"),/* @__PURE__ */qt.createElement("button",{className:"btn btn-primary",disabled:l,onClick:()=>{m("fail")}},u("Fail")&&/* @__PURE__ */qt.createElement(me,{mode:"circular"}),a.context.FailButtonLabel||"Fail"))),c&&/* @__PURE__ */qt.createElement("div",{className:"error-message"},"There was an error recording your decision. Please try again."))},fs=class extends Ht.Component{constructor(e){super(e)}render(){const{application:e,execution:t,stage:a,current:n,name:r}=this.props,l=a.context.changeSetContainsReplacement,s=l&&a.isRunning&&"ask"===a.context.actionOnReplacement,i=a.context.isChangeSet;/* @__PURE__ */
|
|
111
|
+
return Ht.createElement(_e,{name:r,current:n},s?/* @__PURE__ */Ht.createElement(vs,{key:a.refId,application:e,execution:t,stage:a}):/* @__PURE__ */Ht.createElement("div",null,i?/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("dl",{className:"no-margin"},/* @__PURE__ */Ht.createElement("dt",null,"ChangeSet Name"),/* @__PURE__ */Ht.createElement("dd",null,a.context.changeSetName),/* @__PURE__ */Ht.createElement("dt",null,"Replacement"),/* @__PURE__ */Ht.createElement("dd",null,String(l)),a.context.changeSetExecutionChoice&&/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("dt",null,"Judgment"),/* @__PURE__ */Ht.createElement("dd",null,a.context.changeSetExecutionChoice),/* @__PURE__ */Ht.createElement("dt",null,"Judged By"),/* @__PURE__ */Ht.createElement("dd",null,a.context.lastModifiedBy)))):/* @__PURE__ */Ht.createElement("div",null,"No changeSets found")))}};fs.title="Change Set Execution";let Es=fs;class ys extends Ht.Component{render(){if(!this.props.executionMarker)/* @__PURE__ */
|
|
112
|
+
return Ht.createElement(ot,{...this.props});const{stage:e}=this.props;if(e.isRunning&&e.stages[0].context.changeSetContainsReplacement&&"ask"===e.stages[0].context.actionOnReplacement){const t=/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("b",null,e.name)),/* @__PURE__ */Ht.createElement(vs,{stage:e.masterStage,application:this.props.application,execution:this.props.execution}));/* @__PURE__ */
|
|
113
113
|
return Ht.createElement(ue,{template:t},this.props.children)}const t=/* @__PURE__ */Ht.createElement(Ya,{id:e.id},e.name);/* @__PURE__ */
|
|
114
|
-
return Ht.createElement(Xa,{placement:"top",overlay:t},/* @__PURE__ */Ht.createElement("span",null,this.props.children))}}class
|
|
115
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{label:"Account",name:"account",input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,isLoading:"PENDING"===r,stringOptions:n.map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Region",name:"region",onChange:t=>{e.formik.setFieldValue("enableLambdaAtEdge",!1),e.formik.setFieldValue("region",t)},input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,isLoading:"PENDING"===r,stringOptions:n.filter(e=>e.name===t.account).flatMap(e=>e.regions).map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{name:"functionUid",label:"Function Name",onChange:t=>{e.formik.setFieldValue("functionUid",t),a()},help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.name"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),/* @__PURE__ */qt.createElement(u,{name:"stackName",label:"Stack",help:/* @__PURE__ */qt.createElement(c,{content:
|
|
116
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{name:"vpcId",label:"VPC Id",input:e=>/* @__PURE__ */qt.createElement(g,{...e,onChange:n,isLoading:"PENDING"===l,stringOptions:o,clearable:!0})}),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-4 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Subnets ")),0===c.length?/* @__PURE__ */qt.createElement("div",{className:"form-control-static"},"No subnets found in the selected account/region/VPC "):/* @__PURE__ */qt.createElement("div",{className:"col-md-6"},/* @__PURE__ */qt.createElement(S,{multi:!0,options:c.map(e=>{return{value:(t=e).id,label:t.id};var t}),value:a.subnetIds,onChange:t=>{const a=t.map(e=>e.value);e.formik.setFieldValue("subnetIds",a)}}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-4 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Security Groups ")),0===d.length?/* @__PURE__ */qt.createElement("div",{className:"form-control-static"},"No security groups found in the selected account/region/VPC "):/* @__PURE__ */qt.createElement("div",{className:"col-md-6"},/* @__PURE__ */qt.createElement(S,{multi:!0,options:d,value:a.securityGroupIds,onChange:t=>{const a=t.map(e=>e.value);e.formik.setFieldValue("securityGroupIds",a)}}))))}function
|
|
117
|
-
return qt.createElement(u,{name:"role",label:"Role ARN",input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter role ARN",name:"role"})})}function
|
|
118
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{name:"triggerArns",label:"Event ARNs",help:/* @__PURE__ */qt.createElement(c,{content:"The resource ARNs for Lambda event trigger sources. Triggers created here will only be applied to the higher level function, and will NOT be applied to function aliases. Input the entire ARN and select `Create option TRIGGER-ARN-INPUT` to add the ARN."}),input:a=>/* @__PURE__ */qt.createElement(mt,{...a,multi:!0,placeholder:"Input ARN...",onChange:t=>{var a,n;a=t,n="triggerArns",e.formik.setFieldValue(n,a.map(e=>e.value))},value:t.triggerArns?t.triggerArns.map(e=>({value:e,label:e})):[]})}),/* @__PURE__ */qt.createElement(u,{name:"batchsize",label:"Event Batch Size",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:1,max:1e3})}))}const
|
|
119
|
-
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:n},/* @__PURE__ */qt.createElement("strong",null,"Your function will be named: "),/* @__PURE__ */qt.createElement(c,{id:"aws.function.name"}),/* @__PURE__ */qt.createElement("span",null,t.functionName?t.functionName:e.application.name),/* @__PURE__ */qt.createElement(u,{name:"functionName",input:()=>null})),/* @__PURE__ */qt.createElement("h4",null,"Basic Settings"),/* @__PURE__ */qt.createElement(
|
|
120
|
-
return qt.createElement(_e,{name:n,current:a},/* @__PURE__ */qt.createElement(Ke,{stage:t,message:t.outputs.failureMessage}),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null," ",/* @__PURE__ */qt.createElement("b",null," Function Name: ")," ",t.outputs.functionName?t.outputs.functionName:"N/A"," "),/* @__PURE__ */qt.createElement("p",null," ",/* @__PURE__ */qt.createElement("b",null," Function ARN: ")," ",t.outputs.functionARN?t.outputs.functionARN:"N/A"," ")))}(
|
|
121
|
-
return qt.createElement("div",{className:"LambdaDeploymentConfig"},/* @__PURE__ */qt.createElement(at,{...e,stage:
|
|
122
|
-
return qt.createElement("select",{className:"form-control input-sm",onChange:e=>s({[t.fieldName]:e.target.value}),value:l[t.fieldName]||
|
|
114
|
+
return Ht.createElement(Xa,{placement:"top",overlay:t},/* @__PURE__ */Ht.createElement("span",null,this.props.children))}}class bs extends Ht.Component{constructor(e){super(e)}render(){return this.props.stage.isRunning&&this.props.stage.stages[0].context.changeSetContainsReplacement&&"ask"===this.props.stage.stages[0].context.actionOnReplacement?(this.props.stage.requiresAttention=!0,/* @__PURE__ */Ht.createElement("span",{className:"fa fa-child"})):null}}function Cs(){We.pipeline.registerStage({label:"Deploy (CloudFormation Stack)",description:"Deploy a CloudFormation Stack",key:"deployCloudFormation",cloudProvider:"aws",component:us,useCustomTooltip:!0,executionDetailsSections:[hs,Es],executionLabelComponent:ys,producesArtifacts:!0,supportsCustomTimeout:!0,validators:[],markerIcon:bs,accountExtractor:e=>e.account?[e.account]:[],configAccountExtractor:e=>e.account?[e.account]:[],artifactExtractor:dt.accumulateArtifacts(["stackArtifactId","requiredArtifactIds"]),artifactRemover:ct.removeArtifactFromFields(["stackArtifactId","requiredArtifactIds"])})}function Ns(e,t){return Object.entries(t).forEach(([t,a])=>{var n;e[t]||ya(n=a)&&(ea(n)||""===n)||(e[t]=a)}),e}function Ss(e){const{values:t}=e.formik,a=()=>{const a=pe.getClusterName(e.application.name,t.stackName,t.detailName),n=t.functionUid;e.formik.setFieldValue("functionName",`${a}-${n}`)},{result:n,status:r}=b(()=>h.listAccounts("aws"),[],[]);/* @__PURE__ */
|
|
115
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{label:"Account",name:"account",input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,isLoading:"PENDING"===r,stringOptions:n.map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Region",name:"region",onChange:t=>{e.formik.setFieldValue("enableLambdaAtEdge",!1),e.formik.setFieldValue("region",t)},input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,isLoading:"PENDING"===r,stringOptions:n.filter(e=>e.name===t.account).flatMap(e=>e.regions).map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{name:"functionUid",label:"Function Name",onChange:t=>{e.formik.setFieldValue("functionUid",t),a()},help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.name"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),/* @__PURE__ */qt.createElement(u,{name:"stackName",label:"Stack",help:/* @__PURE__ */qt.createElement(c,{content:Rn}),onChange:t=>{e.formik.setFieldValue("stackName",t),a()},input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),/* @__PURE__ */qt.createElement(u,{name:"detailName",label:"Detail",help:/* @__PURE__ */qt.createElement(c,{content:Ln}),onChange:t=>{e.formik.setFieldValue("detailName",t),a()},input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),/* @__PURE__ */qt.createElement(u,{name:"aliasNames",label:"Alias Name",help:/* @__PURE__ */qt.createElement(c,{content:"AWS Lambda aliases are like a pointer to a specific function version. Users can access the function version using the alias Amazon Resource Name (ARN). Input the alias name and select `Create option ALIAS-INPUT` to add the alias."}),input:a=>/* @__PURE__ */qt.createElement(mt,{...a,multi:!0,clearable:!1,placeholder:"Input Alias Name...",onChange:t=>{var a,n;a=t,n="aliases",e.formik.setFieldValue(n,a.map(e=>e.value))},value:t.aliases?t.aliases.map(e=>({value:e,label:e})):[]})}),/* @__PURE__ */qt.createElement(u,{name:"runtime",label:"Runtime",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.runtime"}),input:e=>/* @__PURE__ */qt.createElement(g,{...e,stringOptions:Mn,clearable:!0})}),/* @__PURE__ */qt.createElement(u,{name:"s3bucket",label:"S3 Bucket",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.s3bucket"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"S3 bucket name"})}),/* @__PURE__ */qt.createElement(u,{name:"s3key",label:"S3 Key",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.s3key"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"object.zip"})}),/* @__PURE__ */qt.createElement(u,{name:"handler",label:"Handler",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.handler"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"filename.method"})}),/* @__PURE__ */qt.createElement(u,{name:"publish",label:"Publish",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.publish"}),input:e=>/* @__PURE__ */qt.createElement(v,{...e})}))}function ws(e){const{securityGroupReader:t}=$e(),{values:a}=e.formik,n=t=>{e.formik.setFieldValue("securityGroupIds",null),e.formik.setFieldValue("subnetIds",null),e.formik.setFieldValue("vpcId",t.target.value)},{result:r,status:l}=b(()=>y.listNetworksByProvider("aws"),[],[]),{result:s}=b(()=>N.listSubnetsByProvider("aws"),[],[]),{result:i}=b(()=>t.getAllSecurityGroups(),void 0,[]),o=a.account&&a.region&&"PENDING"!==l?r.filter(e=>!1===e.deprecated).filter(e=>e.account===a.account).filter(e=>e.region===a.region).map(e=>e.id):[],c=Yt(s.filter(e=>e.vpcId===a.vpcId),"id"),d=a.account&&a.region&&a.vpcId?i[a.account].aws[a.region].filter(e=>e.vpcId===a.vpcId).map(e=>({value:e.id,label:e.name})):[];/* @__PURE__ */
|
|
116
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{name:"vpcId",label:"VPC Id",input:e=>/* @__PURE__ */qt.createElement(g,{...e,onChange:n,isLoading:"PENDING"===l,stringOptions:o,clearable:!0})}),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-4 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Subnets ")),0===c.length?/* @__PURE__ */qt.createElement("div",{className:"form-control-static"},"No subnets found in the selected account/region/VPC "):/* @__PURE__ */qt.createElement("div",{className:"col-md-6"},/* @__PURE__ */qt.createElement(S,{multi:!0,options:c.map(e=>{return{value:(t=e).id,label:t.id};var t}),value:a.subnetIds,onChange:t=>{const a=t.map(e=>e.value);e.formik.setFieldValue("subnetIds",a)}}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-4 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Security Groups ")),0===d.length?/* @__PURE__ */qt.createElement("div",{className:"form-control-static"},"No security groups found in the selected account/region/VPC "):/* @__PURE__ */qt.createElement("div",{className:"col-md-6"},/* @__PURE__ */qt.createElement(S,{multi:!0,options:d,value:a.securityGroupIds,onChange:t=>{const a=t.map(e=>e.value);e.formik.setFieldValue("securityGroupIds",a)}}))))}function ks(){/* @__PURE__ */
|
|
117
|
+
return qt.createElement(u,{name:"role",label:"Role ARN",input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Enter role ARN",name:"role"})})}function Ts(e){const{values:t}=e.formik;/* @__PURE__ */
|
|
118
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{name:"triggerArns",label:"Event ARNs",help:/* @__PURE__ */qt.createElement(c,{content:"The resource ARNs for Lambda event trigger sources. Triggers created here will only be applied to the higher level function, and will NOT be applied to function aliases. Input the entire ARN and select `Create option TRIGGER-ARN-INPUT` to add the ARN."}),input:a=>/* @__PURE__ */qt.createElement(mt,{...a,multi:!0,placeholder:"Input ARN...",onChange:t=>{var a,n;a=t,n="triggerArns",e.formik.setFieldValue(n,a.map(e=>e.value))},value:t.triggerArns?t.triggerArns.map(e=>({value:e,label:e})):[]})}),/* @__PURE__ */qt.createElement(u,{name:"batchsize",label:"Event Batch Size",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:1,max:1e3})}))}const Is="Validate AWS Lambda function configuration against Lambda@Edge requirements. This will not enable Lambda@Edge on this function. ";function Ps(e){const{values:t}=e.formik;return"us-east-1"!==t.region?/* @__PURE__ */qt.createElement("div",{className:"horizontal center"},"Lambda@Edge is only available in region us-east-1."):/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{name:"enableLambdaAtEdge",label:"Enable Lambda@Edge Validation",help:/* @__PURE__ */qt.createElement(c,{content:Is}),input:e=>/* @__PURE__ */qt.createElement(v,{...e})}))}function As(e){const{values:t,errors:a}=e.formik,n=Pa({well:!0,"alert-danger":!!a.functionName,"alert-info":!a.functionName});/* @__PURE__ */
|
|
119
|
+
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:n},/* @__PURE__ */qt.createElement("strong",null,"Your function will be named: "),/* @__PURE__ */qt.createElement(c,{id:"aws.function.name"}),/* @__PURE__ */qt.createElement("span",null,t.functionName?t.functionName:e.application.name),/* @__PURE__ */qt.createElement(u,{name:"functionName",input:()=>null})),/* @__PURE__ */qt.createElement("h4",null,"Basic Settings"),/* @__PURE__ */qt.createElement(Ss,{...e}),/* @__PURE__ */qt.createElement("h4",null," Execution Role "),/* @__PURE__ */qt.createElement(ks,null),/* @__PURE__ */qt.createElement("h4",null," Environment "),!0!==t.enableLambdaAtEdge?/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(u,{name:"envVariables",label:"Env Variables",input:e=>/* @__PURE__ */qt.createElement(f,{...e,allowEmptyValues:!0,addButtonLabel:"Add"})}),/* @__PURE__ */qt.createElement(u,{name:"encryptionKMSKeyArn",label:"Key ARN",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.kmsKeyArn"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e})})):/* @__PURE__ */qt.createElement("div",{className:"horizontal center"},"Environment variables not available with Lambda@Edge functions."),/* @__PURE__ */qt.createElement("h4",null," Tags "),/* @__PURE__ */qt.createElement(u,{name:"tags",input:e=>/* @__PURE__ */qt.createElement(f,{...e,allowEmptyValues:!1,addButtonLabel:"Add"})}),/* @__PURE__ */qt.createElement("h4",null," Settings "),/* @__PURE__ */qt.createElement(u,{name:"description",label:"Description",input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),/* @__PURE__ */qt.createElement(u,{name:"layers",label:"Layer ARNs",help:/* @__PURE__ */qt.createElement(c,{content:"The resource ARNs for Lambda layer. Input the entire ARN and select `Create option TRIGGER-ARN-INPUT` to add the ARN."}),input:a=>/* @__PURE__ */qt.createElement(mt,{...a,multi:!0,placeholder:"Layer ARN...",onChange:t=>{var a,n;a=t,n="layers",e.formik.setFieldValue(n,a.map(e=>e.value))},value:t.layers?t.layers.map(e=>({value:e,label:e})):[]})}),/* @__PURE__ */qt.createElement(u,{name:"reservedConcurrentExecutions",label:"Reserved Concurrency",help:/* @__PURE__ */qt.createElement(c,{content:"The total number of current executions of your Lambda function that can be instantiated at any time."}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0,max:3e3})}),/* @__PURE__ */qt.createElement(u,{name:"memorySize",label:"Memory (MB)",help:/* @__PURE__ */qt.createElement(c,{id:"aws.functionBasicSettings.memorySize"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:128,max:!0===t.enableLambdaAtEdge?128:3008})}),/* @__PURE__ */qt.createElement(u,{name:"timeout",label:"Timeout (seconds)",help:/* @__PURE__ */qt.createElement(c,{id:"aws.functionBasicSettings.timeout"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:1,max:!0===t.enableLambdaAtEdge?5:900})}),/* @__PURE__ */qt.createElement(Ps,{...e}),/* @__PURE__ */qt.createElement("h4",null," Network "),!0!==t.enableLambdaAtEdge?/* @__PURE__ */qt.createElement(ws,{...e}):/* @__PURE__ */qt.createElement("div",{className:"horizontal center"},"VPC configuration not available with Lambda@Edge functions."),/* @__PURE__ */qt.createElement("h4",null," Event Triggers "),/* @__PURE__ */qt.createElement(Ts,{...e}),/* @__PURE__ */qt.createElement("h4",null," Debugging and Error Handling "),"Dead Letter Config",/* @__PURE__ */qt.createElement(u,{name:"deadLetterConfig.targetArn",label:"Target ARN",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.deadletterqueue"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),"X-Ray Tracing",/* @__PURE__ */qt.createElement(u,{name:"tracingConfig.mode",label:"Mode",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.tracingConfig.mode"}),input:e=>/* @__PURE__ */qt.createElement(g,{...e,stringOptions:["Active","PassThrough"],clearable:!0})}))}function Gs(e){const t=new m(e);return t.field("runtime","Runtime").required(),t.field("s3key","S3 Object Key").required(),t.field("handler","Handler").required(),t.field("functionUid","Function Name").required(),t.field("stackName","Stack Name").optional().withValidators(Bn),t.field("detailName","Detail Name").optional().withValidators(Bn),t.field("s3bucket","S3 Bucket Name").required().withValidators(Gn),t.field("role","Role ARN").required().withValidators(An),t.field("triggerArns","Trigger ARNs").optional().withValidators((e,t)=>e.map(e=>xn(e,e)).every(e=>void 0===e)?void 0:"Invalid ARN. Event ARN must match regular expression: /^arn:aws[a-zA-Z-]?:[a-zA-Z_0-9.-]+:./"),t.validateForm()}function xs(e){const{stage:t,current:a,name:n}=e;/* @__PURE__ */
|
|
120
|
+
return qt.createElement(_e,{name:n,current:a},/* @__PURE__ */qt.createElement(Ke,{stage:t,message:t.outputs.failureMessage}),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null," ",/* @__PURE__ */qt.createElement("b",null," Function Name: ")," ",t.outputs.functionName?t.outputs.functionName:"N/A"," "),/* @__PURE__ */qt.createElement("p",null," ",/* @__PURE__ */qt.createElement("b",null," Function ARN: ")," ",t.outputs.functionARN?t.outputs.functionARN:"N/A"," ")))}(xs||(xs={})).title="Lambda Deployment Stage";const Ds={key:"Aws.LambdaDeploymentStage",label:"AWS Lambda Deployment",description:"Create a Single AWS Lambda Function",component:function(e){const t={role:"",runtime:"",s3key:"",s3bucket:"",handler:"",functionName:"",publish:!1,tags:{},memorySize:128,description:"",credentials:"",cloudProvider:"aws",region:"",envVariables:{},tracingConfig:{mode:"PassThrough"},kmskeyArn:"",vpcId:"",subnetIds:[],securityGroupIds:[],timeout:3,deadLetterConfig:{targetArn:""},operation:"",targetGroups:""};/* @__PURE__ */
|
|
121
|
+
return qt.createElement("div",{className:"LambdaDeploymentConfig"},/* @__PURE__ */qt.createElement(at,{...e,stage:Ns(e.stage,t),validate:Gs,onChange:e.updateStage,render:e=>/* @__PURE__ */qt.createElement(As,{...e})}))},executionDetailsSections:[xs,Ze],validateFn:Gs};function Bs(){o.feature.lambdaAdditionalStages&&We.pipeline.registerStage(Ds)}const Fs=[{label:"Largest",val:"LARGEST",description:"When multiple server groups exist, prefer the server group with the most instances"},{label:"Newest",val:"NEWEST",description:"When multiple server groups exist, prefer the newest"},{label:"Oldest",val:"OLDEST",description:"When multiple server groups exist, prefer the oldest"},{label:"Fail",val:"FAIL",description:"When multiple server groups exist, fail"}],Ms=[{fieldName:"credentials",label:"Account",type:"account"},{fieldName:"regions",label:"Region",type:"regions"},{fieldName:"cluster",label:"Cluster"},{fieldName:"selectionStrategy",label:"Server Group Selection",type:"selectionStrategy"},{fieldName:"onlyEnabled",label:"Server Group Filters",type:"onlyEnabled"}],Rs={destroyAsg:[{fieldName:"credentials",label:"Account",type:"account"},{fieldName:"regions",label:"Region",type:"regions"},{fieldName:"cluster",label:"Cluster"},{fieldName:"target",label:"Server Group",type:"target"}],destroyServerGroup:[{fieldName:"credentials",label:"Account",type:"account"},{fieldName:"regions",label:"Region",type:"regions"},{fieldName:"cluster",label:"Cluster"},{fieldName:"target",label:"Server Group",type:"target"}],findAmi:Ms,findImage:Ms},Ls=[{fieldName:"credentials",label:"Account",type:"account"},{fieldName:"regions",label:"Region",type:"regions"}];function zs(e,t){return"regions"===t.type?(e.regions||[]).join(", "):"account"===t.type?e[t.fieldName]||e.account||"":e[t.fieldName]||""}function Os(e,t,a,n){const{application:r,stage:l,updateStageField:s}=e;if("selectionStrategy"===t.type)/* @__PURE__ */
|
|
122
|
+
return qt.createElement("select",{className:"form-control input-sm",onChange:e=>s({[t.fieldName]:e.target.value}),value:l[t.fieldName]||Fs[0].val},Fs.map(e=>/* @__PURE__ */qt.createElement("option",{key:e.val,title:e.description,value:e.val},e.label)));if("onlyEnabled"===t.type)/* @__PURE__ */
|
|
123
123
|
return qt.createElement("label",{className:"checkbox-inline"},/* @__PURE__ */qt.createElement("input",{checked:!1!==l[t.fieldName],onChange:e=>s({[t.fieldName]:e.target.checked}),type:"checkbox"}),"Only consider enabled Server Groups");if("target"===t.type)/* @__PURE__ */
|
|
124
124
|
return qt.createElement("select",{className:"form-control input-sm",onChange:e=>s({[t.fieldName]:e.target.value}),value:l[t.fieldName]||""},
|
|
125
125
|
/* @__PURE__ */qt.createElement("option",{value:""},"Select server group"),Ye.TARGET_LIST.map(e=>/* @__PURE__ */qt.createElement("option",{key:e.val,title:e.description,value:e.val},e.label)));if("account"===t.type)/* @__PURE__ */
|
|
126
|
-
return qt.createElement("select",{className:"form-control input-sm",name:t.fieldName,onChange:e=>s({[t.fieldName]:e.target.value,account:e.target.value}),value:
|
|
126
|
+
return qt.createElement("select",{className:"form-control input-sm",name:t.fieldName,onChange:e=>s({[t.fieldName]:e.target.value,account:e.target.value}),value:zs(l,t)},
|
|
127
127
|
/* @__PURE__ */qt.createElement("option",{value:""},"Select..."),a.map(e=>e.name).sort().map(e=>/* @__PURE__ */qt.createElement("option",{key:e,value:e},e)));if("regions"===t.type)/* @__PURE__ */
|
|
128
128
|
return qt.createElement(Ae,{inline:!0,name:t.fieldName,onChange:e=>s({[t.fieldName]:e.target.value}),showSelectAll:!0,stringOptions:n,value:l[t.fieldName]||[]});if("cluster"===t.fieldName){const e=Xe.clusterFilterForCredentialsAndRegion(l.credentials,l.regions),a=Xe.getClusters([r],e);/* @__PURE__ */
|
|
129
129
|
return qt.createElement("select",{className:"form-control input-sm cluster-select",onChange:e=>s({[t.fieldName]:e.target.value}),value:l[t.fieldName]||""},
|
|
130
130
|
/* @__PURE__ */qt.createElement("option",{value:""},"Select a cluster..."),a.map(e=>/* @__PURE__ */qt.createElement("option",{key:e,value:e},e)))}/* @__PURE__ */
|
|
131
|
-
return qt.createElement("input",{className:"form-control input-sm",onChange:e=>{return a=e.target.value,void("regions"!==t.type?"account"!==t.type?s({[t.fieldName]:a}):s({[t.fieldName]:a,account:a}):s({regions:a.split(",").map(e=>e.trim()).filter(Boolean)}));var a},value:
|
|
131
|
+
return qt.createElement("input",{className:"form-control input-sm",onChange:e=>{return a=e.target.value,void("regions"!==t.type?"account"!==t.type?s({[t.fieldName]:a}):s({[t.fieldName]:a,account:a}):s({regions:a.split(",").map(e=>e.trim()).filter(Boolean)}));var a},value:zs(l,t)})}function $s({application:e,stage:t,updateStageField:a}){const n=function(e){return Rs[e.type||e.alias||e.key||""]||Ls}(t),[r,l]=Wt([]),[s,i]=Wt([]);return jt(()=>{let e=!0;return h.listAccounts("aws").then(t=>e&&l(t)),h.getUniqueAttributeForAllAccounts("aws","regions").then(t=>e&&i(t)),()=>{e=!1}},[]),jt(()=>{const r={};t.cloudProvider||(r.cloudProvider="aws"),n.some(e=>"regions"===e.type)&&!t.regions&&(r.regions=[]),n.some(e=>"selectionStrategy"===e.type)&&!t.selectionStrategy&&(r.selectionStrategy=Fs[0].val),n.some(e=>"selectionStrategy"===e.type)&&void 0===t.onlyEnabled&&(r.onlyEnabled=!0),n.some(e=>"account"===e.type)&&!t.credentials&&e.defaultCredentials.aws&&(r.credentials=e.defaultCredentials.aws,r.account=e.defaultCredentials.aws),!n.some(e=>"regions"===e.type)||t.regions&&t.regions.length||!e.defaultRegions.aws||(r.regions=[e.defaultRegions.aws]),Object.keys(r).length&&a(r)},[e,n,t.cloudProvider,t.credentials,t.onlyEnabled,t.regions,t.selectionStrategy,a]),/* @__PURE__ */qt.createElement("div",{className:"form-horizontal"},n.map(n=>/* @__PURE__ */qt.createElement(qe,{key:n.fieldName,label:n.label},Os({application:e,stage:t,updateStageField:a},n,r,s))))}const Us={provides:"destroyServerGroup",alias:"destroyAsg",cloudProvider:"aws",component:$s,accountExtractor:e=>[e.context.credentials],configAccountExtractor:e=>[e.credentials],validators:[{type:"targetImpedance",message:"This pipeline will attempt to destroy a server group without deploying a new version into the same cluster."},{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"target"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}]};function Vs(){We.pipeline.registerStage(Us)}Vs();const Hs={key:"disableServerGroup",provides:"disableServerGroup",alias:"disableAsg",cloudProvider:"aws",component:function(e){const{application:t,pipeline:a,stage:n,stageFieldUpdated:r,updateStageField:l}=e,[s,i]=Wt([]);return jt(()=>{var e;const a={};"aws"!==n.cloudProvider&&(a.cloudProvider="aws"),!n.credentials&&(null==(e=t.defaultCredentials)?void 0:e.aws)&&(a.credentials=t.defaultCredentials.aws),n.target||(a.target=Ye.TARGET_LIST[0].val),n.isNew&&t.attributes.platformHealthOnlyShowOverride&&t.attributes.platformHealthOnly&&void 0===n.interestingHealthProviderNames&&(a.interestingHealthProviderNames=["Amazon"]),Object.keys(a).length&&l(a)},[]),jt(()=>{let e=!0;return h.listAccounts("aws").then(t=>e&&i(t)),()=>{e=!1}},[]),/* @__PURE__ */qt.createElement("div",{className:"form-horizontal"},!a.strategy&&/* @__PURE__ */qt.createElement(Je,{accounts:s,application:t,component:n,onComponentUpdate:r}),/* @__PURE__ */qt.createElement(qe,{label:"Target"},/* @__PURE__ */qt.createElement(Qe,{model:{target:n.target},onChange:e=>l({target:e}),options:Ye.TARGET_LIST})),t.attributes.platformHealthOnlyShowOverride&&/* @__PURE__ */qt.createElement(qe,{label:"Task Completion"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:n.interestingHealthProviderNames||[],onChange:e=>l({interestingHealthProviderNames:e}),platformHealthType:"Amazon"})))},validators:[{type:"targetImpedance",message:"This pipeline will attempt to disable a server group without deploying a new version into the same cluster."},{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"target"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}]};function qs(){We.pipeline.registerStage(Hs)}qs();const Ws={key:"disableCluster",provides:"disableCluster",cloudProvider:"aws",component:function(e){var t,a;const{application:n,pipeline:r,stage:l,stageFieldUpdated:s,updateStageField:i}=e,[o,c]=Wt([]);return jt(()=>{var e;const t={};"aws"!==l.cloudProvider&&(t.cloudProvider="aws"),!l.credentials&&(null==(e=n.defaultCredentials)?void 0:e.aws)&&(t.credentials=n.defaultCredentials.aws),void 0===l.remainingEnabledServerGroups&&(t.remainingEnabledServerGroups=1),void 0===l.preferLargerOverNewer&&(t.preferLargerOverNewer="false"),l.isNew&&n.attributes.platformHealthOnlyShowOverride&&n.attributes.platformHealthOnly&&void 0===l.interestingHealthProviderNames&&(t.interestingHealthProviderNames=["Amazon"]),Object.keys(t).length&&i(t)},[]),jt(()=>{let e=!0;return h.listAccounts("aws").then(t=>e&&c(t)),()=>{e=!1}},[]),/* @__PURE__ */qt.createElement("div",{className:"form-horizontal"},!r.strategy&&/* @__PURE__ */qt.createElement(Je,{accounts:o,application:n,component:l,onComponentUpdate:s}),/* @__PURE__ */qt.createElement(qe,{label:"Disable Options"},/* @__PURE__ */qt.createElement("div",{className:"form-inline"},"Keep the"," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",min:0,onChange:e=>i({remainingEnabledServerGroups:Number(e.target.value)}),required:!0,style:{width:50},type:"number",value:null!=(t=l.remainingEnabledServerGroups)?t:""})," ",/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",onChange:e=>i({preferLargerOverNewer:e.target.value}),style:{width:100},value:null!=(a=l.preferLargerOverNewer)?a:"false"},
|
|
132
132
|
/* @__PURE__ */qt.createElement("option",{value:"true"},"largest"),
|
|
133
|
-
/* @__PURE__ */qt.createElement("option",{value:"false"},"newest"))," ",(d="server group",1===l.remainingEnabledServerGroups?d:`${d}s`)," enabled.")),n.attributes.platformHealthOnlyShowOverride&&/* @__PURE__ */qt.createElement(qe,{label:"Task Completion"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:l.interestingHealthProviderNames||[],onChange:e=>i({interestingHealthProviderNames:e}),platformHealthType:"Amazon"})));var d},validators:[{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"remainingEnabledServerGroups",fieldLabel:"Keep [X] enabled Server Groups"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}]};function
|
|
134
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{name:"timeout",label:"Timeout",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0,max:900})}),/* @__PURE__ */qt.createElement(u,{name:"executionCount",label:"Execution Count",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0,max:100})}),/* @__PURE__ */qt.createElement(rt,{artifact:n(t,"payloadArtifact").artifact,excludedArtifactTypePatterns:a,expectedArtifactId:n(t,"payloadArtifact").id,label:"Payload Artifact",onArtifactEdited:t=>{((t,a)=>{e.formik.setFieldValue(`${a}.id`,null),e.formik.setFieldValue(`${a}.artifact`,t),e.formik.setFieldValue(`${a}.account`,t.artifactAccount)})(t,"payloadArtifact")},helpKey:"",onExpectedArtifactSelected:t=>{return a=t.id,n="payloadrtifact",e.formik.setFieldValue(`${n}.id`,a),void e.formik.setFieldValue(`${n}.artifact`,null);var a,n},pipeline:e.pipeline,stage:t}))}function
|
|
135
|
-
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement("h4",null," Basic Settings "),/* @__PURE__ */qt.createElement(u,{label:"Account",name:"account",onChange:t=>{e.formik.setFieldValue("region",null),e.formik.setFieldValue("functionName",null),e.formik.setFieldValue("account",t)},required:!0,input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,isLoading:"PENDING"===r,stringOptions:n.map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Region",name:"region",onChange:t=>{e.formik.setFieldValue("functionName",null),e.formik.setFieldValue("region",t)},input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!t.account,placeholder:t.account?"Select...":"Select an Account...",...e,isLoading:"PENDING"===r,stringOptions:n.filter(e=>e.name===t.account).flatMap(e=>e.regions).map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Function Name",name:"functionName",input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!(t.account&&t.region),placeholder:t.account&&t.region?"Select...":"Select an Account and Region...",...e,stringOptions:l})}),/* @__PURE__ */qt.createElement(u,{label:"Alias",name:"aliasName",input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),/* @__PURE__ */qt.createElement("h4",null," Invoke Settings "),/* @__PURE__ */qt.createElement(
|
|
136
|
-
return qt.createElement(_e,{name:e.name,current:e.current},/* @__PURE__ */qt.createElement(Ke,{stage:t,message:t.outputs.failureMessage}),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null," Function Name: ",t.outputs.functionName?t.outputs.functionName:"N/A"," "),/* @__PURE__ */qt.createElement("p",null," ","Deployed Alias:"," ",t.outputs["deployment:aliasDeployed"]?t.outputs["deployment:aliasDeployed"]:"N/A"," "),/* @__PURE__ */qt.createElement("p",null," ","Deployed Major Version:"," ",t.outputs["deployment:majorVersionDeployed"]?t.outputs["deployment:majorVersionDeployed"]:"N/A"," ")))}function
|
|
137
|
-
return qt.createElement("div",{className:"InvokeLambdaStageConfig"},/* @__PURE__ */qt.createElement(at,{...e,validate:
|
|
138
|
-
return qt.createElement("div",{className:"form-horizontal"},!t.strategy&&/* @__PURE__ */qt.createElement(Je,{accounts:i,application:e,component:{...a},onComponentUpdate:n}),/* @__PURE__ */qt.createElement(qe,{label:"Target"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",name:"target",onChange:e=>r({target:e.target.value}),value:a.target||Ye.TARGET_LIST[0].val},Ye.TARGET_LIST.map(e=>/* @__PURE__ */qt.createElement("option",{key:e.val,title:e.description,value:e.val},e.label)))),/* @__PURE__ */qt.createElement(qe,{label:"Action"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",name:"action",onChange:e=>r({action:e.target.value}),value:a.action||
|
|
139
|
-
return qt.createElement("input",{"aria-label":e,"aria-invalid":!c,className:"form-control input-sm","data-capacity-field":t,inputMode:"numeric",name:n,onChange:e=>{const t=e.target.value;o(t),
|
|
140
|
-
return qt.createElement("div",{className:"form-horizontal"},!a.strategy&&/* @__PURE__ */qt.createElement(Je,{accounts:i,application:t,component:n,onComponentUpdate:r}),/* @__PURE__ */qt.createElement(qe,{label:"Target"},/* @__PURE__ */qt.createElement(Qe,{model:{target:n.target},options:Ye.TARGET_LIST,onChange:e=>s({target:e})})),/* @__PURE__ */qt.createElement(qe,{label:"Action",helpKey:"pipeline.config.resizeAsg.action"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",name:"action",onChange:e=>c(e.target.value),required:!0,value:n.action},
|
|
141
|
-
return qt.createElement("div",{className:"col-md-3",key:e},/* @__PURE__ */qt.createElement(
|
|
142
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{name:"triggerArns",label:"Event ARNs",help:/* @__PURE__ */qt.createElement(c,{content:"The resource ARNs for Lambda event trigger sources. Input the entire ARN and select `Create option TRIGGER-ARN-INPUT` to add the ARN."}),input:a=>/* @__PURE__ */qt.createElement(mt,{...a,multi:!0,placeholder:"Input ARN...",onChange:t=>{var a,n;a=t,n="triggerArns",e.formik.setFieldValue(n,a.map(e=>e.value))},value:t.triggerArns?t.triggerArns.map(e=>({value:e,label:e})):[]}),required:!1}),/* @__PURE__ */qt.createElement(u,{name:"batchsize",label:"Event Batch Size",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:1,max:10}),required:!1}))}function
|
|
143
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{name:"destroyOnFail",label:"On Fail",input:e=>/* @__PURE__ */qt.createElement(v,{text:"Destroy latest lambda version on fail.",...e})}),/* @__PURE__ */qt.createElement(u,{name:"timeout",label:"Timeout",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0,max:900})}),/* @__PURE__ */qt.createElement(rt,{artifact:l(t,"payloadArtifact").artifact,excludedArtifactTypePatterns:a,expectedArtifactId:l(t,"payloadArtifact").id,label:"Payload Artifact",onArtifactEdited:e=>{n(e,"payloadArtifact")},helpKey:"",onExpectedArtifactSelected:e=>r(e.id,"payloadrtifact"),pipeline:e.pipeline,stage:t}),/* @__PURE__ */qt.createElement(rt,{artifact:l(t,"outputArtifact").artifact,excludedArtifactTypePatterns:a,expectedArtifactId:l(t,"outputArtifact").id,label:"Output Artifact",onArtifactEdited:e=>{n(e,"outputArtifact")},helpKey:"",onExpectedArtifactSelected:e=>r(e.id,"outputArtifact"),pipeline:e.pipeline,stage:t}))}
|
|
144
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{label:"Health Check Type",name:"healthCheckType",input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,options:
|
|
145
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("b",null," ",this.state.label," "),/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("small",null," ",this.state.description," "))}}const
|
|
146
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("b",null," ",this.state.label," ")," ",/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("small",null," ",this.state.description," "))}}function
|
|
147
|
-
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement(u,{label:"Target Version",name:"versionNameA",onChange:t=>{e.formik.setFieldValue("trafficPercentA",100),e.formik.setFieldValue("versionNameA",t)},input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,options:
|
|
148
|
-
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement(u,{label:"Target Version",name:"versionNameA",input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,options:
|
|
133
|
+
/* @__PURE__ */qt.createElement("option",{value:"false"},"newest"))," ",(d="server group",1===l.remainingEnabledServerGroups?d:`${d}s`)," enabled.")),n.attributes.platformHealthOnlyShowOverride&&/* @__PURE__ */qt.createElement(qe,{label:"Task Completion"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:l.interestingHealthProviderNames||[],onChange:e=>i({interestingHealthProviderNames:e}),platformHealthType:"Amazon"})));var d},validators:[{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"remainingEnabledServerGroups",fieldLabel:"Keep [X] enabled Server Groups"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}]};function js(){We.pipeline.registerStage(Ws)}js();const Zs={key:"enableServerGroup",provides:"enableServerGroup",alias:"enableAsg",cloudProvider:"aws",component:function(e){const{application:t,pipeline:a,stage:n,stageFieldUpdated:r,updateStageField:l}=e,[s,i]=Wt([]);return jt(()=>{var e;const a={};"aws"!==n.cloudProvider&&(a.cloudProvider="aws"),!n.credentials&&(null==(e=t.defaultCredentials)?void 0:e.aws)&&(a.credentials=t.defaultCredentials.aws),n.target||(a.target=Ye.TARGET_LIST[0].val),n.isNew&&t.attributes.platformHealthOnlyShowOverride&&t.attributes.platformHealthOnly&&void 0===n.interestingHealthProviderNames&&(a.interestingHealthProviderNames=["Amazon"]),Object.keys(a).length&&l(a)},[]),jt(()=>{let e=!0;return h.listAccounts("aws").then(t=>e&&i(t)),()=>{e=!1}},[]),/* @__PURE__ */qt.createElement("div",{className:"form-horizontal"},!a.strategy&&/* @__PURE__ */qt.createElement(Je,{accounts:s,application:t,component:n,onComponentUpdate:r}),/* @__PURE__ */qt.createElement(qe,{label:"Target"},/* @__PURE__ */qt.createElement(Qe,{model:{target:n.target},onChange:e=>l({target:e}),options:Ye.TARGET_LIST})),t.attributes.platformHealthOnlyShowOverride&&/* @__PURE__ */qt.createElement(qe,{label:"Task Completion"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:n.interestingHealthProviderNames||[],onChange:e=>l({interestingHealthProviderNames:e}),platformHealthType:"Amazon"})))},validators:[{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"target"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}]};function _s(){We.pipeline.registerStage(Zs)}_s();const Ks={provides:"findImage",alias:"findAmi",cloudProvider:"aws",component:$s,validators:[{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"selectionStrategy",fieldLabel:"Server Group Selection"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"credentials"}]};function Ys(){We.pipeline.registerStage(Ks)}Ys();const Xs={key:"findImageFromTags",provides:"findImageFromTags",cloudProvider:"aws",component:function({application:e,pipeline:t,stage:a,updateStageField:n}){var r,l,s,i;const[o,c]=qt.useState([]),d=[...null!=(r=a.regions)?r:[],...o].filter((e,t,a)=>e&&a.indexOf(e)===t);return qt.useEffect(()=>{var t;const r={};void 0===a.cloudProvider&&(r.cloudProvider="aws"),void 0===a.regions&&(r.regions=(null==(t=e.defaultRegions)?void 0:t.aws)?[e.defaultRegions.aws]:[]),void 0===a.tags&&(r.tags={}),Object.keys(r).length>0&&n(r)},[]),qt.useEffect(()=>{let e=!0;return Ve.getRegions("aws").then(t=>{e&&c(t)}),()=>{e=!1}},[]),/* @__PURE__ */qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement(qe,{label:"Package"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",name:"packageName",onChange:e=>n({packageName:e.target.value}),type:"text",value:null!=(l=a.packageName)?l:""})),/* @__PURE__ */qt.createElement(qe,{label:"Regions"},/* @__PURE__ */qt.createElement(Ae,{inline:!0,name:"regions",onChange:e=>n({regions:e.target.value}),showSelectAll:!0,stringOptions:d,value:null!=(s=a.regions)?s:[]})),/* @__PURE__ */qt.createElement(qe,{label:"Tags"},/* @__PURE__ */qt.createElement(lt,{allowEmpty:!0,model:null!=(i=a.tags)?i:{},onChange:e=>n({tags:e}),pipeline:t})))},validators:[{type:"requiredField",fieldName:"packageName"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"tags"}]};function Js(){We.pipeline.registerStage(Xs)}function Qs(e){const{values:t}=e.formik,a=ut(pt.BITBUCKET_FILE,pt.CUSTOM_OBJECT,pt.EMBEDDED_BASE64,pt.REMOTE_BASE64,pt.GCS_OBJECT,pt.GITHUB_FILE,pt.GITLAB_FILE,pt.S3_OBJECT,pt.HTTP_FILE),n=(e,t)=>e[t]?e[t]:{account:"",id:""};/* @__PURE__ */
|
|
134
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{name:"timeout",label:"Timeout",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0,max:900})}),/* @__PURE__ */qt.createElement(u,{name:"executionCount",label:"Execution Count",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0,max:100})}),/* @__PURE__ */qt.createElement(rt,{artifact:n(t,"payloadArtifact").artifact,excludedArtifactTypePatterns:a,expectedArtifactId:n(t,"payloadArtifact").id,label:"Payload Artifact",onArtifactEdited:t=>{((t,a)=>{e.formik.setFieldValue(`${a}.id`,null),e.formik.setFieldValue(`${a}.artifact`,t),e.formik.setFieldValue(`${a}.account`,t.artifactAccount)})(t,"payloadArtifact")},helpKey:"",onExpectedArtifactSelected:t=>{return a=t.id,n="payloadrtifact",e.formik.setFieldValue(`${n}.id`,a),void e.formik.setFieldValue(`${n}.artifact`,null);var a,n},pipeline:e.pipeline,stage:t}))}function ei(e){const{values:t}=e.formik,{functions:a}=e.application,{result:n,status:r}=b(()=>h.listAccounts("aws"),[],[]),l=t.account&&t.region?a.data.filter(e=>e.account===t.account).filter(e=>e.region===t.region).map(e=>e.functionName):[];/* @__PURE__ */
|
|
135
|
+
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement("h4",null," Basic Settings "),/* @__PURE__ */qt.createElement(u,{label:"Account",name:"account",onChange:t=>{e.formik.setFieldValue("region",null),e.formik.setFieldValue("functionName",null),e.formik.setFieldValue("account",t)},required:!0,input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,isLoading:"PENDING"===r,stringOptions:n.map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Region",name:"region",onChange:t=>{e.formik.setFieldValue("functionName",null),e.formik.setFieldValue("region",t)},input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!t.account,placeholder:t.account?"Select...":"Select an Account...",...e,isLoading:"PENDING"===r,stringOptions:n.filter(e=>e.name===t.account).flatMap(e=>e.regions).map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Function Name",name:"functionName",input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!(t.account&&t.region),placeholder:t.account&&t.region?"Select...":"Select an Account and Region...",...e,stringOptions:l})}),/* @__PURE__ */qt.createElement(u,{label:"Alias",name:"aliasName",input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),/* @__PURE__ */qt.createElement("h4",null," Invoke Settings "),/* @__PURE__ */qt.createElement(Qs,{...e}))}function ti(e){const{stage:t}=e;/* @__PURE__ */
|
|
136
|
+
return qt.createElement(_e,{name:e.name,current:e.current},/* @__PURE__ */qt.createElement(Ke,{stage:t,message:t.outputs.failureMessage}),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null," Function Name: ",t.outputs.functionName?t.outputs.functionName:"N/A"," "),/* @__PURE__ */qt.createElement("p",null," ","Deployed Alias:"," ",t.outputs["deployment:aliasDeployed"]?t.outputs["deployment:aliasDeployed"]:"N/A"," "),/* @__PURE__ */qt.createElement("p",null," ","Deployed Major Version:"," ",t.outputs["deployment:majorVersionDeployed"]?t.outputs["deployment:majorVersionDeployed"]:"N/A"," ")))}function ai(e){const t=new m(e);return t.field("triggerArns","Trigger ARNs").optional().withValidators((e,t)=>e.map(e=>xn(e,e)).every(e=>void 0===e)?void 0:"Invalid ARN. Event ARN must match regular expression: /^arn:aws[a-zA-Z-]?:[a-zA-Z_0-9.-]+:./"),t.validateForm()}Js(),(ti||(ti={})).title="Invoke Lambda Stage";const ni={key:"Aws.LambdaInvokeStage",label:"AWS Lambda Invoke",description:"Invoke a Lambda function",component:function(e){/* @__PURE__ */
|
|
137
|
+
return qt.createElement("div",{className:"InvokeLambdaStageConfig"},/* @__PURE__ */qt.createElement(at,{...e,validate:ai,onChange:e.updateStage,render:e=>/* @__PURE__ */qt.createElement(ei,{...e})}))},executionDetailsSections:[ti,Ze],validateFn:ai};function ri(){o.feature.lambdaAdditionalStages&&We.pipeline.registerStage(ni)}const li=[{label:"Suspend",value:"suspend"},{label:"Resume",value:"resume"}],si=["Launch","Terminate","AddToLoadBalancer","AlarmNotification","AZRebalance","HealthCheck","ReplaceUnhealthy","ScheduledActions"];const ii={label:"Modify Scaling Process",description:"Suspend/Resume Scaling Processes",key:"modifyAwsScalingProcess",alias:"modifyScalingProcess",component:function({application:e,pipeline:t,stage:a,updateStage:n,updateStageField:r}){const[l,s]=qt.useState([]);return qt.useEffect(()=>{let e=!0;return h.listAccounts("aws").then(t=>e&&s(t)),()=>{e=!1}},[]),qt.useEffect(()=>{const t={},n=e.defaultCredentials.aws,l=e.defaultRegions.aws;a.cloudProvider||(t.cloudProvider="aws"),a.processes||(t.processes=[]),a.regions?!a.regions.length&&l&&(t.regions=[l]):t.regions=l?[l]:[],!a.credentials&&n&&(t.credentials=n),a.action||(t.action=li[0].value),a.target||(t.target=Ye.TARGET_LIST[0].val),void 0===a.suspendProcesses&&void 0===a.resumeProcesses||(t.suspendProcesses=void 0,t.resumeProcesses=void 0),Object.keys(t).length&&r(t)},[e.defaultCredentials.aws,e.defaultRegions.aws,a.action,a.cloudProvider,a.credentials,a.processes,a.regions,a.resumeProcesses,a.suspendProcesses,a.target,r]),/* @__PURE__ */qt.createElement("div",{className:"form-horizontal"},!t.strategy&&/* @__PURE__ */qt.createElement(Je,{accounts:l,application:e,component:{...a},onComponentUpdate:n}),/* @__PURE__ */qt.createElement(qe,{label:"Target"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",name:"target",onChange:e=>r({target:e.target.value}),value:a.target||Ye.TARGET_LIST[0].val},Ye.TARGET_LIST.map(e=>/* @__PURE__ */qt.createElement("option",{key:e.val,title:e.description,value:e.val},e.label)))),/* @__PURE__ */qt.createElement(qe,{label:"Action"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",name:"action",onChange:e=>r({action:e.target.value,suspendProcesses:void 0,resumeProcesses:void 0}),value:a.action||li[0].value},li.map(e=>/* @__PURE__ */qt.createElement("option",{key:e.value,value:e.value},e.label)))),/* @__PURE__ */qt.createElement(qe,{label:"Processes"},/* @__PURE__ */qt.createElement(Ae,{name:"processes",onChange:e=>r({processes:e.target.value}),showSelectAll:!0,stringOptions:si,value:a.processes||[]})))},validators:[{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"target"},{type:"requiredField",fieldName:"action"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"processes"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}],cloudProvider:"aws",strategy:!0};function oi(){We.pipeline.registerStage(ii)}oi();const ci=[{label:"Upsert",value:"upsert"},{label:"Delete",value:"delete"}],di=["Stopped","Running","Hibernated"];const mi={label:"Modify Warm Pool",description:"Upsert or delete an Auto Scaling Group warm pool",key:"modifyWarmPool",component:function({application:e,pipeline:t,stage:a,updateStage:n,updateStageField:r}){var l,s;const[i,o]=qt.useState([]);qt.useEffect(()=>{let e=!0;return h.listAccounts("aws").then(t=>e&&o(t)),()=>{e=!1}},[]),qt.useEffect(()=>{const t={},n=e.defaultCredentials.aws,l=e.defaultRegions.aws;a.cloudProvider||(t.cloudProvider="aws"),a.regions?!a.regions.length&&l&&(t.regions=[l]):t.regions=l?[l]:[],!a.credentials&&n&&(t.credentials=n),a.action||(t.action=ci[0].value),a.target||(t.target=Ye.TARGET_LIST[0].val),a.poolState||(t.poolState=di[0]),Object.keys(t).length&&r(t)},[e.defaultCredentials.aws,e.defaultRegions.aws,a.action,a.cloudProvider,a.credentials,a.poolState,a.regions,a.target,r]);const c="upsert"===(a.action||ci[0].value);/* @__PURE__ */
|
|
138
|
+
return qt.createElement("div",{className:"form-horizontal"},!t.strategy&&/* @__PURE__ */qt.createElement(Je,{accounts:i,application:e,component:{...a},onComponentUpdate:n}),/* @__PURE__ */qt.createElement(qe,{label:"Target"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",name:"target",onChange:e=>r({target:e.target.value}),value:a.target||Ye.TARGET_LIST[0].val},Ye.TARGET_LIST.map(e=>/* @__PURE__ */qt.createElement("option",{key:e.val,title:e.description,value:e.val},e.label)))),/* @__PURE__ */qt.createElement(qe,{label:"Action"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",name:"action",onChange:e=>r({action:e.target.value}),value:a.action||ci[0].value},ci.map(e=>/* @__PURE__ */qt.createElement("option",{key:e.value,value:e.value},e.label)))),c&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(qe,{label:"Min Size"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",min:0,name:"minSize",onChange:e=>r({minSize:Number(e.target.value)}),value:null!=(l=a.minSize)?l:0})),/* @__PURE__ */qt.createElement(qe,{label:"Max Group Prepared Capacity"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",min:-1,name:"maxGroupPreparedCapacity",onChange:e=>r({maxGroupPreparedCapacity:Number(e.target.value)}),value:null!=(s=a.maxGroupPreparedCapacity)?s:-1})),/* @__PURE__ */qt.createElement(qe,{label:"Instance State"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",name:"poolState",onChange:e=>r({poolState:e.target.value}),value:a.poolState||di[0]},di.map(e=>/* @__PURE__ */qt.createElement("option",{key:e,value:e},e)))),/* @__PURE__ */qt.createElement(qe,{label:"Reuse Instances on Scale In"},/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:!!a.reuseOnScaleIn,onChange:e=>r({reuseOnScaleIn:e.target.checked})}))))},executionConfigSections:["modifyWarmPoolConfig","taskStatus"],validators:[{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"target"},{type:"requiredField",fieldName:"action"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}],cloudProvider:"aws",strategy:!0};function ui(){We.pipeline.registerStage(mi)}ui();const pi=[{label:"Scale Up",value:"scale_up"},{label:"Scale Down",value:"scale_down"},{label:"Scale to Cluster Size",value:"scale_to_cluster"},{label:"Scale to Exact Size",value:"scale_exact"}],hi=[{label:"Percentage",value:"pct"},{label:"Incremental",value:"incr"}],gi=String.raw`(?:\$\{.+\}|\d+)`;function vi(e){return"string"==typeof e&&/^\$\{[\s\S]+\}$/.test(e)}function fi(e,t,a){if(vi(e))return!0;if("number"!=typeof e&&"string"!=typeof e)return!1;const n=Number(e);return Number.isFinite(n)&&n>=0&&Number.isInteger(n)&&(void 0===a||n<=a)}function Ei({ariaLabel:e,dataCapacityField:t,maximum:a,name:n,onValidChange:r,resetKey:l,value:s}){const[i,o]=Wt(null!=s?s:"");jt(()=>o(null!=s?s:""),[l,s]);const c=fi(i,0,a);/* @__PURE__ */
|
|
139
|
+
return qt.createElement("input",{"aria-label":e,"aria-invalid":!c,className:"form-control input-sm","data-capacity-field":t,inputMode:"numeric",name:n,onChange:e=>{const t=e.target.value;o(t),fi(t,0,a)&&r(function(e){return vi(e)||!fi(e)?e:Number(e)}(t))},pattern:gi,required:!0,value:i})}const yi={key:"resizeServerGroup",provides:"resizeServerGroup",alias:"resizeAsg",cloudProvider:"aws",component:function(e){const{application:t,pipeline:a,stage:n,stageFieldUpdated:r,updateStage:l,updateStageField:s}=e,[i,o]=Wt([]);jt(()=>{var e,a,r;const l={cloudProvider:"aws"},i={action:"exact"===n.resizeType?"scale_exact":pi[0].value,capacity:{},resizeType:hi[0].value,target:Ye.TARGET_LIST[0].val,targetHealthyDeployPercentage:100};Object.entries(i).forEach(([e,t])=>{void 0===n[e]&&(l[e]=t)}),!n.credentials&&(null==(e=t.defaultCredentials)?void 0:e.aws)&&(l.credentials=t.defaultCredentials.aws),(null==(a=n.regions)?void 0:a.length)||(l.regions=(null==(r=t.defaultRegions)?void 0:r.aws)?[t.defaultRegions.aws]:[]),n.isNew&&void 0===n.interestingHealthProviderNames&&t.attributes.platformHealthOnlyShowOverride&&t.attributes.platformHealthOnly&&(l.interestingHealthProviderNames=["Amazon"]),s(l)},[]),jt(()=>{let e=!0;return h.listAccounts("aws").then(t=>e&&o(t)),()=>{e=!1}},[]);const c=(e,t=n.resizeType||hi[0].value)=>{if("scale_exact"===e)return void l({action:e,resizeType:"exact",scaleNum:void 0,scalePct:void 0});const a="incr"===t?"incr":"pct",r={action:e,capacity:{},resizeType:a,scaleNum:void 0,scalePct:void 0};"pct"===a?r.scalePct=n.scalePct||0:r.scaleNum=n.scaleNum||0,l(r)};/* @__PURE__ */
|
|
140
|
+
return qt.createElement("div",{className:"form-horizontal"},!a.strategy&&/* @__PURE__ */qt.createElement(Je,{accounts:i,application:t,component:n,onComponentUpdate:r}),/* @__PURE__ */qt.createElement(qe,{label:"Target"},/* @__PURE__ */qt.createElement(Qe,{model:{target:n.target},options:Ye.TARGET_LIST,onChange:e=>s({target:e})})),/* @__PURE__ */qt.createElement(qe,{label:"Action",helpKey:"pipeline.config.resizeAsg.action"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",name:"action",onChange:e=>c(e.target.value),required:!0,value:n.action},pi.map(e=>/* @__PURE__ */qt.createElement("option",{key:e.value,value:e.value},e.label)))),"scale_exact"!==n.action&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(qe,{label:"scale_to_cluster"===n.action?"Additional Capacity":"Type"},/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",name:"resizeType",onChange:e=>c(n.action,e.target.value),required:!0,value:n.resizeType},hi.map(e=>/* @__PURE__ */qt.createElement("option",{key:e.value,value:e.value},e.label)))),"pct"===n.resizeType&&/* @__PURE__ */qt.createElement(qe,{label:"Resize Percentage"},/* @__PURE__ */qt.createElement(Ei,{ariaLabel:"Resize percentage",name:"scalePct",onValidChange:e=>s({scalePct:e}),resetKey:n.refId,value:n.scalePct})),"incr"===n.resizeType&&/* @__PURE__ */qt.createElement(qe,{label:"Resize Count"},/* @__PURE__ */qt.createElement(Ei,{ariaLabel:"Resize count",name:"scaleNum",onValidChange:e=>s({scaleNum:e}),resetKey:n.refId,value:n.scaleNum})),("scale_up"===n.action||"scale_to_cluster"===n.action)&&/* @__PURE__ */qt.createElement(qe,{label:"Target Healthy Percentage"},/* @__PURE__ */qt.createElement(Ei,{ariaLabel:"Target healthy percentage",maximum:100,name:"targetHealthyDeployPercentage",onValidChange:e=>s({targetHealthyDeployPercentage:e}),resetKey:n.refId,value:n.targetHealthyDeployPercentage}))),"scale_exact"===n.action&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(qe,{label:"Capacity"},/* @__PURE__ */qt.createElement("div",{className:"row small"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3"},"Min"),/* @__PURE__ */qt.createElement("div",{className:"col-md-3"},"Max"),/* @__PURE__ */qt.createElement("div",{className:"col-md-3"},"Desired"))),/* @__PURE__ */qt.createElement(qe,{label:"Match Capacity"},/* @__PURE__ */qt.createElement("div",{className:"row"},["min","max","desired"].map(e=>{var t;/* @__PURE__ */
|
|
141
|
+
return qt.createElement("div",{className:"col-md-3",key:e},/* @__PURE__ */qt.createElement(Ei,{ariaLabel:("min"===e?"Minimum":"max"===e?"Maximum":"Desired")+" capacity",dataCapacityField:e,name:`capacity.${e}`,onValidChange:t=>s({capacity:{...n.capacity,[e]:t}}),resetKey:n.refId,value:null==(t=n.capacity)?void 0:t[e]}))}))),/* @__PURE__ */qt.createElement(qe,{label:""},/* @__PURE__ */qt.createElement("em",{className:"subinput-note"},"This is the exact amount to which the target server group will be scaled"))),t.attributes.platformHealthOnlyShowOverride&&/* @__PURE__ */qt.createElement(qe,{label:"Task Completion"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:n.interestingHealthProviderNames||[],onChange:e=>s({interestingHealthProviderNames:e}),platformHealthType:"Amazon"})))},accountExtractor:e=>[e.context.credentials],configAccountExtractor:e=>[e.credentials],validators:[{type:"targetImpedance",message:"This pipeline will attempt to resize a server group without deploying a new version into the same cluster."},{type:"requiredField",fieldName:"target"},{type:"requiredField",fieldName:"action"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"},{type:"custom",preventSave:!0,validate:(e,t)=>function(e){var t;if("scale_exact"===e.action){const a=[["min","Minimum"],["max","Maximum"],["desired","Desired"]];for(const[n,r]of a)if(!fi(null==(t=e.capacity)?void 0:t[n]))return`${r} capacity must be a nonnegative integer or pipeline expression.`}else{if("pct"===e.resizeType&&!fi(e.scalePct))return"Resize percentage must be a nonnegative integer or pipeline expression.";if("incr"===e.resizeType&&!fi(e.scaleNum))return"Resize count must be a nonnegative integer or pipeline expression."}return"scale_up"!==e.action&&"scale_to_cluster"!==e.action||fi(e.targetHealthyDeployPercentage,0,100)?"":"Target healthy percentage must be an integer from 0 through 100 or pipeline expression."}(t)}]};function bi(){We.pipeline.registerStage(yi)}bi();const Ci={key:"rollbackCluster",provides:"rollbackCluster",cloudProvider:"aws",component:function(e){var t,a,n;const{application:r,pipeline:l,stage:s,stageFieldUpdated:i,updateStageField:c}=e,[d,m]=Wt([]);return jt(()=>{var e;const t={};"aws"!==s.cloudProvider&&(t.cloudProvider="aws"),!s.credentials&&(null==(e=r.defaultCredentials)?void 0:e.aws)&&(t.credentials=r.defaultCredentials.aws),s.targetHealthyRollbackPercentage||(t.targetHealthyRollbackPercentage=100),s.isNew&&r.attributes.platformHealthOnlyShowOverride&&r.attributes.platformHealthOnly&&void 0===s.interestingHealthProviderNames&&(t.interestingHealthProviderNames=["Amazon"]),Object.keys(t).length&&c(t)},[]),jt(()=>{let e=!0;return h.listAccounts("aws").then(t=>e&&m(t)),()=>{e=!1}},[]),/* @__PURE__ */qt.createElement("div",{className:"form-horizontal"},!l.strategy&&/* @__PURE__ */qt.createElement(Je,{accounts:d,application:r,component:s,onComponentUpdate:i}),r.attributes.platformHealthOnlyShowOverride&&/* @__PURE__ */qt.createElement(qe,{label:"Task Completion"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:s.interestingHealthProviderNames||[],onChange:e=>c({interestingHealthProviderNames:e}),platformHealthType:"Amazon"})),/* @__PURE__ */qt.createElement("div",{className:"row"},(s.regions||[]).length>1&&/* @__PURE__ */qt.createElement("div",{className:"col-sm-10 col-sm-offset-2"},"Wait"," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",min:0,onChange:e=>c({waitTimeBetweenRegions:Number(e.target.value)}),type:"number",value:null!=(t=s.waitTimeBetweenRegions)?t:""})," ","seconds between regional rollbacks."),/* @__PURE__ */qt.createElement("div",{className:"col-sm-10 col-sm-offset-2"},"Consider rollback successful when"," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",max:100,min:0,onChange:e=>c({targetHealthyRollbackPercentage:Number(e.target.value)}),type:"number",value:null!=(a=s.targetHealthyRollbackPercentage)?a:""})," ","percent of instances are healthy."),o.feature.dynamicRollbackTimeout&&/* @__PURE__ */qt.createElement("div",{className:"col-sm-10 col-sm-offset-2"},"Rollback Timeout is"," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm inline-number",max:100,min:0,onChange:e=>c({rollbackTimeout:Number(e.target.value)}),type:"number",value:null!=(n=s.rollbackTimeout)?n:""})," ","minutes.")))},validators:[{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}]};function Ni(){We.pipeline.registerStage(Ci)}function Si(e){const{values:t}=e.formik;/* @__PURE__ */
|
|
142
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{name:"triggerArns",label:"Event ARNs",help:/* @__PURE__ */qt.createElement(c,{content:"The resource ARNs for Lambda event trigger sources. Input the entire ARN and select `Create option TRIGGER-ARN-INPUT` to add the ARN."}),input:a=>/* @__PURE__ */qt.createElement(mt,{...a,multi:!0,placeholder:"Input ARN...",onChange:t=>{var a,n;a=t,n="triggerArns",e.formik.setFieldValue(n,a.map(e=>e.value))},value:t.triggerArns?t.triggerArns.map(e=>({value:e,label:e})):[]}),required:!1}),/* @__PURE__ */qt.createElement(u,{name:"batchsize",label:"Event Batch Size",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:1,max:10}),required:!1}))}function wi(e){const{values:t}=e.formik,a=ut(pt.BITBUCKET_FILE,pt.CUSTOM_OBJECT,pt.EMBEDDED_BASE64,pt.GCS_OBJECT,pt.GITHUB_FILE,pt.GITLAB_FILE,pt.S3_OBJECT,pt.HTTP_FILE),n=(t,a)=>{e.formik.setFieldValue(`${a}.id`,null),e.formik.setFieldValue(`${a}.artifact`,t),e.formik.setFieldValue(`${a}.account`,t.artifactAccount)},r=(t,a)=>{e.formik.setFieldValue(`${a}.id`,t),e.formik.setFieldValue(`${a}.artifact`,null)},l=(e,t)=>e[t]?e[t]:{account:"",id:""};/* @__PURE__ */
|
|
143
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{name:"destroyOnFail",label:"On Fail",input:e=>/* @__PURE__ */qt.createElement(v,{text:"Destroy latest lambda version on fail.",...e})}),/* @__PURE__ */qt.createElement(u,{name:"timeout",label:"Timeout",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0,max:900})}),/* @__PURE__ */qt.createElement(rt,{artifact:l(t,"payloadArtifact").artifact,excludedArtifactTypePatterns:a,expectedArtifactId:l(t,"payloadArtifact").id,label:"Payload Artifact",onArtifactEdited:e=>{n(e,"payloadArtifact")},helpKey:"",onExpectedArtifactSelected:e=>r(e.id,"payloadrtifact"),pipeline:e.pipeline,stage:t}),/* @__PURE__ */qt.createElement(rt,{artifact:l(t,"outputArtifact").artifact,excludedArtifactTypePatterns:a,expectedArtifactId:l(t,"outputArtifact").id,label:"Output Artifact",onArtifactEdited:e=>{n(e,"outputArtifact")},helpKey:"",onExpectedArtifactSelected:e=>r(e.id,"outputArtifact"),pipeline:e.pipeline,stage:t}))}Ni();const ki=[{label:"Lambda Invocation",value:"$LAMBDA"}];function Ti(e){const{values:t}=e.formik;/* @__PURE__ */
|
|
144
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement(u,{label:"Health Check Type",name:"healthCheckType",input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,options:ki})}),t.healthCheckType?function(e,t){return"$LAMBDA"===e?/* @__PURE__ */qt.createElement(wi,{...t}):null}(t.healthCheckType,e):null)}const Ii=[{label:"Simple",value:"$SIMPLE",description:"Route 100% of traffic to specified version"},{label:"Weighted Deployment",value:"$WEIGHTED",description:"Split the traffic weight between two function versions."},{label:"Blue/Green",value:"$BLUEGREEN",description:"Disable all previous versions once the latest version passes health checks."}];class Pi extends qt.Component{constructor(e){super(e);const{value:t}=this.props,a=Ii.filter(e=>e.value===t)[0];this.state={label:a.label,value:a.value,description:a.description}}render(){/* @__PURE__ */
|
|
145
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("b",null," ",this.state.label," "),/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("small",null," ",this.state.description," "))}}const Ai=[{label:"Newest Function Version",value:"$LATEST",description:"Selects the most recently deployed function when this stage starts."},{label:"Previous Function Version",value:"$PREVIOUS",description:"Selects the second-most recently deployed function when this stage starts."},{label:"Oldest Function Verion",value:"$OLDEST",description:"Selects the least recently deployed function when this stage starts."},{label:"Provide Version Number",value:"$PROVIDED",description:"Provide a specific version number to destroy."}];class Gi extends qt.Component{constructor(e){super(e);const{value:t}=this.props,a=Ai.filter(e=>e.value===t)[0];this.state={label:a.label,value:a.value,description:a.description}}render(){/* @__PURE__ */
|
|
146
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("b",null," ",this.state.label," ")," ",/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("small",null," ",this.state.description," "))}}function xi(e){const{values:t}=e.formik,{functions:a}=e.application;/* @__PURE__ */
|
|
147
|
+
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement(u,{label:"Target Version",name:"versionNameA",onChange:t=>{e.formik.setFieldValue("trafficPercentA",100),e.formik.setFieldValue("versionNameA",t)},input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,options:Ai,optionRenderer:e=>/* @__PURE__ */qt.createElement(Gi,{value:e.value,showingDetails:!0})})}),"$PROVIDED"===t.versionNameA?/* @__PURE__ */qt.createElement(u,{label:"Version Number",name:"versionNumberA",input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,stringOptions:a.data.filter(e=>e.account===t.account).filter(e=>e.region===t.region).filter(e=>e.functionName===t.functionName).flatMap(e=>Object.values(e.revisions).sort(function(e,t){return t-e})).filter(e=>"$LATEST"!==e)})}):null,/* @__PURE__ */qt.createElement(u,{name:"trafficPercentA",label:"Traffic %",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0,max:100,value:100,disabled:!0})}))}function Di(e){const{values:t}=e.formik,{functions:a}=e.application;/* @__PURE__ */
|
|
148
|
+
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement(u,{label:"Target Version",name:"versionNameA",input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,options:Ai,optionRenderer:e=>/* @__PURE__ */qt.createElement(Gi,{value:e.value,showingDetails:!0})})}),"$PROVIDED"===t.versionNameA?/* @__PURE__ */qt.createElement(u,{label:"Version Number",name:"versionNumberA",input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,stringOptions:a.data.filter(e=>e.account===t.account).filter(e=>e.region===t.region).filter(e=>e.functionName===t.functionName).flatMap(e=>Object.values(e.revisions).sort(function(e,t){return t-e})).filter(e=>"$LATEST"!==e)})}):null,/* @__PURE__ */qt.createElement(u,{name:"trafficPercentA",label:"Traffic %",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0,max:100})}),/* @__PURE__ */qt.createElement(u,{label:"Version Name",name:"versionNameB",input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,options:Ai,optionRenderer:e=>/* @__PURE__ */qt.createElement(Gi,{value:e.value,showingDetails:!0})})}),"$PROVIDED"===t.versionNameB?/* @__PURE__ */qt.createElement(u,{label:"Version Number",name:"versionNumberB",input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,stringOptions:a.data.filter(e=>e.account===t.account).filter(e=>e.region===t.region).filter(e=>e.functionName===t.functionName).flatMap(e=>Object.values(e.revisions).sort(function(e,t){return t-e})).filter(e=>"$LATEST"!==e)})}):null,/* @__PURE__ */qt.createElement(u,{name:"trafficPercentB",label:"Traffic %",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0,max:100,disabled:!0,value:t.trafficPercentA||0===t.trafficPercentA?100-t.trafficPercentA:null})}))}function Bi(e){const{values:t}=e.formik;/* @__PURE__ */
|
|
149
149
|
return qt.createElement("div",{className:"form-horizontal"},t.deploymentStrategy?function(e,t){switch(e){case"$SIMPLE":/* @__PURE__ */
|
|
150
|
-
return qt.createElement(
|
|
151
|
-
return qt.createElement(
|
|
152
|
-
return qt.createElement(
|
|
153
|
-
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement("h4",null," Basic Settings "),/* @__PURE__ */qt.createElement(u,{label:"Account",name:"account",onChange:t=>{e.formik.setFieldValue("region",null),e.formik.setFieldValue("functionName",null),e.formik.setFieldValue("account",t)},required:!0,input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,isLoading:"PENDING"===r,stringOptions:n.map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Region",name:"region",onChange:t=>{e.formik.setFieldValue("functionName",null),e.formik.setFieldValue("region",t)},input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!t.account,placeholder:t.account?"Select...":"Select an Account...",...e,isLoading:"PENDING"===r,stringOptions:n.filter(e=>e.name===t.account).flatMap(e=>e.regions).map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Function Name",name:"functionName",input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!(t.account&&t.region),placeholder:t.account&&t.region?"Select...":"Select an Account and Region...",...e,stringOptions:l})}),/* @__PURE__ */qt.createElement(u,{label:"Alias",name:"aliasName",input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),/* @__PURE__ */qt.createElement("h4",null," Alias Settings "),/* @__PURE__ */qt.createElement(
|
|
154
|
-
return qt.createElement(_e,{name:e.name,current:e.current},/* @__PURE__ */qt.createElement(Ke,{stage:t,message:t.outputs.failureMessage}),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null," Function Name: ",t.outputs.functionName?t.outputs.functionName:"N/A"," "),/* @__PURE__ */qt.createElement("p",null," ","Deployed Alias:"," ",t.outputs["deployment:aliasDeployed"]?t.outputs["deployment:aliasDeployed"]:"N/A"," "),/* @__PURE__ */qt.createElement("p",null," ","Deployed Major Version:"," ",t.outputs["deployment:majorVersionDeployed"]?t.outputs["deployment:majorVersionDeployed"]:"N/A"," ")))}function
|
|
155
|
-
return qt.createElement("div",{className:"RouteLambdaStageConfig"},/* @__PURE__ */qt.createElement(at,{...e,validate:
|
|
150
|
+
return qt.createElement(xi,{...t});case"$WEIGHTED":/* @__PURE__ */
|
|
151
|
+
return qt.createElement(Di,{...t});case"$BLUEGREEN":/* @__PURE__ */
|
|
152
|
+
return qt.createElement(Ti,{...t});default:return null}}(t.deploymentStrategy,e):null)}function Fi(e){const{values:t}=e.formik,{functions:a}=e.application,{result:n,status:r}=b(()=>h.listAccounts("aws"),[],[]),l=t.account&&t.region?a.data.filter(e=>e.account===t.account).filter(e=>e.region===t.region).map(e=>e.functionName):[];/* @__PURE__ */
|
|
153
|
+
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement("h4",null," Basic Settings "),/* @__PURE__ */qt.createElement(u,{label:"Account",name:"account",onChange:t=>{e.formik.setFieldValue("region",null),e.formik.setFieldValue("functionName",null),e.formik.setFieldValue("account",t)},required:!0,input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,isLoading:"PENDING"===r,stringOptions:n.map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Region",name:"region",onChange:t=>{e.formik.setFieldValue("functionName",null),e.formik.setFieldValue("region",t)},input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!t.account,placeholder:t.account?"Select...":"Select an Account...",...e,isLoading:"PENDING"===r,stringOptions:n.filter(e=>e.name===t.account).flatMap(e=>e.regions).map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Function Name",name:"functionName",input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!(t.account&&t.region),placeholder:t.account&&t.region?"Select...":"Select an Account and Region...",...e,stringOptions:l})}),/* @__PURE__ */qt.createElement(u,{label:"Alias",name:"aliasName",input:e=>/* @__PURE__ */qt.createElement(p,{...e})}),/* @__PURE__ */qt.createElement("h4",null," Alias Settings "),/* @__PURE__ */qt.createElement(Si,{...e}),/* @__PURE__ */qt.createElement(u,{name:"provisionedConcurrentExecutions",label:"Provisioned Concurrency",help:/* @__PURE__ */qt.createElement(c,{content:"To enable your function to scale without fluctuations in latency, use provisioned concurrency. Provisioned concurrency runs continually and has separate pricing for concurrency and execution duration. Concurrency cannot be provisioned with a weighted deployment strategy."}),input:e=>"$WEIGHTED"===t.deploymentStrategy?/* @__PURE__ */qt.createElement(E,{...e,min:0,max:0}):/* @__PURE__ */qt.createElement(E,{...e,min:0,max:3e3}),required:!1}),/* @__PURE__ */qt.createElement("h4",null," Deployment Strategy "),/* @__PURE__ */qt.createElement(u,{label:"Strategy",name:"deploymentStrategy",help:/* @__PURE__ */qt.createElement(c,{content:""}),input:t=>/* @__PURE__ */qt.createElement(g,{...t,clearable:!1,options:Ii,optionRenderer:t=>/* @__PURE__ */qt.createElement(Pi,{config:e,value:t.value,showingDetails:!0})})}),t.deploymentStrategy?/* @__PURE__ */qt.createElement(Bi,{...e}):null)}function Mi(e){const{stage:t}=e;/* @__PURE__ */
|
|
154
|
+
return qt.createElement(_e,{name:e.name,current:e.current},/* @__PURE__ */qt.createElement(Ke,{stage:t,message:t.outputs.failureMessage}),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null," Function Name: ",t.outputs.functionName?t.outputs.functionName:"N/A"," "),/* @__PURE__ */qt.createElement("p",null," ","Deployed Alias:"," ",t.outputs["deployment:aliasDeployed"]?t.outputs["deployment:aliasDeployed"]:"N/A"," "),/* @__PURE__ */qt.createElement("p",null," ","Deployed Major Version:"," ",t.outputs["deployment:majorVersionDeployed"]?t.outputs["deployment:majorVersionDeployed"]:"N/A"," ")))}function Ri(e){const t=new m(e);return t.field("triggerArns","Trigger ARNs").optional().withValidators((e,t)=>e.map(e=>xn(e,e)).every(e=>void 0===e)?void 0:"Invalid ARN. Event ARN must match regular expression: /^arn:aws[a-zA-Z-]?:[a-zA-Z_0-9.-]+:./"),t.validateForm()}(Mi||(Mi={})).title="Route Lambda Traffic Stage";const Li={key:"Aws.LambdaTrafficRoutingStage",label:"AWS Lambda Route",description:"Route traffic across various versions of your Lambda function",component:function(e){/* @__PURE__ */
|
|
155
|
+
return qt.createElement("div",{className:"RouteLambdaStageConfig"},/* @__PURE__ */qt.createElement(at,{...e,validate:Ri,onChange:e.updateStage,render:e=>/* @__PURE__ */qt.createElement(Fi,{...e})}))},executionDetailsSections:[Mi,Ze],validateFn:Ri};function zi(){o.feature.lambdaAdditionalStages&&We.pipeline.registerStage(Li)}const Oi={key:"scaleDownCluster",provides:"scaleDownCluster",cloudProvider:"aws",component:function(e){var t,a;const{application:n,pipeline:r,stage:l,stageFieldUpdated:s,updateStageField:i}=e,[o,c]=Wt([]);return jt(()=>{var e;const t={};"aws"!==l.cloudProvider&&(t.cloudProvider="aws"),!l.credentials&&(null==(e=n.defaultCredentials)?void 0:e.aws)&&(t.credentials=n.defaultCredentials.aws),void 0===l.remainingFullSizeServerGroups&&(t.remainingFullSizeServerGroups=1),void 0===l.allowScaleDownActive&&(t.allowScaleDownActive=!1),void 0===l.preferLargerOverNewer&&(t.preferLargerOverNewer="false"),Object.keys(t).length&&i(t)},[]),jt(()=>{let e=!0;return h.listAccounts("aws").then(t=>e&&c(t)),()=>{e=!1}},[]),/* @__PURE__ */qt.createElement("div",{className:"form-horizontal"},!r.strategy&&/* @__PURE__ */qt.createElement(Je,{accounts:o,application:n,component:l,onComponentUpdate:s}),/* @__PURE__ */qt.createElement(qe,{label:"Scale Down Options"},/* @__PURE__ */qt.createElement("div",{className:"form-inline"},/* @__PURE__ */qt.createElement("p",null,"Keep the"," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",min:0,onChange:e=>i({remainingFullSizeServerGroups:Number(e.target.value)}),required:!0,style:{width:50},type:"number",value:null!=(t=l.remainingFullSizeServerGroups)?t:""})," ",/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",onChange:e=>i({preferLargerOverNewer:e.target.value}),style:{width:100},value:null!=(a=l.preferLargerOverNewer)?a:"false"},
|
|
156
156
|
/* @__PURE__ */qt.createElement("option",{value:"true"},"largest"),
|
|
157
|
-
/* @__PURE__ */qt.createElement("option",{value:"false"},"newest"))," ",(d="server group",1===l.remainingFullSizeServerGroups?d:`${d}s`)," at current size."),/* @__PURE__ */qt.createElement("p",null,"The remaining server groups will be scaled down to zero instances."))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-offset-3 col-md-6 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!!l.allowScaleDownActive,onChange:e=>i({allowScaleDownActive:e.target.checked}),type:"checkbox"}),"Allow scale down of active server groups"))));var d},accountExtractor:e=>[e.context.credentials],configAccountExtractor:e=>[e.credentials],validators:[{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"remainingFullSizeServerGroups",fieldLabel:"Keep [X] full size Server Groups"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}],strategy:!0};function
|
|
157
|
+
/* @__PURE__ */qt.createElement("option",{value:"false"},"newest"))," ",(d="server group",1===l.remainingFullSizeServerGroups?d:`${d}s`)," at current size."),/* @__PURE__ */qt.createElement("p",null,"The remaining server groups will be scaled down to zero instances."))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-offset-3 col-md-6 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!!l.allowScaleDownActive,onChange:e=>i({allowScaleDownActive:e.target.checked}),type:"checkbox"}),"Allow scale down of active server groups"))));var d},accountExtractor:e=>[e.context.credentials],configAccountExtractor:e=>[e.credentials],validators:[{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"remainingFullSizeServerGroups",fieldLabel:"Keep [X] full size Server Groups"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}],strategy:!0};function $i(){We.pipeline.registerStage(Oi)}$i();const Ui={key:"shrinkCluster",provides:"shrinkCluster",cloudProvider:"aws",component:function(e){var t,a;const{application:n,pipeline:r,stage:l,stageFieldUpdated:s,updateStageField:i}=e,[o,c]=Wt([]);return jt(()=>{var e;const t={};"aws"!==l.cloudProvider&&(t.cloudProvider="aws"),!l.credentials&&(null==(e=n.defaultCredentials)?void 0:e.aws)&&(t.credentials=n.defaultCredentials.aws),void 0===l.shrinkToSize&&(t.shrinkToSize=1),void 0===l.allowDeleteActive&&(t.allowDeleteActive=!1),void 0===l.retainLargerOverNewer&&(t.retainLargerOverNewer="false"),l.isNew&&n.attributes.platformHealthOnlyShowOverride&&n.attributes.platformHealthOnly&&void 0===l.interestingHealthProviderNames&&(t.interestingHealthProviderNames=["Amazon"]),Object.keys(t).length&&i(t)},[]),jt(()=>{let e=!0;return h.listAccounts("aws").then(t=>e&&c(t)),()=>{e=!1}},[]),/* @__PURE__ */qt.createElement("div",{className:"form-horizontal"},!r.strategy&&/* @__PURE__ */qt.createElement(Je,{accounts:o,application:n,component:l,onComponentUpdate:s}),/* @__PURE__ */qt.createElement(qe,{label:"Shrink Options"},/* @__PURE__ */qt.createElement("div",{className:"form-inline"},"Shrink to"," ",/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",min:0,onChange:e=>i({shrinkToSize:Number(e.target.value)}),required:!0,style:{width:50},type:"number",value:null!=(t=l.shrinkToSize)?t:""})," ",(d="server group",1===l.shrinkToSize?d:`${d}s`),", keeping the"," ",/* @__PURE__ */qt.createElement("select",{className:"form-control input-sm",onChange:e=>i({retainLargerOverNewer:e.target.value}),style:{width:100},value:null!=(a=l.retainLargerOverNewer)?a:"false"},
|
|
158
158
|
/* @__PURE__ */qt.createElement("option",{value:"true"},"largest"),
|
|
159
|
-
/* @__PURE__ */qt.createElement("option",{value:"false"},"newest")))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-offset-3 col-md-6 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!!l.allowDeleteActive,onChange:e=>i({allowDeleteActive:e.target.checked}),type:"checkbox"}),"Allow deletion of active server groups"))),n.attributes.platformHealthOnlyShowOverride&&/* @__PURE__ */qt.createElement(qe,{label:"Task Completion"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:l.interestingHealthProviderNames||[],onChange:e=>i({interestingHealthProviderNames:e}),platformHealthType:"Amazon"})));var d},accountExtractor:e=>[e.context.credentials],configAccountExtractor:e=>[e.credentials],validators:[{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"shrinkToSize",fieldLabel:"shrink to [X] Server Groups"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}]};function
|
|
160
|
-
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement("h4",null," Basic Settings "),/* @__PURE__ */qt.createElement(u,{label:"Account",name:"account",onChange:t=>{e.formik.setFieldValue("region",null),e.formik.setFieldValue("functionName",null),e.formik.setFieldValue("account",t)},required:!0,input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,isLoading:"PENDING"===r,stringOptions:n.map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Region",name:"region",onChange:t=>{e.formik.setFieldValue("functionName",null),e.formik.setFieldValue("region",t)},input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!t.account,placeholder:t.account?"Select...":"Select an Account...",...e,isLoading:"PENDING"===r,stringOptions:n.filter(e=>e.name===t.account).flatMap(e=>e.regions).map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Function Name",name:"functionName",input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!(t.account&&t.region),placeholder:t.account&&t.region?"Select...":"Select an Account and Region...",...e,stringOptions:l})}),/* @__PURE__ */qt.createElement(u,{name:"s3bucket",label:"S3 Bucket",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.s3bucket"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"S3 bucket name"})}),/* @__PURE__ */qt.createElement(u,{name:"s3key",label:"S3 Key",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.s3key"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"object.zip"})}),/* @__PURE__ */qt.createElement(u,{name:"publish",label:"Publish",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.publish"}),input:e=>/* @__PURE__ */qt.createElement(v,{...e})}))}function
|
|
161
|
-
return qt.createElement(_e,{name:n,current:a},/* @__PURE__ */qt.createElement(Ke,{stage:t,message:t.outputs.failureMessage}),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null," ",/* @__PURE__ */qt.createElement("b",null," Function Name: ")," ",t.outputs.functionName?t.outputs.functionName:"N/A"," "),/* @__PURE__ */qt.createElement("p",null," ",/* @__PURE__ */qt.createElement("b",null," Function ARN: ")," ",t.outputs.functionARN?t.outputs.functionARN:"N/A"," ")))}
|
|
162
|
-
return qt.createElement("div",{className:"LambdaUpdateCodeConfig"},/* @__PURE__ */qt.createElement(at,{...e,validate:
|
|
159
|
+
/* @__PURE__ */qt.createElement("option",{value:"false"},"newest")))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-offset-3 col-md-6 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:!!l.allowDeleteActive,onChange:e=>i({allowDeleteActive:e.target.checked}),type:"checkbox"}),"Allow deletion of active server groups"))),n.attributes.platformHealthOnlyShowOverride&&/* @__PURE__ */qt.createElement(qe,{label:"Task Completion"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:l.interestingHealthProviderNames||[],onChange:e=>i({interestingHealthProviderNames:e}),platformHealthType:"Amazon"})));var d},accountExtractor:e=>[e.context.credentials],configAccountExtractor:e=>[e.credentials],validators:[{type:"requiredField",fieldName:"cluster"},{type:"requiredField",fieldName:"shrinkToSize",fieldLabel:"shrink to [X] Server Groups"},{type:"requiredField",fieldName:"regions"},{type:"requiredField",fieldName:"credentials",fieldLabel:"account"}]};function Vi(){We.pipeline.registerStage(Ui)}Vi();const Hi={key:"upsertImageTags",provides:"upsertImageTags",cloudProvider:"aws",component:function({pipeline:e,stage:t,updateStageField:a}){const n=t.consideredStages||[],r=ht.getAllUpstreamDependencies(e,t).filter(e=>Ye.IMAGE_PRODUCING_STAGES.includes(e.type)),l=new Set(r.map(e=>e.refId)),s=n.filter(e=>!l.has(e));return qt.useEffect(()=>{const e={};void 0===t.cloudProvider&&(e.cloudProvider="aws"),void 0===t.tags&&(e.tags={}),Object.keys(e).length&&a(e)},[t.cloudProvider,t.tags,a]),/* @__PURE__ */qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement(qe,{label:"Tags"},/* @__PURE__ */qt.createElement(lt,{allowEmpty:!0,model:t.tags||{},onChange:e=>a({tags:e}),pipeline:e})),/* @__PURE__ */qt.createElement(qe,{helpKey:"aws.tagImage.consideredStages",label:"Stages (optional)"},/* @__PURE__ */qt.createElement("div",{className:"checkbox"},r.map(e=>/* @__PURE__ */qt.createElement("label",{key:e.refId,style:{display:"block"}},/* @__PURE__ */qt.createElement("input",{checked:n.includes(e.refId),onChange:t=>{return a({consideredStages:(r=n,l=e.refId,s=t.target.checked,s&&!r.includes(l)?[...r,l]:s?r:r.filter(e=>e!==l))});var r,l,s},type:"checkbox",value:e.refId})," ",e.name||e.refId)),s.map(e=>/* @__PURE__ */qt.createElement("label",{key:e,style:{display:"block"}},/* @__PURE__ */qt.createElement("input",{checked:!0,disabled:!0,readOnly:!0,type:"checkbox",value:e})," ",e," ","(unavailable)")))))}};function qi(){We.pipeline.registerStage(Hi)}function Wi(e){const{values:t}=e.formik,{functions:a}=e.application,{result:n,status:r}=b(()=>h.listAccounts("aws"),[],[]),l=t.account&&t.region?a.data.filter(e=>e.account===t.account).filter(e=>e.region===t.region).map(e=>e.functionName):[];/* @__PURE__ */
|
|
160
|
+
return qt.createElement("div",{className:"form-horizontal"},/* @__PURE__ */qt.createElement("h4",null," Basic Settings "),/* @__PURE__ */qt.createElement(u,{label:"Account",name:"account",onChange:t=>{e.formik.setFieldValue("region",null),e.formik.setFieldValue("functionName",null),e.formik.setFieldValue("account",t)},required:!0,input:e=>/* @__PURE__ */qt.createElement(g,{...e,clearable:!1,isLoading:"PENDING"===r,stringOptions:n.map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Region",name:"region",onChange:t=>{e.formik.setFieldValue("functionName",null),e.formik.setFieldValue("region",t)},input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!t.account,placeholder:t.account?"Select...":"Select an Account...",...e,isLoading:"PENDING"===r,stringOptions:n.filter(e=>e.name===t.account).flatMap(e=>e.regions).map(e=>e.name)})}),/* @__PURE__ */qt.createElement(u,{label:"Function Name",name:"functionName",input:e=>/* @__PURE__ */qt.createElement(g,{clearable:!1,disabled:!(t.account&&t.region),placeholder:t.account&&t.region?"Select...":"Select an Account and Region...",...e,stringOptions:l})}),/* @__PURE__ */qt.createElement(u,{name:"s3bucket",label:"S3 Bucket",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.s3bucket"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"S3 bucket name"})}),/* @__PURE__ */qt.createElement(u,{name:"s3key",label:"S3 Key",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.s3key"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e,placeholder:"object.zip"})}),/* @__PURE__ */qt.createElement(u,{name:"publish",label:"Publish",help:/* @__PURE__ */qt.createElement(c,{id:"aws.function.publish"}),input:e=>/* @__PURE__ */qt.createElement(v,{...e})}))}function ji(e){const t=new m(e);return t.field("account","Account Name").required(),t.field("region","Region").required(),t.field("functionName","Lambda Function Name").required(),t.field("s3key","S3 Object Key").required(),t.field("s3bucket","S3 Bucket Name").required().withValidators(Gn),t.validateForm()}function Zi(e){const{stage:t,current:a,name:n}=e;/* @__PURE__ */
|
|
161
|
+
return qt.createElement(_e,{name:n,current:a},/* @__PURE__ */qt.createElement(Ke,{stage:t,message:t.outputs.failureMessage}),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null," ",/* @__PURE__ */qt.createElement("b",null," Function Name: ")," ",t.outputs.functionName?t.outputs.functionName:"N/A"," "),/* @__PURE__ */qt.createElement("p",null," ",/* @__PURE__ */qt.createElement("b",null," Function ARN: ")," ",t.outputs.functionARN?t.outputs.functionARN:"N/A"," ")))}qi(),(Zi||(Zi={})).title="Lambda Update Code Stage";const _i={key:"Aws.LambdaUpdateCodeStage",label:"AWS Lambda Update Code",description:"Update code for a single AWS Lambda Function",component:function(e){/* @__PURE__ */
|
|
162
|
+
return qt.createElement("div",{className:"LambdaUpdateCodeConfig"},/* @__PURE__ */qt.createElement(at,{...e,validate:ji,onChange:e.updateStage,render:e=>/* @__PURE__ */qt.createElement(Wi,{...e})}))},executionDetailsSections:[Zi,Ze],validateFn:ji};function Ki(){o.feature.lambdaAdditionalStages&&We.pipeline.registerStage(_i)}function Yi(e){return e.credentials||e.accountName||e.accountId||e.account||""}function Xi(e){return(e.inboundRules||[]).filter(e=>e.range).reduce((e,t)=>((t.portRanges||[]).forEach(a=>{e.push({cidr:t.range.ip+t.range.cidr,type:t.protocol,startPort:a.startPort,endPort:a.endPort})}),e),[])}function Ji(e,t){return(e.inboundRules||[]).filter(e=>e.securityGroup).reduce((a,n)=>((n.portRanges||[]).forEach(r=>{const l=n.securityGroup,s="edit"===t;a.push({...s?{account:l.account,accountId:l.accountId,accountName:l.accountName||l.accountId,existing:!0,id:l.id,vpcId:l.vpcId!==e.vpcId?l.vpcId:null}:{},name:l.inferredName?null:l.name,type:n.protocol,startPort:r.startPort,endPort:r.endPort})}),a),[])}function Qi(e,t){var a;const n=e.securityGroup||{},r=Yi(n)||e.credentials||"",l=n.region||e.region||(null==(a=n.regions)?void 0:a[0])||"",s=e.mode||"create",i=n.name||t,o={...n,account:r,accountId:n.accountId||r,accountName:n.accountName||r,credentials:r,description:n.description||"",ipIngress:n.ipIngress||Xi(n),name:i,region:l,regions:[l].filter(Boolean),securityGroupIngress:n.securityGroupIngress||Ji(n,s),vpcId:n.vpcId||""};return"clone"===s&&delete o.id,o}function eo(e){return!!e.type&&void 0!==e.startPort&&void 0!==e.endPort}function to(e){return!!e.name&&!!Yi(e)&&!!e.region&&(e.ipIngress||[]).every(e=>!!e.cidr&&eo(e))&&(e.securityGroupIngress||[]).every(e=>!(!e.name&&!e.id)&&eo(e))}const ao=class extends qt.Component{constructor(e){super(e),this.updateSecurityGroup=e=>{this.setState(({securityGroup:t})=>({securityGroup:{...t,...e}}))},this.updateRule=(e,t,a)=>{const n=this.state.securityGroup[e].slice();n[t]={...n[t],...a},this.updateSecurityGroup({[e]:n})},this.addIpRule=()=>{this.updateSecurityGroup({ipIngress:[...this.state.securityGroup.ipIngress,{cidr:"0.0.0.0/0",type:"tcp",startPort:7001,endPort:7001}]})},this.addSecurityGroupRule=()=>{this.updateSecurityGroup({securityGroupIngress:[...this.state.securityGroup.securityGroupIngress,{name:"",type:"tcp",startPort:7001,endPort:7001}]})},this.removeRule=(e,t)=>{this.updateSecurityGroup({[e]:this.state.securityGroup[e].filter((e,a)=>a!==t)})},this.onTaskComplete=()=>{var e,t;if(null==(t=null==(e=this.getApplication().securityGroups)?void 0:e.refresh)||t.call(e),this.props.closeModal(),"edit"===this.getMode())return;const{securityGroup:a}=this.state;this.props.stateService.go(this.props.stateService.includes("**.firewallDetails")?"^.firewallDetails":".firewallDetails",{accountId:Yi(a),name:a.name,provider:"aws",region:a.region,vpcId:a.vpcId})},this.submit=()=>{const e=this.getApplication(),{securityGroup:t}=this.state,a=Yi(t),n={...t,account:a,accountId:a,accountName:a,cloudProvider:"aws",credentials:a,regions:[t.region]},r="edit"===this.getMode()?"Update":"clone"===this.getMode()?"Clone":"Create";this.state.taskMonitor.submit(()=>gt.upsertSecurityGroup(n,e,r))};const t=this.getApplication(e);this.state={securityGroup:Qi(e,t.name),taskMonitor:new w({application:t,title:`${"edit"===this.getMode(e)?"Updating":"Creating"} your ${j.get("firewall")}`,onDismiss:()=>e.dismissModal(),onTaskComplete:this.onTaskComplete})}}static show(e){return I.show(ro,e,{dialogClassName:"modal-lg"})}getApplication(e=this.props){return e.app||e.application}getMode(e=this.props){return e.mode||"create"}renderTextField(e,t,a){/* @__PURE__ */
|
|
163
163
|
return qt.createElement("div",{className:"form-group row"},/* @__PURE__ */qt.createElement("label",{className:"col-md-3 sm-label-right"},e),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:t||"",onChange:e=>a(e.target.value)})))}renderIpRules(){const e=this.state.securityGroup.ipIngress||[];/* @__PURE__ */
|
|
164
164
|
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("h5",null,"IP Ingress"),e.map((e,t)=>/* @__PURE__ */qt.createElement("div",{className:"row",key:`ip-${t}`},/* @__PURE__ */qt.createElement("div",{className:"col-md-3"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.cidr||"",onChange:e=>this.updateRule("ipIngress",t,{cidr:e.target.value})})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.type||"",onChange:e=>this.updateRule("ipIngress",t,{type:e.target.value})})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",value:e.startPort,onChange:e=>this.updateRule("ipIngress",t,{startPort:Number(e.target.value)})})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",value:e.endPort,onChange:e=>this.updateRule("ipIngress",t,{endPort:Number(e.target.value)})})),/* @__PURE__ */qt.createElement("div",{className:"col-md-1"},/* @__PURE__ */qt.createElement(_a,{bsSize:"xsmall",onClick:()=>this.removeRule("ipIngress",t)},"Remove")))),/* @__PURE__ */qt.createElement(_a,{bsSize:"small",onClick:this.addIpRule},"Add IP Rule"))}renderSecurityGroupRules(){const e=this.state.securityGroup.securityGroupIngress||[];/* @__PURE__ */
|
|
165
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("h5",null,j.get("Firewall")," Ingress"),e.map((e,t)=>/* @__PURE__ */qt.createElement("div",{className:"row",key:`sg-${t}`},/* @__PURE__ */qt.createElement("div",{className:"col-md-3"},e.existing?/* @__PURE__ */qt.createElement("span",{className:"form-control-static"},e.name||e.id):/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.name||"",onChange:e=>this.updateRule("securityGroupIngress",t,{name:e.target.value})})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.type||"",onChange:e=>this.updateRule("securityGroupIngress",t,{type:e.target.value})})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",value:e.startPort,onChange:e=>this.updateRule("securityGroupIngress",t,{startPort:Number(e.target.value)})})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",value:e.endPort,onChange:e=>this.updateRule("securityGroupIngress",t,{endPort:Number(e.target.value)})})),/* @__PURE__ */qt.createElement("div",{className:"col-md-1"},/* @__PURE__ */qt.createElement(_a,{bsSize:"xsmall",onClick:()=>this.removeRule("securityGroupIngress",t)},"Remove")))),/* @__PURE__ */qt.createElement(_a,{bsSize:"small",onClick:this.addSecurityGroupRule},"Add ",j.get("Firewall")," Rule"))}render(){const{securityGroup:e,taskMonitor:t}=this.state,a=this.getMode(),n=
|
|
166
|
-
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(vt,{monitor:t}),/* @__PURE__ */qt.createElement(ye,{dismiss:this.props.dismissModal}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"edit"===a?"Edit":"clone"===a?"Clone":"Create"," ",j.get("Firewall"))),/* @__PURE__ */qt.createElement(Za.Body,null,this.renderTextField("Account",
|
|
167
|
-
return qt.createElement(z,{heading:t},e.map(e=>/* @__PURE__ */qt.createElement(q,{key:e.address,className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement(U,{label:"IP Range",value:e.address}),/* @__PURE__ */qt.createElement(U,{label:"Port Ranges",value:e.rules.map(t=>"-1"===t.protocol?/* @__PURE__ */qt.createElement("span",null,"All ports and protocols",e.rules.length>1?/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("em",null,"Additional port ranges are specified, but redundant:")):null):/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("span",null,t.protocol,":",t.startPort," → ",t.endPort)))}))))}};function
|
|
168
|
-
return qt.createElement(ja,{className:"dropdown",id:"amazon-security-group-actions-dropdown"},/* @__PURE__ */qt.createElement(ja.Toggle,{className:"btn btn-sm btn-primary dropdown-toggle"},j.get("Firewall")," Actions"),/* @__PURE__ */qt.createElement(ja.Menu,null,/* @__PURE__ */qt.createElement(Ka,{onClick:()=>{ft(n,e).then(t=>{t&&
|
|
169
|
-
/* @__PURE__ */qt.createElement("a",null,e.securityGroup.accountName!==r.accountName&&/* @__PURE__ */qt.createElement(L,{account:e.securityGroup.accountName||e.securityGroup.accountId})," ",e.securityGroup.name," (",e.securityGroup.id,")"))),/* @__PURE__ */qt.createElement("dt",null,"Port Ranges"),e.rules.map(e=>/* @__PURE__ */qt.createElement("dd",{key:`${e.protocol}-${e.startPort}-${e.endPort}`},e.protocol,": ",e.startPort," → ",e.endPort)))))))}};oo.contextType=C;let co=oo;const mo=G(co);class uo{resolveIndexedSecurityGroup(e,t,a){return uo.resolveIndexedSecurityGroup(e,t,a)}static resolveIndexedSecurityGroup(e,t,a){return e[t.account][t.region][a]}}class po{constructor(){this.supportsCompression=!0}normalizeSecurityGroup(e){return zn.listVpcs().then(t=>{const a=t.find(t=>t.id===e.vpcId);return e.vpcName=a?a.name:"",e})}compress(e){const t=oa(e,"vpcId");return Object.keys(t).forEach(e=>{t[e]=t[e].map(e=>[e.name,e.id])}),t}decompress(e){const t=[];return Object.keys(e).forEach(a=>{e[a].forEach(e=>{t.push({name:e[0],id:e[1],vpcId:a})})}),t}}function ho(e,t){function a(e,t){t=t||{};const a=h.getCredentialsKeyedByAccount("aws"),r=t.account||e.defaultCredentials.aws||Cn.defaults.account,l=t.region||e.defaultRegions.aws||Cn.defaults.region,s=t.subnet||Cn.defaults.subnetType||"",i=h.getAvailabilityZonesForAccountAndRegion("aws",r,l);return Promise.all([i,a]).then(function([a,i]){var o,c,d,m,u,p,h,g;const v=i[r],f=v?v.defaultKeyPair:null,E=null!=(d=null==(c=null==(o=e.attributes)?void 0:o.providerSettings)?void 0:c.aws)?d:{};let y=Cn.defaults.iamRole||"BaseIAMRole";y=y.replace("{{application}}",e.name);const b=E.useAmiBlockDeviceMappings||!1,C={application:e.name,credentials:r,region:l,strategy:"",capacity:{min:1,max:1,desired:1},targetHealthyDeployPercentage:100,cooldown:10,enabledMetrics:[],healthCheckType:"EC2",healthCheckGracePeriod:600,instanceMonitoring:!1,ebsOptimized:!1,selectedProvider:"aws",iamRole:y,terminationPolicies:["Default"],vpcId:null,subnetType:s,availabilityZones:a,keyPair:f,suspendedProcesses:[],securityGroups:[],stack:"",freeFormDetails:"",spotPrice:"",tags:{},useAmiBlockDeviceMappings:b,copySourceCustomBlockDeviceMappings:!1,viewState:{instanceProfile:"custom",useSimpleInstanceTypeSelector:!0,useAllImageSelection:!1,useSimpleCapacity:!0,usePreferredZones:!0,mode:t.mode||"create",disableStrategySelection:!0,dirty:{},submitButtonLabel:n(t.mode||"create")}};if((null==(m=e.attributes)?void 0:m.platformHealthOnlyShowOverride)&&(null==(u=e.attributes)?void 0:u.platformHealthOnly)&&(C.interestingHealthProviderNames=["Amazon"]),"test"===r&&(null==(p=Cn.serverGroups)?void 0:p.enableIPv6)&&(C.associateIPv6Address=!0),null==(h=Cn.serverGroups)?void 0:h.enableIMDSv2){const t=Cn.serverGroups.defaultIMDSv2AppAgeLimit,a=null==(g=e.attributes)?void 0:g.createTs;C.requireIMDSv2=t&&a&&Number(a)>t}return C})}function n(e){switch(e){case"createPipeline":return"Add";case"editPipeline":return"Done";case"clone":return"Clone";default:return"Create"}}function r(e){return!(e.onDemandAllocationStrategy||e.onDemandBaseCapacity||e.onDemandPercentageAboveBaseCapacity||e.spotAllocationStrategy||e.spotInstancePools||e.launchTemplateOverridesForInstanceType&&e.launchTemplateOverridesForInstanceType.length>0)}return{buildNewServerGroupCommand:a,buildServerGroupCommandFromExisting:function(t,a,l="clone"){var s,i,o,c;const m=h.getPreferredZonesByAccount("aws"),u=N.listSubnets(),p=pe.parseServerGroupName(a.asg.autoScalingGroupName);let g;if(a.mixedInstancesPolicy){const e=null==(s=a.mixedInstancesPolicy)?void 0:s.launchTemplateOverridesForInstanceType;g=e?e.map(e=>e.instanceType):[null==(c=null==(o=null==(i=a.mixedInstancesPolicy)?void 0:i.launchTemplates[0])?void 0:o.launchTemplateData)?void 0:c.instanceType]}else a.launchTemplate?g=[Zt.get(a,"launchTemplate.launchTemplateData.instanceType")]:a.launchConfig&&(g=[Zt.get(a,"launchConfig.instanceType")]);const v=e.getCategoryForMultipleInstanceTypes("aws",g);return Promise.all([m,u,v]).then(([e,s,i])=>{var o,c,m,u,h,g,v,f,E,y,b,C,N,S;const w=a.asg.availabilityZones.sort();let k=!1;const T=e[a.account];if(T){const e=T[a.region].sort();k=w.join(",")===e.join(",")}const I=["Launch","Terminate","AddToLoadBalancer"],P=(null!=(m=null==(c=null==(o=t.attributes)?void 0:o.providerSettings)?void 0:c.aws)?m:{}).useAmiBlockDeviceMappings||!1,A={},G=["spinnaker:application","spinnaker:stack","spinnaker:details"];a.asg.tags&&a.asg.tags.filter(e=>!G.includes(e.key)).forEach(e=>{A[e.key]=e.value});const x={application:t.name,strategy:"",stack:p.stack,freeFormDetails:p.freeFormDetails,credentials:a.account,cooldown:a.asg.defaultCooldown,enabledMetrics:Zt.get(a,"asg.enabledMetrics",[]).map(e=>e.metric),healthCheckGracePeriod:a.asg.healthCheckGracePeriod,healthCheckType:a.asg.healthCheckType,terminationPolicies:a.asg.terminationPolicies,loadBalancers:a.asg.loadBalancerNames,region:a.region,useSourceCapacity:!1,capacity:{min:a.asg.minSize,max:a.asg.maxSize,desired:a.asg.desiredCapacity},targetHealthyDeployPercentage:100,availabilityZones:w,selectedProvider:"aws",source:{account:a.account,region:a.region,asgName:a.asg.autoScalingGroupName},suspendedProcesses:(a.asg.suspendedProcesses||[]).map(e=>e.processName).filter(e=>!I.includes(e)),tags:Object.assign({},a.tags,A),targetGroups:a.targetGroups,useAmiBlockDeviceMappings:P,copySourceCustomBlockDeviceMappings:"clone"===l,viewState:{instanceProfile:i,useAllImageSelection:!1,useSimpleCapacity:a.asg.minSize===a.asg.maxSize,usePreferredZones:k,mode:l,submitButtonLabel:n(l),isNew:!1,dirty:{}}};if((null==(u=t.attributes)?void 0:u.platformHealthOnlyShowOverride)&&(null==(h=t.attributes)?void 0:h.platformHealthOnly)&&(x.interestingHealthProviderNames=["Amazon"]),"editPipeline"===l){x.useSourceCapacity=!0,x.viewState.useSimpleCapacity=!1,x.strategy="redblack";const e=d.getStrategy("redblack");e.initializationMethod&&e.initializationMethod(x),x.suspendedProcesses=[]}const D=a.asg.vpczoneIdentifier;if(""!==D){const e=D.split(",")[0],t=s.find(t=>t.id===e);x.subnetType=t.purpose,x.vpcId=t.vpcId}else x.subnetType="",x.vpcId=null;if(a.launchConfig&&(Object.assign(x,{instanceType:a.launchConfig.instanceType,iamRole:a.launchConfig.iamInstanceProfile,keyPair:a.launchConfig.keyName,associatePublicIpAddress:a.launchConfig.associatePublicIpAddress,ramdiskId:a.launchConfig.ramdiskId,instanceMonitoring:a.launchConfig.instanceMonitoring&&a.launchConfig.instanceMonitoring.enabled,ebsOptimized:a.launchConfig.ebsOptimized,spotPrice:a.launchConfig.spotPrice}),a.launchConfig.userData&&(x.base64UserData=a.launchConfig.userData),x.viewState.imageId=a.launchConfig.imageId,x.viewState.useSimpleInstanceTypeSelector=!0),a.launchTemplate||a.mixedInstancesPolicy){let e,t;if(a.launchTemplate&&(e=a.launchTemplate.launchTemplateData,t=null==(v=null==(g=e.instanceMarketOptions)?void 0:g.spotOptions)?void 0:v.maxPrice,x.instanceType=e.instanceType,x.viewState.useSimpleInstanceTypeSelector=!0,e.userData&&(x.base64UserData=e.userData)),a.mixedInstancesPolicy){const n=a.mixedInstancesPolicy;e=null==(E=null==(f=null==n?void 0:n.launchTemplates)?void 0:f[0])?void 0:E.launchTemplateData,t=null==(y=null==n?void 0:n.instancesDistribution)?void 0:y.spotMaxPrice,x.securityGroups=e.networkInterfaces?(null!=(b=e.networkInterfaces.find(e=>0===e.deviceIndex))?b:{}).groups:e.securityGroups,x.onDemandAllocationStrategy=n.instancesDistribution.onDemandAllocationStrategy,x.onDemandBaseCapacity=n.instancesDistribution.onDemandBaseCapacity,x.onDemandPercentageAboveBaseCapacity=n.instancesDistribution.onDemandPercentageAboveBaseCapacity,x.spotAllocationStrategy=n.instancesDistribution.spotAllocationStrategy,x.spotInstancePools=n.instancesDistribution.spotInstancePools,n.launchTemplateOverridesForInstanceType?x.launchTemplateOverridesForInstanceType=function(e){let t=1;return Zt.sortBy(e,["priority"]).map(e=>{const{instanceType:a,weightedCapacity:n}=e;let r;return e.priority?(r=e.priority,t=e.priority+1):r=t++,{instanceType:a,weightedCapacity:n,priority:r}})}(n.launchTemplateOverridesForInstanceType):x.instanceType=e.instanceType,x.viewState.useSimpleInstanceTypeSelector=r(x)}const n=Zt.get(e,"networkInterfaces[0]"),l=null!=(C=null==n?void 0:n.ipv6AddressCount)?C:0,s=Cn.serverGroups,i=a.accountDetails&&"test"===a.accountDetails.environment,o=s&&s.enableIPv6&&s.setIPv6InTest&&i;Object.assign(x,{iamRole:e.iamInstanceProfile.name,keyPair:e.keyName,associateIPv6Address:o||Boolean(l),ramdiskId:e.ramdiskId,instanceMonitoring:e.monitoring&&e.monitoring.enabled,ebsOptimized:e.ebsOptimized,spotPrice:t||void 0,requireIMDSv2:Boolean("required"===(null==(N=e.metadataOptions)?void 0:N.httpTokens)),unlimitedCpuCredits:e.creditSpecification?"unlimited"===e.creditSpecification.cpuCredits:void 0}),x.viewState.imageId=e.imageId}if("clone"===l&&a.image&&a.image.name&&(x.amiName=a.image.name),a.launchConfig&&a.launchConfig.securityGroups.length&&(x.securityGroups=a.launchConfig.securityGroups),a.launchTemplate&&a.launchTemplate.launchTemplateData.securityGroups.length&&(x.securityGroups=a.launchTemplate.launchTemplateData.securityGroups),a.launchTemplate&&a.launchTemplate.launchTemplateData.networkInterfaces){const e=null!=(S=a.launchTemplate.launchTemplateData.networkInterfaces.find(e=>0===e.deviceIndex))?S:{};x.securityGroups=e.groups}return x})},buildNewServerGroupCommandForPipeline:function(){return Promise.resolve({viewState:{requiresTemplateSelection:!0}})},buildServerGroupCommandFromPipeline:function(t,n){const l=Zt.cloneDeep(n),s=Object.keys(l.availabilityZones)[0],i=l.launchTemplateOverridesForInstanceType?l.launchTemplateOverridesForInstanceType.map(e=>e.instanceType):[l.instanceType],o=e.getCategoryForMultipleInstanceTypes("aws",i),c={account:l.account,region:s};return Promise.all([a(t,c),o]).then(function([e,t]){const a=l.availabilityZones[s].join(",")===e.availabilityZones.join(","),n={instanceProfile:t,disableImageSelection:!0,useSimpleCapacity:l.capacity.min===l.capacity.max&&!0!==l.useSourceCapacity,usePreferredZones:a,mode:"editPipeline",submitButtonLabel:"Done",templatingEnabled:!0,existingPipelineCluster:!0,dirty:{},useSimpleInstanceTypeSelector:r(l)},i={region:s,credentials:l.account,availabilityZones:l.availabilityZones[s],iamRole:l.iamRole,viewState:n};return l.strategy=l.strategy||"",Object.assign({},e,l,i)})},buildUpdateServerGroupCommand:function(e){var a,n;const r={type:"modifyAsg",asgs:[{asgName:e.name,region:e.region}],cooldown:e.asg.defaultCooldown,enabledMetrics:(null!=(n=null==(a=e.asg)?void 0:a.enabledMetrics)?n:[]).map(e=>e.metric),healthCheckGracePeriod:e.asg.healthCheckGracePeriod,healthCheckType:e.asg.healthCheckType,terminationPolicies:Zt.cloneDeep(e.asg.terminationPolicies),credentials:e.account,capacityRebalance:e.asg.capacityRebalance};return t.configureUpdateCommand(r),r}}}const go=class{constructor(e,t){const a=t.providerServiceDelegate.getDelegate("aws","serverGroup.configurationService");this.delegate=ho(t.instanceTypeService,a)}buildNewServerGroupCommand(e,t){return this.delegate.buildNewServerGroupCommand(e,t)}buildServerGroupCommandFromExisting(e,t,a){return this.delegate.buildServerGroupCommandFromExisting(e,t,a)}buildNewServerGroupCommandForPipeline(){return this.delegate.buildNewServerGroupCommandForPipeline()}buildServerGroupCommandFromPipeline(e,t){return this.delegate.buildServerGroupCommandFromPipeline(e,t)}buildUpdateServerGroupCommand(e){return this.delegate.buildUpdateServerGroupCommand(e)}};go.requiresDeckRuntimeServices=!0;const vo=go;class fo{static getDisabledDate(e){if(e.isDisabled){const t=this.normalizeScalingProcesses(e).find(e=>"AddToLoadBalancer"===e.name&&!e.enabled);if(t)return t.suspensionDate}return null}static normalizeScalingProcesses(e){if(!e.asg||!e.asg.suspendedProcesses)return[];const t=e.asg.suspendedProcesses;return this.listProcesses().map(e=>{const a=t.find(t=>t.processName===e.name),n={name:e.name,enabled:!a,description:e.description};if(a){const e=a.suspensionReason.replace("User suspended at ","");n.suspensionDate=new Date(e).getTime()}return n})}static listProcesses(){return[{name:"Launch",description:"Controls if new instances should be launched into the ASG. If this is disabled, scale-up events will not produce new instances."},{name:"Terminate",description:"Controls if instances should be terminated during a scale-down event."},{name:"AddToLoadBalancer",description:"Controls if new instances should be added to the ASG’s ELB."},{name:"AlarmNotification",description:"This disables autoscaling."},{name:"AZRebalance",description:"Controls whether AWS should attempt to maintain an even distribution of instances across all healthy Availability Zones configured for the ASG."},{name:"HealthCheck",description:"If disabled, the instance’s health will no longer be reported to the autoscaling processor."},{name:"ReplaceUnhealthy",description:"Controls whether instances should be replaced if they failed the health check."},{name:"ScheduledActions",description:"Controls whether scheduled actions should be executed."}]}}class Eo{static listKeyPairs(){return F("/keyPairs").useCache().get().then(e=>e.sort((e,t)=>e.keyName.localeCompare(t.keyName)))}}class yo{constructor(e,t,a,n={getCommandOverrides:()=>[]}){this.serverGroupCommandRegistry=n,this.enabledMetrics=["GroupMinSize","GroupMaxSize","GroupDesiredCapacity","GroupInServiceInstances","GroupPendingInstances","GroupStandbyInstances","GroupTerminatingInstances","GroupTotalInstances"],this.healthCheckTypes=["EC2","ELB"],this.terminationPolicies=["OldestInstance","NewestInstance","OldestLaunchConfiguration","ClosestToNextInstanceHour","Default"],this.securityGroupReader=e,this.awsInstanceTypeService=t,this.cacheInitializer=a}getSecurityGroupReader(){return this.securityGroupReader}getCacheInitializer(){return this.cacheInitializer}configureUpdateCommand(e){e.backingData={enabledMetrics:ba(this.enabledMetrics),healthCheckTypes:ba(this.healthCheckTypes),terminationPolicies:ba(this.terminationPolicies)}}configureCommand(e,t){this.applyOverrides("beforeConfiguration",t),t.toggleSuspendedProcess=(e,t)=>{e.suspendedProcesses=e.suspendedProcesses||[];const a=e.suspendedProcesses.indexOf(t);e.suspendedProcesses=-1===a?e.suspendedProcesses.concat(t):e.suspendedProcesses.filter(e=>e!==t)},t.processIsSuspended=(e,t)=>e.suspendedProcesses.includes(t),t.onStrategyChange=(e,t)=>{var a;(null==(a=Cn.serverGroups)?void 0:a.enableLaunchTemplates)&&(e.setLaunchTemplate="rollingpush"===t.key||void 0),""!==t.key&&"custom"!==t.key&&(e.suspendedProcesses=(e.suspendedProcesses||[]).filter(e=>"AddToLoadBalancer"!==e))},t.getBlockDeviceMappingsSource=e=>e.copySourceCustomBlockDeviceMappings?"source":e.useAmiBlockDeviceMappings?"ami":"default",t.selectBlockDeviceMappingsSource=(e,t)=>{"source"===t?(e.copySourceCustomBlockDeviceMappings=!0,e.useAmiBlockDeviceMappings=!1):"ami"===t?(e.copySourceCustomBlockDeviceMappings=!1,e.useAmiBlockDeviceMappings=!0):(e.copySourceCustomBlockDeviceMappings=!1,e.useAmiBlockDeviceMappings=!1)},t.regionIsDeprecated=e=>Ca(e,"backingData.filtered.regions")&&e.backingData.filtered.regions.some(t=>t.name===e.region&&t.deprecated);const a=this.getSecurityGroupReader();return Promise.all([h.getCredentialsKeyedByAccount("aws"),a.getAllSecurityGroups(),N.listSubnets(),h.getPreferredZonesByAccount("aws"),Eo.listKeyPairs(),this.awsInstanceTypeService.getAllTypesByRegion(),Promise.resolve(ba(this.enabledMetrics)),Promise.resolve(ba(this.healthCheckTypes)),Promise.resolve(ba(this.terminationPolicies))]).then(([a,n,r,l,s,i,o,c,d])=>{var m,u;const p={credentialsKeyedByAccount:a,securityGroups:n,subnets:r,preferredZones:l,keyPairs:s,instanceTypesInfo:i,enabledMetrics:o,healthCheckTypes:c,terminationPolicies:d};let h=Promise.resolve();if(p.accounts=Na(p.credentialsKeyedByAccount),p.filtered={},p.scalingProcesses=fo.listProcesses(),p.appLoadBalancers=e.getDataSource("loadBalancers").data,p.managedResources=null==(u=null==(m=e.getDataSource("managedResources"))?void 0:m.data)?void 0:u.resources,t.backingData=p,this.configureVpcId(t),p.filtered.securityGroups=this.getRegionalSecurityGroups(t),t.viewState.disableImageSelection&&this.configureInstanceTypes(t),t.securityGroups&&t.securityGroups.length){const e=sa(this.getRegionalSecurityGroups(t),"id");Sa(t.securityGroups,e).length<t.securityGroups.length&&(h=this.refreshSecurityGroups(t,!0))}return h.then(()=>{this.applyOverrides("afterConfiguration",t),this.attachEventHandlers(t)})})}applyOverrides(e,t){this.serverGroupCommandRegistry.getCommandOverrides("aws").forEach(a=>{a[e]&&a[e](t)})}configureKeyPairs(e){const t={dirty:{}};if(e.credentials&&e.region){const a=ua(e.backingData.credentialsKeyedByAccount,t=>t.defaultKeyPair&&e.keyPair&&0===e.keyPair.indexOf(t.defaultKeyPair.replace("{{region}}",""))),n=la(e.backingData.keyPairs).filter({account:e.credentials,region:e.region}).map("keyName").value();if(e.keyPair&&n.length&&!n.includes(e.keyPair)){const r=e.backingData.credentialsKeyedByAccount[e.credentials]||{defaultKeyPair:null};if(r.defaultKeyPair){const l=r.defaultKeyPair.replace("{{region}}",e.region);a&&n.includes(l)?e.keyPair=l:(e.keyPair=null,t.dirty.keyPair=!0)}else e.keyPair=null,t.dirty.keyPair=!0}e.backingData.filtered.keyPairs=n}else e.backingData.filtered.keyPairs=[];return t}configureInstanceTypes(e){const t={dirty:{}};if(e.region&&(e.virtualizationType||e.viewState.disableImageSelection)){let a=this.awsInstanceTypeService.getAvailableTypesForRegions(e.backingData.instanceTypesInfo,[e.region]);(e.virtualizationType||e.amiArchitecture)&&(a=this.awsInstanceTypeService.filterInstanceTypes(a,e.virtualizationType,!!e.vpcId,e.amiArchitecture));const n=sa(a,"name");e.instanceType&&!n.includes(e.instanceType)&&(t.dirty.instanceType=e.instanceType,e.instanceType=null);const r=sa(e.launchTemplateOverridesForInstanceType,"instanceType"),l=Sa(r,n),s=ma(r,l);e.launchTemplateOverridesForInstanceType&&s.length>0&&(t.dirty.launchTemplateOverridesForInstanceType=e.launchTemplateOverridesForInstanceType.filter(e=>s.includes(e.instanceType)),e.launchTemplateOverridesForInstanceType=e.launchTemplateOverridesForInstanceType.filter(e=>l.includes(e.instanceType))),e.backingData.filtered.instanceTypes=n,e.backingData.filtered.instanceTypesInfo=a}else e.backingData.filtered.instanceTypes=[],e.backingData.filtered.instanceTypesInfo=[];return wa(e.viewState.dirty,t.dirty),t}configureImages(e){const t={dirty:{}};return e.amiName||(e.virtualizationType=null,e.amiArchitecture=null),e.viewState.disableImageSelection||e.amiName&&!e.region&&(t.dirty.amiName=!0,e.amiName=null),t}configureAvailabilityZones(e){e.backingData.filtered.availabilityZones=ka(e.backingData.credentialsKeyedByAccount[e.credentials].regions,{name:e.region}).availabilityZones}configureSubnetPurposes(e){const t={dirty:{}},a=e.backingData.filtered;return null===e.region||(a.subnetPurposes=la(e.backingData.subnets).filter({account:e.credentials,region:e.region}).reject({target:"elb"}).reject({purpose:null}).uniqBy("purpose").value(),la(a.subnetPurposes).some({purpose:e.subnetType}).value()||(e.subnetType=null,t.dirty.subnetType=!0)),t}getRegionalSecurityGroups(e){const t=e.backingData.securityGroups[e.credentials]||{aws:{}};return la(t.aws[e.region]).filter({vpcId:e.vpcId||null}).sortBy("name").value()}configureSecurityGroupOptions(e){const t={dirty:{}},a=e.backingData.filtered.securityGroups,n=this.getRegionalSecurityGroups(e),r="string"==typeof e.securityGroups&&e.securityGroups.includes("${");if(a&&e.securityGroups&&!r){const r=e.securityGroups.map(e=>{const t=ka(a,{id:e});return t?t.name:e}),l=e.securityGroups.map(e=>{const t=ka(a,{id:e})||ka(a,{name:e});return t?t.name:null}).map(e=>ka(n,{name:e})).filter(e=>e),s=sa(l,"name"),i=Ta(r,s);e.securityGroups=sa(l,"id"),i.length&&(t.dirty.securityGroups=i)}return e.backingData.filtered.securityGroups=n.sort((e,t)=>e.name.localeCompare(t.name)),t}refreshSecurityGroups(e,t){return this.getCacheInitializer().refreshCache("securityGroups").then(()=>this.getSecurityGroupReader().getAllSecurityGroups().then(a=>{e.backingData.securityGroups=a,t||this.configureSecurityGroupOptions(e)}))}getLoadBalancerMap(e){if(e.backingData.loadBalancers)return la(e.backingData.loadBalancers).map("accounts").flattenDeep().filter({name:e.credentials}).map("regions").flattenDeep().filter({name:e.region}).map("loadBalancers").flattenDeep().value();return(e.backingData.appLoadBalancers||[]).filter(t=>t.region===e.region&&t.account===e.credentials)}getLoadBalancerNames(e){return this.getLoadBalancerMap(e).filter(t=>(!t.loadBalancerType||"classic"===t.loadBalancerType)&&t.vpcId===e.vpcId).map(e=>e.name).sort()}getVpcLoadBalancerNames(e){return this.getLoadBalancerMap(e).filter(e=>(!e.loadBalancerType||"classic"===e.loadBalancerType)&&e.vpcId).map(e=>e.name).sort()}getTargetGroupNames(e){const t=this.getLoadBalancerMap(e).filter(e=>"classic"!==e.loadBalancerType);return Qt(t.map(e=>e.targetGroups.filter(e=>"instance"===e.targetType))).map(e=>e.name).sort()}getValidMatches(e,t){const a=t.filter(e=>e.includes("${")),n=Sa(e,t),[r,l]=ga(t,e=>n.includes(e)||a.includes(e));return{valid:r,invalid:l,spel:a}}configureLoadBalancerOptions(e){const t={dirty:{}},a=(e.loadBalancers||[]).concat(e.vpcLoadBalancers||[]),n=e.targetGroups||[],r=this.getLoadBalancerNames(e),l=this.getVpcLoadBalancerNames(e),s=this.getTargetGroupNames(e);if(a&&e.loadBalancers){const n=e.vpcId?r:r.concat(l),{valid:s,invalid:i,spel:o}=this.getValidMatches(n,a);e.loadBalancers=Sa(r.concat(o),s),e.vpcId?delete e.vpcLoadBalancers:e.vpcLoadBalancers=Sa(l,s),i.length&&(t.dirty.loadBalancers=i),e.viewState.spelLoadBalancers=o||[]}if(n&&e.targetGroups&&!n.includes("${")){const{valid:a,invalid:r,spel:l}=this.getValidMatches(s,n);e.targetGroups=a,r.length&&(t.dirty.targetGroups=r),e.viewState.spelTargetGroups=l||[]}return e.backingData.filtered.loadBalancers=r,e.backingData.filtered.vpcLoadBalancers=l,e.backingData.filtered.targetGroups=s,t}refreshLoadBalancers(e,t){return F("/loadBalancers").query({provider:"aws"}).get().then(a=>{e.backingData.loadBalancers=a,t||this.configureLoadBalancerOptions(e)})}configureVpcId(e){const t={dirty:{}};if(e.subnetType){const t=ka(e.backingData.subnets,{purpose:e.subnetType,account:e.credentials,region:e.region});e.vpcId=t?t.vpcId:null}else e.vpcId=null,t.dirty.vpcId=!0;return wa(t.dirty,this.configureInstanceTypes(e).dirty),t}attachEventHandlers(e){e.usePreferredZonesChanged=e=>{const t=e.availabilityZones?e.availabilityZones.length:0,a={dirty:{}},n=e.backingData.preferredZones[e.credentials];if(n&&n[e.region]&&e.viewState.usePreferredZones)e.availabilityZones=Xt(n[e.region].sort());else{e.availabilityZones=Sa(e.availabilityZones,e.backingData.filtered.availabilityZones);t!==(e.availabilityZones?e.availabilityZones.length:0)&&(a.dirty.availabilityZones=!0)}return a},e.subnetChanged=e=>{const t=this.configureVpcId(e);return wa(t.dirty,this.configureSecurityGroupOptions(e).dirty),wa(t.dirty,this.configureLoadBalancerOptions(e).dirty),e.viewState.dirty=e.viewState.dirty||{},wa(e.viewState.dirty,t.dirty),t},e.regionChanged=e=>{const t={dirty:{}},a=e.backingData.filtered;return wa(t.dirty,this.configureSubnetPurposes(e).dirty),e.region?(wa(t.dirty,e.subnetChanged(e).dirty),wa(t.dirty,this.configureInstanceTypes(e).dirty),this.configureAvailabilityZones(e),wa(t.dirty,e.usePreferredZonesChanged(e).dirty),wa(t.dirty,this.configureImages(e).dirty),wa(t.dirty,this.configureKeyPairs(e).dirty)):a.regionalAvailabilityZones=null,Et(e),t},e.clusterChanged=e=>{e.moniker=pe.getMoniker(e.application,e.stack,e.freeFormDetails),Et(e)},e.credentialsChanged=e=>{const t={dirty:{}},a=e.backingData;if(e.credentials){const n=a.credentialsKeyedByAccount[e.credentials]||{regions:[]};a.filtered.regions=n.regions,ua(a.filtered.regions,{name:e.region})?wa(t.dirty,e.regionChanged(e).dirty):(e.region=null,t.dirty.region=!0)}else e.region=null;return Et(e),t},e.imageChanged=e=>this.configureInstanceTypes(e),e.instanceTypeChanged=e=>{e.ebsOptimized=this.awsInstanceTypeService.isEbsOptimized(e.instanceType)},e.launchTemplateOverridesChanged=e=>{var t;e.ebsOptimized=null==(t=e.launchTemplateOverridesForInstanceType)?void 0:t.every(e=>this.awsInstanceTypeService.isEbsOptimized(e.instanceType))},this.applyOverrides("attachEventHandlers",e)}}const bo=class extends yo{constructor(e,t){super(t.securityGroupReader,new Qn,t.cacheInitializer)}};bo.requiresDeckRuntimeServices=!0;let Co=bo;class No extends qt.Component{constructor(e){super(e),this.state={templateSelectionText:{copied:["account, region, subnet, cluster name (stack, details)","load balancers",j.get("firewalls"),"instance type","all fields on the Advanced Settings page"],notCopied:["the following suspended scaling processes: Launch, Terminate, AddToLoadBalancer"],additionalCopyText:"If a server group exists in this cluster at the time of deployment, its scaling policies will be copied over to the new server group."}},e.command.viewState.disableStrategySelection||this.state.templateSelectionText.notCopied.push("the deployment strategy (if any) used to deploy the most recent server group")}render(){const{app:e,command:t,onDismiss:a,onTemplateSelected:n}=this.props,{templateSelectionText:r}=this.state;/* @__PURE__ */
|
|
170
|
-
return qt.createElement(yt,{cloudProvider:"aws",application:e,command:t,onDismiss:a,onTemplateSelected:n,templateSelectionText:r})}}class
|
|
165
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("h5",null,j.get("Firewall")," Ingress"),e.map((e,t)=>/* @__PURE__ */qt.createElement("div",{className:"row",key:`sg-${t}`},/* @__PURE__ */qt.createElement("div",{className:"col-md-3"},e.existing?/* @__PURE__ */qt.createElement("span",{className:"form-control-static"},e.name||e.id):/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.name||"",onChange:e=>this.updateRule("securityGroupIngress",t,{name:e.target.value})})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",value:e.type||"",onChange:e=>this.updateRule("securityGroupIngress",t,{type:e.target.value})})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",value:e.startPort,onChange:e=>this.updateRule("securityGroupIngress",t,{startPort:Number(e.target.value)})})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm",type:"number",value:e.endPort,onChange:e=>this.updateRule("securityGroupIngress",t,{endPort:Number(e.target.value)})})),/* @__PURE__ */qt.createElement("div",{className:"col-md-1"},/* @__PURE__ */qt.createElement(_a,{bsSize:"xsmall",onClick:()=>this.removeRule("securityGroupIngress",t)},"Remove")))),/* @__PURE__ */qt.createElement(_a,{bsSize:"small",onClick:this.addSecurityGroupRule},"Add ",j.get("Firewall")," Rule"))}render(){const{securityGroup:e,taskMonitor:t}=this.state,a=this.getMode(),n=to(e);/* @__PURE__ */
|
|
166
|
+
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(vt,{monitor:t}),/* @__PURE__ */qt.createElement(ye,{dismiss:this.props.dismissModal}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"edit"===a?"Edit":"clone"===a?"Clone":"Create"," ",j.get("Firewall"))),/* @__PURE__ */qt.createElement(Za.Body,null,this.renderTextField("Account",Yi(e),e=>this.updateSecurityGroup({account:e,accountId:e,accountName:e,credentials:e})),this.renderTextField("Region",e.region,e=>this.updateSecurityGroup({region:e,regions:[e]})),this.renderTextField("VPC ID",e.vpcId,e=>this.updateSecurityGroup({vpcId:e})),this.renderTextField("Name",e.name,e=>this.updateSecurityGroup({name:e})),this.renderTextField("Description",e.description,e=>this.updateSecurityGroup({description:e})),/* @__PURE__ */qt.createElement("div",{className:"well"},/* @__PURE__ */qt.createElement("div",{className:"row small text-bold"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3"},"CIDR / ",j.get("Firewall")),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Protocol"),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Start Port"),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"End Port")),this.renderIpRules(),this.renderSecurityGroupRules())),/* @__PURE__ */qt.createElement(Za.Footer,null,/* @__PURE__ */qt.createElement(_a,{onClick:this.props.dismissModal},"Cancel"),/* @__PURE__ */qt.createElement(be,{isDisabled:!n,isFormSubmit:!1,submitting:t.submitting,onClick:this.submit,label:"edit"===a?"Update":"clone"===a?"Clone":"Create"})))}};ao.defaultProps={closeModal:T,dismissModal:T,mode:"create"};let no=ao;const ro=Object.assign(G(no),{show:no.show});var lo=Object.getOwnPropertyDescriptor;let so=class extends qt.Component{render(){const e=this.props.ipRules||[],t=`IP Range Rules (${e.length})`;/* @__PURE__ */
|
|
167
|
+
return qt.createElement(z,{heading:t},e.map(e=>/* @__PURE__ */qt.createElement(q,{key:e.address,className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement(U,{label:"IP Range",value:e.address}),/* @__PURE__ */qt.createElement(U,{label:"Port Ranges",value:e.rules.map(t=>"-1"===t.protocol?/* @__PURE__ */qt.createElement("span",null,"All ports and protocols",e.rules.length>1?/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("em",null,"Additional port ranges are specified, but redundant:")):null):/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("span",null,t.protocol,":",t.startPort," → ",t.endPort)))}))))}};function io(e,t){const a=[];return e[t].forEach(e=>{(e.portRanges||[]).forEach(t=>{("-1"===e.protocol||void 0!==t.startPort&&void 0!==t.endPort)&&a.push({startPort:t.startPort,endPort:t.endPort,protocol:e.protocol,description:e.description||""})})}),a}function oo(e){const t=oa(e.ipRangeRules||[],e=>e.range.ip+e.range.cidr);return Object.keys(t).map(e=>({address:e,rules:io(t,e)})).filter(e=>e.rules.length)}function co(e){const t=oa(e.securityGroupRules||[],e=>e.securityGroup.id);return Object.keys(t).map(e=>({securityGroup:t[e][0].securityGroup,rules:io(t,e)})).filter(e=>e.rules.length)}function mo(e,t){return e.accountId||e.accountName||e.account||e.credentials||(null==t?void 0:t.accountId)}function uo(e,t){if(!t)return e;const a=mo(e,t);return{...e,accountId:a,accountName:e.accountName||a,name:e.name||t.name,region:e.region||t.region,vpcId:e.vpcId||t.vpcId}}function po({app:e,resolvedSecurityGroup:t,securityGroup:a}){if(!Cn.adHocInfraWritesEnabled)return null;const n=uo(a,t);/* @__PURE__ */
|
|
168
|
+
return qt.createElement(ja,{className:"dropdown",id:"amazon-security-group-actions-dropdown"},/* @__PURE__ */qt.createElement(ja.Toggle,{className:"btn btn-sm btn-primary dropdown-toggle"},j.get("Firewall")," Actions"),/* @__PURE__ */qt.createElement(ja.Menu,null,/* @__PURE__ */qt.createElement(Ka,{onClick:()=>{ft(n,e).then(t=>{t&&ro.show({app:e,mode:"edit",securityGroup:n})})}},"Edit Inbound Rules"),/* @__PURE__ */qt.createElement(Ka,{onClick:()=>{let t=!1;ft(n,e).then(a=>{a&&x.confirm({header:`Really delete ${n.name}?`,buttonText:`Delete ${n.name}`,account:mo(n),taskMonitorConfig:{application:e,title:`Deleting ${n.name}`,onTaskRetry:()=>{t=!0}},submitMethod:()=>{const a={cloudProvider:n.provider||"aws",vpcId:n.vpcId};return t&&(a.removeDependencies=!0),gt.deleteSecurityGroup(n,e,a)},retryBody:`<div><p>Retry deleting the ${j.get("firewall")} and revoke any dependent ingress rules?</p><p>Any instance or load balancer associations will have to removed manually.</p></div>`})})}},"Delete ",j.get("Firewall")),/* @__PURE__ */qt.createElement(Ka,{onClick:()=>{ro.show({app:e,mode:"clone",securityGroup:n})}},"Clone ",j.get("Firewall")),o.feature.entityTags&&/* @__PURE__ */qt.createElement(B,{component:n,application:e,entityType:"securityGroup",onUpdate:()=>e.securityGroups.refresh()})))}so=((e,t,a,n)=>{for(var r,l=n>1?void 0:n?lo(t,a):t,s=e.length-1;s>=0;s--)(r=e[s])&&(l=r(l)||l);return l})([fe("aws.securityGroup.ip.rules")],so);const ho=class extends qt.Component{constructor(){super(...arguments),this.state={loading:!0},this.isUnmounted=!1,this.loadRequestId=0,this.autoClose=()=>{if(!this.isUnmounted){if(!this.props.autoClose)return this.props.app.isStandalone?(J.removeLastItem("securityGroups"),void this.setState({loading:!1,notFound:!0})):void this.props.stateService.go("^",{allowModalToStayOpen:!0},{location:"replace"});this.props.autoClose()}},this.loadSecurityGroup=()=>{const{app:e,resolvedSecurityGroup:t}=this.props,a=++this.loadRequestId;this.setState({loading:!0,notFound:!1}),this.getSecurityGroupReader().getSecurityGroupDetails(e,t.accountId,"aws",t.region,t.vpcId||"",t.name).then(n=>this.isUnmounted||a!==this.loadRequestId?Promise.resolve():!n||_t(n)?(this.autoClose(),Promise.resolve()):Promise.resolve(Hn.getVpcName(n.vpcId)).then(r=>{if(this.isUnmounted||a!==this.loadRequestId)return;const l=this.getSecurityGroupReader().getApplicationSecurityGroup(e,t.accountId,t.region,t.name);this.setState({loading:!1,securityGroup:uo({...l,...n,vpcName:r},t)})})).catch(()=>{a===this.loadRequestId&&this.autoClose()})},this.closeDetails=()=>{this.props.stateService.go("^")}}componentDidMount(){var e,t;const a=null==(t=(e=this.props.app).getDataSource)?void 0:t.call(e,"securityGroups");a?a.ready().then(()=>{this.isUnmounted||(this.loadSecurityGroup(),this.unsubscribeFromRefresh=a.onRefresh(this.loadSecurityGroup))}):this.loadSecurityGroup()}componentDidUpdate(e){this.getCoordinatesKey(e)!==this.getCoordinatesKey(this.props)&&this.loadSecurityGroup()}componentWillUnmount(){this.isUnmounted=!0,this.unsubscribeFromRefresh&&this.unsubscribeFromRefresh()}getCoordinatesKey(e){const{accountId:t,name:a,region:n,vpcId:r}=e.resolvedSecurityGroup;return[t,n,r||"",a].join(":")}getSecurityGroupReader(){return this.props.securityGroupReader||this.context.services.securityGroupReader}render(){const{app:e,resolvedSecurityGroup:t}=this.props,{loading:a,notFound:n,securityGroup:r}=this.state;return n?/* @__PURE__ */qt.createElement("div",{className:"text-center"},/* @__PURE__ */qt.createElement("h3",null,"Could not find ",j.get("firewall")," ",t.name,"."),/* @__PURE__ */qt.createElement(en,{to:"home.infrastructure"},/* @__PURE__ */qt.createElement("a",null,"Back to search results"))):/* @__PURE__ */qt.createElement("div",{className:"details-panel"},/* @__PURE__ */qt.createElement("div",{className:"header"},!e.isStandalone&&/* @__PURE__ */qt.createElement("div",{className:"close-button"},/* @__PURE__ */qt.createElement("a",{className:"btn btn-link",onClick:this.closeDetails},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-remove"}))),a&&/* @__PURE__ */qt.createElement("div",{className:"horizontal center middle"},/* @__PURE__ */qt.createElement(me,{size:"small"})),!a&&r&&/* @__PURE__ */qt.createElement("div",{className:"header-text horizontal middle"},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-transfer"}),/* @__PURE__ */qt.createElement("h3",{className:"horizontal middle space-between flex-1"},r.name||"(not found)")),!a&&r&&/* @__PURE__ */qt.createElement("div",{className:"actions"},/* @__PURE__ */qt.createElement(po,{app:e,resolvedSecurityGroup:t,securityGroup:r}))),!a&&(null==r?void 0:r.isManaged)&&/* @__PURE__ */qt.createElement(ge,{resourceSummary:r.managedResourceSummary,application:e}),!a&&r&&/* @__PURE__ */qt.createElement("div",{className:"content"},/* @__PURE__ */qt.createElement(z,{heading:`${j.get("Firewall")} Details`,defaultExpanded:!0},/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-medium"},/* @__PURE__ */qt.createElement("dt",null,"ID"),/* @__PURE__ */qt.createElement("dd",null,r.id),/* @__PURE__ */qt.createElement("dt",null,"Account"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(L,{account:r.accountName||r.accountId})),/* @__PURE__ */qt.createElement("dt",null,"Region"),/* @__PURE__ */qt.createElement("dd",null,r.region),/* @__PURE__ */qt.createElement("dt",null,"VPC"),/* @__PURE__ */qt.createElement("dd",null,r.vpcName||r.vpcId),/* @__PURE__ */qt.createElement("dt",null,"Description"),/* @__PURE__ */qt.createElement("dd",null,r.description))),/* @__PURE__ */qt.createElement(so,{ipRules:oo(r)}),/* @__PURE__ */qt.createElement(z,{heading:`${j.get("Firewall")} Rules (${co(r).length||0})`,defaultExpanded:co(r).length>0},!co(r).length&&/* @__PURE__ */qt.createElement("div",null,"None"),co(r).map(e=>/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-medium",key:e.securityGroup.id||e.securityGroup.name},/* @__PURE__ */qt.createElement("dt",null,j.get("Firewall")),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(en,{to:"^.firewallDetails",params:{name:e.securityGroup.name,accountId:e.securityGroup.accountName||e.securityGroup.accountId,region:e.securityGroup.region,vpcId:e.securityGroup.vpcId,provider:"aws"}},
|
|
169
|
+
/* @__PURE__ */qt.createElement("a",null,e.securityGroup.accountName!==r.accountName&&/* @__PURE__ */qt.createElement(L,{account:e.securityGroup.accountName||e.securityGroup.accountId})," ",e.securityGroup.name," (",e.securityGroup.id,")"))),/* @__PURE__ */qt.createElement("dt",null,"Port Ranges"),e.rules.map(e=>/* @__PURE__ */qt.createElement("dd",{key:`${e.protocol}-${e.startPort}-${e.endPort}`},e.protocol,": ",e.startPort," → ",e.endPort)))))))}};ho.contextType=C;let go=ho;const vo=G(go);class fo{resolveIndexedSecurityGroup(e,t,a){return fo.resolveIndexedSecurityGroup(e,t,a)}static resolveIndexedSecurityGroup(e,t,a){return e[t.account][t.region][a]}}class Eo{constructor(){this.supportsCompression=!0}normalizeSecurityGroup(e){return Hn.listVpcs().then(t=>{const a=t.find(t=>t.id===e.vpcId);return e.vpcName=a?a.name:"",e})}compress(e){const t=oa(e,"vpcId");return Object.keys(t).forEach(e=>{t[e]=t[e].map(e=>[e.name,e.id])}),t}decompress(e){const t=[];return Object.keys(e).forEach(a=>{e[a].forEach(e=>{t.push({name:e[0],id:e[1],vpcId:a})})}),t}}function yo(e,t){function a(e,t){t=t||{};const a=h.getCredentialsKeyedByAccount("aws"),r=t.account||e.defaultCredentials.aws||Cn.defaults.account,l=t.region||e.defaultRegions.aws||Cn.defaults.region,s=t.subnet||Cn.defaults.subnetType||"",i=h.getAvailabilityZonesForAccountAndRegion("aws",r,l);return Promise.all([i,a]).then(function([a,i]){var o,c,d,m,u,p,h,g;const v=i[r],f=v?v.defaultKeyPair:null,E=null!=(d=null==(c=null==(o=e.attributes)?void 0:o.providerSettings)?void 0:c.aws)?d:{};let y=Cn.defaults.iamRole||"BaseIAMRole";y=y.replace("{{application}}",e.name);const b=E.useAmiBlockDeviceMappings||!1,C={application:e.name,credentials:r,region:l,strategy:"",capacity:{min:1,max:1,desired:1},targetHealthyDeployPercentage:100,cooldown:10,enabledMetrics:[],healthCheckType:"EC2",healthCheckGracePeriod:600,instanceMonitoring:!1,ebsOptimized:!1,selectedProvider:"aws",iamRole:y,terminationPolicies:["Default"],vpcId:null,subnetType:s,availabilityZones:a,keyPair:f,suspendedProcesses:[],securityGroups:[],stack:"",freeFormDetails:"",spotPrice:"",tags:{},useAmiBlockDeviceMappings:b,copySourceCustomBlockDeviceMappings:!1,viewState:{instanceProfile:"custom",useSimpleInstanceTypeSelector:!0,useAllImageSelection:!1,useSimpleCapacity:!0,usePreferredZones:!0,mode:t.mode||"create",disableStrategySelection:!0,dirty:{},submitButtonLabel:n(t.mode||"create")}};if((null==(m=e.attributes)?void 0:m.platformHealthOnlyShowOverride)&&(null==(u=e.attributes)?void 0:u.platformHealthOnly)&&(C.interestingHealthProviderNames=["Amazon"]),"test"===r&&(null==(p=Cn.serverGroups)?void 0:p.enableIPv6)&&(C.associateIPv6Address=!0),null==(h=Cn.serverGroups)?void 0:h.enableIMDSv2){const t=Cn.serverGroups.defaultIMDSv2AppAgeLimit,a=null==(g=e.attributes)?void 0:g.createTs;C.requireIMDSv2=t&&a&&Number(a)>t}return C})}function n(e){switch(e){case"createPipeline":return"Add";case"editPipeline":return"Done";case"clone":return"Clone";default:return"Create"}}function r(e){return!(e.onDemandAllocationStrategy||e.onDemandBaseCapacity||e.onDemandPercentageAboveBaseCapacity||e.spotAllocationStrategy||e.spotInstancePools||e.launchTemplateOverridesForInstanceType&&e.launchTemplateOverridesForInstanceType.length>0)}return{buildNewServerGroupCommand:a,buildServerGroupCommandFromExisting:function(t,a,l="clone"){var s,i,o,c;const m=h.getPreferredZonesByAccount("aws"),u=N.listSubnets(),p=pe.parseServerGroupName(a.asg.autoScalingGroupName);let g;if(a.mixedInstancesPolicy){const e=null==(s=a.mixedInstancesPolicy)?void 0:s.launchTemplateOverridesForInstanceType;g=e?e.map(e=>e.instanceType):[null==(c=null==(o=null==(i=a.mixedInstancesPolicy)?void 0:i.launchTemplates[0])?void 0:o.launchTemplateData)?void 0:c.instanceType]}else a.launchTemplate?g=[Zt.get(a,"launchTemplate.launchTemplateData.instanceType")]:a.launchConfig&&(g=[Zt.get(a,"launchConfig.instanceType")]);const v=e.getCategoryForMultipleInstanceTypes("aws",g);return Promise.all([m,u,v]).then(([e,s,i])=>{var o,c,m,u,h,g,v,f,E,y,b,C,N,S;const w=a.asg.availabilityZones.sort();let k=!1;const T=e[a.account];if(T){const e=T[a.region].sort();k=w.join(",")===e.join(",")}const I=["Launch","Terminate","AddToLoadBalancer"],P=(null!=(m=null==(c=null==(o=t.attributes)?void 0:o.providerSettings)?void 0:c.aws)?m:{}).useAmiBlockDeviceMappings||!1,A={},G=["spinnaker:application","spinnaker:stack","spinnaker:details"];a.asg.tags&&a.asg.tags.filter(e=>!G.includes(e.key)).forEach(e=>{A[e.key]=e.value});const x={application:t.name,strategy:"",stack:p.stack,freeFormDetails:p.freeFormDetails,credentials:a.account,cooldown:a.asg.defaultCooldown,enabledMetrics:Zt.get(a,"asg.enabledMetrics",[]).map(e=>e.metric),healthCheckGracePeriod:a.asg.healthCheckGracePeriod,healthCheckType:a.asg.healthCheckType,terminationPolicies:a.asg.terminationPolicies,loadBalancers:a.asg.loadBalancerNames,region:a.region,useSourceCapacity:!1,capacity:{min:a.asg.minSize,max:a.asg.maxSize,desired:a.asg.desiredCapacity},targetHealthyDeployPercentage:100,availabilityZones:w,selectedProvider:"aws",source:{account:a.account,region:a.region,asgName:a.asg.autoScalingGroupName},suspendedProcesses:(a.asg.suspendedProcesses||[]).map(e=>e.processName).filter(e=>!I.includes(e)),tags:Object.assign({},a.tags,A),targetGroups:a.targetGroups,useAmiBlockDeviceMappings:P,copySourceCustomBlockDeviceMappings:"clone"===l,viewState:{instanceProfile:i,useAllImageSelection:!1,useSimpleCapacity:a.asg.minSize===a.asg.maxSize,usePreferredZones:k,mode:l,submitButtonLabel:n(l),isNew:!1,dirty:{}}};if((null==(u=t.attributes)?void 0:u.platformHealthOnlyShowOverride)&&(null==(h=t.attributes)?void 0:h.platformHealthOnly)&&(x.interestingHealthProviderNames=["Amazon"]),"editPipeline"===l){x.useSourceCapacity=!0,x.viewState.useSimpleCapacity=!1,x.strategy="redblack";const e=d.getStrategy("redblack");e.initializationMethod&&e.initializationMethod(x),x.suspendedProcesses=[]}const D=Sn(a.asg);if(D){const e=D.split(",")[0],t=s.find(t=>t.id===e);x.subnetType=t.purpose,x.vpcId=t.vpcId}else x.subnetType="",x.vpcId=null;if(a.launchConfig&&(Object.assign(x,{instanceType:a.launchConfig.instanceType,iamRole:a.launchConfig.iamInstanceProfile,keyPair:a.launchConfig.keyName,associatePublicIpAddress:a.launchConfig.associatePublicIpAddress,ramdiskId:a.launchConfig.ramdiskId,instanceMonitoring:a.launchConfig.instanceMonitoring&&a.launchConfig.instanceMonitoring.enabled,ebsOptimized:a.launchConfig.ebsOptimized,spotPrice:a.launchConfig.spotPrice}),a.launchConfig.userData&&(x.base64UserData=a.launchConfig.userData),x.viewState.imageId=a.launchConfig.imageId,x.viewState.useSimpleInstanceTypeSelector=!0),a.launchTemplate||a.mixedInstancesPolicy){let e,t;if(a.launchTemplate&&(e=a.launchTemplate.launchTemplateData,t=null==(v=null==(g=e.instanceMarketOptions)?void 0:g.spotOptions)?void 0:v.maxPrice,x.instanceType=e.instanceType,x.viewState.useSimpleInstanceTypeSelector=!0,e.userData&&(x.base64UserData=e.userData)),a.mixedInstancesPolicy){const n=a.mixedInstancesPolicy;e=null==(E=null==(f=null==n?void 0:n.launchTemplates)?void 0:f[0])?void 0:E.launchTemplateData,t=null==(y=null==n?void 0:n.instancesDistribution)?void 0:y.spotMaxPrice,x.securityGroups=e.networkInterfaces?(null!=(b=e.networkInterfaces.find(e=>0===e.deviceIndex))?b:{}).groups:e.securityGroups,x.onDemandAllocationStrategy=n.instancesDistribution.onDemandAllocationStrategy,x.onDemandBaseCapacity=n.instancesDistribution.onDemandBaseCapacity,x.onDemandPercentageAboveBaseCapacity=n.instancesDistribution.onDemandPercentageAboveBaseCapacity,x.spotAllocationStrategy=n.instancesDistribution.spotAllocationStrategy,x.spotInstancePools=n.instancesDistribution.spotInstancePools,n.launchTemplateOverridesForInstanceType?x.launchTemplateOverridesForInstanceType=function(e){let t=1;return Zt.sortBy(e,["priority"]).map(e=>{const{instanceType:a,weightedCapacity:n}=e;let r;return e.priority?(r=e.priority,t=e.priority+1):r=t++,{instanceType:a,weightedCapacity:n,priority:r}})}(n.launchTemplateOverridesForInstanceType):x.instanceType=e.instanceType,x.viewState.useSimpleInstanceTypeSelector=r(x)}const n=Zt.get(e,"networkInterfaces[0]"),l=null!=(C=null==n?void 0:n.ipv6AddressCount)?C:0,s=Cn.serverGroups,i=a.accountDetails&&"test"===a.accountDetails.environment,o=s&&s.enableIPv6&&s.setIPv6InTest&&i;Object.assign(x,{iamRole:e.iamInstanceProfile.name,keyPair:e.keyName,associateIPv6Address:o||Boolean(l),ramdiskId:e.ramdiskId,instanceMonitoring:e.monitoring&&e.monitoring.enabled,ebsOptimized:e.ebsOptimized,spotPrice:t||void 0,requireIMDSv2:Boolean("required"===(null==(N=e.metadataOptions)?void 0:N.httpTokens)),unlimitedCpuCredits:e.creditSpecification?"unlimited"===e.creditSpecification.cpuCredits:void 0}),x.viewState.imageId=e.imageId}if("clone"===l&&a.image&&a.image.name&&(x.amiName=a.image.name),a.launchConfig&&a.launchConfig.securityGroups.length&&(x.securityGroups=a.launchConfig.securityGroups),a.launchTemplate&&a.launchTemplate.launchTemplateData.securityGroups.length&&(x.securityGroups=a.launchTemplate.launchTemplateData.securityGroups),a.launchTemplate&&a.launchTemplate.launchTemplateData.networkInterfaces){const e=null!=(S=a.launchTemplate.launchTemplateData.networkInterfaces.find(e=>0===e.deviceIndex))?S:{};x.securityGroups=e.groups}return x})},buildNewServerGroupCommandForPipeline:function(){return Promise.resolve({viewState:{requiresTemplateSelection:!0}})},buildServerGroupCommandFromPipeline:function(t,n){const l=Zt.cloneDeep(n),s=Object.keys(l.availabilityZones)[0],i=l.launchTemplateOverridesForInstanceType?l.launchTemplateOverridesForInstanceType.map(e=>e.instanceType):[l.instanceType],o=e.getCategoryForMultipleInstanceTypes("aws",i),c={account:l.account,region:s};return Promise.all([a(t,c),o]).then(function([e,t]){const a=l.availabilityZones[s].join(",")===e.availabilityZones.join(","),n={instanceProfile:t,disableImageSelection:!0,useSimpleCapacity:l.capacity.min===l.capacity.max&&!0!==l.useSourceCapacity,usePreferredZones:a,mode:"editPipeline",submitButtonLabel:"Done",templatingEnabled:!0,existingPipelineCluster:!0,dirty:{},useSimpleInstanceTypeSelector:r(l)},i={region:s,credentials:l.account,availabilityZones:l.availabilityZones[s],iamRole:l.iamRole,viewState:n};return l.strategy=l.strategy||"",Object.assign({},e,l,i)})},buildUpdateServerGroupCommand:function(e){var a,n;const r={type:"modifyAsg",asgs:[{asgName:e.name,region:e.region}],cooldown:e.asg.defaultCooldown,enabledMetrics:(null!=(n=null==(a=e.asg)?void 0:a.enabledMetrics)?n:[]).map(e=>e.metric),healthCheckGracePeriod:e.asg.healthCheckGracePeriod,healthCheckType:e.asg.healthCheckType,terminationPolicies:Zt.cloneDeep(e.asg.terminationPolicies),credentials:e.account,capacityRebalance:e.asg.capacityRebalance};return t.configureUpdateCommand(r),r}}}const bo=class{constructor(e,t){const a=t.providerServiceDelegate.getDelegate("aws","serverGroup.configurationService");this.delegate=yo(t.instanceTypeService,a)}buildNewServerGroupCommand(e,t){return this.delegate.buildNewServerGroupCommand(e,t)}buildServerGroupCommandFromExisting(e,t,a){return this.delegate.buildServerGroupCommandFromExisting(e,t,a)}buildNewServerGroupCommandForPipeline(){return this.delegate.buildNewServerGroupCommandForPipeline()}buildServerGroupCommandFromPipeline(e,t){return this.delegate.buildServerGroupCommandFromPipeline(e,t)}buildUpdateServerGroupCommand(e){return this.delegate.buildUpdateServerGroupCommand(e)}};bo.requiresDeckRuntimeServices=!0;const Co=bo;class No{static getDisabledDate(e){if(e.isDisabled){const t=this.normalizeScalingProcesses(e).find(e=>"AddToLoadBalancer"===e.name&&!e.enabled);if(t)return t.suspensionDate}return null}static normalizeScalingProcesses(e){if(!e.asg||!e.asg.suspendedProcesses)return[];const t=e.asg.suspendedProcesses;return this.listProcesses().map(e=>{const a=t.find(t=>t.processName===e.name),n={name:e.name,enabled:!a,description:e.description};if(a){const e=a.suspensionReason.replace("User suspended at ","");n.suspensionDate=new Date(e).getTime()}return n})}static listProcesses(){return[{name:"Launch",description:"Controls if new instances should be launched into the ASG. If this is disabled, scale-up events will not produce new instances."},{name:"Terminate",description:"Controls if instances should be terminated during a scale-down event."},{name:"AddToLoadBalancer",description:"Controls if new instances should be added to the ASG’s ELB."},{name:"AlarmNotification",description:"This disables autoscaling."},{name:"AZRebalance",description:"Controls whether AWS should attempt to maintain an even distribution of instances across all healthy Availability Zones configured for the ASG."},{name:"HealthCheck",description:"If disabled, the instance’s health will no longer be reported to the autoscaling processor."},{name:"ReplaceUnhealthy",description:"Controls whether instances should be replaced if they failed the health check."},{name:"ScheduledActions",description:"Controls whether scheduled actions should be executed."}]}}class So{static listKeyPairs(){return F("/keyPairs").useCache().get().then(e=>e.sort((e,t)=>e.keyName.localeCompare(t.keyName)))}}class wo{constructor(e,t,a,n={getCommandOverrides:()=>[]}){this.serverGroupCommandRegistry=n,this.enabledMetrics=["GroupMinSize","GroupMaxSize","GroupDesiredCapacity","GroupInServiceInstances","GroupPendingInstances","GroupStandbyInstances","GroupTerminatingInstances","GroupTotalInstances"],this.healthCheckTypes=["EC2","ELB"],this.terminationPolicies=["OldestInstance","NewestInstance","OldestLaunchConfiguration","ClosestToNextInstanceHour","Default"],this.securityGroupReader=e,this.awsInstanceTypeService=t,this.cacheInitializer=a}getSecurityGroupReader(){return this.securityGroupReader}getCacheInitializer(){return this.cacheInitializer}configureUpdateCommand(e){e.backingData={enabledMetrics:ba(this.enabledMetrics),healthCheckTypes:ba(this.healthCheckTypes),terminationPolicies:ba(this.terminationPolicies)}}configureCommand(e,t){this.applyOverrides("beforeConfiguration",t),t.toggleSuspendedProcess=(e,t)=>{e.suspendedProcesses=e.suspendedProcesses||[];const a=e.suspendedProcesses.indexOf(t);e.suspendedProcesses=-1===a?e.suspendedProcesses.concat(t):e.suspendedProcesses.filter(e=>e!==t)},t.processIsSuspended=(e,t)=>e.suspendedProcesses.includes(t),t.onStrategyChange=(e,t)=>{var a;(null==(a=Cn.serverGroups)?void 0:a.enableLaunchTemplates)&&(e.setLaunchTemplate="rollingpush"===t.key||void 0),""!==t.key&&"custom"!==t.key&&(e.suspendedProcesses=(e.suspendedProcesses||[]).filter(e=>"AddToLoadBalancer"!==e))},t.getBlockDeviceMappingsSource=e=>e.copySourceCustomBlockDeviceMappings?"source":e.useAmiBlockDeviceMappings?"ami":"default",t.selectBlockDeviceMappingsSource=(e,t)=>{"source"===t?(e.copySourceCustomBlockDeviceMappings=!0,e.useAmiBlockDeviceMappings=!1):"ami"===t?(e.copySourceCustomBlockDeviceMappings=!1,e.useAmiBlockDeviceMappings=!0):(e.copySourceCustomBlockDeviceMappings=!1,e.useAmiBlockDeviceMappings=!1)},t.regionIsDeprecated=e=>Ca(e,"backingData.filtered.regions")&&e.backingData.filtered.regions.some(t=>t.name===e.region&&t.deprecated);const a=this.getSecurityGroupReader();return Promise.all([h.getCredentialsKeyedByAccount("aws"),a.getAllSecurityGroups(),N.listSubnets(),h.getPreferredZonesByAccount("aws"),So.listKeyPairs(),this.awsInstanceTypeService.getAllTypesByRegion(),Promise.resolve(ba(this.enabledMetrics)),Promise.resolve(ba(this.healthCheckTypes)),Promise.resolve(ba(this.terminationPolicies))]).then(([a,n,r,l,s,i,o,c,d])=>{var m,u;const p={credentialsKeyedByAccount:a,securityGroups:n,subnets:r,preferredZones:l,keyPairs:s,instanceTypesInfo:i,enabledMetrics:o,healthCheckTypes:c,terminationPolicies:d};let h=Promise.resolve();if(p.accounts=Na(p.credentialsKeyedByAccount),p.filtered={},p.scalingProcesses=No.listProcesses(),p.appLoadBalancers=e.getDataSource("loadBalancers").data,p.managedResources=null==(u=null==(m=e.getDataSource("managedResources"))?void 0:m.data)?void 0:u.resources,t.backingData=p,this.configureVpcId(t),p.filtered.securityGroups=this.getRegionalSecurityGroups(t),t.viewState.disableImageSelection&&this.configureInstanceTypes(t),t.securityGroups&&t.securityGroups.length){const e=sa(this.getRegionalSecurityGroups(t),"id");Sa(t.securityGroups,e).length<t.securityGroups.length&&(h=this.refreshSecurityGroups(t,!0))}return h.then(()=>{this.applyOverrides("afterConfiguration",t),this.attachEventHandlers(t)})})}applyOverrides(e,t){this.serverGroupCommandRegistry.getCommandOverrides("aws").forEach(a=>{a[e]&&a[e](t)})}configureKeyPairs(e){const t={dirty:{}};if(e.credentials&&e.region){const a=ua(e.backingData.credentialsKeyedByAccount,t=>t.defaultKeyPair&&e.keyPair&&0===e.keyPair.indexOf(t.defaultKeyPair.replace("{{region}}",""))),n=la(e.backingData.keyPairs).filter({account:e.credentials,region:e.region}).map("keyName").value();if(e.keyPair&&n.length&&!n.includes(e.keyPair)){const r=e.backingData.credentialsKeyedByAccount[e.credentials]||{defaultKeyPair:null};if(r.defaultKeyPair){const l=r.defaultKeyPair.replace("{{region}}",e.region);a&&n.includes(l)?e.keyPair=l:(e.keyPair=null,t.dirty.keyPair=!0)}else e.keyPair=null,t.dirty.keyPair=!0}e.backingData.filtered.keyPairs=n}else e.backingData.filtered.keyPairs=[];return t}configureInstanceTypes(e){const t={dirty:{}};if(e.region&&(e.virtualizationType||e.viewState.disableImageSelection)){let a=this.awsInstanceTypeService.getAvailableTypesForRegions(e.backingData.instanceTypesInfo,[e.region]);(e.virtualizationType||e.amiArchitecture)&&(a=this.awsInstanceTypeService.filterInstanceTypes(a,e.virtualizationType,!!e.vpcId,e.amiArchitecture));const n=sa(a,"name");e.instanceType&&!n.includes(e.instanceType)&&(t.dirty.instanceType=e.instanceType,e.instanceType=null);const r=sa(e.launchTemplateOverridesForInstanceType,"instanceType"),l=Sa(r,n),s=ma(r,l);e.launchTemplateOverridesForInstanceType&&s.length>0&&(t.dirty.launchTemplateOverridesForInstanceType=e.launchTemplateOverridesForInstanceType.filter(e=>s.includes(e.instanceType)),e.launchTemplateOverridesForInstanceType=e.launchTemplateOverridesForInstanceType.filter(e=>l.includes(e.instanceType))),e.backingData.filtered.instanceTypes=n,e.backingData.filtered.instanceTypesInfo=a}else e.backingData.filtered.instanceTypes=[],e.backingData.filtered.instanceTypesInfo=[];return wa(e.viewState.dirty,t.dirty),t}configureImages(e){const t={dirty:{}};return e.amiName||(e.virtualizationType=null,e.amiArchitecture=null),e.viewState.disableImageSelection||e.amiName&&!e.region&&(t.dirty.amiName=!0,e.amiName=null),t}configureAvailabilityZones(e){e.backingData.filtered.availabilityZones=ka(e.backingData.credentialsKeyedByAccount[e.credentials].regions,{name:e.region}).availabilityZones}configureSubnetPurposes(e){const t={dirty:{}},a=e.backingData.filtered;return null===e.region||(a.subnetPurposes=la(e.backingData.subnets).filter({account:e.credentials,region:e.region}).reject({target:"elb"}).reject({purpose:null}).uniqBy("purpose").value(),la(a.subnetPurposes).some({purpose:e.subnetType}).value()||(e.subnetType=null,t.dirty.subnetType=!0)),t}getRegionalSecurityGroups(e){const t=e.backingData.securityGroups[e.credentials]||{aws:{}};return la(t.aws[e.region]).filter({vpcId:e.vpcId||null}).sortBy("name").value()}configureSecurityGroupOptions(e){const t={dirty:{}},a=e.backingData.filtered.securityGroups,n=this.getRegionalSecurityGroups(e),r="string"==typeof e.securityGroups&&e.securityGroups.includes("${");if(a&&e.securityGroups&&!r){const r=e.securityGroups.map(e=>{const t=ka(a,{id:e});return t?t.name:e}),l=e.securityGroups.map(e=>{const t=ka(a,{id:e})||ka(a,{name:e});return t?t.name:null}).map(e=>ka(n,{name:e})).filter(e=>e),s=sa(l,"name"),i=Ta(r,s);e.securityGroups=sa(l,"id"),i.length&&(t.dirty.securityGroups=i)}return e.backingData.filtered.securityGroups=n.sort((e,t)=>e.name.localeCompare(t.name)),t}refreshSecurityGroups(e,t){return this.getCacheInitializer().refreshCache("securityGroups").then(()=>this.getSecurityGroupReader().getAllSecurityGroups().then(a=>{e.backingData.securityGroups=a,t||this.configureSecurityGroupOptions(e)}))}getLoadBalancerMap(e){if(e.backingData.loadBalancers)return la(e.backingData.loadBalancers).map("accounts").flattenDeep().filter({name:e.credentials}).map("regions").flattenDeep().filter({name:e.region}).map("loadBalancers").flattenDeep().value();return(e.backingData.appLoadBalancers||[]).filter(t=>t.region===e.region&&t.account===e.credentials)}getLoadBalancerNames(e){return this.getLoadBalancerMap(e).filter(t=>(!t.loadBalancerType||"classic"===t.loadBalancerType)&&t.vpcId===e.vpcId).map(e=>e.name).sort()}getVpcLoadBalancerNames(e){return this.getLoadBalancerMap(e).filter(e=>(!e.loadBalancerType||"classic"===e.loadBalancerType)&&e.vpcId).map(e=>e.name).sort()}getTargetGroupNames(e){const t=this.getLoadBalancerMap(e).filter(e=>"classic"!==e.loadBalancerType);return Qt(t.map(e=>e.targetGroups.filter(e=>"instance"===e.targetType))).map(e=>e.name).sort()}getValidMatches(e,t){const a=t.filter(e=>e.includes("${")),n=Sa(e,t),[r,l]=ga(t,e=>n.includes(e)||a.includes(e));return{valid:r,invalid:l,spel:a}}configureLoadBalancerOptions(e){const t={dirty:{}},a=(e.loadBalancers||[]).concat(e.vpcLoadBalancers||[]),n=e.targetGroups||[],r=this.getLoadBalancerNames(e),l=this.getVpcLoadBalancerNames(e),s=this.getTargetGroupNames(e);if(a&&e.loadBalancers){const n=e.vpcId?r:r.concat(l),{valid:s,invalid:i,spel:o}=this.getValidMatches(n,a);e.loadBalancers=Sa(r.concat(o),s),e.vpcId?delete e.vpcLoadBalancers:e.vpcLoadBalancers=Sa(l,s),i.length&&(t.dirty.loadBalancers=i),e.viewState.spelLoadBalancers=o||[]}if(n&&e.targetGroups&&!n.includes("${")){const{valid:a,invalid:r,spel:l}=this.getValidMatches(s,n);e.targetGroups=a,r.length&&(t.dirty.targetGroups=r),e.viewState.spelTargetGroups=l||[]}return e.backingData.filtered.loadBalancers=r,e.backingData.filtered.vpcLoadBalancers=l,e.backingData.filtered.targetGroups=s,t}refreshLoadBalancers(e,t){return F("/loadBalancers").query({provider:"aws"}).get().then(a=>{e.backingData.loadBalancers=a,t||this.configureLoadBalancerOptions(e)})}configureVpcId(e){const t={dirty:{}};if(e.subnetType){const t=ka(e.backingData.subnets,{purpose:e.subnetType,account:e.credentials,region:e.region});e.vpcId=t?t.vpcId:null}else e.vpcId=null,t.dirty.vpcId=!0;return wa(t.dirty,this.configureInstanceTypes(e).dirty),t}attachEventHandlers(e){e.usePreferredZonesChanged=e=>{const t=e.availabilityZones?e.availabilityZones.length:0,a={dirty:{}},n=e.backingData.preferredZones[e.credentials];if(n&&n[e.region]&&e.viewState.usePreferredZones)e.availabilityZones=Xt(n[e.region].sort());else{e.availabilityZones=Sa(e.availabilityZones,e.backingData.filtered.availabilityZones);t!==(e.availabilityZones?e.availabilityZones.length:0)&&(a.dirty.availabilityZones=!0)}return a},e.subnetChanged=e=>{const t=this.configureVpcId(e);return wa(t.dirty,this.configureSecurityGroupOptions(e).dirty),wa(t.dirty,this.configureLoadBalancerOptions(e).dirty),e.viewState.dirty=e.viewState.dirty||{},wa(e.viewState.dirty,t.dirty),t},e.regionChanged=e=>{const t={dirty:{}},a=e.backingData.filtered;return wa(t.dirty,this.configureSubnetPurposes(e).dirty),e.region?(wa(t.dirty,e.subnetChanged(e).dirty),wa(t.dirty,this.configureInstanceTypes(e).dirty),this.configureAvailabilityZones(e),wa(t.dirty,e.usePreferredZonesChanged(e).dirty),wa(t.dirty,this.configureImages(e).dirty),wa(t.dirty,this.configureKeyPairs(e).dirty)):a.regionalAvailabilityZones=null,Et(e),t},e.clusterChanged=e=>{e.moniker=pe.getMoniker(e.application,e.stack,e.freeFormDetails),Et(e)},e.credentialsChanged=e=>{const t={dirty:{}},a=e.backingData;if(e.credentials){const n=a.credentialsKeyedByAccount[e.credentials]||{regions:[]};a.filtered.regions=n.regions,ua(a.filtered.regions,{name:e.region})?wa(t.dirty,e.regionChanged(e).dirty):(e.region=null,t.dirty.region=!0)}else e.region=null;return Et(e),t},e.imageChanged=e=>this.configureInstanceTypes(e),e.instanceTypeChanged=e=>{e.ebsOptimized=this.awsInstanceTypeService.isEbsOptimized(e.instanceType)},e.launchTemplateOverridesChanged=e=>{var t;e.ebsOptimized=null==(t=e.launchTemplateOverridesForInstanceType)?void 0:t.every(e=>this.awsInstanceTypeService.isEbsOptimized(e.instanceType))},this.applyOverrides("attachEventHandlers",e)}}const ko=class extends wo{constructor(e,t){super(t.securityGroupReader,new rr,t.cacheInitializer)}};ko.requiresDeckRuntimeServices=!0;let To=ko;class Io extends qt.Component{constructor(e){super(e),this.state={templateSelectionText:{copied:["account, region, subnet, cluster name (stack, details)","load balancers",j.get("firewalls"),"instance type","all fields on the Advanced Settings page"],notCopied:["the following suspended scaling processes: Launch, Terminate, AddToLoadBalancer"],additionalCopyText:"If a server group exists in this cluster at the time of deployment, its scaling policies will be copied over to the new server group."}},e.command.viewState.disableStrategySelection||this.state.templateSelectionText.notCopied.push("the deployment strategy (if any) used to deploy the most recent server group")}render(){const{app:e,command:t,onDismiss:a,onTemplateSelected:n}=this.props,{templateSelectionText:r}=this.state;/* @__PURE__ */
|
|
170
|
+
return qt.createElement(yt,{cloudProvider:"aws",application:e,command:t,onDismiss:a,onTemplateSelected:n,templateSelectionText:r})}}class Po extends qt.Component{constructor(){super(...arguments),this.state={errorMessage:null,selectionMode:"packageImages",searchString:"",searchResults:[],isSearching:!1,packageImages:null,isLoadingPackageImages:!0},this.awsImageReader=new ur,this.props$=new Aa,this.searchInput$=new Aa,this.destroy$=new Aa,this.sortImagesBy$=new Da("ts"),this.buildImageMenu=e=>{const{ImageMenuHeading:t,ImageLabel:a}=this,{options:n}=e;/* @__PURE__ */
|
|
171
171
|
return qt.createElement(qt.Fragment,null,n.length>0&&/* @__PURE__ */qt.createElement(t,null),n.map(t=>/* @__PURE__ */qt.createElement(a,{key:t.imageName,option:t,params:e})))},this.ImageMenuHeading=()=>{const e=this.sortImagesBy$.value;/* @__PURE__ */
|
|
172
172
|
return qt.createElement("div",{className:"sp-padding-s-xaxis sp-padding-xs-yaxis small",style:{borderBottom:"1px solid var(--color-silver)",position:"sticky",top:0,backgroundColor:"var(--color-white)"}},
|
|
173
173
|
/* @__PURE__ */qt.createElement("b",null,"Sort by: "),
|
|
@@ -176,105 +176,105 @@ return qt.createElement("div",{className:"sp-padding-s-xaxis sp-padding-xs-yaxis
|
|
|
176
176
|
/* @__PURE__ */qt.createElement("a",{className:"clickable sp-padding-xs-xaxis",onClick:()=>this.setSortImagesBy("name")},"name"===e?/* @__PURE__ */qt.createElement("b",null,"name (A-Z)"):"name (A-Z)"))},this.ImageLabel=e=>{const{credentials:t,region:a}=this.props,{option:n,params:r}=e,l=n.amis[a]&&n.amis[a][0]?n.amis[a][0]:` - not found in ${t}/${a}`;/* @__PURE__ */
|
|
177
177
|
return qt.createElement("div",{key:n.imageName,onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),r.selectValue(n)},onMouseOver:()=>r.focusOption(n),className:"Select-option "+(r.focusedOption&&r.focusedOption.imageName===n.imageName?"is-focused":""),role:"option"},
|
|
178
178
|
/* @__PURE__ */qt.createElement("div",null,n.imageName),
|
|
179
|
-
/* @__PURE__ */qt.createElement("div",{className:"small"},/* @__PURE__ */qt.createElement("b",null,"Created: "),n.attributes.creationDate,/* @__PURE__ */qt.createElement("b",{className:"sp-padding-s-left"},"AMI: "),l))}}static makeFakeImage(e,t,a){if(!e&&!t)return null;return{imageName:e,amis:{[a]:[t]},attributes:{virtualizationType:"*",architecture:"*",creationDate:/* @__PURE__ */(new Date).toISOString()}}}loadImagesFromApplicationName(e){const t=e.name.replace(/_/g,"[_\\-]")+"*";return this.awsImageReader.findImages({q:t})}buildQueryForSimilarImages(e){let t=!1,a=e.split("_")[0];const n=a.split("-");n.length>3&&(a=n.slice(0,-3).join("-"),t=!0);return!a||a.length<3?null:a+(t?"-*":"*")}loadImageById(e,t,a){return e?this.awsImageReader.getImage(e,t,a).catch(()=>null):Promise.resolve(null)}searchForImages(e){return e&&e.length>=3?this.awsImageReader.findImages({q:e}):Promise.resolve([])}fetchPackageImages(e,t,a,n){const r=e&&e.amis&&e.amis[t]&&e.amis[t][0];return this.loadImageById(r,t,a).then(e=>e?this.searchForImages(this.buildQueryForSimilarImages(e.imageName)).then(t=>t.find(t=>t.imageName===e.imageName)?t:t.concat(e)):this.loadImagesFromApplicationName(n))}selectImage(e){this.props.value!==e&&this.props.onChange(e)}findMatchingImage(e,t){return e.find(e=>t&&t.imageName===e.imageName)}componentDidMount(){const e=this.props$.pipe(Ma(e=>e.region),Ra()),{value:t,region:a,credentials:n,application:r}=this.props;this.setState({isLoadingPackageImages:!0});const l=this.fetchPackageImages(t,a,n,r),s=Ga(l).pipe(Ha(e=>(console.error(e),this.setState({errorMessage:"Unable to load package images"}),Ba([]))),Ua(()=>this.setState({isLoadingPackageImages:!1}))),i=xa([s,e,this.sortImagesBy$]).pipe(Ma(([e,t,a])=>{const n=e.filter(e=>!!e.amis[t]);return this.sortImages(n,a)})),o=this.searchInput$.pipe(Ua(e=>this.setState({searchString:e})),Ra(),qa(250)).pipe(Ua(()=>this.setState({isSearching:!0})),za(e=>this.searchForImages(e)),Ha(e=>(console.error(e),this.setState({errorMessage:"Unable to search for images"}),Ba([]))),Ua(()=>this.setState({isSearching:!1})));xa([o,e,this.sortImagesBy$]).pipe(Ma(([e,t,a])=>{const{searchString:n}=this.state;if(0===e.length&&/ami-[0-9a-f]{8,17}/.exec(n)){return[
|
|
179
|
+
/* @__PURE__ */qt.createElement("div",{className:"small"},/* @__PURE__ */qt.createElement("b",null,"Created: "),n.attributes.creationDate,/* @__PURE__ */qt.createElement("b",{className:"sp-padding-s-left"},"AMI: "),l))}}static makeFakeImage(e,t,a){if(!e&&!t)return null;return{imageName:e,amis:{[a]:[t]},attributes:{virtualizationType:"*",architecture:"*",creationDate:/* @__PURE__ */(new Date).toISOString()}}}loadImagesFromApplicationName(e){const t=e.name.replace(/_/g,"[_\\-]")+"*";return this.awsImageReader.findImages({q:t})}buildQueryForSimilarImages(e){let t=!1,a=e.split("_")[0];const n=a.split("-");n.length>3&&(a=n.slice(0,-3).join("-"),t=!0);return!a||a.length<3?null:a+(t?"-*":"*")}loadImageById(e,t,a){return e?this.awsImageReader.getImage(e,t,a).catch(()=>null):Promise.resolve(null)}searchForImages(e){return e&&e.length>=3?this.awsImageReader.findImages({q:e}):Promise.resolve([])}fetchPackageImages(e,t,a,n){const r=e&&e.amis&&e.amis[t]&&e.amis[t][0];return this.loadImageById(r,t,a).then(e=>e?this.searchForImages(this.buildQueryForSimilarImages(e.imageName)).then(t=>t.find(t=>t.imageName===e.imageName)?t:t.concat(e)):this.loadImagesFromApplicationName(n))}selectImage(e){this.props.value!==e&&this.props.onChange(e)}findMatchingImage(e,t){return e.find(e=>t&&t.imageName===e.imageName)}componentDidMount(){const e=this.props$.pipe(Ma(e=>e.region),Ra()),{value:t,region:a,credentials:n,application:r}=this.props;this.setState({isLoadingPackageImages:!0});const l=this.fetchPackageImages(t,a,n,r),s=Ga(l).pipe(Ha(e=>(console.error(e),this.setState({errorMessage:"Unable to load package images"}),Ba([]))),Ua(()=>this.setState({isLoadingPackageImages:!1}))),i=xa([s,e,this.sortImagesBy$]).pipe(Ma(([e,t,a])=>{const n=e.filter(e=>!!e.amis[t]);return this.sortImages(n,a)})),o=this.searchInput$.pipe(Ua(e=>this.setState({searchString:e})),Ra(),qa(250)).pipe(Ua(()=>this.setState({isSearching:!0})),za(e=>this.searchForImages(e)),Ha(e=>(console.error(e),this.setState({errorMessage:"Unable to search for images"}),Ba([]))),Ua(()=>this.setState({isSearching:!1})));xa([o,e,this.sortImagesBy$]).pipe(Ma(([e,t,a])=>{const{searchString:n}=this.state;if(0===e.length&&/ami-[0-9a-f]{8,17}/.exec(n)){return[Po.makeFakeImage(n,n,t)].filter(e=>!!e)}const r=e.filter(e=>!!e.amis[t]);return this.sortImages(r,a)})).pipe($a(this.destroy$)).subscribe(e=>this.setState({searchResults:e})),i.pipe($a(this.destroy$)).subscribe(e=>{this.setState({packageImages:e}),this.selectImage(this.findMatchingImage(e,this.props.value))}),e.pipe(za(e=>{const t=this.props.value;if("packageImages"===this.state.selectionMode)return i.pipe(Ma(e=>this.findMatchingImage(e,t)));{const a=!!(t&&t.amis&&t.amis[e]);return Ba(a?t:void 0)}}),$a(this.destroy$)).subscribe(e=>this.selectImage(e))}setSortImagesBy(e){this.sortImagesBy$.next(e)}sortImages(e,t){return e.slice().sort((e,a)=>"ts"===t?a.attributes.creationDate.localeCompare(e.attributes.creationDate):e.imageName.localeCompare(a.imageName))}componentDidUpdate(){this.props$.next(this.props)}componentWillUnmount(){this.destroy$.next()}render(){const{value:e,credentials:t,region:a,onChange:n}=this.props,{isLoadingPackageImages:r,isSearching:l,selectionMode:s,packageImages:i,searchResults:o,searchString:d}=this.state,m=!!i,u=e=>{const n=e.amis||{},r=n[a]&&n[a][0],l=r?`(${r})`:` - not found in ${t}/${a}`;/* @__PURE__ */
|
|
180
180
|
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("span",null,e.imageName),/* @__PURE__ */qt.createElement("span",null,l))},p={clearable:!1,required:!0,valueKey:"imageName",optionRenderer:u,valueRenderer:u,onSelectResetsInput:!1,onBlurResetsInput:!1,onCloseResetsInput:!1,value:e},h=this.state.errorMessage?/* @__PURE__ */qt.createElement(Se,{message:this.state.errorMessage,type:"error"}):null,g=`No results found in ${t}/${a}`;if("searchAllImages"===s){const e=!d||d.length<3?"Please enter at least 3 characters":l?"Searching...":g;/* @__PURE__ */
|
|
181
|
-
return qt.createElement("div",{className:"col-md-9"},/* @__PURE__ */qt.createElement(S,{...p,menuRenderer:this.buildImageMenu,isLoading:l,placeholder:"Search for an image...",filterOptions:!1,noResultsText:e,options:null!=o?o:[],onInputChange:e=>(this.searchInput$.next(e),e),onChange:n}),h,/* @__PURE__ */qt.createElement("button",{type:"button",className:"link",onClick:()=>this.setState({selectionMode:"packageImages",searchString:"",searchResults:null})},"Back to Package Images")," ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.allImages"}))}return m?/* @__PURE__ */qt.createElement("div",{className:"col-md-9"},/* @__PURE__ */qt.createElement(S,{...p,menuRenderer:this.buildImageMenu,isLoading:r,placeholder:"Pick an image",noResultsText:g,options:i,onChange:n}),h,/* @__PURE__ */qt.createElement("button",{type:"button",className:"link",onClick:()=>this.setState({selectionMode:"searchAllImages"})},"Search All Images")," ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.allImages"})):/* @__PURE__ */qt.createElement("div",{className:"col-md-9"},/* @__PURE__ */qt.createElement(S,{...p,isLoading:r,disabled:!0,options:[e].filter(e=>!!e)}),h,/* @__PURE__ */qt.createElement("button",{type:"button",className:"link",onClick:()=>this.setState({selectionMode:"searchAllImages"})},"Search All Images")," ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.allImages"}))}}const
|
|
182
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal"},n.regionIsDeprecated(n)&&/* @__PURE__ */qt.createElement("div",{className:"form-group row"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12 error-message"},/* @__PURE__ */qt.createElement("div",{className:"alert alert-danger"},"You are deploying into a deprecated region within the ",n.credentials," account!"))),/* @__PURE__ */qt.createElement(bt,{app:e,formik:t}),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Account"),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(Fe,{value:n.credentials,onChange:e=>this.accountUpdated(e.target.value),readOnly:o.credentials,accounts:i,provider:"aws"}))),/* @__PURE__ */qt.createElement(Me,{readOnly:o.region,labelColumns:3,component:n,field:"region",account:n.credentials,regions:n.backingData.filtered.regions,onChange:this.regionUpdated}),/* @__PURE__ */qt.createElement(
|
|
183
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Min"),/* @__PURE__ */qt.createElement("div",{className:"col-md-8"},/* @__PURE__ */qt.createElement(Pe,{value:e,min:0,max:"number"==typeof t?t:void 0,onChange:e=>n("min",e),required:!0}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Max"),/* @__PURE__ */qt.createElement("div",{className:"col-md-8"},/* @__PURE__ */qt.createElement(Pe,{value:t,min:"number"==typeof e?e:void 0,onChange:e=>n("max",e),required:!0}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Desired"),/* @__PURE__ */qt.createElement("div",{className:"col-md-8"},/* @__PURE__ */qt.createElement(Pe,{value:a,min:"number"==typeof e?e:void 0,max:"number"==typeof t?t:void 0,onChange:e=>n("desired",e),required:!0}))))}}class
|
|
184
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"row"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement(
|
|
181
|
+
return qt.createElement("div",{className:"col-md-9"},/* @__PURE__ */qt.createElement(S,{...p,menuRenderer:this.buildImageMenu,isLoading:l,placeholder:"Search for an image...",filterOptions:!1,noResultsText:e,options:null!=o?o:[],onInputChange:e=>(this.searchInput$.next(e),e),onChange:n}),h,/* @__PURE__ */qt.createElement("button",{type:"button",className:"link",onClick:()=>this.setState({selectionMode:"packageImages",searchString:"",searchResults:null})},"Back to Package Images")," ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.allImages"}))}return m?/* @__PURE__ */qt.createElement("div",{className:"col-md-9"},/* @__PURE__ */qt.createElement(S,{...p,menuRenderer:this.buildImageMenu,isLoading:r,placeholder:"Pick an image",noResultsText:g,options:i,onChange:n}),h,/* @__PURE__ */qt.createElement("button",{type:"button",className:"link",onClick:()=>this.setState({selectionMode:"searchAllImages"})},"Search All Images")," ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.allImages"})):/* @__PURE__ */qt.createElement("div",{className:"col-md-9"},/* @__PURE__ */qt.createElement(S,{...p,isLoading:r,disabled:!0,options:[e].filter(e=>!!e)}),h,/* @__PURE__ */qt.createElement("button",{type:"button",className:"link",onClick:()=>this.setState({selectionMode:"searchAllImages"})},"Search All Images")," ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.allImages"}))}}const Ao=e=>e&&e.includes("${");class Go extends qt.Component{constructor(e){super(e),this.imageChanged=e=>{var t,a;const{setFieldValue:n,values:r}=this.props.formik;this.setState({selectedImage:e});const l=e&&e.attributes.virtualizationType,s=e&&e.attributes.architecture,i=e&&e.imageName;if(r.virtualizationType=l,r.amiArchitecture=s,r.amiName=i,n("amiArchitecture",s),n("virtualizationType",l),n("amiName",i),r.imageChanged(r),e&&(null==(t=o.disabledImages)?void 0:t.length)&&(null==(a=Cn.serverGroups)?void 0:a.enableIPv6)){o.disabledImages.some(t=>e.imageName.includes(t))&&n("associateIPv6Address",!1)}this.props.formik.validateForm()},this.accountUpdated=e=>{var t,a,n,r,l,s,i,o;const{setFieldValue:c,values:d}=this.props.formik;d.credentials=e,d.credentialsChanged(d),d.subnetChanged(d),c("credentials",e);const m=d.backingData.credentialsKeyedByAccount[e];if(c("associateIPv6Address",(null==(t=null==Cn?void 0:Cn.serverGroups)?void 0:t.enableIPv6)&&(null==(a=null==Cn?void 0:Cn.serverGroups)?void 0:a.setIPv6InTest)&&"test"===m.environment),null==(n=Cn.serverGroups)?void 0:n.enableIMDSv2){const t=!(null==(l=null==(r=null==Cn?void 0:Cn.serverGroups)?void 0:r.accountDenyListIMDSv2)?void 0:l.includes(e)),a=null==(s=Cn.serverGroups)?void 0:s.defaultIMDSv2AppAgeLimit,n=null==(o=null==(i=this.props.app)?void 0:i.attributes)?void 0:o.createTs;c("requireIMDSv2",t&&a&&n&&Number(n)>a)}},this.regionUpdated=e=>{const{values:t,setFieldValue:a}=this.props.formik;t.region=e,t.regionChanged(t),a("region",e)},this.subnetUpdated=()=>{const{setFieldValue:e,values:t}=this.props.formik;t.subnetChanged(t),e("subnetType",t.subnetType)},this.clientRequestsChanged=()=>{const{values:e,setFieldValue:t}=this.props.formik;e.toggleSuspendedProcess(e,"AddToLoadBalancer"),t("suspendedProcesses",e.suspendedProcesses),this.setState({})},this.navigateToLatestServerGroup=()=>{const{values:e}=this.props.formik,{latestServerGroup:t}=this.state,a={provider:e.selectedProvider,accountId:t.account,region:t.region,serverGroup:t.name};this.props.stateService.is("home.applications.application.insight.clusters")?this.props.stateService.go(".serverGroup",a):this.props.stateService.go("^.serverGroup",a)},this.stackChanged=e=>{const{setFieldValue:t,values:a}=this.props.formik;a.stack=e,t("stack",e),a.clusterChanged(a)},this.handleReasonChanged=e=>{this.props.formik.setFieldValue("reason",e)},this.strategyChanged=(e,t)=>{e.onStrategyChange(e,t),this.props.formik.setFieldValue("strategy",t.key)},this.onStrategyFieldChange=(e,t)=>{this.props.formik.setFieldValue(e,t)};const{amiName:t,region:a,viewState:{imageId:n}}=e.formik.values,r=Po.makeFakeImage(t,n,a);this.state={...this.getStateFromProps(e),selectedImage:r}}getStateFromProps(e){const{app:t}=e,{values:a}=e.formik,n=pe.getClusterName(t.name,a.stack,a.freeFormDetails),r=!t.clusters.find(e=>e.name===n),l=t.serverGroups.data.filter(e=>e.cluster===n&&e.account===a.credentials&&e.region===a.region).sort((e,t)=>e.createdTime-t.createdTime),s=l.length?l.pop():null;return{namePreview:n,createsNewCluster:r,latestServerGroup:s}}validate(e){const t={};var a,n;return a=e.stack,Ao(a)||/^([a-zA-Z_0-9._${}]*(\${.+})*)*$/.test(a)||(t.stack="Only dot(.) and underscore(_) special characters are allowed in the Stack field."),n=e.freeFormDetails,Ao(n)||/^([a-zA-Z_0-9._${}-]*(\${.+})*)*$/.test(n)||(t.freeFormDetails="Only dot(.), underscore(_), and dash(-) special characters are allowed in the Detail field."),e.viewState.disableImageSelection||e.amiName||(t.amiName="Image required."),e.resourceSummary&&(t.resourceSummary={id:"Cluster is managed"}),t}componentWillReceiveProps(e){this.setState(this.getStateFromProps(e))}render(){const{app:e,formik:t}=this.props,{errors:a,values:n}=t,{createsNewCluster:r,latestServerGroup:l,namePreview:s}=this.state,i=n.backingData.accounts,o=n.viewState.readOnlyFields||{};/* @__PURE__ */
|
|
182
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal"},n.regionIsDeprecated(n)&&/* @__PURE__ */qt.createElement("div",{className:"form-group row"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12 error-message"},/* @__PURE__ */qt.createElement("div",{className:"alert alert-danger"},"You are deploying into a deprecated region within the ",n.credentials," account!"))),/* @__PURE__ */qt.createElement(bt,{app:e,formik:t}),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Account"),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(Fe,{value:n.credentials,onChange:e=>this.accountUpdated(e.target.value),readOnly:o.credentials,accounts:i,provider:"aws"}))),/* @__PURE__ */qt.createElement(Me,{readOnly:o.region,labelColumns:3,component:n,field:"region",account:n.credentials,regions:n.backingData.filtered.regions,onChange:this.regionUpdated}),/* @__PURE__ */qt.createElement(il,{readOnly:o.subnet,labelColumns:3,helpKey:"aws.serverGroup.subnet",component:n,field:"subnetType",region:n.region,application:e,subnets:n.backingData.filtered.subnetPurposes,onChange:this.subnetUpdated,showSubnetWarning:!0}),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Stack ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.stack"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement("input",{type:"text",className:"form-control input-sm no-spel",value:n.stack,onChange:e=>this.stackChanged(e.target.value)}))),a.stack&&/* @__PURE__ */qt.createElement("div",{className:"form-group row slide-in"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-9 col-sm-offset-2 error-message"},/* @__PURE__ */qt.createElement("span",null,a.stack))),/* @__PURE__ */qt.createElement(Ct,{app:e,formik:t}),n.viewState.imageSourceText&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Image Source"),/* @__PURE__ */qt.createElement("div",{className:"col-md-7",style:{marginTop:"5px"}},/* @__PURE__ */qt.createElement(Be,{tag:"span",message:n.viewState.imageSourceText}))),!n.viewState.disableImageSelection&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Image ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.imageName"})),Ao(n.amiName)?/* @__PURE__ */qt.createElement(cn,{name:"amiName"}):/* @__PURE__ */qt.createElement(Po,{onChange:e=>this.imageChanged(e),value:this.state.selectedImage,application:e,credentials:n.credentials,region:n.region})),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Traffic ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.traffic"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-9 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"checkbox",onChange:this.clientRequestsChanged,checked:!n.processIsSuspended(n,"AddToLoadBalancer"),disabled:""!==n.strategy&&"custom"!==n.strategy}),"Send client requests to new instances"))),!n.viewState.disableStrategySelection&&n.selectedProvider&&/* @__PURE__ */qt.createElement(tt,{command:n,onFieldChange:this.onStrategyFieldChange,onStrategyChange:this.strategyChanged}),!n.viewState.hideClusterNamePreview&&/* @__PURE__ */qt.createElement(Nt,{createsNewCluster:r,latestServerGroupName:null==l?void 0:l.name,mode:n.viewState.mode,namePreview:s,navigateToLatestServerGroup:this.navigateToLatestServerGroup}),/* @__PURE__ */qt.createElement(St,{reason:n.reason,onChange:this.handleReasonChanged}))}}const xo=G(Go);class Do extends qt.Component{constructor(){super(...arguments),this.preferSourceCapacityOptions=[{label:"fail the stage",value:!1},{label:"use fallback values",value:!0}],this.useSourceCapacityUpdated=e=>{const t="true"===e.target.value,{command:a}=this.props;this.props.setFieldValue("useSourceCapacity",t),t||(delete a.preferSourceCapacity,this.props.setFieldValue("preferSourceCapacity",void 0)),this.setState({})},this.simpleInstancesChanged=e=>{this.setMinMax(e)},this.preferSourceCapacityChanged=e=>{this.props.setFieldValue("preferSourceCapacity",!(!e||!e.value)||void 0),this.setState({})},this.capacityFieldChanged=(e,t)=>{const{command:a,setFieldValue:n}=this.props;a.capacity={...a.capacity},a.capacity[e]=t,n("capacity",a.capacity)}}setSimpleCapacity(e){const{command:t}=this.props,a={...t.viewState,useSimpleCapacity:e};this.props.setFieldValue("useSourceCapacity",!1),this.props.setFieldValue("viewState",a),this.setMinMax(t.capacity.desired),this.setState({})}setMinMax(e){const{command:t}=this.props;t.viewState.useSimpleCapacity&&(t.capacity={min:e,max:e,desired:e},this.props.setFieldValue("useSourceCapacity",!1),this.props.setFieldValue("capacity",t.capacity)),this.setState({})}render(){const{command:e,MinMaxDesired:t}=this.props,a=e.viewState.readOnlyFields||{};return!e.viewState.useSimpleCapacity||e.useSourceCapacity?/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("p",null,"Sets up auto-scaling constraints for this server group."),/* @__PURE__ */qt.createElement("p",null,"To set min, max, and desired instance counts to the same value use the"," ",/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:()=>this.setSimpleCapacity(!0)},"Simple Mode"),"."))),!a.useSourceCapacity&&"editPipeline"===e.viewState.mode&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Capacity"),/* @__PURE__ */qt.createElement("div",{className:"col-md-9 radio"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",checked:e.useSourceCapacity,value:"true",id:"useSourceCapacityTrue",onChange:this.useSourceCapacityUpdated}),"Copy the capacity from the current server group",/* @__PURE__ */qt.createElement(c,{id:"serverGroupCapacity.useSourceCapacityTrue"}))),e.useSourceCapacity&&/* @__PURE__ */qt.createElement("div",{className:"col-md-9 col-md-offset-3 radio",style:{paddingLeft:"35px"}},/* @__PURE__ */qt.createElement("div",null,"If no current server group is found,",/* @__PURE__ */qt.createElement(an,{clearable:!1,value:!!e.preferSourceCapacity,options:this.preferSourceCapacityOptions,onChange:this.preferSourceCapacityChanged})),e.preferSourceCapacity&&/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("b",null,"Fallback values"),/* @__PURE__ */qt.createElement(t,{command:e,fieldChanged:this.capacityFieldChanged}))),/* @__PURE__ */qt.createElement("div",{className:"col-md-9 col-md-offset-3 radio"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",checked:!e.useSourceCapacity,value:"false",id:"useSourceCapacityFalse",onChange:this.useSourceCapacityUpdated}),"Let me specify the capacity",/* @__PURE__ */qt.createElement(c,{id:"serverGroupCapacity.useSourceCapacityFalse"})))),(!e.useSourceCapacity||"editPipeline"!==e.viewState.mode)&&/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"col-md-9 col-md-offset-3"},/* @__PURE__ */qt.createElement(t,{command:e,fieldChanged:this.capacityFieldChanged})))):/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("p",null,"Sets the min, max, and desired instance counts to the same value."),/* @__PURE__ */qt.createElement("p",null," ","To set capacity for auto-scaling, use the"," ",/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:()=>this.setSimpleCapacity(!1)},"Advanced Mode"),"."))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Number of Instances"),/* @__PURE__ */qt.createElement("div",{className:"col-md-8"},/* @__PURE__ */qt.createElement(Pe,{value:e.capacity.desired,min:0,onChange:this.simpleInstancesChanged}))))}}class Bo extends qt.Component{render(){const{command:{capacity:{min:e,max:t,desired:a}},fieldChanged:n}=this.props;/* @__PURE__ */
|
|
183
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Min"),/* @__PURE__ */qt.createElement("div",{className:"col-md-8"},/* @__PURE__ */qt.createElement(Pe,{value:e,min:0,max:"number"==typeof t?t:void 0,onChange:e=>n("min",e),required:!0}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Max"),/* @__PURE__ */qt.createElement("div",{className:"col-md-8"},/* @__PURE__ */qt.createElement(Pe,{value:t,min:"number"==typeof e?e:void 0,onChange:e=>n("max",e),required:!0}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Desired"),/* @__PURE__ */qt.createElement("div",{className:"col-md-8"},/* @__PURE__ */qt.createElement(Pe,{value:a,min:"number"==typeof e?e:void 0,max:"number"==typeof t?t:void 0,onChange:e=>n("desired",e),required:!0}))))}}class Fo extends qt.Component{validate(e){const t={};(wt(e.capacity.min)<0||wt(e.capacity.max)<0||wt(e.capacity.desired)<0)&&(t.capacity="Capacity min, max, and desired all have to be non-negative values.");const a=e;return void 0!==a.targetHealthyDeployPercentage&&null!==a.targetHealthyDeployPercentage||(t.targetHealthyDeployPercentage="Target Healthy Deploy Percentage required."),t}render(){const{setFieldValue:e,values:t}=this.props.formik;/* @__PURE__ */
|
|
184
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"row"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement(Do,{command:t,setFieldValue:e,MinMaxDesired:Bo}))),/* @__PURE__ */qt.createElement("div",{className:"row"},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("div",{className:"form-group form-inline",style:{marginTop:"20px"}},/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},"Consider deployment successful when"," ",/* @__PURE__ */qt.createElement(cn,{type:"number",name:"targetHealthyDeployPercentage",min:"0",max:"100",className:"form-control input-sm inline-number",required:!0})," ","percent of instances are healthy.")))))}}function Mo(e){/* @__PURE__ */
|
|
185
185
|
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("h4",{style:{marginTop:"10px"}},"This application is"),e.instanceProfileList.map(t=>/* @__PURE__ */qt.createElement("div",{key:t.type,className:"instance-profile-header profile-button"},/* @__PURE__ */qt.createElement("button",{type:"button",onClick:()=>e.handleProfileChange(t.type),className:e.currentProfile===t.type?"instance-profile active":"instance-profile"},e.currentProfile===t.type&&/* @__PURE__ */qt.createElement("span",{className:"far fa-check-circle selected-indicator"}),
|
|
186
|
-
/* @__PURE__ */qt.createElement("div",{className:"panel-heading"},/* @__PURE__ */qt.createElement("h4",null,/* @__PURE__ */qt.createElement("span",{className:`glyphicon glyphicon-${t.icon}`}),/* @__PURE__ */qt.createElement("div",null,t.label)))))))}function
|
|
187
|
-
return qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:"select-option-label"},null==(k=e.instanceType)?void 0:k.name),/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("span",{className:"select-option-label-attributes"},I),P,A,G,x)}const
|
|
188
|
-
return qt.createElement("span",{className:"cost-factor"},a,t?` - ${n}`:"")};function
|
|
189
|
-
/* @__PURE__ */qt.createElement(_,{value:"Remove instance type"},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"})))))))}else{const{cpu:t,memory:l,cpuCreditsPerHour:m,storage:u,costFactor:h}=e.instanceTypeDetails;d=/* @__PURE__ */qt.createElement("tr",{key:s,className:n?"sortable clickable":"non-sortable "+(i?"unavailable":"clickable"),title:n?"Click to unselect instance type":i?"This instance type is not available for the selected configuration":"Click to select instance type",onClick:t=>{$(t.target).is("input")||(n?e.removeInstanceType(s):o(s,r))}},n?/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement(
|
|
186
|
+
/* @__PURE__ */qt.createElement("div",{className:"panel-heading"},/* @__PURE__ */qt.createElement("h4",null,/* @__PURE__ */qt.createElement("span",{className:`glyphicon glyphicon-${t.icon}`}),/* @__PURE__ */qt.createElement("div",null,t.label)))))))}function Ro(e){const{selectedInstanceTypes:t,currentProfile:a}=e,n=cr.awsInstanceTypeService.isBurstingSupportedForAllTypes(t),r=!!cr.awsInstanceTypeService.getInstanceTypesInCategory(t,a).length,[l,s]=Wt(!1);return jt(()=>{t&&t.length&&(n||e.setUnlimitedCpuCredits(void 0),s(n)),a&&s(t&&t.length>0&&n&&r)},[a,t]),/* @__PURE__ */qt.createElement("div",{className:"row",style:{fontSize:"110%"}},l&&/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement(kt,{toggleSize:Tt.XSMALL,propLabel:"Unlimited CPU credits ",propHelpFieldId:"aws.serverGroup.unlimitedCpuCredits",tooltipPropOffBtn:"Toggle to turn OFF unlimited CPU credits",displayTextPropOffBtn:"Off",tooltipPropOnBtn:"Toggle to turn ON unlimited CPU credits",displayTextPropOnBtn:"On",onClick:t=>e.setUnlimitedCpuCredits(t),isPropertyActive:e.unlimitedCpuCredits})))}function Lo(e){var t,a,n,r,l,s,i,o,c,d,m,u,p,h,g,v,f,E,y,b,C,N,S,w,k;const T=(null==(a=null==(t=e.instanceType)?void 0:t.supportedUsageClasses)?void 0:a.includes("spot"))?"| SPOT supported":"",I=`${null==(n=e.instanceType)?void 0:n.defaultVCpus} vCPU | ${null==(r=e.instanceType)?void 0:r.memoryInGiB} Gib Memory ${T}`,P=(null==(l=e.instanceType)?void 0:l.instanceStorageSupported)&&/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("span",{className:"select-option-label-attributes"},`Instance Storage: ${Zt.toUpper(null==(i=null==(s=e.instanceType)?void 0:s.instanceStorageInfo)?void 0:i.storageTypes)} | ${null==(c=null==(o=e.instanceType)?void 0:o.instanceStorageInfo)?void 0:c.totalSizeInGB} Gib total size`)),A=(null==(d=e.instanceType)?void 0:d.ebsInfo)&&/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("span",{className:"select-option-label-attributes"},`EBS: optimization ${null==(u=null==(m=e.instanceType)?void 0:m.ebsInfo)?void 0:u.ebsOptimizedSupport} | NVMe ${null==(h=null==(p=e.instanceType)?void 0:p.ebsInfo)?void 0:h.nvmeSupport} | Encryption ${null==(v=null==(g=e.instanceType)?void 0:g.ebsInfo)?void 0:v.encryptionSupport}`)),G=(null==(f=e.instanceType)?void 0:f.gpuInfo)&&/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("span",{className:"select-option-label-attributes"},`GPU: ${null==(y=null==(E=e.instanceType)?void 0:E.gpuInfo)?void 0:y.totalGpuMemoryInMiB} MiB total memory`,null==(C=null==(b=e.instanceType)?void 0:b.gpuInfo)?void 0:C.gpus.map(e=>` | ${e.count} ${e.manufacturer} ${e.name} GPUs, size: ${e.gpuSizeInMiB} MiB`))),x=void 0!==(null==(N=e.instanceType)?void 0:N.currentGeneration)&&null!==(null==(S=e.instanceType)?void 0:S.currentGeneration)&&/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("span",{className:"select-option-label-attributes"},(null==(w=e.instanceType)?void 0:w.currentGeneration)?"Current Generation":"Previous Generation"));/* @__PURE__ */
|
|
187
|
+
return qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:"select-option-label"},null==(k=e.instanceType)?void 0:k.name),/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("span",{className:"select-option-label-attributes"},I),P,A,G,x)}const zo=({min:e,max:t})=>{const a=/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("span",{className:"cost"},"$".repeat(e)),"$".repeat(4-e)),n=/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("span",{className:"cost"},"$".repeat(Math.min(4,t))),"$".repeat(4-Math.min(4,t)));/* @__PURE__ */
|
|
188
|
+
return qt.createElement("span",{className:"cost-factor"},a,t?` - ${n}`:"")};function Oo(e){var t,a;const n=!!e.selectedType,[r,l]=Wt(""),s=n?e.selectedType.instanceType:e.instanceTypeDetails.name,i=!n&&e.instanceTypeDetails.unavailable,o=(t,a)=>{i||e.addOrUpdateInstanceType(t,a),l("")},c=e=>{l(e.target.value),n?o(s,e.target.value):document.getElementById(`selectInstanceType-${s}`).focus()};let d;if(e.isCustom){const a=/* @__PURE__ */qt.createElement(Lo,{instanceType:e.selectedTypeInfo});d=/* @__PURE__ */qt.createElement("tr",{key:s,className:"sortable clickable"},/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement($o,null)),/* @__PURE__ */qt.createElement("td",null,`${s} `/* @__PURE__ */,qt.createElement(ue,{placement:"right",template:a,className:"custom-profile"},/* @__PURE__ */qt.createElement("span",{className:"clickable help-field"},/* @__PURE__ */qt.createElement("i",{className:"small glyphicon glyphicon-info-sign"})))),/* @__PURE__ */qt.createElement("td",{title:"Enter optional weight (allowed values: 1 to 999)."},/* @__PURE__ */qt.createElement(p,{className:"form-control input input-sm",pattern:"[0-9]*",placeholder:"Enter optional weight (allowed values: 1 to 999).",value:(null==(t=e.selectedType)?void 0:t.weightedCapacity)||"",onChange:e=>o(s,e.target.value)})),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("a",{className:"btn btn-sm btn-link clickable",onClick:()=>e.removeInstanceType(s),style:{padding:"5px"}},
|
|
189
|
+
/* @__PURE__ */qt.createElement(_,{value:"Remove instance type"},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"})))))))}else{const{cpu:t,memory:l,cpuCreditsPerHour:m,storage:u,costFactor:h}=e.instanceTypeDetails;d=/* @__PURE__ */qt.createElement("tr",{key:s,className:n?"sortable clickable":"non-sortable "+(i?"unavailable":"clickable"),title:n?"Click to unselect instance type":i?"This instance type is not available for the selected configuration":"Click to select instance type",onClick:t=>{$(t.target).is("input")||(n?e.removeInstanceType(s):o(s,r))}},n?/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement($o,null)):/* @__PURE__ */qt.createElement("td",null),
|
|
190
190
|
/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement(Ja,{id:`selectInstanceType-${s}`,checked:!!n,disabled:i,onChange:()=>{n?e.removeInstanceType(s):o(s,r)}})),
|
|
191
191
|
/* @__PURE__ */qt.createElement("td",null,s),
|
|
192
192
|
/* @__PURE__ */qt.createElement("td",null,t),
|
|
193
193
|
/* @__PURE__ */qt.createElement("td",null,l),m?/* @__PURE__ */qt.createElement("td",null,m):/* @__PURE__ */qt.createElement("td",{title:"Cpu credits not applicable to instance type."},"-"),"EBS"===u.type&&/* @__PURE__ */qt.createElement("td",null,"EBS Only"),"SSD"===u.type&&/* @__PURE__ */qt.createElement("td",null,u.count+"x"+u.size),
|
|
194
|
-
/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement(
|
|
195
|
-
/* @__PURE__ */qt.createElement("td",{title:i?"":"Enter optional weight (allowed values: 1 to 999)."},/* @__PURE__ */qt.createElement(p,{inputClassName:"form-control input input-sm",id:`weightedCapacity-${s}`,pattern:"[0-9]*",placeholder:"Enter optional weight (allowed values: 1 to 999).",disabled:i,value:(null==(a=e.selectedType)?void 0:a.weightedCapacity)||r||"",onChange:c})))}return d}const
|
|
196
|
-
return qt.createElement(
|
|
197
|
-
return qt.createElement("tbody",null,n,t?null:r)}),
|
|
198
|
-
return qt.createElement("div",{className:"custom-profile"},/* @__PURE__ */qt.createElement(an,{className:"select",clearable:!1,multi:!1,placeholder:"Filter like 16vcpu, 32gib, spot, oldGen or Select an instance type to add",removeSelected:!0,searchable:!0,options:e.availableInstanceTypesList,optionRenderer:e=>/* @__PURE__ */qt.createElement(
|
|
199
|
-
return qt.createElement("div",{className:"row sub-section"},/* @__PURE__ */qt.createElement(
|
|
200
|
-
return qt.createElement("div",{className:"row sub-section"},/* @__PURE__ */qt.createElement(
|
|
201
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"row"},/* @__PURE__ */qt.createElement(Pt,{command:n,onTypeChanged:o,onProfileChanged:t=>{l(t),e.setFieldValue("viewState",{...n.viewState,instanceProfile:t})}}),/* @__PURE__ */qt.createElement(
|
|
194
|
+
/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement(zo,{min:h})),
|
|
195
|
+
/* @__PURE__ */qt.createElement("td",{title:i?"":"Enter optional weight (allowed values: 1 to 999)."},/* @__PURE__ */qt.createElement(p,{inputClassName:"form-control input input-sm",id:`weightedCapacity-${s}`,pattern:"[0-9]*",placeholder:"Enter optional weight (allowed values: 1 to 999).",disabled:i,value:(null==(a=e.selectedType)?void 0:a.weightedCapacity)||r||"",onChange:c})))}return d}const $o=nn(()=>/* @__PURE__ */qt.createElement(_,{value:"Drag to change priority"},/* @__PURE__ */qt.createElement("span",{className:"instance-type-drag-handle glyphicon glyphicon-resize-vertical"})));function Uo(e){/* @__PURE__ */
|
|
196
|
+
return qt.createElement(Vo,{isCustom:e.isCustom,selectedInstanceTypesMap:e.selectedInstanceTypesMap,selectedInstanceTypesInfo:e.selectedInstanceTypesInfo,removeInstanceType:e.removeInstanceType,addOrUpdateInstanceType:e.addOrUpdateInstanceType,instanceTypeDetails:e.isCustom?null:new Map(Object.entries(Ia(Qt(e.profileFamiliesDetails.map(e=>e.instanceTypes)),"name"))),onSortEnd:t=>e.handleSortEnd(t),distance:1})}const Vo=sn(e=>{const{isCustom:t,selectedInstanceTypesMap:a}=e;let n,r;if(t)n=a.size>0&&Array.from(a.values()).sort((e,t)=>e.priority-t.priority).map((t,a)=>/* @__PURE__ */qt.createElement(Ho,{key:`${t.instanceType}-${a}`,index:a,isCustom:!0,selectedType:t,selectedTypeInfo:e.selectedInstanceTypesInfo.find(e=>e.name===t.instanceType),removeInstanceType:e.removeInstanceType,addOrUpdateInstanceType:e.addOrUpdateInstanceType}));else{const{instanceTypeDetails:t}=e,l=Array.from(null==t?void 0:t.keys()),s=ma(l,Array.from(a.keys())),i=Array.from(a.values()).filter(e=>l.includes(e.instanceType)).sort((e,t)=>e.priority-t.priority);n=i&&i.length>0&&i.map((a,n)=>/* @__PURE__ */qt.createElement(Ho,{key:`${a.instanceType}-${n}`,index:n,isCustom:!1,selectedType:a,instanceTypeDetails:t,removeInstanceType:e.removeInstanceType,addOrUpdateInstanceType:e.addOrUpdateInstanceType})),r=s&&s.length>0&&s.map(a=>/* @__PURE__ */qt.createElement(Oo,{key:a,isCustom:!1,instanceTypeDetails:t.get(a),addOrUpdateInstanceType:e.addOrUpdateInstanceType}))}/* @__PURE__ */
|
|
197
|
+
return qt.createElement("tbody",null,n,t?null:r)}),Ho=ln(e=>/* @__PURE__ */qt.createElement(Oo,{key:e.selectedType.instanceType,isCustom:e.isCustom,selectedType:e.selectedType,selectedTypeInfo:e.selectedTypeInfo,instanceTypeDetails:e.isCustom?null:e.instanceTypeDetails.get(e.selectedType.instanceType),removeInstanceType:e.removeInstanceType,addOrUpdateInstanceType:e.addOrUpdateInstanceType}));function qo(e){/* @__PURE__ */
|
|
198
|
+
return qt.createElement("div",{className:"custom-profile"},/* @__PURE__ */qt.createElement(an,{className:"select",clearable:!1,multi:!1,placeholder:"Filter like 16vcpu, 32gib, spot, oldGen or Select an instance type to add",removeSelected:!0,searchable:!0,options:e.availableInstanceTypesList,optionRenderer:e=>/* @__PURE__ */qt.createElement(Lo,{instanceType:e}),filterOption:(e,t)=>{const{name:a,defaultVCpus:n,memoryInGiB:r,instanceStorageInfo:l,ebsInfo:s,gpuInfo:i,supportedUsageClasses:o,currentGeneration:c}=e;return t.split(",").every(e=>{const t=Zt.toLower(e.trim());return t.match(/\d+\s*vcpu/)&&n>=Zt.toNumber(t.split("vcpu")[0].trim())||t.match(/\d+\s*gib/)&&r>=Zt.toNumber(t.split("gib")[0].trim())||t.match(/\b(ssd|hdd)\b/)&&(null==l?void 0:l.storageTypes.includes(t))||"spot"===t&&(null==o?void 0:o.includes(t))||"ebs"===t&&s||"gpu"===t&&i||"currentgen"===t&&c||"oldgen"===t&&!c||a.match(t)})},valueRenderer:e=>/* @__PURE__ */qt.createElement(qt.Fragment,null,e.name),onChange:t=>e.addOrUpdateInstanceType(t.name,void 0)})," ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.instanceTypesSelect"}))}function Wo(e){let t;return t=e.isCustom?/* @__PURE__ */qt.createElement("p",null,"Choose the instance types that best suit the needs of your application."):/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("b",null,e.profileLabel)),/* @__PURE__ */qt.createElement("ul",null,e.profileDescriptionArr.map((e,t)=>/* @__PURE__ */qt.createElement("li",{key:t},e)))),/* @__PURE__ */qt.createElement("div",{className:"row sub-section"},/* @__PURE__ */qt.createElement("h4",null,"Instance Types"),/* @__PURE__ */qt.createElement("div",{className:"description"},t,/* @__PURE__ */qt.createElement("p",null,"Learn about AWS recommended best practices in"," ",/* @__PURE__ */qt.createElement("a",{target:"_blank",href:"https://spinnaker.io/docs/setup/other_config/server-group-launch-settings/aws-ec2/launch-templates/#create-a-server-group-with-aws-recommended-best-practices-for-ec2-spot"},"examples and docs"),"."),/* @__PURE__ */qt.createElement("i",null,/* @__PURE__ */qt.createElement("b",null,"Note:"),/* @__PURE__ */qt.createElement("ul",null,/* @__PURE__ */qt.createElement("li",null,"The order of instance types sets their priority when On-Demand capacity is launched; instance type at the top is prioritized the highest."),/* @__PURE__ */qt.createElement("li",null,"Some instance types might not be available for the selected configuration.")))))}function jo(e){let t,a,n,r;return e.isCustom?(t=/* @__PURE__ */qt.createElement("th",null),a=/* @__PURE__ */qt.createElement("th",null,"Instance Type ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.instanceTypes"})),n=null,r=/* @__PURE__ */qt.createElement("th",null)):(t=/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("th",null),/* @__PURE__ */qt.createElement("th",null)),a=/* @__PURE__ */qt.createElement("th",null,"InstanceType"),n=/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("th",null,"vCPU"),/* @__PURE__ */qt.createElement("th",null,"Mem (GiB)"),e.showCpuCredits&&/* @__PURE__ */qt.createElement("th",null,"CPU Credits"),/* @__PURE__ */qt.createElement("th",null,"Storage (GB)",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.storageType"})),/* @__PURE__ */qt.createElement("th",null,"Cost")),r=null),/* @__PURE__ */qt.createElement("thead",null,/* @__PURE__ */qt.createElement("tr",null,t,a,n,/* @__PURE__ */qt.createElement("th",null,"Weight ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.instanceTypeWeight"})),r))}function Zo(e){return e.isCustom?/* @__PURE__ */qt.createElement("tfoot",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign",style:{paddingTop:"8px"}})),/* @__PURE__ */qt.createElement("td",{colSpan:2},/* @__PURE__ */qt.createElement(qo,{availableInstanceTypesList:e.availableInstanceTypesList,addOrUpdateInstanceType:e.addOrUpdateInstanceType})),/* @__PURE__ */qt.createElement("td",null))):null}function _o(e){return e.dirty.instanceType||e.dirty.launchTemplateOverridesForInstanceType&&e.dirty.launchTemplateOverridesForInstanceType.length>0?/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"}),e.dirty.instanceType&&"The following instance type was found incompatible with the selected image/region and was removed:",e.dirty.launchTemplateOverridesForInstanceType&&e.dirty.launchTemplateOverridesForInstanceType.length>0&&"The following instance type(s) were found incompatible with the selected image/region and were removed:"),/* @__PURE__ */qt.createElement("ul",null,e.dirty.instanceType&&/* @__PURE__ */qt.createElement("li",{key:e.dirty.instanceType},e.dirty.instanceType),e.dirty.launchTemplateOverridesForInstanceType&&e.dirty.launchTemplateOverridesForInstanceType.length>0&&e.dirty.launchTemplateOverridesForInstanceType.map(e=>/* @__PURE__ */qt.createElement("li",{key:e.instanceType},e.instanceType,e.weightedCapacity?" with weight "+e.weightedCapacity:""))),/* @__PURE__ */qt.createElement("p",{className:"text-right"},/* @__PURE__ */qt.createElement("a",{className:"btn btn-sm btn-default dirty-flag-dismiss clickable",onClick:()=>e.clearWarnings()},"Okay")))):null}function Ko(e){var t;const{currentProfile:a,selectedInstanceTypesMap:n}=e,r=e=>{const t=Array.from(n.values()).sort((e,t)=>e.priority-t.priority).map(e=>e.instanceType),a=rn(t,e.oldIndex,e.newIndex);l(a)},l=t=>{n.forEach((e,a)=>{const n=1+t.indexOf(a);e.priority!==n&&(e.priority=n)}),e.handleInstanceTypesChange(Array.from(n.values()))},s=t=>{const a=new Map(n);a.delete(t),e.handleInstanceTypesChange(Array.from(a.values()))},i=(t,a)=>{const r=Number(a),l=isNaN(r)||0===r?void 0:r.toString(),s=n.has(t)?{...n.get(t),weightedCapacity:l}:{instanceType:t,weightedCapacity:l,priority:1+Array.from(n.values()).reduce((e,t)=>t.priority>e?t.priority:e,0)};n.set(t,s),e.handleInstanceTypesChange(Array.from(n.values()))},o=null==(t=Cn.serverGroups)?void 0:t.enableCpuCredits,c=Array.from(n.keys()),d=/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement(Ro,{unlimitedCpuCredits:e.unlimitedCpuCreditsInCmd,currentProfile:a,selectedInstanceTypes:c,setUnlimitedCpuCredits:e.setUnlimitedCpuCredits}));if(a&&"custom"!==a){const{label:t,descriptionListOverride:a,families:l,showCpuCredits:c}=e.profileDetails,m=!1;/* @__PURE__ */
|
|
199
|
+
return qt.createElement("div",{className:"row sub-section"},/* @__PURE__ */qt.createElement(Wo,{isCustom:m,profileLabel:t,profileDescriptionArr:a||l.map(e=>e.description)}),/* @__PURE__ */qt.createElement(_o,{dirty:e.viewState.dirty,clearWarnings:e.clearWarnings}),o&&d,/* @__PURE__ */qt.createElement("table",{className:"table table-hover"},/* @__PURE__ */qt.createElement(jo,{isCustom:m,showCpuCredits:c}),/* @__PURE__ */qt.createElement(Uo,{isCustom:m,profileFamiliesDetails:l,selectedInstanceTypesMap:n,addOrUpdateInstanceType:i,removeInstanceType:s,handleSortEnd:r})))}{const t=!0;/* @__PURE__ */
|
|
200
|
+
return qt.createElement("div",{className:"row sub-section"},/* @__PURE__ */qt.createElement(Wo,{isCustom:t}),/* @__PURE__ */qt.createElement(_o,{dirty:e.viewState.dirty,clearWarnings:e.clearWarnings}),o&&d,/* @__PURE__ */qt.createElement("table",{className:"table table-hover"},/* @__PURE__ */qt.createElement(jo,{isCustom:t}),/* @__PURE__ */qt.createElement(Uo,{isCustom:t,selectedInstanceTypesMap:n,selectedInstanceTypesInfo:e.availableInstanceTypesList.filter(e=>c.includes(e.name)),addOrUpdateInstanceType:i,removeInstanceType:s,handleSortEnd:r}),/* @__PURE__ */qt.createElement(Zo,{isCustom:t,availableInstanceTypesList:e.availableInstanceTypesList.filter(e=>!c.includes(e.name)),addOrUpdateInstanceType:i})))}}function Yo(e,t,a){const n=ca(e.values,t);qt.useEffect(()=>{void 0===n&&void 0!==a&&e.setFieldValue(t,a)},[t,a,n])}function Xo(e){const{values:t,setFieldValue:a}=e.formik,n=[{label:"capacity-optimized (recommended)",value:"capacity-optimized"},{label:"capacity-optimized-prioritized",value:"capacity-optimized-prioritized"},{label:"lowest-price",value:"lowest-price"}];return qt.useEffect(()=>{"lowest-price"!==t.spotAllocationStrategy?a("spotInstancePools",void 0):void 0===t.spotInstancePools&&a("spotInstancePools",2)},[t.spotAllocationStrategy]),Yo(e.formik,"spotAllocationStrategy","capacity-optimized"),Yo(e.formik,"onDemandAllocationStrategy","prioritized"),Yo(e.formik,"onDemandBaseCapacity",0),Yo(e.formik,"onDemandPercentageAboveBaseCapacity",100),/* @__PURE__ */qt.createElement("div",{className:"InstancesDistribution row sub-section form-group"},/* @__PURE__ */qt.createElement("h4",null,"Instances Distribution"),/* @__PURE__ */qt.createElement("div",{className:"description"},"Diversify and distribute instance types across purchase options."," ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.instancesDistribution"})),/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement(u,{label:"Spot Allocation Strategy",name:"spotAllocationStrategy",help:/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.spotAllocationStrategy"}),input:e=>/* @__PURE__ */qt.createElement(g,{...e,mode:"PLAIN",options:n})}),"lowest-price"===e.formik.values.spotAllocationStrategy&&/* @__PURE__ */qt.createElement(u,{label:"Spot Instance Pools Count",name:"spotInstancePools",help:/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.spotInstancePoolCount"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e})}),/* @__PURE__ */qt.createElement(u,{label:"On-Demand Allocation Strategy",name:"onDemandAllocationStrategy",help:/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.odAllocationStrategy"}),input:e=>/* @__PURE__ */qt.createElement(p,{...e,disabled:!0})}),/* @__PURE__ */qt.createElement(u,{label:"On-Demand Base Capacity",name:"onDemandBaseCapacity",help:/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.odBase"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e})}),/* @__PURE__ */qt.createElement(u,{label:"On-Demand Percentage Above Base Capacity",name:"onDemandPercentageAboveBaseCapacity",help:/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.odPercentAboveBase"}),input:e=>/* @__PURE__ */qt.createElement(E,{...e})}),/* @__PURE__ */qt.createElement(u,{label:"Spot Max Price",name:"spotPrice",help:/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.spotMaxPrice"}),input:e=>/* @__PURE__ */qt.createElement(_,{value:"Recommended to leave empty and use AWS default i.e. On-Demand price"},/* @__PURE__ */qt.createElement(p,{...e,placeholder:"Recommended to leave empty and use AWS default i.e. On-Demand price"}))}))}function Jo(e){const{instanceTypeDetails:t,setUnlimitedCpuCredits:a}=e,{values:n,setFieldValue:r}=e.formik,{instanceType:l,launchTemplateOverridesForInstanceType:s}=n;jt(()=>{!s&&l&&e.formik.setFieldValue("launchTemplateOverridesForInstanceType",[{instanceType:n.instanceType,priority:1}])});const i=n.launchTemplateOverridesForInstanceType?n.launchTemplateOverridesForInstanceType:void 0,o=new Map(Object.entries(Ia(i,"instanceType"))),[c,d]=Wt(n.viewState.instanceProfile||"custom"),m=It(c);return t&&t.length>0?/* @__PURE__ */qt.createElement("div",{className:"advanced-mode-selector"},/* @__PURE__ */qt.createElement(Mo,{currentProfile:c,handleProfileChange:e=>{d(e),r("viewState",{...n.viewState,instanceProfile:e});const t=m&&e&&m!==e,a="custom"!==e&&i&&i.length;if(t&&a){const t=cr.awsInstanceTypeService.getInstanceTypesInCategory(i.map(e=>e.instanceType),e),a=i.filter(e=>t.includes(e.instanceType));r("launchTemplateOverridesForInstanceType",a),n.launchTemplateOverridesChanged(n)}},instanceProfileList:t}),/* @__PURE__ */qt.createElement(Xo,{formik:e.formik}),/* @__PURE__ */qt.createElement(Ko,{currentProfile:c,selectedInstanceTypesMap:o,unlimitedCpuCreditsInCmd:n.unlimitedCpuCredits,profileDetails:t.find(e=>e.type===c),availableInstanceTypesList:n.backingData&&n.backingData.filtered&&n.backingData.filtered.instanceTypesInfo||[],handleInstanceTypesChange:e=>{r("launchTemplateOverridesForInstanceType",e),n.launchTemplateOverridesChanged(n)},setUnlimitedCpuCredits:a,viewState:n.viewState,clearWarnings:e.clearWarnings})):null}function Qo(e){var t,a;const{command:n}=e,[r,l]=qt.useState(n.viewState.instanceProfile),s=null==(t=Cn.serverGroups)?void 0:t.enableLaunchTemplates,i=null==(a=Cn.serverGroups)?void 0:a.enableCpuCredits;qt.useEffect(()=>{l(n.viewState.instanceProfile)},[n.viewState.instanceProfile]);const o=t=>{n.instanceType=t,n.instanceTypeChanged(n),e.setFieldValue("instanceType",t)},c={...n,viewState:{...n.viewState,instanceProfile:r}};/* @__PURE__ */
|
|
201
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"row"},/* @__PURE__ */qt.createElement(Pt,{command:n,onTypeChanged:o,onProfileChanged:t=>{l(t),e.setFieldValue("viewState",{...n.viewState,instanceProfile:t})}}),/* @__PURE__ */qt.createElement(_o,{dirty:n.viewState.dirty,clearWarnings:e.clearWarnings}),/* @__PURE__ */qt.createElement("div",{style:{padding:"0 15px"}},r&&"custom"!==r&&/* @__PURE__ */qt.createElement(At,{command:c,onTypeChanged:o}))),s&&i&&/* @__PURE__ */qt.createElement("div",{className:"row"},/* @__PURE__ */qt.createElement(Ro,{unlimitedCpuCredits:n.unlimitedCpuCredits,selectedInstanceTypes:[n.instanceType],currentProfile:r,setUnlimitedCpuCredits:e.setUnlimitedCpuCredits})))}function ec(e){var t;const{instanceTypeDetails:a}=e,{values:n,setFieldValue:r}=e.formik,l=null==(t=Cn.serverGroups)?void 0:t.enableLaunchTemplates,s=n.viewState.useSimpleInstanceTypeSelector,[i,o]=Wt(n.unlimitedCpuCredits);jt(()=>{n.unlimitedCpuCredits!==i&&r("unlimitedCpuCredits",i)},[i]);const d=()=>{const{formik:t}=e;t.values.viewState.dirty.instanceType=null,t.values.viewState.dirty.launchTemplateOverridesForInstanceType=null,t.validateForm()},m=e=>{if(s!==e)if(r("viewState",{...n.viewState,useSimpleInstanceTypeSelector:e}),e){const e=n.launchTemplateOverridesForInstanceType,t=n.viewState.dirty.launchTemplateOverridesForInstanceType;if(null==e?void 0:e.length){const t=e.reduce((e,t)=>e.priority<t.priority?e:t).instanceType;r("instanceType",t),r("launchTemplateOverridesForInstanceType",[]),n.instanceTypeChanged(n)}if(null==t?void 0:t.length){const e=t.reduce((e,t)=>e.priority<t.priority?e:t).instanceType;r("viewState.dirty.instanceType",e),r("viewState.dirty.launchTemplateOverridesForInstanceType",[])}}else if(!e){const e=n.instanceType,t=n.viewState.dirty.instanceType;if(e){const t=[{instanceType:e,priority:1}];r("instanceType",void 0),r("launchTemplateOverridesForInstanceType",t),n.launchTemplateOverridesChanged(n)}if(t){const e=[{instanceType:t,priority:1}];r("viewState.dirty.instanceType",void 0),r("viewState.dirty.launchTemplateOverridesForInstanceType",e)}}};return l&&!s?/* @__PURE__ */qt.createElement("div",{className:"container-fluid form-horizontal",style:{padding:"0 15px"}},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null,"Switch to",/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:()=>m(!0)},/* @__PURE__ */qt.createElement("span",null," Simple Mode")),"."),/* @__PURE__ */qt.createElement("i",null,/* @__PURE__ */qt.createElement("b",null,"Note:")," If multiple instance types are already selected in advanced mode, the instance type with highest priority will be preserved in simple mode.")),/* @__PURE__ */qt.createElement(Jo,{formik:e.formik,instanceTypeDetails:a,setUnlimitedCpuCredits:o,clearWarnings:d})):/* @__PURE__ */qt.createElement("div",{className:"container-fluid form-horizontal",style:{padding:"0 15px"}},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("span",null,"To configure mixed server groups and/or multiple instance types,"),!l&&/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("a",{href:"https://spinnaker.io/docs/setup/other_config/server-group-launch-settings/aws-ec2/launch-templates-setup/"},
|
|
202
202
|
/* @__PURE__ */qt.createElement("span",null," enable launch templates")),/* @__PURE__ */qt.createElement("span",null," and")),/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("a",{className:l?"clickable":"disabled",onClick:l?()=>m(!1):()=>{}},
|
|
203
|
-
/* @__PURE__ */qt.createElement("span",null," use Advanced Mode ")),/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.advancedMode"}),"."),/* @__PURE__ */qt.createElement("p",null),l&&/* @__PURE__ */qt.createElement("i",null,/* @__PURE__ */qt.createElement("b",null,"Note:")," If an instance type is already selected in simple mode, it will be preserved in advanced mode.")),/* @__PURE__ */qt.createElement(
|
|
204
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement(
|
|
205
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal"},o,d)}};
|
|
206
|
-
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("div",{className:"form-group"},!n&&/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,j.get("Firewalls")),a&&/* @__PURE__ */qt.createElement(c,{key:a})),/* @__PURE__ */qt.createElement("div",{className:"col-md-8"},/* @__PURE__ */qt.createElement(dn,{ignoreAccents:!0,options:s,onChange:this.onChange,value:t,multi:!0}))),/* @__PURE__ */qt.createElement("div",{className:"form-group small",style:{marginTop:"20px"}},/* @__PURE__ */qt.createElement("div",{className:`col-md-${n?12:9} col-md-offset-${n?0:3}`},/* @__PURE__ */qt.createElement("p",null,r&&/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:"fa fa-sync-alt fa-spin"})),j.get("Firewalls"),!r&&/* @__PURE__ */qt.createElement("span",null," last refreshed ",V(l)),r&&/* @__PURE__ */qt.createElement("span",null," refreshing...")),/* @__PURE__ */qt.createElement("p",null,"If you're not finding a ",j.get("firewall")," that was recently added,"," ",/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.refreshSecurityGroups},"click here")," ","to refresh the list."))))}};
|
|
207
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement(
|
|
208
|
-
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Cooldown")),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement(cn,{type:"text",required:!0,name:"cooldown","aria-label":"Cooldown",className:"form-control input-sm no-spel"}))," ","seconds"),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Enabled Metrics "),/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.enabledMetrics"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(an,{multi:!0,value:a.enabledMetrics,options:a.backingData.enabledMetrics.map(e=>({label:e,value:e})),onChange:e=>t("enabledMetrics",e.map(e=>e.value))}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Health Check Type")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(an,{value:a.healthCheckType,clearable:!1,placeholder:"Select...",options:a.backingData.healthCheckTypes.map(e=>({label:e,value:e})),onChange:e=>t("healthCheckType",e.value)}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Health Check Grace Period")),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement(cn,{type:"text",required:!0,className:"form-control input-sm no-spel",name:"healthCheckGracePeriod"}))," ","seconds"),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Termination Policies")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(an,{multi:!0,value:a.terminationPolicies,options:a.backingData.terminationPolicies.map(e=>({label:e,value:e})),onChange:e=>t("terminationPolicies",e.map(e=>e.value))}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Key Name")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(an,{value:a.keyPair,required:!0,clearable:!1,options:r.map(e=>({label:e,value:e})),onChange:e=>t("keyPair",e.value)}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Ramdisk Id (optional)")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(cn,{type:"text",name:"ramdiskId",className:"form-control input-sm no-spel"}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"IAM Instance Profile (optional)")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(cn,{type:"text",className:"form-control input-sm no-spel",name:"iamRole"}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"UserData (optional) "),/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.base64UserData"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(cn,{type:"text",className:"form-control input-sm no-spel",name:"base64UserData"}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Instance Monitoring "),/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.instanceMonitoring"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:a.instanceMonitoring,onChange:e=>t("instanceMonitoring",e.target.checked)})," ","Enforce Instance Monitoring"," "))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"EBS Optimized")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:a.ebsOptimized,onChange:e=>t("ebsOptimized",e.target.checked)})," ","Optimize Instances for EBS"))),(null==l?void 0:l.enableIMDSv2)&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"IMDSv2 "),/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.imdsv2"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:!0===a.requireIMDSv2,onChange:e=>t("requireIMDSv2",e.target.checked)})," ","Require IMDSv2"," "))),!Cn.disableSpotPricing&&a.viewState.useSimpleInstanceTypeSelector&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Spot Instances Price (optional)")," ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.spotMaxPrice"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement(cn,{type:"text",className:"form-control input-sm",name:"spotPrice"}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"AMI Block Device Mappings")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7 radio"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",onChange:()=>this.selectBlockDeviceMappingsSource("source"),checked:"source"===n,name:"blockDeviceMappingsSource"}),"Copy from current server group ",/* @__PURE__ */qt.createElement(c,{id:"aws.blockDeviceMappings.useSource"}))),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",onChange:()=>this.selectBlockDeviceMappingsSource("ami"),checked:"ami"===n,name:"blockDeviceMappingsSource"}),"Prefer AMI block device mappings ",/* @__PURE__ */qt.createElement(c,{id:"aws.blockDeviceMappings.useAMI"}))),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",onChange:()=>this.selectBlockDeviceMappingsSource("default"),checked:"default"===n,name:"blockDeviceMappingsSource"}),"Defaults for selected instance type ",/* @__PURE__ */qt.createElement(c,{id:"aws.blockDeviceMappings.useDefaults"}))))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,`Associate ${(null==l?void 0:l.enableIPv6)?"IPv6 (Recommended)":"Public IPv4"} Address`),/* @__PURE__ */qt.createElement(c,{id:"serverGroup.ipv6"})),(null==l?void 0:l.enableIPv6)&&/* @__PURE__ */qt.createElement("div",{className:"col-md-7 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:!0===a.associateIPv6Address,onChange:e=>t("associateIPv6Address",e.target.checked),id:"associateIPv6AddressToggle"})," ","Assign an IPv6 address to instances"," ")),!(null==l?void 0:l.enableIPv6)&&/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"col-md-2 radio"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",checked:!0===a.associatePublicIpAddress,onChange:()=>t("associatePublicIpAddress",!0),id:"associatePublicIpAddressTrue"}),"Yes")),/* @__PURE__ */qt.createElement("div",{className:"col-md-2 radio"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",checked:!1===a.associatePublicIpAddress,onChange:()=>t("associatePublicIpAddress",!1),id:"associatePublicIpAddressFalse"}),"No")),/* @__PURE__ */qt.createElement("div",{className:"col-md-2 radio"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",checked:null===a.associatePublicIpAddress,onChange:()=>t("associatePublicIpAddress",null),id:"associatePublicIpAddressDefault"}),"Default")))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Scaling Processes")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7 checkbox"},a.backingData.scalingProcesses.map(e=>/* @__PURE__ */qt.createElement("div",{key:e.name},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"checkbox",onChange:()=>this.toggleSuspendedProcess(e.name),checked:!a.suspendedProcesses.includes(e.name)})," ",e.name," ",/* @__PURE__ */qt.createElement(c,{content:e.description})))))),e.attributes.platformHealthOnlyShowOverride&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Task Completion")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:a.interestingHealthProviderNames,platformHealthType:"Amazon",onChange:this.platformHealthOverrideChanged}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Tags (optional)"),/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.tags"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(lt,{model:a.tags,allowEmpty:!0,onChange:this.tagsChanged}))))}}var ic=Object.getOwnPropertyDescriptor;let oc=class extends qt.Component{constructor(){super(...arguments),this.validators=/* @__PURE__ */new Map,this.validate=e=>{const t={};return this.validators.forEach(a=>{const n=a(e);Object.assign(t,{...n})}),t},this.handleRef=e=>{e?this.validators.set("common",e.validate):this.validators.delete("common")}}render(){const{formik:e,app:t}=this.props;/* @__PURE__ */
|
|
209
|
-
return qt.createElement(
|
|
210
|
-
return qt.createElement(
|
|
211
|
-
return qt.createElement(Qa,null,/* @__PURE__ */qt.createElement("form",{onSubmit:()=>(this.props.onSubmit(),!1)},l&&/* @__PURE__ */qt.createElement(Gt,{expectedValue:e,onValidChange:this.handleVerification})),/* @__PURE__ */qt.createElement("button",{className:"btn btn-default",onClick:t},"Cancel"),/* @__PURE__ */qt.createElement("button",{type:"submit",className:"btn btn-primary",onClick:a,disabled:!n||l&&!r},"Submit"))}};
|
|
203
|
+
/* @__PURE__ */qt.createElement("span",null," use Advanced Mode ")),/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.advancedMode"}),"."),/* @__PURE__ */qt.createElement("p",null),l&&/* @__PURE__ */qt.createElement("i",null,/* @__PURE__ */qt.createElement("b",null,"Note:")," If an instance type is already selected in simple mode, it will be preserved in advanced mode.")),/* @__PURE__ */qt.createElement(Qo,{command:n,setUnlimitedCpuCredits:o,setFieldValue:r,clearWarnings:d}))}class tc extends qt.Component{constructor(){super(...arguments),this.state={instanceTypeDetails:[]},this.props$=new Aa,this.destroy$=new Aa}validate(e){const t={};if(e.viewState.useSimpleInstanceTypeSelector)e.viewState.dirty.instanceType?t.instanceType="You must confirm removed instance type and pick a compatible instance type.":e.instanceType||(t.instanceType="Instance Type required.");else{const a=e.viewState.dirty.launchTemplateOverridesForInstanceType;if(a&&a.length>0)t.instanceType="You must confirm removed instance types and/or pick more instance types.";else{const a=this.validateAdvancedModeFields(e,t);Object.assign(t,{...a})}}return t}validateAdvancedModeFields(e,t){e.launchTemplateOverridesForInstanceType.length||(t.instanceType="At least one instance type required."),e.launchTemplateOverridesForInstanceType.length>40&&(t.instanceType="Maximum of 40 instance types are allowed.");const a=e.launchTemplateOverridesForInstanceType.filter(e=>void 0!==e.weightedCapacity);if(a.length!==e.launchTemplateOverridesForInstanceType.length&&0!==a.length&&(t.instanceType="Weighted capacity must be specified for all instance types selected or none."),ua(a,function(e){const t=Number(e.weightedCapacity);return t<1||t>999})&&(t.instanceType="Weighted capacity must be a number between 1 and 999."),e.onDemandBaseCapacity<0&&(t.onDemandBaseCapacity="On-Demand base capacity must be non-negative."),e.onDemandBaseCapacity>wt(e.capacity.max)&&(t.onDemandBaseCapacity="On-Demand base capacity must be less than or equal to max capacity."),(e.onDemandPercentageAboveBaseCapacity<0||e.onDemandPercentageAboveBaseCapacity>100)&&(t.onDemandPercentageAboveBaseCapacity="On-Demand percentage above base capacity must be a number between 0 and 100."),e.spotPrice){const a=Number(e.spotPrice);Number.isNaN(a)&&(t.spotPrice="Spot Max Price must be a number or empty string, used to unset previous max price."),a<=0&&(t.spotPrice="Spot Max Price must be greater than 0, if specified.")}return e.spotInstancePools&&"lowest-price"!==e.spotAllocationStrategy&&(t.spotInstancePools="Spot Instance Pools is only supported for 'lowest-price' Spot Allocation Strategy."),(e.spotInstancePools<=0||e.spotInstancePools>20)&&(t.spotInstancePools="Spot Instance Pools count must be a number between 1 and 20, when applicable."),t}componentDidMount(){Promise.resolve(cr.awsInstanceTypeService.getCategories()).then(e=>{this.setState({instanceTypeDetails:e})})}componentDidUpdate(){this.props$.next(this.props)}componentWillUnmount(){this.destroy$.next()}render(){var e,t,a;const{values:n}=this.props.formik,r=!(!n.viewState.disableImageSelection&&!n.amiName),l=null!=(a=null==(t=null==(e=n.backingData)?void 0:e.filtered)?void 0:t.instanceTypes)?a:[],s=Array.from(this.state.instanceTypeDetails);return!n.viewState.disableImageSelection&&l.length&&s.forEach(e=>{e.families.forEach(e=>{e.instanceTypes.forEach(e=>{e.unavailable=!l.includes(e.name)})})}),r&&n?/* @__PURE__ */qt.createElement(ec,{formik:this.props.formik,instanceTypeDetails:s}):/* @__PURE__ */qt.createElement("h5",{className:"text-center"},"Please select an image.")}}class ac extends qt.Component{constructor(){super(...arguments),this.handleAvailabilityZonesChanged=e=>{const{values:t,setFieldValue:a}=this.props.formik;t.usePreferredZonesChanged(t),a("availabilityZones",e)},this.rebalanceToggled=()=>{const{values:e,setFieldValue:t}=this.props.formik;e.toggleSuspendedProcess(e,"AZRebalance"),t("suspendedProcesses",e.suspendedProcesses),this.setState({})}}validate(e){const t={};return e.availabilityZones&&0!==e.availabilityZones.length||(t.availabilityZones="You must select at least one availability zone."),t}render(){const{values:e}=this.props.formik;/* @__PURE__ */
|
|
204
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement(ll,{credentials:e.credentials,region:e.region,onChange:this.handleAvailabilityZonesChanged,selectedZones:e.availabilityZones,allZones:e.backingData.filtered.availabilityZones,usePreferredZones:e.viewState.usePreferredZones}),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"AZ Rebalance")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"checkbox",onChange:this.rebalanceToggled,checked:!e.processIsSuspended(e,"AZRebalance")}),"Keep instances evenly distributed across zones"))))}}const nc=e=>({value:e,label:e}),rc=class extends qt.Component{constructor(){super(...arguments),this.state={refreshing:!1,refreshed:!1,showVpcLoadBalancers:!1},this.refreshLoadBalancers=()=>{const{values:e}=this.props.formik;this.setState({refreshing:!0});this.context.services.providerServiceDelegate.getDelegate(e.cloudProvider||e.selectedProvider,"serverGroup.configurationService").refreshLoadBalancers(e).then(()=>{this.setState({refreshing:!1,refreshed:!0})})},this.targetGroupsChanged=e=>{const t=e.map(e=>e.value);this.props.formik.setFieldValue("targetGroups",t)},this.loadBalancersChanged=e=>{const t=e.map(e=>e.value);this.props.formik.setFieldValue("loadBalancers",t)},this.vpcLoadBalancersChanged=e=>{const t=e.map(e=>e.value);this.props.formik.setFieldValue("vpcLoadBalancers",t)}}validate(e){const t={};return e.viewState.dirty.targetGroups&&(t.targetGroups="You must confirm the removed target groups."),e.viewState.dirty.loadBalancers&&(t.loadBalancers="You must confirm the removed load balancers."),t}clearWarnings(e){this.props.formik.values.viewState.dirty[e]=null,this.props.formik.validateForm()}render(){var e;const{hideLoadBalancers:t,hideTargetGroups:a}=this.props,{values:n}=this.props.formik,{dirty:r}=n.viewState,{refreshed:l,refreshing:s,showVpcLoadBalancers:i}=this.state;let o=null;if(!a){const t=(n.backingData.filtered.targetGroups||[]).concat(n.viewState.spelTargetGroups||[]).map(nc);o=/* @__PURE__ */qt.createElement(qt.Fragment,null,r.targetGroups&&/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"}),"The following target groups could not be found in the selected account/region/VPC and were removed:"),/* @__PURE__ */qt.createElement("ul",null,r.targetGroups.map(e=>/* @__PURE__ */qt.createElement("li",{key:e},e))),/* @__PURE__ */qt.createElement("p",{className:"text-right"},/* @__PURE__ */qt.createElement("a",{className:"btn btn-sm btn-default dirty-flag-dismiss clickable",onClick:()=>this.clearWarnings("targetGroups")},"Okay")))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-4 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Target Groups "),/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.targetGroups"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},0===t.length&&/* @__PURE__ */qt.createElement("div",{className:"form-control-static"},"No ",/* @__PURE__ */qt.createElement("b",null,null!=(e=this.props.targetGroupTypeHelpText)?e:"instance")," target groups found in the selected account/region/VPC"),t.length>0&&/* @__PURE__ */qt.createElement(S,{multi:!0,options:t,value:n.targetGroups,onChange:this.targetGroupsChanged}))))}let d=null;if(!t){const e=(n.backingData.filtered.loadBalancers||[]).concat(n.viewState.spelLoadBalancers||[]).map(nc),t=(n.backingData.filtered.vpcLoadBalancers||[]).map(nc),a=n.vpcLoadBalancers&&n.vpcLoadBalancers.length>0;d=/* @__PURE__ */qt.createElement(qt.Fragment,null,r.loadBalancers&&/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"}),"The following load balancers could not be found in the selected account/region/VPC and were removed:"),/* @__PURE__ */qt.createElement("ul",null,r.loadBalancers.map(e=>/* @__PURE__ */qt.createElement("li",{key:e},e))),/* @__PURE__ */qt.createElement("p",{className:"text-right"},/* @__PURE__ */qt.createElement("a",{className:"btn btn-sm btn-default dirty-flag-dismiss clickable",onClick:()=>this.clearWarnings("loadBalancers")},"Okay")))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-4 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Classic Load Balancers "),/* @__PURE__ */qt.createElement(c,{id:"aws.loadBalancer.loadBalancers"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},0===e.length&&/* @__PURE__ */qt.createElement("div",{className:"form-control-static"},"No load balancers found in the selected account/region/VPC"),e.length>0&&/* @__PURE__ */qt.createElement(S,{multi:!0,options:e,value:n.loadBalancers,onChange:this.loadBalancersChanged}))),!n.vpcId&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},!a&&!i&&/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"col-md-8 col-md-offset-3"},/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:()=>this.setState({showVpcLoadBalancers:!0})},"Add VPC Load Balancers"))),a&&/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"col-md-4 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"VPC Load Balancers")),/* @__PURE__ */qt.createElement("div",{className:"col-md-8"},t.length>0&&/* @__PURE__ */qt.createElement(S,{multi:!0,options:t,value:n.vpcLoadBalancers,onChange:this.vpcLoadBalancersChanged})))),!l&&/* @__PURE__ */qt.createElement("div",{className:"form-group small",style:{marginTop:"20px"}},/* @__PURE__ */qt.createElement("div",{className:"col-md-8 col-md-offset-4"},s&&/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("span",{className:"fa fa-sync-alt fa-spin"}),/* @__PURE__ */qt.createElement("span",null," refreshing...")),!s&&/* @__PURE__ */qt.createElement("p",null,"If you are looking for a load balancer or target group from a different application, ",/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.refreshLoadBalancers},"click here")," ","to load all load balancers."))))}/* @__PURE__ */
|
|
205
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal"},o,d)}};rc.contextType=C;let lc=rc;const sc=class extends qt.Component{constructor(e){super(e),this.getRefreshTime=()=>{var e;return(null==(e=Re.get("securityGroups"))?void 0:e.getStats().ageMax)||0},this.refreshSecurityGroups=()=>{this.setState({refreshing:!0}),this.props.refresh?this.props.refresh().then(()=>this.setState({refreshing:!1})):this.context.services.providerServiceDelegate.getDelegate(this.props.command.selectedProvider,"serverGroup.configurationService").refreshSecurityGroups(this.props.command).then(()=>{this.setState({refreshing:!1,refreshTime:this.getRefreshTime()})})},this.onChange=e=>{const t=e.map(e=>e.value);this.props.onChange(t)},this.state={refreshing:!1,refreshTime:this.getRefreshTime()}}render(){const{availableGroups:e,groupsToEdit:t,helpKey:a,hideLabel:n}=this.props,{refreshing:r,refreshTime:l}=this.state,s=e.map(e=>({label:`${e.name} (${e.id})`,value:e.id}));/* @__PURE__ */
|
|
206
|
+
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("div",{className:"form-group"},!n&&/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,j.get("Firewalls")),a&&/* @__PURE__ */qt.createElement(c,{key:a})),/* @__PURE__ */qt.createElement("div",{className:"col-md-8"},/* @__PURE__ */qt.createElement(dn,{ignoreAccents:!0,options:s,onChange:this.onChange,value:t,multi:!0}))),/* @__PURE__ */qt.createElement("div",{className:"form-group small",style:{marginTop:"20px"}},/* @__PURE__ */qt.createElement("div",{className:`col-md-${n?12:9} col-md-offset-${n?0:3}`},/* @__PURE__ */qt.createElement("p",null,r&&/* @__PURE__ */qt.createElement("span",null,/* @__PURE__ */qt.createElement("span",{className:"fa fa-sync-alt fa-spin"})),j.get("Firewalls"),!r&&/* @__PURE__ */qt.createElement("span",null," last refreshed ",V(l)),r&&/* @__PURE__ */qt.createElement("span",null," refreshing...")),/* @__PURE__ */qt.createElement("p",null,"If you're not finding a ",j.get("firewall")," that was recently added,"," ",/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.refreshSecurityGroups},"click here")," ","to refresh the list."))))}};sc.contextType=C;let ic=sc;const oc=class extends qt.Component{render(){const{command:e,onClear:t,removed:a}=this.props,n=(e&&e.viewState.dirty.securityGroups||[]).concat(a||[]);return 0===n.length?null:/* @__PURE__ */qt.createElement("div",{className:"col-md-12"},/* @__PURE__ */qt.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("i",{className:"fa fa-exclamation-triangle"}),"The following ",j.get("firewalls")," could not be found in the selected account/region/VPC and were removed:"),/* @__PURE__ */qt.createElement("ul",null,n.map(e=>/* @__PURE__ */qt.createElement("li",{key:e},e))),/* @__PURE__ */qt.createElement("p",{className:"text-right"},/* @__PURE__ */qt.createElement("a",{className:"btn btn-sm btn-default dirty-flag-dismiss clickable",onClick:t},"Okay"))))}};oc.defaultProps={onClear:T};let cc=oc;class dc extends qt.Component{constructor(){super(...arguments),this.onChange=e=>{this.props.formik.setFieldValue("securityGroups",e)},this.acknowledgeRemovedGroups=()=>{const{viewState:e}=this.props.formik.values;e.dirty.securityGroups=null,this.props.formik.setFieldValue("viewState",e)}}validate(e){const t={};return e.viewState.dirty.securityGroups&&(t.securityGroups="You must acknowledge removed security groups."),t}render(){const{values:e}=this.props.formik;/* @__PURE__ */
|
|
207
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement(cc,{command:e,onClear:this.acknowledgeRemovedGroups}),/* @__PURE__ */qt.createElement(ic,{command:e,availableGroups:e.backingData.filtered.securityGroups,groupsToEdit:e.securityGroups,onChange:this.onChange}))}}class mc extends qt.Component{constructor(){super(...arguments),this.duplicateKeys=!1,this.validate=e=>{const t={};return e.keyPair||(t.keyPair="Key Name is required"),this.duplicateKeys&&(t.tags="Tags have duplicate keys."),t},this.selectBlockDeviceMappingsSource=e=>{const{values:t}=this.props.formik;t.selectBlockDeviceMappingsSource(t,e),this.setState({})},this.toggleSuspendedProcess=e=>{const{values:t,setFieldValue:a}=this.props.formik;t.toggleSuspendedProcess(t,e),a("suspendedProcesses",t.suspendedProcesses),this.setState({})},this.platformHealthOverrideChanged=e=>{this.props.formik.setFieldValue("interestingHealthProviderNames",e)},this.tagsChanged=(e,t)=>{this.duplicateKeys=t,this.props.formik.setFieldValue("tags",e)}}render(){const{app:e}=this.props,{setFieldValue:t,values:a}=this.props.formik,n=a.getBlockDeviceMappingsSource(a),r=a.backingData.filtered.keyPairs||[],l=Cn.serverGroups;/* @__PURE__ */
|
|
208
|
+
return qt.createElement("div",{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Cooldown")),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement(cn,{type:"text",required:!0,name:"cooldown","aria-label":"Cooldown",className:"form-control input-sm no-spel"}))," ","seconds"),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Enabled Metrics "),/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.enabledMetrics"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(an,{multi:!0,value:a.enabledMetrics,options:a.backingData.enabledMetrics.map(e=>({label:e,value:e})),onChange:e=>t("enabledMetrics",e.map(e=>e.value))}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Health Check Type")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(an,{value:a.healthCheckType,clearable:!1,placeholder:"Select...",options:a.backingData.healthCheckTypes.map(e=>({label:e,value:e})),onChange:e=>t("healthCheckType",e.value)}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Health Check Grace Period")),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement(cn,{type:"text",required:!0,className:"form-control input-sm no-spel",name:"healthCheckGracePeriod"}))," ","seconds"),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Termination Policies")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(an,{multi:!0,value:a.terminationPolicies,options:a.backingData.terminationPolicies.map(e=>({label:e,value:e})),onChange:e=>t("terminationPolicies",e.map(e=>e.value))}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Key Name")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(an,{value:a.keyPair,required:!0,clearable:!1,options:r.map(e=>({label:e,value:e})),onChange:e=>t("keyPair",e.value)}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Ramdisk Id (optional)")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(cn,{type:"text",name:"ramdiskId",className:"form-control input-sm no-spel"}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"IAM Instance Profile (optional)")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(cn,{type:"text",className:"form-control input-sm no-spel",name:"iamRole"}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"UserData (optional) "),/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.base64UserData"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(cn,{type:"text",className:"form-control input-sm no-spel",name:"base64UserData"}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Instance Monitoring "),/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.instanceMonitoring"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:a.instanceMonitoring,onChange:e=>t("instanceMonitoring",e.target.checked)})," ","Enforce Instance Monitoring"," "))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"EBS Optimized")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:a.ebsOptimized,onChange:e=>t("ebsOptimized",e.target.checked)})," ","Optimize Instances for EBS"))),(null==l?void 0:l.enableIMDSv2)&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"IMDSv2 "),/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.imdsv2"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:!0===a.requireIMDSv2,onChange:e=>t("requireIMDSv2",e.target.checked)})," ","Require IMDSv2"," "))),!Cn.disableSpotPricing&&a.viewState.useSimpleInstanceTypeSelector&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Spot Instances Price (optional)")," ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.spotMaxPrice"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement(cn,{type:"text",className:"form-control input-sm",name:"spotPrice"}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"AMI Block Device Mappings")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7 radio"},/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",onChange:()=>this.selectBlockDeviceMappingsSource("source"),checked:"source"===n,name:"blockDeviceMappingsSource"}),"Copy from current server group ",/* @__PURE__ */qt.createElement(c,{id:"aws.blockDeviceMappings.useSource"}))),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",onChange:()=>this.selectBlockDeviceMappingsSource("ami"),checked:"ami"===n,name:"blockDeviceMappingsSource"}),"Prefer AMI block device mappings ",/* @__PURE__ */qt.createElement(c,{id:"aws.blockDeviceMappings.useAMI"}))),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",onChange:()=>this.selectBlockDeviceMappingsSource("default"),checked:"default"===n,name:"blockDeviceMappingsSource"}),"Defaults for selected instance type ",/* @__PURE__ */qt.createElement(c,{id:"aws.blockDeviceMappings.useDefaults"}))))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,`Associate ${(null==l?void 0:l.enableIPv6)?"IPv6 (Recommended)":"Public IPv4"} Address`),/* @__PURE__ */qt.createElement(c,{id:"serverGroup.ipv6"})),(null==l?void 0:l.enableIPv6)&&/* @__PURE__ */qt.createElement("div",{className:"col-md-7 checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"checkbox",checked:!0===a.associateIPv6Address,onChange:e=>t("associateIPv6Address",e.target.checked),id:"associateIPv6AddressToggle"})," ","Assign an IPv6 address to instances"," ")),!(null==l?void 0:l.enableIPv6)&&/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement("div",{className:"col-md-2 radio"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",checked:!0===a.associatePublicIpAddress,onChange:()=>t("associatePublicIpAddress",!0),id:"associatePublicIpAddressTrue"}),"Yes")),/* @__PURE__ */qt.createElement("div",{className:"col-md-2 radio"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",checked:!1===a.associatePublicIpAddress,onChange:()=>t("associatePublicIpAddress",!1),id:"associatePublicIpAddressFalse"}),"No")),/* @__PURE__ */qt.createElement("div",{className:"col-md-2 radio"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"radio",checked:null===a.associatePublicIpAddress,onChange:()=>t("associatePublicIpAddress",null),id:"associatePublicIpAddressDefault"}),"Default")))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Scaling Processes")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7 checkbox"},a.backingData.scalingProcesses.map(e=>/* @__PURE__ */qt.createElement("div",{key:e.name},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{type:"checkbox",onChange:()=>this.toggleSuspendedProcess(e.name),checked:!a.suspendedProcesses.includes(e.name)})," ",e.name," ",/* @__PURE__ */qt.createElement(c,{content:e.description})))))),e.attributes.platformHealthOnlyShowOverride&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Task Completion")),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:a.interestingHealthProviderNames,platformHealthType:"Amazon",onChange:this.platformHealthOverrideChanged}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},/* @__PURE__ */qt.createElement("b",null,"Tags (optional)"),/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.tags"})),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},/* @__PURE__ */qt.createElement(lt,{model:a.tags,allowEmpty:!0,onChange:this.tagsChanged}))))}}var uc=Object.getOwnPropertyDescriptor;let pc=class extends qt.Component{constructor(){super(...arguments),this.validators=/* @__PURE__ */new Map,this.validate=e=>{const t={};return this.validators.forEach(a=>{const n=a(e);Object.assign(t,{...n})}),t},this.handleRef=e=>{e?this.validators.set("common",e.validate):this.validators.delete("common")}}render(){const{formik:e,app:t}=this.props;/* @__PURE__ */
|
|
209
|
+
return qt.createElement(mc,{formik:e,app:t,ref:this.handleRef})}};pc=((e,t,a,n)=>{for(var r,l=n>1?void 0:n?uc(t,a):t,s=e.length-1;s>=0;s--)(r=e[s])&&(l=r(l)||l);return l})([fe("aws.serverGroup.advancedSettings")],pc);class hc extends qt.Component{constructor(){super(...arguments),this.ref=qt.createRef()}validate(e){return this.ref&&this.ref.current?this.ref.current.validate(e):{}}render(){const{app:e,formik:t}=this.props;/* @__PURE__ */
|
|
210
|
+
return qt.createElement(pc,{formik:t,app:e,ref:this.ref})}}const gc=class extends qt.Component{constructor(e){super(e),this._isUnmounted=!1,this.templateSelected=()=>{this.setState({requiresTemplateSelection:!1}),this.configureCommand()},this.onTaskComplete=()=>{this.clearRefreshSubscription(),this.refreshUnsubscribe=this.props.application.serverGroups.onNextRefresh(this.onApplicationRefresh),this.props.application.serverGroups.refresh()},this.onApplicationRefresh=()=>{if(this.clearRefreshSubscription(),this._isUnmounted)return;const{command:e}=this.props,{taskMonitor:t}=this.state,a=t.task.execution.stages.find(e=>"cloneServerGroup"===e.type);if(a&&a.context["deploy.server.groups"]){const t=a.context["deploy.server.groups"][e.region];if(t){const a={serverGroup:t,accountId:e.credentials,region:e.region,provider:"aws"};let n="^.^.^.clusters.serverGroup";this.props.stateService.includes("**.clusters.serverGroup")&&(n="^.serverGroup"),this.props.stateService.includes("**.clusters.cluster.serverGroup")&&(n="^.^.serverGroup"),this.props.stateService.includes("**.clusters")&&(n=".serverGroup"),this.props.stateService.go(n,a)}}},this.initializeCommand=()=>{const{command:e}=this.props;e.credentialsChanged(e),e.regionChanged(e),this.configurationService.configureSubnetPurposes(e)},this.configureCommand=()=>{const{application:e,command:t}=this.props;this.configurationService.configureCommand(e,t).then(()=>{this.initializeCommand(),this.setState({loaded:!0,requiresTemplateSelection:!1})})},this.normalizeCommand=({tags:e})=>{e&&Object.keys(e).forEach(t=>{t.length||e[t].length||delete e[t]})},this.clearRefreshSubscription=()=>{var e;null==(e=this.refreshUnsubscribe)||e.call(this),this.refreshUnsubscribe=void 0},this.submit=e=>{this.normalizeCommand(e);"editPipeline"===e.viewState.mode||"createPipeline"===e.viewState.mode?this.props.closeModal&&this.props.closeModal(e):this.state.taskMonitor.submit(()=>this.context.services.serverGroupWriter.cloneServerGroup(e,this.props.application))};const t=ca(e,"command.viewState.requiresTemplateSelection",!1);this.state={firewallsLabel:j.get("Firewalls"),loaded:!1,requiresTemplateSelection:t,taskMonitor:new w({application:e.application,title:"Creating your server group",onDismiss:()=>this.props.dismissModal(),onTaskComplete:this.onTaskComplete})}}static show(e,t){return I.show(fc,e,{dialogClassName:"wizard-modal modal-lg"},t)}componentDidMount(){this.state.requiresTemplateSelection||this.configureCommand()}get configurationService(){return this.context.services.providerServiceDelegate.getDelegate(this.props.command.selectedProvider,"serverGroup.configurationService")}componentWillUnmount(){this._isUnmounted=!0,this.clearRefreshSubscription()}render(){const{application:e,command:t,dismissModal:a,title:n}=this.props,{loaded:r,taskMonitor:l,requiresTemplateSelection:s}=this.state;return s?/* @__PURE__ */qt.createElement(Io,{app:e,command:t,onDismiss:a,onTemplateSelected:this.templateSelected}):/* @__PURE__ */qt.createElement(P,{heading:n,initialValues:t,loading:!r,taskMonitor:l,dismissModal:a,closeModal:this.submit,submitButtonLabel:t.viewState.submitButtonLabel,render:({formik:a,nextIdx:n,wizard:r})=>/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(A,{label:"Basic Settings",wizard:r,order:n(),render:({innerRef:t})=>/* @__PURE__ */qt.createElement(xo,{ref:t,formik:a,app:e})}),/* @__PURE__ */qt.createElement(A,{label:"Load Balancers",wizard:r,order:n(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(lc,{ref:e,formik:a})}),/* @__PURE__ */qt.createElement(A,{label:j.get("Firewalls"),wizard:r,order:n(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(dc,{ref:e,formik:a})}),/* @__PURE__ */qt.createElement(A,{label:t.viewState.useSimpleInstanceTypeSelector?"Instance Type":"Instance Types",wizard:r,order:n(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(tc,{ref:e,formik:a})}),/* @__PURE__ */qt.createElement(A,{label:"Capacity",wizard:r,order:n(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(Fo,{ref:e,formik:a})}),/* @__PURE__ */qt.createElement(A,{label:"Availability Zones",wizard:r,order:n(),render:({innerRef:e})=>/* @__PURE__ */qt.createElement(ac,{ref:e,formik:a})}),/* @__PURE__ */qt.createElement(A,{label:"Advanced Settings",wizard:r,order:n(),render:({innerRef:t})=>/* @__PURE__ */qt.createElement(hc,{ref:t,formik:a,app:e})}))})}};gc.contextType=C,gc.defaultProps={closeModal:T,dismissModal:T};let vc=gc;const fc=Object.assign(G(vc),{show:vc.show}),Ec=class extends qt.Component{constructor(){super(...arguments),this.state={verified:!1,requireVerification:!1},this.handleVerification=e=>{this.setState({verified:e})}}componentDidMount(){h.accounts$.pipe(Wa(1),Ma(e=>e.find(e=>e.name===this.props.account))).subscribe(e=>{this.setState({requireVerification:!!e&&e.challengeDestructiveActions})})}render(){const{account:e,onCancel:t,onSubmit:a,isValid:n}=this.props,{verified:r,requireVerification:l}=this.state;/* @__PURE__ */
|
|
211
|
+
return qt.createElement(Qa,null,/* @__PURE__ */qt.createElement("form",{onSubmit:()=>(this.props.onSubmit(),!1)},l&&/* @__PURE__ */qt.createElement(Gt,{expectedValue:e,onValidChange:this.handleVerification})),/* @__PURE__ */qt.createElement("button",{className:"btn btn-default",onClick:t},"Cancel"),/* @__PURE__ */qt.createElement("button",{type:"submit",className:"btn btn-primary",onClick:a,disabled:!n||l&&!r},"Submit"))}};Ec.defaultProps={isValid:!0};let yc=Ec;const bc=class e extends qt.Component{constructor(e){super(e),this.formikRef=qt.createRef(),this.validate=e=>{const{min:t,max:a,desired:n}=e,r={};return this.state.advancedMode?(t>a&&t>n?r.min="Min cannot be larger than Max/Desired":a<t&&a<n?r.max="Max cannot be smaller than Min/Desired":(t>a&&(r.min="Min cannot be larger than Max"),this.isDesiredControlledByAutoscaling()||(n<t&&(r.desired="Desired cannot be smaller than Min"),n>a&&(r.desired="Desired cannot be larger than Max"))),r):r},this.toggleAdvancedMode=()=>{const{desired:e}=this.formikRef.current.getFormikContext().values;this.formikRef.current.setFieldValue("min",e),this.formikRef.current.setFieldValue("max",e),this.setState({advancedMode:!this.state.advancedMode})},this.close=e=>{this.props.dismissModal.apply(null,e)},this.platformHealthOverrideChanged=e=>{this.setState({interestingHealthProviderNames:e})},this.isDesiredControlledByAutoscaling=()=>{const{serverGroup:e}=this.props,{suspendedProcesses:t}=e.asg,{advancedMode:a}=this.state;return(e.scalingPolicies||[]).length&&a&&t.every(e=>"AlarmNotification"!==e.processName)},this.submit=e=>{const{min:t,max:a,desired:n,enforceCapacityConstraints:r,reason:l}=e,{interestingHealthProviderNames:s}=this.state,{serverGroup:i,application:o}=this.props,{asg:c}=i,d={capacity:ia({min:t!==c.minSize?t:void 0,max:a!==c.maxSize?a:void 0,desired:n!==c.desiredCapacity?n:void 0},e=>void 0!==e),reason:l,interestingHealthProviderNames:s};r&&(d.constraints={capacity:{min:c.minSize,max:c.maxSize,desired:c.desiredCapacity}}),this.state.taskMonitor.submit(()=>this.context.services.serverGroupWriter.resizeServerGroup(i,o,d))};const{minSize:t,maxSize:a,desiredCapacity:n}=e.serverGroup.asg,{attributes:r}=e.application;this.state={advancedMode:t!==a,initialValues:{min:t,max:a,desired:n,enforceCapacityConstraints:!1},taskMonitor:new w({application:e.application,title:"Resizing your server group",onDismiss:()=>this.props.dismissModal(),onTaskComplete:()=>this.props.application.serverGroups.refresh()}),platformHealthOnlyShowOverride:r.platformHealthOnlyShowOverride,interestingHealthProviderNames:r.platformHealthOnlyShowOverride&&r.platformHealthOnly?["Amazon"]:null}}static show(t,a){const n={},{serverGroup:r,application:l}=t;return ft(r,l).then(r=>{r&&I.show(e,t,n,a)})}autoIncrementDesiredIfNeeded(){if(!this.isDesiredControlledByAutoscaling())return;const e=this.formikRef.current.getFormikContext(),{asg:t}=this.props.serverGroup,{min:a,max:n,desired:r}=e.values,l=Math.min(n,Math.max(a,t.desiredCapacity));r!==l&&e.setFieldValue("desired",l)}renderSimpleMode(e){const{serverGroup:t}=this.props,{asg:a}=t;/* @__PURE__ */
|
|
212
212
|
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null,"Sets min, max, and desired instance counts to the same value."),/* @__PURE__ */qt.createElement("p",null,"To allow autoscaling, use the"," ",/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:()=>this.toggleAdvancedMode()},"Advanced Mode"),"."),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Current size"),/* @__PURE__ */qt.createElement("div",{className:"col-md-4"},/* @__PURE__ */qt.createElement("div",{className:"horizontal middle"},/* @__PURE__ */qt.createElement("input",{type:"number",className:"NumberInput form-control",value:a.desiredCapacity,disabled:!0}),/* @__PURE__ */qt.createElement("div",{className:"sp-padding-xs-xaxis"},"instances")))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Resize to"),/* @__PURE__ */qt.createElement("div",{className:"col-md-4"},/* @__PURE__ */qt.createElement("div",{className:"horizontal middle"},/* @__PURE__ */qt.createElement(u,{name:"desired",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0}),touched:!0,onChange:t=>{e.setFieldValue("min",t),e.setFieldValue("max",t)}}),/* @__PURE__ */qt.createElement("div",{className:"sp-padding-xs-xaxis"},"instances")))))}renderAdvancedMode(e){const{serverGroup:t}=this.props,{errors:a}=e,{asg:n}=t,r=a.min||a.max||a.desired;/* @__PURE__ */
|
|
213
213
|
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("p",null,"Sets up autoscaling for this server group."),/* @__PURE__ */qt.createElement("p",null,"To disable autoscaling, use the"," ",/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:()=>this.toggleAdvancedMode()},"Simple Mode"),"."),/* @__PURE__ */qt.createElement("div",{className:"form-group bold"},/* @__PURE__ */qt.createElement("div",{className:"col-md-2 col-md-offset-3"},"Min"),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Max"),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},"Desired")),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Current"),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{type:"number",className:"NumberInput form-control",value:n.minSize,disabled:!0})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{type:"number",className:"NumberInput form-control",value:n.maxSize,disabled:!0})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement("input",{type:"number",className:"NumberInput form-control",value:n.desiredCapacity,disabled:!0}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Resize to"),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement(u,{name:"min",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0}),onChange:()=>this.autoIncrementDesiredIfNeeded(),layout:({input:e})=>/* @__PURE__ */qt.createElement(qt.Fragment,null,e),touched:!0})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement(u,{name:"max",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0}),onChange:()=>this.autoIncrementDesiredIfNeeded(),layout:({input:e})=>/* @__PURE__ */qt.createElement(qt.Fragment,null,e),touched:!0})),/* @__PURE__ */qt.createElement("div",{className:"col-md-2"},/* @__PURE__ */qt.createElement(u,{name:"desired",input:e=>/* @__PURE__ */qt.createElement(E,{...e,min:0,disabled:this.isDesiredControlledByAutoscaling()}),layout:({input:e})=>/* @__PURE__ */qt.createElement(qt.Fragment,null,e),touched:!0}))),!!r&&/* @__PURE__ */qt.createElement("div",{className:"col-md-offset-3 col-md-9"},/* @__PURE__ */qt.createElement(Se,{message:r,type:"error"})))}renderCapacityConstraintSelector(){/* @__PURE__ */
|
|
214
214
|
return qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-7 col-md-offset-3"},/* @__PURE__ */qt.createElement(u,{name:"enforceCapacityConstraints",input:e=>/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(v,{...e,text:"Enforce Capacity Constraints"}),/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.capacityConstraint"}))})))}renderScalingPolicyWarning(e){const{serverGroup:t}=this.props,{min:a,max:n}=e.values,{advancedMode:r}=this.state,l=t.scalingPolicies||[];return l.length&&a===n?/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-7 col-md-offset-3"},/* @__PURE__ */qt.createElement("div",{className:"well-compact alert alert-warning"},/* @__PURE__ */qt.createElement("b",null,"Warning"),": this server group has",1===l.length&&/* @__PURE__ */qt.createElement("span",null," a scaling policy. "),l.length>1&&/* @__PURE__ */qt.createElement("span",null," scaling policies. "),!r&&/* @__PURE__ */qt.createElement("span",null,"Scaling policies will not take effect in Simple Mode. Switch to"," ",/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:()=>this.toggleAdvancedMode()},"Advanced Mode"),"."),r&&/* @__PURE__ */qt.createElement("span",null,"Scaling policies will not take effect when ",/* @__PURE__ */qt.createElement("b",null,"Min")," is the same as ",/* @__PURE__ */qt.createElement("b",null,"Max"),".")))):this.isDesiredControlledByAutoscaling()?/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-8 col-md-offset-1"},/* @__PURE__ */qt.createElement("div",{className:"well-compact alert alert-warning"},/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("b",null,"Desired")," capacity is managed by Autoscaling Policies."),/* @__PURE__ */qt.createElement("p",null,"If you need to scale ",/* @__PURE__ */qt.createElement("b",null,"down")," this server group, set ",/* @__PURE__ */qt.createElement("b",null,"Max")," to the new desired size."),/* @__PURE__ */qt.createElement("p",null,"If you need to scale ",/* @__PURE__ */qt.createElement("b",null,"up")," this server group, set ",/* @__PURE__ */qt.createElement("b",null,"Min")," to the new desired size.")))):null}render(){const{serverGroup:e}=this.props,{advancedMode:t,initialValues:a,platformHealthOnlyShowOverride:n}=this.state;/* @__PURE__ */
|
|
215
215
|
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(vt,{monitor:this.state.taskMonitor}),/* @__PURE__ */qt.createElement(Ee,{ref:this.formikRef,initialValues:a,validate:this.validate,onSubmit:this.submit,render:a=>{const{asg:r}=e,l={min:r.minSize,max:r.maxSize,desired:r.desiredCapacity},s=a.values;/* @__PURE__ */
|
|
216
|
-
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(ye,{dismiss:this.close}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Resize ",e.name)),/* @__PURE__ */qt.createElement(Za.Body,null,/* @__PURE__ */qt.createElement(on,{className:"form-horizontal"},t&&this.renderAdvancedMode(a),!t&&this.renderSimpleMode(a),this.renderScalingPolicyWarning(a),this.renderCapacityConstraintSelector(),n&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-8 col-md-offset-3"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:this.state.interestingHealthProviderNames,platformHealthType:"Amazon",onChange:this.platformHealthOverrideChanged,showHelpDetails:!0}))),/* @__PURE__ */qt.createElement(St,{reason:a.values.reason,onChange:e=>a.setFieldValue("reason",e)}),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Changes"),/* @__PURE__ */qt.createElement("div",{className:"col-md-9 sm-control-field"},/* @__PURE__ */qt.createElement(xt,{current:l,next:s}))))),/* @__PURE__ */qt.createElement(
|
|
216
|
+
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(ye,{dismiss:this.close}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Resize ",e.name)),/* @__PURE__ */qt.createElement(Za.Body,null,/* @__PURE__ */qt.createElement(on,{className:"form-horizontal"},t&&this.renderAdvancedMode(a),!t&&this.renderSimpleMode(a),this.renderScalingPolicyWarning(a),this.renderCapacityConstraintSelector(),n&&/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-8 col-md-offset-3"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:this.state.interestingHealthProviderNames,platformHealthType:"Amazon",onChange:this.platformHealthOverrideChanged,showHelpDetails:!0}))),/* @__PURE__ */qt.createElement(St,{reason:a.values.reason,onChange:e=>a.setFieldValue("reason",e)}),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-3 sm-label-right"},"Changes"),/* @__PURE__ */qt.createElement("div",{className:"col-md-9 sm-control-field"},/* @__PURE__ */qt.createElement(xt,{current:l,next:s}))))),/* @__PURE__ */qt.createElement(yc,{onSubmit:()=>this.submit(a.values),onCancel:this.close,isValid:a.isValid,account:e.account}))}}))}};bc.contextType=C,bc.defaultProps={closeModal:T,dismissModal:T};let Cc=bc;function Nc(e){return e<10?100:e<20?90:95}function Sc(e){var t,a,n,r,l;const s=null==(n=null==(a=null==(t=e.entityTags)?void 0:t.creationMetadata)?void 0:a.value)?void 0:n.previousServerGroup;if(!s)return;const i=null==(l=null==(r=s.buildInfo)?void 0:r.jenkins)?void 0:l.number;return{...void 0!==i?{buildNumber:i}:{},imageId:s.imageId&&s.imageId!==s.imageName?s.imageId:void 0,imageName:s.imageName,name:s.name}}function wc(e,t,a){const n={};return"EXPLICIT"===t&&(e.restoreServerGroupName?a&&!a.includes(e.restoreServerGroupName)&&(n.restoreServerGroupName="Select an eligible server group to restore"):n.restoreServerGroupName="Select a server group to restore"),(!Number.isFinite(e.targetHealthyRollbackPercentage)||e.targetHealthyRollbackPercentage<0||e.targetHealthyRollbackPercentage>100)&&(n.targetHealthyRollbackPercentage="Healthy threshold must be between 0 and 100"),(!Number.isFinite(e.delayBeforeDisableSeconds)||!Number.isInteger(e.delayBeforeDisableSeconds)||e.delayBeforeDisableSeconds<0)&&(n.delayBeforeDisableSeconds="Delay must be a non-negative whole number"),n}const kc=class e extends qt.Component{constructor(e){var t,a;super(e),this.close=()=>this.props.dismissModal(),this.submit=e=>{const{allServerGroups:t,application:a,serverGroup:n}=this.props,r=wc(e,this.rollbackType,t.map(({name:e})=>e));if(!this.state.verified||Object.keys(r).length>0)return;const l=function(e,t,a,n){var r;return{interestingHealthProviderNames:n.interestingHealthProviderNames,platformHealthOnlyShowOverride:null==(r=e.attributes)?void 0:r.platformHealthOnlyShowOverride,reason:n.reason,rollbackContext:{delayBeforeDisableSeconds:n.delayBeforeDisableSeconds,restoreServerGroupName:n.restoreServerGroupName,rollbackServerGroupName:t.name,targetHealthyRollbackPercentage:n.targetHealthyRollbackPercentage},rollbackType:a}}(a,n,this.rollbackType,e);this.state.taskMonitor.submit(()=>this.context.services.serverGroupWriter.rollbackServerGroup(n,a,l))};const{application:n,previousServerGroup:r,serverGroup:l}=e,s=Number(l.capacity.desired);this.state={initialValues:{delayBeforeDisableSeconds:0,interestingHealthProviderNames:(null==(t=n.attributes)?void 0:t.platformHealthOnlyShowOverride)&&(null==(a=n.attributes)?void 0:a.platformHealthOnly)?["Amazon"]:void 0,restoreServerGroupName:null==r?void 0:r.name,targetHealthyRollbackPercentage:Nc(s)},taskMonitor:new w({application:n,title:`Rollback ${l.name}`,onDismiss:()=>this.props.dismissModal(),onTaskComplete:()=>n.serverGroups.refresh()}),verified:!1}}static show(t,a){return I.show(e,t,void 0,a)}get rollbackType(){return e=this.props.serverGroup,0===this.props.allServerGroups.length&&Sc(e)?"PREVIOUS_IMAGE":"EXPLICIT";var e}label(e){var t,a;const n=null==(a=null==(t=null==e?void 0:e.buildInfo)?void 0:t.jenkins)?void 0:a.number;return n?`${e.name} (build #${n})`:(null==e?void 0:e.name)||""}minHealthy(e){return Math.ceil(Number(this.props.serverGroup.capacity.desired)*e/100)}renderRestoreTarget(e,t){if("PREVIOUS_IMAGE"===this.rollbackType){const e=Sc(this.props.serverGroup);/* @__PURE__ */
|
|
217
217
|
return qt.createElement("div",{style:{marginTop:"5px"}},e.name," ",/* @__PURE__ */qt.createElement("span",{className:"small"},"(no longer deployed)"),/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("span",{className:"small"},/* @__PURE__ */qt.createElement("strong",null,"Image"),": ",e.imageName,e.imageId&&/* @__PURE__ */qt.createElement(qt.Fragment,null," (",e.imageId,")")),void 0!==e.buildNumber&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("br",null),/* @__PURE__ */qt.createElement("span",{className:"small"},/* @__PURE__ */qt.createElement("strong",null,"Build")," #",e.buildNumber)))}const a=this.props.allServerGroups.filter(({isDisabled:e})=>!e),n=this.props.allServerGroups.filter(({isDisabled:e})=>e),r=e=>e.map(e=>/* @__PURE__ */qt.createElement("option",{key:e.name,value:e.name},this.label(e)));/* @__PURE__ */
|
|
218
218
|
return qt.createElement("select",{"aria-label":"Server group to restore",className:"form-control input-sm",name:"restoreServerGroupName",onChange:e=>t("restoreServerGroupName",e.target.value||void 0),value:e.restoreServerGroupName||""},
|
|
219
|
-
/* @__PURE__ */qt.createElement("option",{value:""},"Select..."),a.length>0&&/* @__PURE__ */qt.createElement("optgroup",{label:"Enabled Server Groups"},r(a)),n.length>0&&/* @__PURE__ */qt.createElement("optgroup",{label:"Disabled Server Groups"},r(n)))}renderOperations(e){const{serverGroup:t}=this.props,a=
|
|
219
|
+
/* @__PURE__ */qt.createElement("option",{value:""},"Select..."),a.length>0&&/* @__PURE__ */qt.createElement("optgroup",{label:"Enabled Server Groups"},r(a)),n.length>0&&/* @__PURE__ */qt.createElement("optgroup",{label:"Disabled Server Groups"},r(n)))}renderOperations(e){const{serverGroup:t}=this.props,a=Sc(t),n=e.restoreServerGroupName||"previous server group";/* @__PURE__ */
|
|
220
220
|
return qt.createElement("div",{className:"row"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-11 col-sm-offset-1"},/* @__PURE__ */qt.createElement("ol",null,"EXPLICIT"===this.rollbackType?/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("li",null,"Enable ",/* @__PURE__ */qt.createElement("em",null,n)),/* @__PURE__ */qt.createElement("li",null,"Resize ",/* @__PURE__ */qt.createElement("em",null,n)," to [",/* @__PURE__ */qt.createElement("strong",null,"min"),": ",t.capacity.desired,","," ",/* @__PURE__ */qt.createElement("strong",null,"max"),": ",t.capacity.max,", ",/* @__PURE__ */qt.createElement("strong",null,"desired"),":"," ",t.capacity.desired,"]")):/* @__PURE__ */qt.createElement("li",null,"Deploy ",/* @__PURE__ */qt.createElement("em",null,a.imageId||a.imageName)," [",/* @__PURE__ */qt.createElement("strong",null,"min"),":"," ",t.capacity.desired,", ",/* @__PURE__ */qt.createElement("strong",null,"max"),": ",t.capacity.max,","," ",/* @__PURE__ */qt.createElement("strong",null,"desired"),": ",t.capacity.desired,"]"),e.targetHealthyRollbackPercentage<100&&/* @__PURE__ */qt.createElement("li",null,"Wait for at least ",this.minHealthy(e.targetHealthyRollbackPercentage)," instances to report as healthy"),e.delayBeforeDisableSeconds>0&&/* @__PURE__ */qt.createElement("li",null,"Wait ",e.delayBeforeDisableSeconds," seconds"),/* @__PURE__ */qt.createElement("li",null,"Disable ",/* @__PURE__ */qt.createElement("em",null,t.name)),/* @__PURE__ */qt.createElement("li",null,"Restore minimum capacity of ",/* @__PURE__ */qt.createElement("em",null,"EXPLICIT"===this.rollbackType?n:"new server group")," ","[",/* @__PURE__ */qt.createElement("strong",null,"min"),": ",t.capacity.min,"]")),/* @__PURE__ */qt.createElement("p",null,"This rollback will affect server groups in ",t.account," (",t.region,").")))}render(){const{application:e,serverGroup:t}=this.props,a=this.props.allServerGroups.map(({name:e})=>e);/* @__PURE__ */
|
|
221
|
-
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(vt,{monitor:this.state.taskMonitor}),/* @__PURE__ */qt.createElement(Ee,{initialValues:this.state.initialValues,onSubmit:this.submit,validate:e=>
|
|
222
|
-
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(ye,{dismiss:this.close}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Rollback ",t.name)),/* @__PURE__ */qt.createElement(Za.Body,null,/* @__PURE__ */qt.createElement("form",{className:"form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group row"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-3 sm-label-right"},"Restore to"),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},this.renderRestoreTarget(a.values,a.setFieldValue),a.errors.restoreServerGroupName&&/* @__PURE__ */qt.createElement(Se,{message:a.errors.restoreServerGroupName,type:"error"}))),(null==(n=e.attributes)?void 0:n.platformHealthOnlyShowOverride)&&/* @__PURE__ */qt.createElement("div",{className:"form-group row"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-10 col-sm-offset-1"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:a.values.interestingHealthProviderNames,onChange:e=>a.setFieldValue("interestingHealthProviderNames",e),platformHealthType:"Amazon",showHelpDetails:!0}))),/* @__PURE__ */qt.createElement(St,{reason:a.values.reason,onChange:e=>a.setFieldValue("reason",e)}),/* @__PURE__ */qt.createElement("div",{className:"form-group row"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-11 col-sm-offset-1"},"Wait"," ",/* @__PURE__ */qt.createElement("input",{"aria-label":"Delay before disabling",className:"form-control input-sm inline-number",min:0,name:"delayBeforeDisableSeconds",onChange:e=>a.setFieldValue("delayBeforeDisableSeconds",Number(e.target.value)),placeholder:"0",step:1,type:"number",value:a.values.delayBeforeDisableSeconds})," ","seconds before disabling ",/* @__PURE__ */qt.createElement("em",null,this.label(t)),".",a.errors.delayBeforeDisableSeconds&&/* @__PURE__ */qt.createElement(Se,{message:a.errors.delayBeforeDisableSeconds,type:"error"}))),/* @__PURE__ */qt.createElement("div",{className:"form-group row"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-11 col-sm-offset-1"},"Consider rollback successful when"," ",/* @__PURE__ */qt.createElement("input",{"aria-label":"Target healthy rollback percentage",className:"form-control input-sm inline-number",max:100,min:0,name:"targetHealthyRollbackPercentage",onChange:e=>a.setFieldValue("targetHealthyRollbackPercentage",Number(e.target.value)),type:"number",value:a.values.targetHealthyRollbackPercentage})," ","percent of instances are healthy.",a.errors.targetHealthyRollbackPercentage&&/* @__PURE__ */qt.createElement(Se,{message:a.errors.targetHealthyRollbackPercentage,type:"error"})))),/* @__PURE__ */qt.createElement("div",{className:"row"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-4 sm-label-right"},"Rollback Operations")),this.renderOperations(a.values)),/* @__PURE__ */qt.createElement(Za.Footer,null,/* @__PURE__ */qt.createElement(Gt,{account:t.account,onValidChange:e=>this.setState({verified:e})}),/* @__PURE__ */qt.createElement("button",{className:"btn btn-default",onClick:this.close,type:"button"},"Cancel"),/* @__PURE__ */qt.createElement("button",{className:"btn btn-primary",disabled:!this.state.verified||!a.isValid,onClick:()=>this.submit(a.values),type:"button"},"Submit")))}}))}};
|
|
223
|
-
return qt.createElement(Ka,{onClick:this.resizeServerGroup},"Resize")}};
|
|
224
|
-
return qt.createElement(qt.Fragment,null,Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement(ja,{className:"dropdown",id:"server-group-actions-dropdown"},/* @__PURE__ */qt.createElement(ja.Toggle,{className:"btn btn-sm btn-primary dropdown-toggle"},"Server Group Actions"),/* @__PURE__ */qt.createElement(ja.Menu,{className:"dropdown-menu"},this.isRollbackEnabled()&&/* @__PURE__ */qt.createElement(Oe,{resource:t,application:e,onClick:this.rollbackServerGroup},"Rollback"),this.isRollbackEnabled()&&/* @__PURE__ */qt.createElement("li",{role:"presentation",className:"divider"}),/* @__PURE__ */qt.createElement(
|
|
221
|
+
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(vt,{monitor:this.state.taskMonitor}),/* @__PURE__ */qt.createElement(Ee,{initialValues:this.state.initialValues,onSubmit:this.submit,validate:e=>wc(e,this.rollbackType,a),render:a=>{var n;/* @__PURE__ */
|
|
222
|
+
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(ye,{dismiss:this.close}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Rollback ",t.name)),/* @__PURE__ */qt.createElement(Za.Body,null,/* @__PURE__ */qt.createElement("form",{className:"form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group row"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-3 sm-label-right"},"Restore to"),/* @__PURE__ */qt.createElement("div",{className:"col-md-7"},this.renderRestoreTarget(a.values,a.setFieldValue),a.errors.restoreServerGroupName&&/* @__PURE__ */qt.createElement(Se,{message:a.errors.restoreServerGroupName,type:"error"}))),(null==(n=e.attributes)?void 0:n.platformHealthOnlyShowOverride)&&/* @__PURE__ */qt.createElement("div",{className:"form-group row"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-10 col-sm-offset-1"},/* @__PURE__ */qt.createElement(et,{interestingHealthProviderNames:a.values.interestingHealthProviderNames,onChange:e=>a.setFieldValue("interestingHealthProviderNames",e),platformHealthType:"Amazon",showHelpDetails:!0}))),/* @__PURE__ */qt.createElement(St,{reason:a.values.reason,onChange:e=>a.setFieldValue("reason",e)}),/* @__PURE__ */qt.createElement("div",{className:"form-group row"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-11 col-sm-offset-1"},"Wait"," ",/* @__PURE__ */qt.createElement("input",{"aria-label":"Delay before disabling",className:"form-control input-sm inline-number",min:0,name:"delayBeforeDisableSeconds",onChange:e=>a.setFieldValue("delayBeforeDisableSeconds",Number(e.target.value)),placeholder:"0",step:1,type:"number",value:a.values.delayBeforeDisableSeconds})," ","seconds before disabling ",/* @__PURE__ */qt.createElement("em",null,this.label(t)),".",a.errors.delayBeforeDisableSeconds&&/* @__PURE__ */qt.createElement(Se,{message:a.errors.delayBeforeDisableSeconds,type:"error"}))),/* @__PURE__ */qt.createElement("div",{className:"form-group row"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-11 col-sm-offset-1"},"Consider rollback successful when"," ",/* @__PURE__ */qt.createElement("input",{"aria-label":"Target healthy rollback percentage",className:"form-control input-sm inline-number",max:100,min:0,name:"targetHealthyRollbackPercentage",onChange:e=>a.setFieldValue("targetHealthyRollbackPercentage",Number(e.target.value)),type:"number",value:a.values.targetHealthyRollbackPercentage})," ","percent of instances are healthy.",a.errors.targetHealthyRollbackPercentage&&/* @__PURE__ */qt.createElement(Se,{message:a.errors.targetHealthyRollbackPercentage,type:"error"})))),/* @__PURE__ */qt.createElement("div",{className:"row"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-4 sm-label-right"},"Rollback Operations")),this.renderOperations(a.values)),/* @__PURE__ */qt.createElement(Za.Footer,null,/* @__PURE__ */qt.createElement(Gt,{account:t.account,onValidChange:e=>this.setState({verified:e})}),/* @__PURE__ */qt.createElement("button",{className:"btn btn-default",onClick:this.close,type:"button"},"Cancel"),/* @__PURE__ */qt.createElement("button",{className:"btn btn-primary",disabled:!this.state.verified||!a.isValid,onClick:()=>this.submit(a.values),type:"button"},"Submit")))}}))}};kc.contextType=C,kc.defaultProps={allServerGroups:[],closeModal:T,dismissModal:T};let Tc=kc;function Ic(e,t,a){return a.filter(a=>a.name!==t.name&&function(e,t,a){return((n=a).app||(null==(r=n.moniker)?void 0:r.app))===e&&a.cluster===t.cluster&&a.account===t.account&&a.region===t.region;var n,r}(e,t,a)).sort((e,t)=>t.name.localeCompare(e.name))}var Pc=Object.getOwnPropertyDescriptor;let Ac=class extends qt.Component{constructor(){super(...arguments),this.resizeServerGroup=()=>{Cc.show(this.props,this.context.services)}}render(){/* @__PURE__ */
|
|
223
|
+
return qt.createElement(Ka,{onClick:this.resizeServerGroup},"Resize")}};Ac.contextType=C,Ac=((e,t,a,n)=>{for(var r,l=n>1?void 0:n?Pc(t,a):t,s=e.length-1;s>=0;s--)(r=e[s])&&(l=r(l)||l);return l})([fe("AmazonServerGroupActions.resize")],Ac);const Gc=class extends qt.Component{constructor(){super(...arguments),this.destroyServerGroup=()=>{const{app:e,serverGroup:t}=this.props,a={application:e,title:"Destroying "+t.name,onTaskComplete:()=>{this.props.stateService.includes("**.serverGroup",n)&&this.props.stateService.go("^")}},n={name:t.name,accountId:t.account,region:t.region},r={header:"Really destroy "+t.name+"?",buttonText:"Destroy "+t.name,account:t.account,taskMonitorConfig:a,interestingHealthProviderNames:void 0,submitMethod:a=>this.context.services.serverGroupWriter.destroyServerGroup(t,e,a),askForReason:!0,platformHealthOnlyShowOverride:e.attributes.platformHealthOnlyShowOverride,platformHealthType:"Amazon"};Dt.addDestroyWarningMessage(e,t,r),e.attributes.platformHealthOnlyShowOverride&&e.attributes.platformHealthOnly&&(r.interestingHealthProviderNames=["Amazon"]),x.confirm(r)},this.disableServerGroup=()=>{const{app:e,serverGroup:t}=this.props,a={application:e,title:"Disabling "+t.name},n={header:"Really disable "+t.name+"?",buttonText:"Disable "+t.name,account:t.account,interestingHealthProviderNames:void 0,taskMonitorConfig:a,platformHealthOnlyShowOverride:e.attributes.platformHealthOnlyShowOverride,platformHealthType:"Amazon",submitMethod:a=>this.context.services.serverGroupWriter.disableServerGroup(t,e.name,a),askForReason:!0};Dt.addDisableWarningMessage(e,t,n),e.attributes.platformHealthOnlyShowOverride&&e.attributes.platformHealthOnly&&(n.interestingHealthProviderNames=["Amazon"]),x.confirm(n)},this.enableServerGroup=()=>{if(!this.isRollbackEnabled())return void this.showEnableServerGroupModal();const e={header:"Rolling back?",body:"Spinnaker provides an orchestrated rollback feature to carefully restore a different version of this\n server group. Do you want to use the orchestrated rollback?",buttonText:"Yes, take me to the rollback settings modal",cancelButtonText:"No, I just want to enable the server group"};x.confirm(e).then(()=>this.rollbackServerGroup()).catch(e=>{"footer"===(null==e?void 0:e.source)&&this.showEnableServerGroupModal()})},this.rollbackServerGroup=()=>{const{app:e,serverGroup:t}=this.props,a=function(e,t,a){let n,r=t;if(t.isDisabled&&(n=t,r=Ic(e,t,a).filter(e=>!e.isDisabled).sort((e,t)=>{var a,n;return((null==(a=t.instanceCounts)?void 0:a.total)||0)-((null==(n=e.instanceCounts)?void 0:n.total)||0)||(t.createdTime||0)-(e.createdTime||0)})[0],!r))return;const l=Ic(e,r,a);return 1!==l.length||n||(n=l[0]),{allServerGroups:l,previousServerGroup:n,serverGroup:r}}(e.name,t,e.getDataSource("serverGroups").data);a&&Tc.show({application:e,...a},this.context.services)},this.cloneServerGroup=()=>{const{app:e,serverGroup:t}=this.props;this.context.services.serverGroupCommandBuilder.buildServerGroupCommandFromExisting(e,t).then(a=>{const n=`Clone ${t.name}`;fc.show({title:n,application:e,command:a},this.context.services)})}}isEnableLocked(){if(this.props.serverGroup.isDisabled){if((this.props.serverGroup.runningTasks||[]).filter(e=>ca(e,"execution.stages",[]).some(e=>"resizeServerGroup"===e.type)).length)return!0}return!1}isRollbackEnabled(){const{app:e,serverGroup:t}=this.props;return a=e.name,n=t,r=e.getDataSource("serverGroups").data,!n.isDisabled||Ic(a,n,r).some(e=>!e.isDisabled);var a,n,r}hasDisabledInstances(){return this.props.serverGroup.isDisabled||ca(this.props.serverGroup,"instanceCounts.outOfService",0)>0}showEnableServerGroupModal(){const{app:e,serverGroup:t}=this.props,a={application:e,title:"Enabling "+t.name},n={header:"Really enable "+t.name+"?",buttonText:"Enable "+t.name,account:t.account,interestingHealthProviderNames:void 0,taskMonitorConfig:a,platformHealthOnlyShowOverride:e.attributes.platformHealthOnlyShowOverride,platformHealthType:"Amazon",submitMethod:a=>this.context.services.serverGroupWriter.enableServerGroup(t,e,a),askForReason:!0};e.attributes.platformHealthOnlyShowOverride&&e.attributes.platformHealthOnly&&(n.interestingHealthProviderNames=["Amazon"]),x.confirm(n)}render(){const{app:e,serverGroup:t}=this.props,a=o.feature&&o.feature.entityTags,n=Bt.buildClusterTargets(t);/* @__PURE__ */
|
|
224
|
+
return qt.createElement(qt.Fragment,null,Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement(ja,{className:"dropdown",id:"server-group-actions-dropdown"},/* @__PURE__ */qt.createElement(ja.Toggle,{className:"btn btn-sm btn-primary dropdown-toggle"},"Server Group Actions"),/* @__PURE__ */qt.createElement(ja.Menu,{className:"dropdown-menu"},this.isRollbackEnabled()&&/* @__PURE__ */qt.createElement(Oe,{resource:t,application:e,onClick:this.rollbackServerGroup},"Rollback"),this.isRollbackEnabled()&&/* @__PURE__ */qt.createElement("li",{role:"presentation",className:"divider"}),/* @__PURE__ */qt.createElement(Ac,{application:e,serverGroup:t}),!t.isDisabled&&/* @__PURE__ */qt.createElement(Oe,{resource:t,application:e,onClick:this.disableServerGroup},"Disable"),this.hasDisabledInstances()&&!this.isEnableLocked()&&/* @__PURE__ */qt.createElement(Oe,{resource:t,application:e,onClick:this.enableServerGroup},"Enable"),this.isEnableLocked()&&/* @__PURE__ */qt.createElement("li",{className:"disabled"},/* @__PURE__ */qt.createElement(Ya,{value:"Cannot enable this server group until resize operation completes",placement:"left"},/* @__PURE__ */qt.createElement("a",null,/* @__PURE__ */qt.createElement("span",{className:"small glyphicon glyphicon-lock"})," Enable"))),/* @__PURE__ */qt.createElement(Oe,{resource:t,application:e,onClick:this.destroyServerGroup},"Destroy"),/* @__PURE__ */qt.createElement("li",null,/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.cloneServerGroup},"Clone")),a&&/* @__PURE__ */qt.createElement(B,{component:t,application:e,entityType:"serverGroup",ownerOptions:n,onUpdate:()=>e.serverGroups.refresh()}))))}};Gc.contextType=C;const xc=G(Gc);function Dc(e,t){const{app:a,serverGroup:n}=e;return new Fa(r=>{(function(e){const{app:t,serverGroup:a}=e;return t.ready().then(()=>{let e=t.serverGroups.data.find(e=>e.name===a.name&&e.account===a.accountId&&e.region===a.region);return e||t.loadBalancers.data.some(t=>t.account===a.accountId&&t.region===a.region&&t.serverGroups.some(t=>t.name===a.name&&(e=t,!0))),e})})(e).then(e=>{Ft.getServerGroup(a.name,n.accountId,n.region,n.name).then(a=>{Object.assign(a,e,{account:n.accountId});const l=cr.awsServerGroupTransformer.normalizeServerGroupDetails(a);if(h.getAccountDetails(l.account).then(e=>{l.accountDetails=e,r.next(l)}),_t(l))t();else{const e=Sn(l.asg);if(e){const t=e.split(",")[0];N.listSubnets().then(e=>{const a=e.find(e=>e.id===t);l.subnetType=a.purpose,r.next(l)})}l.disabledDate=No.getDisabledDate(l),r.next(l)}},t)},t)})}function Bc(e){const t=Ht.useRef(),a=Ht.useRef(),{lines:n,className:r="",style:l={}}=e;return Ht.useEffect(()=>{return t?(a.current=(e=t.current,new mn(e,{type:"line",data:{labels:[],datasets:[{data:[]}]},options:{plugins:{tooltip:{mode:"index",itemSort:(e,t)=>{var a,n;const r=e.chart.data.datasets.map(e=>e.label),l=null!=(a=e.dataset.label)?a:r[0],s=null!=(n=t.dataset.label)?n:r[0];return r.indexOf(s)-r.indexOf(l)}}},hover:{mode:"index"},elements:{point:{hitRadius:12,radius:1,hoverRadius:5}},scales:{x:{type:"time",display:!0,scaleLabel:{labelString:"Date"},ticks:{major:{enabled:!0}}},y:{min:0,stacked:!0}}}})),()=>{var e;return null==(e=a.current)?void 0:e.destroy()}):null;var e},[t.current]),Ht.useEffect(()=>{const e=a.current;e&&n&&(e.options.animation=!1,e.data.datasets=n,e.update())},[a.current,n]),/* @__PURE__ */Ht.createElement("canvas",{ref:t,...l,className:r})}function Fc(e){return e.serverGroup&&e.alarm?/* @__PURE__ */Ht.createElement(Mc,{...e}):null}function Mc(e){var t,a;const n=null!=(t=e.alarm)?t:{},r=null!=(a=e.serverGroup)?a:{},{account:l,awsAccount:s,region:i,type:o}=r,{metricName:c,namespace:d,statistic:m,period:u}=n,{status:p,result:h}=b(async()=>{var t;const a={namespace:d,statistics:m,period:u};n.dimensions.forEach(e=>a[e.name]=e.value);const r="aws"===o?l:s,p=await Mt.getMetricStatistics("aws",r,i,c,a);return p.datapoints=p.datapoints||[],null==(t=e.onChartLoaded)||t.call(e,p),p},{datapoints:[],unit:""},[d,m,u,o,l,i,c,n.dimensions]);if("PENDING"===p)/* @__PURE__ */
|
|
225
225
|
return Ht.createElement("div",{className:"flex-container-v middle center sp-margin-xl"},/* @__PURE__ */Ht.createElement(me,null));if("REJECTED"===p)/* @__PURE__ */
|
|
226
226
|
return Ht.createElement(Ht.Fragment,null,/* @__PURE__ */Ht.createElement("div",null,"no data"),/* @__PURE__ */Ht.createElement("div",null,"something went wrong fetching stats"));if(0===h.datapoints.length)/* @__PURE__ */
|
|
227
227
|
return Ht.createElement(Ht.Fragment,null,"no data");const g=/* @__PURE__ */new Date,v=new Date(Date.now()-864e5),f={label:c,fill:"stack",borderColor:"green",borderWidth:2,data:h.datapoints.map(e=>({x:new Date(e.timestamp),y:ca(e,[n.statistic.toLowerCase()],void 0)}))},E={label:"threshold",borderWidth:1,borderColor:"red",data:[{x:v,y:n.threshold},{x:g,y:n.threshold}]};/* @__PURE__ */
|
|
228
|
-
return Ht.createElement(
|
|
229
|
-
return Ht.createElement(
|
|
230
|
-
return Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-12 small"},/* @__PURE__ */Ht.createElement("h5",null,"Dimensions"))),n.map((t,n)=>/* @__PURE__ */Ht.createElement("div",{key:`dimension-${n}`,className:"row dimensions-row horizontal middle"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-6"},/* @__PURE__ */Ht.createElement(g,{onChange:e=>l("name",e.target.value,n),value:t.name,stringOptions:r})),/* @__PURE__ */Ht.createElement(p,{onChange:e=>l("value",e.target.value,n),value:t.value}),!e.disableEditingDimensions&&/* @__PURE__ */Ht.createElement("div",{className:"col-md-1",onClick:()=>(t=>{const n=e.dimensions.filter((e,a)=>a!==t);a(n)})(n)},/* @__PURE__ */Ht.createElement("a",null,/* @__PURE__ */Ht.createElement("i",{className:"glyphicon glyphicon-trash clickable"}))))),!e.disableEditingDimensions&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("button",{type:"button",className:"btn btn-block btn-xs add-new",onClick:()=>{const e=[...n,{}];a(e)}},/* @__PURE__ */Ht.createElement("span",{className:"glyphicon glyphicon-plus-sign sp-margin-xs-left"}),"Add dimension"))))},
|
|
231
|
-
return Ht.createElement("div",{className:"TargetMetricFields sp-margin-l-xaxis"},/* @__PURE__ */Ht.createElement("p",null,"With target tracking policies, Amazon will automatically adjust the size of your ASG to keep the selected metric as close as possible to the selected value."),t&&/* @__PURE__ */Ht.createElement("p",null,/* @__PURE__ */Ht.createElement("b",null,"Note:"),' metrics must be sent to Amazon CloudWatch before they can be used in auto scaling. If you do not see a metric below, click "Configure available metrics" in the server group details to set up forwarding from Atlas to CloudWatch.'),/* @__PURE__ */Ht.createElement("div",{className:"row sp-margin-s-yaxis"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Metric"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 content-fields"},!n&&/* @__PURE__ */Ht.createElement(g,{value:null==(o=a.targetTrackingConfiguration.predefinedMetricSpecification)?void 0:o.predefinedMetricType,stringOptions:["ASGAverageCPUUtilization","ASGAverageNetworkOut","ASGAverageNetworkIn","ALBRequestCountPerTarget"],onChange:e=>h("targetTrackingConfiguration.predefinedMetricSpecification.predefinedMetricType",e.target.value),inputClassName:"metric-select-input"}),n&&/* @__PURE__ */Ht.createElement(
|
|
232
|
-
return Ht.createElement("div",{className:"section-body TargetTrackingAdditionalSettings"},t&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Policy Name"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},t)),Boolean(e.estimatedInstanceWarmup)&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Warmup"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement("span",{className:"form-control-static"},"Instances need"),/* @__PURE__ */Ht.createElement(E,{value:e.estimatedInstanceWarmup,onChange:e=>r("estimatedInstanceWarmup",Number.parseInt(e.target.value)),inputClassName:"form-control number-input-sm sp-margin-xs-xaxis"}),/* @__PURE__ */Ht.createElement("span",{className:"input-label"}," seconds to warm up "))),/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Scale In"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-9"},/* @__PURE__ */Ht.createElement("div",{className:"checkbox"},/* @__PURE__ */Ht.createElement(v,{text:"Disable Scale-downs",checked:l,onChange:e=>r("targetTrackingConfiguration.disableScaleIn",e.target.checked)}),/* @__PURE__ */Ht.createElement("div",{className:"small"},/* @__PURE__ */Ht.createElement("p",null,"This option disables scale-downs for the target tracking policy, while keeping the scale-ups. This means that ASG will not scale down unless you explicitly set up a separate step policy to scale it down."),/* @__PURE__ */Ht.createElement("p",null,"This is useful when you have special requirements, such as gradual or delayed scale-down."))))),/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 col-md-offset-1"},l&&/* @__PURE__ */Ht.createElement("div",{className:"well"},"This policy will not scale down. Make sure you have another policy (either TT or Step) that will scale down this ASG."),!1===l&&/* @__PURE__ */Ht.createElement("div",{className:"well"},"This policy will scale both up and down. Make sure you don't have other scaling policies, as they will likely interfere with each other."))))},
|
|
233
|
-
return Ht.createElement(Rt,{closeModal:t,dismissModal:a,title:`${d} scaling policy`,application:e,description:`${d} scaling policy for ${r.name}`,initialValues:o,mapValuesToTask:()=>({application:e,job:[{type:"upsertScalingPolicy",...o}]}),render:()=>/* @__PURE__ */Ht.createElement("div",{className:"modal-body"},/* @__PURE__ */Ht.createElement("h4",{className:"section-heading"},"Target Metric"),/* @__PURE__ */Ht.createElement(
|
|
234
|
-
return qt.createElement(Za,{show:!0,onHide:e.showCallback},/* @__PURE__ */qt.createElement(Za.Header,{closeButton:!0},/* @__PURE__ */qt.createElement("h3",null,"Select a policy type")),/* @__PURE__ */qt.createElement(Za.Body,null,/* @__PURE__ */qt.createElement("div",{className:"card-choices"},/* @__PURE__ */qt.createElement("div",{className:l,onClick:n,id:"targetTracking"},/* @__PURE__ */qt.createElement("h3",null,"Target Tracking"),/* @__PURE__ */qt.createElement("div",null,"Continuously adjusts the size of the ASG to keep a specified metric at the target value")),/* @__PURE__ */qt.createElement("div",{className:r,onClick:n,id:"step"},/* @__PURE__ */qt.createElement("h3",null,"Step"),/* @__PURE__ */qt.createElement("div",null,"Rule-based scaling, with the ability to define different scaling amounts depending on the magnitude of the alarm breach"))),i&&/* @__PURE__ */qt.createElement(Se,{type:"info",message:/* @__PURE__ */qt.createElement(c,{id:s,expand:!0})}),e.warnOnMinMaxCapacity&&/* @__PURE__ */qt.createElement(Se,{type:"warning",message:/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("p",null,"This server group's ",/* @__PURE__ */qt.createElement("em",null,"min")," and ",/* @__PURE__ */qt.createElement("em",null,"max")," capacity are identical, so scaling policies will have ",/* @__PURE__ */qt.createElement("b",null,"no effect.")),/* @__PURE__ */qt.createElement("p",null,"Scaling policies work by adjusting the server group's ",/* @__PURE__ */qt.createElement("em",null,"desired")," capacity to a value between the min and max."))})),/* @__PURE__ */qt.createElement(Za.Footer,null,/* @__PURE__ */qt.createElement("button",{className:"btn btn-default",onClick:e.showCallback},"Cancel"),/* @__PURE__ */qt.createElement("button",{className:"btn btn-primary",disabled:!t,onClick:()=>{e.typeSelectedCallback(t)}},"Next")))}const
|
|
235
|
-
return Ht.createElement("div",{className:"ScalingPolicyAdditionalSettings"},/* @__PURE__ */Ht.createElement("h4",{className:"section-heading"},"Additional Settings"),/* @__PURE__ */Ht.createElement("div",{className:"section-body section-additional-settings"},!a&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Policy Name"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement("span",{className:"form-control-static select-placeholder"},e.name))),!t&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Adjustment Step"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement("span",{className:"form-control-static select-placeholder"},`${n} instances in increments of at least `),/* @__PURE__ */Ht.createElement(E,{value:e.minAdjustmentMagnitude,onChange:e=>d("minAdjustmentMagnitude",Number.parseInt(e.target.value)),inputClassName:"sp-margin-xs-xaxis input-sm number-input-sm"}),/* @__PURE__ */Ht.createElement("span",{className:"input-label"}," instance(s) "))),Boolean(e.simple)&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Cooldown"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement("span",{className:"form-control-static select-placeholder"}," Wait at least "),/* @__PURE__ */Ht.createElement(E,{value:null==(l=e.simple)?void 0:l.cooldown,onChange:e=>d("simple.cooldown",Number.parseInt(e.target.value)),inputClassName:"sp-margin-xs-xaxis input-sm number-input-sm"}),/* @__PURE__ */Ht.createElement("span",{className:"input-label"}," seconds before another scaling event "))),Boolean(null==(s=e.step)?void 0:s.estimatedInstanceWarmup)&&"Remove"!==n&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Warmup"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement("span",{className:"form-control-static select-placeholder"},"Instances need"),/* @__PURE__ */Ht.createElement(E,{value:e.step.estimatedInstanceWarmup,onChange:e=>d("step.estimatedInstanceWarmup",Number.parseInt(e.target.value)),inputClassName:"sp-margin-xs-xaxis input-sm number-input-sm"}),/* @__PURE__ */Ht.createElement("span",{className:"input-label"}," seconds to warm up after each step "))),Boolean(null==(i=e.step)?void 0:i.cooldown)&&"Remove"!==n&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},/* @__PURE__ */Ht.createElement("span",{className:"sp-margin-xs-right"},"Cooldown"),/* @__PURE__ */Ht.createElement(c,{id:`${e.cloudProvider||e.provider}.autoscaling.cooldown`})),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement(E,{value:null==(o=e.step)?void 0:o.cooldown,onChange:e=>d("step.cooldown",Number.parseInt(e.target.value)),inputClassName:"sp-margin-xs-xaxis input-sm number-input-sm"}),/* @__PURE__ */Ht.createElement("span",{className:"input-label"}," seconds ")))))},
|
|
236
|
-
return Ht.createElement("div",{className:"AlarmConfigurer"},t&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-12"},/* @__PURE__ */Ht.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */Ht.createElement("p",null,/* @__PURE__ */Ht.createElement("i",{className:"fa fa-exclamation-triangle"})," This scaling policy is configured with multiple alarms. You are only editing the first alarm."),/* @__PURE__ */Ht.createElement("p",null,"To edit or remove the additional alarms, you will need to use the AWS console.")))),(null==(i=e.alarmActionArns)?void 0:i.length)>1&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-12"},/* @__PURE__ */Ht.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */Ht.createElement("p",null,/* @__PURE__ */Ht.createElement("i",{className:"fa fa-exclamation-triangle"})," This alarm is used in multiple scaling policies. Any changes here will affect those other scaling policies.")))),/* @__PURE__ */Ht.createElement("div",{className:"row sp-margin-s-yaxis"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Whenever"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal"},/* @__PURE__ */Ht.createElement(g,{value:e.statistic,onChange:e=>u("statistic",e.target.value),stringOptions:
|
|
237
|
-
return Ht.createElement("div",{className:"SimplePolicyAction row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 col-md-offset-1 horizontal middle"},/* @__PURE__ */Ht.createElement(g,{value:a,stringOptions:["Add","Remove","Set to"],onChange:a=>{return n=a.target.value,void t(n,e);var n},clearable:!1,inputClassName:"action-input"}),/* @__PURE__ */Ht.createElement(E,{value:o,min:1,onChange:e=>{return t=Number.parseInt(e.target.value),c(t),void r(t);var t},inputClassName:"action-input"}),/* @__PURE__ */Ht.createElement(g,{value:s,stringOptions:l,onChange:e=>{return n=e.target.value,i(n),void t(a,n);var n},clearable:!1,inputClassName:"adjustment-type-input"})))},
|
|
228
|
+
return Ht.createElement(Bc,{lines:[f,E]})}mn.register(un,pn,hn,gn,vn,fn,En,yn,bn);const Rc={ASGAverageCPUUtilization:"CPUUtilization",ASGAverageNetworkIn:"NetworkIn",ASGAverageNetworkOut:"NetworkOut",ALBRequestCountPerTarget:"RequestCountPerTarget"},Lc=({config:e,serverGroup:t,updateUnit:a})=>{const[n,r]=Ht.useState({alarmName:null,alarmArn:null,metricName:null,namespace:null,statistic:"Average",dimensions:[],period:60,threshold:e.targetValue,comparisonOperator:"GreaterThanThreshold",okActions:[],insufficientDataActions:[],alarmActions:[],evaluationPeriods:null,alarmDescription:null,unit:null});Ht.useEffect(()=>{(()=>{const a=null==e?void 0:e.customizedMetricSpecification,l=null==e?void 0:e.predefinedMetricSpecification,s={...n,dimensions:(null==a?void 0:a.dimensions)||[{name:"AutoScalingGroupName",value:t.name}],metricName:(null==a?void 0:a.metricName)||Rc[null==l?void 0:l.predefinedMetricType],namespace:(null==a?void 0:a.namespace)||"AWS/EC2",threshold:null==e?void 0:e.targetValue};if(a&&(s.statistic=null==a?void 0:a.statistic),l&&"ALBRequestCountPerTarget"===l.predefinedMetricType&&(s.statistic="Sum",s.namespace="AWS/ApplicationELB",null==l?void 0:l.resourceLabel)){const e=null==l?void 0:l.resourceLabel.split("/"),t=e.slice(0,3).join("/"),a=e.slice(3).join("/");s.dimensions=[{name:"LoadBalancer",value:t},{name:"TargetGroup",value:a}]}r(s)})()},[e]);/* @__PURE__ */
|
|
229
|
+
return Ht.createElement(Fc,{alarm:n,onChartLoaded:e=>{a&&a(e.unit)},serverGroup:t})},zc=({alarm:e,serverGroup:t,updateAvailableMetrics:a})=>{const n=e.dimensions||[],{result:r}=b(()=>Mt.listMetrics("aws",t.account,t.region,{namespace:e.namespace}).then(e=>{const t=ta(e,e=>e.dimensions);return da(t.filter(e=>e).map(e=>e.name)).sort()}).catch(()=>[]),[],[e.namespace,t.name]),l=(e,t,r)=>{const l=[...n];l[r][e]=t,a(l)};/* @__PURE__ */
|
|
230
|
+
return Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-12 small"},/* @__PURE__ */Ht.createElement("h5",null,"Dimensions"))),n.map((t,n)=>/* @__PURE__ */Ht.createElement("div",{key:`dimension-${n}`,className:"row dimensions-row horizontal middle"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-6"},/* @__PURE__ */Ht.createElement(g,{onChange:e=>l("name",e.target.value,n),value:t.name,stringOptions:r})),/* @__PURE__ */Ht.createElement(p,{onChange:e=>l("value",e.target.value,n),value:t.value}),!e.disableEditingDimensions&&/* @__PURE__ */Ht.createElement("div",{className:"col-md-1",onClick:()=>(t=>{const n=e.dimensions.filter((e,a)=>a!==t);a(n)})(n)},/* @__PURE__ */Ht.createElement("a",null,/* @__PURE__ */Ht.createElement("i",{className:"glyphicon glyphicon-trash clickable"}))))),!e.disableEditingDimensions&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("button",{type:"button",className:"btn btn-block btn-xs add-new",onClick:()=>{const e=[...n,{}];a(e)}},/* @__PURE__ */Ht.createElement("span",{className:"glyphicon glyphicon-plus-sign sp-margin-xs-left"}),"Add dimension"))))},Oc=["AWS/ApplicationELB","AWS/AutoScaling","AWS/AmazonMQ","AWS/Billing","AWS/CloudFront","AWS/CloudSearch","AWS/Events","AWS/DynamoDB","AWS/ECS","AWS/ElastiCache","AWS/EBS","AWS/EC2","AWS/ELB","AWS/ElasticMapReduce","AWS/ES","AWS/Kinesis","AWS/Lambda","AWS/ML","AWS/OpsWorks","AWS/Redshift","AWS/RDS","AWS/Route53","AWS/SNS","AWS/SQS","AWS/S3","AWS/SWF","AWS/StorageGateway","AWS/WAF","AWS/WorkSpaces"],$c=({alarm:e,updateAlarm:t,serverGroup:a})=>{var n;const r=((null==(n=null==Cn?void 0:Cn.metrics)?void 0:n.customNamespaces)||[]).concat(Oc),[l,s]=Ht.useState(!1),i=((null==e?void 0:e.dimensions)||[]).reduce((e,t)=>(e[t.name]=t.value,e),{}),{result:o}=b(()=>{const t="aws"===a.cloudProvider?a.account:null==a?void 0:a.awsAccount,n=l?{namespace:null==e?void 0:e.namespace}:{AutoScalingGroupName:a.name};return Mt.listMetrics("aws",t,a.region,n).then(e=>(e||[]).map(e=>{return{label:`(${e.namespace}) ${e.name}`,dimensions:[],dimensionValues:(t=e.dimensions||[],t.sort((e,t)=>{var a;return null==(a=e.name)?void 0:a.localeCompare(t.name)}).map(e=>e.value).join(", ")),value:e,...e};var t}).sort((e,t)=>{var a;return null==(a=e.label)?void 0:a.localeCompare(t.label)})).catch(()=>[])},[],[a,null==e?void 0:e.namespace]),d=(o||[]).filter(t=>t.namespace===(null==e?void 0:e.namespace)),m=d.find(t=>t.name===(null==e?void 0:e.metricName)&&t.namespace===(null==e?void 0:e.namespace))||d.find(e=>e.name.match("CPUUtilization"))||d[0],{name:u,namespace:p}=m||{},h=()=>{const n=!l;if(n)i.namespace=null==e?void 0:e.namespace;else{const n={...e,dimension:[{name:"AutoScalingGroupName",value:a.name}]};t(n)}s(n)},v=a=>{const n={...e,metricName:a.name,namespace:a.namespace,dimensions:a.dimensions};t(n)},f=(a,n)=>{const r={...e,metricName:n,namespace:a};t(r)};return Ht.useEffect(()=>{m&&v(m)},[m]),l?/* @__PURE__ */Ht.createElement("div",{className:"MetricSelector"},/* @__PURE__ */Ht.createElement("div",{className:"horizontal middle"},/* @__PURE__ */Ht.createElement(g,{value:p,onChange:t=>f(t.target.value,null==e?void 0:e.metricName),stringOptions:r,inputClassName:"advanced-input-namespace sp-margin-m-right"}),/* @__PURE__ */Ht.createElement(g,{value:u,onChange:t=>f(null==e?void 0:e.namespace,t.target.value),stringOptions:o.map(e=>e.name),placeholder:"name",searchable:!0,inputClassName:"advanced-input-metric"})),/* @__PURE__ */Ht.createElement("div",{className:"vertical"},!Boolean(o.length)&&/* @__PURE__ */Ht.createElement("span",{className:"input-label"},/* @__PURE__ */Ht.createElement("b",null,"Note:")," no metrics found for selected namespace + dimensions"),/* @__PURE__ */Ht.createElement("a",{className:"clickable",onClick:h},/* @__PURE__ */Ht.createElement("span",{className:"sp-margin-s-yaxis sp-margin-xs-right"},"Only show metrics for this auto scaling group"),/* @__PURE__ */Ht.createElement(c,{id:"aws.scalingPolicy.search.restricted"}))),/* @__PURE__ */Ht.createElement(zc,{alarm:e,serverGroup:a,updateAvailableMetrics:a=>{const n={...e,dimensions:a};t(n)}})):/* @__PURE__ */Ht.createElement("div",{className:"MetricSelector horizontal middle"},/* @__PURE__ */Ht.createElement(g,{value:m,onChange:e=>v(e.target.value),options:o,clearable:!1,inputClassName:"sp-margin-s-right simple-input"}),/* @__PURE__ */Ht.createElement("a",{className:"clickable",onClick:h},/* @__PURE__ */Ht.createElement("span",{className:"sp-margin-xs-right"},"Search all metrics"),/* @__PURE__ */Ht.createElement(c,{id:"aws.scalingPolicy.search.all"})))},Uc=({allowDualMode:e,cloudwatch:t,command:a,isCustomMetric:n,app:r,serverGroup:l,toggleMetricType:s,updateCommand:i})=>{var o,c,d,m;const[u,p]=Ht.useState(null),h=(e,t)=>{const n=Xt(a);ha(n,e,t),i(n)};/* @__PURE__ */
|
|
231
|
+
return Ht.createElement("div",{className:"TargetMetricFields sp-margin-l-xaxis"},/* @__PURE__ */Ht.createElement("p",null,"With target tracking policies, Amazon will automatically adjust the size of your ASG to keep the selected metric as close as possible to the selected value."),t&&/* @__PURE__ */Ht.createElement("p",null,/* @__PURE__ */Ht.createElement("b",null,"Note:"),' metrics must be sent to Amazon CloudWatch before they can be used in auto scaling. If you do not see a metric below, click "Configure available metrics" in the server group details to set up forwarding from Atlas to CloudWatch.'),/* @__PURE__ */Ht.createElement("div",{className:"row sp-margin-s-yaxis"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Metric"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 content-fields"},!n&&/* @__PURE__ */Ht.createElement(g,{value:null==(o=a.targetTrackingConfiguration.predefinedMetricSpecification)?void 0:o.predefinedMetricType,stringOptions:["ASGAverageCPUUtilization","ASGAverageNetworkOut","ASGAverageNetworkIn","ALBRequestCountPerTarget"],onChange:e=>h("targetTrackingConfiguration.predefinedMetricSpecification.predefinedMetricType",e.target.value),inputClassName:"metric-select-input"}),n&&/* @__PURE__ */Ht.createElement($c,{alarm:a.targetTrackingConfiguration.customizedMetricSpecification,serverGroup:l,updateAlarm:e=>{h("targetTrackingConfiguration.customizedMetricSpecification",e)}}),e&&/* @__PURE__ */Ht.createElement("a",{className:"clickable",onClick:()=>{const e=Xt(a);n?(ha(e,"targetTrackingConfiguration.predefinedMetricSpecification",{predefinedMetricType:"ASGAverageCPUUtilization"}),ha(e,"targetTrackingConfiguration.customizedMetricSpecification",null)):(ha(e,"targetTrackingConfiguration.predefinedMetricSpecification",null),ha(e,"targetTrackingConfiguration.customizedMetricSpecification",{metricName:"CPUUtilization",namespace:"AWS/EC2",dimensions:[{name:"AutoScalingGroupName",value:l.name}],statistic:"Average"})),i(e),s(n?"predefined":"custom")}},n?"Use a predefined metric":"Select a custom metric"))),!n&&"ALBRequestCountPerTarget"===(null==(c=a.targetTrackingConfiguration.predefinedMetricSpecification)?void 0:c.predefinedMetricType)&&/* @__PURE__ */Ht.createElement("div",{className:"row sp-margin-s-yaxis"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Target Group"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 content-fields horizontal"},/* @__PURE__ */Ht.createElement(g,{value:null==(d=a.targetTrackingConfiguration.predefinedMetricSpecification)?void 0:d.resourceLabel,options:r.loadBalancers.data.filter(e=>e.account===l.account&&e.region===l.region).flatMap(e=>e.targetGroups.filter(e=>l.targetGroups.some(t=>t===e.name)).map(t=>({...t,loadBalancerArn:e.loadBalancerArn}))).map(e=>({label:e.name,value:`${e.loadBalancerArn.substring(e.loadBalancerArn.indexOf("app"))}/${e.targetGroupArn.substring(e.targetGroupArn.indexOf("targetgroup"))}`})),onChange:e=>h("targetTrackingConfiguration.predefinedMetricSpecification.resourceLabel",e.target.value),inputClassName:"metric-select-input"}))),/* @__PURE__ */Ht.createElement("div",{className:"row sp-margin-s-yaxis"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Target"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 content-fields horizontal"},n&&/* @__PURE__ */Ht.createElement("div",{className:"horizontal middle"},/* @__PURE__ */Ht.createElement(g,{value:null==(m=a.targetTrackingConfiguration.customizedMetricSpecification)?void 0:m.statistic,stringOptions:["Average","Maximum","Minimum","SampleCount","Sum"],onChange:e=>h("targetTrackingConfiguration.customizedMetricSpecification.statistic",e.target.value),inputClassName:"form-control input-sm target-input"}),/* @__PURE__ */Ht.createElement("span",{className:"sp-margin-xs-xaxis"},"of")),/* @__PURE__ */Ht.createElement("div",{className:"horizontal middle"},/* @__PURE__ */Ht.createElement(E,{value:a.targetTrackingConfiguration.targetValue,onChange:e=>h("targetTrackingConfiguration.targetValue",Number.parseInt(e.target.value)),inputClassName:"form-control input-sm sp-margin-xs-right"}),/* @__PURE__ */Ht.createElement("span",null,u)))),/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 col-md-offset-1"},/* @__PURE__ */Ht.createElement(Lc,{config:a.targetTrackingConfiguration,serverGroup:l,unit:u,updateUnit:e=>p(e)}))))},Vc=({command:e,policyName:t,updateCommand:a})=>{var n;const r=(t,n)=>{const r={...e};ha(r,t,n),a(r)},l=null==(n=e.targetTrackingConfiguration)?void 0:n.disableScaleIn;/* @__PURE__ */
|
|
232
|
+
return Ht.createElement("div",{className:"section-body TargetTrackingAdditionalSettings"},t&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Policy Name"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},t)),Boolean(e.estimatedInstanceWarmup)&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Warmup"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement("span",{className:"form-control-static"},"Instances need"),/* @__PURE__ */Ht.createElement(E,{value:e.estimatedInstanceWarmup,onChange:e=>r("estimatedInstanceWarmup",Number.parseInt(e.target.value)),inputClassName:"form-control number-input-sm sp-margin-xs-xaxis"}),/* @__PURE__ */Ht.createElement("span",{className:"input-label"}," seconds to warm up "))),/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Scale In"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-9"},/* @__PURE__ */Ht.createElement("div",{className:"checkbox"},/* @__PURE__ */Ht.createElement(v,{text:"Disable Scale-downs",checked:l,onChange:e=>r("targetTrackingConfiguration.disableScaleIn",e.target.checked)}),/* @__PURE__ */Ht.createElement("div",{className:"small"},/* @__PURE__ */Ht.createElement("p",null,"This option disables scale-downs for the target tracking policy, while keeping the scale-ups. This means that ASG will not scale down unless you explicitly set up a separate step policy to scale it down."),/* @__PURE__ */Ht.createElement("p",null,"This is useful when you have special requirements, such as gradual or delayed scale-down."))))),/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 col-md-offset-1"},l&&/* @__PURE__ */Ht.createElement("div",{className:"well"},"This policy will not scale down. Make sure you have another policy (either TT or Step) that will scale down this ASG."),!1===l&&/* @__PURE__ */Ht.createElement("div",{className:"well"},"This policy will scale both up and down. Make sure you don't have other scaling policies, as they will likely interfere with each other."))))},Hc={buildAlarm:(e,t,a)=>{const n=(null==e?void 0:e.alarms)?e.alarms[0]:{};return{name:n.alarmName,actionsEnabled:!0,alarmActionArns:n.alarmActions,alarmDescription:n.alarmDescription,asgName:a,comparisonOperator:n.comparisonOperator,dimensions:n.dimensions,evaluationPeriods:n.evaluationPeriods,insufficientDataActionArns:n.insufficientDataActions,metricName:n.metricName,namespace:n.namespace,okActionArns:In(n),period:n.period,region:t,statistic:n.statistic,threshold:n.threshold,unit:n.unit}},buildStepPolicy:(e,t,a)=>{var n,r;const l=e.stepAdjustments.map(e=>{const a={scalingAdjustment:Math.abs(e.scalingAdjustment)};return void 0!==e.metricIntervalUpperBound&&(a.metricIntervalUpperBound=e.metricIntervalUpperBound+t),void 0!==e.metricIntervalLowerBound&&(a.metricIntervalLowerBound=e.metricIntervalLowerBound+t),a});return{estimatedInstanceWarmup:null!=(r=null!=(n=e.estimatedInstanceWarmup)?n:a)?r:600,metricAggregationType:"Average",stepAdjustments:l}},buildSimplePolicy:e=>{var t,a;return{cooldown:null!=(t=e.cooldown)?t:600,scalingAdjustment:null!=(a=Math.abs(e.scalingAdjustment))?a:1}},buildNewCommand:(e,t,a)=>{var n,r,l;const s={name:a.policyName,adjustmentType:"Step"===e?a.adjustmentType:null,cloudProvider:t.cloudProvider,credentials:t.account,provider:t.type,region:t.region,serverGroupName:t.name};return"Step"===e&&(s.alarm=Hc.buildAlarm(a,t.region,t.name),s.minAdjustmentMagnitude=null!=(n=a.minAdjustmentMagnitude)?n:1,(null==(r=a.stepAdjustments)?void 0:r.length)?s.step=Hc.buildStepPolicy(a,s.alarm.threshold,s.cooldown):s.simple=Hc.buildSimplePolicy(a)),"TargetTracking"===e&&(s.estimatedInstanceWarmup=null!=(l=a.estimatedInstanceWarmup)?l:600,s.targetTrackingConfiguration={...a.targetTrackingConfiguration}),s},prepareCommandForUpsert:(e,t)=>{const a=Xt(e);return"PercentChangeInCapacity"!==a.adjustmentType&&delete a.minAdjustmentMagnitude,a.step?a.step.stepAdjustments.forEach(e=>{t&&(e.scalingAdjustment=0-e.scalingAdjustment,delete a.step.estimatedInstanceWarmup),void 0!==e.metricIntervalLowerBound&&(e.metricIntervalLowerBound-=a.alarm.threshold),void 0!==e.metricIntervalUpperBound&&(e.metricIntervalUpperBound-=a.alarm.threshold)}):t&&(e.simple.scalingAdjustment=0-e.simple.scalingAdjustment),a}},qc=({app:e,closeModal:t,dismissModal:a,policy:n,serverGroup:r})=>{var l;const[s,i]=Ht.useState(Boolean(null==(l=n.targetTrackingConfiguration)?void 0:l.customizedMetricSpecification)),[o,c]=Ht.useState({});Ht.useEffect(()=>{const e=Hc.buildNewCommand("TargetTracking",r,n);c(e)},[]);const d=n.policyName?"Update":"Create";/* @__PURE__ */
|
|
233
|
+
return Ht.createElement(Rt,{closeModal:t,dismissModal:a,title:`${d} scaling policy`,application:e,description:`${d} scaling policy for ${r.name}`,initialValues:o,mapValuesToTask:()=>({application:e,job:[{type:"upsertScalingPolicy",...o}]}),render:()=>/* @__PURE__ */Ht.createElement("div",{className:"modal-body"},/* @__PURE__ */Ht.createElement("h4",{className:"section-heading"},"Target Metric"),/* @__PURE__ */Ht.createElement(Uc,{allowDualMode:!0,cloudwatch:!1,command:o,isCustomMetric:s,app:e,serverGroup:r,toggleMetricType:e=>i("custom"===e),updateCommand:c}),/* @__PURE__ */Ht.createElement("h4",{className:"section-heading"},"Additional Settings"),/* @__PURE__ */Ht.createElement(Vc,{command:o,policyName:n.policyName,updateCommand:c}))})};function Wc(e){const[t,a]=qt.useState(null),n=e=>{a(e.currentTarget.id)},r="step"===t?"card active":"card",l="targetTracking"===t?"card active":"card",s="aws.scalingPolicy.additionalHelp",i=!!O.getHelpField(s);/* @__PURE__ */
|
|
234
|
+
return qt.createElement(Za,{show:!0,onHide:e.showCallback},/* @__PURE__ */qt.createElement(Za.Header,{closeButton:!0},/* @__PURE__ */qt.createElement("h3",null,"Select a policy type")),/* @__PURE__ */qt.createElement(Za.Body,null,/* @__PURE__ */qt.createElement("div",{className:"card-choices"},/* @__PURE__ */qt.createElement("div",{className:l,onClick:n,id:"targetTracking"},/* @__PURE__ */qt.createElement("h3",null,"Target Tracking"),/* @__PURE__ */qt.createElement("div",null,"Continuously adjusts the size of the ASG to keep a specified metric at the target value")),/* @__PURE__ */qt.createElement("div",{className:r,onClick:n,id:"step"},/* @__PURE__ */qt.createElement("h3",null,"Step"),/* @__PURE__ */qt.createElement("div",null,"Rule-based scaling, with the ability to define different scaling amounts depending on the magnitude of the alarm breach"))),i&&/* @__PURE__ */qt.createElement(Se,{type:"info",message:/* @__PURE__ */qt.createElement(c,{id:s,expand:!0})}),e.warnOnMinMaxCapacity&&/* @__PURE__ */qt.createElement(Se,{type:"warning",message:/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("p",null,"This server group's ",/* @__PURE__ */qt.createElement("em",null,"min")," and ",/* @__PURE__ */qt.createElement("em",null,"max")," capacity are identical, so scaling policies will have ",/* @__PURE__ */qt.createElement("b",null,"no effect.")),/* @__PURE__ */qt.createElement("p",null,"Scaling policies work by adjusting the server group's ",/* @__PURE__ */qt.createElement("em",null,"desired")," capacity to a value between the min and max."))})),/* @__PURE__ */qt.createElement(Za.Footer,null,/* @__PURE__ */qt.createElement("button",{className:"btn btn-default",onClick:e.showCallback},"Cancel"),/* @__PURE__ */qt.createElement("button",{className:"btn btn-primary",disabled:!t,onClick:()=>{e.typeSelectedCallback(t)}},"Next")))}const jc=({command:e,isInstanceType:t,isNew:a,operator:n,updateCommand:r})=>{var l,s,i,o;const d=(t,a)=>{const n={...e};ha(n,t,a),r(n)};/* @__PURE__ */
|
|
235
|
+
return Ht.createElement("div",{className:"ScalingPolicyAdditionalSettings"},/* @__PURE__ */Ht.createElement("h4",{className:"section-heading"},"Additional Settings"),/* @__PURE__ */Ht.createElement("div",{className:"section-body section-additional-settings"},!a&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Policy Name"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement("span",{className:"form-control-static select-placeholder"},e.name))),!t&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Adjustment Step"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement("span",{className:"form-control-static select-placeholder"},`${n} instances in increments of at least `),/* @__PURE__ */Ht.createElement(E,{value:e.minAdjustmentMagnitude,onChange:e=>d("minAdjustmentMagnitude",Number.parseInt(e.target.value)),inputClassName:"sp-margin-xs-xaxis input-sm number-input-sm"}),/* @__PURE__ */Ht.createElement("span",{className:"input-label"}," instance(s) "))),Boolean(e.simple)&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Cooldown"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement("span",{className:"form-control-static select-placeholder"}," Wait at least "),/* @__PURE__ */Ht.createElement(E,{value:null==(l=e.simple)?void 0:l.cooldown,onChange:e=>d("simple.cooldown",Number.parseInt(e.target.value)),inputClassName:"sp-margin-xs-xaxis input-sm number-input-sm"}),/* @__PURE__ */Ht.createElement("span",{className:"input-label"}," seconds before another scaling event "))),Boolean(null==(s=e.step)?void 0:s.estimatedInstanceWarmup)&&"Remove"!==n&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Warmup"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement("span",{className:"form-control-static select-placeholder"},"Instances need"),/* @__PURE__ */Ht.createElement(E,{value:e.step.estimatedInstanceWarmup,onChange:e=>d("step.estimatedInstanceWarmup",Number.parseInt(e.target.value)),inputClassName:"sp-margin-xs-xaxis input-sm number-input-sm"}),/* @__PURE__ */Ht.createElement("span",{className:"input-label"}," seconds to warm up after each step "))),Boolean(null==(i=e.step)?void 0:i.cooldown)&&"Remove"!==n&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},/* @__PURE__ */Ht.createElement("span",{className:"sp-margin-xs-right"},"Cooldown"),/* @__PURE__ */Ht.createElement(c,{id:`${e.cloudProvider||e.provider}.autoscaling.cooldown`})),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement(E,{value:null==(o=e.step)?void 0:o.cooldown,onChange:e=>d("step.cooldown",Number.parseInt(e.target.value)),inputClassName:"sp-margin-xs-xaxis input-sm number-input-sm"}),/* @__PURE__ */Ht.createElement("span",{className:"input-label"}," seconds ")))))},Zc=["Average","Maximum","Minimum","SampleCount","Sum"],_c=[{label:">=",value:"GreaterThanOrEqualToThreshold"},{label:">",value:"GreaterThanThreshold"},{label:"<=",value:"LessThanOrEqualToThreshold"},{label:"<",value:"LessThanThreshold"}],Kc=[{label:"1 minute",value:60},{label:"5 minutes",value:300},{label:"15 minutes",value:900},{label:"1 hour",value:3600},{label:"4 hours",value:14400},{label:"1 day",value:86400}],Yc=({alarm:e,multipleAlarms:t,serverGroup:a,stepAdjustments:n,stepsChanged:r,updateAlarm:l})=>{var s,i;const o=0===(null==(s=e.comparisonOperator)?void 0:s.indexOf("Greater"))?"max":"min",[c,d]=Ht.useState(null==e?void 0:e.unit),m=It(o);Ht.useEffect(()=>{if(n&&void 0!==m){const t="max"===o?"metricIntervalLowerBound":"metricIntervalUpperBound",a={scalingAdjustment:1,[t]:e.threshold};r([a])}},[o]),Ht.useEffect(()=>{const t="max"===o?"metricIntervalLowerBound":"metricIntervalUpperBound";if(null==n?void 0:n.length){const a=[...n];a[0][t]=e.threshold,r(a)}},[e.threshold]);const u=(t,a)=>{const n={...e,[t]:a};l(n)};/* @__PURE__ */
|
|
236
|
+
return Ht.createElement("div",{className:"AlarmConfigurer"},t&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-12"},/* @__PURE__ */Ht.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */Ht.createElement("p",null,/* @__PURE__ */Ht.createElement("i",{className:"fa fa-exclamation-triangle"})," This scaling policy is configured with multiple alarms. You are only editing the first alarm."),/* @__PURE__ */Ht.createElement("p",null,"To edit or remove the additional alarms, you will need to use the AWS console.")))),(null==(i=e.alarmActionArns)?void 0:i.length)>1&&/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-12"},/* @__PURE__ */Ht.createElement("div",{className:"alert alert-warning"},/* @__PURE__ */Ht.createElement("p",null,/* @__PURE__ */Ht.createElement("i",{className:"fa fa-exclamation-triangle"})," This alarm is used in multiple scaling policies. Any changes here will affect those other scaling policies.")))),/* @__PURE__ */Ht.createElement("div",{className:"row sp-margin-s-yaxis"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"Whenever"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal"},/* @__PURE__ */Ht.createElement(g,{value:e.statistic,onChange:e=>u("statistic",e.target.value),stringOptions:Zc,clearable:!1,inputClassName:"sp-margin-xs-right configurer-field-lg"}),/* @__PURE__ */Ht.createElement("span",{className:"input-label sp-margin-xs-right sp-margin-s-top"}," of "),/* @__PURE__ */Ht.createElement($c,{alarm:e,serverGroup:a,updateAlarm:e=>{l(e)}}))),/* @__PURE__ */Ht.createElement("div",{className:"row sp-margin-s-yaxis"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"is"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement(g,{value:e.comparisonOperator,onChange:e=>u("comparisonOperator",e.target.value),options:_c,clearable:!1,inputClassName:"sp-margin-s-right configurer-field-small"}),/* @__PURE__ */Ht.createElement("div",{className:"sp-margin-xl-left"},/* @__PURE__ */Ht.createElement(E,{value:e.threshold,onChange:e=>u("threshold",Number.parseInt(e.target.value)),inputClassName:"sp-margin-xs-right configurer-field-lg"})),/* @__PURE__ */Ht.createElement("span",{className:"input-label"},c))),/* @__PURE__ */Ht.createElement("div",{className:"row sp-margin-s-yaxis"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-2 sm-label-right"},"for at least"),/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 horizontal middle"},/* @__PURE__ */Ht.createElement(E,{value:e.evaluationPeriods,onChange:e=>u("evaluationPeriods",Number.parseInt(e.target.value)),inputClassName:"configurer-field-med number-input-field"}),/* @__PURE__ */Ht.createElement("span",{className:"input-label sp-margin-s-xaxis"}," consecutive period(s) of "),/* @__PURE__ */Ht.createElement(g,{value:e.period,onChange:e=>u("period",e.target.value),options:Kc,clearable:!1,inputClassName:"sp-margin-xs-right configurer-field-lg"}))),/* @__PURE__ */Ht.createElement("div",{className:"row sp-margin-s-yaxis"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 col-md-offset-1"},e&&/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement(Fc,{alarm:e,serverGroup:a,onChartLoaded:e=>d(e.unit)})))))},Xc=({adjustmentType:e,adjustmentTypeChanged:t,operator:a,scalingAdjustment:n,updateScalingAdjustment:r})=>{const l="Set to"===a?["instances"]:["instances","percent of group"],[s,i]=Ht.useState(e),[o,c]=Ht.useState(n);/* @__PURE__ */
|
|
237
|
+
return Ht.createElement("div",{className:"SimplePolicyAction row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 col-md-offset-1 horizontal middle"},/* @__PURE__ */Ht.createElement(g,{value:a,stringOptions:["Add","Remove","Set to"],onChange:a=>{return n=a.target.value,void t(n,e);var n},clearable:!1,inputClassName:"action-input"}),/* @__PURE__ */Ht.createElement(E,{value:o,min:1,onChange:e=>{return t=Number.parseInt(e.target.value),c(t),void r(t);var t},inputClassName:"action-input"}),/* @__PURE__ */Ht.createElement(g,{value:s,stringOptions:l,onChange:e=>{return n=e.target.value,i(n),void t(a,n);var n},clearable:!1,inputClassName:"adjustment-type-input"})))},Jc=({adjustmentType:e,adjustmentTypeChanged:t,alarm:a,isMin:n,operator:r,step:l,stepAdjustments:s,stepsChanged:i})=>{const o=null==a?void 0:a.comparisonOperator.includes("Equal"),c=["Add","Remove","Set to"],d="Set to"===r?["instances"]:["instances","percent of group"],m=(null==l?void 0:l.stepAdjustments)||s,u=(e,t)=>{const a=[...m];a[t]=e,i(a)};/* @__PURE__ */
|
|
238
238
|
return Ht.createElement("div",{className:"StepPolicyAction row"},null==m?void 0:m.map((l,s)=>/* @__PURE__ */Ht.createElement("div",{key:`step-adjustment-${s}`,className:"step-policy-row col-md-10 col-md-offset-1 horizontal middle"},Boolean(s)?/* @__PURE__ */Ht.createElement("span",{className:"action-input sp-margin-xs-left"},r):/* @__PURE__ */Ht.createElement(g,{value:r,stringOptions:c,onChange:a=>{return n=a.target.value,void t(n,e);var n},clearable:!1,inputClassName:"action-input sp-margin-xs-right"}),/* @__PURE__ */Ht.createElement(E,{value:l.scalingAdjustment,min:1,onChange:e=>u({...l,scalingAdjustment:Number.parseInt(e.target.value)},s),inputClassName:"action-input"}),Boolean(s)?/* @__PURE__ */Ht.createElement("span",{className:"sp-margin-xs-left"},e):/* @__PURE__ */Ht.createElement(g,{value:e,stringOptions:d,onChange:e=>{return a=e.target.value,void t(r,a);var a},clearable:!1,inputClassName:"adjustment-type-input sp-margin-xs-left"}),/* @__PURE__ */Ht.createElement("span",{className:"sp-margin-xs-xaxis"}," ","when ",/* @__PURE__ */Ht.createElement("b",null,null==a?void 0:a.metricName)," is"," "),s===m.length-1&&/* @__PURE__ */Ht.createElement("span",null,` ${n?"less":"greater"} than${!Boolean(s)||o?" or equal to":""} ${n?l.metricIntervalUpperBound||"":l.metricIntervalLowerBound||""} `),s<m.length-1&&/* @__PURE__ */Ht.createElement(Ht.Fragment,null,/* @__PURE__ */Ht.createElement("span",{className:"sp-margin-xs-xaxis"},"between"),n?/* @__PURE__ */Ht.createElement(E,{value:l.metricIntervalLowerBound,max:l.metricIntervalUpperBound,step:.1,onChange:e=>u({...l,metricIntervalLowerBound:Number.parseFloat(e.target.value)},s),inputClassName:"action-input"}):/* @__PURE__ */Ht.createElement("span",null,l.metricIntervalLowerBound),/* @__PURE__ */Ht.createElement("span",{className:"sp-margin-xs-xaxis"},"and"),n?/* @__PURE__ */Ht.createElement("span",null,l.metricIntervalUpperBound):/* @__PURE__ */Ht.createElement(E,{value:l.metricIntervalUpperBound,min:l.metricIntervalLowerBound,step:.1,onChange:e=>u({...l,metricIntervalUpperBound:Number.parseFloat(e.target.value)},s),inputClassName:"action-input"})),Boolean(s)&&/* @__PURE__ */Ht.createElement("a",{className:"glyphicon glyphicon-trash clickable sp-margin-xs-xaxis remove-step-action-icon",onClick:()=>(e=>{const t=m.filter((t,a)=>a!==e);i(t)})(s)}))),/* @__PURE__ */Ht.createElement("div",{className:"row sp-margin-s"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 col-md-offset-1"},/* @__PURE__ */Ht.createElement("button",{type:"button",className:"btn btn-block btn-sm add-new",onClick:()=>{const e=[...m,{scalingAdjustment:1}];i(e)}},/* @__PURE__ */Ht.createElement("span",{className:"glyphicon glyphicon-plus-sign"}),"Add step"))),/* @__PURE__ */Ht.createElement("div",{className:"row sp-margin-s-xaxis"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 col-md-offset-1"},/* @__PURE__ */Ht.createElement("a",{href:"http://docs.aws.amazon.com/autoscaling/latest/userguide/as-scale-based-on-demand.html#as-scaling-steps",target:"_blank"},
|
|
239
|
-
/* @__PURE__ */Ht.createElement("i",{className:"far fa-file-alt sp-margin-xs-right"}),"Documentation"))))},
|
|
240
|
-
return Ht.createElement(Rt,{...o,title:`${v} scaling policy`,application:e,description:`${v} scaling policy for ${r.name}`,initialValues:c,mapValuesToTask:()=>{const t=
|
|
241
|
-
return Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("h4",{className:"section-heading"},"Conditions"),/* @__PURE__ */Ht.createElement("div",{className:"section-body"},/* @__PURE__ */Ht.createElement(
|
|
242
|
-
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.handleClick},"Create new scaling policy"),this.state.showSelection&&/* @__PURE__ */qt.createElement(
|
|
243
|
-
return Ht.createElement("div",null,/* @__PURE__ */Ht.createElement(q,{className:"dl-horizontal dl-narrow"},/* @__PURE__ */Ht.createElement(U,{label:"Whenever",value:`${d.statistic} of ${d.metricName} is ${
|
|
244
|
-
return Ht.createElement("div",{className:"StepPolicySummary"},/* @__PURE__ */Ht.createElement("div",null,!Boolean(null==(n=t.alarms)?void 0:n.length)&&/* @__PURE__ */Ht.createElement("div",null,"No alarms configured for this policy - it's safe to delete."),Boolean(null==(r=t.alarms)?void 0:r.length)&&t.alarms.map(e=>/* @__PURE__ */Ht.createElement("div",{key:`step-summary-${t.policyName}`},/* @__PURE__ */Ht.createElement(ue,{Component:()=>/* @__PURE__ */Ht.createElement(
|
|
245
|
-
/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("div",{className:"label label-default"},Z(t.policyType).toUpperCase()),/* @__PURE__ */Ht.createElement(
|
|
239
|
+
/* @__PURE__ */Ht.createElement("i",{className:"far fa-file-alt sp-margin-xs-right"}),"Documentation"))))},Qc=({app:e,closeModal:t,dismissModal:a,policy:n,serverGroup:r})=>{var l,s,i;const o={closeModal:t,dismissModal:a},[c,d]=Ht.useState({});Ht.useEffect(()=>{const e=Hc.buildNewCommand("Step",r,n);d(e)},[]);const m=(null==(l=n.stepAdjustments)?void 0:l.length)?n.stepAdjustments[0].scalingAdjustment:n.scalingAdjustment,[u,p]=Ht.useState("ExactCapacity"===c.adjustmentType?"Set to":m>0?"Add":"Remove"),h="ExactCapacity"===c.adjustmentType||"ChangeInCapacity"===c.adjustmentType?"instances":"percent of group",g=c.step,v=n.policyARN?"Edit":"Create",f=0===(null==(i=null==(s=null==c?void 0:c.alarm)?void 0:s.comparisonOperator)?void 0:i.indexOf("Greater"))?"max":"min",E=e=>{const t="min"===f?"metricIntervalLowerBound":"metricIntervalUpperBound",a="metricIntervalLowerBound"===t?"metricIntervalUpperBound":"metricIntervalLowerBound",n=e.stepAdjustments;(n||[]).forEach((e,r)=>{n.length>r+1&&(n[r+1][a]=e[t])}),delete n[n.length-1][t]},y=e=>{const t=Xt(c);t.simplescalingAdjustment=e,d(t)},b=e=>{const t=Xt(c);t.step.stepAdjustments=e,E(t.step),d(t)},C=(e,t)=>{p(e);const a="instances"!==t?"PercentChangeInCapacity":"Set to"===e?"ExactCapacity":"ChangeInCapacity";d({...c,adjustmentType:a})},N=()=>{const e=Xt(c),t=c.step?c.step.estimatedInstanceWarmup:c.simple.cooldown;if(c.step)delete e.step,e.simple=Hc.buildSimplePolicy({cooldown:t});else{const a=[{scalingAdjustment:c.simple.scalingAdjustment}];"min"===f?a[0].metricIntervalUpperBound=0:a[0].metricIntervalLowerBound=0;const n={estimatedInstanceWarmup:t,stepAdjustments:a};delete e.simple,e.step=Hc.buildStepPolicy(n,e.alarm.threshold,t),E(e.step)}d(e)};/* @__PURE__ */
|
|
240
|
+
return Ht.createElement(Rt,{...o,title:`${v} scaling policy`,application:e,description:`${v} scaling policy for ${r.name}`,initialValues:c,mapValuesToTask:()=>{const t=Hc.prepareCommandForUpsert(c,"Remove"===u);return{application:e,job:[{type:t.type||"upsertScalingPolicy",...t}]}},render:()=>{var e,t,a,l,s;/* @__PURE__ */
|
|
241
|
+
return Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("h4",{className:"section-heading"},"Conditions"),/* @__PURE__ */Ht.createElement("div",{className:"section-body"},/* @__PURE__ */Ht.createElement(Yc,{alarm:c.alarm,multipleAlarms:Boolean((null==(e=null==n?void 0:n.alarms)?void 0:e.length)>1),serverGroup:r,stepAdjustments:c.step.stepAdjustments,stepsChanged:b,updateAlarm:e=>d({...c,alarm:e})})),/* @__PURE__ */Ht.createElement("h4",{className:"section-heading"},"Actions"),/* @__PURE__ */Ht.createElement("div",{className:"section-body"},!(null==(t=c.alarm)?void 0:t.metricName)&&/* @__PURE__ */Ht.createElement("h4",{className:"text-center"},"Select a metric"),(null==(a=c.alarm)?void 0:a.metricName)&&!g&&/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("div",{className:"row"},/* @__PURE__ */Ht.createElement("div",{className:"col-md-10 col-md-offset-1"},/* @__PURE__ */Ht.createElement("p",null,"This is a simple scaling policy. To declare different actions based on the magnitude of the alarm,",/* @__PURE__ */Ht.createElement("b",null,"switch to a",/* @__PURE__ */Ht.createElement("a",{className:"clickable sp-margin-xs-l",onClick:N},"step policy"),".")))),/* @__PURE__ */Ht.createElement(Xc,{adjustmentType:h,adjustmentTypeChanged:C,operator:u,scalingAdjustment:null==(l=c.simple)?void 0:l.scalingAdjustment,updateScalingAdjustment:y})),(null==(s=c.alarm)?void 0:s.metricName)&&g&&/* @__PURE__ */Ht.createElement(Jc,{adjustmentType:h,adjustmentTypeChanged:C,alarm:c.alarm,isMin:"min"===f,operator:u,step:c.step,stepsChanged:b})),/* @__PURE__ */Ht.createElement(jc,{command:c,isInstanceType:"instances"===h,isNew:Boolean(!n.policyARN),operator:u,updateCommand:d}))}})};class ed extends qt.Component{constructor(e){super(e),this.handleClick=()=>{this.setState({showSelection:!0})},this.typeSelected=e=>{this.setState({typeSelection:e,showSelection:!1,showModal:!0}),"step"===e&&this.createStepPolicy(),"targetTracking"===e&&this.createTargetTrackingPolicy()},this.showModalCallback=()=>{this.setState({showSelection:!1,showModal:!1,typeSelection:null})},this.state={showSelection:!1,showModal:!1,typeSelection:null}}createStepPolicy(){const{serverGroup:e,application:t}=this.props,a={app:t,policy:cr.awsServerGroupTransformer.constructNewStepScalingPolicyTemplate(e),serverGroup:e};I.show(Qc,a,{dialogClassName:"wizard-modal modal-lg"})}createTargetTrackingPolicy(){const{serverGroup:e,application:t}=this.props,a={app:t,policy:cr.awsServerGroupTransformer.constructNewTargetTrackingPolicyTemplate(),serverGroup:e};I.show(qc,a,{dialogClassName:"wizard-modal modal-lg"})}render(){const{min:e,max:t}=this.props.serverGroup.capacity;/* @__PURE__ */
|
|
242
|
+
return qt.createElement("div",null,/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.handleClick},"Create new scaling policy"),this.state.showSelection&&/* @__PURE__ */qt.createElement(Wc,{warnOnMinMaxCapacity:e===t,typeSelectedCallback:this.typeSelected,showCallback:this.showModalCallback}))}}class td{static upsertScalingPolicy(e,t){return t.type=t.type||"upsertScalingPolicy",X.executeTask({application:e,description:"Upsert scaling policy "+(t.name||t.serverGroupName),job:[t]})}static deleteScalingPolicy(e,t,a){return X.executeTask({application:e,description:"Delete scaling policy "+a.policyName,job:[{type:"deleteScalingPolicy",cloudProvider:"aws",credentials:t.account,region:t.region,policyName:a.policyName,serverGroupName:t.name}]})}}const ad={GreaterThanOrEqualToThreshold:">=",GreaterThanThreshold:">",LessThanOrEqualToThreshold:"<=",LessThanThreshold:"<"},nd=({alarm:e})=>/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("b",null,"Whenever"),` ${e.statistic} of ${e.metricName}`),/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("b",null,"for at least"),` ${e.evaluationPeriods} consecutive periods of ${e.period} seconds`)),rd=({policy:e,serverGroup:t})=>{var a;const{adjustmentType:n,alarms:r,cooldown:l,estimatedInstanceWarmup:s,minAdjustmentMagnitude:i,stepAdjustments:o}=e,c=!!l||"decrease"===(null==(a=null==o?void 0:o[0])?void 0:a.operator),d=r[0]||{},m=null==d?void 0:d.comparisonOperator.includes("Greater"),u=e=>"ExactCapacity"===n?`set capacity to ${e.scalingAdjustment} instance${e.scalingAdjustment>1?"s":""}`:`${e.operator} capacity by ${e.absAdjustment}${"PercentChangeInCapacity"===n?"%":" instance"}${"ChangeInCapacity"===n&&e.absAdjustment>1?"s":""}`;/* @__PURE__ */
|
|
243
|
+
return Ht.createElement("div",null,/* @__PURE__ */Ht.createElement(q,{className:"dl-horizontal dl-narrow"},/* @__PURE__ */Ht.createElement(U,{label:"Whenever",value:`${d.statistic} of ${d.metricName} is ${ad[d.comparisonOperator]} ${d.threshold}`}),/* @__PURE__ */Ht.createElement(U,{label:"for at least",value:`${d.evaluationPeriods} consecutive periods of ${d.period} seconds`}),Boolean(null==o?void 0:o.length)&&/* @__PURE__ */Ht.createElement(U,{label:"then",value:o.map((e,t)=>/* @__PURE__ */Ht.createElement("div",{key:`step-adjustment-boundary-${t}`},o.length>1&&/* @__PURE__ */Ht.createElement("span",null,(e=>{const t=void 0!==e.metricIntervalLowerBound&&void 0!==e.metricIntervalUpperBound?`is between ${d.threshold+e.metricIntervalLowerBound} and ${d.threshold+e.metricIntervalUpperBound} `:"",a=m?e.metricIntervalLowerBound:e.metricIntervalUpperBound,n=`is ${m?"greater":"less"} than ${d.threshold+a}`;return`if ${d.metricName} ${t}${n}`})(e)),/* @__PURE__ */Ht.createElement("span",null,u(e))))}),!Boolean(null==o?void 0:o.length)&&/* @__PURE__ */Ht.createElement(U,{label:"then",value:u(e)}),Boolean(i)&&/* @__PURE__ */Ht.createElement(U,{label:"in",value:`increments of at least ${i} instance${i>1?"s":""}`}),Boolean(c)&&/* @__PURE__ */Ht.createElement(U,{label:"wait",value:`${l} seconds before allowing another scaling activity.`}),Boolean(s)&&/* @__PURE__ */Ht.createElement(U,{label:"wait",value:`${s} seconds to warm up after each step.`})),/* @__PURE__ */Ht.createElement(Fc,{alarm:d,serverGroup:t}))},ld=({application:e,policy:t,serverGroup:a})=>{var n,r;const l=a.type||a.cloudProvider||"aws",s=ze.getValue(l,"serverGroup"),i="aws"===l?t.policyName:t.id,o=s.UpsertStepPolicyModal,c=()=>{const n={app:e,policy:t,serverGroup:a};I.show(o,n,{dialogClassName:"wizard-modal modal-lg"})},d=()=>{const n={application:e,title:`Deleting scaling policy ${i}`},r={type:"deleteScalingPolicy",cloudProvider:l,credentials:a.account,region:a.region,scalingPolicyID:t.id,serverGroupName:a.name};"aws"===l&&(delete r.scalingPolicyID,r.policyName=t.policyName),x.confirm({header:`Really delete ${i}?`,buttonText:"Delete scaling policy",account:a.account,taskMonitorConfig:n,submitMethod:()=>X.executeTask({application:e,description:`Delete scaling policy ${i}`,job:[r]})})};/* @__PURE__ */
|
|
244
|
+
return Ht.createElement("div",{className:"StepPolicySummary"},/* @__PURE__ */Ht.createElement("div",null,!Boolean(null==(n=t.alarms)?void 0:n.length)&&/* @__PURE__ */Ht.createElement("div",null,"No alarms configured for this policy - it's safe to delete."),Boolean(null==(r=t.alarms)?void 0:r.length)&&t.alarms.map(e=>/* @__PURE__ */Ht.createElement("div",{key:`step-summary-${t.policyName}`},/* @__PURE__ */Ht.createElement(ue,{Component:()=>/* @__PURE__ */Ht.createElement(rd,{policy:t,serverGroup:a}),placement:"left",title:t.policyName},
|
|
245
|
+
/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("div",{className:"label label-default"},Z(t.policyType).toUpperCase()),/* @__PURE__ */Ht.createElement(nd,{alarm:e}))),/* @__PURE__ */Ht.createElement("div",{className:"actions"},/* @__PURE__ */Ht.createElement("button",{className:"btn btn-xs btn-link",onClick:c},/* @__PURE__ */Ht.createElement("span",{className:"glyphicon glyphicon-cog"}),/* @__PURE__ */Ht.createElement("span",{className:"sr-only"},"Edit policy")),/* @__PURE__ */Ht.createElement("button",{className:"btn btn-xs btn-link",onClick:d},/* @__PURE__ */Ht.createElement("span",{className:"glyphicon glyphicon-trash"}),/* @__PURE__ */Ht.createElement("span",{className:"sr-only"},"Delete policy")))))))},sd=({application:e,policy:t,serverGroup:a})=>{var n,r,l;const s=a.type||a.cloudProvider||"aws",i=ze.getValue(s,"serverGroup"),o="aws"===s?t.policyName:t.id,c=i.UpsertTargetTrackingModal,d=i.TargetTrackingChart,m=t.targetTrackingConfiguration;/* @__PURE__ */
|
|
246
246
|
return Ht.createElement("div",{className:"TargetTrackingSummary"},/* @__PURE__ */Ht.createElement(ue,{Component:()=>/* @__PURE__ */Ht.createElement(d,{config:t.targetTrackingConfiguration,serverGroup:a}),placement:"left",title:o},
|
|
247
|
-
/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("div",{className:"label label-default"},Z(t.policyType).toUpperCase()),/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("b",null,"Target"),/* @__PURE__ */Ht.createElement("span",{className:"sp-margin-xs-left"},(null==(n=m.predefinedMetricSpecification)?void 0:n.predefinedMetricType)||(null==(r=m.customizedMetricSpecification)?void 0:r.metricName)),Boolean(null==(l=m.customizedMetricSpecification)?void 0:l.statistic)&&/* @__PURE__ */Ht.createElement("span",null,` @ ${m.targetValue}`)))),/* @__PURE__ */Ht.createElement("div",{className:"actions"},/* @__PURE__ */Ht.createElement("button",{className:"btn btn-xs btn-link",onClick:()=>{const n={app:e,policy:t,serverGroup:a};I.show(c,n,{dialogClassName:"wizard-modal modal-lg"})}},/* @__PURE__ */Ht.createElement("span",{className:"glyphicon glyphicon-cog"}),/* @__PURE__ */Ht.createElement("span",{className:"sr-only"},"Edit policy")),/* @__PURE__ */Ht.createElement("button",{className:"btn btn-xs btn-link",onClick:()=>{const n={application:e,title:`Deleting scaling policy ${o}`},r={type:"deleteScalingPolicy",cloudProvider:s,credentials:a.account,region:a.region,scalingPolicyID:t.id,serverGroupName:a.name};"aws"===s&&(delete r.scalingPolicyID,r.policyName=t.policyName),x.confirm({header:`Really delete ${o}?`,buttonText:"Delete scaling policy",account:a.account,taskMonitorConfig:n,submitMethod:()=>X.executeTask({application:e,description:`Delete scaling policy ${o}`,job:[r]})})}},/* @__PURE__ */Ht.createElement("span",{className:"glyphicon glyphicon-trash"}),/* @__PURE__ */Ht.createElement("span",{className:"sr-only"},"Delete policy"))))},
|
|
248
|
-
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(u,{label:"Cooldown",name:"cooldown",help:"Seconds",input:e=>/* @__PURE__ */qt.createElement(E,{...e,"aria-label":"Cooldown",min:0}),required:!0,validate:
|
|
249
|
-
return qt.createElement(Rt,{application:e,closeModal:t,description:`Update Advanced Settings for ${n.name}`,dismissModal:a,initialValues:this.command,mapValuesToTask:t=>({application:e,job:[t]}),render:this.renderFields,title:`Edit Advanced Settings for ${n.name}`})}};
|
|
247
|
+
/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("div",{className:"label label-default"},Z(t.policyType).toUpperCase()),/* @__PURE__ */Ht.createElement("div",null,/* @__PURE__ */Ht.createElement("b",null,"Target"),/* @__PURE__ */Ht.createElement("span",{className:"sp-margin-xs-left"},(null==(n=m.predefinedMetricSpecification)?void 0:n.predefinedMetricType)||(null==(r=m.customizedMetricSpecification)?void 0:r.metricName)),Boolean(null==(l=m.customizedMetricSpecification)?void 0:l.statistic)&&/* @__PURE__ */Ht.createElement("span",null,` @ ${m.targetValue}`)))),/* @__PURE__ */Ht.createElement("div",{className:"actions"},/* @__PURE__ */Ht.createElement("button",{className:"btn btn-xs btn-link",onClick:()=>{const n={app:e,policy:t,serverGroup:a};I.show(c,n,{dialogClassName:"wizard-modal modal-lg"})}},/* @__PURE__ */Ht.createElement("span",{className:"glyphicon glyphicon-cog"}),/* @__PURE__ */Ht.createElement("span",{className:"sr-only"},"Edit policy")),/* @__PURE__ */Ht.createElement("button",{className:"btn btn-xs btn-link",onClick:()=>{const n={application:e,title:`Deleting scaling policy ${o}`},r={type:"deleteScalingPolicy",cloudProvider:s,credentials:a.account,region:a.region,scalingPolicyID:t.id,serverGroupName:a.name};"aws"===s&&(delete r.scalingPolicyID,r.policyName=t.policyName),x.confirm({header:`Really delete ${o}?`,buttonText:"Delete scaling policy",account:a.account,taskMonitorConfig:n,submitMethod:()=>X.executeTask({application:e,description:`Delete scaling policy ${o}`,job:[r]})})}},/* @__PURE__ */Ht.createElement("span",{className:"glyphicon glyphicon-trash"}),/* @__PURE__ */Ht.createElement("span",{className:"sr-only"},"Delete policy"))))},id=({application:e,policy:t,serverGroup:a})=>"TargetTrackingScaling"===(t.policyType?t.policyType:t.targetTrackingConfiguration?"TargetTrackingScaling":"StepScaling")?/* @__PURE__ */Ht.createElement(sd,{application:e,policy:t,serverGroup:a}):/* @__PURE__ */Ht.createElement(ld,{application:e,policy:t,serverGroup:a});function od(e){return"number"!=typeof e||!Number.isFinite(e)||e<0?"Enter a finite non-negative number":void 0}const cd=class e extends qt.Component{constructor(){super(...arguments),this.renderFields=e=>{const{backingData:t}=e.values;/* @__PURE__ */
|
|
248
|
+
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(u,{label:"Cooldown",name:"cooldown",help:"Seconds",input:e=>/* @__PURE__ */qt.createElement(E,{...e,"aria-label":"Cooldown",min:0}),required:!0,validate:od}),/* @__PURE__ */qt.createElement(u,{label:"Enabled Metrics",name:"enabledMetrics",help:/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.enabledMetrics"}),input:e=>/* @__PURE__ */qt.createElement(g,{...e,"aria-label":"Enabled Metrics",multi:!0,stringOptions:t.enabledMetrics})}),/* @__PURE__ */qt.createElement(u,{label:"Health Check Type",name:"healthCheckType",input:e=>/* @__PURE__ */qt.createElement(g,{...e,"aria-label":"Health Check Type",clearable:!1,stringOptions:t.healthCheckTypes})}),/* @__PURE__ */qt.createElement(u,{label:"Health Check Grace Period",name:"healthCheckGracePeriod",help:"Seconds",input:e=>/* @__PURE__ */qt.createElement(E,{...e,"aria-label":"Health Check Grace Period",min:0}),required:!0,validate:od}),/* @__PURE__ */qt.createElement(u,{label:"Termination Policies",name:"terminationPolicies",input:e=>/* @__PURE__ */qt.createElement(g,{...e,"aria-label":"Termination Policies",multi:!0,stringOptions:t.terminationPolicies})}),/* @__PURE__ */qt.createElement(u,{label:"Capacity Rebalance",name:"capacityRebalance",help:/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.capacityRebalance"}),input:e=>/* @__PURE__ */qt.createElement(v,{...e,text:"Enable capacity rebalance"})}))}}static show(t,a){return ft(t.serverGroup,t.application).then(n=>n&&I.show(e,t,{dialogClassName:"modal-lg"},a))}get command(){return this.directCommand||(this.directCommand=this.context.services.providerServiceDelegate.getDelegate("aws","serverGroup.commandBuilder").buildUpdateServerGroupCommand(this.props.serverGroup))}render(){const{application:e,closeModal:t,dismissModal:a,serverGroup:n}=this.props;/* @__PURE__ */
|
|
249
|
+
return qt.createElement(Rt,{application:e,closeModal:t,description:`Update Advanced Settings for ${n.name}`,dismissModal:a,initialValues:this.command,mapValuesToTask:t=>({application:e,job:[t]}),render:this.renderFields,title:`Edit Advanced Settings for ${n.name}`})}};cd.contextType=C;let dd=cd;const md=class extends qt.Component{constructor(){super(...arguments),this.editAdvancedSettings=()=>{const{app:e,serverGroup:t}=this.props;dd.show({application:e,serverGroup:t},this.context.services)}}render(){const{serverGroup:e}=this.props,t=e.asg;/* @__PURE__ */
|
|
250
250
|
return qt.createElement(z,{heading:"Advanced Settings"},/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Cooldown"),/* @__PURE__ */qt.createElement("dd",null,t.defaultCooldown," seconds"),t.enabledMetrics.length>0&&[
|
|
251
251
|
/* @__PURE__ */qt.createElement("dt",{key:"t-metrics"},"Enabled Metrics"),
|
|
252
252
|
/* @__PURE__ */qt.createElement("dd",{key:"d-metrics"},t.enabledMetrics.map(e=>e.metric).join(", "))],/* @__PURE__ */qt.createElement("dt",null,"Health Check Type"),/* @__PURE__ */qt.createElement("dd",null,t.healthCheckType),/* @__PURE__ */qt.createElement("dt",null,"Grace Period"),/* @__PURE__ */qt.createElement("dd",null,t.healthCheckGracePeriod," seconds"),/* @__PURE__ */qt.createElement("dt",null,"Termination Policies"),/* @__PURE__ */qt.createElement("dd",null,t.terminationPolicies.join(", ")),t.capacityRebalance&&[
|
|
253
253
|
/* @__PURE__ */qt.createElement("dt",null,"Capacity Rebalance ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.capacityRebalance"})),
|
|
254
|
-
/* @__PURE__ */qt.createElement("dd",null,`${t.capacityRebalance}`)]),Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.editAdvancedSettings},"Edit Advanced Settings"))}};
|
|
255
|
-
return qt.createElement(z,{heading:"Server Group Information",defaultExpanded:!0},/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-narrow"},/* @__PURE__ */qt.createElement("dt",null,"Created"),/* @__PURE__ */qt.createElement("dd",null,V(e.createdTime)),a&&/* @__PURE__ */qt.createElement(Lt,{metadata:n.creationMetadata}),a&&/* @__PURE__ */qt.createElement(zt,{changeConfig:t,linkText:"view changes",nameItem:e,viewType:"description"}),/* @__PURE__ */qt.createElement("dt",null,"In"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(L,{account:e.account}),e.region),/* @__PURE__ */qt.createElement("dt",null,"VPC"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(
|
|
256
|
-
return qt.createElement(z,{heading:"Capacity",defaultExpanded:!0},/* @__PURE__ */qt.createElement(Ot,{current:e.instances.length,capacity:a}),/* @__PURE__ */qt.createElement("div",null,Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:()=>
|
|
257
|
-
return qt.createElement(z,{heading:"Instances Distribution"},/* @__PURE__ */qt.createElement(q,{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement(U,{label:"On-Demand Allocation Strategy",helpFieldId:"aws.serverGroup.odAllocationStrategy",value:t.onDemandAllocationStrategy}),/* @__PURE__ */qt.createElement(U,{label:"On-Demand Base Capacity",helpFieldId:"aws.serverGroup.odBase",value:t.onDemandBaseCapacity}),/* @__PURE__ */qt.createElement(U,{label:"On-Demand Percentage Above Base Capacity",helpFieldId:"aws.serverGroup.odPercentAboveBase",value:t.onDemandPercentageAboveBaseCapacity}),/* @__PURE__ */qt.createElement(U,{label:"Spot Allocation Strategy",helpFieldId:"aws.serverGroup.spotAllocationStrategy",value:t.spotAllocationStrategy}),t.spotInstancePools&&/* @__PURE__ */qt.createElement(U,{label:"Spot Instance Pools",helpFieldId:"aws.serverGroup.spotInstancePoolCount",value:t.spotInstancePools}),/* @__PURE__ */qt.createElement(U,{label:"Max Spot Price",helpFieldId:"aws.serverGroup.spotMaxPrice",value:t.spotMaxPrice||"on-demand price, default"})))},
|
|
254
|
+
/* @__PURE__ */qt.createElement("dd",null,`${t.capacityRebalance}`)]),Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.editAdvancedSettings},"Edit Advanced Settings"))}};md.contextType=C;let ud=md;class pd extends qt.Component{constructor(e){super(e),this.state={changeConfig:this.getChangeConfig(e.serverGroup)}}getChangeConfig(e){const t={metadata:ca(e.entityTags,"creationMetadata")};return Ca(e,"buildInfo.jenkins")&&(t.buildInfo={ancestor:void 0,jenkins:e.buildInfo.jenkins,target:void 0}),t}componentWillReceiveProps(e){this.setState({changeConfig:this.getChangeConfig(e.serverGroup)})}render(){const{serverGroup:e}=this.props,{changeConfig:t}=this.state,a=o.feature&&o.feature.entityTags,n=e.entityTags||{};/* @__PURE__ */
|
|
255
|
+
return qt.createElement(z,{heading:"Server Group Information",defaultExpanded:!0},/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-narrow"},/* @__PURE__ */qt.createElement("dt",null,"Created"),/* @__PURE__ */qt.createElement("dd",null,V(e.createdTime)),a&&/* @__PURE__ */qt.createElement(Lt,{metadata:n.creationMetadata}),a&&/* @__PURE__ */qt.createElement(zt,{changeConfig:t,linkText:"view changes",nameItem:e,viewType:"description"}),/* @__PURE__ */qt.createElement("dt",null,"In"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(L,{account:e.account}),e.region),/* @__PURE__ */qt.createElement("dt",null,"VPC"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(Wn,{vpcId:e.vpcId})),e.vpcId&&e.subnetType&&/* @__PURE__ */qt.createElement("dt",null,"Subnet"),e.vpcId&&e.subnetType&&/* @__PURE__ */qt.createElement("dd",null,e.subnetType),e.asg&&/* @__PURE__ */qt.createElement("dt",null,"Zones"),e.asg&&/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement("ul",null,e.asg.availabilityZones.map(e=>/* @__PURE__ */qt.createElement("li",{key:e},e))))))}}var hd=Object.getOwnPropertyDescriptor;let gd=class extends qt.Component{render(){const{serverGroup:e,app:t}=this.props,a={min:e.asg.minSize,max:e.asg.maxSize,desired:e.asg.desiredCapacity};/* @__PURE__ */
|
|
256
|
+
return qt.createElement(z,{heading:"Capacity",defaultExpanded:!0},/* @__PURE__ */qt.createElement(Ot,{current:e.instances.length,capacity:a}),/* @__PURE__ */qt.createElement("div",null,Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:()=>Cc.show({application:t,serverGroup:e},this.context.services)},"Resize Server Group")),/* @__PURE__ */qt.createElement("div",null,/* @__PURE__ */qt.createElement($t,{serverGroup:e})))}};gd.contextType=C,gd=((e,t,a,n)=>{for(var r,l=n>1?void 0:n?hd(t,a):t,s=e.length-1;s>=0;s--)(r=e[s])&&(l=r(l)||l);return l})([fe("amazon.serverGroup.CapacityDetailsSection")],gd);class vd extends qt.Component{render(){const{serverGroup:e}=this.props;return e.instanceCounts.total>0?/* @__PURE__ */qt.createElement(z,{heading:"Health",defaultExpanded:!0},/* @__PURE__ */qt.createElement("dl",{className:"dl-horizontal dl-narrow"},/* @__PURE__ */qt.createElement("dt",null,"Instances"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(se,{container:e.instanceCounts,className:"pull-left"})))):null}}const fd=({serverGroup:e})=>{if(!e.mixedInstancesPolicy)return null;const t=e.mixedInstancesPolicy.instancesDistribution;/* @__PURE__ */
|
|
257
|
+
return qt.createElement(z,{heading:"Instances Distribution"},/* @__PURE__ */qt.createElement(q,{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement(U,{label:"On-Demand Allocation Strategy",helpFieldId:"aws.serverGroup.odAllocationStrategy",value:t.onDemandAllocationStrategy}),/* @__PURE__ */qt.createElement(U,{label:"On-Demand Base Capacity",helpFieldId:"aws.serverGroup.odBase",value:t.onDemandBaseCapacity}),/* @__PURE__ */qt.createElement(U,{label:"On-Demand Percentage Above Base Capacity",helpFieldId:"aws.serverGroup.odPercentAboveBase",value:t.onDemandPercentageAboveBaseCapacity}),/* @__PURE__ */qt.createElement(U,{label:"Spot Allocation Strategy",helpFieldId:"aws.serverGroup.spotAllocationStrategy",value:t.spotAllocationStrategy}),t.spotInstancePools&&/* @__PURE__ */qt.createElement(U,{label:"Spot Instance Pools",helpFieldId:"aws.serverGroup.spotInstancePoolCount",value:t.spotInstancePools}),/* @__PURE__ */qt.createElement(U,{label:"Max Spot Price",helpFieldId:"aws.serverGroup.spotMaxPrice",value:t.spotMaxPrice||"on-demand price, default"})))},Ed=e=>{let t;return(e||"").split(", ").forEach(e=>{const a=e.split("=");2===a.length&&"ancestor_name"===a[0]&&(t=a[1])}),t};class yd extends qt.Component{constructor(e){super(e),this.state={image:this.getImage(e.serverGroup)}}getImage(e){const t=e.image?e.image:void 0;return e.image&&e.image.description&&(t.baseImage=Ed(e.image.description)),t}componentWillReceiveProps(e){this.setState({image:this.getImage(e.serverGroup)})}render(){const{name:e,launchConfig:t}=this.props.serverGroup,{image:a}=this.state;return t?/* @__PURE__ */qt.createElement(z,{heading:"Launch Configuration"},/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Name"),/* @__PURE__ */qt.createElement("dd",null,t.launchConfigurationName),/* @__PURE__ */qt.createElement("dt",null,"Image ID"),/* @__PURE__ */qt.createElement("dd",null,t.imageId),a&&a.imageLocation&&/* @__PURE__ */qt.createElement("dt",null,"Image Name"),a&&a.imageLocation&&/* @__PURE__ */qt.createElement("dd",null,a.imageLocation),a&&a.baseImage&&/* @__PURE__ */qt.createElement("dt",null,"Base Image Name"),a&&a.baseImage&&/* @__PURE__ */qt.createElement("dd",null,a.baseImage),/* @__PURE__ */qt.createElement("dt",null,"Instance Type"),/* @__PURE__ */qt.createElement("dd",null,t.instanceType),/* @__PURE__ */qt.createElement("dt",null,"IAM Profile"),/* @__PURE__ */qt.createElement("dd",null,t.iamInstanceProfile),t.instanceMonitoring&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("dt",null,"Instance Monitoring"),/* @__PURE__ */qt.createElement("dd",null,t.instanceMonitoring.enabled?"enabled":"disabled")),t.spotPrice&&/* @__PURE__ */qt.createElement("dt",null,"Spot Price"),t.spotPrice&&/* @__PURE__ */qt.createElement("dd",null,t.spotPrice),t.keyName&&/* @__PURE__ */qt.createElement("dt",null,"Key Name"),t.keyName&&/* @__PURE__ */qt.createElement("dd",null,t.keyName),t.kernelId&&/* @__PURE__ */qt.createElement("dt",null,"Kernel ID"),t.kernelId&&/* @__PURE__ */qt.createElement("dd",null,t.kernelId),t.ramdiskId&&/* @__PURE__ */qt.createElement("dt",null,"Ramdisk ID"),t.ramdiskId&&/* @__PURE__ */qt.createElement("dd",null,t.ramdiskId),/* @__PURE__ */qt.createElement("dt",null,"User Data"),t.userData&&/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement(Ut,{serverGroupName:e,userData:t.userData})),!t.userData&&/* @__PURE__ */qt.createElement("dd",null,"[none]"))):null}}function bd(e){return e.instanceTypeOverrides?/* @__PURE__ */qt.createElement(z,{heading:"Instance Types",defaultExpanded:!0,outerDivClassName:"multiple-instance-types-subsection",toggleClassName:"clickable subsection-heading",headingClassName:"collapsible-subheading"},
|
|
258
258
|
/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed",id:"MultipleInstanceTypes"},/* @__PURE__ */qt.createElement("thead",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("th",{id:"instanceType"},"Type ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.multipleInstanceTypes"})),/* @__PURE__ */qt.createElement("th",{id:"weight"},"Weighted Capacity ",/* @__PURE__ */qt.createElement(c,{id:"aws.serverGroup.instanceTypeWeight"})))),/* @__PURE__ */qt.createElement("tbody",null,e.instanceTypeOverrides.map(e=>[
|
|
259
|
-
/* @__PURE__ */qt.createElement("tr",{key:e.instanceType},/* @__PURE__ */qt.createElement("td",{headers:"instanceType"},e.instanceType),/* @__PURE__ */qt.createElement("td",{headers:"weight"},e.weightedCapacity))])))):null}const
|
|
260
|
-
return qt.createElement(z,{heading:"Launch Template"},/* @__PURE__ */qt.createElement(q,{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement(U,{label:"Name",value:i.launchTemplateName}),/* @__PURE__ */qt.createElement(U,{label:"Image ID",value:o.imageId}),(null==r?void 0:r.imageLocation)&&/* @__PURE__ */qt.createElement(U,{label:"Image Name",value:null==r?void 0:r.imageLocation}),l&&/* @__PURE__ */qt.createElement(U,{label:"Base Image Name",value:l}),m&&m.length>0?/* @__PURE__ */qt.createElement(
|
|
261
|
-
return qt.createElement(z,{heading:"Logs"},/* @__PURE__ */qt.createElement("ul",null,/* @__PURE__ */qt.createElement("li",null,/* @__PURE__ */qt.createElement($t,{serverGroup:this.props.serverGroup}))))}}class
|
|
262
|
-
return qt.createElement(z,{cacheKey:"Scaling Policies",heading:({chevron:e})=>/* @__PURE__ */qt.createElement("h4",{className:"collapsible-heading"},e,/* @__PURE__ */qt.createElement("span",null,a&&/* @__PURE__ */qt.createElement(_,{value:"Some scaling processes are disabled that may prevent scaling policies from working"},/* @__PURE__ */qt.createElement("span",{className:"fa fa-exclamation-circle warning-text"})),"Scaling Policies"))},a&&/* @__PURE__ */qt.createElement("div",{className:"band band-warning"},"Some scaling processes are disabled that may prevent scaling policies from working."),t.scalingPolicies.map(a=>/* @__PURE__ */qt.createElement(
|
|
263
|
-
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(vt,{monitor:this.state.taskMonitor}),/* @__PURE__ */qt.createElement(ye,{dismiss:e}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Modify Scaling Processes for ",t.name)),/* @__PURE__ */qt.createElement(Za.Body,{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-offset-2 col-sm-10"},this.state.processes.map((e,t)=>/* @__PURE__ */qt.createElement("div",{className:"checkbox",key:e.name},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:e.enabled,onChange:e=>this.setProcessEnabled(t,e.target.checked),type:"checkbox"})," ",e.name)," ",/* @__PURE__ */qt.createElement(c,{content:e.description,placement:"right"}))))),/* @__PURE__ */qt.createElement(St,{reason:this.state.reason,onChange:e=>this.setState({reason:e})})),/* @__PURE__ */qt.createElement(
|
|
259
|
+
/* @__PURE__ */qt.createElement("tr",{key:e.instanceType},/* @__PURE__ */qt.createElement("td",{headers:"instanceType"},e.instanceType),/* @__PURE__ */qt.createElement("td",{headers:"weight"},e.weightedCapacity))])))):null}const Cd=({serverGroup:e})=>{var t,a,n;const{image:r}=e,l=Ed(null==r?void 0:r.description);if(!e.launchTemplate&&!e.mixedInstancesPolicy)return null;const s=!!e.mixedInstancesPolicy,i=s?e.mixedInstancesPolicy.launchTemplates[0]:e.launchTemplate,{launchTemplateData:o}=i,c=s?e.mixedInstancesPolicy.instancesDistribution.spotMaxPrice:null==(a=null==(t=null==o?void 0:o.instanceMarketOptions)?void 0:t.spotOptions)?void 0:a.maxPrice,d=null==(n=null==o?void 0:o.creditSpecification)?void 0:n.cpuCredits,m=s?e.mixedInstancesPolicy.launchTemplateOverridesForInstanceType:null;/* @__PURE__ */
|
|
260
|
+
return qt.createElement(z,{heading:"Launch Template"},/* @__PURE__ */qt.createElement(q,{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement(U,{label:"Name",value:i.launchTemplateName}),/* @__PURE__ */qt.createElement(U,{label:"Image ID",value:o.imageId}),(null==r?void 0:r.imageLocation)&&/* @__PURE__ */qt.createElement(U,{label:"Image Name",value:null==r?void 0:r.imageLocation}),l&&/* @__PURE__ */qt.createElement(U,{label:"Base Image Name",value:l}),m&&m.length>0?/* @__PURE__ */qt.createElement(bd,{instanceTypeOverrides:m}):/* @__PURE__ */qt.createElement(U,{label:"Instance Type",value:o.instanceType}),d&&/* @__PURE__ */qt.createElement(U,{label:"CPU Credit Specification",value:d}),/* @__PURE__ */qt.createElement(U,{label:"IAM Profile",value:o.iamInstanceProfile.name}),o.monitoring&&/* @__PURE__ */qt.createElement(U,{label:"Instance Monitoring",value:o.monitoring.enabled?"enabled":"disabled"}),c&&/* @__PURE__ */qt.createElement(U,{label:"Max Spot Price",value:c}),o.keyName&&/* @__PURE__ */qt.createElement(U,{label:"Key Name",value:o.keyName}),o.kernelId&&/* @__PURE__ */qt.createElement(U,{label:"Kernel ID",value:o.kernelId}),o.ramDiskId&&/* @__PURE__ */qt.createElement(U,{label:"Ramdisk ID",value:o.ramDiskId}),o.userData&&/* @__PURE__ */qt.createElement(U,{label:"User Data",value:/* @__PURE__ */qt.createElement(Ut,{serverGroupName:e.name,userData:o.userData})})))};class Nd extends qt.Component{render(){/* @__PURE__ */
|
|
261
|
+
return qt.createElement(z,{heading:"Logs"},/* @__PURE__ */qt.createElement("ul",null,/* @__PURE__ */qt.createElement("li",null,/* @__PURE__ */qt.createElement($t,{serverGroup:this.props.serverGroup}))))}}class Sd extends qt.Component{constructor(e){super(e),this.state=this.getState(e)}getState(e){const{serverGroup:t}=e,a=t.buildInfo||{};let n=null;a.commit&&(n=t.buildInfo.commit.substring(0,8));let r=null;if(a.buildInfoUrl)r=t.buildInfo.buildInfoUrl;else if(a.jenkins){const e=t.buildInfo.jenkins;r=`${e.host}job/${e.name}/${e.number}`}return{commitHash:n,jenkinsLink:r}}componentWillReceiveProps(e){this.setState(this.getState(e))}render(){const{serverGroup:e}=this.props,{commitHash:t,jenkinsLink:a}=this.state;return e.buildInfo&&e.buildInfo.jenkins?/* @__PURE__ */qt.createElement(z,{heading:"Package"},/* @__PURE__ */qt.createElement("dl",{className:"horizontal-when-filters-collapsed"},/* @__PURE__ */qt.createElement("dt",null,"Job"),/* @__PURE__ */qt.createElement("dd",null,e.buildInfo.jenkins.name),/* @__PURE__ */qt.createElement("dt",null,"Package"),/* @__PURE__ */qt.createElement("dd",null,e.buildInfo.package_name),/* @__PURE__ */qt.createElement("dt",null,"Build"),/* @__PURE__ */qt.createElement("dd",null,e.buildInfo.jenkins.number),/* @__PURE__ */qt.createElement("dt",null,"Commit"),/* @__PURE__ */qt.createElement("dd",null,t),/* @__PURE__ */qt.createElement("dt",null,"Version"),/* @__PURE__ */qt.createElement("dd",null,e.buildInfo.version),/* @__PURE__ */qt.createElement("dt",null,"Build Link"),/* @__PURE__ */qt.createElement("dd",null,/* @__PURE__ */qt.createElement("a",{target:"_blank",href:a},a)))):null}}var wd=Object.getOwnPropertyDescriptor;let kd=class extends qt.Component{constructor(e){super(e)}static arePoliciesDisabled(e){const t=No.normalizeScalingProcesses(e);return e.scalingPolicies.length>0&&t.filter(e=>!e.enabled).some(e=>["Launch","Terminate","AlarmNotification"].includes(e.name))}render(){const{app:e,serverGroup:t}=this.props,a=kd.arePoliciesDisabled(t);/* @__PURE__ */
|
|
262
|
+
return qt.createElement(z,{cacheKey:"Scaling Policies",heading:({chevron:e})=>/* @__PURE__ */qt.createElement("h4",{className:"collapsible-heading"},e,/* @__PURE__ */qt.createElement("span",null,a&&/* @__PURE__ */qt.createElement(_,{value:"Some scaling processes are disabled that may prevent scaling policies from working"},/* @__PURE__ */qt.createElement("span",{className:"fa fa-exclamation-circle warning-text"})),"Scaling Policies"))},a&&/* @__PURE__ */qt.createElement("div",{className:"band band-warning"},"Some scaling processes are disabled that may prevent scaling policies from working."),t.scalingPolicies.map(a=>/* @__PURE__ */qt.createElement(id,{key:a.policyARN,policy:a,serverGroup:t,application:e})),Cn.adHocInfraWritesEnabled?/* @__PURE__ */qt.createElement(ed,{serverGroup:t,application:e}):/* @__PURE__ */qt.createElement("p",null,"Can not create scaling policy, because ad-hoc operations are disabled for AWS providers."))}};kd=((e,t,a,n)=>{for(var r,l=n>1?void 0:n?wd(t,a):t,s=e.length-1;s>=0;s--)(r=e[s])&&(l=r(l)||l);return l})([fe("aws.serverGroup.ScalingPoliciesDetailsSection")],kd);class Td extends qt.Component{constructor(){super(...arguments),this.initialProcesses=No.normalizeScalingProcesses(this.props.serverGroup),this.state={processes:this.initialProcesses.map(e=>({...e})),taskMonitor:new w({application:this.props.application,title:`Update Auto Scaling Processes for ${this.props.serverGroup.name}`,onDismiss:this.props.dismissModal,onTaskComplete:()=>this.props.application.serverGroups.refresh()})},this.setProcessEnabled=(e,t)=>{const a=this.state.processes.map((a,n)=>n===e?{...a,enabled:t}:a);this.setState({processes:a})},this.getJobs=()=>function(e,t,a,n){const r=t.filter(t=>{var a;return(null==(a=e.find(e=>e.name===t.name))?void 0:a.enabled)!==t.enabled}),l=r.filter(e=>e.enabled).map(e=>e.name),s=r.filter(e=>!e.enabled).map(e=>e.name),i=(e,t)=>({type:"modifyScalingProcess",action:e,processes:t,asgName:a.name,regions:[a.region],credentials:a.account,cloudProvider:"aws",reason:n});return[l.length&&i("resume",l),s.length&&i("suspend",s)].filter(Boolean)}(this.initialProcesses,this.state.processes,this.props.serverGroup,this.state.reason),this.submit=()=>{const{application:e,serverGroup:t}=this.props,a=this.getJobs();this.state.taskMonitor.submit(()=>X.executeTask({application:e,description:`Update Auto Scaling Processes for ${t.name}`,job:a}))}}static show(e){return ft(e.serverGroup,e.application).then(t=>t&&I.show(Td,e))}render(){const{dismissModal:e,serverGroup:t}=this.props;/* @__PURE__ */
|
|
263
|
+
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(vt,{monitor:this.state.taskMonitor}),/* @__PURE__ */qt.createElement(ye,{dismiss:e}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Modify Scaling Processes for ",t.name)),/* @__PURE__ */qt.createElement(Za.Body,{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-offset-2 col-sm-10"},this.state.processes.map((e,t)=>/* @__PURE__ */qt.createElement("div",{className:"checkbox",key:e.name},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:e.enabled,onChange:e=>this.setProcessEnabled(t,e.target.checked),type:"checkbox"})," ",e.name)," ",/* @__PURE__ */qt.createElement(c,{content:e.description,placement:"right"}))))),/* @__PURE__ */qt.createElement(St,{reason:this.state.reason,onChange:e=>this.setState({reason:e})})),/* @__PURE__ */qt.createElement(yc,{account:t.account,isValid:this.getJobs().length>0,onCancel:e,onSubmit:this.submit}))}}class Id extends qt.Component{constructor(e){super(e),this.editScalingProcesses=()=>{const{app:e,serverGroup:t}=this.props;Td.show({application:e,serverGroup:t})},this.state=this.getState(e)}getState(e){const{serverGroup:t}=e,a=No.normalizeScalingProcesses(t),n=t.scalingPolicies.length>0&&a.filter(e=>!e.enabled).some(e=>["Launch","Terminate","AlarmNotification"].includes(e.name)),r=t.scheduledActions.length>0&&a.filter(e=>!e.enabled).some(e=>["Launch","Terminate","ScheduledAction"].includes(e.name));return{autoScalingProcesses:a,scalingPoliciesDisabled:n,scheduledActionsDisabled:r}}componentWillReceiveProps(e){this.setState(this.getState(e))}render(){const{autoScalingProcesses:e,scalingPoliciesDisabled:t,scheduledActionsDisabled:a}=this.state;/* @__PURE__ */
|
|
264
264
|
return qt.createElement(z,{cacheKey:"Scaling Processes",heading:({chevron:e})=>/* @__PURE__ */qt.createElement("h4",{className:"collapsible-heading"},e,/* @__PURE__ */qt.createElement("span",null,t&&/* @__PURE__ */qt.createElement(_,{value:"Some scaling processes are disabled that may prevent scaling policies from working"},/* @__PURE__ */qt.createElement("span",{className:"fa fa-exclamation-circle warning-text"})),a&&/* @__PURE__ */qt.createElement(_,{value:"Some scaling processes are disabled that may prevent scheduled actions from working"},/* @__PURE__ */qt.createElement("span",{className:"fa fa-exclamation-circle warning-text"})),"Scaling Processes"))},
|
|
265
|
-
/* @__PURE__ */qt.createElement("ul",{className:"scaling-processes"},e.map(e=>/* @__PURE__ */qt.createElement("li",{key:e.name},/* @__PURE__ */qt.createElement("span",{style:{visibility:e.enabled?"visible":"hidden"},className:"fa fa-check small"}),/* @__PURE__ */qt.createElement("span",{className:e.enabled?"":"text-disabled"},e.name," "),/* @__PURE__ */qt.createElement(c,{content:e.description,placement:"bottom"}),e.suspensionDate&&/* @__PURE__ */qt.createElement("div",{className:"text-disabled small",style:{marginLeft:"35px"}},"Suspended ",V(e.suspensionDate))))),Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.editScalingProcesses},"Edit Scaling Processes"))}}class
|
|
266
|
-
return qt.createElement("dl",{className:"horizontal-when-filters-collapsed",style:{marginBottom:"20px"}},/* @__PURE__ */qt.createElement("dt",null,"Schedule"),/* @__PURE__ */qt.createElement("dd",null,e.recurrence),void 0!==e.minSize&&/* @__PURE__ */qt.createElement("dt",null,"Min Size"),void 0!==e.minSize&&/* @__PURE__ */qt.createElement("dd",null,e.minSize),void 0!==e.maxSize&&/* @__PURE__ */qt.createElement("dt",null,"Max Size"),void 0!==e.maxSize&&/* @__PURE__ */qt.createElement("dd",null,e.maxSize),void 0!==e.desiredCapacity&&/* @__PURE__ */qt.createElement("dt",null,"Desired Size"),void 0!==e.desiredCapacity&&/* @__PURE__ */qt.createElement("dd",null,e.desiredCapacity))}}function
|
|
267
|
-
return qt.createElement("input",{className:"form-control input-sm",min:0,onChange:a=>this.updateScheduledAction(e,t,""===a.target.value?"":Number(a.target.value)),type:"number",value:null!=a?a:""})}render(){const{dismissModal:e,serverGroup:t}=this.props,a=this.state.scheduledActions.every(
|
|
265
|
+
/* @__PURE__ */qt.createElement("ul",{className:"scaling-processes"},e.map(e=>/* @__PURE__ */qt.createElement("li",{key:e.name},/* @__PURE__ */qt.createElement("span",{style:{visibility:e.enabled?"visible":"hidden"},className:"fa fa-check small"}),/* @__PURE__ */qt.createElement("span",{className:e.enabled?"":"text-disabled"},e.name," "),/* @__PURE__ */qt.createElement(c,{content:e.description,placement:"bottom"}),e.suspensionDate&&/* @__PURE__ */qt.createElement("div",{className:"text-disabled small",style:{marginLeft:"35px"}},"Suspended ",V(e.suspensionDate))))),Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.editScalingProcesses},"Edit Scaling Processes"))}}class Pd extends qt.Component{render(){const{action:e}=this.props;/* @__PURE__ */
|
|
266
|
+
return qt.createElement("dl",{className:"horizontal-when-filters-collapsed",style:{marginBottom:"20px"}},/* @__PURE__ */qt.createElement("dt",null,"Schedule"),/* @__PURE__ */qt.createElement("dd",null,e.recurrence),void 0!==e.minSize&&/* @__PURE__ */qt.createElement("dt",null,"Min Size"),void 0!==e.minSize&&/* @__PURE__ */qt.createElement("dd",null,e.minSize),void 0!==e.maxSize&&/* @__PURE__ */qt.createElement("dt",null,"Max Size"),void 0!==e.maxSize&&/* @__PURE__ */qt.createElement("dd",null,e.maxSize),void 0!==e.desiredCapacity&&/* @__PURE__ */qt.createElement("dt",null,"Desired Size"),void 0!==e.desiredCapacity&&/* @__PURE__ */qt.createElement("dd",null,e.desiredCapacity))}}function Ad(e){return{recurrence:e.recurrence,minSize:e.minSize,maxSize:e.maxSize,desiredCapacity:e.desiredCapacity}}function Gd(e){var t;const a=[e.minSize,e.maxSize,e.desiredCapacity];return!(!String(null!=(t=e.recurrence)?t:"").trim()||a.every(e=>void 0===e))&&(!a.some(e=>void 0!==e&&(!Number.isFinite(e)||!Number.isInteger(e)||e<0))&&(!(void 0!==e.minSize&&void 0!==e.maxSize&&e.minSize>e.maxSize)&&(!(void 0!==e.desiredCapacity&&void 0!==e.minSize&&e.desiredCapacity<e.minSize)&&!(void 0!==e.desiredCapacity&&void 0!==e.maxSize&&e.desiredCapacity>e.maxSize))))}function xd(e,t){return{type:"upsertAsgScheduledActions",asgs:[{asgName:e.name,region:e.region}],scheduledActions:t.map(Ad),credentials:e.account}}class Dd extends qt.Component{constructor(){super(...arguments),this.state={scheduledActions:(this.props.serverGroup.scheduledActions||[]).map(Ad),taskMonitor:new w({application:this.props.application,title:`Update Scheduled Actions for ${this.props.serverGroup.name}`,onDismiss:this.props.dismissModal,onTaskComplete:()=>this.props.application.serverGroups.refresh()})},this.addScheduledAction=()=>{this.setState(({scheduledActions:e})=>({scheduledActions:[...e,{}]}))},this.removeScheduledAction=e=>{this.setState(({scheduledActions:t})=>({scheduledActions:t.filter((t,a)=>a!==e)}))},this.updateScheduledAction=(e,t,a)=>{this.setState(({scheduledActions:n})=>({scheduledActions:n.map((n,r)=>r===e?{...n,[t]:""===a?void 0:a}:n)}))},this.submit=()=>{const{application:e,serverGroup:t}=this.props;this.state.taskMonitor.submit(()=>X.executeTask({application:e,description:`Update Scheduled Actions for ${t.name}`,job:[xd(t,this.state.scheduledActions)]}))}}static show(e){return ft(e.serverGroup,e.application).then(t=>t&&I.show(Dd,e,{dialogClassName:"modal-lg"}))}renderNumberInput(e,t,a){/* @__PURE__ */
|
|
267
|
+
return qt.createElement("input",{className:"form-control input-sm",min:0,onChange:a=>this.updateScheduledAction(e,t,""===a.target.value?"":Number(a.target.value)),type:"number",value:null!=a?a:""})}render(){const{dismissModal:e,serverGroup:t}=this.props,a=this.state.scheduledActions.every(Gd);/* @__PURE__ */
|
|
268
268
|
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(vt,{monitor:this.state.taskMonitor}),/* @__PURE__ */qt.createElement(ye,{dismiss:e}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Edit Scheduled Actions for ",t.name)),/* @__PURE__ */qt.createElement(Za.Body,{className:"container-fluid"},/* @__PURE__ */qt.createElement("p",null,"You must specify at least one of: Min Size, Max Size, Desired Capacity."),/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("strong",null,"Note:")," CRON expressions are evaluated in UTC."),/* @__PURE__ */qt.createElement("table",{className:"table table-condensed packed"},/* @__PURE__ */qt.createElement("thead",null,/* @__PURE__ */qt.createElement("tr",null,/* @__PURE__ */qt.createElement("th",null,"Recurrence (CRON)"),/* @__PURE__ */qt.createElement("th",null,"Min Size"),/* @__PURE__ */qt.createElement("th",null,"Max Size"),/* @__PURE__ */qt.createElement("th",null,"Desired Capacity"),/* @__PURE__ */qt.createElement("th",null))),/* @__PURE__ */qt.createElement("tbody",null,this.state.scheduledActions.map((e,t)=>{var a;/* @__PURE__ */
|
|
269
269
|
return qt.createElement("tr",{key:t},/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("input",{className:"form-control input-sm no-spel",onChange:e=>this.updateScheduledAction(t,"recurrence",e.target.value),required:!0,type:"text",value:null!=(a=e.recurrence)?a:""})),/* @__PURE__ */qt.createElement("td",null,this.renderNumberInput(t,"minSize",e.minSize)),/* @__PURE__ */qt.createElement("td",null,this.renderNumberInput(t,"maxSize",e.maxSize)),/* @__PURE__ */qt.createElement("td",null,this.renderNumberInput(t,"desiredCapacity",e.desiredCapacity)),/* @__PURE__ */qt.createElement("td",null,/* @__PURE__ */qt.createElement("button",{"aria-label":"Remove scheduled action",className:"btn btn-link",onClick:()=>this.removeScheduledAction(t),type:"button"},
|
|
270
|
-
/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"}))))}))),/* @__PURE__ */qt.createElement("button",{className:"add-new col-md-12",onClick:this.addScheduledAction,type:"button"},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"})," Add new Scheduled Action")),/* @__PURE__ */qt.createElement(
|
|
271
|
-
return qt.createElement(z,{cacheKey:"Scheduled Actions",heading:({chevron:e})=>/* @__PURE__ */qt.createElement("h4",{className:"collapsible-heading"},e,/* @__PURE__ */qt.createElement("span",null,t&&/* @__PURE__ */qt.createElement(_,{value:"Some scaling processes are disabled that may prevent scheduled actions from working"},/* @__PURE__ */qt.createElement("span",{className:"fa fa-exclamation-circle warning-text"})),"Scheduled Actions"))},e.scheduledActions.map((e,t)=>/* @__PURE__ */qt.createElement(
|
|
272
|
-
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(vt,{monitor:this.state.taskMonitor}),/* @__PURE__ */qt.createElement(ye,{dismiss:e}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Edit ",j.get("Firewalls")," for ",t.name)),/* @__PURE__ */qt.createElement(Za.Body,{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-10 col-md-offset-1"},/* @__PURE__ */qt.createElement(an,{labelKey:"name",isLoading:!this.state.securityGroupsLoaded,multi:!0,onChange:e=>this.setState({securityGroups:e||[]}),optionRenderer:e=>/* @__PURE__ */qt.createElement("span",null,`${e.name} (${e.id})`),options:this.state.availableSecurityGroups,value:this.state.securityGroups,valueKey:"id"}),this.state.securityGroupsLoadError&&/* @__PURE__ */qt.createElement("div",{className:"alert alert-danger security-groups-load-error",role:"alert"},this.state.securityGroupsLoadError," ",/* @__PURE__ */qt.createElement("button",{className:"btn btn-default btn-xs",onClick:this.loadSecurityGroups,type:"button"},"Retry"))))),/* @__PURE__ */qt.createElement(
|
|
270
|
+
/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-trash"}))))}))),/* @__PURE__ */qt.createElement("button",{className:"add-new col-md-12",onClick:this.addScheduledAction,type:"button"},/* @__PURE__ */qt.createElement("span",{className:"glyphicon glyphicon-plus-sign"})," Add new Scheduled Action")),/* @__PURE__ */qt.createElement(yc,{account:t.account,isValid:a,onCancel:e,onSubmit:this.submit}))}}class Bd extends qt.Component{constructor(e){super(e),this.editScheduledActions=()=>{const{app:e,serverGroup:t}=this.props;Dd.show({application:e,serverGroup:t})},this.state=this.getState(e)}getState(e){const{serverGroup:t}=e,a=No.normalizeScalingProcesses(t);return{scheduledActionsDisabled:t.scheduledActions.length>0&&a.filter(e=>!e.enabled).some(e=>["Launch","Terminate","ScheduledAction"].includes(e.name))}}componentWillReceiveProps(e){this.setState(this.getState(e))}render(){const{serverGroup:e}=this.props,{scheduledActionsDisabled:t}=this.state;/* @__PURE__ */
|
|
271
|
+
return qt.createElement(z,{cacheKey:"Scheduled Actions",heading:({chevron:e})=>/* @__PURE__ */qt.createElement("h4",{className:"collapsible-heading"},e,/* @__PURE__ */qt.createElement("span",null,t&&/* @__PURE__ */qt.createElement(_,{value:"Some scaling processes are disabled that may prevent scheduled actions from working"},/* @__PURE__ */qt.createElement("span",{className:"fa fa-exclamation-circle warning-text"})),"Scheduled Actions"))},e.scheduledActions.map((e,t)=>/* @__PURE__ */qt.createElement(Pd,{key:t,action:e})),e.scheduledActions.length>0&&/* @__PURE__ */qt.createElement("p",null,/* @__PURE__ */qt.createElement("strong",null,"Note:")," Schedules are evaluated in UTC."),0===e.scheduledActions.length&&/* @__PURE__ */qt.createElement("p",null,"No Scheduled Actions are configured for this server group."),Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.editScheduledActions},"Edit Scheduled Actions"))}}function Fd(e,t,a){var n,r;const l=((null==(r=null==(n=null==e?void 0:e[t.account])?void 0:n.aws)?void 0:r[t.region])||[]).filter(e=>e.vpcId===t.vpcId),s=new Map(l.map(e=>[e.id,e])),i=/* @__PURE__ */new Set;return[...(a||[]).map(e=>(i.add(e.id),s.get(e.id)||e)),...l.filter(e=>!i.has(e.id)).sort((e,t)=>e.name.localeCompare(t.name))]}const Md=class e extends qt.Component{constructor(){super(...arguments),this.initialSecurityGroups=this.props.securityGroups||(this.props.serverGroup.securityGroups||[]).map(e=>({id:e,name:e})),this.state={availableSecurityGroups:this.initialSecurityGroups,securityGroups:this.initialSecurityGroups,securityGroupsLoaded:!1,taskMonitor:new w({application:this.props.application,title:`Update ${j.get("Firewalls")} for ${this.props.serverGroup.name}`,onDismiss:this.props.dismissModal,onTaskComplete:()=>this.props.application.serverGroups.refresh()})},this.isUnmounted=!1,this.loadSecurityGroups=()=>(this.setState({securityGroupsLoaded:!1,securityGroupsLoadError:void 0}),this.context.services.securityGroupReader.getAllSecurityGroups().then(e=>{this.isUnmounted||this.setState({availableSecurityGroups:Fd(e,this.props.serverGroup,this.state.securityGroups),securityGroupsLoaded:!0})}).catch(()=>{this.isUnmounted||this.setState({securityGroupsLoaded:!0,securityGroupsLoadError:"Unable to load security groups. Check your connection and try again."})})),this.submit=()=>{const{application:e,serverGroup:t}=this.props;this.state.taskMonitor.submit(()=>this.context.services.serverGroupWriter.updateSecurityGroups(t,this.state.securityGroups,e,function(e){return Boolean(e.launchTemplate||e.mixedInstancesPolicy)}(t)))}}static show(t,a){return ft(t.serverGroup,t.application).then(n=>n&&I.show(e,t,void 0,a))}componentDidMount(){this.loadSecurityGroups()}componentWillUnmount(){this.isUnmounted=!0}render(){const{dismissModal:e,serverGroup:t}=this.props;/* @__PURE__ */
|
|
272
|
+
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(vt,{monitor:this.state.taskMonitor}),/* @__PURE__ */qt.createElement(ye,{dismiss:e}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Edit ",j.get("Firewalls")," for ",t.name)),/* @__PURE__ */qt.createElement(Za.Body,{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-md-10 col-md-offset-1"},/* @__PURE__ */qt.createElement(an,{labelKey:"name",isLoading:!this.state.securityGroupsLoaded,multi:!0,onChange:e=>this.setState({securityGroups:e||[]}),optionRenderer:e=>/* @__PURE__ */qt.createElement("span",null,`${e.name} (${e.id})`),options:this.state.availableSecurityGroups,value:this.state.securityGroups,valueKey:"id"}),this.state.securityGroupsLoadError&&/* @__PURE__ */qt.createElement("div",{className:"alert alert-danger security-groups-load-error",role:"alert"},this.state.securityGroupsLoadError," ",/* @__PURE__ */qt.createElement("button",{className:"btn btn-default btn-xs",onClick:this.loadSecurityGroups,type:"button"},"Retry"))))),/* @__PURE__ */qt.createElement(yc,{account:t.account,isValid:this.state.securityGroupsLoaded&&!this.state.securityGroupsLoadError,onCancel:e,onSubmit:this.submit}))}};Md.contextType=C;let Rd=Md;const Ld=class extends qt.Component{constructor(e){super(e),this.editSecurityGroups=()=>{const{app:e,serverGroup:t}=this.props;Rd.show({application:e,securityGroups:this.state.securityGroups,serverGroup:t},this.context.services)},this.state={securityGroups:this.getSecurityGroups(e)}}tryFindingSecurityGroupInIndex(e,t,a,n){try{return fo.resolveIndexedSecurityGroup(e,{account:t,region:a},n)}catch(r){return}}getSecurityGroups(e){let t;const{app:a,serverGroup:n}=e;return n.securityGroups&&n.securityGroups.length&&(t=la(n.securityGroups).map(e=>ka(a.securityGroups.data,{accountName:n.account,region:n.region,id:e})||ka(a.securityGroups.data,{accountName:n.account,region:n.region,name:e})||this.tryFindingSecurityGroupInIndex(a.securityGroupsIndex,n.account,n.region,e)||{id:e,name:e}).compact().value()),t}componentWillReceiveProps(e){this.setState({securityGroups:this.getSecurityGroups(e)})}render(){const{serverGroup:e}=this.props,{securityGroups:t}=this.state;/* @__PURE__ */
|
|
273
273
|
return qt.createElement(z,{heading:j.get("Firewalls")},/* @__PURE__ */qt.createElement("ul",null,na(t,"name").map(t=>/* @__PURE__ */qt.createElement("li",{key:t.name},/* @__PURE__ */qt.createElement(en,{to:"^.firewallDetails",params:{name:t.name,accountId:t.accountName,region:e.region,vpcId:e.vpcId,provider:e.type}},
|
|
274
|
-
/* @__PURE__ */qt.createElement("a",null,t.name," (",t.id,")"))))),Cn.adHocInfraWritesEnabled&&e.vpcId&&/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.editSecurityGroups},"Edit ",j.get("Firewalls")))}};
|
|
274
|
+
/* @__PURE__ */qt.createElement("a",null,t.name," (",t.id,")"))))),Cn.adHocInfraWritesEnabled&&e.vpcId&&/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.editSecurityGroups},"Edit ",j.get("Firewalls")))}};Ld.contextType=C;let zd=Ld;class Od extends qt.Component{render(){const{serverGroup:e}=this.props;/* @__PURE__ */
|
|
275
275
|
return qt.createElement(z,{heading:"Tags"},0===e.asg.tags.length&&/* @__PURE__ */qt.createElement("div",null,"No tags associated with this server group"),e.asg.tags.length>0&&/* @__PURE__ */qt.createElement("dl",null,na(e.asg.tags,"key").map(e=>[
|
|
276
276
|
/* @__PURE__ */qt.createElement("dt",{key:e.key},e.key),
|
|
277
|
-
/* @__PURE__ */qt.createElement("dd",{key:e.value},e.value)])))}}class
|
|
278
|
-
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(vt,{monitor:this.state.taskMonitor}),/* @__PURE__ */qt.createElement(ye,{dismiss:e}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Modify Warm Pool for ",t.name)),/* @__PURE__ */qt.createElement(Za.Body,{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-offset-2 col-sm-10"},/* @__PURE__ */qt.createElement("div",{className:"checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:a,onChange:e=>this.setState({enabled:e.target.checked}),type:"checkbox"})," ","Enable Warm Pool",/* @__PURE__ */qt.createElement(c,{content:"Keeps a pool of pre-initialized instances alongside this Auto Scaling Group to speed up scale-out.",placement:"right"}))))),a&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("label",{className:"col-sm-4 control-label"},"Min Size"),/* @__PURE__ */qt.createElement("div",{className:"col-sm-6"},/* @__PURE__ */qt.createElement("input",{className:"form-control",type:"number",min:0,value:n,onChange:e=>this.setState({minSize:Number(e.target.value)})}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("label",{className:"col-sm-4 control-label"},"Max Group Prepared Capacity",/* @__PURE__ */qt.createElement(c,{content:"The maximum capacity of the Auto Scaling Group, including the warm pool. -1 means no limit beyond the group's own max size."})),/* @__PURE__ */qt.createElement("div",{className:"col-sm-6"},/* @__PURE__ */qt.createElement("input",{className:"form-control",type:"number",min:-1,value:r,onChange:e=>this.setState({maxGroupPreparedCapacity:Number(e.target.value)})}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("label",{className:"col-sm-4 control-label"},"Instance State"),/* @__PURE__ */qt.createElement("div",{className:"col-sm-6"},/* @__PURE__ */qt.createElement("select",{className:"form-control",value:l,onChange:e=>this.setState({poolState:e.target.value})}
|
|
279
|
-
return qt.createElement(z,{cacheKey:"Warm Pool",heading:"Warm Pool"},r?/* @__PURE__ */qt.createElement("ul",{className:"warm-pool"},/* @__PURE__ */qt.createElement("li",null,"Min Size: ",null!=(e=r.minSize)?e:0),/* @__PURE__ */qt.createElement("li",null,"Max Group Prepared Capacity:"," ",null!=r.maxGroupPreparedCapacity&&r.maxGroupPreparedCapacity>=0?r.maxGroupPreparedCapacity:"No limit"),/* @__PURE__ */qt.createElement("li",null,"Instance State: ",null!=(t=r.poolState)?t:"Stopped"),/* @__PURE__ */qt.createElement("li",null,"Reuse on Scale In: ",(null==(a=r.instanceReusePolicy)?void 0:a.reuseOnScaleIn)?"Yes":"No")):/* @__PURE__ */qt.createElement("div",{className:"text-disabled"},"No warm pool configured"),Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.editWarmPool},"Edit Warm Pool"))}}function
|
|
277
|
+
/* @__PURE__ */qt.createElement("dd",{key:e.value},e.value)])))}}class $d{static getWarmPoolConfiguration(e){var t;return null==(t=e.asg)?void 0:t.warmPoolConfiguration}static isEnabled(e){return!!$d.getWarmPoolConfiguration(e)}static poolStates(){return["Stopped","Running","Hibernated"]}}class Ud extends qt.Component{constructor(){var e,t,a,n,r,l,s,i,o;super(...arguments),this.initialConfiguration=$d.getWarmPoolConfiguration(this.props.serverGroup),this.state={enabled:!!this.initialConfiguration,minSize:null!=(t=null==(e=this.initialConfiguration)?void 0:e.minSize)?t:0,maxGroupPreparedCapacity:null!=(n=null==(a=this.initialConfiguration)?void 0:a.maxGroupPreparedCapacity)?n:-1,poolState:null!=(l=null==(r=this.initialConfiguration)?void 0:r.poolState)?l:"Stopped",reuseOnScaleIn:null!=(o=null==(i=null==(s=this.initialConfiguration)?void 0:s.instanceReusePolicy)?void 0:i.reuseOnScaleIn)&&o,taskMonitor:new w({application:this.props.application,title:`Update Warm Pool for ${this.props.serverGroup.name}`,onDismiss:this.props.dismissModal,onTaskComplete:()=>this.props.application.serverGroups.refresh()})},this.submit=()=>{const{application:e,serverGroup:t}=this.props,a=function(e,t){const a={asgName:t.name,regions:[t.region],credentials:t.account,cloudProvider:"aws",reason:e.reason};return e.enabled?{...a,type:"modifyWarmPool",action:"upsert",minSize:e.minSize,maxGroupPreparedCapacity:e.maxGroupPreparedCapacity,poolState:e.poolState,reuseOnScaleIn:e.reuseOnScaleIn}:{...a,type:"modifyWarmPool",action:"delete"}}(this.state,t);this.state.taskMonitor.submit(()=>X.executeTask({application:e,description:`Update Warm Pool for ${t.name}`,job:[a]}))}}static show(e){return ft(e.serverGroup,e.application).then(t=>t&&I.show(Ud,e))}render(){const{dismissModal:e,serverGroup:t}=this.props,{enabled:a,minSize:n,maxGroupPreparedCapacity:r,poolState:l,reuseOnScaleIn:s}=this.state;/* @__PURE__ */
|
|
278
|
+
return qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement(vt,{monitor:this.state.taskMonitor}),/* @__PURE__ */qt.createElement(ye,{dismiss:e}),/* @__PURE__ */qt.createElement(Za.Header,null,/* @__PURE__ */qt.createElement(Za.Title,null,"Modify Warm Pool for ",t.name)),/* @__PURE__ */qt.createElement(Za.Body,{className:"container-fluid form-horizontal"},/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-offset-2 col-sm-10"},/* @__PURE__ */qt.createElement("div",{className:"checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:a,onChange:e=>this.setState({enabled:e.target.checked}),type:"checkbox"})," ","Enable Warm Pool",/* @__PURE__ */qt.createElement(c,{content:"Keeps a pool of pre-initialized instances alongside this Auto Scaling Group to speed up scale-out.",placement:"right"}))))),a&&/* @__PURE__ */qt.createElement(qt.Fragment,null,/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("label",{className:"col-sm-4 control-label"},"Min Size"),/* @__PURE__ */qt.createElement("div",{className:"col-sm-6"},/* @__PURE__ */qt.createElement("input",{className:"form-control",type:"number",min:0,value:n,onChange:e=>this.setState({minSize:Number(e.target.value)})}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("label",{className:"col-sm-4 control-label"},"Max Group Prepared Capacity",/* @__PURE__ */qt.createElement(c,{content:"The maximum capacity of the Auto Scaling Group, including the warm pool. -1 means no limit beyond the group's own max size."})),/* @__PURE__ */qt.createElement("div",{className:"col-sm-6"},/* @__PURE__ */qt.createElement("input",{className:"form-control",type:"number",min:-1,value:r,onChange:e=>this.setState({maxGroupPreparedCapacity:Number(e.target.value)})}))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("label",{className:"col-sm-4 control-label"},"Instance State"),/* @__PURE__ */qt.createElement("div",{className:"col-sm-6"},/* @__PURE__ */qt.createElement("select",{className:"form-control",value:l,onChange:e=>this.setState({poolState:e.target.value})},$d.poolStates().map(e=>/* @__PURE__ */qt.createElement("option",{key:e,value:e},e))))),/* @__PURE__ */qt.createElement("div",{className:"form-group"},/* @__PURE__ */qt.createElement("div",{className:"col-sm-offset-2 col-sm-10"},/* @__PURE__ */qt.createElement("div",{className:"checkbox"},/* @__PURE__ */qt.createElement("label",null,/* @__PURE__ */qt.createElement("input",{checked:s,onChange:e=>this.setState({reuseOnScaleIn:e.target.checked}),type:"checkbox"})," ","Reuse instances on scale in",/* @__PURE__ */qt.createElement(c,{content:"If enabled, instances terminated by scale-in are returned to the warm pool instead of being terminated."})))))),/* @__PURE__ */qt.createElement(St,{reason:this.state.reason,onChange:e=>this.setState({reason:e})})),/* @__PURE__ */qt.createElement(yc,{account:t.account,isValid:!0,onCancel:e,onSubmit:this.submit}))}}class Vd extends qt.Component{constructor(){super(...arguments),this.editWarmPool=()=>{const{app:e,serverGroup:t}=this.props;Ud.show({application:e,serverGroup:t})}}render(){var e,t,a;const{serverGroup:n}=this.props,r=$d.getWarmPoolConfiguration(n);/* @__PURE__ */
|
|
279
|
+
return qt.createElement(z,{cacheKey:"Warm Pool",heading:"Warm Pool"},r?/* @__PURE__ */qt.createElement("ul",{className:"warm-pool"},/* @__PURE__ */qt.createElement("li",null,"Min Size: ",null!=(e=r.minSize)?e:0),/* @__PURE__ */qt.createElement("li",null,"Max Group Prepared Capacity:"," ",null!=r.maxGroupPreparedCapacity&&r.maxGroupPreparedCapacity>=0?r.maxGroupPreparedCapacity:"No limit"),/* @__PURE__ */qt.createElement("li",null,"Instance State: ",null!=(t=r.poolState)?t:"Stopped"),/* @__PURE__ */qt.createElement("li",null,"Reuse on Scale In: ",(null==(a=r.instanceReusePolicy)?void 0:a.reuseOnScaleIn)?"Yes":"No")):/* @__PURE__ */qt.createElement("div",{className:"text-disabled"},"No warm pool configured"),Cn.adHocInfraWritesEnabled&&/* @__PURE__ */qt.createElement("a",{className:"clickable",onClick:this.editWarmPool},"Edit Warm Pool"))}}function Hd(e,t,a="aws"){We.pipeline.getStageTypes().some(t=>{const n=t.provides||t.key,r=null===a||t.cloudProvider===a;return n===e&&r})||t()}Vt.registerValidator("aws",new class{validateSpecialCharacters(e,t){/^[a-zA-Z_0-9.]*$/g.test(e)||t.push("Only dot(.) and underscore(_) special characters are allowed.")}validateClassicLock(e){const t=Cn.classicLaunchLockout;t&&t</* @__PURE__ */(new Date).getTime()&&e.push(`New applications deployed to AWS are restricted to VPC; you cannot create server groups,\n load balancers, or ${j.get("firewalls")} in EC2 Classic.`)}validateLoadBalancerCharacters(e,t){(e.includes(".")||e.includes("_"))&&t.push("If the application's name contains an underscore(_) or dot(.),\n you will not be able to create a load balancer,\n preventing it from being used as a front end service.\n Any hostname constructed with this application name may have issues.")}validateLength(e,t,a){if(e.length>250)a.push("The maximum length for an application in Amazon is 250 characters.");else{if(e.length>240)if(e.length>=248)t.push(`You will not be able to include a stack or detail field for clusters or ${j.get("firewalls")}.`);else{const a=248-e.length;t.push(`If you plan to include a stack or detail field for clusters, you will only\n have ~${a} characters to do so.`)}if(e.length>20)if(e.length>32)t.push(`You will not be able to create an Amazon load balancer for this application if the\n application's name is longer than 32 characters (currently: ${e.length} characters)`);else if(e.length>=30)t.push(`If you plan to create load balancers for this application, be aware that the character limit\n for load balancer names is 32 (currently: ${e.length} characters). With separators ("-"), you will not\n be able to add a stack and detail field to any load balancer.`);else{const a=30-e.length;t.push(`If you plan to create load balancers for this application, be aware that the character limit\n for load balancer names is 32. You will only have ~${a} characters to add a stack or detail\n field to any load balancer.`)}}}validate(e=""){const t=[],a=[];return e.length&&(this.validateClassicLock(t),this.validateSpecialCharacters(e,a),this.validateLoadBalancerCharacters(e,t),this.validateLength(e,t,a)),{warnings:t,errors:a}}}),ze.registerProvider("aws",{name:"Amazon",adHocInfrastructureWritesEnabled:Cn.adHocInfraWritesEnabled,logo:{path:ql},applicationProviderFields:[{field:"useAmiBlockDeviceMappings",label:"Prefer AMI Block Device Mappings",type:"boolean"}],image:{reader:ur},serverGroup:{transformer:lr,detailsActions:xc,detailsGetter:Dc,detailsSections:[pd,gd,vd,fd,yd,Cd,zd,Id,kd,Bd,Vd,Od,Sd,ud,Nd],CloneServerGroupModal:fc,commandBuilder:Co,configurationService:To,instanceTypeService:rr,scalingActivitiesEnabled:!0,TargetTrackingChart:Lc,UpsertStepPolicyModal:Qc,UpsertTargetTrackingModal:qc},instance:{instanceTypeService:rr,details:Pr},loadBalancer:{transformer:Rr,CreateLoadBalancerModal:Al,useDetailsHook:Bl,detailsActions:Rl,detailsSections:Hl,targetGroupDetails:Or,ClusterContainer:Gr,LoadBalancersTag:Mr},function:{details:dr,CreateFunctionModal:Yn,setTransformer:Pn,transformer:Pn},securityGroup:{transformer:Eo,reader:fo,CreateSecurityGroupModal:ro,details:vo}}),Hd("bake",Jl),Hd("cloneServerGroup",ts),Hd("deployCloudFormation",Cs),Hd("destroyServerGroup",Vs),Hd("disableServerGroup",qs),Hd("disableCluster",js),Hd("enableServerGroup",_s),Hd("findImage",Ys),Hd("findImageFromTags",Js),Hd("Aws.LambdaDeleteStage",os,null),Hd("Aws.LambdaDeploymentStage",Bs,null),Hd("Aws.LambdaInvokeStage",ri,null),Hd("modifyAwsScalingProcess",oi),Hd("modifyWarmPool",ui),Hd("resizeServerGroup",bi),Hd("rollbackCluster",Ni),Hd("Aws.LambdaUpdateCodeStage",Ki,null),Hd("Aws.LambdaTrafficRoutingStage",zi,null),Hd("scaleDownCluster",$i),Hd("shrinkCluster",Vi),Hd("upsertImageTags",qi),d.registerProvider("aws",["custom","redblack","rollingpush","rollingredblack","monitored"]);export{Cn as AWSProviderSettings,ud as AdvancedSettingsDetailsSection,Yc as AlarmConfigurer,gd as AmazonCapacityDetailsSection,_r as AmazonCertificateReader,Ur as AmazonCertificateSelectField,dr as AmazonFunctionDetails,Po as AmazonImageSelectInput,pd as AmazonInfoDetailsSection,Ir as AmazonInstanceActions,kr as AmazonInstanceActionsComponent,Pr as AmazonInstanceDetails,Tr as AmazonInstanceDetailsComponent,yr as AmazonInstanceWriter,Rl as AmazonLoadBalancerActions,Al as AmazonLoadBalancerChoiceModal,Gr as AmazonLoadBalancerClusterContainer,xr as AmazonLoadBalancerDataUtils,Ll as AmazonLoadBalancerDetailsSection,$l as AmazonLoadBalancerFirewallsSection,Vl as AmazonLoadBalancerHealthChecksSection,Ol as AmazonLoadBalancerListenersSection,zl as AmazonLoadBalancerStatusSection,Ul as AmazonLoadBalancerSubnetsSection,Mr as AmazonLoadBalancersTag,Fr as AmazonLoadBalancersTagComponent,Cc as AmazonResizeServerGroupModal,po as AmazonSecurityGroupActions,vo as AmazonSecurityGroupDetails,go as AmazonSecurityGroupDetailsComponent,ro as AmazonSecurityGroupModal,no as AmazonSecurityGroupModalComponent,Qc as AmazonUpsertScalingPolicyModal,qc as AmazonUpsertTargetTrackingModal,Pn as AwsFunctionTransformer,Rr as AwsLoadBalancerTransformer,yc as AwsModalFooter,wo as AwsServerGroupConfigurationService,To as AwsServerGroupConfigurationServiceDelegate,cr as AwsServices,_c as COMPARATORS,Yn as CreateLambdaFunction,Kn as CreateLambdaFunctionComponent,ed as CreateScalingPolicyButton,Bc as DateLineChart,zc as DimensionsEditor,Jn as FunctionActions,zn as FunctionBasicInformation,vd as HealthDetailsSection,so as IPRangeRules,gr as InstanceDns,pr as InstanceInformation,fr as InstanceStatus,fd as InstancesDistributionDetailsSection,So as KeyPairsReader,yd as LaunchConfigDetailsSection,Cd as LaunchTemplateDetailsSection,Il as LoadBalancerTypes,Nd as LogsDetailsSection,Fc as MetricAlarmChart,$c as MetricSelector,Sd as PackageDetailsSection,Wc as PolicyTypeSelectionModal,kd as ScalingPoliciesDetailsSection,jc as ScalingPolicyAdditionalSettings,id as ScalingPolicySummary,td as ScalingPolicyWriter,Id as ScalingProcessesDetailsSection,Bd as ScheduledActionsDetailsSection,ic as SecurityGroupSelector,zd as SecurityGroupsDetailsSection,hc as ServerGroupAdvancedSettings,mc as ServerGroupAdvancedSettingsCommon,xo as ServerGroupBasicSettings,Go as ServerGroupBasicSettingsComponent,Fo as ServerGroupCapacity,tc as ServerGroupInstanceType,lc as ServerGroupLoadBalancers,dc as ServerGroupSecurityGroups,cc as ServerGroupSecurityGroupsRemoved,ac as ServerGroupZones,Jc as StepPolicyAction,ld as StepPolicySummary,il as SubnetSelectField,sl as SubnetSelectInput,Od as TagsDetailsSection,Ar as TargetGroup,Or as TargetGroupDetails,zr as TargetGroupDetailsComponent,Uc as TargetMetricFields,Vc as TargetTrackingAdditionalSettings,Lc as TargetTrackingChart,sd as TargetTrackingSummary,Hn as VpcReader,Wn as VpcTag,Vd as WarmPoolDetailsSection,Hl as amazonLoadBalancerDetailsSections,Cr as applyHealthCheckInfoToTargetGroups,oo as buildIpRulesModel,co as buildSecurityGroupRulesModel,br as getAllTargetGroups,Ed as getBaseImageName,Qi as initializeAmazonSecurityGroupForModal,to as isAmazonSecurityGroupValid,Sr as loadAmazonInstanceDetails,Dl as loadAmazonLoadBalancerDetails,Bl as useAmazonLoadBalancerDetails};
|
|
280
280
|
//# sourceMappingURL=index.js.map
|