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 Fargate instances. // // Example: // var vpc iVpc // // sharedComputeEnv := batch.NewFargateComputeEnvironment(this, jsii.String("spotEnv"), &FargateComputeEnvironmentProps{ // Vpc: Vpc, // Spot: jsii.Boolean(true), // }) // lowPriorityQueue := batch.NewJobQueue(this, jsii.String("JobQueue"), &JobQueueProps{ // Priority: jsii.Number(1), // }) // highPriorityQueue := batch.NewJobQueue(this, jsii.String("JobQueue"), &JobQueueProps{ // Priority: jsii.Number(10), // }) // lowPriorityQueue.AddComputeEnvironment(sharedComputeEnv, jsii.Number(1)) // highPriorityQueue.AddComputeEnvironment(sharedComputeEnv, jsii.Number(1)) // // Experimental. type FargateComputeEnvironment interface { awscdk.Resource IComputeEnvironment IFargateComputeEnvironment IManagedComputeEnvironment // 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 // 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 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 // 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 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 // 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 FargateComputeEnvironment type jsiiProxy_FargateComputeEnvironment struct { internal.Type__awscdkResource jsiiProxy_IComputeEnvironment jsiiProxy_IFargateComputeEnvironment jsiiProxy_IManagedComputeEnvironment } func (j *jsiiProxy_FargateComputeEnvironment) ComputeEnvironmentArn() *string { var returns *string _jsii_.Get( j, "computeEnvironmentArn", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) ComputeEnvironmentName() *string { var returns *string _jsii_.Get( j, "computeEnvironmentName", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) Connections() awsec2.Connections { var returns awsec2.Connections _jsii_.Get( j, "connections", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) Enabled() *bool { var returns *bool _jsii_.Get( j, "enabled", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) Env() *awscdk.ResourceEnvironment { var returns *awscdk.ResourceEnvironment _jsii_.Get( j, "env", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) MaxvCpus() *float64 { var returns *float64 _jsii_.Get( j, "maxvCpus", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) Node() constructs.Node { var returns constructs.Node _jsii_.Get( j, "node", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) PhysicalName() *string { var returns *string _jsii_.Get( j, "physicalName", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) ReplaceComputeEnvironment() *bool { var returns *bool _jsii_.Get( j, "replaceComputeEnvironment", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) SecurityGroups() *[]awsec2.ISecurityGroup { var returns *[]awsec2.ISecurityGroup _jsii_.Get( j, "securityGroups", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) ServiceRole() awsiam.IRole { var returns awsiam.IRole _jsii_.Get( j, "serviceRole", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) Spot() *bool { var returns *bool _jsii_.Get( j, "spot", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) Stack() awscdk.Stack { var returns awscdk.Stack _jsii_.Get( j, "stack", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) Tags() awscdk.TagManager { var returns awscdk.TagManager _jsii_.Get( j, "tags", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) TerminateOnUpdate() *bool { var returns *bool _jsii_.Get( j, "terminateOnUpdate", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) UpdateTimeout() awscdk.Duration { var returns awscdk.Duration _jsii_.Get( j, "updateTimeout", &returns, ) return returns } func (j *jsiiProxy_FargateComputeEnvironment) UpdateToLatestImageVersion() *bool { var returns *bool _jsii_.Get( j, "updateToLatestImageVersion", &returns, ) return returns } // Experimental. func NewFargateComputeEnvironment(scope constructs.Construct, id *string, props *FargateComputeEnvironmentProps) FargateComputeEnvironment { _init_.Initialize() if err := validateNewFargateComputeEnvironmentParameters(scope, id, props); err != nil { panic(err) } j := jsiiProxy_FargateComputeEnvironment{} _jsii_.Create( "@aws-cdk/aws-batch-alpha.FargateComputeEnvironment", []interface{}{scope, id, props}, &j, ) return &j } // Experimental. func NewFargateComputeEnvironment_Override(f FargateComputeEnvironment, scope constructs.Construct, id *string, props *FargateComputeEnvironmentProps) { _init_.Initialize() _jsii_.Create( "@aws-cdk/aws-batch-alpha.FargateComputeEnvironment", []interface{}{scope, id, props}, f, ) } // Reference an existing FargateComputeEnvironment by its arn. // Experimental. func FargateComputeEnvironment_FromFargateComputeEnvironmentArn(scope constructs.Construct, id *string, fargateComputeEnvironmentArn *string) IFargateComputeEnvironment { _init_.Initialize() if err := validateFargateComputeEnvironment_FromFargateComputeEnvironmentArnParameters(scope, id, fargateComputeEnvironmentArn); err != nil { panic(err) } var returns IFargateComputeEnvironment _jsii_.StaticInvoke( "@aws-cdk/aws-batch-alpha.FargateComputeEnvironment", "fromFargateComputeEnvironmentArn", []interface{}{scope, id, fargateComputeEnvironmentArn}, &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 FargateComputeEnvironment_IsConstruct(x interface{}) *bool { _init_.Initialize() if err := validateFargateComputeEnvironment_IsConstructParameters(x); err != nil { panic(err) } var returns *bool _jsii_.StaticInvoke( "@aws-cdk/aws-batch-alpha.FargateComputeEnvironment", "isConstruct", []interface{}{x}, &returns, ) return returns } // Returns true if the construct was created by CDK, and false otherwise. // Experimental. func FargateComputeEnvironment_IsOwnedResource(construct constructs.IConstruct) *bool { _init_.Initialize() if err := validateFargateComputeEnvironment_IsOwnedResourceParameters(construct); err != nil { panic(err) } var returns *bool _jsii_.StaticInvoke( "@aws-cdk/aws-batch-alpha.FargateComputeEnvironment", "isOwnedResource", []interface{}{construct}, &returns, ) return returns } // Check whether the given construct is a Resource. // Experimental. func FargateComputeEnvironment_IsResource(construct constructs.IConstruct) *bool { _init_.Initialize() if err := validateFargateComputeEnvironment_IsResourceParameters(construct); err != nil { panic(err) } var returns *bool _jsii_.StaticInvoke( "@aws-cdk/aws-batch-alpha.FargateComputeEnvironment", "isResource", []interface{}{construct}, &returns, ) return returns } func (f *jsiiProxy_FargateComputeEnvironment) ApplyRemovalPolicy(policy awscdk.RemovalPolicy) { if err := f.validateApplyRemovalPolicyParameters(policy); err != nil { panic(err) } _jsii_.InvokeVoid( f, "applyRemovalPolicy", []interface{}{policy}, ) } func (f *jsiiProxy_FargateComputeEnvironment) GeneratePhysicalName() *string { var returns *string _jsii_.Invoke( f, "generatePhysicalName", nil, // no parameters &returns, ) return returns } func (f *jsiiProxy_FargateComputeEnvironment) GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string { if err := f.validateGetResourceArnAttributeParameters(arnAttr, arnComponents); err != nil { panic(err) } var returns *string _jsii_.Invoke( f, "getResourceArnAttribute", []interface{}{arnAttr, arnComponents}, &returns, ) return returns } func (f *jsiiProxy_FargateComputeEnvironment) GetResourceNameAttribute(nameAttr *string) *string { if err := f.validateGetResourceNameAttributeParameters(nameAttr); err != nil { panic(err) } var returns *string _jsii_.Invoke( f, "getResourceNameAttribute", []interface{}{nameAttr}, &returns, ) return returns } func (f *jsiiProxy_FargateComputeEnvironment) ToString() *string { var returns *string _jsii_.Invoke( f, "toString", nil, // no parameters &returns, ) return returns }