Skip to content

Commit

Permalink
Add scope check
Browse files Browse the repository at this point in the history
  • Loading branch information
hupe1980 committed Jun 30, 2022
1 parent 92529e2 commit 515652b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
28 changes: 28 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ new plus_aws.ApplicationLoadBalancer(scope: Construct, id: string, props: Applic
| --- | --- |
| <code><a href="#cdktg.plus_aws.ApplicationLoadBalancer.toString">toString</a></code> | Returns a string representation of this construct. |
| <code><a href="#cdktg.plus_aws.ApplicationLoadBalancer.communicatesWith">communicatesWith</a></code> | *No description.* |
| <code><a href="#cdktg.plus_aws.ApplicationLoadBalancer.isInScope">isInScope</a></code> | *No description.* |
| <code><a href="#cdktg.plus_aws.ApplicationLoadBalancer.isTrafficForwarding">isTrafficForwarding</a></code> | *No description.* |
| <code><a href="#cdktg.plus_aws.ApplicationLoadBalancer.isWebApplication">isWebApplication</a></code> | *No description.* |
| <code><a href="#cdktg.plus_aws.ApplicationLoadBalancer.isWebService">isWebService</a></code> | *No description.* |
Expand Down Expand Up @@ -84,6 +85,12 @@ public communicatesWith(id: string, target: TechnicalAsset, options: Communicati

---

##### `isInScope` <a name="isInScope" id="cdktg.plus_aws.ApplicationLoadBalancer.isInScope"></a>

```typescript
public isInScope(): boolean
```

##### `isTrafficForwarding` <a name="isTrafficForwarding" id="cdktg.plus_aws.ApplicationLoadBalancer.isTrafficForwarding"></a>

```typescript
Expand Down Expand Up @@ -471,6 +478,7 @@ new plus.Browser(scope: Construct, id: string, props: BrowserProps)
| --- | --- |
| <code><a href="#cdktg.plus.Browser.toString">toString</a></code> | Returns a string representation of this construct. |
| <code><a href="#cdktg.plus.Browser.communicatesWith">communicatesWith</a></code> | *No description.* |
| <code><a href="#cdktg.plus.Browser.isInScope">isInScope</a></code> | *No description.* |
| <code><a href="#cdktg.plus.Browser.isTrafficForwarding">isTrafficForwarding</a></code> | *No description.* |
| <code><a href="#cdktg.plus.Browser.isWebApplication">isWebApplication</a></code> | *No description.* |
| <code><a href="#cdktg.plus.Browser.isWebService">isWebService</a></code> | *No description.* |
Expand Down Expand Up @@ -511,6 +519,12 @@ public communicatesWith(id: string, target: TechnicalAsset, options: Communicati

---

##### `isInScope` <a name="isInScope" id="cdktg.plus.Browser.isInScope"></a>

```typescript
public isInScope(): boolean
```

##### `isTrafficForwarding` <a name="isTrafficForwarding" id="cdktg.plus.Browser.isTrafficForwarding"></a>

```typescript
Expand Down Expand Up @@ -3019,6 +3033,7 @@ new TechnicalAsset(scope: Construct, id: string, props: TechnicalAssetProps)
| --- | --- |
| <code><a href="#cdktg.TechnicalAsset.toString">toString</a></code> | Returns a string representation of this construct. |
| <code><a href="#cdktg.TechnicalAsset.communicatesWith">communicatesWith</a></code> | *No description.* |
| <code><a href="#cdktg.TechnicalAsset.isInScope">isInScope</a></code> | *No description.* |
| <code><a href="#cdktg.TechnicalAsset.isTrafficForwarding">isTrafficForwarding</a></code> | *No description.* |
| <code><a href="#cdktg.TechnicalAsset.isWebApplication">isWebApplication</a></code> | *No description.* |
| <code><a href="#cdktg.TechnicalAsset.isWebService">isWebService</a></code> | *No description.* |
Expand Down Expand Up @@ -3059,6 +3074,12 @@ public communicatesWith(id: string, target: TechnicalAsset, options: Communicati

---

##### `isInScope` <a name="isInScope" id="cdktg.TechnicalAsset.isInScope"></a>

```typescript
public isInScope(): boolean
```

##### `isTrafficForwarding` <a name="isTrafficForwarding" id="cdktg.TechnicalAsset.isTrafficForwarding"></a>

```typescript
Expand Down Expand Up @@ -3643,6 +3664,7 @@ new plus.Vault(scope: Construct, id: string, props: VaultProps)
| --- | --- |
| <code><a href="#cdktg.plus.Vault.toString">toString</a></code> | Returns a string representation of this construct. |
| <code><a href="#cdktg.plus.Vault.communicatesWith">communicatesWith</a></code> | *No description.* |
| <code><a href="#cdktg.plus.Vault.isInScope">isInScope</a></code> | *No description.* |
| <code><a href="#cdktg.plus.Vault.isTrafficForwarding">isTrafficForwarding</a></code> | *No description.* |
| <code><a href="#cdktg.plus.Vault.isWebApplication">isWebApplication</a></code> | *No description.* |
| <code><a href="#cdktg.plus.Vault.isWebService">isWebService</a></code> | *No description.* |
Expand Down Expand Up @@ -3684,6 +3706,12 @@ public communicatesWith(id: string, target: TechnicalAsset, options: Communicati

---

##### `isInScope` <a name="isInScope" id="cdktg.plus.Vault.isInScope"></a>

```typescript
public isInScope(): boolean
```

##### `isTrafficForwarding` <a name="isTrafficForwarding" id="cdktg.plus.Vault.isTrafficForwarding"></a>

```typescript
Expand Down
4 changes: 3 additions & 1 deletion src/risks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export class RiskAspect implements IAspect {
// When a technical communication link does not send or receive any data assets, this is
// an indicator for an unnecessary communication link (or for an incomplete model).
if (!node.hasDataAssets()) {
Annotations.of(node).addWarning("Unnecessary Communication Link");
if (node.source.isInScope() || node.target.isInScope()) {
Annotations.of(node).addWarning("Unnecessary Communication Link");
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/technical-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ export class TechnicalAsset extends Resource {
].includes(this.technology);
}

public isInScope(): boolean {
return this.scope === Scope.inScope();
}

public get highestIntegrity(): Integrity {
let { integrity: highest } = this.ciaTriad;

Expand Down

0 comments on commit 515652b

Please sign in to comment.