Skip to content

Commit 9d6f992

Browse files
committed
chore(servicediscovery): reference interfaces
Reference interfaces for L2s, like #35271. "chore" because I plan to make a lot of these PRs and they're not adding value to the changelog. (Generated with AI)
1 parent 8e9f730 commit 9d6f992

File tree

6 files changed

+65
-8
lines changed

6 files changed

+65
-8
lines changed

packages/aws-cdk-lib/aws-apigatewayv2-integrations/lib/http/service-discovery.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { HttpPrivateIntegrationOptions } from './base-types';
22
import { HttpPrivateIntegration } from './private/integration';
33
import { HttpRouteIntegrationBindOptions, HttpRouteIntegrationConfig } from '../../../aws-apigatewayv2';
4-
import * as servicediscovery from '../../../aws-servicediscovery';
54
import { ValidationError } from '../../../core/lib/errors';
5+
import { IServiceRef } from '../../../interfaces/generated/aws-servicediscovery-interfaces.generated';
66

77
/**
88
* Properties to initialize `HttpServiceDiscoveryIntegration`.
@@ -21,7 +21,7 @@ export class HttpServiceDiscoveryIntegration extends HttpPrivateIntegration {
2121
*/
2222
constructor(
2323
id: string,
24-
private readonly service: servicediscovery.IService,
24+
private readonly service: IServiceRef,
2525
private readonly props: HttpServiceDiscoveryIntegrationProps = {}) {
2626
super(id);
2727
}
@@ -37,7 +37,7 @@ export class HttpServiceDiscoveryIntegration extends HttpPrivateIntegration {
3737
type: this.integrationType,
3838
connectionType: this.connectionType,
3939
connectionId: this.props.vpcLink.vpcLinkId,
40-
uri: this.service.serviceArn,
40+
uri: this.service.serviceRef.serviceArn,
4141
secureServerName: this.props.secureServerName,
4242
parameterMapping: this.props.parameterMapping,
4343
};

packages/aws-cdk-lib/aws-servicediscovery/lib/http-namespace.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { CfnHttpNamespace } from './servicediscovery.generated';
55
import { Resource } from '../../core';
66
import { addConstructMetadata, MethodMetadata } from '../../core/lib/metadata-resource';
77
import { propertyInjectable } from '../../core/lib/prop-injectable';
8+
import { IHttpNamespaceRef } from '../../interfaces/generated/aws-servicediscovery-interfaces.generated';
89

