package awscdkbatchalpha import ( _init_ "github.com/aws/aws-cdk-go/awscdkbatchalpha/v2/jsii" _jsii_ "github.com/aws/jsii-runtime-go/runtime" "github.com/aws/aws-cdk-go/awscdk/v2" "github.com/aws/aws-cdk-go/awscdk/v2/awsec2" "github.com/aws/aws-cdk-go/awscdk/v2/awsiam" "github.com/aws/aws-cdk-go/awscdkbatchalpha/v2/internal" "github.com/aws/constructs-go/constructs/v10" ) // A ManagedComputeEnvironment that uses ECS orchestration on EC2 instances. // // Example: // var computeEnv iManagedEc2EcsComputeEnvironment // vpc := ec2.NewVpc(this, jsii.String("VPC")) // computeEnv.AddInstanceClass(ec2.InstanceClass_M5AD) // // Or, specify it on the constructor: // // Or, specify it on the constructor: // batch.NewManagedEc2EcsComputeEnvironment(this, jsii.String("myEc2ComputeEnv"), &ManagedEc2EcsComputeEnvironmentProps{ // Vpc: Vpc, // InstanceClasses: []instanceClass{ // ec2.*instanceClass_R4, // }, // }) // // Experimental. type ManagedEc2EcsComputeEnvironment interface { awscdk.Resource IComputeEnvironment IManagedComputeEnvironment IManagedEc2EcsComputeEnvironment // The allocation strategy to use if not enough instances of the best fitting instance type can be allocated. // Experimental. AllocationStrategy() AllocationStrategy // The ARN of this compute environment. // Experimental. ComputeEnvironmentArn() *string // The name of the ComputeEnvironment. // Experimental. ComputeEnvironmentName() *string // The network connections associated with this resource. // Experimental. Connections() awsec2.Connections // Whether or not this ComputeEnvironment can accept jobs from a Queue. // // Enabled ComputeEnvironments can accept jobs from a Queue and // can scale instances up or down. // Disabled ComputeEnvironments cannot accept jobs from a Queue or // scale instances up or down. // // If you change a ComputeEnvironment from enabled to disabled while it is executing jobs, // Jobs in the `STARTED` or `RUNNING` states will not // be interrupted. As jobs complete, the ComputeEnvironment will scale instances down to `minvCpus`. // // To ensure you aren't billed for unused capacity, set `minvCpus` to `0`. // Experimental. Enabled() *bool // The environment this resource belongs to. // // For resources that are created and managed by the CDK // (generally, those created by creating new class instances like Role, Bucket, etc.), // this is always the same as the environment of the stack they belong to; // however, for imported resources // (those obtained from static methods like fromRoleArn, fromBucketName, etc.), // that might be different than the stack they were imported into. // Experimental. Env() *awscdk.ResourceEnvironment // Configure which AMIs this Compute Environment can launch. // // Leave this `undefined` to allow Batch to choose the latest AMIs it supports for each instance that it launches. // Experimental. Images() *[]*EcsMachineImage // The instance classes that this Compute Environment can launch. // // Which one is chosen depends on the `AllocationStrategy` used. // Batch will automatically choose the size. // Experimental. InstanceClasses() *[]awsec2.InstanceClass // The execution Role that instances launched by this Compute Environment will use. // Experimental. InstanceRole() awsiam.IRole // The instance types that this Compute Environment can launch. // // Which one is chosen depends on the `AllocationStrategy` used. // Experimental. InstanceTypes() *[]awsec2.InstanceType // The Launch Template that this Compute Environment will use to provision EC2 Instances. // // *Note*: if `securityGroups` is specified on both your // launch template and this Compute Environment, **the // `securityGroup`s on the Compute Environment override the // ones on the launch template. // Experimental. LaunchTemplate() awsec2.ILaunchTemplate // The maximum vCpus this `ManagedComputeEnvironment` can scale up to. // // *Note*: if this Compute Environment uses EC2 resources (not Fargate) with either `AllocationStrategy.BEST_FIT_PROGRESSIVE` or // `AllocationStrategy.SPOT_CAPACITY_OPTIMIZED`, or `AllocationStrategy.BEST_FIT` with Spot instances, // The scheduler may exceed this number by at most one of the instances specified in `instanceTypes` // or `instanceClasses`. // Experimental. MaxvCpus() *float64 // The minimum vCPUs that an environment should maintain, even if the compute environment is DISABLED. // Experimental. MinvCpus() *float64 // The tree node. // Experimental. Node() constructs.Node // Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource. // // This value will resolve to one of the following: // - a concrete value (e.g. `"my-awesome-bucket"`) // - `undefined`, when a name should be generated by CloudFormation // - a concrete name generated automatically during synthesis, in // cross-environment scenarios. // Experimental. PhysicalName() *string // The EC2 placement group to associate with your compute resources. // // If you intend to submit multi-node parallel jobs to this Compute Environment, // you should consider creating a cluster placement group and associate it with your compute resources. // This keeps your multi-node parallel job on a logical grouping of instances // within a single Availability Zone with high network flow potential. // Experimental. PlacementGroup() awsec2.IPlacementGroup // Specifies whether this Compute Environment is replaced if an update is made that requires replacing its instances. // // To enable more properties to be updated, // set this property to `false`. When changing the value of this property to false, // do not change any other properties at the same time. // If other properties are changed at the same time, // and the change needs to be rolled back but it can't, // it's possible for the stack to go into the UPDATE_ROLLBACK_FAILED state. // You can't update a stack that is in the UPDATE_ROLLBACK_FAILED state. // However, if you can continue to roll it back, // you can return the stack to its original settings and then try to update it again. // // The properties which require a replacement of the Compute Environment are:. // Experimental. ReplaceComputeEnvironment() *bool // The security groups this Compute Environment will launch instances in. // Experimental. SecurityGroups() *[]awsec2.ISecurityGroup // The role Batch uses to perform actions on your behalf in your account, such as provision instances to run your jobs. // Experimental. ServiceRole() awsiam.IRole // Whether or not to use spot instances. // // Spot instances are less expensive EC2 instances that can be // reclaimed by EC2 at any time; your job will be given two minutes // of notice before reclamation. // Experimental. Spot() *bool // The maximum percentage that a Spot Instance price can be when compared with the On-Demand price for that instance type before instances are launched. // // For example, if your maximum percentage is 20%, the Spot price must be // less than 20% of the current On-Demand price for that Instance. // You always pay the lowest market price and never more than your maximum percentage. // For most use cases, Batch recommends leaving this field empty. // Experimental. SpotBidPercentage() *float64 // The service-linked role that Spot Fleet needs to launch instances on your behalf. // Experimental. SpotFleetRole() awsiam.IRole // The stack in which this resource is defined. // Experimental. Stack() awscdk.Stack // TagManager to set, remove and format tags. // Experimental. Tags() awscdk.TagManager // Whether or not any running jobs will be immediately terminated when an infrastructure update occurs. // // If this is enabled, any terminated jobs may be retried, depending on the job's // retry policy. // Experimental. TerminateOnUpdate() *bool // Only meaningful if `terminateOnUpdate` is `false`. // // If so, // when an infrastructure update is triggered, any running jobs // will be allowed to run until `updateTimeout` has expired. // Experimental. UpdateTimeout() awscdk.Duration // Whether or not the AMI is updated to the latest one supported by Batch when an infrastructure update occurs. // // If you specify a specific AMI, this property will be ignored. // Experimental. UpdateToLatestImageVersion() *bool // Add an instance class to this compute environment. // Experimental. AddInstanceClass(instanceClass awsec2.InstanceClass) // Add an instance type to this compute environment. // Experimental. AddInstanceType(instanceType awsec2.InstanceType) // Apply the given removal policy to this resource. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). // Experimental. ApplyRemovalPolicy(policy awscdk.RemovalPolicy) // Experimental. GeneratePhysicalName() *string // Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`). // // Normally, this token will resolve to `arnAttr`, but if the resource is // referenced across environments, `arnComponents` will be used to synthesize // a concrete ARN with the resource's physical name. Make sure to reference // `this.physicalName` in `arnComponents`. // Experimental. GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string // Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`). // // Normally, this token will resolve to `nameAttr`, but if the resource is // referenced across environments, it will be resolved to `this.physicalName`, // which will be a concrete name. // Experimental. GetResourceNameAttribute(nameAttr *string) *string // Returns a string representation of this construct. // Experimental. ToString() *string } // The jsii proxy struct for ManagedEc2EcsComputeEnvironment type jsiiProxy_ManagedEc2EcsComputeEnvironment struct { internal.Type__awscdkResource jsiiProxy_IComputeEnvironment jsiiProxy_IManagedComputeEnvironment jsiiProxy_IManagedEc2EcsComputeEnvironment } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) AllocationStrategy() AllocationStrategy { var returns AllocationStrategy _jsii_.Get( j, "allocationStrategy", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) ComputeEnvironmentArn() *string { var returns *string _jsii_.Get( j, "computeEnvironmentArn", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) ComputeEnvironmentName() *string { var returns *string _jsii_.Get( j, "computeEnvironmentName", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) Connections() awsec2.Connections { var returns awsec2.Connections _jsii_.Get( j, "connections", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) Enabled() *bool { var returns *bool _jsii_.Get( j, "enabled", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) Env() *awscdk.ResourceEnvironment { var returns *awscdk.ResourceEnvironment _jsii_.Get( j, "env", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) Images() *[]*EcsMachineImage { var returns *[]*EcsMachineImage _jsii_.Get( j, "images", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) InstanceClasses() *[]awsec2.InstanceClass { var returns *[]awsec2.InstanceClass _jsii_.Get( j, "instanceClasses", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) InstanceRole() awsiam.IRole { var returns awsiam.IRole _jsii_.Get( j, "instanceRole", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) InstanceTypes() *[]awsec2.InstanceType { var returns *[]awsec2.InstanceType _jsii_.Get( j, "instanceTypes", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) LaunchTemplate() awsec2.ILaunchTemplate { var returns awsec2.ILaunchTemplate _jsii_.Get( j, "launchTemplate", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) MaxvCpus() *float64 { var returns *float64 _jsii_.Get( j, "maxvCpus", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) MinvCpus() *float64 { var returns *float64 _jsii_.Get( j, "minvCpus", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) Node() constructs.Node { var returns constructs.Node _jsii_.Get( j, "node", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) PhysicalName() *string { var returns *string _jsii_.Get( j, "physicalName", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) PlacementGroup() awsec2.IPlacementGroup { var returns awsec2.IPlacementGroup _jsii_.Get( j, "placementGroup", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) ReplaceComputeEnvironment() *bool { var returns *bool _jsii_.Get( j, "replaceComputeEnvironment", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) SecurityGroups() *[]awsec2.ISecurityGroup { var returns *[]awsec2.ISecurityGroup _jsii_.Get( j, "securityGroups", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) ServiceRole() awsiam.IRole { var returns awsiam.IRole _jsii_.Get( j, "serviceRole", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) Spot() *bool { var returns *bool _jsii_.Get( j, "spot", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) SpotBidPercentage() *float64 { var returns *float64 _jsii_.Get( j, "spotBidPercentage", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) SpotFleetRole() awsiam.IRole { var returns awsiam.IRole _jsii_.Get( j, "spotFleetRole", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) Stack() awscdk.Stack { var returns awscdk.Stack _jsii_.Get( j, "stack", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) Tags() awscdk.TagManager { var returns awscdk.TagManager _jsii_.Get( j, "tags", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) TerminateOnUpdate() *bool { var returns *bool _jsii_.Get( j, "terminateOnUpdate", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) UpdateTimeout() awscdk.Duration { var returns awscdk.Duration _jsii_.Get( j, "updateTimeout", &returns, ) return returns } func (j *jsiiProxy_ManagedEc2EcsComputeEnvironment) UpdateToLatestImageVersion() *bool { var returns *bool _jsii_.Get( j, "updateToLatestImageVersion", &returns, ) return returns } // Experimental. func NewManagedEc2EcsComputeEnvironment(scope constructs.Construct, id *string, props *ManagedEc2EcsComputeEnvironmentProps) ManagedEc2EcsComputeEnvironment { _init_.Initialize() if err := validateNewManagedEc2EcsComputeEnvironmentParameters(scope, id, props); err != nil { panic(err) } j := jsiiProxy_ManagedEc2EcsComputeEnvironment{} _jsii_.Create( "@aws-cdk/aws-batch-alpha.ManagedEc2EcsComputeEnvironment", []interface{}{scope, id, props}, &j, ) return &j } // Experimental. func NewManagedEc2EcsComputeEnvironment_Override(m ManagedEc2EcsComputeEnvironment, scope constructs.Construct, id *string, props *ManagedEc2EcsComputeEnvironmentProps) { _init_.Initialize() _jsii_.Create( "@aws-cdk/aws-batch-alpha.ManagedEc2EcsComputeEnvironment", []interface{}{scope, id, props}, m, ) } // refer to an existing ComputeEnvironment by its arn. // Experimental. func ManagedEc2EcsComputeEnvironment_FromManagedEc2EcsComputeEnvironmentArn(scope constructs.Construct, id *string, managedEc2EcsComputeEnvironmentArn *string) IManagedEc2EcsComputeEnvironment { _init_.Initialize() if err := validateManagedEc2EcsComputeEnvironment_FromManagedEc2EcsComputeEnvironmentArnParameters(scope, id, managedEc2EcsComputeEnvironmentArn); err != nil { panic(err) } var returns IManagedEc2EcsComputeEnvironment _jsii_.StaticInvoke( "@aws-cdk/aws-batch-alpha.ManagedEc2EcsComputeEnvironment", "fromManagedEc2EcsComputeEnvironmentArn", []interface{}{scope, id, managedEc2EcsComputeEnvironmentArn}, &returns, ) return returns } // Checks if `x` is a construct. // // Use this method instead of `instanceof` to properly detect `Construct` // instances, even when the construct library is symlinked. // // Explanation: in JavaScript, multiple copies of the `constructs` library on // disk are seen as independent, completely different libraries. As a // consequence, the class `Construct` in each copy of the `constructs` library // is seen as a different class, and an instance of one class will not test as // `instanceof` the other class. `npm install` will not create installations // like this, but users may manually symlink construct libraries together or // use a monorepo tool: in those cases, multiple copies of the `constructs` // library can be accidentally installed, and `instanceof` will behave // unpredictably. It is safest to avoid using `instanceof`, and using // this type-testing method instead. // // Returns: true if `x` is an object created from a class which extends `Construct`. // Experimental. func ManagedEc2EcsComputeEnvironment_IsConstruct(x interface{}) *bool { _init_.Initialize() if err := validateManagedEc2EcsComputeEnvironment_IsConstructParameters(x); err != nil { panic(err) } var returns *bool _jsii_.StaticInvoke( "@aws-cdk/aws-batch-alpha.ManagedEc2EcsComputeEnvironment", "isConstruct", []interface{}{x}, &returns, ) return returns } // Returns true if the construct was created by CDK, and false otherwise. // Experimental. func ManagedEc2EcsComputeEnvironment_IsOwnedResource(construct constructs.IConstruct) *bool { _init_.Initialize() if err := validateManagedEc2EcsComputeEnvironment_IsOwnedResourceParameters(construct); err != nil { panic(err) } var returns *bool _jsii_.StaticInvoke( "@aws-cdk/aws-batch-alpha.ManagedEc2EcsComputeEnvironment", "isOwnedResource", []interface{}{construct}, &returns, ) return returns } // Check whether the given construct is a Resource. // Experimental. func ManagedEc2EcsComputeEnvironment_IsResource(construct constructs.IConstruct) *bool { _init_.Initialize() if err := validateManagedEc2EcsComputeEnvironment_IsResourceParameters(construct); err != nil { panic(err) } var returns *bool _jsii_.StaticInvoke( "@aws-cdk/aws-batch-alpha.ManagedEc2EcsComputeEnvironment", "isResource", []interface{}{construct}, &returns, ) return returns } func (m *jsiiProxy_ManagedEc2EcsComputeEnvironment) AddInstanceClass(instanceClass awsec2.InstanceClass) { if err := m.validateAddInstanceClassParameters(instanceClass); err != nil { panic(err) } _jsii_.InvokeVoid( m, "addInstanceClass", []interface{}{instanceClass}, ) } func (m *jsiiProxy_ManagedEc2EcsComputeEnvironment) AddInstanceType(instanceType awsec2.InstanceType) { if err := m.validateAddInstanceTypeParameters(instanceType); err != nil { panic(err) } _jsii_.InvokeVoid( m, "addInstanceType", []interface{}{instanceType}, ) } func (m *jsiiProxy_ManagedEc2EcsComputeEnvironment) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) { if err := m.validateApplyRemovalPolicyParameters(policy); err != nil { panic(err) } _jsii_.InvokeVoid( m, "applyRemovalPolicy", []interface{}{policy}, ) } func (m *jsiiProxy_ManagedEc2EcsComputeEnvironment) GeneratePhysicalName() *string { var returns *string _jsii_.Invoke( m, "generatePhysicalName", nil, // no parameters &returns, ) return returns } func (m *jsiiProxy_ManagedEc2EcsComputeEnvironment) GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string { if err := m.validateGetResourceArnAttributeParameters(arnAttr, arnComponents); err != nil { panic(err) } var returns *string _jsii_.Invoke( m, "getResourceArnAttribute", []interface{}{arnAttr, arnComponents}, &returns, ) return returns } func (m *jsiiProxy_ManagedEc2EcsComputeEnvironment) GetResourceNameAttribute(nameAttr *string) *string { if err := m.validateGetResourceNameAttributeParameters(nameAttr); err != nil { panic(err) } var returns *string _jsii_.Invoke( m, "getResourceNameAttribute", []interface{}{nameAttr}, &returns, ) return returns } func (m *jsiiProxy_ManagedEc2EcsComputeEnvironment) ToString() *string { var returns *string _jsii_.Invoke( m, "toString", nil, // no parameters &returns, ) return returns }