Skip to content
Merged
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
5 changes: 3 additions & 2 deletions packages/core/src/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Timeout } from '../shared/utilities/timeoutUtils'
import { errorCode, isAwsError, isNetworkError, ToolkitError, UnknownError } from '../shared/errors'
import { getCache, getCacheFileWatcher } from './sso/cache'
import { isNonNullable, Mutable } from '../shared/utilities/tsUtils'
import { builderIdStartUrl, SsoToken, truncateStartUrl } from './sso/model'
import { SsoToken, truncateStartUrl } from './sso/model'
import { SsoClient } from './sso/clients'
import { getLogger } from '../shared/logger'
import { CredentialsProviderManager } from './providers/credentialsProviderManager'
Expand Down Expand Up @@ -68,6 +68,7 @@ import { asStringifiedStack } from '../shared/telemetry/spans'
import { withTelemetryContext } from '../shared/telemetry/util'
import { DiskCacheError } from '../shared/utilities/cacheUtils'
import { setContext } from '../shared/vscode/setContext'
import { builderIdStartUrl, internalStartUrl } from './sso/constants'

interface AuthService {
/**
Expand Down Expand Up @@ -189,7 +190,7 @@ export class Auth implements AuthService, ConnectionManager {
}

public isInternalAmazonUser(): boolean {
return this.isConnected() && this.startUrl === 'https://amzn.awsapps.com/start'
return this.isConnected() && this.startUrl === internalStartUrl
}

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/auth/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import * as vscode from 'vscode'
import { Credentials } from '@aws-sdk/types'
import { Mutable } from '../shared/utilities/tsUtils'
import { builderIdStartUrl, ClientRegistration, SsoToken, truncateStartUrl } from './sso/model'
import { ClientRegistration, SsoToken, truncateStartUrl } from './sso/model'
import { SsoClient } from './sso/clients'
import { CredentialsProviderManager } from './providers/credentialsProviderManager'
import { fromString } from './providers/credentials'
Expand All @@ -17,6 +17,7 @@ import { withTelemetryContext } from '../shared/telemetry/util'
import { AuthModifyConnection, telemetry } from '../shared/telemetry/telemetry'
import { asStringifiedStack } from '../shared/telemetry/spans'
import { getTelemetryReason, getTelemetryReasonDesc } from '../shared/errors'
import { builderIdStartUrl } from './sso/constants'

/** Shows a warning message unless it is the same as the last one shown. */
const warnOnce = onceChanged((s: string, url: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import {
Profile,
Section,
} from '../credentials/sharedCredentials'
import { builderIdStartUrl } from '../sso/model'
import { SectionName, SharedCredentialsKeys } from '../credentials/types'
import { SsoProfile, hasScopes, scopesSsoAccountAccess } from '../connection'
import { builderIdStartUrl } from '../sso/constants'

const credentialSources = {
ECS_CONTAINER: 'EcsContainer',
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/auth/sso/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* web, node, or vue.
*/

export const builderIdStartUrl = 'https://view.awsapps.com/start'
export const internalStartUrl = 'https://amzn.awsapps.com/start'

export const ssoUrlFormatRegex =
/^(https?:\/\/(.+)\.awsapps\.com\/start|https?:\/\/identitycenter\.amazonaws\.com\/ssoins-[\da-zA-Z]{16})\/?$/

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/auth/sso/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { ssoAuthHelpUrl } from '../../shared/constants'
import { openUrl } from '../../shared/utilities/vsCodeUtils'
import { ToolkitError } from '../../shared/errors'
import { isCloud9 } from '../../shared/extensionUtilities'
import { builderIdStartUrl } from './constants'

export interface SsoToken {
/**
Expand Down Expand Up @@ -88,7 +89,6 @@ export interface SsoProfile {
readonly identifier?: string
}

export const builderIdStartUrl = 'https://view.awsapps.com/start'
export const trustedDomainCancellation = 'TrustedDomainCancellation'

const tryOpenHelpUrl = (url: vscode.Uri) =>
Expand Down
11 changes: 2 additions & 9 deletions packages/core/src/auth/sso/ssoAccessTokenProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@
import * as vscode from 'vscode'
import globals from '../../shared/extensionGlobals'
import { AuthorizationPendingException, SSOOIDCServiceException, SlowDownException } from '@aws-sdk/client-sso-oidc'
import {
SsoToken,
ClientRegistration,
isExpired,
SsoProfile,
builderIdStartUrl,
openSsoPortalLink,
isDeprecatedAuth,
} from './model'
import { SsoToken, ClientRegistration, isExpired, SsoProfile, openSsoPortalLink, isDeprecatedAuth } from './model'
import { getCache } from './cache'
import { hasProps, hasStringProps, RequiredProps, selectFrom } from '../../shared/utilities/tsUtils'
import { OidcClient } from './clients'
Expand Down Expand Up @@ -46,6 +38,7 @@ import { NestedMap } from '../../shared/utilities/map'
import { asStringifiedStack } from '../../shared/telemetry/spans'
import { showViewLogsMessage } from '../../shared/utilities/messages'
import _ from 'lodash'
import { builderIdStartUrl } from './constants'

export const authenticationPath = 'sso/authenticated'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import {
import { prepareDocument, searchLogGroup } from './searchLogGroup'
import { telemetry, Result } from '../../../shared/telemetry/telemetry'
import { CancellationError } from '../../../shared/utilities/timeoutUtils'
import { formatLocalized } from '../../../shared/utilities/textUtilities'
import { cwlUriSchema } from '../cloudWatchLogsUtils'
import { formatLocalized } from '../../../shared/datetime'

export async function viewLogStream(node: LogGroupNode, registry: LogDataRegistry): Promise<void> {
await telemetry.cloudwatchlogs_open.run(async (span) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { formatDateTimestamp } from '../../../shared/datetime'
import { CloudWatchLogsEvent, CloudWatchLogsGroupInfo } from '../registry/logDataRegistry'
import { formatDateTimestamp } from '../../../shared/utilities/textUtilities'

export const timestampSpaceEquivalent = ' '

Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/awsService/ecs/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import globals from '../../shared/extensionGlobals'
import { ToolkitPromptSettings } from '../../shared/settings'
import { ChildProcess } from '../../shared/utilities/processUtils'
import { showMessageWithCancel, showOutputMessage } from '../../shared/utilities/messages'
import { formatDateTimestamp, removeAnsi } from '../../shared/utilities/textUtilities'
import { removeAnsi } from '../../shared/utilities/textUtilities'
import { CancellationError, Timeout } from '../../shared/utilities/timeoutUtils'
import { Commands } from '../../shared/vscode/commands2'
import { EcsSettings } from './util'
Expand All @@ -22,6 +22,7 @@ import { Container, Service } from './model'
import { Instance } from '../../shared/utilities/typeConstructors'
import { telemetry } from '../../shared/telemetry/telemetry'
import { openRemoteTerminal } from '../../shared/remoteSession'
import { formatDateTimestamp } from '../../shared/datetime'

async function runCommandWizard(
param?: unknown,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import { IotCertsFolderNode } from './iotCertFolderNode'
import { IotThingNode } from './iotThingNode'
import { IotPolicyCertNode } from './iotPolicyNode'
import { getIcon } from '../../../shared/icons'
import { formatLocalized, truncate } from '../../../shared/utilities/textUtilities'
import { truncate } from '../../../shared/utilities/textUtilities'
import { Settings } from '../../../shared/settings'
import { ClassToInterfaceType } from '../../../shared/utilities/tsUtils'
import { formatLocalized } from '../../../shared/datetime'

const contextBase = 'awsIotCertificateNode'
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { AWSTreeNodeBase } from '../../../shared/treeview/nodes/awsTreeNodeBase'
import { inspect } from 'util'
import { IotPolicyWithVersionsNode } from './iotPolicyNode'
import { localize } from '../../../shared/utilities/vsCodeUtils'
import { formatLocalized } from '../../../shared/utilities/textUtilities'
import { formatLocalized } from '../../../shared/datetime'

/**
* Represents an IoT Policy that may have either a Certificate Node or the
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/awsService/s3/explorer/s3FileNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { inspect } from 'util'
import { S3BucketNode } from './s3BucketNode'
import { S3FolderNode } from './s3FolderNode'
import globals from '../../../shared/extensionGlobals'
import { formatLocalized, getRelativeDate } from '../../../shared/utilities/textUtilities'
import { isCloud9 } from '../../../shared/extensionUtilities'
import { getIcon } from '../../../shared/icons'
import { formatLocalized, getRelativeDate } from '../../../shared/datetime'

/**
* Represents an object in an S3 bucket.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/codecatalyst/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import {
hasExactScopes,
} from '../auth/connection'
import { createBuilderIdConnection } from '../auth/utils'
import { builderIdStartUrl } from '../auth/sso/model'
import { showReauthenticateMessage } from '../shared/utilities/messages'
import { ToolkitPromptSettings } from '../shared/settings'
import { setContext } from '../shared/vscode/setContext'
import { withTelemetryContext } from '../shared/telemetry/util'
import { builderIdStartUrl } from '../auth/sso/constants'

// Secrets stored on the macOS keychain appear as individual entries for each key
// This is fine so long as the user has only a few accounts. Otherwise this should
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/codecatalyst/uriHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import * as vscode from 'vscode'
import { SearchParams, UriHandler } from '../shared/vscode/uriHandler'
import { getCodeCatalystConfig } from '../shared/clients/codecatalystClient'
import { CodeCatalystCommands } from './commands'
import { builderIdStartUrl } from '../auth/sso/model'
import { defaultSsoRegion } from '../auth/connection'
import { getLogger } from '../shared/logger'
import { builderIdStartUrl } from '../auth/sso/constants'

type ConnectParams = {
devEnvironmentId: string
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/codecatalyst/wizards/selectResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import {
QuickPickPrompter,
} from '../../shared/ui/pickerPrompter'
import { AsyncCollection } from '../../shared/utilities/asyncCollection'
import { getRelativeDate } from '../../shared/utilities/textUtilities'
import { isValidResponse } from '../../shared/wizards/wizard'
import { associateDevEnv, docs } from '../model'
import { getHelpUrl, isDevenvVscode } from '../utils'
import { getLogger } from '../../shared/logger/logger'
import { getRelativeDate } from '../../shared/datetime'

export function createRepoLabel(r: codecatalyst.CodeCatalystRepo): string {
return `${r.org.name} / ${r.project.name} / ${r.name}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
DB,
TransformationType,
} from '../models/model'
import { convertDateToTimestamp } from '../../shared/utilities/textUtilities'
import {
createZipManifest,
downloadAndExtractResultArchive,
Expand Down Expand Up @@ -80,6 +79,7 @@ import { HumanInTheLoopManager } from '../service/transformByQ/humanInTheLoopMan
import { setContext } from '../../shared/vscode/setContext'
import { makeTemporaryToolkitFolder } from '../../shared'
import globals from '../../shared/extensionGlobals'
import { convertDateToTimestamp } from '../../shared/datetime'

function getFeedbackCommentData() {
const jobId = transformByQState.getJobId()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ import { downloadExportResultArchive } from '../../../shared/utilities/download'
import { ExportIntent, TransformationDownloadArtifactType } from '@amzn/codewhisperer-streaming'
import fs from '../../../shared/fs/fs'
import { ChatSessionManager } from '../../../amazonqGumby/chat/storages/chatSession'
import { convertToTimeString, encodeHTML } from '../../../shared/utilities/textUtilities'
import { encodeHTML } from '../../../shared/utilities/textUtilities'
import { convertToTimeString } from '../../../shared/datetime'

export function getSha256(buffer: Buffer) {
const hasher = crypto.createHash('sha256')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
sessionJobHistory,
transformByQState,
} from '../../models/model'
import { convertToTimeString } from '../../../shared/utilities/textUtilities'
import { getLogger } from '../../../shared/logger'
import { getTransformationSteps } from './transformApiHandler'
import {
Expand All @@ -23,6 +22,7 @@ import {
} from '../../../codewhisperer/client/codewhispereruserclient'
import { startInterval } from '../../commands/startTransformByQ'
import { CodeTransformTelemetryState } from '../../../amazonqGumby/telemetry/codeTransformTelemetryState'
import { convertToTimeString } from '../../../shared/datetime'

export class TransformationHubViewProvider implements vscode.WebviewViewProvider {
public static readonly viewType = 'aws.amazonq.transformationHub'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import { VSCODE_EXTENSION_ID } from '../../../../shared/extensions'
import { getLogger } from '../../../../shared/logger'
import { debounce } from 'lodash'
import { AuthError, AuthFlowState, userCancelled } from '../types'
import { builderIdStartUrl } from '../../../../auth/sso/model'
import { ToolkitError } from '../../../../shared/errors'
import { withTelemetryContext } from '../../../../shared/telemetry/util'
import { builderIdStartUrl } from '../../../../auth/sso/constants'

const className = 'AmazonQLoginWebview'
export class AmazonQLoginWebview extends CommonAuthWebview {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {
import { Auth } from '../../../../auth/auth'
import { CodeCatalystAuthenticationProvider } from '../../../../codecatalyst/auth'
import { AuthError, AuthFlowState } from '../types'
import { builderIdStartUrl } from '../../../../auth/sso/model'
import { setContext } from '../../../../shared'
import { builderIdStartUrl } from '../../../../auth/sso/constants'

export class ToolkitLoginWebview extends CommonAuthWebview {
public override id: string = 'aws.toolkit.AmazonCommonAuth'
Expand Down
Loading
Loading