-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(codepipeline-actions): use IBaseService instead of BaseService in EcsDeployActionProps #6412
Changes from 7 commits
8be4b51
f38e6f4
2333da2
441f276
51fc085
61f2f5f
8c9e994
b44e309
e786f9f
bee67c6
739a61a
99ecc57
fba4573
6e1d696
583b8af
fee33f2
2a4e1f3
5310ca4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import * as ec2 from '@aws-cdk/aws-ec2'; | ||
import { Construct, Lazy, Resource, Stack } from '@aws-cdk/core'; | ||
import { BaseService, BaseServiceOptions, IService, LaunchType, PropagatedTagSource } from '../base/base-service'; | ||
import { BaseService, BaseServiceOptions, IBaseService, IService, LaunchType, PropagatedTagSource } from '../base/base-service'; | ||
import { NetworkMode, TaskDefinition } from '../base/task-definition'; | ||
import { Cluster } from '../cluster'; | ||
import { CfnService } from '../ecs.generated'; | ||
import { PlacementConstraint, PlacementStrategy } from '../placement'; | ||
|
||
|
@@ -87,6 +88,20 @@ export interface IEc2Service extends IService { | |
|
||
} | ||
|
||
/** | ||
* The properties to import from the service using the EC2 launch type. | ||
*/ | ||
export interface Ec2ServiceAttributes { | ||
/** | ||
* The name of the cluster that hosts the service. | ||
*/ | ||
readonly clusterName: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to be |
||
/** | ||
skinny85 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* The service ARN. | ||
*/ | ||
readonly serviceArn: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should also be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added validation to prevent from setting both or neither. If both are set, it may be confusing. |
||
} | ||
|
||
/** | ||
* This creates a service using the EC2 launch type on an ECS cluster. | ||
* | ||
|
@@ -100,6 +115,24 @@ export class Ec2Service extends BaseService implements IEc2Service { | |
public static fromEc2ServiceArn(scope: Construct, id: string, ec2ServiceArn: string): IEc2Service { | ||
class Import extends Resource implements IEc2Service { | ||
public readonly serviceArn = ec2ServiceArn; | ||
public readonly serviceName = Stack.of(scope).parseArn(ec2ServiceArn).resourceName as string; | ||
} | ||
return new Import(scope, id); | ||
} | ||
|
||
/** | ||
* Imports from the specified service attrributes. | ||
*/ | ||
public static fromEc2ServiceAttributes(scope: Construct, id: string, attrs: Ec2ServiceAttributes): IBaseService { | ||
const stack = Stack.of(scope); | ||
const serviceName = stack.parseArn(attrs.serviceArn).resourceName as string; | ||
|
||
class Import extends Resource implements IBaseService { | ||
public readonly serviceArn = attrs.serviceArn; | ||
public readonly serviceName = serviceName; | ||
public readonly cluster = new Cluster(stack, serviceName, { | ||
clusterName: attrs.clusterName, | ||
}); | ||
} | ||
return new Import(scope, id); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the
test.doesNotThrow()
, it's redundant.