-
Notifications
You must be signed in to change notification settings - Fork 906
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/github_actions/actions/cache-3
- Loading branch information
Showing
143 changed files
with
4,522 additions
and
1,922 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...nsions/azurecore/src/azureResource/providers/cosmosdb/postgres/cosmosDbPostgresService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the Source EULA. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
|
||
import { ResourceServiceBase } from '../../resourceTreeDataProviderBase'; | ||
import { azureResource } from 'azurecore'; | ||
import { cosmosPostgresDbQuery } from '../../queryStringConstants'; | ||
import { DbServerGraphData } from '../../../interfaces'; | ||
import { COSMOSDB_POSTGRES_PROVIDER_ID } from '../../../../constants'; | ||
|
||
export interface AzureResourcePostgresDatabaseServer extends azureResource.AzureResourceDatabaseServer { | ||
isServer: boolean; | ||
} | ||
|
||
export class CosmosDbPostgresService extends ResourceServiceBase<DbServerGraphData> { | ||
public override queryFilter: string = cosmosPostgresDbQuery; | ||
|
||
public convertServerResource(resource: DbServerGraphData): AzureResourcePostgresDatabaseServer | undefined { | ||
let host = resource.name; | ||
const isServer = resource.type === azureResource.AzureResourceType.cosmosDbPostgresCluster; | ||
if (isServer) { | ||
const url = new URL(resource.properties.connectionString); | ||
host = url.hostname; | ||
} | ||
return { | ||
id: resource.id, | ||
name: resource.name, | ||
provider: COSMOSDB_POSTGRES_PROVIDER_ID, | ||
isServer: isServer, | ||
fullName: host, | ||
loginName: resource.properties.administratorLogin, | ||
defaultDatabaseName: '', | ||
tenant: resource.tenantId, | ||
subscription: { | ||
id: resource.subscriptionId, | ||
name: resource.subscriptionName || '' | ||
} | ||
}; | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
...urecore/src/azureResource/providers/cosmosdb/postgres/cosmosDbPostgresTreeDataProvider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the Source EULA. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { TreeItemCollapsibleState, ExtensionContext } from 'vscode'; | ||
import * as nls from 'vscode-nls'; | ||
const localize = nls.loadMessageBundle(); | ||
|
||
import { AzureResourceItemType, AzureResourcePrefixes, pgsqlProvider } from '../../../constants'; | ||
import { AzureResourcePostgresDatabaseServer } from './cosmosDbPostgresService'; | ||
import { generateGuid } from '../../../utils'; | ||
import { DbServerGraphData, GraphData } from '../../../interfaces'; | ||
import { ResourceTreeDataProviderBase } from '../../resourceTreeDataProviderBase'; | ||
import { AzureAccountProperties, azureResource } from 'azurecore'; | ||
import * as azdata from 'azdata'; | ||
|
||
export class CosmosDbPostgresTreeDataProvider extends ResourceTreeDataProviderBase<GraphData, DbServerGraphData> { | ||
private static readonly CONTAINER_ID = 'azure.resource.providers.databaseServer.treeDataProvider.cosmosDbPostgresContainer'; | ||
private static readonly CONTAINER_LABEL = localize('azure.resource.providers.databaseServer.treeDataProvider.cosmosDbPostgresContainerLabel', "Azure CosmosDB for PostgreSQL Cluster"); | ||
|
||
public constructor( | ||
databaseServerService: azureResource.IAzureResourceService, | ||
private _extensionContext: ExtensionContext | ||
) { | ||
super(databaseServerService); | ||
} | ||
|
||
public getTreeItemForResource(databaseServer: AzureResourcePostgresDatabaseServer, account: azdata.Account): azdata.TreeItem { | ||
return { | ||
id: `${AzureResourcePrefixes.cosmosdb}${account.key.accountId}${databaseServer.tenant}${databaseServer.id ?? databaseServer.name}`, | ||
label: this.browseConnectionMode ? `${databaseServer.name} ${CosmosDbPostgresTreeDataProvider.CONTAINER_LABEL}, ${databaseServer.subscription.name})` : databaseServer.name, | ||
iconPath: this._extensionContext.asAbsolutePath('resources/cosmosDb.svg'), | ||
collapsibleState: TreeItemCollapsibleState.None, | ||
contextValue: AzureResourceItemType.cosmosDBPostgresAccount, | ||
payload: { | ||
id: generateGuid(), | ||
connectionName: databaseServer.name, | ||
serverName: databaseServer.fullName, | ||
userName: databaseServer.loginName, | ||
password: '', | ||
authenticationType: databaseServer.isServer ? azdata.connection.AuthenticationType.SqlLogin : azdata.connection.AuthenticationType.AzureMFA, | ||
savePassword: true, | ||
groupFullName: '', | ||
groupId: '', | ||
providerName: pgsqlProvider, | ||
saveProfile: false, | ||
options: { | ||
isServer: databaseServer.isServer, | ||
}, | ||
azureAccount: account.key.accountId, | ||
azureTenantId: databaseServer.tenant, | ||
azureResourceId: databaseServer.id, | ||
azurePortalEndpoint: (account.properties as AzureAccountProperties).providerSettings.settings.portalEndpoint | ||
}, | ||
childProvider: pgsqlProvider, | ||
type: azdata.ExtensionNodeType.Server | ||
}; | ||
} | ||
|
||
public async getRootChild(): Promise<azdata.TreeItem> { | ||
return { | ||
id: CosmosDbPostgresTreeDataProvider.CONTAINER_ID, | ||
label: CosmosDbPostgresTreeDataProvider.CONTAINER_LABEL, | ||
iconPath: this._extensionContext.asAbsolutePath('resources/cosmosDb.svg'), | ||
collapsibleState: TreeItemCollapsibleState.Collapsed, | ||
contextValue: AzureResourceItemType.databaseServerContainer | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.