Skip to content

Commit cd57248

Browse files
committed
merge in upstream changes
2 parents 6e160c8 + ee917c0 commit cd57248

File tree

30 files changed

+825
-361
lines changed

30 files changed

+825
-361
lines changed

package-lock.json

Lines changed: 1 addition & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Amazon Q Developer: Updated legal disclaimer text"
4+
}

packages/core/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,6 @@
502502
"mime-types": "^2.1.32",
503503
"node-fetch": "^2.7.0",
504504
"portfinder": "^1.0.32",
505-
"proper-lockfile": "^4.1.2",
506-
"ps-list": "^8.1.1",
507505
"semver": "^7.5.4",
508506
"stream-buffers": "^3.0.2",
509507
"strip-ansi": "^5.2.0",

packages/core/package.nls.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@
8080
"AWS.command.apig.copyUrl": "Copy URL",
8181
"AWS.command.apig.invokeRemoteRestApi": "Invoke on AWS",
8282
"AWS.command.apig.invokeRemoteRestApi.cn": "Invoke on Amazon",
83-
"AWS.command.applicationComposer.open": "Open with Application Composer",
84-
"AWS.command.applicationComposer.openDialog": "Open Template with Application Composer...",
83+
"AWS.command.applicationComposer.open": "Open with Infrastructure Composer",
84+
"AWS.command.applicationComposer.openDialog": "Open Template with Infrastructure Composer...",
8585
"AWS.command.auth.addConnection": "Add New Connection",
8686
"AWS.command.auth.showConnectionsPage": "Add New Connection",
8787
"AWS.command.auth.switchConnections": "Switch Connections",
@@ -227,7 +227,7 @@
227227
"AWS.lambda.explorerTitle": "Explorer",
228228
"AWS.developerTools.explorerTitle": "Developer Tools",
229229
"AWS.codewhisperer.explorerTitle": "CodeWhisperer",
230-
"AWS.appcomposer.explorerTitle": "Application Composer",
230+
"AWS.appcomposer.explorerTitle": "Infrastructure Composer",
231231
"AWS.cdk.explorerTitle": "CDK",
232232
"AWS.codecatalyst.explorerTitle": "CodeCatalyst",
233233
"AWS.cwl.limit.desc": "Maximum amount of log entries pulled per request from CloudWatch Logs (max 10000)",

