@microsoft/vscode-azext-azureauth 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
- import type * as vscode from 'vscode';
2
- /**
3
- * Represents a means of obtaining authentication data for an Azure subscription.
4
- */
5
- export interface AzureAuthentication {
6
- /**
7
- * Gets a VS Code authentication session for an Azure subscription.
8
- *
9
- * @param scopes - The scopes for which the authentication is needed.
10
- *
11
- * @returns A VS Code authentication session or undefined, if none could be obtained.
12
- */
13
- getSession(scopes?: string[]): vscode.ProviderResult<vscode.AuthenticationSession>;
14
- }
1
+ import type * as vscode from 'vscode';
2
+ /**
3
+ * Represents a means of obtaining authentication data for an Azure subscription.
4
+ */
5
+ export interface AzureAuthentication {
6
+ /**
7
+ * Gets a VS Code authentication session for an Azure subscription.
8
+ *
9
+ * @param scopes - The scopes for which the authentication is needed.
10
+ *
11
+ * @returns A VS Code authentication session or undefined, if none could be obtained.
12
+ */
13
+ getSession(scopes?: string[]): vscode.ProviderResult<vscode.AuthenticationSession>;
14
+ }
@@ -1,7 +1,7 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License. See License.txt in the project root for license information.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  //# sourceMappingURL=AzureAuthentication.js.map
@@ -1,44 +1,44 @@
1
- import type { TokenCredential } from '@azure/core-auth';
2
- import type { Environment } from '@azure/ms-rest-azure-env';
3
- import type { AzureAuthentication } from './AzureAuthentication';
4
- /**
5
- * A type representing an Azure subscription ID, not including the tenant ID.
6
- */
7
- export type SubscriptionId = string;
8
- /**
9
- * A type representing an Azure tenant ID.
10
- */
11
- export type TenantId = string;
12
- /**
13
- * Represents an Azure subscription.
14
- */
15
- export interface AzureSubscription {
16
- /**
17
- * Access to the authentication session associated with this subscription.
18
- */
19
- readonly authentication: AzureAuthentication;
20
- /**
21
- * The Azure environment to which this subscription belongs.
22
- */
23
- readonly environment: Environment;
24
- /**
25
- * Whether this subscription belongs to a custom cloud.
26
- */
27
- readonly isCustomCloud: boolean;
28
- /**
29
- * The display name of this subscription.
30
- */
31
- readonly name: string;
32
- /**
33
- * The ID of this subscription.
34
- */
35
- readonly subscriptionId: SubscriptionId;
36
- /**
37
- * The ID of the tenant to which this subscription belongs.
38
- */
39
- readonly tenantId: TenantId;
40
- /**
41
- * The credential for authentication to this subscription. Compatible with Azure track 2 SDKs.
42
- */
43
- readonly credential: TokenCredential;
44
- }
1
+ import type { TokenCredential } from '@azure/core-auth';
2
+ import type { Environment } from '@azure/ms-rest-azure-env';
3
+ import type { AzureAuthentication } from './AzureAuthentication';
4
+ /**
5
+ * A type representing an Azure subscription ID, not including the tenant ID.
6
+ */
7
+ export type SubscriptionId = string;
8
+ /**
9
+ * A type representing an Azure tenant ID.
10
+ */
11
+ export type TenantId = string;
12
+ /**
13
+ * Represents an Azure subscription.
14
+ */
15
+ export interface AzureSubscription {
16
+ /**
17
+ * Access to the authentication session associated with this subscription.
18
+ */
19
+ readonly authentication: AzureAuthentication;
20
+ /**
21
+ * The Azure environment to which this subscription belongs.
22
+ */
23
+ readonly environment: Environment;
24
+ /**
25
+ * Whether this subscription belongs to a custom cloud.
26
+ */
27
+ readonly isCustomCloud: boolean;
28
+ /**
29
+ * The display name of this subscription.
30
+ */
31
+ readonly name: string;
32
+ /**
33
+ * The ID of this subscription.
34
+ */
35
+ readonly subscriptionId: SubscriptionId;
36
+ /**
37
+ * The ID of the tenant to which this subscription belongs.
38
+ */
39
+ readonly tenantId: TenantId;
40
+ /**
41
+ * The credential for authentication to this subscription. Compatible with Azure track 2 SDKs.
42
+ */
43
+ readonly credential: TokenCredential;
44
+ }
@@ -1,7 +1,7 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License. See License.txt in the project root for license information.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  //# sourceMappingURL=AzureSubscription.js.map
@@ -1,48 +1,48 @@
1
- import type * as vscode from 'vscode';
2
- import type { AzureSubscription } from './AzureSubscription';
3
- /**
4
- * An interface for obtaining Azure subscription information
5
- */
6
- export interface AzureSubscriptionProvider {
7
- /**
8
- * Gets a list of Azure subscriptions available to the user.
9
- *
10
- * @param filter - Whether to filter the list returned, according to the list returned
11
- * by `getTenantFilters()` and `getSubscriptionFilters()`. Optional, default true.
12
- *
13
- * @returns A list of Azure subscriptions.
14
- *
15
- * @throws A {@link NotSignedInError} If the user is not signed in to Azure.
16
- * Use {@link isSignedIn} and/or {@link signIn} before this method to ensure
17
- * the user is signed in.
18
- */
19
- getSubscriptions(filter: boolean): Promise<AzureSubscription[]>;
20
- /**
21
- * Checks to see if a user is signed in.
22
- *
23
- * @returns True if the user is signed in, false otherwise.
24
- */
25
- isSignedIn(): Promise<boolean>;
26
- /**
27
- * Asks the user to sign in or pick an account to use.
28
- *
29
- * @returns True if the user is signed in, false otherwise.
30
- */
31
- signIn(): Promise<boolean>;
32
- /**
33
- * An event that is fired when the user signs in. Debounced to fire at most once every 5 seconds.
34
- */
35
- onDidSignIn: vscode.Event<void>;
36
- /**
37
- * Signs the user out
38
- *
39
- * @deprecated Not currently supported by VS Code auth providers
40
- *
41
- * @throws Throws an {@link Error} every time
42
- */
43
- signOut(): Promise<void>;
44
- /**
45
- * An event that is fired when the user signs out. Debounced to fire at most once every 5 seconds.
46
- */
47
- onDidSignOut: vscode.Event<void>;
48
- }
1
+ import type * as vscode from 'vscode';
2
+ import type { AzureSubscription } from './AzureSubscription';
3
+ /**
4
+ * An interface for obtaining Azure subscription information
5
+ */
6
+ export interface AzureSubscriptionProvider {
7
+ /**
8
+ * Gets a list of Azure subscriptions available to the user.
9
+ *
10
+ * @param filter - Whether to filter the list returned, according to the list returned
11
+ * by `getTenantFilters()` and `getSubscriptionFilters()`. Optional, default true.
12
+ *
13
+ * @returns A list of Azure subscriptions.
14
+ *
15
+ * @throws A {@link NotSignedInError} If the user is not signed in to Azure.
16
+ * Use {@link isSignedIn} and/or {@link signIn} before this method to ensure
17
+ * the user is signed in.
18
+ */
19
+ getSubscriptions(filter: boolean): Promise<AzureSubscription[]>;
20
+ /**
21
+ * Checks to see if a user is signed in.
22
+ *
23
+ * @returns True if the user is signed in, false otherwise.
24
+ */
25
+ isSignedIn(): Promise<boolean>;
26
+ /**
27
+ * Asks the user to sign in or pick an account to use.
28
+ *
29
+ * @returns True if the user is signed in, false otherwise.
30
+ */
31
+ signIn(): Promise<boolean>;
32
+ /**
33
+ * An event that is fired when the user signs in. Debounced to fire at most once every 5 seconds.
34
+ */
35
+ onDidSignIn: vscode.Event<void>;
36
+ /**
37
+ * Signs the user out
38
+ *
39
+ * @deprecated Not currently supported by VS Code auth providers
40
+ *
41
+ * @throws Throws an {@link Error} every time
42
+ */
43
+ signOut(): Promise<void>;
44
+ /**
45
+ * An event that is fired when the user signs out. Debounced to fire at most once every 5 seconds.
46
+ */
47
+ onDidSignOut: vscode.Event<void>;
48
+ }
@@ -1,7 +1,7 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License. See License.txt in the project root for license information.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  //# sourceMappingURL=AzureSubscriptionProvider.js.map
@@ -1,15 +1,15 @@
1
- /**
2
- * An error indicating the user is not signed in.
3
- */
4
- export declare class NotSignedInError extends Error {
5
- readonly isNotSignedInError = true;
6
- constructor();
7
- }
8
- /**
9
- * Tests if an object is a `NotSignedInError`. This should be used instead of `instanceof`.
10
- *
11
- * @param error The object to test
12
- *
13
- * @returns True if the object is a NotSignedInError, false otherwise
14
- */
15
- export declare function isNotSignedInError(error: unknown): error is NotSignedInError;
1
+ /**
2
+ * An error indicating the user is not signed in.
3
+ */
4
+ export declare class NotSignedInError extends Error {
5
+ readonly isNotSignedInError = true;
6
+ constructor();
7
+ }
8
+ /**
9
+ * Tests if an object is a `NotSignedInError`. This should be used instead of `instanceof`.
10
+ *
11
+ * @param error The object to test
12
+ *
13
+ * @returns True if the object is a NotSignedInError, false otherwise
14
+ */
15
+ export declare function isNotSignedInError(error: unknown): error is NotSignedInError;
@@ -1,30 +1,30 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Microsoft Corporation. All rights reserved.
4
- * Licensed under the MIT License. See License.txt in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.isNotSignedInError = exports.NotSignedInError = void 0;
8
- const vscode = require("vscode");
9
- /**
10
- * An error indicating the user is not signed in.
11
- */
12
- class NotSignedInError extends Error {
13
- constructor() {
14
- super(vscode.l10n.t('You are not signed in to an Azure account. Please sign in.'));
15
- this.isNotSignedInError = true;
16
- }
17
- }
18
- exports.NotSignedInError = NotSignedInError;
19
- /**
20
- * Tests if an object is a `NotSignedInError`. This should be used instead of `instanceof`.
21
- *
22
- * @param error The object to test
23
- *
24
- * @returns True if the object is a NotSignedInError, false otherwise
25
- */
26
- function isNotSignedInError(error) {
27
- return !!error && typeof error === 'object' && error.isNotSignedInError === true;
28
- }
29
- exports.isNotSignedInError = isNotSignedInError;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License. See License.txt in the project root for license information.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.isNotSignedInError = exports.NotSignedInError = void 0;
8
+ const vscode = require("vscode");
9
+ /**
10
+ * An error indicating the user is not signed in.
11
+ */
12
+ class NotSignedInError extends Error {
13
+ constructor() {
14
+ super(vscode.l10n.t('You are not signed in to an Azure account. Please sign in.'));
15
+ this.isNotSignedInError = true;
16
+ }
17
+ }
18
+ exports.NotSignedInError = NotSignedInError;
19
+ /**
20
+ * Tests if an object is a `NotSignedInError`. This should be used instead of `instanceof`.
21
+ *
22
+ * @param error The object to test
23
+ *
24
+ * @returns True if the object is a NotSignedInError, false otherwise
25
+ */
26
+ function isNotSignedInError(error) {
27
+ return !!error && typeof error === 'object' && error.isNotSignedInError === true;
28
+ }
29
+ exports.isNotSignedInError = isNotSignedInError;
30
30
  //# sourceMappingURL=NotSignedInError.js.map
