Skip to content
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

docs(appmesh): clarifying the difference between constructor and method to create a resource #15237

Merged
merged 16 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/@aws-cdk/aws-appmesh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ const router = mesh.addVirtualRouter('router', {
```

The router can also be created using the constructor and passing in the mesh instead of calling the `addVirtualRouter()` method for the mesh.
The same pattern applies to all constructs within the appmesh library, for any mesh.addXZY method, a new constuctor can also be used.
Note that creating the router using the `addVirtualRouter()` method places it in the same Stack that the mesh belongs to
(which might be different from the current Stack).
The same pattern applies to all constructs within the appmesh library, for any mesh.addXZY method, a new constructor can also be used.
(For example, see [Adding a VirtualNode](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-appmesh-readme.html#adding-a-virtualnode)
and [Adding a Virtual Gateway](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-appmesh-readme.html#adding-a-virtual-gateway) sections)
This is particularly useful for cross stack resources are required.
Where creating the `mesh` as part of an infrastructure stack and creating the `resources` such as `nodes` is more useful to keep in the application stack.

Expand Down
16 changes: 11 additions & 5 deletions packages/@aws-cdk/aws-appmesh/lib/mesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export enum MeshFilterType {
}

/**
* Interface wich all Mesh based classes MUST implement
* Interface which all Mesh based classes MUST implement
*/
export interface IMesh extends cdk.IResource {
/**
Expand All @@ -41,17 +41,23 @@ export interface IMesh extends cdk.IResource {
readonly meshArn: string;

/**
* Adds a VirtualRouter to the Mesh with the given id and props
* Creates a new VirtualRouter in this Mesh.
* Note that the Router is created in the same Stack that this Mesh belongs to,
* which might be different than current stack.
*/
addVirtualRouter(id: string, props?: VirtualRouterBaseProps): VirtualRouter;

/**
* Adds a VirtualNode to the Mesh
* Creates a new VirtualNode in this Mesh.
* Note that the Node is created in the same Stack that this Mesh belongs to,
* which might be different than current stack.
*/
addVirtualNode(id: string, props?: VirtualNodeBaseProps): VirtualNode;

/**
* Adds a VirtualGateway to the Mesh
* Creates a new VirtualGateway in this Mesh.
* Note that the Gateway is created in the same Stack that this Mesh belongs to,
* which might be different than current stack.
*/
addVirtualGateway(id: string, props?: VirtualGatewayBaseProps): VirtualGateway;
}
Expand Down Expand Up @@ -108,7 +114,7 @@ export interface MeshProps {
/**
* The name of the Mesh being defined
*
* @default - A name is autmoatically generated
* @default - A name is automatically generated
*/
readonly meshName?: string;

Expand Down