@microsoft/windows-admin-center-sdk 2.128.0 → 2.165.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.
Files changed (129) hide show
  1. package/angular/assets/strings/cs-CZ/strings.json +1 -1
  2. package/angular/assets/strings/de-DE/strings.json +1 -1
  3. package/angular/assets/strings/es-ES/strings.json +1 -1
  4. package/angular/assets/strings/fr-FR/strings.json +1 -1
  5. package/angular/assets/strings/hu-HU/strings.json +1 -1
  6. package/angular/assets/strings/it-IT/strings.json +1 -1
  7. package/angular/assets/strings/ja-JP/strings.json +1 -1
  8. package/angular/assets/strings/ko-KR/strings.json +1 -1
  9. package/angular/assets/strings/nl-NL/strings.json +1 -1
  10. package/angular/assets/strings/pl-PL/strings.json +1 -1
  11. package/angular/assets/strings/pt-BR/strings.json +1 -1
  12. package/angular/assets/strings/pt-PT/strings.json +1 -1
  13. package/angular/assets/strings/ru-RU/strings.json +1 -1
  14. package/angular/assets/strings/sv-SE/strings.json +1 -1
  15. package/angular/assets/strings/tr-TR/strings.json +1 -1
  16. package/angular/assets/strings/zh-CN/strings.json +1 -1
  17. package/angular/assets/strings/zh-TW/strings.json +1 -1
  18. package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.js +706 -507
  19. package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.js.map +1 -1
  20. package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.min.js +1 -1
  21. package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.min.js.map +1 -1
  22. package/angular/esm2015/src/controls/accordion/index.js +5 -0
  23. package/angular/esm2015/src/controls/data-table/data-table.component.js +135 -129
  24. package/angular/esm2015/src/controls/dialog/dialog.component.js +11 -5
  25. package/angular/esm2015/src/controls/dialog/dialog.service.js +6 -13
  26. package/angular/esm2015/src/controls/dropdown/dropdown.service.js +3 -2
  27. package/angular/esm2015/src/controls/form/form-field/array/array-form-field.component.js +29 -22
  28. package/angular/esm2015/src/controls/form/form-field/datetime-range/datetime-range-form-field.component.js +4 -3
  29. package/angular/esm2015/src/controls/form/form-field/list/list-form-field.component.js +1 -1
  30. package/angular/esm2015/src/controls/form/validation-alert/validation-alert.component.js +3 -2
  31. package/angular/esm2015/src/controls/index.js +2 -1
  32. package/angular/esm2015/src/controls/pivot/pivot.component.js +21 -9
  33. package/angular/esm2015/src/controls/settings/common-settings/common-settings.component.js +38 -34
  34. package/angular/esm2015/src/controls/settings/settings-content.component.js +3 -2
  35. package/angular/esm2015/src/controls/settings/settings.component.js +45 -13
  36. package/angular/esm2015/src/controls/settings/settings.module.js +5 -1
  37. package/angular/esm2015/src/controls/tooltip/tooltip-zone.directive.js +2 -2
  38. package/angular/esm2015/src/controls/wizard/models/index.js +1 -1
  39. package/angular/esm2015/src/controls/wizard/models/wizard-builder-interface.js +2 -0
  40. package/angular/esm2015/src/controls/wizard/models/wizard-navigation-interface.js +2 -0
  41. package/angular/esm2015/src/controls/wizard/wizard-builder.js +70 -1
  42. package/angular/esm2015/src/controls/wizard/wizard-navigation-information.js +56 -2
  43. package/angular/esm2015/src/controls/wizard/wizard.component.js +8 -2
  44. package/angular/esm2015/src/service/connectivity-enforcer.js +5 -2
  45. package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.js +656 -462
  46. package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.js.map +1 -1
  47. package/angular/src/controls/accordion/index.d.ts +4 -0
  48. package/angular/src/controls/form/form-field/array/array-form-field.component.d.ts +2 -1
  49. package/angular/src/controls/index.d.ts +1 -0
  50. package/angular/src/controls/pivot/pivot.component.d.ts +2 -2
  51. package/angular/src/controls/settings/settings.component.d.ts +3 -0
  52. package/angular/src/controls/settings/settings.module.d.ts +3 -2
  53. package/angular/src/controls/wizard/models/index.d.ts +2 -0
  54. package/angular/src/controls/wizard/models/wizard-builder-interface.d.ts +8 -0
  55. package/angular/src/controls/wizard/models/wizard-navigation-interface.d.ts +4 -0
  56. package/angular/src/controls/wizard/wizard-builder.d.ts +36 -1
  57. package/angular/src/controls/wizard/wizard-navigation-information.d.ts +48 -5
  58. package/angular/src/controls/wizard/wizard.component.d.ts +2 -1
  59. package/core/azure/azure-constants.d.ts +8 -0
  60. package/core/azure/azure-constants.js +8 -0
  61. package/core/azure/azure-constants.js.map +1 -1
  62. package/core/azure/azure-manager.d.ts +1 -0
  63. package/core/azure/azure-manager.js +7 -1
  64. package/core/azure/azure-manager.js.map +1 -1
  65. package/core/base/environment.d.ts +3 -0
  66. package/core/base/environment.js.map +1 -1
  67. package/core/base/msft-sme.mock.js +3 -0
  68. package/core/base/msft-sme.mock.js.map +1 -1
  69. package/core/base/utilities.d.ts +0 -3
  70. package/core/base/utilities.js +0 -34
  71. package/core/base/utilities.js.map +1 -1
  72. package/core/data/resource-cache.d.ts +1 -1
  73. package/core/data/resource-cache.js +1 -1
  74. package/core/data/resource-cache.js.map +1 -1
  75. package/core/data/settings-manager.d.ts +3 -0
  76. package/core/data/settings-manager.js +14 -1
  77. package/core/data/settings-manager.js.map +1 -1
  78. package/core/dom/dom.d.ts +5 -0
  79. package/core/dom/dom.js +20 -0
  80. package/core/dom/dom.js.map +1 -1
  81. package/core/manifest/environment-modules.js +3 -0
  82. package/core/manifest/environment-modules.js.map +1 -1
  83. package/core/notification/client-notification-instance.d.ts +5 -2
  84. package/core/notification/client-notification-instance.js +9 -5
  85. package/core/notification/client-notification-instance.js.map +1 -1
  86. package/core/notification/client-notification.d.ts +4 -0
  87. package/core/notification/client-notification.js.map +1 -1
  88. package/core/notification/notification.d.ts +6 -1
  89. package/core/notification/notification.js +3 -1
  90. package/core/notification/notification.js.map +1 -1
  91. package/core/rpc/credssp/rpc-credssp-model.d.ts +4 -0
  92. package/core/rpc/credssp/rpc-credssp-model.js.map +1 -1
  93. package/core/rpc/dialog/rpc-dialog-client.js +11 -5
  94. package/core/rpc/dialog/rpc-dialog-client.js.map +1 -1
  95. package/core/rpc/rpc.d.ts +6 -6
  96. package/core/rpc/rpc.js +7 -7
  97. package/core/rpc/rpc.js.map +1 -1
  98. package/core/security/authorization-manager.js +1 -1
  99. package/core/security/authorization-manager.js.map +1 -1
  100. package/core/security/credssp-manager.d.ts +13 -6
  101. package/core/security/credssp-manager.js +37 -21
  102. package/core/security/credssp-manager.js.map +1 -1
  103. package/core/shared/cluster-inventory/cluster-inventory-cache.js +2 -1
  104. package/core/shared/cluster-inventory/cluster-inventory-cache.js.map +1 -1
  105. package/e2e/assets/strings/cs-CZ/strings.json +1 -1
  106. package/e2e/assets/strings/de-DE/strings.json +1 -1
  107. package/e2e/assets/strings/es-ES/strings.json +1 -1
  108. package/e2e/assets/strings/fr-FR/strings.json +1 -1
  109. package/e2e/assets/strings/hu-HU/strings.json +1 -1
  110. package/e2e/assets/strings/it-IT/strings.json +1 -1
  111. package/e2e/assets/strings/ja-JP/strings.json +1 -1
  112. package/e2e/assets/strings/ko-KR/strings.json +1 -1
  113. package/e2e/assets/strings/nl-NL/strings.json +1 -1
  114. package/e2e/assets/strings/pl-PL/strings.json +1 -1
  115. package/e2e/assets/strings/pt-BR/strings.json +1 -1
  116. package/e2e/assets/strings/pt-PT/strings.json +1 -1
  117. package/e2e/assets/strings/ru-RU/strings.json +1 -1
  118. package/e2e/assets/strings/strings.json +1 -1
  119. package/e2e/assets/strings/sv-SE/strings.json +1 -1
  120. package/e2e/assets/strings/tr-TR/strings.json +1 -1
  121. package/e2e/assets/strings/zh-CN/strings.json +1 -1
  122. package/e2e/assets/strings/zh-TW/strings.json +1 -1
  123. package/package.json +11 -4
  124. package/styles/css/main.css +1 -1
  125. package/tools/gulp-ps-cim/index.js +1 -1
  126. package/tools/gulp-ps-cim/index.js.map +1 -1
  127. package/angular/assets/strings/en-US/strings.json +0 -1
  128. package/core/assets/strings/en-US/strings.json +0 -1
  129. package/e2e/assets/strings/en-US/strings.json +0 -1
@@ -0,0 +1,4 @@
1
+ export { AccordionModule } from './accordion.module';
2
+ export { AccordionComponent } from './accordion.component';
3
+ export { AccordionPanelComponent } from './accordion-panel/accordion-panel.component';
4
+ export { PanelControlComponent } from './accordion-panel/accordion-panel.component';
@@ -73,6 +73,7 @@ export declare class ArrayFormFieldComponent extends SmeInternalFormFieldCompone
73
73
  */
74
74
  maxItems: number;
75
75
  addButtonText: string;
76
+ headerTemplate: TemplateRef<any>;
76
77
  set itemTitle(value: string);
77
78
  get itemTitle(): string;
78
79
  /**
@@ -137,5 +138,5 @@ export declare class ArrayFormFieldComponent extends SmeInternalFormFieldCompone
137
138
  */
