Skip to content

Commit

Permalink
fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
atsushi-ishibashi committed Feb 24, 2020
1 parent e786f9f commit bee67c6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
15 changes: 10 additions & 5 deletions packages/@aws-cdk/aws-ecs/lib/ec2/ec2-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,16 @@ export interface Ec2ServiceAttributes {
readonly cluster: ICluster;
/**
* The service ARN.
*
* @default - generated from serviceName
*/
readonly serviceArn: string?;
readonly serviceArn?: string;
/**
* The name of the service.
*
* @default - generated from serviceArn
*/
readonly serviceName: string?;
readonly serviceName?: string;
}

/**
Expand Down Expand Up @@ -132,9 +136,10 @@ export class Ec2Service extends BaseService implements IEc2Service {
throw new Error('You can only specify either serviceArn or serviceName.');
}
const stack = Stack.of(scope);
let name, arn: string;
let name: string;
let arn: string;
if (attrs.serviceName) {
name = attrs.serviceName;
name = attrs.serviceName as string;
arn = stack.formatArn({
partition: stack.partition,
service: 'ecs',
Expand All @@ -144,7 +149,7 @@ export class Ec2Service extends BaseService implements IEc2Service {
resourceName: name,
});
} else {
arn = attrs.serviceArn;
arn = attrs.serviceArn as string;
name = stack.parseArn(arn).resourceName as string;
}
class Import extends Resource implements IBaseService {
Expand Down
15 changes: 10 additions & 5 deletions packages/@aws-cdk/aws-ecs/lib/fargate/fargate-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,16 @@ export interface FargateServiceAttributes {
readonly cluster: ICluster;
/**
* The service ARN.
*
* @default - generated from serviceName
*/
readonly serviceArn: string?;
readonly serviceArn?: string;
/**
* The name of the service.
*
* @default - generated from serviceArn
*/
readonly serviceName: string?;
readonly serviceName?: string;
}

/**
Expand Down Expand Up @@ -110,9 +114,10 @@ export class FargateService extends BaseService implements IFargateService {
throw new Error('You can only specify either serviceArn or serviceName.');
}
const stack = cdk.Stack.of(scope);
let name, arn: string;
let name: string;
let arn: string;
if (attrs.serviceName) {
name = attrs.serviceName;
name = attrs.serviceName as string;
arn = stack.formatArn({
partition: stack.partition,
service: 'ecs',
Expand All @@ -122,7 +127,7 @@ export class FargateService extends BaseService implements IFargateService {
resourceName: name,
});
} else {
arn = attrs.serviceArn;
arn = attrs.serviceArn as string;
name = stack.parseArn(arn).resourceName as string;
}
class Import extends cdk.Resource implements IBaseService {
Expand Down

0 comments on commit bee67c6

Please sign in to comment.