packages/core/src/amazonq/webview/ui/tabs/generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class TabDataGenerator {
3030
const tabData: MynahUIDataModel = {
3131
tabTitle: taskName ?? TabTypeDataMap[tabType].title,
3232
promptInputInfo:
33-
'Use of Amazon Q is subject to the [AWS Responsible AI Policy](https://aws.amazon.com/machine-learning/responsible-ai/policy/).',
33+
'Amazon Q Developer uses generative AI. You may need to verify responses. See the [AWS Responsible AI Policy](https://aws.amazon.com/machine-learning/responsible-ai/policy/).',
3434
quickActionCommands: this.quickActionsGenerator.generateForTab(tabType),
3535
promptInputPlaceholder: TabTypeDataMap[tabType].placeholder,
3636
contextCommands: [

packages/core/src/applicationcomposer/codeLensProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class ApplicationComposerCodeLensProvider implements vscode.CodeLensProvi
3333
}
3434
const resourcesLoc = new vscode.Range(codeLensLine, 0, codeLensLine, 0)
3535
const codeLens = openTemplateInComposerCommand.build().asCodeLens(resourcesLoc, {
36-
title: localize('AWS.applicationComposer.codeLens.title', 'Visualize with Application Composer'),
36+
title: localize('AWS.applicationComposer.codeLens.title', 'Visualize with Infrastructure Composer'),
3737
tooltip: localize(
3838
'AWS.applicationComposer.codeLens.tooltip',
3939
'Visually design and build modern applications quickly'

packages/core/src/applicationcomposer/composerWebview.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ export class ApplicationComposer {
119119
): vscode.WebviewPanel {
120120
const panel = vscode.window.createWebviewPanel(
121121
'applicationComposer',
122-
localize('AWS.applicationComposer.title', '{0} (Application Composer)', path.basename(documentUri.fsPath)),
122+
localize(
123+
'AWS.applicationComposer.title',
124+
'{0} (Infrastructure Composer)',
125+
path.basename(documentUri.fsPath)
126+
),
123127
{
124128
preserveFocus: true,
125129
viewColumn: vscode.ViewColumn.Active,

packages/core/src/applicationcomposer/messageHandlers/openFeedbackMessageHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ import { submitFeedback } from '../../feedback/vue/submitFeedback'
77
import { placeholder } from '../../shared/vscode/commands2'
88

99
export function openFeedbackMessageHandler() {
10-
void submitFeedback(placeholder, 'Application Composer')
10+
void submitFeedback(placeholder, 'Infrastructure Composer')
1111
}

packages/core/src/applicationcomposer/webviewManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class ApplicationComposerManager {
116116
void vscode.window.showInformationMessage(
117117
localize(
118118
'AWS.applicationComposer.visualisation.errors.rendering',
119-
'There was an error rendering Application Composer, check logs for details.'
119+
'There was an error rendering Infrastructure Composer, check logs for details.'
120120
)
121121
)
122122
this.logger.error(`${this.name}: Unable to show App Composer webview: ${err}`)

packages/core/src/awsService/accessanalyzer/vue/iamPolicyChecks.ts

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as fs from 'fs'
88
import * as path from 'path'
99
import { getLogger, Logger } from '../../../shared/logger'
1010
import { localize } from '../../../shared/utilities/vsCodeUtils'
11-
import { VueWebview } from '../../../webviews/main'
11+
import { VueWebview, VueWebviewPanel } from '../../../webviews/main'
1212
import { ExtContext } from '../../../shared/extensions'
1313
import { telemetry } from '../../../shared/telemetry/telemetry'
1414
import { AccessAnalyzer, SharedIniFileCredentials } from 'aws-sdk'
@@ -31,8 +31,8 @@ import { ExpiredTokenException } from '@aws-sdk/client-sso-oidc'
3131

3232
const defaultTerraformConfigPath = 'resources/policychecks-tf-default.yaml'
3333
// Diagnostics for Custom checks are shared
34-
const customPolicyCheckDiagnosticCollection = vscode.languages.createDiagnosticCollection('customPolicyCheck')
35-
const validatePolicyDiagnosticCollection = vscode.languages.createDiagnosticCollection('validatePolicy')
34+
export const customPolicyCheckDiagnosticCollection = vscode.languages.createDiagnosticCollection('customPolicyCheck')
35+
export const validatePolicyDiagnosticCollection = vscode.languages.createDiagnosticCollection('validatePolicy')
3636

3737
export interface IamPolicyChecksInitialData {
3838
checkNoNewAccessFilePath: string
@@ -56,7 +56,7 @@ export class IamPolicyChecksWebview extends VueWebview {
5656
public static readonly sourcePath: string = 'src/awsService/accessanalyzer/vue/index.js'
5757
public readonly id = 'iamPolicyChecks'
5858
private static editedDocumentUri: vscode.Uri
59-
private static editedDocumentFileName: string
59+
public static editedDocumentFileName: string
6060
private static editedDocument: string
6161

6262
public constructor(
@@ -119,14 +119,18 @@ export class IamPolicyChecksWebview extends VueWebview {
119119
// Send the current active text editor to Webview to show what is being targeted by the user
120120
vscode.window.onDidChangeActiveTextEditor((message: any) => {
121121
const editedFile = vscode.window.activeTextEditor?.document
122-
IamPolicyChecksWebview.editedDocumentFileName = editedFile!.uri.path
123-
IamPolicyChecksWebview.editedDocument = editedFile!.getText()
124-
IamPolicyChecksWebview.editedDocumentUri = editedFile!.uri
125-
this.onChangeInputPath.fire(editedFile!.uri.path)
122+
if (editedFile !== undefined) {
123+
IamPolicyChecksWebview.editedDocumentFileName = editedFile.uri.path
124+
IamPolicyChecksWebview.editedDocument = editedFile.getText()
125+
IamPolicyChecksWebview.editedDocumentUri = editedFile.uri
126+
this.onChangeInputPath.fire(editedFile.uri.path)
127+
}
126128
})
127129
vscode.workspace.onDidChangeTextDocument((message: any) => {
128130
const editedFile = vscode.window.activeTextEditor?.document
129-
IamPolicyChecksWebview.editedDocument = editedFile!.getText()
131+
if (editedFile !== undefined) {
132+
IamPolicyChecksWebview.editedDocument = editedFile.getText()
133+
}
130134
})
131135
}
132136

@@ -715,10 +719,10 @@ export class IamPolicyChecksWebview extends VueWebview {
715719
}
716720

717721
public pushCustomCheckDiagnostic(diagnostics: vscode.Diagnostic[], finding: any, isBlocking: boolean) {
718-
const message = `${finding.findingType}: ${finding.message} - Resource name: ${finding.resourceName}, Policy name: ${finding.policyName}`
719-
if (message.includes('existingPolicyDocument')) {
720-
message.replace('existingPolicyDocument', 'reference document')
721-
}
722+
const findingMessage: string = finding.message.includes('existingPolicyDocument')
723+
? finding.message.replace('existingPolicyDocument', 'reference document')
724+
: finding.message
725+
const message = `${finding.findingType}: ${findingMessage} - Resource name: ${finding.resourceName}, Policy name: ${finding.policyName}`
722726
if (finding.details.reasons) {
723727
finding.details.reasons.forEach((reason: any) => {
724728
diagnostics.push(
@@ -744,7 +748,7 @@ export class IamPolicyChecksWebview extends VueWebview {
744748

745749
const Panel = VueWebview.compilePanel(IamPolicyChecksWebview)
746750

747-
export async function renderIamPolicyChecks(context: ExtContext): Promise<void> {
751+
export async function renderIamPolicyChecks(context: ExtContext): Promise<VueWebviewPanel | undefined> {
748752
const logger: Logger = getLogger()
749753
try {
750754
const client = new AccessAnalyzer({ region: context.regionProvider.defaultRegionId })
@@ -795,13 +799,14 @@ export async function renderIamPolicyChecks(context: ExtContext): Promise<void>
795799
viewColumn: vscode.ViewColumn.Beside,
796800
title: localize('AWS.iamPolicyChecks.title', 'IAM Policy Checks'),
797801
})
802+
return wv
798803
} catch (err) {
799804
logger.error(err as Error)
800805
}
801806
}
802807

803808
// Helper function to get document contents from a path
804-
async function _readCustomChecksFile(input: string): Promise<string> {
809+
export async function _readCustomChecksFile(input: string): Promise<string> {
805810
if (fs.existsSync(input)) {
806811
return fs.readFileSync(input).toString()
807812
} else {
@@ -823,7 +828,7 @@ async function _readCustomChecksFile(input: string): Promise<string> {
823828
}
824829

825830
//Check if Cfn and Tf tools are installed
826-
function arePythonToolsInstalled(): boolean {
831+
export function arePythonToolsInstalled(): boolean {
827832
const logger: Logger = getLogger()
828833
let cfnToolInstalled = true
829834
let tfToolInstalled = true
@@ -846,12 +851,12 @@ function arePythonToolsInstalled(): boolean {
846851
return cfnToolInstalled && tfToolInstalled
847852
}
848853

849-
function isProcessNotFoundErr(errMsg: string) {
854+
export function isProcessNotFoundErr(errMsg: string) {
850855
return errMsg.includes('command not found') || errMsg.includes('ENOENT')
851856
}
852857

853858
// Since TypeScript can only get the CLI tool's error output as a string, we have to parse and sanitize it ourselves
854-
function parseCliErrorMessage(message: string, documentType: PolicyChecksDocumentType): string {
859+
export function parseCliErrorMessage(message: string, documentType: PolicyChecksDocumentType): string {
855860
const cfnMatch = message.match(/ERROR: .*/)
856861
const botoMatch = message.match(/(?<=botocore\.exceptions\.).*/) // Boto errors have a special match
857862
const terraformMatch = message.match(/AttributeError:.*/) // Terraform CLI responds with a different error schema... this catches invalid .json plans
@@ -876,7 +881,7 @@ function parseCliErrorMessage(message: string, documentType: PolicyChecksDocumen
876881
return message
877882
}
878883

879-
function getCheckNoNewAccessErrorMessage(finding: any) {
884+
export function getCheckNoNewAccessErrorMessage(finding: any) {
880885
if (finding.findingType === 'ERROR') {
881886
if (
882887
finding.message.includes(
@@ -888,7 +893,7 @@ function getCheckNoNewAccessErrorMessage(finding: any) {
888893
}
889894
}
890895

891-
function getResultCssColor(resultType: PolicyChecksResult): string {
896+
export function getResultCssColor(resultType: PolicyChecksResult): string {
892897
switch (resultType) {
893898
case 'Success':
894899
return 'var(--vscode-terminal-ansiGreen)'
@@ -899,17 +904,17 @@ function getResultCssColor(resultType: PolicyChecksResult): string {
899904
}
900905
}
901906

902-
function isCloudFormationTemplate(document: string): boolean {
907+
export function isCloudFormationTemplate(document: string): boolean {
903908
const cfnFileTypes = ['.yaml', '.yml', '.json']
904909
return cfnFileTypes.some((t) => document.endsWith(t))
905910
}
906911

907-
function isTerraformPlan(document: string) {
912+
export function isTerraformPlan(document: string) {
908913
const terraformPlanFileTypes = ['.json']
909914
return terraformPlanFileTypes.some((t) => document.endsWith(t))
910915
}
911916

912-
function isJsonPolicyLanguage(document: string) {
917+
export function isJsonPolicyLanguage(document: string) {
913918
const policyLanguageFileTypes = ['.json']
914919
return policyLanguageFileTypes.some((t) => document.endsWith(t))
915920
}

0 commit comments

Comments
 (0)