138
139
  private getNewItem;
139
140
  static ɵfac: i0.ɵɵFactoryDef<ArrayFormFieldComponent, never>;
140
- static ɵcmp: i0.ɵɵComponentDefWithMeta<ArrayFormFieldComponent, "sme-form-field[type=\"array\"]", never, { "adjustControlButtonLocation": "adjustControlButtonLocation"; "newItem": "newItem"; "showAdd": "showAdd"; "showRemove": "showRemove"; "showMove": "showMove"; "canCloseAll": "canCloseAll"; "canCloseAny": "canCloseAny"; "canOpenMultiple": "canOpenMultiple"; "maxItems": "maxItems"; "addButtonText": "addButtonText"; "itemTitle": "itemTitle"; }, { "askForNewItem": "askForNewItem"; "askForItemHeader": "askForItemHeader"; "askForRemoveEvaluator": "askForRemoveEvaluator"; }, ["subFieldIsolator"], never>;
141
+ static ɵcmp: i0.ɵɵComponentDefWithMeta<ArrayFormFieldComponent, "sme-form-field[type=\"array\"]", never, { "adjustControlButtonLocation": "adjustControlButtonLocation"; "newItem": "newItem"; "showAdd": "showAdd"; "showRemove": "showRemove"; "showMove": "showMove"; "canCloseAll": "canCloseAll"; "canCloseAny": "canCloseAny"; "canOpenMultiple": "canOpenMultiple"; "maxItems": "maxItems"; "addButtonText": "addButtonText"; "headerTemplate": "headerTemplate"; "itemTitle": "itemTitle"; }, { "askForNewItem": "askForNewItem"; "askForItemHeader": "askForItemHeader"; "askForRemoveEvaluator": "askForRemoveEvaluator"; }, ["subFieldIsolator"], never>;
141
142
  }
@@ -9,6 +9,7 @@ export { BackgroundExtensionRootComponent } from './extension-root/background-ex
9
9
  export { ExtensionRootModule } from './extension-root/extension-root.module';
10
10
  export { SmeUxComponent } from './ux/sme-ux.component';
11
11
  export { SmeUxModule } from './ux/sme-ux.module';
12
+ export * from './accordion/index';
12
13
  export * from './actions/index';
13
14
  export * from './active-directory/index';
14
15
  export * from './alert-bar/index';
@@ -101,7 +101,8 @@ export declare class PivotComponent extends CoreBaseComponent implements Layout,
101
101
  * @param tab The tab to select
102
102
  */
103
103
  select(tab: PivotTabComponent): void;
104
- onLayoutChanged(): void;
104
+ private emitLayoutChanged;
105
+ private onLayoutChanged;
105
106
  getTabPanelIndex(id: string, currentTab: boolean): number | undefined;
106
107
  /**
107
108
  * Creates the idBag used by this component to store unique element ids.
@@ -113,7 +114,6 @@ export declare class PivotComponent extends CoreBaseComponent implements Layout,
113
114
  */
114
115
  protected getInitialHostClasses(): string[];
115
116
  private updatePivotTabs;
116
- tabWidthChanged(pivotTab: PivotTabComponent): void;
117
117
  static ɵfac: i0.ɵɵFactoryDef<PivotComponent, [null, { optional: true; skipSelf: true; }]>;
118
118
  static ɵcmp: i0.ɵɵComponentDefWithMeta<PivotComponent, "sme-pivot", never, { "selection": "selection"; "switchTabByShowHide": "switchTabByShowHide"; "headerText": "headerText"; "alignHeader": "alignHeader"; "alignTabs": "alignTabs"; "noLeftPadding": "noLeftPadding"; "disabled": "disabled"; }, { "selectionChange": "selectionChange"; "layoutChanged": "layoutChanged"; }, ["tabs", "visibleTabsQL"], never>;
119
119
  }
@@ -13,6 +13,7 @@ export declare class SettingsComponent extends CoreBaseComponent implements OnIn
13
13
  */
14
14
  protected get logSourceName(): string;
15
15
  allForms: FormGroup[];
16
+ addPadding: boolean;
16
17
  private autoFocus;
17
18
  /**
18
19
  * @deprecated Add your own custom back button in the form
@@ -22,6 +23,7 @@ export declare class SettingsComponent extends CoreBaseComponent implements OnIn
22
23
  extras?: NavigationExtras;
23
24
  };
24
25
  settingsTitle: string;
26
+ private layoutComponent;
25
27
  settingsForms: SettingsFormService;
26
28
  dialogService: DialogService;
27
29
  constructor(injector: Injector);
@@ -37,6 +39,7 @@ export declare class SettingsComponent extends CoreBaseComponent implements OnIn
37
39
  * Gets the initial host classes to be applied to this element
38
40
  */
39
41
  protected getInitialHostClasses(): string[];
42
+ isPaddingRequired(): boolean;
40
43
  static ɵfac: i0.ɵɵFactoryDef<SettingsComponent, never>;
41
44
  static ɵcmp: i0.ɵɵComponentDefWithMeta<SettingsComponent, "sme-settings", never, { "backRoute": "backRoute"; "settingsTitle": "settingsTitle"; }, {}, never, ["sme-settings-navigation", "sme-settings-header", "sme-settings-content", "sme-settings-footer"]>;
42
45
  }
@@ -10,9 +10,10 @@ import * as i8 from "./common-settings/common-settings.component";
10
10
  import * as i9 from "@angular/router";
11
11
  import * as i10 from "@angular/common";
12
12
  import * as i11 from "../header/header.module";
13
- import * as i12 from "../tooltip/tooltip.module";
13
+ import * as i12 from "../layout/layout.module";
14
+ import * as i13 from "../tooltip/tooltip.module";
14
15
  export declare class SettingsModule {
15
16
  static ɵfac: i0.ɵɵFactoryDef<SettingsModule, never>;
16
- static ɵmod: i0.ɵɵNgModuleDefWithMeta<SettingsModule, [typeof i1.SettingsComponent, typeof i2.SettingsFormDirective, typeof i3.SettingsFooterComponent, typeof i4.SettingsHeaderComponent, typeof i5.SettingsContentComponent, typeof i6.SettingsPageComponent, typeof i7.SettingsNavigationComponent, typeof i8.CommonSettingsComponent], [typeof i9.RouterModule, typeof i10.CommonModule, typeof i11.HeaderModule, typeof i12.TooltipModule], [typeof i1.SettingsComponent, typeof i2.SettingsFormDirective, typeof i3.SettingsFooterComponent, typeof i4.SettingsHeaderComponent, typeof i5.SettingsContentComponent, typeof i6.SettingsPageComponent, typeof i7.SettingsNavigationComponent, typeof i8.CommonSettingsComponent]>;
17
+ static ɵmod: i0.ɵɵNgModuleDefWithMeta<SettingsModule, [typeof i1.SettingsComponent, typeof i2.SettingsFormDirective, typeof i3.SettingsFooterComponent, typeof i4.SettingsHeaderComponent, typeof i5.SettingsContentComponent, typeof i6.SettingsPageComponent, typeof i7.SettingsNavigationComponent, typeof i8.CommonSettingsComponent], [typeof i9.RouterModule, typeof i10.CommonModule, typeof i11.HeaderModule, typeof i12.LayoutModule, typeof i13.TooltipModule], [typeof i1.SettingsComponent, typeof i2.SettingsFormDirective, typeof i3.SettingsFooterComponent, typeof i4.SettingsHeaderComponent, typeof i5.SettingsContentComponent, typeof i6.SettingsPageComponent, typeof i7.SettingsNavigationComponent, typeof i8.CommonSettingsComponent]>;
17
18
  static ɵinj: i0.ɵɵInjectorDef<SettingsModule>;
18
19
  }
@@ -7,3 +7,5 @@ export { WizardStepSnapInOutput } from './wizard-step-snap-in-output';
7
7
  export { WizardStepOptions } from './wizard-step-options';
8
8
  export { WizardStepValidation } from './wizard-step-validation';
9
9
  export { WizardStepChangedEvent } from './wizard-step-changed-event';
10
+ export { WizardNavigationInterface } from './wizard-navigation-interface';
11
+ export { WizardBuilderInterface } from './wizard-builder-interface';
@@ -0,0 +1,8 @@
1
+ import { Type } from '@angular/core';
2
+ export interface WizardBuilderInterface {
3
+ addStepInStage(stepName: string, stepComponentType: Type<any>, stageName: string): void;
4
+ addStepInStageByIndex(stepName: string, stepComponentType: Type<any>, stageName: string, index: number): void;
5
+ addStageByIndex(stageName: string, index: number): void;
6
+ removeStepInStageByIndex(stageName: string, index: number): boolean;
7
+ clearStage(stageName: string): boolean;
8
+ }
@@ -0,0 +1,4 @@
1
+ import { WizardStage } from './wizard-stage';
2
+ export interface WizardNavigationInterface {
3
+ stages: WizardStage[];
4
+ }
@@ -1,8 +1,9 @@
1
1
  import { Type } from '@angular/core';
2
2
  import { Strings } from '../../generated/strings';
3
3
  import { WizardStep } from './models';
4
+ import { WizardBuilderInterface } from './models/wizard-builder-interface';
4
5
  import { WizardStage } from './models/wizard-stage';
