Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Use SM IAM Credentials for Code Completion"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for including a changelog. Please review the changelog guidelines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need further refinement? I can take your proposal on that. How much context should be stated in it?

}
3 changes: 2 additions & 1 deletion packages/amazonq/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
setContext,
setupUninstallHandler,
maybeShowMinVscodeWarning,
isSageMaker,
} from 'aws-core-vscode/shared'
import { ExtStartUpSources, telemetry } from 'aws-core-vscode/telemetry'
import { VSCODE_EXTENSION_ID } from 'aws-core-vscode/utils'
Expand Down Expand Up @@ -193,7 +194,7 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
}
}
const currConn = AuthUtil.instance.conn
if (currConn !== undefined && !isAnySsoConnection(currConn)) {
if (currConn !== undefined && !(isAnySsoConnection(currConn) || isSageMaker())) {
getLogger().error(`Current Amazon Q connection is not SSO, type is: %s`, currConn?.type)
}

Expand Down
16 changes: 15 additions & 1 deletion packages/core/src/auth/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@ import { LoginManager } from './deprecated/loginManager'
import { fromString } from './providers/credentials'
import { getLogger } from '../shared/logger'
import { ExtensionUse } from './utils'
import { isCloud9 } from '../shared/extensionUtilities'
import { isAmazonQ, isCloud9, isSageMaker } from '../shared/extensionUtilities'
import { isInDevEnv } from '../shared/vscode/env'
import { isWeb } from '../shared/extensionGlobals'
import { CredentialsProviderManager } from './providers/credentialsProviderManager'
import { SharedCredentialsProviderFactory } from './providers/sharedCredentialsProviderFactory'
import { Ec2CredentialsProvider } from './providers/ec2CredentialsProvider'
import { EcsCredentialsProvider } from './providers/ecsCredentialsProvider'
import { EnvVarsCredentialsProvider } from './providers/envVarsCredentialsProvider'

export async function initialize(loginManager: LoginManager): Promise<void> {
if (isAmazonQ() && isSageMaker()) {
initializeCredentialsProviderManager()
}
Auth.instance.onDidChangeActiveConnection(async (conn) => {
// This logic needs to be moved to `Auth.useConnection` to correctly record `passive`
if (conn?.type === 'iam' && conn.state === 'valid') {
Expand All @@ -25,6 +33,12 @@ export async function initialize(loginManager: LoginManager): Promise<void> {
await showManageConnectionsOnStartup()
}

function initializeCredentialsProviderManager() {
const manager = CredentialsProviderManager.getInstance()
manager.addProviderFactory(new SharedCredentialsProviderFactory())
manager.addProviders(new Ec2CredentialsProvider(), new EcsCredentialsProvider(), new EnvVarsCredentialsProvider())
}

/**
* Show the Manage Connections page when the extension starts up, if it should be shown.
*/
Expand Down