910
export interface HttpNamespaceProps extends BaseNamespaceProps {}
10-
export interface IHttpNamespace extends INamespace { }
11+
export interface IHttpNamespace extends INamespace, IHttpNamespaceRef { }
1112
export interface HttpNamespaceAttributes {
1213
/**
1314
* A name for the Namespace.
@@ -39,6 +40,12 @@ export class HttpNamespace extends Resource implements IHttpNamespace {
3940
public namespaceId = attrs.namespaceId;
4041
public namespaceArn = attrs.namespaceArn;
4142
public type = NamespaceType.HTTP;
43+
public get httpNamespaceRef() {
44+
return {
45+
httpNamespaceId: attrs.namespaceId,
46+
httpNamespaceArn: attrs.namespaceArn,
47+
};
48+
}
4249
}
4350
return new Import(scope, id);
4451
}
@@ -88,6 +95,13 @@ export class HttpNamespace extends Resource implements IHttpNamespace {
8895
/** @attribute */
8996
public get httpNamespaceId() { return this.namespaceId; }
9097

98+
public get httpNamespaceRef() {
99+
return {
100+
httpNamespaceId: this.namespaceId,
101+
httpNamespaceArn: this.namespaceArn,
102+
};
103+
}
104+
91105
/**
92106
* Creates a service within the namespace
93107
*/

packages/aws-cdk-lib/aws-servicediscovery/lib/instance.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { IService } from './service';
22
import { IResource, Names, Resource } from '../../core';
3+
import { IInstanceRef } from '../../interfaces/generated/aws-servicediscovery-interfaces.generated';
34

4-
export interface IInstance extends IResource {
5+
export interface IInstance extends IResource, IInstanceRef {
56
/**
67
* The id of the instance resource
78
* @attribute
@@ -45,6 +46,12 @@ export abstract class InstanceBase extends Resource implements IInstance {
4546
*/
4647
public abstract readonly service: IService;
4748

49+
public get instanceRef() {
50+
return {
51+
instanceId: this.instanceId,
52+
};
53+
}
54+
4855
/**
4956
* Generate a unique instance Id that is safe to pass to CloudMap
5057
*/

packages/aws-cdk-lib/aws-servicediscovery/lib/private-dns-namespace.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as ec2 from '../../aws-ec2';
66
import { Resource, ValidationError } from '../../core';
77
import { addConstructMetadata, MethodMetadata } from '../../core/lib/metadata-resource';
88
import { propertyInjectable } from '../../core/lib/prop-injectable';
9+
import { IPrivateDnsNamespaceRef } from '../../interfaces/generated/aws-servicediscovery-interfaces.generated';
910

1011
export interface PrivateDnsNamespaceProps extends BaseNamespaceProps {
1112
/**
@@ -14,7 +15,7 @@ export interface PrivateDnsNamespaceProps extends BaseNamespaceProps {
1415
readonly vpc: ec2.IVpc;
1516
}
1617

17-
export interface IPrivateDnsNamespace extends INamespace { }
18+
export interface IPrivateDnsNamespace extends INamespace, IPrivateDnsNamespaceRef { }
1819

1920
export interface PrivateDnsNamespaceAttributes {
2021
/**
@@ -47,6 +48,12 @@ export class PrivateDnsNamespace extends Resource implements IPrivateDnsNamespac
4748
public namespaceId = attrs.namespaceId;
4849
public namespaceArn = attrs.namespaceArn;
4950
public type = NamespaceType.DNS_PRIVATE;
51+
public get privateDnsNamespaceRef() {
52+
return {
53+
privateDnsNamespaceId: attrs.namespaceId,
54+
privateDnsNamespaceArn: attrs.namespaceArn,
55+
};
56+
}
5057
}
5158
return new Import(scope, id);
5259
}
@@ -106,6 +113,13 @@ export class PrivateDnsNamespace extends Resource implements IPrivateDnsNamespac
106113
/** @attribute */
107114
public get privateDnsNamespaceId() { return this.namespaceId; }
108115

116+
public get privateDnsNamespaceRef() {
117+
return {
118+
privateDnsNamespaceId: this.namespaceId,
119+
privateDnsNamespaceArn: this.namespaceArn,
120+
};
121+
}
122+
109123
/**
110124
* Creates a service within the namespace
111125
*/

packages/aws-cdk-lib/aws-servicediscovery/lib/public-dns-namespace.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { CfnPublicDnsNamespace } from './servicediscovery.generated';
55
import { Resource } from '../../core';
66
import { addConstructMetadata, MethodMetadata } from '../../core/lib/metadata-resource';
77
import { propertyInjectable } from '../../core/lib/prop-injectable';
8+
import { IPublicDnsNamespaceRef } from '../../interfaces/generated/aws-servicediscovery-interfaces.generated';
89

910
export interface PublicDnsNamespaceProps extends BaseNamespaceProps {}
10-
export interface IPublicDnsNamespace extends INamespace { }
11+
export interface IPublicDnsNamespace extends INamespace, IPublicDnsNamespaceRef { }
1112
export interface PublicDnsNamespaceAttributes {
1213
/**
1314
* A name for the Namespace.
@@ -39,6 +40,12 @@ export class PublicDnsNamespace extends Resource implements IPublicDnsNamespace
3940
public namespaceId = attrs.namespaceId;
4041
public namespaceArn = attrs.namespaceArn;
4142
public type = NamespaceType.DNS_PUBLIC;
43+
public get publicDnsNamespaceRef() {
44+
return {
45+
publicDnsNamespaceId: attrs.namespaceId,
46+
publicDnsNamespaceArn: attrs.namespaceArn,
47+
};
48+
}
4249
}
4350
return new Import(scope, id);
4451
}
@@ -94,6 +101,13 @@ export class PublicDnsNamespace extends Resource implements IPublicDnsNamespace
94101
/** @attribute */
95102
public get publicDnsNamespaceId() { return this.namespaceId; }
96103

104+
public get publicDnsNamespaceRef() {
105+
return {
106+
publicDnsNamespaceId: this.namespaceId,
107+
publicDnsNamespaceArn: this.namespaceArn,
108+
};
109+
}
110+
97111
/**
98112
* Creates a service within the namespace
99113
*/

packages/aws-cdk-lib/aws-servicediscovery/lib/service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ import * as elbv2 from '../../aws-elasticloadbalancingv2';
1111
import { Duration, IResource, Resource, ValidationError } from '../../core';
1212
import { addConstructMetadata, MethodMetadata } from '../../core/lib/metadata-resource';
1313
import { propertyInjectable } from '../../core/lib/prop-injectable';
14+
import { IServiceRef } from '../../interfaces/generated/aws-servicediscovery-interfaces.generated';
1415

15-
export interface IService extends IResource {
16+
export interface IService extends IResource, IServiceRef {
1617
/**
1718
* A name for the Cloudmap Service.
1819
* @attribute
@@ -152,6 +153,13 @@ abstract class ServiceBase extends Resource implements IService {
152153
public abstract routingPolicy: RoutingPolicy;
153154
public abstract readonly serviceName: string;
154155
public abstract discoveryType: DiscoveryType;
156+
157+
public get serviceRef() {
158+
return {
159+
serviceId: this.serviceId,
160+
serviceArn: this.serviceArn,
161+
};
162+
}
155163
}
156164

157165
export interface ServiceAttributes {

0 commit comments

Comments
 (0)