5
- export declare class WizardBuilder {
6
+ export declare class WizardBuilder implements WizardBuilderInterface {
6
7
  /**
7
8
  * Resource strings for the component.
8
9
  */
@@ -124,6 +125,40 @@ export declare class WizardBuilder {
124
125
  * @param stageName - The name of the WizardStage in which this new WizardStep should be added.
125
126
  */
126
127
  addStepInStage(stepName: string, stepComponentType: Type<any>, stageName: string): void;
128
+ /**
129
+ * Creates a new WizardStep, and adds it to the specified WizardStage at the specified index.
130
+ * If the specified WizardStage does not exist, it will be created.
131
+ *
132
+ * @param stepName - The name for the new WizardStep.
133
+ * @param stepComponentType - The componentType for the new WizardStep.
134
+ * @param stageName - The name of the WizardStage in which this new WizardStep should be added.
135
+ * @param index - The step index to insert step (will increase index of existing step at given index by 1 if any)
136
+ */
137
+ addStepInStageByIndex(stepName: string, stepComponentType: Type<any>, stageName: string, index: number): void;
138
+ /**
139
+ * Removes WizardStep at specified index in specified stage.
140
+ * If the specified stage or index does not exist, false will be returned.
141
+ *
142
+ * @param stageName - The name of the Wizard stage in which to remove the step.
143
+ * @param index - The step index to be removed (will decrease indices of proceeding steps)
144
+ * @returns - True if step is removed successfully, false otherwise.
145
+ */
146
+ removeStepInStageByIndex(stageName: string, index: number): boolean;
147
+ /**
148
+ * Creates a new WizardStage at the specified index.
149
+ *
150
+ * @param stageName - The Name for the new WizardStage
151
+ * @param index - The stage index to insert stage (will increase index of existing stage at given index by 1 if any)
152
+ */
153
+ addStageByIndex(stageName: string, index: number): void;
154
+ /**
155
+ * Clears all steps from given stage.
156
+ * If the specified stage does not exist, false will be returned.
157
+ *
158
+ * @param stageName - The name of the Wizard stage to clear steps from.
159
+ * @returns - True if stage is cleared successfully, false otherwise.
160
+ */
161
+ clearStage(stageName: string): boolean;
127
162
  /**
128
163
  * Creates a new WizardStep for the Finish view using the component specified.
129
164
  */
@@ -1,14 +1,14 @@
1
+ import { Type } from '@angular/core';
2
+ import { WizardBuilderInterface } from './models/wizard-builder-interface';
3
+ import { WizardNavigationInterface } from './models/wizard-navigation-interface';
1
4
  import { WizardNavigationSet } from './models/wizard-navigation-set';
2
- import { WizardStage } from './models/wizard-stage';
3
- export interface WizardNavigationInterface {
4
- stages: WizardStage[];
5
- }
6
5
  /**
7
6
  * Wizard navigation information class.
8
7
  */
9
8
  export declare class WizardNavigationInformation {
10
9
  static readonly NoStageNoStep = -1;
11
10
  private wizard;
11
+ private wizardBuilder;
12
12
  /**
13
13
  * The history of navigation of stage and step.
14
14
  */
@@ -22,7 +22,7 @@ export declare class WizardNavigationInformation {
22
22
  *
23
23
  * @param wizard the wizard component instance.
24
24
  */
25
- constructor(wizard: WizardNavigationInterface);
25
+ constructor(wizard: WizardNavigationInterface, wizardBuilder: WizardBuilderInterface);
26
26
  /**
27
27
  * Gets the navigation history data.
28
28
  */
@@ -74,4 +74,47 @@ export declare class WizardNavigationInformation {
74
74
  * @param set current set.
75
75
  */
76
76
  checkHistory(set?: WizardNavigationSet): number;
77
+ /**
78
+ * Creates a new WizardStep, and adds it to the specified WizardStage.
79
+ * If the specified WizardStage does not exist, it will be created.
80
+ *
81
+ * @param stepName - The name for the new WizardStep.
82
+ * @param stepComponentType - The componentType for the new WizardStep.
83
+ * @param stageName - The name of the WizardStage in which this new WizardStep should be added.
84
+ */
85
+ addStepInStage(stepName: string, stepComponentType: Type<any>, stageName: string): void;
86
+ /**
87
+ * Creates a new WizardStep, and adds it to the specified WizardStage at the specified index.
88
+ * If the specified WizardStage does not exist, it will be created.
89
+ *
90
+ * @param stepName - The name for the new WizardStep.
91
+ * @param stepComponentType - The componentType for the new WizardStep.
92
+ * @param stageName - The name of the WizardStage in which this new WizardStep should be added.
93
+ * @param index - The step index to insert step (will increase index of existing step at given index by 1 if any)
94
+ */
95
+ addStepInStageByIndex(stepName: string, stepComponentType: Type<any>, stageName: string, index: number): void;
96
+ /**
97
+ * Removes WizardStep at specified index in specified stage.
98
+ * If the specified stage or index does not exist, false will be returned.
99
+ *
100
+ * @param stageName - The name of the Wizard stage in which to remove the step.
101
+ * @param index - The step index to be removed (will decrease indices of proceeding steps)
102
+ * @returns - True if step is removed successfully, false otherwise.
103
+ */
104
+ removeStepInStageByIndex(stageName: string, index: number): boolean;
105
+ /**
106
+ * Creates a new WizardStage at the specified index.
107
+ *
108
+ * @param stageName - The Name for the new WizardStage
109
+ * @param index - The stage index to insert stage (will increase index of existing stage at given index by 1 if any)
110
+ */
111
+ addStageByIndex(stageName: string, index: number): void;
112
+ /**
113
+ * Clears all steps from given stage.
114
+ * If the specified stage does not exist, false will be returned.
115
+ *
116
+ * @param stageName - The name of the Wizard stage to clear steps from.
117
+ * @returns - True if stage is cleared successfully, false otherwise.
118
+ */
119
+ clearStage(stageName: string): boolean;
77
120
  }
@@ -4,12 +4,13 @@ import { AppContextService } from '../../service/app-context.service';
4
4
  import { DynamicComponentBase } from '../common/dynamic.component';
5
5
  import { PageAlert } from '../page-alert-bar/models/page-alert';
6
6
  import { WizardModel } from './models/wizard-model';
7
+ import { WizardNavigationInterface } from './models/wizard-navigation-interface';
7
8
  import { WizardStage } from './models/wizard-stage';
8
9
  import { WizardStep } from './models/wizard-step';
9
10
  import { WizardStepChangedEvent } from './models/wizard-step-changed-event';
10
11
  import { WizardStepValidation } from './models/wizard-step-validation';
11
12
  import { WizardBuilder } from './wizard-builder';
12
- import { WizardNavigationInformation, WizardNavigationInterface } from './wizard-navigation-information';
13
+ import { WizardNavigationInformation } from './wizard-navigation-information';
13
14
  import { GenericWizardStepComponent } from './wizard-step/wizard-step.component';
14
15
  import * as i0 from "@angular/core";
15
16
  /**
@@ -15,6 +15,14 @@ export declare class AzureConstants {
15
15
  * Azure China portal.
16
16
  */
17
17
  static readonly azureChinaPortal = "https://portal.azure.cn";
18
+ /**
19
+ * Azure Resource Manager endpoint - Azure US Govenment/Fairfax/Arlington.
20
+ */
21
+ static readonly azureUSGovArmEndpoint = "https://management.usgovcloudapi.net";
22
+ /**
23
+ * Azure US Government portal.
24
+ */
25
+ static readonly azureUSGovPortal = "https://portal.azure.us";
18
26
  static readonly armApiVersion = "?api-version=2016-06-01";
19
27
  static readonly azureSubscriptionUrl = "{0}/subscriptions?api-version=2016-06-01";
20
28
  static readonly armDeploymentUrl = "{0}/subscriptions/{1}/resourcegroups/{2}/providers/Microsoft.Resources/deployments/{3}?api-version=2018-02-01";
@@ -16,6 +16,14 @@ AzureConstants.azureChinaArmEndpoint = 'https://management.chinacloudapi.cn';
16
16
  * Azure China portal.
17
17
  */
18
18
  AzureConstants.azureChinaPortal = 'https://portal.azure.cn';
19
+ /**
20
+ * Azure Resource Manager endpoint - Azure US Govenment/Fairfax/Arlington.
21
+ */
22
+ AzureConstants.azureUSGovArmEndpoint = 'https://management.usgovcloudapi.net';
23
+ /**
24
+ * Azure US Government portal.
25
+ */
26
+ AzureConstants.azureUSGovPortal = 'https://portal.azure.us';
19
27
  AzureConstants.armApiVersion = '?api-version=2016-06-01';
20
28
  AzureConstants.azureSubscriptionUrl = '{0}/subscriptions?api-version=2016-06-01';
21
29
  AzureConstants.armDeploymentUrl = '{0}/subscriptions/{1}/resourcegroups/{2}/providers/Microsoft.Resources/deployments/{3}?api-version=2018-02-01';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../packages/core/azure/azure-constants.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAc;;AACvB;;GAEG;AACoB,qCAAsB,GAAG,8BAA8B,CAAC;AAE/E;;GAEG;AACoB,gCAAiB,GAAG,0BAA0B,CAAC;AAEtE;;GAEG;AACoB,oCAAqB,GAAG,qCAAqC,CAAC;AAErF;;GAEG;AACoB,+BAAgB,GAAG,yBAAyB,CAAC;AAE7C,4BAAa,GAAG,yBAAyB,CAAC;AAC1C,mCAAoB,GAAG,0CAA0C,CAAC;AAClE,+BAAgB,GACnC,+GAA+G,CAAC;AAC7F,oCAAqB,GACxC,wHAAwH,CAAC;AACtG,iCAAkB,GAAG,wDAAwD,CAAC;AAC9E,mCAAoB,GAAG,6DAA6D,CAAC;AAE5G,mBAAmB;AACI,iCAAkB,GAAG,6DAA6D,CAAC;AACnF,+CAAgC,GACnD,iFAAiF,CAAC;AAC/D,+BAAgB,GAAG,iEAAiE,CAAC;AAE5G,4BAA4B;AACL,+BAAgB,GACnC,+GAA+G,CAAC;A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AO,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 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\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 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;;AACvB;;GAEG;AACoB,qCAAsB,GAAG,8BAA8B,CAAC;AAE/E;;GAEG;AACoB,gCAAiB,GAAG,0BAA0B,CAAC;AAEtE;;GAEG;AACoB,oCAAqB,GAAG,qCAAqC,CAAC;AAErF;;GAEG;AACoB,+BAAgB,GAAG,yBAAyB,CAAC;AAEpE;;GAEG;AACqB,oCAAqB,GAAG,sCAAsC,CAAC;AAEvF;;GAEG;AACoB,+BAAgB,GAAG,yBAAyB,CAAC;AAE7C,4BAAa,GAAG,yBAAyB,CAAC;AAC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B,iBAAiB,CAAC,UAAkB;QAChD,QAAQ,UAAU,EAAE;YAChB,KAAK,yBAAyB,CAAC,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC;YACnE,KAAK,0BAA0B,CAAC,CAAC,OAAO,oBAAoB,CAAC,QAAQ,CAAC;YACtE,KAAK,uBAAuB,CAAC,CAAC,OAAO,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\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 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"]}
@@ -18,6 +18,7 @@ export declare class AzureManager {
18
18
  private azureLogging;
19
19
  private readonly AzureGlobal;
20
20
  private readonly AzureChina;
21
+ private readonly AzureUSGov;
21
22
  /**
22
23
  * Initializes a new instance of the Azure Manager class
23
24
  * @param rpc The rpc to forward auth requests to a parent window
@@ -20,6 +20,7 @@ export class AzureManager {
20
20
  this.http = http;
21
21
  this.AzureGlobal = 'azureglobal';
22
22
  this.AzureChina = 'azurechina';
23
+ this.AzureUSGov = 'azureusgov';
23
24
  this.watcher = new Subject();
24
25
  this.azureLogging = new AzureLogging();
25
26
  }
@@ -493,6 +494,9 @@ export class AzureManager {
493
494
  else if (cloudName === this.AzureChina) {
494
495
  return AzureConstants.azureChinaArmEndpoint;
495
496
  }
497
+ else if (cloudName === this.AzureUSGov) {
498
+ return AzureConstants.azureUSGovArmEndpoint;
499
+ }
496
500
  }
497
501
  /**
498
502
  * Make a GET request using ARM token.
@@ -532,7 +536,9 @@ export class AzureManager {
532
536
  */
533
537
  putRequestWithArmToken(url, body, integrationType) {
534
538
  if (!MsftSme.self().Init.isProduction &&
535
- (url.includes(AzureConstants.azureGlobalArmEndpoint) || url.includes(AzureConstants.azureChinaArmEndpoint)) &&
539
+ (url.includes(AzureConstants.azureGlobalArmEndpoint) ||
540
+ url.includes(AzureConstants.azureChinaArmEndpoint) ||
541
+ url.includes(AzureConstants.azureUSGovArmEndpoint)) &&
536
542
  url.includes(AzureConstants.resourceDeploymentSubstring)) {
537
543
  Logging.logWarning('putRequestWithArmToken', 'Use DeployAzure Template to create resource.');
538
544
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../packages/core/azure/azure-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE7D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CAAC;IAEM,YAAY,CAAC,QAAa;QAC7B,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC/B,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QAE5D,IAAI,QAAQ,IAAI,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE;YACrE,IAAI,oBAAoB,GAAG,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC;YAC5D,oBAAoB,GAAG,oBAAoB,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;YAC/F,IAAI,CAAC,YAAY,CAAC,6BAA6B,CAAC,MAAM,EAAE,oBAAoB,EACxE,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;SAC1C;aAAM;YACH,IAAI,CAAC,YAAY,CAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC;SAC3D;IACL,CAAC;CACJ","file":"azure-manager.js","sourcesContent":["import { from, Observable, Subject, throwError } from 'rxjs';\r\nimport { AjaxRequest, AjaxResponse } from 'rxjs/ajax';\r\nimport { filter, map, mergeMap, take, tap } from 'rxjs/operators';\r\nimport { CoreEnvironment } from '../data/core-environment';\r\nimport { Http } from '../data/http';\r\nimport { LogLevel } from '../diagnostics/log-level';\r\nimport { Logging } from '../diagnostics/logging';\r\nimport { Strings } from '../generated/strings';\r\nimport {\r\n RpcAzureOperation,\r\n RpcAzureOperationResult,\r\n RpcAzureOperationType,\r\n RpcAzureResponseKey\r\n} from '../rpc/azure/rpc-azure-model';\r\nimport { RpcAzureRequestClient } from '../rpc/azure/rpc-azure-request-client';\r\nimport { Rpc } from '../rpc/rpc';\r\nimport { ConnectionProperties } from '../security/connection';\r\nimport { ArmTelemetry, AzureConstants, AzureIntegrationType } from './azure-constants';\r\nimport { AzureLogging } from './azure-logging';\r\nimport { AadAppConfig } from './models/aadAppConfig-data';\r\nimport { DeploymentOperationRequestBody } from './resources/deployment-operation-request-body';\r\nimport { DeploymentOperationResponse } from './resources/deployment-operation-response';\r\nimport { LocationsOperationResult } from './resources/location-data';\r\nimport {\r\n ResourceGroupOperationResult,\r\n ResourceGroupRequestBody,\r\n ResourceGroupsOperationResult\r\n} from './resources/resource-group-data';\r\nimport { SubscriptionsOperationResult } from './resources/subscription-data';\r\n\r\n/**\r\n * Azure Manager class. Handles detecting and configuring Azure on a set of servers.\r\n */\r\nexport class AzureManager {\r\n\r\n private watcher: Subject<RpcAzureOperationResult>;\r\n private azureLogging: AzureLogging;\r\n private readonly AzureGlobal = 'azureglobal';\r\n private readonly AzureChina = 'azurechina';\r\n\r\n /**\r\n * Initializes a new instance of the Azure Manager class\r\n * @param rpc The rpc to forward auth requests to a parent window\r\n */\r\n constructor(private rpc: Rpc, private http: Http) {\r\n this.watcher = new Subject<RpcAzureOperationResult>();\r\n this.azureLogging = new AzureLogging();\r\n }\r\n\r\n /**\r\n * Initialize the azure manager\r\n */\r\n public initialize() {\r\n // When in Shell (the top window) do not register. Only extension register.\r\n if (MsftSme.isExtension()) {\r\n this.rpc.register(RpcAzureResponseKey.command, this.onRpcResponse.bind(this));\r\n }\r\n }\r\n\r\n /**\r\n * Get application from gateway\r\n */\r\n public getAppInfo(): Observable<any> {\r\n return this.sendRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.GetAadStatus\r\n });\r\n }\r\n\r\n /**\r\n * Open the register Aad dialog\r\n */\r\n public openRegisterAadDialog(): Observable<any> {\r\n return this.sendRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.OpenAzureDialog\r\n });\r\n }\r\n\r\n /**\r\n * Signs in user.\r\n */\r\n public signIn(): Observable<any> {\r\n return this.sendTokenRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.SignIn\r\n });\r\n }\r\n\r\n /**\r\n * Signs out user.\r\n */\r\n public signOut(): Observable<any> {\r\n return this.sendRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.SignOut\r\n });\r\n }\r\n\r\n /**\r\n * Switches user accounts.\r\n */\r\n public switchAccounts(): Observable<any> {\r\n throw new Error('To be implemented');\r\n }\r\n\r\n /**\r\n * Get user token from azure\r\n */\r\n public getToken(): Observable<any> {\r\n return this.sendTokenRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.GetAadToken\r\n });\r\n }\r\n\r\n /**\r\n * Get the Azure AD graph token from azure\r\n */\r\n public getGraphToken(): Observable<any> {\r\n return this.sendTokenRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.GetAadGraphToken\r\n });\r\n }\r\n\r\n /**\r\n * Get the Microsoft graph token from azure\r\n * @param scopes The set of permissions for which the token has to be requested.\r\n * https://docs.microsoft.com/en-us/graph/permissions-reference\r\n * A null value will request default scopes - openid and profile.\r\n */\r\n public getMicrosoftGraphToken(scopes: string[] = null): Observable<any> {\r\n return this.sendTokenRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.GetMicrosoftGraphToken,\r\n tokenScopes: scopes\r\n });\r\n }\r\n\r\n /**\r\n * Checks to see if user is signed in. Returns true if signed in, else false.\r\n */\r\n public checkUserSignedIn(): Observable<boolean> {\r\n return this.sendTokenRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.CheckUserSignedIn\r\n }).pipe(map(result => {\r\n const isSignedIn = result && result.appInfo && result.appInfo.token;\r\n return !!isSignedIn;\r\n }));\r\n }\r\n\r\n /**\r\n * Get Azure subscriptions.\r\n * @param integrationType 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.\r\n */\r\n public getSubscriptions(integrationType?: AzureIntegrationType): Observable<SubscriptionsOperationResult> {\r\n let armEndpoint = null;\r\n const url = AzureConstants.azureSubscriptionUrl;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n return this.getRequestWithArmToken(url.format(armEndpoint), integrationType);\r\n }),\r\n map(result => {\r\n const response: SubscriptionsOperationResult = {\r\n httpStatusCode: result.status,\r\n value: result.response\r\n };\r\n return response;\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Check whether a resource group exists or not.\r\n * @param subscriptionId The subscription id.\r\n * @param resourceGroupName The resource group name.\r\n * @param integrationType 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.\r\n */\r\n public checkResourceGroupExists(\r\n subscriptionId: string,\r\n resourceGroupName: string,\r\n integrationType?: AzureIntegrationType): Observable<{ status: number }> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n return this.getArmToken();\r\n }),\r\n mergeMap(token => {\r\n const url = AzureConstants.resourceGroupUrl.format(armEndpoint, subscriptionId, resourceGroupName);\r\n const ajaxRequest = this.createRequestWithHeaders(token, { integrationType: integrationType });\r\n return this.http.head(url, ajaxRequest);\r\n }),\r\n map(result => {\r\n return { status: result.status };\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Create or update (if it exists) resource group.\r\n * @param subscriptionId The subscription id.\r\n * @param resourceGroupName The resource group name.\r\n * @param body request body. Optional. See definition of ResourceGroupRequestBody for what fields can be inside this body.\r\n * If this is not provided, a default of { \\'location\\': \\'West US\\' } will be used.\r\n * @param integrationType 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.\r\n */\r\n public createResourceGroup(\r\n subscriptionId: string,\r\n resourceGroupName: string,\r\n body?: ResourceGroupRequestBody,\r\n integrationType?: AzureIntegrationType): Observable<ResourceGroupOperationResult> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n const url = AzureConstants.resourceGroupUrl.format(armEndpoint, subscriptionId, resourceGroupName);\r\n if (!body) {\r\n body = <ResourceGroupRequestBody>{ location: 'West US' };\r\n }\r\n return this.putRequestWithArmToken(url, body, integrationType);\r\n }),\r\n map(result => {\r\n const response: ResourceGroupOperationResult = {\r\n httpStatusCode: result.status,\r\n value: result.response\r\n };\r\n return response;\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * List all resource groups in a subscription.\r\n * @param subscriptionId The subscription id.\r\n * @param integrationType 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.\r\n */\r\n public getResourceGroups(subscriptionId: string, integrationType?: AzureIntegrationType): Observable<ResourceGroupsOperationResult> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n const url = AzureConstants.listResourceGroups.format(armEndpoint, subscriptionId);\r\n return this.getRequestWithArmToken(url, integrationType);\r\n }),\r\n map(result => {\r\n const response: ResourceGroupsOperationResult = {\r\n httpStatusCode: result.status,\r\n value: result.response\r\n };\r\n return response;\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Delete resource group.\r\n * @param subscriptionId The subscription id.\r\n * @param resourceGroupName The resource group name.\r\n * @param integrationType 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.\r\n */\r\n public deleteResourceGroup(\r\n subscriptionId: string,\r\n resourceGroupName: string,\r\n integrationType?: AzureIntegrationType): Observable<{ status: number }> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n const url = AzureConstants.resourceGroupUrl.format(armEndpoint, subscriptionId, resourceGroupName);\r\n return this.deleteRequestWithArmToken(url, integrationType);\r\n }),\r\n map(result => {\r\n // result.status will either be 200 or 202.\r\n return { status: result.status };\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Get all available geo-locations.\r\n * @param subscriptionId The subscription id.\r\n * @param integrationType 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.\r\n */\r\n public getAllAzureLocations(subscriptionId: string, integrationType?: AzureIntegrationType): Observable<LocationsOperationResult> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n const url = AzureConstants.getAllGeoLocations.format(armEndpoint, subscriptionId);\r\n return this.getRequestWithArmToken(url, integrationType);\r\n }),\r\n map(result => {\r\n const response: LocationsOperationResult = {\r\n httpStatusCode: result.status,\r\n value: result.response\r\n };\r\n return response;\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Deploy resources with Resource Manager templates and Resource Manager REST API.\r\n * @param subscriptionId The subscription id.\r\n * @param resourceGroupName The resource group name.\r\n * @param deploymentName The deployment name.\r\n * @param resourceTemplate The resource template content.\r\n * @param templateParameters The resource template parameters.\r\n * @param deploymentMode The mode that is used to deploy resources.This value can be either Incremental or Complete.\r\n * In Incremental mode, resources are deployed without deleting existing resources that are not included in the template.\r\n In Complete mode, resources are deployed and existing resources in the resource group that are not included in the\r\n template are deleted.\r\n * @param integrationType 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.\r\n */\r\n public DeployAzureTemplate(\r\n subscriptionId: string,\r\n resourceGroupName: string,\r\n deploymentName: string,\r\n resourceTemplate: string,\r\n templateParameters: string,\r\n deploymentMode: string = 'Incremental',\r\n integrationType?: AzureIntegrationType): Observable<DeploymentOperationResponse> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n const url = AzureConstants.ArmDeploymentUrl.format(armEndpoint, subscriptionId, resourceGroupName, deploymentName);\r\n const body: DeploymentOperationRequestBody = {\r\n properties: {\r\n template: JSON.parse(resourceTemplate),\r\n parameters: JSON.parse(templateParameters),\r\n mode: deploymentMode\r\n }\r\n };\r\n\r\n return this.putRequestWithArmToken(url, body, integrationType);\r\n }),\r\n tap(result => this.logTelemetry(result)),\r\n map(result => this.createDeploymentOperationResponse(result))\r\n );\r\n }\r\n\r\n /**\r\n * Validate resources with Resource Manager templates and Resource Manager REST API.\r\n * @param subscriptionId The subscription id.\r\n * @param resourceGroupName The resource group name.\r\n * @param deploymentName The deployment name.\r\n * @param resourceTemplate The resource template content.\r\n * @param templateParameters The resource template parameters.\r\n * @param deploymentMode The mode that is used to deploy resources.This value can be either Incremental or Complete.\r\n * In Incremental mode, resources are deployed without deleting existing resources that are not included in the template.\r\n In Complete mode, resources are deployed and existing resources in the resource group that are not included in the\r\n template are deleted.\r\n * @param integrationType 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.\r\n */\r\n public validateAzureTemplate(\r\n subscriptionId: string,\r\n resourceGroupName: string,\r\n deploymentName: string,\r\n resourceTemplate: string,\r\n templateParameters: string,\r\n deploymentMode: string = 'Incremental',\r\n integrationType?: AzureIntegrationType\r\n ): Observable<DeploymentOperationResponse> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n const url = AzureConstants.validateAzureTemplate.format(armEndpoint, subscriptionId, resourceGroupName, deploymentName);\r\n const body: DeploymentOperationRequestBody = {\r\n properties: {\r\n template: JSON.parse(resourceTemplate),\r\n parameters: JSON.parse(templateParameters),\r\n mode: deploymentMode\r\n }\r\n };\r\n\r\n return this.postRequestWithArmToken(url, body, integrationType);\r\n }),\r\n map(result => this.createDeploymentOperationResponse(result))\r\n );\r\n }\r\n\r\n /**\r\n * Creates azure request with headers\r\n * @param token bearer token for ARM request\r\n * @param options additional information that can be send in the headers of the request.\r\n * - additionalHeaders any headers besides 'Authorization'\r\n * - 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.\r\n * 'x-ms-client-request-id', 'x-ms-return-client-request-id', and 'Accept-Language'.\r\n * @return formatted AjaxRequest for an ARM call\r\n */\r\n public createRequestWithHeaders(\r\n token: string,\r\n options?: {\r\n additionalHeaders?: any,\r\n integrationType?: AzureIntegrationType,\r\n connectionProperties?: ConnectionProperties\r\n }): AjaxRequest {\r\n const ajaxRequest: AjaxRequest = { headers: {} };\r\n\r\n ajaxRequest.headers = (options && options.additionalHeaders) || {};\r\n ajaxRequest.headers[AzureConstants.authorizationHeaderKey] = AzureConstants.bearer + token;\r\n\r\n const integrationType = (options && options.integrationType) || ArmTelemetry.toIntegrationType(MsftSme.self().Init.moduleName);\r\n\r\n // TODO: Remove work around. Only intended for the quality release for Jan 2020.\r\n const connectionProperties = options && options.connectionProperties;\r\n ajaxRequest.headers[AzureConstants.clientRequestHeaderKey] =\r\n this.formatClientRequestId(\r\n integrationType,\r\n this.hexEncodeTelemetryData(connectionProperties));\r\n\r\n ajaxRequest.headers[AzureConstants.returnClientRequestHeaderKey] = 'True';\r\n ajaxRequest.headers[AzureConstants.acceptLanguageHeaderKey] = CoreEnvironment.localizationManager.getLocaleId().neutral;\r\n return ajaxRequest;\r\n }\r\n\r\n /**\r\n * Gets the arm token.\r\n */\r\n public getArmToken(): Observable<string> {\r\n return this.sendTokenRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.GetAadToken\r\n })\r\n .pipe(\r\n map(result => {\r\n return result && result.appInfo && result.appInfo.token;\r\n }));\r\n }\r\n\r\n // TODO: Remove work around. Only intended for the quality release for Jan 2020.\r\n /**\r\n * Parses connection properties for ARM telemetry data and encode in hex\r\n * @param connectionProperties properties on the current active connection\r\n * @return hex encoded json object.\r\n */\r\n public hexEncodeTelemetryData(connectionProperties?: ConnectionProperties): string {\r\n if (connectionProperties\r\n && connectionProperties['operatingSystem']\r\n && connectionProperties['version']\r\n && connectionProperties['computerModel']\r\n && connectionProperties['computerManufacturer']\r\n && connectionProperties['isS2dEnabled'] != null) {\r\n const telemetryData = {\r\n operatingSystem: connectionProperties['operatingSystem'],\r\n version: connectionProperties['version'],\r\n computerManufacturer: connectionProperties['computerManufacturer'],\r\n computerModel: connectionProperties['computerModel'],\r\n isS2dEnabled: connectionProperties['isS2dEnabled']\r\n };\r\n const stringifiedData = JSON.stringify(telemetryData);\r\n try {\r\n return MsftSme.toHex(stringifiedData);\r\n } catch {\r\n return null;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n // TODO: Remove work around. Only intended for the quality release for Jan 2020.\r\n private formatClientRequestId(integrationType: string, encodedData?: string): string {\r\n let clientRequestId = AzureConstants.clientRequestIdQualifier.format(MsftSme.newGuid());\r\n\r\n if (integrationType) {\r\n clientRequestId += AzureConstants.integrationTypeDataParameter.format(integrationType);\r\n }\r\n\r\n if (encodedData != null) {\r\n if (encodedData.length < AzureConstants.maxEncodedTelemetryDataLength) {\r\n clientRequestId += AzureConstants.telemetryDataParameter.format(encodedData);\r\n } else {\r\n clientRequestId += AzureConstants.telemetryDataParameter.format(AzureConstants.telemetryDataInvalidValue);\r\n }\r\n }\r\n\r\n // Ordering of parameters is important for parsing in telemetry pipeline.\r\n clientRequestId += AzureConstants.sourceParameter;\r\n\r\n return clientRequestId;\r\n }\r\n\r\n /**\r\n * Send request to RPC\r\n * @param request RpcAzureOperation\r\n */\r\n private sendRequest(request: RpcAzureOperation): Observable<any> {\r\n Logging.log({\r\n level: LogLevel.Debug,\r\n message: 'Sending request to AzureManagerShellService. Request:{0}'.format(JSON.stringify(request)),\r\n source: 'AzureManager'\r\n });\r\n\r\n return from(RpcAzureRequestClient.azureRequest(this.rpc, request))\r\n .pipe(\r\n mergeMap(() => this.watcher),\r\n filter((result) => result.requestId === request.requestId),\r\n take(1),\r\n map((result) => result));\r\n }\r\n\r\n /**\r\n * Send token request to RPC\r\n * @param request RpcAzureOperation\r\n */\r\n private sendTokenRequest(request: RpcAzureOperation): Observable<any> {\r\n Logging.log({\r\n level: LogLevel.Debug,\r\n message: 'Sending request to AzureManagerShellService. Request:{0}'.format(JSON.stringify(request)),\r\n source: 'AzureManager'\r\n });\r\n\r\n return from(RpcAzureRequestClient.azureRequest(this.rpc, request))\r\n .pipe(\r\n mergeMap(() => this.watcher),\r\n filter((result) => result.requestId === request.requestId),\r\n take(1),\r\n map((result) => {\r\n if (result.appInfo) {\r\n return result;\r\n } else if (result.error) {\r\n throw new Error(result.error);\r\n }\r\n\r\n throw new Error(MsftSme.getStrings<Strings>().MsftSmeShell.Core.Rpc.Azure.Unexpected.Error.message);\r\n }));\r\n }\r\n\r\n /**\r\n * Handles Rpc response.\r\n */\r\n private onRpcResponse(data: RpcAzureOperationResult): Promise<any> {\r\n this.watcher.next(data);\r\n return Promise.resolve();\r\n }\r\n\r\n /**\r\n * Determine cloud specific ARM endpoint based on the cloud that gateway is registered to.\r\n * @param cloudName cloudName from gateway's app registration.\r\n * @returns Returns cloud specific ARM endpoint.\r\n */\r\n private getArmEndpoint(cloudNameParam: string): string {\r\n const cloudName = MsftSme.replaceAll(cloudNameParam, ' ', '').toLowerCase();\r\n\r\n if (cloudName === this.AzureGlobal) {\r\n return AzureConstants.azureGlobalArmEndpoint;\r\n } else if (cloudName === this.AzureChina) {\r\n return AzureConstants.azureChinaArmEndpoint;\r\n }\r\n }\r\n\r\n /**\r\n * Make a GET request using ARM token.\r\n * @param url endpoint for request\r\n * @param integrationType 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.\r\n */\r\n public getRequestWithArmToken(url: string, integrationType?: AzureIntegrationType): Observable<AjaxResponse> {\r\n return this.getArmToken().pipe(\r\n mergeMap(token => {\r\n const ajaxRequest = this.createRequestWithHeaders(token, { integrationType: integrationType });\r\n return this.http.get(url, ajaxRequest);\r\n }));\r\n }\r\n\r\n /**\r\n * Make a POST request using ARM token.\r\n * @param url endpoint for request\r\n * @param integrationType 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.\r\n */\r\n public postRequestWithArmToken(url: string, body: any, integrationType?: AzureIntegrationType): Observable<AjaxResponse> {\r\n return this.getArmToken().pipe(\r\n mergeMap(token => {\r\n const ajaxRequest = this.createRequestWithHeaders(token, { integrationType: integrationType });\r\n return this.http.post(url, body, ajaxRequest);\r\n }));\r\n }\r\n\r\n /**\r\n * Make a PUT request using ARM token.\r\n * @param url endpoint for request\r\n * @param integrationType 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.\r\n */\r\n public putRequestWithArmToken(url: string, body: any, integrationType?: AzureIntegrationType): Observable<AjaxResponse> {\r\n if (!MsftSme.self().Init.isProduction &&\r\n (url.includes(AzureConstants.azureGlobalArmEndpoint) || url.includes(AzureConstants.azureChinaArmEndpoint)) &&\r\n url.includes(AzureConstants.resourceDeploymentSubstring)) {\r\n Logging.logWarning('putRequestWithArmToken', 'Use DeployAzure Template to create resource.');\r\n }\r\n\r\n return this.getArmToken().pipe(\r\n mergeMap(token => {\r\n const ajaxRequest = this.createRequestWithHeaders(token, { integrationType: integrationType });\r\n return this.http.put(url, body, ajaxRequest);\r\n }));\r\n }\r\n\r\n /**\r\n * Make a DELETE request using ARM token.\r\n * @param url endpoint for request\r\n * @param integrationType 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.\r\n */\r\n public deleteRequestWithArmToken(url: string, integrationType?: AzureIntegrationType): Observable<AjaxResponse> {\r\n return this.getArmToken().pipe(\r\n mergeMap(token => {\r\n const ajaxRequest = this.createRequestWithHeaders(token, { integrationType: integrationType });\r\n return this.http.delete(url, ajaxRequest);\r\n }));\r\n }\r\n\r\n public createDeploymentOperationResponse(result: AjaxResponse): DeploymentOperationResponse {\r\n const headers = result.xhr.getAllResponseHeaders();\r\n const headerArray = headers && headers.trim().split(/[\\r\\n]+/);\r\n const headerMap: Map<string, string> = new Map<string, string>();\r\n headerArray.forEach(x => {\r\n const parts = x.split(': ');\r\n const header = parts && parts.shift();\r\n const value = parts && parts.join(': ');\r\n headerMap.set(header, value);\r\n });\r\n\r\n const response: DeploymentOperationResponse = {\r\n httpStatusCode: result.status ? result.status : null,\r\n responseHeaders: headerMap ? headerMap : null,\r\n response: result.response ? result.response : null\r\n };\r\n\r\n return response;\r\n }\r\n\r\n public logTelemetry(response: any): void {\r\n const status = response.status;\r\n response = response.response ? response.response : response;\r\n\r\n if (response && response.properties && response.properties.dependencies) {\r\n let dependentResourceIds = response.properties.dependencies;\r\n dependentResourceIds = dependentResourceIds.map(dependentResourceId => dependentResourceId.id);\r\n this.azureLogging.submitCreateResourceTelemetry(status, dependentResourceIds,\r\n response.properties.correlationId);\r\n } else {\r\n this.azureLogging.submitCreateResourceTelemetry(status);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"sources":["../../../packages/core/azure/azure-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO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AC,QAAQ,CAAC,CAAC,CAAC,IAAI;SACrD,CAAC;QAEF,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEM,YAAY,CAAC,QAAa;QAC7B,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC/B,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QAE5D,IAAI,QAAQ,IAAI,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE;YACrE,IAAI,oBAAoB,GAAG,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC;YAC5D,oBAAoB,GAAG,oBAAoB,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;YAC/F,IAAI,CAAC,YAAY,CAAC,6BAA6B,CAAC,MAAM,EAAE,oBAAoB,EACxE,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;SAC1C;aAAM;YACH,IAAI,CAAC,YAAY,CAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC;SAC3D;IACL,CAAC;CACJ","file":"azure-manager.js","sourcesContent":["import { from, Observable, Subject, throwError } from 'rxjs';\r\nimport { AjaxRequest, AjaxResponse } from 'rxjs/ajax';\r\nimport { filter, map, mergeMap, take, tap } from 'rxjs/operators';\r\nimport { CoreEnvironment } from '../data/core-environment';\r\nimport { Http } from '../data/http';\r\nimport { LogLevel } from '../diagnostics/log-level';\r\nimport { Logging } from '../diagnostics/logging';\r\nimport { Strings } from '../generated/strings';\r\nimport {\r\n RpcAzureOperation,\r\n RpcAzureOperationResult,\r\n RpcAzureOperationType,\r\n RpcAzureResponseKey\r\n} from '../rpc/azure/rpc-azure-model';\r\nimport { RpcAzureRequestClient } from '../rpc/azure/rpc-azure-request-client';\r\nimport { Rpc } from '../rpc/rpc';\r\nimport { ConnectionProperties } from '../security/connection';\r\nimport { ArmTelemetry, AzureConstants, AzureIntegrationType } from './azure-constants';\r\nimport { AzureLogging } from './azure-logging';\r\nimport { AadAppConfig } from './models/aadAppConfig-data';\r\nimport { DeploymentOperationRequestBody } from './resources/deployment-operation-request-body';\r\nimport { DeploymentOperationResponse } from './resources/deployment-operation-response';\r\nimport { LocationsOperationResult } from './resources/location-data';\r\nimport {\r\n ResourceGroupOperationResult,\r\n ResourceGroupRequestBody,\r\n ResourceGroupsOperationResult\r\n} from './resources/resource-group-data';\r\nimport { SubscriptionsOperationResult } from './resources/subscription-data';\r\n\r\n/**\r\n * Azure Manager class. Handles detecting and configuring Azure on a set of servers.\r\n */\r\nexport class AzureManager {\r\n\r\n private watcher: Subject<RpcAzureOperationResult>;\r\n private azureLogging: AzureLogging;\r\n private readonly AzureGlobal = 'azureglobal';\r\n private readonly AzureChina = 'azurechina';\r\n private readonly AzureUSGov = 'azureusgov';\r\n\r\n /**\r\n * Initializes a new instance of the Azure Manager class\r\n * @param rpc The rpc to forward auth requests to a parent window\r\n */\r\n constructor(private rpc: Rpc, private http: Http) {\r\n this.watcher = new Subject<RpcAzureOperationResult>();\r\n this.azureLogging = new AzureLogging();\r\n }\r\n\r\n /**\r\n * Initialize the azure manager\r\n */\r\n public initialize() {\r\n // When in Shell (the top window) do not register. Only extension register.\r\n if (MsftSme.isExtension()) {\r\n this.rpc.register(RpcAzureResponseKey.command, this.onRpcResponse.bind(this));\r\n }\r\n }\r\n\r\n /**\r\n * Get application from gateway\r\n */\r\n public getAppInfo(): Observable<any> {\r\n return this.sendRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.GetAadStatus\r\n });\r\n }\r\n\r\n /**\r\n * Open the register Aad dialog\r\n */\r\n public openRegisterAadDialog(): Observable<any> {\r\n return this.sendRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.OpenAzureDialog\r\n });\r\n }\r\n\r\n /**\r\n * Signs in user.\r\n */\r\n public signIn(): Observable<any> {\r\n return this.sendTokenRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.SignIn\r\n });\r\n }\r\n\r\n /**\r\n * Signs out user.\r\n */\r\n public signOut(): Observable<any> {\r\n return this.sendRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.SignOut\r\n });\r\n }\r\n\r\n /**\r\n * Switches user accounts.\r\n */\r\n public switchAccounts(): Observable<any> {\r\n throw new Error('To be implemented');\r\n }\r\n\r\n /**\r\n * Get user token from azure\r\n */\r\n public getToken(): Observable<any> {\r\n return this.sendTokenRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.GetAadToken\r\n });\r\n }\r\n\r\n /**\r\n * Get the Azure AD graph token from azure\r\n */\r\n public getGraphToken(): Observable<any> {\r\n return this.sendTokenRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.GetAadGraphToken\r\n });\r\n }\r\n\r\n /**\r\n * Get the Microsoft graph token from azure\r\n * @param scopes The set of permissions for which the token has to be requested.\r\n * https://docs.microsoft.com/en-us/graph/permissions-reference\r\n * A null value will request default scopes - openid and profile.\r\n */\r\n public getMicrosoftGraphToken(scopes: string[] = null): Observable<any> {\r\n return this.sendTokenRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.GetMicrosoftGraphToken,\r\n tokenScopes: scopes\r\n });\r\n }\r\n\r\n /**\r\n * Checks to see if user is signed in. Returns true if signed in, else false.\r\n */\r\n public checkUserSignedIn(): Observable<boolean> {\r\n return this.sendTokenRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.CheckUserSignedIn\r\n }).pipe(map(result => {\r\n const isSignedIn = result && result.appInfo && result.appInfo.token;\r\n return !!isSignedIn;\r\n }));\r\n }\r\n\r\n /**\r\n * Get Azure subscriptions.\r\n * @param integrationType 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.\r\n */\r\n public getSubscriptions(integrationType?: AzureIntegrationType): Observable<SubscriptionsOperationResult> {\r\n let armEndpoint = null;\r\n const url = AzureConstants.azureSubscriptionUrl;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n return this.getRequestWithArmToken(url.format(armEndpoint), integrationType);\r\n }),\r\n map(result => {\r\n const response: SubscriptionsOperationResult = {\r\n httpStatusCode: result.status,\r\n value: result.response\r\n };\r\n return response;\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Check whether a resource group exists or not.\r\n * @param subscriptionId The subscription id.\r\n * @param resourceGroupName The resource group name.\r\n * @param integrationType 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.\r\n */\r\n public checkResourceGroupExists(\r\n subscriptionId: string,\r\n resourceGroupName: string,\r\n integrationType?: AzureIntegrationType): Observable<{ status: number }> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n return this.getArmToken();\r\n }),\r\n mergeMap(token => {\r\n const url = AzureConstants.resourceGroupUrl.format(armEndpoint, subscriptionId, resourceGroupName);\r\n const ajaxRequest = this.createRequestWithHeaders(token, { integrationType: integrationType });\r\n return this.http.head(url, ajaxRequest);\r\n }),\r\n map(result => {\r\n return { status: result.status };\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Create or update (if it exists) resource group.\r\n * @param subscriptionId The subscription id.\r\n * @param resourceGroupName The resource group name.\r\n * @param body request body. Optional. See definition of ResourceGroupRequestBody for what fields can be inside this body.\r\n * If this is not provided, a default of { \\'location\\': \\'West US\\' } will be used.\r\n * @param integrationType 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.\r\n */\r\n public createResourceGroup(\r\n subscriptionId: string,\r\n resourceGroupName: string,\r\n body?: ResourceGroupRequestBody,\r\n integrationType?: AzureIntegrationType): Observable<ResourceGroupOperationResult> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n const url = AzureConstants.resourceGroupUrl.format(armEndpoint, subscriptionId, resourceGroupName);\r\n if (!body) {\r\n body = <ResourceGroupRequestBody>{ location: 'West US' };\r\n }\r\n return this.putRequestWithArmToken(url, body, integrationType);\r\n }),\r\n map(result => {\r\n const response: ResourceGroupOperationResult = {\r\n httpStatusCode: result.status,\r\n value: result.response\r\n };\r\n return response;\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * List all resource groups in a subscription.\r\n * @param subscriptionId The subscription id.\r\n * @param integrationType 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.\r\n */\r\n public getResourceGroups(subscriptionId: string, integrationType?: AzureIntegrationType): Observable<ResourceGroupsOperationResult> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n const url = AzureConstants.listResourceGroups.format(armEndpoint, subscriptionId);\r\n return this.getRequestWithArmToken(url, integrationType);\r\n }),\r\n map(result => {\r\n const response: ResourceGroupsOperationResult = {\r\n httpStatusCode: result.status,\r\n value: result.response\r\n };\r\n return response;\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Delete resource group.\r\n * @param subscriptionId The subscription id.\r\n * @param resourceGroupName The resource group name.\r\n * @param integrationType 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.\r\n */\r\n public deleteResourceGroup(\r\n subscriptionId: string,\r\n resourceGroupName: string,\r\n integrationType?: AzureIntegrationType): Observable<{ status: number }> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n const url = AzureConstants.resourceGroupUrl.format(armEndpoint, subscriptionId, resourceGroupName);\r\n return this.deleteRequestWithArmToken(url, integrationType);\r\n }),\r\n map(result => {\r\n // result.status will either be 200 or 202.\r\n return { status: result.status };\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Get all available geo-locations.\r\n * @param subscriptionId The subscription id.\r\n * @param integrationType 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.\r\n */\r\n public getAllAzureLocations(subscriptionId: string, integrationType?: AzureIntegrationType): Observable<LocationsOperationResult> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n const url = AzureConstants.getAllGeoLocations.format(armEndpoint, subscriptionId);\r\n return this.getRequestWithArmToken(url, integrationType);\r\n }),\r\n map(result => {\r\n const response: LocationsOperationResult = {\r\n httpStatusCode: result.status,\r\n value: result.response\r\n };\r\n return response;\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Deploy resources with Resource Manager templates and Resource Manager REST API.\r\n * @param subscriptionId The subscription id.\r\n * @param resourceGroupName The resource group name.\r\n * @param deploymentName The deployment name.\r\n * @param resourceTemplate The resource template content.\r\n * @param templateParameters The resource template parameters.\r\n * @param deploymentMode The mode that is used to deploy resources.This value can be either Incremental or Complete.\r\n * In Incremental mode, resources are deployed without deleting existing resources that are not included in the template.\r\n In Complete mode, resources are deployed and existing resources in the resource group that are not included in the\r\n template are deleted.\r\n * @param integrationType 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.\r\n */\r\n public DeployAzureTemplate(\r\n subscriptionId: string,\r\n resourceGroupName: string,\r\n deploymentName: string,\r\n resourceTemplate: string,\r\n templateParameters: string,\r\n deploymentMode: string = 'Incremental',\r\n integrationType?: AzureIntegrationType): Observable<DeploymentOperationResponse> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n const url = AzureConstants.ArmDeploymentUrl.format(armEndpoint, subscriptionId, resourceGroupName, deploymentName);\r\n const body: DeploymentOperationRequestBody = {\r\n properties: {\r\n template: JSON.parse(resourceTemplate),\r\n parameters: JSON.parse(templateParameters),\r\n mode: deploymentMode\r\n }\r\n };\r\n\r\n return this.putRequestWithArmToken(url, body, integrationType);\r\n }),\r\n tap(result => this.logTelemetry(result)),\r\n map(result => this.createDeploymentOperationResponse(result))\r\n );\r\n }\r\n\r\n /**\r\n * Validate resources with Resource Manager templates and Resource Manager REST API.\r\n * @param subscriptionId The subscription id.\r\n * @param resourceGroupName The resource group name.\r\n * @param deploymentName The deployment name.\r\n * @param resourceTemplate The resource template content.\r\n * @param templateParameters The resource template parameters.\r\n * @param deploymentMode The mode that is used to deploy resources.This value can be either Incremental or Complete.\r\n * In Incremental mode, resources are deployed without deleting existing resources that are not included in the template.\r\n In Complete mode, resources are deployed and existing resources in the resource group that are not included in the\r\n template are deleted.\r\n * @param integrationType 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.\r\n */\r\n public validateAzureTemplate(\r\n subscriptionId: string,\r\n resourceGroupName: string,\r\n deploymentName: string,\r\n resourceTemplate: string,\r\n templateParameters: string,\r\n deploymentMode: string = 'Incremental',\r\n integrationType?: AzureIntegrationType\r\n ): Observable<DeploymentOperationResponse> {\r\n let armEndpoint = null;\r\n return this.getAppInfo().pipe(\r\n mergeMap(({ appInfo }: { appInfo: AadAppConfig }) => {\r\n if (appInfo) {\r\n armEndpoint = this.getArmEndpoint(appInfo.cloudName);\r\n } else {\r\n return throwError(new Error('Gateway is not registered to Azure.'));\r\n }\r\n\r\n const url = AzureConstants.validateAzureTemplate.format(armEndpoint, subscriptionId, resourceGroupName, deploymentName);\r\n const body: DeploymentOperationRequestBody = {\r\n properties: {\r\n template: JSON.parse(resourceTemplate),\r\n parameters: JSON.parse(templateParameters),\r\n mode: deploymentMode\r\n }\r\n };\r\n\r\n return this.postRequestWithArmToken(url, body, integrationType);\r\n }),\r\n map(result => this.createDeploymentOperationResponse(result))\r\n );\r\n }\r\n\r\n /**\r\n * Creates azure request with headers\r\n * @param token bearer token for ARM request\r\n * @param options additional information that can be send in the headers of the request.\r\n * - additionalHeaders any headers besides 'Authorization'\r\n * - 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.\r\n * 'x-ms-client-request-id', 'x-ms-return-client-request-id', and 'Accept-Language'.\r\n * @return formatted AjaxRequest for an ARM call\r\n */\r\n public createRequestWithHeaders(\r\n token: string,\r\n options?: {\r\n additionalHeaders?: any,\r\n integrationType?: AzureIntegrationType,\r\n connectionProperties?: ConnectionProperties\r\n }): AjaxRequest {\r\n const ajaxRequest: AjaxRequest = { headers: {} };\r\n\r\n ajaxRequest.headers = (options && options.additionalHeaders) || {};\r\n ajaxRequest.headers[AzureConstants.authorizationHeaderKey] = AzureConstants.bearer + token;\r\n\r\n const integrationType = (options && options.integrationType) || ArmTelemetry.toIntegrationType(MsftSme.self().Init.moduleName);\r\n\r\n // TODO: Remove work around. Only intended for the quality release for Jan 2020.\r\n const connectionProperties = options && options.connectionProperties;\r\n ajaxRequest.headers[AzureConstants.clientRequestHeaderKey] =\r\n this.formatClientRequestId(\r\n integrationType,\r\n this.hexEncodeTelemetryData(connectionProperties));\r\n\r\n ajaxRequest.headers[AzureConstants.returnClientRequestHeaderKey] = 'True';\r\n ajaxRequest.headers[AzureConstants.acceptLanguageHeaderKey] = CoreEnvironment.localizationManager.getLocaleId().neutral;\r\n return ajaxRequest;\r\n }\r\n\r\n /**\r\n * Gets the arm token.\r\n */\r\n public getArmToken(): Observable<string> {\r\n return this.sendTokenRequest({\r\n requestId: MsftSme.newGuid(),\r\n operation: RpcAzureOperationType.GetAadToken\r\n })\r\n .pipe(\r\n map(result => {\r\n return result && result.appInfo && result.appInfo.token;\r\n }));\r\n }\r\n\r\n // TODO: Remove work around. Only intended for the quality release for Jan 2020.\r\n /**\r\n * Parses connection properties for ARM telemetry data and encode in hex\r\n * @param connectionProperties properties on the current active connection\r\n * @return hex encoded json object.\r\n */\r\n public hexEncodeTelemetryData(connectionProperties?: ConnectionProperties): string {\r\n if (connectionProperties\r\n && connectionProperties['operatingSystem']\r\n && connectionProperties['version']\r\n && connectionProperties['computerModel']\r\n && connectionProperties['computerManufacturer']\r\n && connectionProperties['isS2dEnabled'] != null) {\r\n const telemetryData = {\r\n operatingSystem: connectionProperties['operatingSystem'],\r\n version: connectionProperties['version'],\r\n computerManufacturer: connectionProperties['computerManufacturer'],\r\n computerModel: connectionProperties['computerModel'],\r\n isS2dEnabled: connectionProperties['isS2dEnabled']\r\n };\r\n const stringifiedData = JSON.stringify(telemetryData);\r\n try {\r\n return MsftSme.toHex(stringifiedData);\r\n } catch {\r\n return null;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n // TODO: Remove work around. Only intended for the quality release for Jan 2020.\r\n private formatClientRequestId(integrationType: string, encodedData?: string): string {\r\n let clientRequestId = AzureConstants.clientRequestIdQualifier.format(MsftSme.newGuid());\r\n\r\n if (integrationType) {\r\n clientRequestId += AzureConstants.integrationTypeDataParameter.format(integrationType);\r\n }\r\n\r\n if (encodedData != null) {\r\n if (encodedData.length < AzureConstants.maxEncodedTelemetryDataLength) {\r\n clientRequestId += AzureConstants.telemetryDataParameter.format(encodedData);\r\n } else {\r\n clientRequestId += AzureConstants.telemetryDataParameter.format(AzureConstants.telemetryDataInvalidValue);\r\n }\r\n }\r\n\r\n // Ordering of parameters is important for parsing in telemetry pipeline.\r\n clientRequestId += AzureConstants.sourceParameter;\r\n\r\n return clientRequestId;\r\n }\r\n\r\n /**\r\n * Send request to RPC\r\n * @param request RpcAzureOperation\r\n */\r\n private sendRequest(request: RpcAzureOperation): Observable<any> {\r\n Logging.log({\r\n level: LogLevel.Debug,\r\n message: 'Sending request to AzureManagerShellService. Request:{0}'.format(JSON.stringify(request)),\r\n source: 'AzureManager'\r\n });\r\n\r\n return from(RpcAzureRequestClient.azureRequest(this.rpc, request))\r\n .pipe(\r\n mergeMap(() => this.watcher),\r\n filter((result) => result.requestId === request.requestId),\r\n take(1),\r\n map((result) => result));\r\n }\r\n\r\n /**\r\n * Send token request to RPC\r\n * @param request RpcAzureOperation\r\n */\r\n private sendTokenRequest(request: RpcAzureOperation): Observable<any> {\r\n Logging.log({\r\n level: LogLevel.Debug,\r\n message: 'Sending request to AzureManagerShellService. Request:{0}'.format(JSON.stringify(request)),\r\n source: 'AzureManager'\r\n });\r\n\r\n return from(RpcAzureRequestClient.azureRequest(this.rpc, request))\r\n .pipe(\r\n mergeMap(() => this.watcher),\r\n filter((result) => result.requestId === request.requestId),\r\n take(1),\r\n map((result) => {\r\n if (result.appInfo) {\r\n return result;\r\n } else if (result.error) {\r\n throw new Error(result.error);\r\n }\r\n\r\n throw new Error(MsftSme.getStrings<Strings>().MsftSmeShell.Core.Rpc.Azure.Unexpected.Error.message);\r\n }));\r\n }\r\n\r\n /**\r\n * Handles Rpc response.\r\n */\r\n private onRpcResponse(data: RpcAzureOperationResult): Promise<any> {\r\n this.watcher.next(data);\r\n return Promise.resolve();\r\n }\r\n\r\n /**\r\n * Determine cloud specific ARM endpoint based on the cloud that gateway is registered to.\r\n * @param cloudName cloudName from gateway's app registration.\r\n * @returns Returns cloud specific ARM endpoint.\r\n */\r\n private getArmEndpoint(cloudNameParam: string): string {\r\n const cloudName = MsftSme.replaceAll(cloudNameParam, ' ', '').toLowerCase();\r\n\r\n if (cloudName === this.AzureGlobal) {\r\n return AzureConstants.azureGlobalArmEndpoint;\r\n } else if (cloudName === this.AzureChina) {\r\n return AzureConstants.azureChinaArmEndpoint;\r\n } else if (cloudName === this.AzureUSGov) {\r\n return AzureConstants.azureUSGovArmEndpoint;\r\n }\r\n }\r\n\r\n /**\r\n * Make a GET request using ARM token.\r\n * @param url endpoint for request\r\n * @param integrationType 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.\r\n */\r\n public getRequestWithArmToken(url: string, integrationType?: AzureIntegrationType): Observable<AjaxResponse> {\r\n return this.getArmToken().pipe(\r\n mergeMap(token => {\r\n const ajaxRequest = this.createRequestWithHeaders(token, { integrationType: integrationType });\r\n return this.http.get(url, ajaxRequest);\r\n }));\r\n }\r\n\r\n /**\r\n * Make a POST request using ARM token.\r\n * @param url endpoint for request\r\n * @param integrationType 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.\r\n */\r\n public postRequestWithArmToken(url: string, body: any, integrationType?: AzureIntegrationType): Observable<AjaxResponse> {\r\n return this.getArmToken().pipe(\r\n mergeMap(token => {\r\n const ajaxRequest = this.createRequestWithHeaders(token, { integrationType: integrationType });\r\n return this.http.post(url, body, ajaxRequest);\r\n }));\r\n }\r\n\r\n /**\r\n * Make a PUT request using ARM token.\r\n * @param url endpoint for request\r\n * @param integrationType 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.\r\n */\r\n public putRequestWithArmToken(url: string, body: any, integrationType?: AzureIntegrationType): Observable<AjaxResponse> {\r\n if (!MsftSme.self().Init.isProduction &&\r\n (url.includes(AzureConstants.azureGlobalArmEndpoint) ||\r\n url.includes(AzureConstants.azureChinaArmEndpoint) ||\r\n url.includes(AzureConstants.azureUSGovArmEndpoint)) &&\r\n url.includes(AzureConstants.resourceDeploymentSubstring)) {\r\n Logging.logWarning('putRequestWithArmToken', 'Use DeployAzure Template to create resource.');\r\n }\r\n\r\n return this.getArmToken().pipe(\r\n mergeMap(token => {\r\n const ajaxRequest = this.createRequestWithHeaders(token, { integrationType: integrationType });\r\n return this.http.put(url, body, ajaxRequest);\r\n }));\r\n }\r\n\r\n /**\r\n * Make a DELETE request using ARM token.\r\n * @param url endpoint for request\r\n * @param integrationType 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.\r\n */\r\n public deleteRequestWithArmToken(url: string, integrationType?: AzureIntegrationType): Observable<AjaxResponse> {\r\n return this.getArmToken().pipe(\r\n mergeMap(token => {\r\n const ajaxRequest = this.createRequestWithHeaders(token, { integrationType: integrationType });\r\n return this.http.delete(url, ajaxRequest);\r\n }));\r\n }\r\n\r\n public createDeploymentOperationResponse(result: AjaxResponse): DeploymentOperationResponse {\r\n const headers = result.xhr.getAllResponseHeaders();\r\n const headerArray = headers && headers.trim().split(/[\\r\\n]+/);\r\n const headerMap: Map<string, string> = new Map<string, string>();\r\n headerArray.forEach(x => {\r\n const parts = x.split(': ');\r\n const header = parts && parts.shift();\r\n const value = parts && parts.join(': ');\r\n headerMap.set(header, value);\r\n });\r\n\r\n const response: DeploymentOperationResponse = {\r\n httpStatusCode: result.status ? result.status : null,\r\n responseHeaders: headerMap ? headerMap : null,\r\n response: result.response ? result.response : null\r\n };\r\n\r\n return response;\r\n }\r\n\r\n public logTelemetry(response: any): void {\r\n const status = response.status;\r\n response = response.response ? response.response : response;\r\n\r\n if (response && response.properties && response.properties.dependencies) {\r\n let dependentResourceIds = response.properties.dependencies;\r\n dependentResourceIds = dependentResourceIds.map(dependentResourceId => dependentResourceId.id);\r\n this.azureLogging.submitCreateResourceTelemetry(status, dependentResourceIds,\r\n response.properties.correlationId);\r\n } else {\r\n this.azureLogging.submitCreateResourceTelemetry(status);\r\n }\r\n }\r\n}\r\n"]}