-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix(appmesh): Move Client Policy from Virtual Service to backend structure #12943
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
Changes from 1 commit
8472ea1
3a784bd
32aff99
29c3626
fa5f6c0
db3821e
1df6f67
8b327f0
9075284
3a9ea8e
1ee03f4
1c7143b
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 |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
|
|
||
| import { CfnVirtualNode } from './appmesh.generated'; | ||
| import { ClientPolicy } from './client-policy'; | ||
| import { IVirtualService } from './virtual-service'; | ||
|
|
||
| // keep this import separate from other imports to reduce chance for merge conflicts with v2-main | ||
| // eslint-disable-next-line no-duplicate-imports, import/order | ||
| import { Construct } from '@aws-cdk/core'; | ||
|
|
||
| /** | ||
| * Represents the properties needed to define backend defaults | ||
| */ | ||
| export interface BackendDefaultsOptions { | ||
| /** | ||
| * Client policy for backend defaults | ||
| * | ||
| * @default none | ||
| */ | ||
| readonly clientPolicy?: ClientPolicy; | ||
| } | ||
|
|
||
| /** | ||
| * Represents the properties needed to define a backend | ||
| */ | ||
| export interface BackendOptions { | ||
| /** | ||
| * The Virtual Service this backend points to | ||
| */ | ||
| readonly virtualService: IVirtualService; | ||
| /** | ||
|
||
| * Client policy for a backend | ||
| * | ||
| * @default none | ||
| */ | ||
| readonly clientPolicy?: ClientPolicy; | ||
| } | ||
|
|
||
| /** | ||
| * Provides static factory methods to generate backend API structures | ||
| */ | ||
| export class Backends { | ||
| /** | ||
| * Creates a backend defaults | ||
| */ | ||
| public static backendDefaults(props: BackendDefaultsOptions): BackendDefaults { | ||
| return new BackendDefaults(props.clientPolicy); | ||
| } | ||
| /** | ||
| * Creates a named backend | ||
| */ | ||
| public static backend(props: BackendOptions): Backend { | ||
| return new Backend(props.virtualService, props.clientPolicy); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Represents all the backends that aren't specifically defined using the backend . | ||
| */ | ||
| export class BackendDefaults { | ||
|
||
|
|
||
| constructor (private readonly clientPolicy: ClientPolicy | undefined) {} | ||
|
|
||
| /** | ||
| * Return backend defaults config | ||
| */ | ||
| public bind(_scope: Construct): CfnVirtualNode.BackendDefaultsProperty { | ||
| return { | ||
| clientPolicy: this.clientPolicy?.bind(_scope).clientPolicy, | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Represents the backend that a virtual node will send outbound traffic to | ||
| */ | ||
| export class Backend { | ||
|
|
||
| constructor (private readonly virtualService: IVirtualService, | ||
| private readonly clientPolicy: ClientPolicy | undefined) {} | ||
|
|
||
| /** | ||
| * Return backend config | ||
| */ | ||
| public bind(_scope: Construct): CfnVirtualNode.BackendProperty { | ||
| return { | ||
| virtualService: { | ||
| virtualServiceName: this.virtualService.virtualServiceName, | ||
| clientPolicy: this.clientPolicy?.bind(_scope).clientPolicy, | ||
| }, | ||
| }; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,9 @@ | |
| "dotnet": { | ||
| "namespace": "Amazon.CDK.AWS.AppMesh", | ||
| "packageId": "Amazon.CDK.AWS.AppMesh", | ||
| "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/master/logo/default-256-dark.png" | ||
| "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/master/logo/default-256-dark.png", | ||
| "signAssembly": true, | ||
| "assemblyOriginatorKeyFile": "../../key.snk" | ||
|
||
| }, | ||
| "java": { | ||
| "package": "software.amazon.awscdk.services.appmesh", | ||
|
|
||
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 this line
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.
I second this motion 🙂.