@microsoft/windows-admin-center-sdk 4.123.0 → 4.167.0
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.
- package/angular/assets/strings/cs-CZ/strings.json +1 -1
- package/angular/assets/strings/de-DE/strings.json +1 -1
- package/angular/assets/strings/es-ES/strings.json +1 -1
- package/angular/assets/strings/fr-FR/strings.json +1 -1
- package/angular/assets/strings/hu-HU/strings.json +1 -1
- package/angular/assets/strings/id-ID/strings.json +1 -1
- package/angular/assets/strings/it-IT/strings.json +1 -1
- package/angular/assets/strings/ja-JP/strings.json +1 -1
- package/angular/assets/strings/ko-KR/strings.json +1 -1
- package/angular/assets/strings/nl-NL/strings.json +1 -1
- package/angular/assets/strings/pl-PL/strings.json +1 -1
- package/angular/assets/strings/pt-BR/strings.json +1 -1
- package/angular/assets/strings/pt-PT/strings.json +1 -1
- package/angular/assets/strings/ru-RU/strings.json +1 -1
- package/angular/assets/strings/strings.json +1 -1
- package/angular/assets/strings/sv-SE/strings.json +1 -1
- package/angular/assets/strings/tr-TR/strings.json +1 -1
- package/angular/assets/strings/zh-CN/strings.json +1 -1
- package/angular/assets/strings/zh-TW/strings.json +1 -1
- package/angular/esm2020/src/controls/actions/containers/action-container.component.mjs +2 -3
- package/angular/esm2020/src/controls/alert-bar/alert-bar.component.mjs +2 -2
- package/angular/esm2020/src/controls/breadcrumb-header/breadcrumb-header.component.mjs +1 -1
- package/angular/esm2020/src/controls/common/base.component.mjs +1 -1
- package/angular/esm2020/src/controls/common/spacer-base.component.mjs +25 -1
- package/angular/esm2020/src/controls/context-menu/context-menu.component.mjs +2 -3
- package/angular/esm2020/src/controls/data-table/data-table.component.mjs +7 -7
- package/angular/esm2020/src/controls/dialog/base-dialog.component.mjs +2 -4
- package/angular/esm2020/src/controls/dialog/confirmation-list-dialog/confirmation-list-dialog.component.mjs +2 -2
- package/angular/esm2020/src/controls/dropdown/dropdown.component.mjs +1 -4
- package/angular/esm2020/src/controls/form/form-field/clock/clock-form-field.component.mjs +10 -7
- package/angular/esm2020/src/controls/form/form-field/form-field.component.mjs +1 -1
- package/angular/esm2020/src/controls/form/form-field/number/number-form-field.component.mjs +22 -4
- package/angular/esm2020/src/controls/form/form-field/radio-group/classic/radio-group-form-field.component.mjs +5 -5
- package/angular/esm2020/src/controls/icon/icon-text/icon-text.component.mjs +6 -6
- package/angular/esm2020/src/controls/icon/layered-icon/status/status-icon.component.mjs +1 -1
- package/angular/esm2020/src/controls/layout/editable-layout.component.mjs +2 -3
- package/angular/esm2020/src/controls/node-credentials-form/node-credentials-form.component.mjs +2 -2
- package/angular/esm2020/src/controls/property-grid/property-grid.component.mjs +33 -13
- package/angular/esm2020/src/controls/schema/tabbed-form-loader.component.mjs +2 -2
- package/angular/esm2020/src/controls/settings/common-settings/common-settings.component.mjs +5 -5
- package/angular/esm2020/src/controls/settings/settings-form.directive.mjs +3 -7
- package/angular/esm2020/src/controls/settings/settings-form.service.mjs +2 -4
- package/angular/esm2020/src/controls/snap-in-extension/snap-in-extension.component.mjs +1 -1
- package/angular/esm2020/src/controls/split-view/split-view.component.mjs +2 -2
- package/angular/esm2020/src/directives/router/router-link.directive.mjs +2 -2
- package/angular/esm2020/src/directives/svg/svg.directive.mjs +2 -3
- package/angular/esm2020/src/generated/strings.mjs +1 -1
- package/angular/esm2020/src/service/navigation.service.mjs +3 -8
- package/angular/esm2020/src/service/user-alive.service.mjs +2 -4
- package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.mjs +126 -72
- package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.mjs.map +1 -1
- package/angular/fesm2020/microsoft-windows-admin-center-sdk-angular.mjs +115 -70
- package/angular/fesm2020/microsoft-windows-admin-center-sdk-angular.mjs.map +1 -1
- package/angular/package.json +1 -1
- package/angular/src/controls/common/spacer-base.component.d.ts +11 -2
- package/angular/src/controls/form/form-field/number/number-form-field.component.d.ts +8 -0
- package/angular/src/controls/icon/icon-text/icon-text.component.d.ts +1 -1
- package/angular/src/controls/property-grid/property-grid.component.d.ts +2 -0
- package/angular/src/directives/svg/svg.directive.d.ts +1 -2
- package/angular/src/generated/strings.d.ts +12 -0
- package/core/azure/azure-constants.d.ts +2 -2
- package/core/azure/azure-constants.d.ts.map +1 -1
- package/core/azure/azure-constants.js +10 -3
- package/core/azure/azure-constants.js.map +1 -1
- package/core/data/gateway-url-translator.d.ts +1 -0
- package/core/data/gateway-url-translator.d.ts.map +1 -1
- package/core/data/gateway-url-translator.js +21 -6
- package/core/data/gateway-url-translator.js.map +1 -1
- package/core/data/node-connection.d.ts.map +1 -1
- package/core/data/node-connection.js +0 -2
- package/core/data/node-connection.js.map +1 -1
- package/core/generated/powershell-scripts.d.ts.map +1 -1
- package/core/generated/powershell-scripts.js +1 -1
- package/core/generated/powershell-scripts.js.map +1 -1
- package/core/resources/scripts/public/inventory/Get-ServerInventory.ps1 +30 -8
- package/{microsoft-windows-admin-center-sdk-4.123.0.tgz → microsoft-windows-admin-center-sdk-4.167.0.tgz} +0 -0
- package/package.json +9 -7
- package/styles/css/main-v2.css +1 -1
- package/tools/code-formatter/.eslintrc.base.json +1 -0
- package/tools/code-formatter/lint.d.ts.map +1 -1
- package/tools/code-formatter/lint.js +7 -1
- package/tools/code-formatter/lint.js.map +1 -1
- package/tools/code-formatter/utilities.d.ts +7 -0
- package/tools/code-formatter/utilities.d.ts.map +1 -0
- package/tools/code-formatter/utilities.js +79 -0
- package/tools/code-formatter/utilities.js.map +1 -0
- package/tools/gulp-update-notes-resource/index.d.ts.map +1 -1
- package/tools/gulp-update-notes-resource/index.js +4 -4
- package/tools/gulp-update-notes-resource/index.js.map +1 -1
- package/tools/module-template/.eslintrc.json +3 -0
- package/tools/module-template/gulpfile.ts/common/utilities.ts +1 -0
- package/tools/wac-cli/src/angular15/configs/eslint-auto-fix-config.d.ts +9 -0
- package/tools/wac-cli/src/angular15/configs/eslint-auto-fix-config.d.ts.map +1 -0
- package/tools/wac-cli/src/angular15/configs/eslint-auto-fix-config.js +16 -0
- package/tools/wac-cli/src/angular15/configs/eslint-auto-fix-config.js.map +1 -0
- package/tools/wac-cli/src/angular15/main.d.ts +19 -3
- package/tools/wac-cli/src/angular15/main.d.ts.map +1 -1
- package/tools/wac-cli/src/angular15/main.js +41 -7
- package/tools/wac-cli/src/angular15/main.js.map +1 -1
- package/tools/wac-cli/src/angular15/upgrader/eslint-auto-fix-upgrader.d.ts +18 -0
- package/tools/wac-cli/src/angular15/upgrader/eslint-auto-fix-upgrader.d.ts.map +1 -0
- package/tools/wac-cli/src/angular15/upgrader/eslint-auto-fix-upgrader.js +49 -0
- package/tools/wac-cli/src/angular15/upgrader/eslint-auto-fix-upgrader.js.map +1 -0
package/angular/package.json
CHANGED
|
@@ -35,12 +35,21 @@ export declare class SpacerBaseDirective extends CoreBaseComponent {
|
|
|
35
35
|
*/
|
|
36
36
|
noSideMargin?: boolean;
|
|
37
37
|
/**
|
|
38
|
+
* The internal value for showLeftMargin.
|
|
39
|
+
*/
|
|
40
|
+
private showLeftMarginInternal;
|
|
41
|
+
/**
|
|
42
|
+
* Setter showLeftMargin.
|
|
38
43
|
* The input parameter for determining the component to render left margin.
|
|
39
44
|
* Custom implementation on control is required.
|
|
40
|
-
* Migrated from the data-table control.
|
|
45
|
+
* Migrated from the data-table control, the data-table control will still accept this input but actual implementation will be noLeftMargin.
|
|
41
46
|
* @deprecated since '05/01/23' Use noLeftMargin instead.
|
|
42
47
|
*/
|
|
43
|
-
showLeftMargin
|
|
48
|
+
set showLeftMargin(input: boolean);
|
|
49
|
+
/**
|
|
50
|
+
* Getter showLeftMargin.
|
|
51
|
+
*/
|
|
52
|
+
get showLeftMargin(): boolean;
|
|
44
53
|
/**
|
|
45
54
|
* The input parameter for determining the component to render without left margin.
|
|
46
55
|
* Custom implementation on control is required.
|
|
@@ -56,6 +56,14 @@ export declare class NumberFormFieldComponent extends SmeInternalFormFieldCompon
|
|
|
56
56
|
*/
|
|
57
57
|
constructor(injector: Injector);
|
|
58
58
|
ngOnInit(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Getter aria label increase for spin button increase.
|
|
61
|
+
*/
|
|
62
|
+
get ariaLabelIncrease(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Getter aria label increase for spin button decrease.
|
|
65
|
+
*/
|
|
66
|
+
get ariaLabelDecrease(): string;
|
|
59
67
|
/**
|
|
60
68
|
* Handle keydown events on the number input
|
|
61
69
|
*/
|
|
@@ -79,6 +79,8 @@ export declare class PropertyGridComponent extends CoreBaseComponent implements
|
|
|
79
79
|
* @param index The index that needs to hard refresh.
|
|
80
80
|
*/
|
|
81
81
|
hardRefreshItem(index: number): void;
|
|
82
|
+
getInternalLinkDescription(item: PropertyGridItemComponent): string;
|
|
83
|
+
getExternalLinkDescription(item: PropertyGridItemComponent): string;
|
|
82
84
|
/**
|
|
83
85
|
* Creates the idBag used by this component to store unique element ids.
|
|
84
86
|
* id values will be assigned be the @see BaseComponent super class.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ElementRef } from '@angular/core';
|
|
2
|
-
import { ViewContainerRef } from '@angular/core';
|
|
1
|
+
import { ElementRef, ViewContainerRef } from '@angular/core';
|
|
3
2
|
import { ResourceService } from '../../service/resource.service';
|
|
4
3
|
import * as i0 from "@angular/core";
|
|
5
4
|
/**
|
|
@@ -268,6 +268,10 @@ export interface Strings {
|
|
|
268
268
|
copy: string;
|
|
269
269
|
copied: string;
|
|
270
270
|
};
|
|
271
|
+
SpinButton: {
|
|
272
|
+
increase: string;
|
|
273
|
+
decrease: string;
|
|
274
|
+
};
|
|
271
275
|
OrderedList: {
|
|
272
276
|
addButtonAriaLabel: string;
|
|
273
277
|
addButtonTooltip: string;
|
|
@@ -858,6 +862,14 @@ export interface Strings {
|
|
|
858
862
|
PivotTab: {
|
|
859
863
|
HasError: string;
|
|
860
864
|
};
|
|
865
|
+
PropertyGrid: {
|
|
866
|
+
InternalLink: {
|
|
867
|
+
label: string;
|
|
868
|
+
};
|
|
869
|
+
ExternalLink: {
|
|
870
|
+
label: string;
|
|
871
|
+
};
|
|
872
|
+
};
|
|
861
873
|
};
|
|
862
874
|
};
|
|
863
875
|
}
|
|
@@ -46,8 +46,8 @@ export declare class AzureConstants {
|
|
|
46
46
|
static readonly maxEncodedTelemetryDataLength = 512;
|
|
47
47
|
static readonly resourceDeploymentSubstring = "Microsoft.Resources/deployments";
|
|
48
48
|
static readonly graphResourceEndpoint = "/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01";
|
|
49
|
-
static readonly resourceTypeFilterQuery = "resources | where (type == \"microsoft.hybridcompute/machines\" or type == \"microsoft.compute/virtualmachines\")
|
|
50
|
-
static readonly azureVmsFilterQuery = "resources | where (type == \"microsoft.compute/virtualmachines\")
|
|
49
|
+
static readonly resourceTypeFilterQuery = "resources \n | extend parsedProperties = parse_json(properties) \n | extend computerName = parsedProperties.osProfile.computerName \n | where (type == \"microsoft.hybridcompute/machines\" or type == \"microsoft.compute/virtualmachines\") and tolower(computerName) in ({0}) \n | project arcStatus = properties.status, nodeName = computerName, type";
|
|
50
|
+
static readonly azureVmsFilterQuery = "resources \n | extend parsedProperties = parse_json(properties) \n | extend computerName = parsedProperties.osProfile.computerName \n | where (type == \"microsoft.compute/virtualmachines\") and tolower(computerName) in ({0})\n | project nodeName = computerName, type";
|
|
51
51
|
static readonly virtualMachine = "microsoft.compute/virtualmachines";
|
|
52
52
|
/**
|
|
53
53
|
* WAC URLS for azure arc machine agent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/azure/azure-constants.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;IACvB;;OAEG;IACH,gBAAuB,sBAAsB,kCAAkC;IAE/E;;OAEG;IACH,gBAAuB,iBAAiB,8BAA8B;IAEtE;;OAEG;IACH,gBAAuB,qBAAqB,yCAAyC;IAErF;;OAEG;IACH,gBAAuB,gBAAgB,6BAA6B;IAEpE;;OAEG;IACF,gBAAuB,qBAAqB,0CAA0C;IA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IAC1B,SAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAc5D;CACJ","file":"azure-constants.d.ts","sourcesContent":["export class AzureConstants {\r\n /**\r\n * Azure Resource Manager endpoint - Azure Global/Public cloud.\r\n */\r\n public static readonly azureGlobalArmEndpoint = 'https://management.azure.com';\r\n\r\n /**\r\n * Azure public portal.\r\n */\r\n public static readonly azureGlobalPortal = 'https://portal.azure.com';\r\n\r\n /**\r\n * Azure Resource Manager endpoint - Azure China cloud.\r\n */\r\n public static readonly azureChinaArmEndpoint = 'https://management.chinacloudapi.cn';\r\n\r\n /**\r\n * Azure China portal.\r\n */\r\n public static readonly azureChinaPortal = 'https://portal.azure.cn';\r\n\r\n /**\r\n * Azure Resource Manager endpoint - Azure US Govenment/Fairfax/Arlington.\r\n */\r\n public static readonly azureUSGovArmEndpoint = 'https://management.usgovcloudapi.net';\r\n\r\n /**\r\n * Azure US Government portal.\r\n */\r\n public static readonly azureUSGovPortal = 'https://portal.azure.us';\r\n\r\n public static readonly armApiVersion = '?api-version=2016-06-01';\r\n public static readonly azureSubscriptionUrl = '{0}/subscriptions?api-version=2016-06-01';\r\n public static readonly armDeploymentUrl =\r\n '{0}/subscriptions/{1}/resourcegroups/{2}/providers/Microsoft.Resources/deployments/{3}?api-version=2018-02-01';\r\n public static readonly validateAzureTemplate =\r\n '{0}/subscriptions/{1}/resourcegroups/{2}/providers/Microsoft.Resources/deployments/{3}/validate?api-version=2018-05-01';\r\n public static readonly getAllGeoLocations = '{0}/subscriptions/{1}/locations?api-version=2016-06-01';\r\n public static readonly getResourceGroupsUri = '{0}/subscriptions/{1}/resourcegroups?api-version=2018-02-01';\r\n\r\n // Resource groups.\r\n public static readonly listResourceGroups = '{0}/subscriptions/{1}/resourcegroups?api-version=2018-05-01';\r\n public static readonly listResourceGroupsWithParameters =\r\n '{0}/subscriptions/{1}/resourcegroups?$filter={2}&$top={3}api-version=2018-05-01';\r\n public static readonly resourceGroupUrl = '{0}/subscriptions/{1}/resourcegroups/{2}?api-version=2018-05-01';\r\n\r\n // Template deployment urls.\r\n public static readonly ArmDeploymentUrl =\r\n '{0}/subscriptions/{1}/resourcegroups/{2}/providers/Microsoft.Resources/deployments/{3}?api-version=2018-02-01';\r\n\r\n // Request header keys and values\r\n public static readonly bearer = 'Bearer ';\r\n public static readonly authorizationHeaderKey = 'Authorization';\r\n public static readonly acceptLanguageHeaderKey = 'Accept-Language';\r\n public static readonly clientRequestHeaderKey = 'x-ms-client-request-id';\r\n public static readonly returnClientRequestHeaderKey = 'x-ms-return-client-request-id';\r\n\r\n // TODO: Remove work around for telemetry. Client request id shouldnt have any parameters.\r\n public static readonly telemetryDataParameter = 'telemetryData={0}; ';\r\n public static readonly telemetryDataInvalidValue = 'invalid';\r\n public static readonly integrationTypeDataParameter = 'integrationType={0}; ';\r\n public static readonly clientRequestIdQualifier = '{0}; ';\r\n public static readonly sourceParameter = 'source=WindowsAdminCenter';\r\n public static readonly maxEncodedTelemetryDataLength = 512;\r\n public static readonly resourceDeploymentSubstring = 'Microsoft.Resources/deployments';\r\n\r\n // ms-graph resource endpoint\r\n public static readonly graphResourceEndpoint = '/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01';\r\n\r\n // ms-graph query\r\n public static readonly resourceTypeFilterQuery = `resources \r\n | extend parsedProperties = parse_json(properties) \r\n | extend computerName = parsedProperties.osProfile.computerName \r\n | where (type == \\\"microsoft.hybridcompute/machines\\\" or type == \\\"microsoft.compute/virtualmachines\\\") and tolower(computerName) in ({0}) \r\n | project arcStatus = properties.status, nodeName = computerName, type`;\r\n public static readonly azureVmsFilterQuery = `resources \r\n | extend parsedProperties = parse_json(properties) \r\n | extend computerName = parsedProperties.osProfile.computerName \r\n | where (type == \"microsoft.compute/virtualmachines\") and tolower(computerName) in ({0})\r\n | project nodeName = computerName, type`;\r\n\r\n public static readonly virtualMachine = \"microsoft.compute/virtualmachines\";\r\n\r\n /**\r\n * WAC URLS for azure arc machine agent\r\n */\r\n public static readonly arcMachineAgentIssuesURL = \"https://go.microsoft.com/fwlink/?linkid=2248533\";\r\n public static readonly expiredArcMachineAgentURL = \"https://learn.microsoft.com/azure/azure-arc/servers/manage-agent?tabs=windows#step-2-disconnect-the-server-from-azure-arc\";\r\n\r\n /**\r\n * The interval of running the graph query call.\r\n * In this case it's 15 minutes\r\n */\r\n public static graphQueryInterval = 900000;\r\n public static readonly arcStatusGraphQueryDelay = 7000;\r\n public static readonly arcStatusGraphQueryRetryCount = 8;\r\n}\r\n\r\n/*\r\n * Azure integration type is used to distinguish which Azure tool/service in Windows Admin Center is making a\r\n * Azure resource management (ARM) call. If only one repository has one tool/service, this will be inferred based\r\n * on the name of the module. If a repository has more than one tool/service then the integration type needs to be\r\n * explicitly set when calling this.appContextService.azureManagerService.createRequestWithHeaders() or when a\r\n * method like this.appContextService.azureManagerService.getSubscriptions() is called.\r\n */\r\nexport enum AzureIntegrationType {\r\n Backup = 'Backup',\r\n Bridge = 'Bridge',\r\n FileSync = 'FileSync',\r\n HybridServices = 'HybridServices',\r\n Monitor = 'Monitor',\r\n NetworkAdapter = 'NetworkAdapter',\r\n SecurityCenter = 'SecurityCenter',\r\n SiteRecovery = 'SiteRecovery',\r\n AzureMigrate = 'AzureMigrate',\r\n SubnetStretch = 'SubnetStretch',\r\n S2SVPN = 'S2SVPN',\r\n UpdateManagement = 'UpdateManagement',\r\n VirtualMachineCreation = 'VirtualMachineCreation',\r\n VirtualMachineSelection = 'VirtualMachineSelection'\r\n}\r\n\r\nexport namespace ArmTelemetry {\r\n export function toIntegrationType(moduleName: string): string {\r\n switch (moduleName) {\r\n case 'msft.azure.azure-backup': return AzureIntegrationType.Backup;\r\n case 'msft.sme.azure-file-sync': return AzureIntegrationType.FileSync;\r\n case 'msft.sme.azure-center': return AzureIntegrationType.HybridServices;\r\n case 'msft.sme.server-manager': return AzureIntegrationType.Monitor;\r\n case 'msft.sme.network-settings': return AzureIntegrationType.NetworkAdapter;\r\n case 'msft.azure.security-center': return AzureIntegrationType.SecurityCenter;\r\n case 'msft.sme.hyperv': return AzureIntegrationType.SiteRecovery;\r\n case 'msft.sme.subnet-stretch': return AzureIntegrationType.SubnetStretch;\r\n case 'msft.sdn.vgw-network-connection': return AzureIntegrationType.S2SVPN;\r\n case 'msft.sme.windows-update': return AzureIntegrationType.UpdateManagement;\r\n default: return moduleName;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -52,9 +52,16 @@ export class AzureConstants {
|
|
|
52
52
|
// ms-graph resource endpoint
|
|
53
53
|
static graphResourceEndpoint = '/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01';
|
|
54
54
|
// ms-graph query
|
|
55
|
-
static resourceTypeFilterQuery = `resources
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
static resourceTypeFilterQuery = `resources
|
|
56
|
+
| extend parsedProperties = parse_json(properties)
|
|
57
|
+
| extend computerName = parsedProperties.osProfile.computerName
|
|
58
|
+
| where (type == \"microsoft.hybridcompute/machines\" or type == \"microsoft.compute/virtualmachines\") and tolower(computerName) in ({0})
|
|
59
|
+
| project arcStatus = properties.status, nodeName = computerName, type`;
|
|
60
|
+
static azureVmsFilterQuery = `resources
|
|
61
|
+
| extend parsedProperties = parse_json(properties)
|
|
62
|
+
| extend computerName = parsedProperties.osProfile.computerName
|
|
63
|
+
| where (type == "microsoft.compute/virtualmachines") and tolower(computerName) in ({0})
|
|
64
|
+
| project nodeName = computerName, type`;
|
|
58
65
|
static virtualMachine = "microsoft.compute/virtualmachines";
|
|
59
66
|
/**
|
|
60
67
|
* WAC URLS for azure arc machine agent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/azure/azure-constants.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAc;IACvB;;OAEG;IACI,MAAM,CAAU,sBAAsB,GAAG,8BAA8B,CAAC;IAE/E;;OAEG;IACI,MAAM,CAAU,iBAAiB,GAAG,0BAA0B,CAAC;IAEtE;;OAEG;IACI,MAAM,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oBAAoB,CAAC,cAAc,CAAC;YACzE,KAAK,yBAAyB,CAAC,CAAC,OAAO,oBAAoB,CAAC,OAAO,CAAC;YACpE,KAAK,2BAA2B,CAAC,CAAC,OAAO,oBAAoB,CAAC,cAAc,CAAC;YAC7E,KAAK,4BAA4B,CAAC,CAAC,OAAO,oBAAoB,CAAC,cAAc,CAAC;YAC9E,KAAK,iBAAiB,CAAC,CAAC,OAAO,oBAAoB,CAAC,YAAY,CAAC;YACjE,KAAK,yBAAyB,CAAC,CAAC,OAAO,oBAAoB,CAAC,aAAa,CAAC;YAC1E,KAAK,iCAAiC,CAAC,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC;YAC3E,KAAK,yBAAyB,CAAC,CAAC,OAAO,oBAAoB,CAAC,gBAAgB,CAAC;YAC7E,OAAO,CAAC,CAAC,OAAO,UAAU,CAAC;SAC9B;IACL,CAAC;IAde,8BAAiB,oBAchC,CAAA;AACL,CAAC,EAhBgB,YAAY,KAAZ,YAAY,QAgB5B","file":"azure-constants.js","sourcesContent":["export class AzureConstants {\r\n /**\r\n * Azure Resource Manager endpoint - Azure Global/Public cloud.\r\n */\r\n public static readonly azureGlobalArmEndpoint = 'https://management.azure.com';\r\n\r\n /**\r\n * Azure public portal.\r\n */\r\n public static readonly azureGlobalPortal = 'https://portal.azure.com';\r\n\r\n /**\r\n * Azure Resource Manager endpoint - Azure China cloud.\r\n */\r\n public static readonly azureChinaArmEndpoint = 'https://management.chinacloudapi.cn';\r\n\r\n /**\r\n * Azure China portal.\r\n */\r\n public static readonly azureChinaPortal = 'https://portal.azure.cn';\r\n\r\n /**\r\n * Azure Resource Manager endpoint - Azure US Govenment/Fairfax/Arlington.\r\n */\r\n public static readonly azureUSGovArmEndpoint = 'https://management.usgovcloudapi.net';\r\n\r\n /**\r\n * Azure US Government portal.\r\n */\r\n public static readonly azureUSGovPortal = 'https://portal.azure.us';\r\n\r\n public static readonly armApiVersion = '?api-version=2016-06-01';\r\n public static readonly azureSubscriptionUrl = '{0}/subscriptions?api-version=2016-06-01';\r\n public static readonly armDeploymentUrl =\r\n '{0}/subscriptions/{1}/resourcegroups/{2}/providers/Microsoft.Resources/deployments/{3}?api-version=2018-02-01';\r\n public static readonly validateAzureTemplate =\r\n '{0}/subscriptions/{1}/resourcegroups/{2}/providers/Microsoft.Resources/deployments/{3}/validate?api-version=2018-05-01';\r\n public static readonly getAllGeoLocations = '{0}/subscriptions/{1}/locations?api-version=2016-06-01';\r\n public static readonly getResourceGroupsUri = '{0}/subscriptions/{1}/resourcegroups?api-version=2018-02-01';\r\n\r\n // Resource groups.\r\n public static readonly listResourceGroups = '{0}/subscriptions/{1}/resourcegroups?api-version=2018-05-01';\r\n public static readonly listResourceGroupsWithParameters =\r\n '{0}/subscriptions/{1}/resourcegroups?$filter={2}&$top={3}api-version=2018-05-01';\r\n public static readonly resourceGroupUrl = '{0}/subscriptions/{1}/resourcegroups/{2}?api-version=2018-05-01';\r\n\r\n // Template deployment urls.\r\n public static readonly ArmDeploymentUrl =\r\n '{0}/subscriptions/{1}/resourcegroups/{2}/providers/Microsoft.Resources/deployments/{3}?api-version=2018-02-01';\r\n\r\n // Request header keys and values\r\n public static readonly bearer = 'Bearer ';\r\n public static readonly authorizationHeaderKey = 'Authorization';\r\n public static readonly acceptLanguageHeaderKey = 'Accept-Language';\r\n public static readonly clientRequestHeaderKey = 'x-ms-client-request-id';\r\n public static readonly returnClientRequestHeaderKey = 'x-ms-return-client-request-id';\r\n\r\n // TODO: Remove work around for telemetry. Client request id shouldnt have any parameters.\r\n public static readonly telemetryDataParameter = 'telemetryData={0}; ';\r\n public static readonly telemetryDataInvalidValue = 'invalid';\r\n public static readonly integrationTypeDataParameter = 'integrationType={0}; ';\r\n public static readonly clientRequestIdQualifier = '{0}; ';\r\n public static readonly sourceParameter = 'source=WindowsAdminCenter';\r\n public static readonly maxEncodedTelemetryDataLength = 512;\r\n public static readonly resourceDeploymentSubstring = 'Microsoft.Resources/deployments';\r\n\r\n // ms-graph resource endpoint\r\n public static readonly graphResourceEndpoint = '/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01';\r\n\r\n // ms-graph query\r\n public static readonly resourceTypeFilterQuery = `resources | where (type == \"microsoft.hybridcompute/machines\" or type == \"microsoft.compute/virtualmachines\")\r\n and tolower(name) in ({0}) | project arcStatus = properties.status, nodeName = name, type`;\r\n public static readonly azureVmsFilterQuery = `resources | where (type == \\\"microsoft.compute/virtualmachines\\\")\\n and tolower(name) in ({0}) | project nodeName = name, type`;\r\n\r\n public static readonly virtualMachine = \"microsoft.compute/virtualmachines\";\r\n\r\n /**\r\n * WAC URLS for azure arc machine agent\r\n */\r\n public static readonly arcMachineAgentIssuesURL = \"https://go.microsoft.com/fwlink/?linkid=2248533\";\r\n public static readonly expiredArcMachineAgentURL = \"https://learn.microsoft.com/azure/azure-arc/servers/manage-agent?tabs=windows#step-2-disconnect-the-server-from-azure-arc\";\r\n\r\n /**\r\n * The interval of running the graph query call.\r\n * In this case it's 15 minutes\r\n */\r\n public static graphQueryInterval = 900000;\r\n public static readonly arcStatusGraphQueryDelay = 7000;\r\n public static readonly arcStatusGraphQueryRetryCount = 8;\r\n}\r\n\r\n/*\r\n * Azure integration type is used to distinguish which Azure tool/service in Windows Admin Center is making a\r\n * Azure resource management (ARM) call. If only one repository has one tool/service, this will be inferred based\r\n * on the name of the module. If a repository has more than one tool/service then the integration type needs to be\r\n * explicitly set when calling this.appContextService.azureManagerService.createRequestWithHeaders() or when a\r\n * method like this.appContextService.azureManagerService.getSubscriptions() is called.\r\n */\r\nexport enum AzureIntegrationType {\r\n Backup = 'Backup',\r\n Bridge = 'Bridge',\r\n FileSync = 'FileSync',\r\n HybridServices = 'HybridServices',\r\n Monitor = 'Monitor',\r\n NetworkAdapter = 'NetworkAdapter',\r\n SecurityCenter = 'SecurityCenter',\r\n SiteRecovery = 'SiteRecovery',\r\n AzureMigrate = 'AzureMigrate',\r\n SubnetStretch = 'SubnetStretch',\r\n S2SVPN = 'S2SVPN',\r\n UpdateManagement = 'UpdateManagement',\r\n VirtualMachineCreation = 'VirtualMachineCreation',\r\n VirtualMachineSelection = 'VirtualMachineSelection'\r\n}\r\n\r\nexport namespace ArmTelemetry {\r\n export function toIntegrationType(moduleName: string): string {\r\n switch (moduleName) {\r\n case 'msft.azure.azure-backup': return AzureIntegrationType.Backup;\r\n case 'msft.sme.azure-file-sync': return AzureIntegrationType.FileSync;\r\n case 'msft.sme.azure-center': return AzureIntegrationType.HybridServices;\r\n case 'msft.sme.server-manager': return AzureIntegrationType.Monitor;\r\n case 'msft.sme.network-settings': return AzureIntegrationType.NetworkAdapter;\r\n case 'msft.azure.security-center': return AzureIntegrationType.SecurityCenter;\r\n case 'msft.sme.hyperv': return AzureIntegrationType.SiteRecovery;\r\n case 'msft.sme.subnet-stretch': return AzureIntegrationType.SubnetStretch;\r\n case 'msft.sdn.vgw-network-connection': return AzureIntegrationType.S2SVPN;\r\n case 'msft.sme.windows-update': return AzureIntegrationType.UpdateManagement;\r\n default: return moduleName;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/azure/azure-constants.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAc;IACvB;;OAEG;IACI,MAAM,CAAU,sBAAsB,GAAG,8BAA8B,CAAC;IAE/E;;OAEG;IACI,MAAM,CAAU,iBAAiB,GAAG,0BAA0B,CAAC;IAEtE;;OAEG;IACI,MAAM,CAAU,qBAAqB,GAAG,qCAAqC,CAAC;IAErF;;OAEG;IACI,MAAM,CAAU,gBAAgB,GAAG,yBAAyB,CAAC;IAEpE;;OAEG;IACK,MAAM,CAAU,qBAAqB,GAAG,sCAAsC,CAAC;IAEvF;;OAEG;IACI,MAAM,CAAU,gBAAgB,GAAG,yBAAyB,CAAC;IAE7D,MAAM,CAAU,aAAa,GAAG,yBAAyB,CAAC;IAC1D,MAAM,CAAU,oBAAoB,GAAG,0CAA0C,CAAC;IAClF,MAAM,CAAU,gBAAgB,GACnC,+GA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C,aAAa,CAAC;YAC1E,KAAK,iCAAiC,CAAC,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC;YAC3E,KAAK,yBAAyB,CAAC,CAAC,OAAO,oBAAoB,CAAC,gBAAgB,CAAC;YAC7E,OAAO,CAAC,CAAC,OAAO,UAAU,CAAC;SAC9B;IACL,CAAC;IAde,8BAAiB,oBAchC,CAAA;AACL,CAAC,EAhBgB,YAAY,KAAZ,YAAY,QAgB5B","file":"azure-constants.js","sourcesContent":["export class AzureConstants {\r\n /**\r\n * Azure Resource Manager endpoint - Azure Global/Public cloud.\r\n */\r\n public static readonly azureGlobalArmEndpoint = 'https://management.azure.com';\r\n\r\n /**\r\n * Azure public portal.\r\n */\r\n public static readonly azureGlobalPortal = 'https://portal.azure.com';\r\n\r\n /**\r\n * Azure Resource Manager endpoint - Azure China cloud.\r\n */\r\n public static readonly azureChinaArmEndpoint = 'https://management.chinacloudapi.cn';\r\n\r\n /**\r\n * Azure China portal.\r\n */\r\n public static readonly azureChinaPortal = 'https://portal.azure.cn';\r\n\r\n /**\r\n * Azure Resource Manager endpoint - Azure US Govenment/Fairfax/Arlington.\r\n */\r\n public static readonly azureUSGovArmEndpoint = 'https://management.usgovcloudapi.net';\r\n\r\n /**\r\n * Azure US Government portal.\r\n */\r\n public static readonly azureUSGovPortal = 'https://portal.azure.us';\r\n\r\n public static readonly armApiVersion = '?api-version=2016-06-01';\r\n public static readonly azureSubscriptionUrl = '{0}/subscriptions?api-version=2016-06-01';\r\n public static readonly armDeploymentUrl =\r\n '{0}/subscriptions/{1}/resourcegroups/{2}/providers/Microsoft.Resources/deployments/{3}?api-version=2018-02-01';\r\n public static readonly validateAzureTemplate =\r\n '{0}/subscriptions/{1}/resourcegroups/{2}/providers/Microsoft.Resources/deployments/{3}/validate?api-version=2018-05-01';\r\n public static readonly getAllGeoLocations = '{0}/subscriptions/{1}/locations?api-version=2016-06-01';\r\n public static readonly getResourceGroupsUri = '{0}/subscriptions/{1}/resourcegroups?api-version=2018-02-01';\r\n\r\n // Resource groups.\r\n public static readonly listResourceGroups = '{0}/subscriptions/{1}/resourcegroups?api-version=2018-05-01';\r\n public static readonly listResourceGroupsWithParameters =\r\n '{0}/subscriptions/{1}/resourcegroups?$filter={2}&$top={3}api-version=2018-05-01';\r\n public static readonly resourceGroupUrl = '{0}/subscriptions/{1}/resourcegroups/{2}?api-version=2018-05-01';\r\n\r\n // Template deployment urls.\r\n public static readonly ArmDeploymentUrl =\r\n '{0}/subscriptions/{1}/resourcegroups/{2}/providers/Microsoft.Resources/deployments/{3}?api-version=2018-02-01';\r\n\r\n // Request header keys and values\r\n public static readonly bearer = 'Bearer ';\r\n public static readonly authorizationHeaderKey = 'Authorization';\r\n public static readonly acceptLanguageHeaderKey = 'Accept-Language';\r\n public static readonly clientRequestHeaderKey = 'x-ms-client-request-id';\r\n public static readonly returnClientRequestHeaderKey = 'x-ms-return-client-request-id';\r\n\r\n // TODO: Remove work around for telemetry. Client request id shouldnt have any parameters.\r\n public static readonly telemetryDataParameter = 'telemetryData={0}; ';\r\n public static readonly telemetryDataInvalidValue = 'invalid';\r\n public static readonly integrationTypeDataParameter = 'integrationType={0}; ';\r\n public static readonly clientRequestIdQualifier = '{0}; ';\r\n public static readonly sourceParameter = 'source=WindowsAdminCenter';\r\n public static readonly maxEncodedTelemetryDataLength = 512;\r\n public static readonly resourceDeploymentSubstring = 'Microsoft.Resources/deployments';\r\n\r\n // ms-graph resource endpoint\r\n public static readonly graphResourceEndpoint = '/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01';\r\n\r\n // ms-graph query\r\n public static readonly resourceTypeFilterQuery = `resources \r\n | extend parsedProperties = parse_json(properties) \r\n | extend computerName = parsedProperties.osProfile.computerName \r\n | where (type == \\\"microsoft.hybridcompute/machines\\\" or type == \\\"microsoft.compute/virtualmachines\\\") and tolower(computerName) in ({0}) \r\n | project arcStatus = properties.status, nodeName = computerName, type`;\r\n public static readonly azureVmsFilterQuery = `resources \r\n | extend parsedProperties = parse_json(properties) \r\n | extend computerName = parsedProperties.osProfile.computerName \r\n | where (type == \"microsoft.compute/virtualmachines\") and tolower(computerName) in ({0})\r\n | project nodeName = computerName, type`;\r\n\r\n public static readonly virtualMachine = \"microsoft.compute/virtualmachines\";\r\n\r\n /**\r\n * WAC URLS for azure arc machine agent\r\n */\r\n public static readonly arcMachineAgentIssuesURL = \"https://go.microsoft.com/fwlink/?linkid=2248533\";\r\n public static readonly expiredArcMachineAgentURL = \"https://learn.microsoft.com/azure/azure-arc/servers/manage-agent?tabs=windows#step-2-disconnect-the-server-from-azure-arc\";\r\n\r\n /**\r\n * The interval of running the graph query call.\r\n * In this case it's 15 minutes\r\n */\r\n public static graphQueryInterval = 900000;\r\n public static readonly arcStatusGraphQueryDelay = 7000;\r\n public static readonly arcStatusGraphQueryRetryCount = 8;\r\n}\r\n\r\n/*\r\n * Azure integration type is used to distinguish which Azure tool/service in Windows Admin Center is making a\r\n * Azure resource management (ARM) call. If only one repository has one tool/service, this will be inferred based\r\n * on the name of the module. If a repository has more than one tool/service then the integration type needs to be\r\n * explicitly set when calling this.appContextService.azureManagerService.createRequestWithHeaders() or when a\r\n * method like this.appContextService.azureManagerService.getSubscriptions() is called.\r\n */\r\nexport enum AzureIntegrationType {\r\n Backup = 'Backup',\r\n Bridge = 'Bridge',\r\n FileSync = 'FileSync',\r\n HybridServices = 'HybridServices',\r\n Monitor = 'Monitor',\r\n NetworkAdapter = 'NetworkAdapter',\r\n SecurityCenter = 'SecurityCenter',\r\n SiteRecovery = 'SiteRecovery',\r\n AzureMigrate = 'AzureMigrate',\r\n SubnetStretch = 'SubnetStretch',\r\n S2SVPN = 'S2SVPN',\r\n UpdateManagement = 'UpdateManagement',\r\n VirtualMachineCreation = 'VirtualMachineCreation',\r\n VirtualMachineSelection = 'VirtualMachineSelection'\r\n}\r\n\r\nexport namespace ArmTelemetry {\r\n export function toIntegrationType(moduleName: string): string {\r\n switch (moduleName) {\r\n case 'msft.azure.azure-backup': return AzureIntegrationType.Backup;\r\n case 'msft.sme.azure-file-sync': return AzureIntegrationType.FileSync;\r\n case 'msft.sme.azure-center': return AzureIntegrationType.HybridServices;\r\n case 'msft.sme.server-manager': return AzureIntegrationType.Monitor;\r\n case 'msft.sme.network-settings': return AzureIntegrationType.NetworkAdapter;\r\n case 'msft.azure.security-center': return AzureIntegrationType.SecurityCenter;\r\n case 'msft.sme.hyperv': return AzureIntegrationType.SiteRecovery;\r\n case 'msft.sme.subnet-stretch': return AzureIntegrationType.SubnetStretch;\r\n case 'msft.sdn.vgw-network-connection': return AzureIntegrationType.S2SVPN;\r\n case 'msft.sme.windows-update': return AzureIntegrationType.UpdateManagement;\r\n default: return moduleName;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/data/gateway-url-translator.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,oBAAoB;IAC7B,OAAO,CAAC,MAAM,CAAC,YAAY,
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/data/gateway-url-translator.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,oBAAoB;IAC7B,OAAO,CAAC,MAAM,CAAC,YAAY,CAQzB;IACF;;;;;;OAMG;WACW,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc;IAgCpD,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAazC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAalC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAalC,OAAO,CAAC,MAAM,CAAC,4BAA4B;IAa3C,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAanC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAatC,OAAO,CAAC,MAAM,CAAC,0BAA0B;CAY5C","file":"gateway-url-translator.d.ts","sourcesContent":["import { Net } from './net';\r\n\r\nexport interface UrlTranslation {\r\n newUrl: string;\r\n startUrl: string;\r\n}\r\n\r\nexport class GatewayUrlTranslator {\r\n private static translations = {\r\n powerShellTranslationMatcher: /features\\/powershellApi\\/(.*)/i,\r\n cimTranslationMatcher: /features\\/cim\\/(.*)/i,\r\n wdacMatcher: /features\\/wdac\\/(.*)/i,\r\n jeaMatcher: /features\\/jea\\/(.*)/i,\r\n fileTransferMatcher: /features\\/fileTransfer\\/(.*)/i,\r\n counterMatcher: /counter\\/(.*)/i,\r\n extensionsTranslationMatcher: /features\\/extensions\\/(.*)/i\r\n };\r\n /**\r\n * Given url return a gateway v2 translation object that will work well with\r\n * nodes/node api.\r\n *\r\n * @param url a gateway v1 url\r\n * @returns\r\n */\r\n public static translate(url: string): UrlTranslation {\r\n if (this.translations.powerShellTranslationMatcher.test(url)) {\r\n return this.translatePowerShellRequest(url);\r\n }\r\n\r\n if (this.translations.cimTranslationMatcher.test(url)) {\r\n return this.translateCimRequest(url);\r\n }\r\n\r\n if (this.translations.jeaMatcher.test(url)) {\r\n return this.translateJeaRequest(url);\r\n }\r\n\r\n if (this.translations.wdacMatcher.test(url)) {\r\n return this.translateWdacRequest(url);\r\n }\r\n\r\n if (this.translations.fileTransferMatcher.test(url)) {\r\n return this.translateFileTransferRequest(url);\r\n }\r\n\r\n if (this.translations.counterMatcher.test(url)) {\r\n return this.translateCounterRequest(url);\r\n }\r\n\r\n if (this.translations.extensionsTranslationMatcher.test(url)) {\r\n return this.translateExtensionsRequest(url);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translatePowerShellRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.powerShellTranslationMatcher);\r\n if (matches) {\r\n const restOfString = matches[1];\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerPowerShell}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translateCimRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.cimTranslationMatcher);\r\n if (matches) {\r\n const restOfString = matches[1];\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerCim}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translateJeaRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.jeaMatcher);\r\n if (matches) {\r\n const restOfString = matches[1];\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerJea}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translateFileTransferRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.fileTransferMatcher);\r\n if (matches) {\r\n const restOfString = matches[1];\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerFileTransfer}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translateWdacRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.wdacMatcher);\r\n if (matches) {\r\n const restOfString = matches[1];\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerWdac}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translateCounterRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.counterMatcher);\r\n if (matches) {\r\n const restOfString = matches[1];\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerPerformanceCounter}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translateExtensionsRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.extensionsTranslationMatcher);\r\n if (matches) {\r\n const restOfString = `extensions/${matches[1]}`;\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerExtensions}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n"]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Net } from './net';
|
|
2
2
|
export class GatewayUrlTranslator {
|
|
3
3
|
static translations = {
|
|
4
|
-
powerShellTranslationMatcher: /features\/powershellApi\/(.*)
|
|
5
|
-
cimTranslationMatcher: /features\/cim\/(.*)
|
|
6
|
-
wdacMatcher: /features\/wdac\/(.*)
|
|
7
|
-
jeaMatcher: /features\/jea\/(.*)
|
|
8
|
-
fileTransferMatcher: /features\/fileTransfer\/(.*)
|
|
9
|
-
counterMatcher: /counter\/(.*)/
|
|
4
|
+
powerShellTranslationMatcher: /features\/powershellApi\/(.*)/i,
|
|
5
|
+
cimTranslationMatcher: /features\/cim\/(.*)/i,
|
|
6
|
+
wdacMatcher: /features\/wdac\/(.*)/i,
|
|
7
|
+
jeaMatcher: /features\/jea\/(.*)/i,
|
|
8
|
+
fileTransferMatcher: /features\/fileTransfer\/(.*)/i,
|
|
9
|
+
counterMatcher: /counter\/(.*)/i,
|
|
10
|
+
extensionsTranslationMatcher: /features\/extensions\/(.*)/i
|
|
10
11
|
};
|
|
11
12
|
/**
|
|
12
13
|
* Given url return a gateway v2 translation object that will work well with
|
|
@@ -34,6 +35,9 @@ export class GatewayUrlTranslator {
|
|
|
34
35
|
if (this.translations.counterMatcher.test(url)) {
|
|
35
36
|
return this.translateCounterRequest(url);
|
|
36
37
|
}
|
|
38
|
+
if (this.translations.extensionsTranslationMatcher.test(url)) {
|
|
39
|
+
return this.translateExtensionsRequest(url);
|
|
40
|
+
}
|
|
37
41
|
return null;
|
|
38
42
|
}
|
|
39
43
|
static translatePowerShellRequest(url) {
|
|
@@ -102,6 +106,17 @@ export class GatewayUrlTranslator {
|
|
|
102
106
|
}
|
|
103
107
|
return null;
|
|
104
108
|
}
|
|
109
|
+
static translateExtensionsRequest(url) {
|
|
110
|
+
const matches = url.match(this.translations.extensionsTranslationMatcher);
|
|
111
|
+
if (matches) {
|
|
112
|
+
const restOfString = `extensions/${matches[1]}`;
|
|
113
|
+
return {
|
|
114
|
+
newUrl: restOfString,
|
|
115
|
+
startUrl: `services/${Net.serviceWinRest}/${Net.controllerExtensions}`
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
105
120
|
}
|
|
106
121
|
|
|
107
122
|
//# sourceMappingURL=gateway-url-translator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/data/gateway-url-translator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAO5B,MAAM,OAAO,oBAAoB;IACrB,MAAM,CAAC,YAAY,GAAG;QAC1B,4BAA4B,EAAE
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/data/gateway-url-translator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAO5B,MAAM,OAAO,oBAAoB;IACrB,MAAM,CAAC,YAAY,GAAG;QAC1B,4BAA4B,EAAE,gCAAgC;QAC9D,qBAAqB,EAAE,sBAAsB;QAC7C,WAAW,EAAE,uBAAuB;QACpC,UAAU,EAAE,sBAAsB;QAClC,mBAAmB,EAAE,+BAA+B;QACpD,cAAc,EAAE,gBAAgB;QAChC,4BAA4B,EAAE,6BAA6B;KAC9D,CAAC;IACF;;;;;;OAMG;IACI,MAAM,CAAC,SAAS,CAAC,GAAW;QAC/B,IAAI,IAAI,CAAC,YAAY,CAAC,4BAA4B,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YAC1D,OAAO,IAAI,CAAC,0BAA0B,CAAC,GAAG,CAAC,CAAC;SAC/C;QAED,IAAI,IAAI,CAAC,YAAY,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACnD,OAAO,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;SACxC;QAED,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,E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,cAAc,EAAE;aACnE,CAAC;SACL;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,MAAM,CAAC,uBAAuB,CAAC,GAAW;QAC9C,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;QAC5D,IAAI,OAAO,EAAE;YACT,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAChC,OAAO;gBACH,MAAM,EAAE,YAAY;gBACpB,QAAQ,EAAE,YAAY,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,4BAA4B,EAAE;aACjF,CAAC;SACL;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,MAAM,CAAC,0BAA0B,CAAC,GAAW;QACjD,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,4BAA4B,CAAC,CAAC;QAC1E,IAAI,OAAO,EAAE;YACT,MAAM,YAAY,GAAG,cAAc,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YAChD,OAAO;gBACH,MAAM,EAAE,YAAY;gBACpB,QAAQ,EAAE,YAAY,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,oBAAoB,EAAE;aACzE,CAAC;SACL;QAED,OAAO,IAAI,CAAC;IAChB,CAAC","file":"gateway-url-translator.js","sourcesContent":["import { Net } from './net';\r\n\r\nexport interface UrlTranslation {\r\n newUrl: string;\r\n startUrl: string;\r\n}\r\n\r\nexport class GatewayUrlTranslator {\r\n private static translations = {\r\n powerShellTranslationMatcher: /features\\/powershellApi\\/(.*)/i,\r\n cimTranslationMatcher: /features\\/cim\\/(.*)/i,\r\n wdacMatcher: /features\\/wdac\\/(.*)/i,\r\n jeaMatcher: /features\\/jea\\/(.*)/i,\r\n fileTransferMatcher: /features\\/fileTransfer\\/(.*)/i,\r\n counterMatcher: /counter\\/(.*)/i,\r\n extensionsTranslationMatcher: /features\\/extensions\\/(.*)/i\r\n };\r\n /**\r\n * Given url return a gateway v2 translation object that will work well with\r\n * nodes/node api.\r\n *\r\n * @param url a gateway v1 url\r\n * @returns\r\n */\r\n public static translate(url: string): UrlTranslation {\r\n if (this.translations.powerShellTranslationMatcher.test(url)) {\r\n return this.translatePowerShellRequest(url);\r\n }\r\n\r\n if (this.translations.cimTranslationMatcher.test(url)) {\r\n return this.translateCimRequest(url);\r\n }\r\n\r\n if (this.translations.jeaMatcher.test(url)) {\r\n return this.translateJeaRequest(url);\r\n }\r\n\r\n if (this.translations.wdacMatcher.test(url)) {\r\n return this.translateWdacRequest(url);\r\n }\r\n\r\n if (this.translations.fileTransferMatcher.test(url)) {\r\n return this.translateFileTransferRequest(url);\r\n }\r\n\r\n if (this.translations.counterMatcher.test(url)) {\r\n return this.translateCounterRequest(url);\r\n }\r\n\r\n if (this.translations.extensionsTranslationMatcher.test(url)) {\r\n return this.translateExtensionsRequest(url);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translatePowerShellRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.powerShellTranslationMatcher);\r\n if (matches) {\r\n const restOfString = matches[1];\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerPowerShell}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translateCimRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.cimTranslationMatcher);\r\n if (matches) {\r\n const restOfString = matches[1];\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerCim}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translateJeaRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.jeaMatcher);\r\n if (matches) {\r\n const restOfString = matches[1];\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerJea}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translateFileTransferRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.fileTransferMatcher);\r\n if (matches) {\r\n const restOfString = matches[1];\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerFileTransfer}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translateWdacRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.wdacMatcher);\r\n if (matches) {\r\n const restOfString = matches[1];\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerWdac}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translateCounterRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.counterMatcher);\r\n if (matches) {\r\n const restOfString = matches[1];\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerPerformanceCounter}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private static translateExtensionsRequest(url: string): UrlTranslation {\r\n const matches = url.match(this.translations.extensionsTranslationMatcher);\r\n if (matches) {\r\n const restOfString = `extensions/${matches[1]}`;\r\n return {\r\n newUrl: restOfString,\r\n startUrl: `services/${Net.serviceWinRest}/${Net.controllerExtensions}`\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/data/node-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAM,MAAM,MAAM,CAAC;AAKtC,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAIzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAE7D;;GAEG;AACH,oBAAY,aAAa;IACrB;;OAEG;IACH,MAAM,IAAA;IAEN;;OAEG;IACH,QAAQ,IAAA;IAER;;OAEG;IACH,MAAM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AAE,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC;IACzH;;;;;;;;OAQG;IACI,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC;IAO3G;;;;;;;OAOG;IACI,WAAW,CAAC,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI;IACpG;;;;;;;OAOG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI;IA0BtF;;;;OAIG;IACI,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAIxD;;;OAGG;IACI,cAAc,CAAC,QAAQ,EAAE,MAAM;IAItC;;;;;;;;OAQG;IACI,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAetG;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IA2DzB;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IAalB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;CA4B3B","file":"node-connection.d.ts","sourcesContent":["import { Observable, of } from 'rxjs';\r\nimport { map, mergeMap } from 'rxjs/operators';\r\nimport { SmeWebTelemetry } from '../diagnostics/sme-web-telemetry';\r\nimport { Strings } from '../generated/strings';\r\nimport { EnvironmentModule } from '../manifest/environment-modules';\r\nimport { AuthorizationManager, AuthorizationToken } from '../security/authorization-manager';\r\nimport { GatewayConnection, GatewayRequest } from './gateway-connection';\r\nimport { GatewayUrlTranslator } from './gateway-url-translator';\r\nimport { headerConstants } from './http-constants';\r\nimport { Net } from './net';\r\nimport { PowerShellCommandWithoutState } from './powershell';\r\n\r\n/**\r\n * Node Cim output type.\r\n */\r\nexport enum NodeCimOutput {\r\n /**\r\n * Single instance.\r\n */\r\n Single,\r\n\r\n /**\r\n * Multiple instances.\r\n */\r\n Multiple,\r\n\r\n /**\r\n * Invoke result.\r\n */\r\n Result,\r\n\r\n /**\r\n * WQL query result.\r\n */\r\n Query\r\n}\r\n\r\n/**\r\n * Node Request options that we use to extend the GatewayRequest interface\r\n */\r\nexport interface NodeRequestOptions {\r\n /**\r\n * Indicates that no auth failure handling should take place, however, any auth headers for this node will still be added.\r\n */\r\n noAuth?: boolean;\r\n\r\n /**\r\n * Provides an alternative token to use for just this request\r\n */\r\n authToken?: AuthorizationToken;\r\n\r\n /**\r\n * Authentication mechanism.\r\n */\r\n authenticationMechanism?: 'Credssp' | 'NotSpecified';\r\n\r\n /**\r\n * Indicates if command should run in local runspace instead of remote runspace.\r\n */\r\n useInProcRunspace?: boolean;\r\n\r\n /**\r\n * Indicates that audit logging for this request should be made. Default is false.\r\n */\r\n logAudit?: boolean;\r\n\r\n /**\r\n * Indicates that telemetry logging for this request should be made. Default is false.\r\n * SmeWebTelemetry will not be sent for polling PS events.\r\n */\r\n logTelemetry?: boolean;\r\n\r\n /**\r\n * Indicates targeting to specific PowerShell endpoint.\r\n * The endpoint data is inserted to the endpoint header.\r\n */\r\n powerShellEndpoint?: string;\r\n\r\n /**\r\n * The PowerShell command resource on JEA PowerShell endpoint.\r\n * The command object is used for auto fallback time on a CIM query.\r\n * (Only CIM query uses this property)\r\n */\r\n powerShell?: PowerShellCommandWithoutState;\r\n\r\n /**\r\n * The parameters for instance query powershell alternative.\r\n * (Only CIM query uses this property)\r\n */\r\n powerShellParameters?: any;\r\n\r\n /**\r\n * The PowerShell context to replace CIM call.\r\n * (Only CIM query uses this property)\r\n */\r\n powerShellContext?: {\r\n /**\r\n * CIM output data type.\r\n */\r\n cimOutput: NodeCimOutput;\r\n\r\n /**\r\n * CIM input parameters.\r\n */\r\n parameters?: any;\r\n };\r\n}\r\n\r\n/**\r\n * Extension of GatewayRequest interface for calling the Gateway Node API\r\n */\r\nexport interface NodeRequest extends GatewayRequest, NodeRequestOptions {\r\n}\r\n\r\n/**\r\n * Service request interface for gateway version 2.\r\n */\r\nexport interface ServiceRequest {\r\n /**\r\n * The service name such as \"WinRest\", \"WinStream\", \"LinuxBase\" and so on.\r\n */\r\n serviceName: string;\r\n\r\n /**\r\n * The controller name such as \"PowerShell\", \"Cim\", \"Ssh\" and so on.\r\n */\r\n controllerName: string;\r\n\r\n /**\r\n * The node name.\r\n */\r\n nodeName: string;\r\n}\r\n\r\n/**\r\n * The Node Connection class for creating requests and calling the Gateway's Node API\r\n */\r\nexport class NodeConnection {\r\n /**\r\n * Initializes a new instance of the GatewayService class.\r\n *\r\n * @param gateway the gateway Connection\r\n * @param authorizationManager the authorization manager.\r\n */\r\n constructor(private gateway: GatewayConnection, private authorizationManager: AuthorizationManager) { }\r\n\r\n /**\r\n * Makes a POST call to the gateway node api\r\n *\r\n * @param serviceRequest the object of service request.\r\n * @param remained the remained Url after 'nodes/<nodeName>'.\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n * @remarks this API is for gateway version 2. It doesn't work on gateway version 1.\r\n */\r\n public post(serviceRequest: ServiceRequest, remained: string, body?: any, request?: NodeRequest): Observable<any>;\r\n /**\r\n * @deprecated This API is for version 1 gateway server, use new API for version 2 gateway.\r\n * Makes a POST call to the gateway node api\r\n *\r\n * @param nodeName the name of the node to call the API for\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n */\r\n public post(nodeName: string, relativeUrl: string, body?: any, request?: NodeRequest): Observable<any>;\r\n public post(nodeOrService: string | ServiceRequest, remained: string, body?: any, request?: NodeRequest): Observable<any> {\r\n const { nodeName, relativeUrl } = this.getNodeUrl(nodeOrService, remained);\r\n request = this.createNodeRequest(request || <NodeRequest>{}, nodeName);\r\n return this.gateway.post(relativeUrl, body, request);\r\n }\r\n\r\n /**\r\n * Makes a GET call to the gateway node api\r\n *\r\n * @param serviceRequest the object of service request.\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param request the node request object.\r\n * @remarks this API is for gateway version 2. It doesn't work on gateway version 1.\r\n */\r\n public get(serviceRequest: ServiceRequest, relativeUrl: string, request?: NodeRequest): Observable<any>;\r\n /**\r\n * @deprecated This API is for version 1 gateway server, use new API for version 2 gateway.\r\n * Makes a GET call to the gateway node api\r\n *\r\n * @param nodeName the name of the node to call the API for\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param request the node request object.\r\n */\r\n public get(nodeName: string, relativeUrl: string, request?: NodeRequest): Observable<any>;\r\n public get(nodeOrService: string | ServiceRequest, remained: string, request?: NodeRequest): Observable<any> {\r\n const { nodeName, relativeUrl } = this.getNodeUrl(nodeOrService, remained);\r\n request = this.createNodeRequest(request || <NodeRequest>{}, nodeName);\r\n return this.gateway.get(relativeUrl, request);\r\n }\r\n\r\n /**\r\n * Makes a PUT call to the gateway node api\r\n *\r\n * @param serviceRequest the object of service request.\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n * @remarks this API is for gateway version 2. It doesn't work on gateway version 1.\r\n */\r\n public put(serviceRequest: ServiceRequest, relativeUrl: string, body?: string, request?: NodeRequest): Observable<any>;\r\n /**\r\n * @deprecated This API is for version 1 gateway server, use new API for version 2 gateway.\r\n * Makes a PUT call to the gateway node api\r\n *\r\n * @param nodeName the name of the node to call the API for\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n */\r\n public put(nodeName: string, relativeUrl: string, body?: string, request?: NodeRequest): Observable<any>;\r\n public put(nodeOrService: string | ServiceRequest, remained: string, body?: string, request?: NodeRequest): Observable<any> {\r\n const { nodeName, relativeUrl } = this.getNodeUrl(nodeOrService, remained);\r\n request = this.createNodeRequest(request || <NodeRequest>{}, nodeName);\r\n return this.gateway.put(relativeUrl, body, request);\r\n }\r\n\r\n /**\r\n * Makes a PATCH call to the gateway node api\r\n *\r\n * @param serviceRequest the object of service request.\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n * @remarks this API is for gateway version 2. It doesn't work on gateway version 1.\r\n */\r\n public patch(serviceRequest: ServiceRequest, relativeUrl: string, body?: string, request?: NodeRequest): Observable<any>;\r\n /**\r\n * @deprecated This API is for version 1 gateway server, use new API for version 2 gateway.\r\n * Makes a PATCH call to the gateway node api\r\n *\r\n * @param nodeName the name of the node to call the API for\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n */\r\n public patch(nodeName: string, relativeUrl: string, body?: string, request?: NodeRequest): Observable<any>;\r\n public patch(nodeOrService: string | ServiceRequest, remained: string, body?: string, request?: NodeRequest): Observable<any> {\r\n const { nodeName, relativeUrl } = this.getNodeUrl(nodeOrService, remained);\r\n request = this.createNodeRequest(request || <NodeRequest>{}, nodeName);\r\n return this.gateway.patch(relativeUrl, body, request);\r\n }\r\n\r\n /**\r\n * Makes a DELETE call to the gateway node api\r\n *\r\n * @param serviceRequest the object of service request.\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n * @remarks this API is for gateway version 2. It doesn't work on gateway version 1.\r\n */\r\n public delete(serviceRequest: ServiceRequest, relativeUrl: string, body?: string, request?: NodeRequest): Observable<any>;\r\n /**\r\n * @deprecated This API is for version 1 gateway server, use new API for version 2 gateway.\r\n * Makes a DELETE call to the gateway node api\r\n *\r\n * @param nodeName the name of the node to call the API for\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n */\r\n public delete(nodeName: string, relativeUrl: string, body?: string, request?: NodeRequest): Observable<any>;\r\n public delete(nodeOrService: string | ServiceRequest, remained: string, body?: string, request?: NodeRequest): Observable<any> {\r\n const { nodeName, relativeUrl } = this.getNodeUrl(nodeOrService, remained);\r\n request = this.createNodeRequest(request || <NodeRequest>{}, nodeName);\r\n return this.gateway.delete(relativeUrl, body, request);\r\n }\r\n\r\n /**\r\n * Makes a DELETE call to the gateway node api without waiting for the response.\r\n *\r\n * @param serviceRequest the object of service request.\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param request the node request object.\r\n * @remarks this API is for gateway version 2. It doesn't work on gateway version 1.\r\n */\r\n public deleteQuick(serviceRequest: ServiceRequest, relativeUrl: string, request?: NodeRequest): void;\r\n /**\r\n * @deprecated This API is for version 1 gateway server, use new API for version 2 gateway.\r\n * Makes a DELETE call to the gateway node api without waiting for the response.\r\n *\r\n * @param nodeName the name of the node to call the API for\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param request the node request object.\r\n */\r\n public deleteQuick(nodeName: string, relativeUrl: string, request?: NodeRequest): void;\r\n public deleteQuick(nodeOrService: string | ServiceRequest, remained: string, request?: NodeRequest): void {\r\n const { nodeName, relativeUrl } = this.getNodeUrl(nodeOrService, remained);\r\n request.headers = request.headers || {};\r\n if (!request.authToken) {\r\n // if we don't have an authToken, then make sure we are not waiting on one.\r\n this.authorizationManager.addAuthorizationRequestHeader(request, nodeName);\r\n } else {\r\n this.authorizationManager.addAuthorizationRequestHeader(request, nodeName, request.authToken);\r\n }\r\n\r\n const endpoint = this.authorizationManager.getJeaEndpoint(nodeName);\r\n if (request.powerShellEndpoint) {\r\n // Override JEA fallback if endpoint is explicitly set for debugging purposes\r\n (<any>request).headers[headerConstants.POWERSHELL_ENDPOINT] = request.powerShellEndpoint;\r\n } else if (endpoint) {\r\n (<any>request).headers[headerConstants.POWERSHELL_ENDPOINT] = endpoint;\r\n }\r\n\r\n if (request.authenticationMechanism === 'Credssp') {\r\n (<any>request).headers[headerConstants.AUTHENTICATION_MECHANISM] = request.authenticationMechanism;\r\n }\r\n\r\n return this.gateway.deleteQuick(relativeUrl, request.headers);\r\n }\r\n\r\n /**\r\n * Persists the JEA powershell endpoint context\r\n * @param nodeName The node name\r\n * @param endpoint The powershell endpoint\r\n */\r\n public saveJeaContext(nodeName: string, endpoint: string) {\r\n this.authorizationManager.saveJeaContext(nodeName, endpoint);\r\n }\r\n\r\n /**\r\n * Gets the JEA powershell endpoint, if it exists\r\n * @param nodeName The node name\r\n */\r\n public getJeaEndpoint(nodeName: string) {\r\n return this.authorizationManager.getJeaEndpoint(nodeName);\r\n }\r\n\r\n /**\r\n * Creates service node API for Gateway V2.\r\n *\r\n * @param serviceName the name of service.\r\n * @param apiName the name of api.\r\n * @param nodeName the name of node.\r\n * @param remained the remained URL after it including option parameters.\r\n * @returns URL string.\r\n */\r\n public getServiceUrl(serviceName: string, apiName: string, nodeName: string, remained: string): string {\r\n // 1) if null or empty, it's empty.\r\n // 2) if start with \"?\", remains as is.\r\n // 3) if not started with \"/\", add \"/\".\r\n remained = remained ?? '';\r\n if (remained.length > 0 && !remained.startsWith('/')) {\r\n if (!remained.startsWith('?')) {\r\n remained = `/${remained}`;\r\n }\r\n }\r\n\r\n // for example, \"/api/services/WinREST/PowerShell/nodes/computer-abc/invoke\"\r\n return `/Services/${serviceName}/${apiName}/nodes/${nodeName}${remained}`;\r\n }\r\n\r\n /**\r\n * Adds default parameters to a NodeRequest\r\n *\r\n * @param method the http method to use\r\n * @param relativeUrl the relative Url after \"/api/\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object to extend.\r\n */\r\n private createNodeRequest(request: NodeRequest, nodeName: string): GatewayRequest {\r\n // if we did not specify no auth, and we are not using a custom token...\r\n request = MsftSme.deepAssign({}, request);\r\n if (!request.noAuth && !request.authToken) {\r\n // ...then add node specific authorization handlers\r\n request.retryHandlers = (request.retryHandlers || []).concat([{\r\n canHandle: (code, error) => this.authorizationManager.canHandleAjaxFailure(code, error),\r\n handle: (code, originalRequest, error) =>\r\n this.authorizationManager.handleAjaxFailure(code, originalRequest, error, nodeName)\r\n }]);\r\n }\r\n\r\n const oldBeforeCall = request.beforeCall;\r\n\r\n // Add before call handler to wait for any pending node authorization\r\n request.beforeCall = pendingRequest => {\r\n let observable: Observable<void> = null;\r\n if (!request.authToken) {\r\n // if we dont have an authToken, then make sure we are not waiting on one.\r\n observable = this.authorizationManager.authAwaiter\r\n .pipe(map(() =>\r\n this.authorizationManager.addAuthorizationRequestHeader(pendingRequest, nodeName)));\r\n } else {\r\n observable = of(\r\n this.authorizationManager.addAuthorizationRequestHeader(pendingRequest, nodeName, request.authToken)\r\n );\r\n }\r\n\r\n if (oldBeforeCall) {\r\n return oldBeforeCall(request).pipe(mergeMap(() => observable));\r\n }\r\n\r\n return observable;\r\n };\r\n\r\n request.headers = request.headers || {};\r\n if (request.logAudit === true || request.logAudit === false) {\r\n (<any>request).headers[headerConstants.LOG_AUDIT] = request.logAudit ? 'true' : 'false';\r\n }\r\n\r\n if (request.logTelemetry === true || request.logTelemetry === false) {\r\n (<any>request).headers[headerConstants.LOG_TELEMETRY] = request.logTelemetry ? 'true' : 'false';\r\n }\r\n\r\n const endpoint = this.authorizationManager.getJeaEndpoint(nodeName);\r\n if (request.powerShellEndpoint) {\r\n // Override JEA fallback if endpoint is explicitly set for debugging purposes\r\n (<any>request).headers[headerConstants.POWERSHELL_ENDPOINT] = request.powerShellEndpoint;\r\n } else if (endpoint) {\r\n (<any>request).headers[headerConstants.POWERSHELL_ENDPOINT] = endpoint;\r\n }\r\n\r\n if (request.authenticationMechanism === 'Credssp') {\r\n (<any>request).headers[headerConstants.AUTHENTICATION_MECHANISM] = request.authenticationMechanism;\r\n }\r\n\r\n return request;\r\n }\r\n\r\n /**\r\n * Get node name and node url.\r\n * @param nodeOrService The node name or service request object.\r\n * @param remained The remained url.\r\n * @returns node name and node url.\r\n */\r\n private getNodeUrl(nodeOrService: string | ServiceRequest, remained: string): { nodeName: string, relativeUrl: string } {\r\n if (typeof nodeOrService === 'string') {\r\n const nodeName = <string>nodeOrService;\r\n return { nodeName, relativeUrl: this.getNodeMappedUrl(nodeName, remained) };\r\n }\r\n\r\n const service = <ServiceRequest>nodeOrService;\r\n return {\r\n nodeName: service.nodeName,\r\n relativeUrl: this.getServiceUrl(service.serviceName, service.controllerName, service.nodeName, remained)\r\n };\r\n }\r\n\r\n /**\r\n * Creates a Node url\r\n *\r\n * @param nodeName the name of the node to make a call against\r\n * @param relativeUrl the relative Url after \"/nodes/<nodeName>/\"\r\n */\r\n private getNodeMappedUrl(nodeName: string, relativeUrl: string): string {\r\n if (EnvironmentModule.isGatewayV200) {\r\n const translation = GatewayUrlTranslator.translate(relativeUrl);\r\n if (translation) {\r\n return `${translation.startUrl}/nodes/${nodeName}/${translation.newUrl}`;\r\n }\r\n\r\n SmeWebTelemetry.traceAction(null, {\r\n content: {\r\n message: 'Could not get translation for URL: {0}'.format(relativeUrl),\r\n action: 'TranslateUrlToGateWayV2'\r\n }\r\n },\r\n { type: 'error' });\r\n\r\n throw new Error(MsftSme.getStrings<Strings>().MsftSmeShell.Core.TranslateGatewayUrls.Url.Not.expected.ErrorMessage\r\n .format(relativeUrl)\r\n );\r\n }\r\n\r\n // create node url from current url\r\n if (!relativeUrl.startsWith('/')) {\r\n relativeUrl = `/${relativeUrl}`;\r\n }\r\n\r\n relativeUrl = Net.updateApiVersion20190201(relativeUrl);\r\n return `/nodes/${nodeName}${relativeUrl}`;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/data/node-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAM,MAAM,MAAM,CAAC;AAKtC,OAAO,EAAE,oBAAoB,EAAE,k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Observable, of } from 'rxjs';\r\nimport { map, mergeMap } from 'rxjs/operators';\r\nimport { SmeWebTelemetry } from '../diagnostics/sme-web-telemetry';\r\nimport { Strings } from '../generated/strings';\r\nimport { EnvironmentModule } from '../manifest/environment-modules';\r\nimport { AuthorizationManager, AuthorizationToken } from '../security/authorization-manager';\r\nimport { GatewayConnection, GatewayRequest } from './gateway-connection';\r\nimport { GatewayUrlTranslator } from './gateway-url-translator';\r\nimport { headerConstants } from './http-constants';\r\nimport { Net } from './net';\r\nimport { PowerShellCommandWithoutState } from './powershell';\r\n\r\n/**\r\n * Node Cim output type.\r\n */\r\nexport enum NodeCimOutput {\r\n /**\r\n * Single instance.\r\n */\r\n Single,\r\n\r\n /**\r\n * Multiple instances.\r\n */\r\n Multiple,\r\n\r\n /**\r\n * Invoke result.\r\n */\r\n Result,\r\n\r\n /**\r\n * WQL query result.\r\n */\r\n Query\r\n}\r\n\r\n/**\r\n * Node Request options that we use to extend the GatewayRequest interface\r\n */\r\nexport interface NodeRequestOptions {\r\n /**\r\n * Indicates that no auth failure handling should take place, however, any auth headers for this node will still be added.\r\n */\r\n noAuth?: boolean;\r\n\r\n /**\r\n * Provides an alternative token to use for just this request\r\n */\r\n authToken?: AuthorizationToken;\r\n\r\n /**\r\n * Authentication mechanism.\r\n */\r\n authenticationMechanism?: 'Credssp' | 'NotSpecified';\r\n\r\n /**\r\n * Indicates if command should run in local runspace instead of remote runspace.\r\n */\r\n useInProcRunspace?: boolean;\r\n\r\n /**\r\n * Indicates that audit logging for this request should be made. Default is false.\r\n */\r\n logAudit?: boolean;\r\n\r\n /**\r\n * Indicates that telemetry logging for this request should be made. Default is false.\r\n * SmeWebTelemetry will not be sent for polling PS events.\r\n */\r\n logTelemetry?: boolean;\r\n\r\n /**\r\n * Indicates targeting to specific PowerShell endpoint.\r\n * The endpoint data is inserted to the endpoint header.\r\n */\r\n powerShellEndpoint?: string;\r\n\r\n /**\r\n * The PowerShell command resource on JEA PowerShell endpoint.\r\n * The command object is used for auto fallback time on a CIM query.\r\n * (Only CIM query uses this property)\r\n */\r\n powerShell?: PowerShellCommandWithoutState;\r\n\r\n /**\r\n * The parameters for instance query powershell alternative.\r\n * (Only CIM query uses this property)\r\n */\r\n powerShellParameters?: any;\r\n\r\n /**\r\n * The PowerShell context to replace CIM call.\r\n * (Only CIM query uses this property)\r\n */\r\n powerShellContext?: {\r\n /**\r\n * CIM output data type.\r\n */\r\n cimOutput: NodeCimOutput;\r\n\r\n /**\r\n * CIM input parameters.\r\n */\r\n parameters?: any;\r\n };\r\n}\r\n\r\n/**\r\n * Extension of GatewayRequest interface for calling the Gateway Node API\r\n */\r\nexport interface NodeRequest extends GatewayRequest, NodeRequestOptions {\r\n}\r\n\r\n/**\r\n * Service request interface for gateway version 2.\r\n */\r\nexport interface ServiceRequest {\r\n /**\r\n * The service name such as \"WinRest\", \"WinStream\", \"LinuxBase\" and so on.\r\n */\r\n serviceName: string;\r\n\r\n /**\r\n * The controller name such as \"PowerShell\", \"Cim\", \"Ssh\" and so on.\r\n */\r\n controllerName: string;\r\n\r\n /**\r\n * The node name.\r\n */\r\n nodeName: string;\r\n}\r\n\r\n/**\r\n * The Node Connection class for creating requests and calling the Gateway's Node API\r\n */\r\nexport class NodeConnection {\r\n /**\r\n * Initializes a new instance of the GatewayService class.\r\n *\r\n * @param gateway the gateway Connection\r\n * @param authorizationManager the authorization manager.\r\n */\r\n constructor(private gateway: GatewayConnection, private authorizationManager: AuthorizationManager) { }\r\n\r\n /**\r\n * Makes a POST call to the gateway node api\r\n *\r\n * @param serviceRequest the object of service request.\r\n * @param remained the remained Url after 'nodes/<nodeName>'.\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n * @remarks this API is for gateway version 2. It doesn't work on gateway version 1.\r\n */\r\n public post(serviceRequest: ServiceRequest, remained: string, body?: any, request?: NodeRequest): Observable<any>;\r\n /**\r\n * @deprecated This API is for version 1 gateway server, use new API for version 2 gateway.\r\n * Makes a POST call to the gateway node api\r\n *\r\n * @param nodeName the name of the node to call the API for\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n */\r\n public post(nodeName: string, relativeUrl: string, body?: any, request?: NodeRequest): Observable<any>;\r\n public post(nodeOrService: string | ServiceRequest, remained: string, body?: any, request?: NodeRequest): Observable<any> {\r\n const { nodeName, relativeUrl } = this.getNodeUrl(nodeOrService, remained);\r\n request = this.createNodeRequest(request || <NodeRequest>{}, nodeName);\r\n return this.gateway.post(relativeUrl, body, request);\r\n }\r\n\r\n /**\r\n * Makes a GET call to the gateway node api\r\n *\r\n * @param serviceRequest the object of service request.\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param request the node request object.\r\n * @remarks this API is for gateway version 2. It doesn't work on gateway version 1.\r\n */\r\n public get(serviceRequest: ServiceRequest, relativeUrl: string, request?: NodeRequest): Observable<any>;\r\n /**\r\n * @deprecated This API is for version 1 gateway server, use new API for version 2 gateway.\r\n * Makes a GET call to the gateway node api\r\n *\r\n * @param nodeName the name of the node to call the API for\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param request the node request object.\r\n */\r\n public get(nodeName: string, relativeUrl: string, request?: NodeRequest): Observable<any>;\r\n public get(nodeOrService: string | ServiceRequest, remained: string, request?: NodeRequest): Observable<any> {\r\n const { nodeName, relativeUrl } = this.getNodeUrl(nodeOrService, remained);\r\n request = this.createNodeRequest(request || <NodeRequest>{}, nodeName);\r\n return this.gateway.get(relativeUrl, request);\r\n }\r\n\r\n /**\r\n * Makes a PUT call to the gateway node api\r\n *\r\n * @param serviceRequest the object of service request.\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n * @remarks this API is for gateway version 2. It doesn't work on gateway version 1.\r\n */\r\n public put(serviceRequest: ServiceRequest, relativeUrl: string, body?: string, request?: NodeRequest): Observable<any>;\r\n /**\r\n * @deprecated This API is for version 1 gateway server, use new API for version 2 gateway.\r\n * Makes a PUT call to the gateway node api\r\n *\r\n * @param nodeName the name of the node to call the API for\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n */\r\n public put(nodeName: string, relativeUrl: string, body?: string, request?: NodeRequest): Observable<any>;\r\n public put(nodeOrService: string | ServiceRequest, remained: string, body?: string, request?: NodeRequest): Observable<any> {\r\n const { nodeName, relativeUrl } = this.getNodeUrl(nodeOrService, remained);\r\n request = this.createNodeRequest(request || <NodeRequest>{}, nodeName);\r\n return this.gateway.put(relativeUrl, body, request);\r\n }\r\n\r\n /**\r\n * Makes a PATCH call to the gateway node api\r\n *\r\n * @param serviceRequest the object of service request.\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n * @remarks this API is for gateway version 2. It doesn't work on gateway version 1.\r\n */\r\n public patch(serviceRequest: ServiceRequest, relativeUrl: string, body?: string, request?: NodeRequest): Observable<any>;\r\n /**\r\n * @deprecated This API is for version 1 gateway server, use new API for version 2 gateway.\r\n * Makes a PATCH call to the gateway node api\r\n *\r\n * @param nodeName the name of the node to call the API for\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n */\r\n public patch(nodeName: string, relativeUrl: string, body?: string, request?: NodeRequest): Observable<any>;\r\n public patch(nodeOrService: string | ServiceRequest, remained: string, body?: string, request?: NodeRequest): Observable<any> {\r\n const { nodeName, relativeUrl } = this.getNodeUrl(nodeOrService, remained);\r\n request = this.createNodeRequest(request || <NodeRequest>{}, nodeName);\r\n return this.gateway.patch(relativeUrl, body, request);\r\n }\r\n\r\n /**\r\n * Makes a DELETE call to the gateway node api\r\n *\r\n * @param serviceRequest the object of service request.\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n * @remarks this API is for gateway version 2. It doesn't work on gateway version 1.\r\n */\r\n public delete(serviceRequest: ServiceRequest, relativeUrl: string, body?: string, request?: NodeRequest): Observable<any>;\r\n /**\r\n * @deprecated This API is for version 1 gateway server, use new API for version 2 gateway.\r\n * Makes a DELETE call to the gateway node api\r\n *\r\n * @param nodeName the name of the node to call the API for\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object.\r\n */\r\n public delete(nodeName: string, relativeUrl: string, body?: string, request?: NodeRequest): Observable<any>;\r\n public delete(nodeOrService: string | ServiceRequest, remained: string, body?: string, request?: NodeRequest): Observable<any> {\r\n const { nodeName, relativeUrl } = this.getNodeUrl(nodeOrService, remained);\r\n request = this.createNodeRequest(request || <NodeRequest>{}, nodeName);\r\n return this.gateway.delete(relativeUrl, body, request);\r\n }\r\n\r\n /**\r\n * Makes a DELETE call to the gateway node api without waiting for the response.\r\n *\r\n * @param serviceRequest the object of service request.\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param request the node request object.\r\n * @remarks this API is for gateway version 2. It doesn't work on gateway version 1.\r\n */\r\n public deleteQuick(serviceRequest: ServiceRequest, relativeUrl: string, request?: NodeRequest): void;\r\n /**\r\n * @deprecated This API is for version 1 gateway server, use new API for version 2 gateway.\r\n * Makes a DELETE call to the gateway node api without waiting for the response.\r\n *\r\n * @param nodeName the name of the node to call the API for\r\n * @param relativeUrl the relative Url after \"/api/nodes/<nodeName>\"\r\n * @param request the node request object.\r\n */\r\n public deleteQuick(nodeName: string, relativeUrl: string, request?: NodeRequest): void;\r\n public deleteQuick(nodeOrService: string | ServiceRequest, remained: string, request?: NodeRequest): void {\r\n const { nodeName, relativeUrl } = this.getNodeUrl(nodeOrService, remained);\r\n request.headers = request.headers || {};\r\n if (!request.authToken) {\r\n // if we don't have an authToken, then make sure we are not waiting on one.\r\n this.authorizationManager.addAuthorizationRequestHeader(request, nodeName);\r\n } else {\r\n this.authorizationManager.addAuthorizationRequestHeader(request, nodeName, request.authToken);\r\n }\r\n\r\n const endpoint = this.authorizationManager.getJeaEndpoint(nodeName);\r\n if (request.powerShellEndpoint) {\r\n // Override JEA fallback if endpoint is explicitly set for debugging purposes\r\n (<any>request).headers[headerConstants.POWERSHELL_ENDPOINT] = request.powerShellEndpoint;\r\n } else if (endpoint) {\r\n (<any>request).headers[headerConstants.POWERSHELL_ENDPOINT] = endpoint;\r\n }\r\n\r\n if (request.authenticationMechanism === 'Credssp') {\r\n (<any>request).headers[headerConstants.AUTHENTICATION_MECHANISM] = request.authenticationMechanism;\r\n }\r\n\r\n return this.gateway.deleteQuick(relativeUrl, request.headers);\r\n }\r\n\r\n /**\r\n * Persists the JEA powershell endpoint context\r\n * @param nodeName The node name\r\n * @param endpoint The powershell endpoint\r\n */\r\n public saveJeaContext(nodeName: string, endpoint: string) {\r\n this.authorizationManager.saveJeaContext(nodeName, endpoint);\r\n }\r\n\r\n /**\r\n * Gets the JEA powershell endpoint, if it exists\r\n * @param nodeName The node name\r\n */\r\n public getJeaEndpoint(nodeName: string) {\r\n return this.authorizationManager.getJeaEndpoint(nodeName);\r\n }\r\n\r\n /**\r\n * Creates service node API for Gateway V2.\r\n *\r\n * @param serviceName the name of service.\r\n * @param apiName the name of api.\r\n * @param nodeName the name of node.\r\n * @param remained the remained URL after it including option parameters.\r\n * @returns URL string.\r\n */\r\n public getServiceUrl(serviceName: string, apiName: string, nodeName: string, remained: string): string {\r\n // 1) if null or empty, it's empty.\r\n // 2) if start with \"?\", remains as is.\r\n // 3) if not started with \"/\", add \"/\".\r\n remained = remained ?? '';\r\n if (remained.length > 0 && !remained.startsWith('/')) {\r\n if (!remained.startsWith('?')) {\r\n remained = `/${remained}`;\r\n }\r\n }\r\n\r\n // for example, \"/api/services/WinREST/PowerShell/nodes/computer-abc/invoke\"\r\n return `/Services/${serviceName}/${apiName}/nodes/${nodeName}${remained}`;\r\n }\r\n\r\n /**\r\n * Adds default parameters to a NodeRequest\r\n *\r\n * @param method the http method to use\r\n * @param relativeUrl the relative Url after \"/api/\"\r\n * @param body the body string JSON.stringfy'ed\r\n * @param request the node request object to extend.\r\n */\r\n private createNodeRequest(request: NodeRequest, nodeName: string): GatewayRequest {\r\n // if we did not specify no auth, and we are not using a custom token...\r\n request = MsftSme.deepAssign({}, request);\r\n if (!request.noAuth && !request.authToken) {\r\n // ...then add node specific authorization handlers\r\n request.retryHandlers = (request.retryHandlers || []).concat([{\r\n canHandle: (code, error) => this.authorizationManager.canHandleAjaxFailure(code, error),\r\n handle: (code, originalRequest, error) =>\r\n this.authorizationManager.handleAjaxFailure(code, originalRequest, error, nodeName)\r\n }]);\r\n }\r\n\r\n const oldBeforeCall = request.beforeCall;\r\n\r\n // Add before call handler to wait for any pending node authorization\r\n request.beforeCall = pendingRequest => {\r\n let observable: Observable<void> = null;\r\n if (!request.authToken) {\r\n // if we dont have an authToken, then make sure we are not waiting on one.\r\n observable = this.authorizationManager.authAwaiter\r\n .pipe(map(() =>\r\n this.authorizationManager.addAuthorizationRequestHeader(pendingRequest, nodeName)));\r\n } else {\r\n observable = of(\r\n this.authorizationManager.addAuthorizationRequestHeader(pendingRequest, nodeName, request.authToken)\r\n );\r\n }\r\n\r\n if (oldBeforeCall) {\r\n return oldBeforeCall(request).pipe(mergeMap(() => observable));\r\n }\r\n\r\n return observable;\r\n };\r\n\r\n request.headers = request.headers || {};\r\n if (request.logAudit === true || request.logAudit === false) {\r\n (<any>request).headers[headerConstants.LOG_AUDIT] = request.logAudit ? 'true' : 'false';\r\n }\r\n\r\n if (request.logTelemetry === true || request.logTelemetry === false) {\r\n (<any>request).headers[headerConstants.LOG_TELEMETRY] = request.logTelemetry ? 'true' : 'false';\r\n }\r\n\r\n const endpoint = this.authorizationManager.getJeaEndpoint(nodeName);\r\n if (request.powerShellEndpoint) {\r\n // Override JEA fallback if endpoint is explicitly set for debugging purposes\r\n (<any>request).headers[headerConstants.POWERSHELL_ENDPOINT] = request.powerShellEndpoint;\r\n } else if (endpoint) {\r\n (<any>request).headers[headerConstants.POWERSHELL_ENDPOINT] = endpoint;\r\n }\r\n\r\n if (request.authenticationMechanism === 'Credssp') {\r\n (<any>request).headers[headerConstants.AUTHENTICATION_MECHANISM] = request.authenticationMechanism;\r\n }\r\n\r\n return request;\r\n }\r\n\r\n /**\r\n * Get node name and node url.\r\n * @param nodeOrService The node name or service request object.\r\n * @param remained The remained url.\r\n * @returns node name and node url.\r\n */\r\n private getNodeUrl(nodeOrService: string | ServiceRequest, remained: string): { nodeName: string, relativeUrl: string } {\r\n if (typeof nodeOrService === 'string') {\r\n const nodeName = <string>nodeOrService;\r\n return { nodeName, relativeUrl: this.getNodeMappedUrl(nodeName, remained) };\r\n }\r\n\r\n const service = <ServiceRequest>nodeOrService;\r\n return {\r\n nodeName: service.nodeName,\r\n relativeUrl: this.getServiceUrl(service.serviceName, service.controllerName, service.nodeName, remained)\r\n };\r\n }\r\n\r\n /**\r\n * Creates a Node url\r\n *\r\n * @param nodeName the name of the node to make a call against\r\n * @param relativeUrl the relative Url after \"/nodes/<nodeName>/\"\r\n */\r\n private getNodeMappedUrl(nodeName: string, relativeUrl: string): string {\r\n if (EnvironmentModule.isGatewayV200) {\r\n const translation = GatewayUrlTranslator.translate(relativeUrl);\r\n if (translation) {\r\n return `${translation.startUrl}/nodes/${nodeName}/${translation.newUrl}`;\r\n }\r\n\r\n SmeWebTelemetry.traceAction(\r\n null,\r\n {\r\n content: {\r\n message: 'Could not get translation for URL: {0}'.format(relativeUrl),\r\n action: 'TranslateUrlToGateWayV2'\r\n }\r\n },\r\n { type: 'error' });\r\n }\r\n\r\n // create node url from current url\r\n if (!relativeUrl.startsWith('/')) {\r\n relativeUrl = `/${relativeUrl}`;\r\n }\r\n\r\n relativeUrl = Net.updateApiVersion20190201(relativeUrl);\r\n return `/nodes/${nodeName}${relativeUrl}`;\r\n }\r\n}\r\n"]}
|
|
@@ -218,8 +218,6 @@ export class NodeConnection {
|
|
|
218
218
|
action: 'TranslateUrlToGateWayV2'
|
|
219
219
|
}
|
|
220
220
|
}, { type: 'error' });
|
|
221
|
-
throw new Error(MsftSme.getStrings().MsftSmeShell.Core.TranslateGatewayUrls.Url.Not.expected.ErrorMessage
|
|
222
|
-
.format(relativeUrl));
|
|
223
221
|
}
|
|
224
222
|
// create node url from current url
|
|
225
223
|
if (!relativeUrl.startsWith('/')) {
|