Show user email address in account picker (#5015)

* Show user email address in account picker

* Fix build break and remove Azure account from sqlops namespace
This commit is contained in:
Karl Burtram
2019-04-12 17:23:48 -07:00
committed by GitHub
parent 34288435ec
commit c5a32d8373
18 changed files with 57 additions and 312 deletions

258
src/sql/sqlops.d.ts vendored
View File

@@ -1994,269 +1994,11 @@ declare module 'sqlops' {
message: string;
}
// ACCOUNT MANAGEMENT //////////////////////////////////////////////////
export namespace accounts {
export function registerAccountProvider(providerMetadata: AccountProviderMetadata, provider: AccountProvider): vscode.Disposable;
/**
* Launches a flyout dialog that will display the information on how to complete device
* code OAuth login to the user. Only one flyout can be opened at once and each must be closed
* by calling {@link endAutoOAuthDeviceCode}.
* @param {string} providerId ID of the provider that's requesting the flyout be opened
* @param {string} title
* @param {string} message
* @param {string} userCode
* @param {string} uri
*/
export function beginAutoOAuthDeviceCode(providerId: string, title: string, message: string, userCode: string, uri: string): Thenable<void>;
/**
* Closes the flyout dialog opened by {@link beginAutoOAuthDeviceCode}
*/
export function endAutoOAuthDeviceCode(): void;
/**
* Notifies the account management service that an account has updated (usually due to the
* account going stale).
* @param {Account} updatedAccount Account object with updated properties
*/
export function accountUpdated(updatedAccount: Account): void;
/**
* Gets all added accounts.
* @returns {Thenable<Account>} Promise to return the accounts
*/
export function getAllAccounts(): Thenable<Account[]>;
/**
* Generates a security token by asking the account's provider
* @param {Account} account Account to generate security token for (defaults to
* AzureResource.ResourceManagement if not given)
* @return {Thenable<{}>} Promise to return the security token
*/
export function getSecurityToken(account: Account, resource?: AzureResource): Thenable<{}>;
/**
* An [event](#Event) which fires when the accounts have changed.
*/
export const onDidChangeAccounts: vscode.Event<DidChangeAccountsParams>;
}
/**
* Represents display information for an account.
*/
export interface AccountDisplayInfo {
/**
* A display name that offers context for the account, such as "Contoso".
*/
contextualDisplayName: string;
/**
* account provider (eg, Work/School vs Microsoft Account)
*/
accountType: string;
/**
* A display name that identifies the account, such as "user@contoso.com".
*/
displayName: string;
}
/**
* Represents a key that identifies an account.
*/
export interface AccountKey {
/**
* Identifier of the provider
*/
providerId: string;
/**
* Any arguments that identify an instantiation of the provider
*/
providerArgs?: any;
/**
* Identifier for the account, unique to the provider
*/
accountId: string;
}
/**
* Represents an account.
*/
export interface Account {
/**
* The key that identifies the account
*/
key: AccountKey;
/**
* Display information for the account
*/
displayInfo: AccountDisplayInfo;
/**
* Custom properties stored with the account
*/
properties: any;
/**
* Indicates if the account needs refreshing
*/
isStale: boolean;
}
export enum AzureResource {
ResourceManagement = 0,
Sql = 1
}
export interface DidChangeAccountsParams {
// Updated accounts
accounts: Account[];
}
// - ACCOUNT PROVIDER //////////////////////////////////////////////////
/**
* Error to be used when the user has cancelled the prompt or refresh methods. When
* AccountProvider.refresh or AccountProvider.prompt are rejected with this error, the error
* will not be reported to the user.
*/
export interface UserCancelledSignInError extends Error {
/**
* Type guard for differentiating user cancelled sign in errors from other errors
*/
userCancelledSignIn: boolean;
}
/**
* Represents a provider of accounts.
*/
export interface AccountProviderMetadata {
/**
* The identifier of the provider
*/
id: string;
/**
* Display name of the provider
*/
displayName: string;
/**
* Any arguments that identify an instantiation of the provider
*/
args?: any;
/**
* Optional settings that identify an instantiation of a provider
*/
settings?: {};
}
/**
* Represents a provider of accounts for use with the account management service
*/
export interface AccountProvider {
/**
* Initializes the account provider with the accounts restored from the memento,
* @param {Account[]} storedAccounts Accounts restored from the memento
* @return {Thenable<Account[]>} Account objects after being rehydrated (if necessary)
*/
initialize(storedAccounts: Account[]): Thenable<Account[]>;
/**
* Generates a security token for the provided account
* @param {Account} account The account to generate a security token for
* @param {AzureResource} resource The resource to get the token for
* @return {Thenable<{}>} Promise to return a security token object
*/
getSecurityToken(account: Account, resource: AzureResource): Thenable<{}>;
/**
* Prompts the user to enter account information.
* Returns an error if the user canceled the operation.
*/
prompt(): Thenable<Account>;
/**
* Refreshes a stale account.
* Returns an error if the user canceled the operation.
* Otherwise, returns a new updated account instance.
* @param account - An account.
*/
refresh(account: Account): Thenable<Account>;
/**
* Clears sensitive information for an account. To be called when account is removed
* @param accountKey - Key that uniquely identifies the account to clear
*/
clear(accountKey: AccountKey): Thenable<void>;
/**
* Called from the account management service when the user has cancelled an auto OAuth
* authorization process. Implementations should use this to cancel any polling process
* and call the end OAuth method.
*/
autoOAuthCancelled(): Thenable<void>;
}
// Resource provider interfaces -----------------------------------------------------------------------
// - ACCOUNT PROVIDER //////////////////////////////////////////////////
/**
* Represents a provider of accounts.
*/
export interface ResourceProviderMetadata {
/**
* The identifier of the provider
*/
id: string;
/**
* Display name of the provider
*/
displayName: string;
/**
* Optional settings that identify an instantiation of a provider
*/
settings?: {};
}
export namespace resources {
/**
* Registers a resource provider that can suport
*/
export function registerResourceProvider(providerMetadata: ResourceProviderMetadata, provider: ResourceProvider): vscode.Disposable;
}
/**
* Represents a provider of resource
*/
export interface ResourceProvider {
createFirewallRule(account: Account, firewallruleInfo: FirewallRuleInfo): Thenable<CreateFirewallRuleResponse>;
handleFirewallRule(errorCode: number, errorMessage: string, connectionTypeId: string): Thenable<HandleFirewallRuleResponse>;
}
export interface FirewallRuleInfo {
startIpAddress: string;
endIpAddress: string;
serverName: string;
securityTokenMappings: {};
}
export interface CreateFirewallRuleResponse {
result: boolean;
errorMessage: string;
}
export interface HandleFirewallRuleResponse {
result: boolean;
ipAddress: string;
}
export interface ModalDialog {
/**
* Title of the webview.