@@ -1,112 +1,112 @@
1
- import * as vscode from 'vscode';
2
- import type { AzureSubscription, SubscriptionId, TenantId } from './AzureSubscription';
3
- import type { AzureSubscriptionProvider } from './AzureSubscriptionProvider';
4
- /**
5
- * A class for obtaining Azure subscription information using VSCode's built-in authentication
6
- * provider.
7
- */
8
- export declare class VSCodeAzureSubscriptionProvider extends vscode.Disposable implements AzureSubscriptionProvider {
9
- private readonly onDidSignInEmitter;
10
- private lastSignInEventFired;
11
- private suppressSignInEvents;
12
- private readonly onDidSignOutEmitter;
13
- private lastSignOutEventFired;
14
- constructor();
15
- /**
16
- * Gets a list of Azure subscriptions available to the user.
17
- *
18
- * @param filter - Whether to filter the list returned, according to the list returned
19
- * by `getTenantFilters()` and `getSubscriptionFilters()`. Optional, default true.
20
- *
21
- * @returns A list of Azure subscriptions.
22
- *
23
- * @throws A {@link NotSignedInError} If the user is not signed in to Azure.
24
- * Use {@link isSignedIn} and/or {@link signIn} before this method to ensure
25
- * the user is signed in.
26
- */
27
- getSubscriptions(filter?: boolean): Promise<AzureSubscription[]>;
28
- /**
29
- * Checks to see if a user is signed in.
30
- *
31
- * @returns True if the user is signed in, false otherwise.
32
- */
33
- isSignedIn(): Promise<boolean>;
34
- /**
35
- * Asks the user to sign in or pick an account to use.
36
- *
37
- * @returns True if the user is signed in, false otherwise.
38
- */
39
- signIn(): Promise<boolean>;
40
- /**
41
- * An event that is fired when the user signs in. Debounced to fire at most once every 5 seconds.
42
- */
43
- readonly onDidSignIn: vscode.Event<void>;
44
- /**
45
- * Signs the user out
46
- *
47
- * @deprecated Not currently supported by VS Code auth providers
48
- */
49
- signOut(): Promise<void>;
50
- /**
51
- * An event that is fired when the user signs out. Debounced to fire at most once every 5 seconds.
52
- */
53
- readonly onDidSignOut: vscode.Event<void>;
54
- /**
55
- * Gets the tenant filters that are configured in `azureResourceGroups.selectedSubscriptions`. To
56
- * override the settings with a custom filter, implement a child class with `getSubscriptionFilters()`
57
- * and/or `getTenantFilters()` overridden.
58
- *
59
- * If no values are returned by `getTenantFilters()`, then all tenants will be scanned for subscriptions.
60
- *
61
- * @returns A list of tenant IDs that are configured in `azureResourceGroups.selectedSubscriptions`.
62
- */
63
- protected getTenantFilters(): Promise<TenantId[]>;
64
- /**
65
- * Gets the subscription filters that are configured in `azureResourceGroups.selectedSubscriptions`. To
66
- * override the settings with a custom filter, implement a child class with `getSubscriptionFilters()`
67
- * and/or `getTenantFilters()` overridden.
68
- *
69
- * If no values are returned by `getSubscriptionFilters()`, then all subscriptions will be returned.
70
- *
71
- * @returns A list of subscription IDs that are configured in `azureResourceGroups.selectedSubscriptions`.
72
- */
73
- protected getSubscriptionFilters(): Promise<SubscriptionId[]>;
74
- /**
75
- * Gets the tenants available to a user.
76
- *
77
- * @returns The list of tenants visible to the user.
78
- */
79
- private getTenants;
80
- /**
81
- * Gets the subscriptions for a given tenant.
82
- *
83
- * @param tenantId The tenant ID to get subscriptions for.
84
- *
85
- * @returns The list of subscriptions for the tenant.
86
- */
87
- private getSubscriptionsForTenant;
88
- /**
89
- * Gets a fully-configured subscription client for a given tenant ID
90
- *
91
- * @param tenantId (Optional) The tenant ID to get a client for
92
- *
93
- * @returns A client, the credential used by the client, and the authentication function
94
- */
95
- private getSubscriptionClient;
96
- /**
97
- * Gets a normalized list of scopes
98
- *
99
- * @param scopes An input scope string, list, or undefined
100
- * @param tenantId (Optional) The tenant ID, will be added to the scopes
101
- *
102
- * @returns A list of scopes, with the default scope and (optionally) the tenant scope added
103
- */
104
- private getScopes;
105
- /**
106
- * Gets the default Azure scopes required for resource management,
107
- * depending on the configured endpoint
108
- *
109
- * @returns The default Azure scopes required
110
- */
111
- private getDefaultScopes;
112
- }
1
+ import * as vscode from 'vscode';
2
+ import type { AzureSubscription, SubscriptionId, TenantId } from './AzureSubscription';
3
+ import type { AzureSubscriptionProvider } from './AzureSubscriptionProvider';
4
+ /**
5
+ * A class for obtaining Azure subscription information using VSCode's built-in authentication
6
+ * provider.
7
+ */
8
+ export declare class VSCodeAzureSubscriptionProvider extends vscode.Disposable implements AzureSubscriptionProvider {
9
+ private readonly onDidSignInEmitter;
10
+ private lastSignInEventFired;
11
+ private suppressSignInEvents;
12
+ private readonly onDidSignOutEmitter;
13
+ private lastSignOutEventFired;
14
+ constructor();
15
+ /**
16
+ * Gets a list of Azure subscriptions available to the user.
17
+ *
18
+ * @param filter - Whether to filter the list returned, according to the list returned
19
+ * by `getTenantFilters()` and `getSubscriptionFilters()`. Optional, default true.
20
+ *
21
+ * @returns A list of Azure subscriptions.
22
+ *
23
+ * @throws A {@link NotSignedInError} If the user is not signed in to Azure.
24
+ * Use {@link isSignedIn} and/or {@link signIn} before this method to ensure
25
+ * the user is signed in.
26
+ */
27
+ getSubscriptions(filter?: boolean): Promise<AzureSubscription[]>;
28
+ /**
29
+ * Checks to see if a user is signed in.
30
+ *
31
+ * @returns True if the user is signed in, false otherwise.
32
+ */
33
+ isSignedIn(): Promise<boolean>;
34
+ /**
35
+ * Asks the user to sign in or pick an account to use.
36
+ *
37
+ * @returns True if the user is signed in, false otherwise.
38
+ */
39
+ signIn(): Promise<boolean>;
40
+ /**
41
+ * An event that is fired when the user signs in. Debounced to fire at most once every 5 seconds.
42
+ */
43
+ readonly onDidSignIn: vscode.Event<void>;
44
+ /**
45
+ * Signs the user out
46
+ *
47
+ * @deprecated Not currently supported by VS Code auth providers
48
+ */
49
+ signOut(): Promise<void>;
50
+ /**
51
+ * An event that is fired when the user signs out. Debounced to fire at most once every 5 seconds.
52
+ */
53
+ readonly onDidSignOut: vscode.Event<void>;
54
+ /**
55
+ * Gets the tenant filters that are configured in `azureResourceGroups.selectedSubscriptions`. To
56
+ * override the settings with a custom filter, implement a child class with `getSubscriptionFilters()`
57
+ * and/or `getTenantFilters()` overridden.
58
+ *
59
+ * If no values are returned by `getTenantFilters()`, then all tenants will be scanned for subscriptions.
60
+ *
61
+ * @returns A list of tenant IDs that are configured in `azureResourceGroups.selectedSubscriptions`.
62
+ */
63
+ protected getTenantFilters(): Promise<TenantId[]>;
64
+ /**
65
+ * Gets the subscription filters that are configured in `azureResourceGroups.selectedSubscriptions`. To
66
+ * override the settings with a custom filter, implement a child class with `getSubscriptionFilters()`
67
+ * and/or `getTenantFilters()` overridden.
68
+ *
69
+ * If no values are returned by `getSubscriptionFilters()`, then all subscriptions will be returned.
70
+ *
71
+ * @returns A list of subscription IDs that are configured in `azureResourceGroups.selectedSubscriptions`.
72
+ */
73
+ protected getSubscriptionFilters(): Promise<SubscriptionId[]>;
74
+ /**
75
+ * Gets the tenants available to a user.
76
+ *
77
+ * @returns The list of tenants visible to the user.
78
+ */
79
+ private getTenants;
80
+ /**
81
+ * Gets the subscriptions for a given tenant.
82
+ *
83
+ * @param tenantId The tenant ID to get subscriptions for.
84
+ *
85
+ * @returns The list of subscriptions for the tenant.
86
+ */
87
+ private getSubscriptionsForTenant;
88
+ /**
89
+ * Gets a fully-configured subscription client for a given tenant ID
90
+ *
91
+ * @param tenantId (Optional) The tenant ID to get a client for
92
+ *
93
+ * @returns A client, the credential used by the client, and the authentication function
94
+ */
95
+ private getSubscriptionClient;
96
+ /**
97
+ * Gets a normalized list of scopes
98
+ *
99
+ * @param scopes An input scope string, list, or undefined
100
+ * @param tenantId (Optional) The tenant ID, will be added to the scopes
101
+ *
102
+ * @returns A list of scopes, with the default scope and (optionally) the tenant scope added
103
+ */
104
+ private getScopes;
105
+ /**
106
+ * Gets the default Azure scopes required for resource management,
107
+ * depending on the configured endpoint
108
+ *
109
+ * @returns The default Azure scopes required
110
+ */
111
+ private getDefaultScopes;
112
+ }