@azure/arm-selfhelp 1.0.1-alpha.20231016.1 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/CHANGELOG.md +92 -8
  2. package/README.md +2 -2
  3. package/dist/index.js +2045 -391
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.js +1 -1
  6. package/dist/index.min.js.map +1 -1
  7. package/dist-esm/samples-dev/checkNameAvailabilityPostSample.d.ts +2 -0
  8. package/dist-esm/samples-dev/checkNameAvailabilityPostSample.d.ts.map +1 -0
  9. package/dist-esm/samples-dev/{diagnosticsCheckNameAvailabilitySample.js → checkNameAvailabilityPostSample.js} +9 -9
  10. package/dist-esm/samples-dev/checkNameAvailabilityPostSample.js.map +1 -0
  11. package/dist-esm/samples-dev/diagnosticsCreateSample.js +5 -14
  12. package/dist-esm/samples-dev/diagnosticsCreateSample.js.map +1 -1
  13. package/dist-esm/samples-dev/diagnosticsGetSample.js +2 -2
  14. package/dist-esm/samples-dev/discoverySolutionListSample.js +44 -13
  15. package/dist-esm/samples-dev/discoverySolutionListSample.js.map +1 -1
  16. package/dist-esm/samples-dev/operationsListSample.js +4 -9
  17. package/dist-esm/samples-dev/operationsListSample.js.map +1 -1
  18. package/dist-esm/samples-dev/solutionCreateSample.d.ts +2 -0
  19. package/dist-esm/samples-dev/solutionCreateSample.d.ts.map +1 -0
  20. package/dist-esm/samples-dev/solutionCreateSample.js +46 -0
  21. package/dist-esm/samples-dev/solutionCreateSample.js.map +1 -0
  22. package/dist-esm/samples-dev/solutionGetSample.d.ts +2 -0
  23. package/dist-esm/samples-dev/solutionGetSample.d.ts.map +1 -0
  24. package/dist-esm/samples-dev/solutionGetSample.js +37 -0
  25. package/dist-esm/samples-dev/solutionGetSample.js.map +1 -0
  26. package/dist-esm/samples-dev/solutionUpdateSample.d.ts +2 -0
  27. package/dist-esm/samples-dev/solutionUpdateSample.d.ts.map +1 -0
  28. package/dist-esm/samples-dev/solutionUpdateSample.js +37 -0
  29. package/dist-esm/samples-dev/solutionUpdateSample.js.map +1 -0
  30. package/dist-esm/samples-dev/troubleshootersContinueSample.d.ts +2 -0
  31. package/dist-esm/samples-dev/troubleshootersContinueSample.d.ts.map +1 -0
  32. package/dist-esm/samples-dev/troubleshootersContinueSample.js +50 -0
  33. package/dist-esm/samples-dev/troubleshootersContinueSample.js.map +1 -0
  34. package/dist-esm/samples-dev/troubleshootersCreateSample.d.ts +2 -0
  35. package/dist-esm/samples-dev/troubleshootersCreateSample.d.ts.map +1 -0
  36. package/dist-esm/samples-dev/troubleshootersCreateSample.js +46 -0
  37. package/dist-esm/samples-dev/troubleshootersCreateSample.js.map +1 -0
  38. package/dist-esm/samples-dev/troubleshootersEndSample.d.ts +2 -0
  39. package/dist-esm/samples-dev/troubleshootersEndSample.d.ts.map +1 -0
  40. package/dist-esm/samples-dev/troubleshootersEndSample.js +37 -0
  41. package/dist-esm/samples-dev/troubleshootersEndSample.js.map +1 -0
  42. package/dist-esm/samples-dev/troubleshootersGetSample.d.ts +2 -0
  43. package/dist-esm/samples-dev/troubleshootersGetSample.d.ts.map +1 -0
  44. package/dist-esm/samples-dev/troubleshootersGetSample.js +37 -0
  45. package/dist-esm/samples-dev/troubleshootersGetSample.js.map +1 -0
  46. package/dist-esm/samples-dev/troubleshootersRestartSample.d.ts +2 -0
  47. package/dist-esm/samples-dev/troubleshootersRestartSample.d.ts.map +1 -0
  48. package/dist-esm/samples-dev/troubleshootersRestartSample.js +37 -0
  49. package/dist-esm/samples-dev/troubleshootersRestartSample.js.map +1 -0
  50. package/dist-esm/src/helpRP.d.ts +4 -1
  51. package/dist-esm/src/helpRP.d.ts.map +1 -1
  52. package/dist-esm/src/helpRP.js +6 -3
  53. package/dist-esm/src/helpRP.js.map +1 -1
  54. package/dist-esm/src/models/index.d.ts +641 -22
  55. package/dist-esm/src/models/index.d.ts.map +1 -1
  56. package/dist-esm/src/models/index.js +140 -8
  57. package/dist-esm/src/models/index.js.map +1 -1
  58. package/dist-esm/src/models/mappers.d.ts +30 -0
  59. package/dist-esm/src/models/mappers.d.ts.map +1 -1
  60. package/dist-esm/src/models/mappers.js +988 -13
  61. package/dist-esm/src/models/mappers.js.map +1 -1
  62. package/dist-esm/src/models/parameters.d.ts +6 -0
  63. package/dist-esm/src/models/parameters.d.ts.map +1 -1
  64. package/dist-esm/src/models/parameters.js +48 -2
  65. package/dist-esm/src/models/parameters.js.map +1 -1
  66. package/dist-esm/src/operations/checkNameAvailability.d.ts +21 -0
  67. package/dist-esm/src/operations/checkNameAvailability.d.ts.map +1 -0
  68. package/dist-esm/src/operations/checkNameAvailability.js +51 -0
  69. package/dist-esm/src/operations/checkNameAvailability.js.map +1 -0
  70. package/dist-esm/src/operations/diagnostics.d.ts +11 -18
  71. package/dist-esm/src/operations/diagnostics.d.ts.map +1 -1
  72. package/dist-esm/src/operations/diagnostics.js +10 -37
  73. package/dist-esm/src/operations/diagnostics.js.map +1 -1
  74. package/dist-esm/src/operations/discoverySolution.d.ts +20 -14
  75. package/dist-esm/src/operations/discoverySolution.d.ts.map +1 -1
  76. package/dist-esm/src/operations/discoverySolution.js +23 -22
  77. package/dist-esm/src/operations/discoverySolution.js.map +1 -1
  78. package/dist-esm/src/operations/index.d.ts +3 -0
  79. package/dist-esm/src/operations/index.d.ts.map +1 -1
  80. package/dist-esm/src/operations/index.js +3 -0
  81. package/dist-esm/src/operations/index.js.map +1 -1
  82. package/dist-esm/src/operations/operations.js +3 -8
  83. package/dist-esm/src/operations/operations.js.map +1 -1
  84. package/dist-esm/src/operations/solution.d.ts +78 -0
  85. package/dist-esm/src/operations/solution.d.ts.map +1 -0
  86. package/dist-esm/src/operations/solution.js +262 -0
  87. package/dist-esm/src/operations/solution.js.map +1 -0
  88. package/dist-esm/src/operations/troubleshooters.d.ts +70 -0
  89. package/dist-esm/src/operations/troubleshooters.d.ts.map +1 -0
  90. package/dist-esm/src/operations/troubleshooters.js +198 -0
  91. package/dist-esm/src/operations/troubleshooters.js.map +1 -0
  92. package/dist-esm/src/operationsInterfaces/checkNameAvailability.d.ts +13 -0
  93. package/dist-esm/src/operationsInterfaces/checkNameAvailability.d.ts.map +1 -0
  94. package/dist-esm/src/operationsInterfaces/checkNameAvailability.js +9 -0
  95. package/dist-esm/src/operationsInterfaces/checkNameAvailability.js.map +1 -0
  96. package/dist-esm/src/operationsInterfaces/diagnostics.d.ts +11 -18
  97. package/dist-esm/src/operationsInterfaces/diagnostics.d.ts.map +1 -1
  98. package/dist-esm/src/operationsInterfaces/discoverySolution.d.ts +10 -7
  99. package/dist-esm/src/operationsInterfaces/discoverySolution.d.ts.map +1 -1
  100. package/dist-esm/src/operationsInterfaces/index.d.ts +3 -0
  101. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -1
  102. package/dist-esm/src/operationsInterfaces/index.js +3 -0
  103. package/dist-esm/src/operationsInterfaces/index.js.map +1 -1
  104. package/dist-esm/src/operationsInterfaces/solution.d.ts +70 -0
  105. package/dist-esm/src/operationsInterfaces/solution.d.ts.map +1 -0
  106. package/dist-esm/src/operationsInterfaces/solution.js +9 -0
  107. package/dist-esm/src/operationsInterfaces/solution.js.map +1 -0
  108. package/dist-esm/src/operationsInterfaces/troubleshooters.d.ts +62 -0
  109. package/dist-esm/src/operationsInterfaces/troubleshooters.d.ts.map +1 -0
  110. package/dist-esm/src/operationsInterfaces/troubleshooters.js +9 -0
  111. package/dist-esm/src/operationsInterfaces/troubleshooters.js.map +1 -0
  112. package/dist-esm/test/selfhelp_operations_test.spec.js +5 -20
  113. package/dist-esm/test/selfhelp_operations_test.spec.js.map +1 -1
  114. package/package.json +7 -7
  115. package/review/arm-selfhelp.api.md +469 -17
  116. package/src/helpRP.ts +16 -4
  117. package/src/models/index.ts +712 -22
  118. package/src/models/mappers.ts +1024 -13
  119. package/src/models/parameters.ts +58 -2
  120. package/src/operations/checkNameAvailability.ts +68 -0
  121. package/src/operations/diagnostics.ts +10 -46
  122. package/src/operations/discoverySolution.ts +20 -14
  123. package/src/operations/index.ts +3 -0
  124. package/src/operations/solution.ts +349 -0
  125. package/src/operations/troubleshooters.ts +261 -0
  126. package/src/operationsInterfaces/checkNameAvailability.ts +27 -0
  127. package/src/operationsInterfaces/diagnostics.ts +10 -22
  128. package/src/operationsInterfaces/discoverySolution.ts +10 -7
  129. package/src/operationsInterfaces/index.ts +3 -0
  130. package/src/operationsInterfaces/solution.ts +115 -0
  131. package/src/operationsInterfaces/troubleshooters.ts +101 -0
  132. package/types/arm-selfhelp.d.ts +892 -63
  133. package/dist-esm/samples-dev/diagnosticsCheckNameAvailabilitySample.d.ts +0 -2
  134. package/dist-esm/samples-dev/diagnosticsCheckNameAvailabilitySample.d.ts.map +0 -1
  135. package/dist-esm/samples-dev/diagnosticsCheckNameAvailabilitySample.js.map +0 -1
@@ -13,7 +13,11 @@ import {
13
13
  } from "@azure/core-client";
14
14
  import {
15
15
  CheckNameAvailabilityRequest as CheckNameAvailabilityRequestMapper,
16
- DiagnosticResource as DiagnosticResourceMapper
16
+ DiagnosticResource as DiagnosticResourceMapper,
17
+ SolutionResource as SolutionResourceMapper,
18
+ SolutionPatchRequestBody as SolutionPatchRequestBodyMapper,
19
+ TroubleshooterResource as TroubleshooterResourceMapper,
20
+ ContinueRequestBody as ContinueRequestBodyMapper
17
21
  } from "../models/mappers";
18
22
 
19
23
  export const accept: OperationParameter = {
@@ -43,7 +47,7 @@ export const $host: OperationURLParameter = {
43
47
  export const apiVersion: OperationQueryParameter = {
44
48
  parameterPath: "apiVersion",
45
49
  mapper: {
46
- defaultValue: "2023-06-01",
50
+ defaultValue: "2023-09-01-preview",
47
51
  isConstant: true,
48
52
  serializedName: "api-version",
49
53
  type: {
@@ -134,3 +138,55 @@ export const skiptoken: OperationQueryParameter = {
134
138
  }
135
139
  }
136
140
  };
141
+
142
+ export const solutionRequestBody: OperationParameter = {
143
+ parameterPath: ["options", "solutionRequestBody"],
144
+ mapper: SolutionResourceMapper
145
+ };
146
+
147
+ export const solutionResourceName: OperationURLParameter = {
148
+ parameterPath: "solutionResourceName",
149
+ mapper: {
150
+ constraints: {
151
+ Pattern: new RegExp("^[A-Za-z0-9-+@()_]+$"),
152
+ MaxLength: 100,
153
+ MinLength: 1
154
+ },
155
+ serializedName: "solutionResourceName",
156
+ required: true,
157
+ type: {
158
+ name: "String"
159
+ }
160
+ }
161
+ };
162
+
163
+ export const solutionPatchRequestBody: OperationParameter = {
164
+ parameterPath: ["options", "solutionPatchRequestBody"],
165
+ mapper: SolutionPatchRequestBodyMapper
166
+ };
167
+
168
+ export const createTroubleshooterRequestBody: OperationParameter = {
169
+ parameterPath: ["options", "createTroubleshooterRequestBody"],
170
+ mapper: TroubleshooterResourceMapper
171
+ };
172
+
173
+ export const troubleshooterName: OperationURLParameter = {
174
+ parameterPath: "troubleshooterName",
175
+ mapper: {
176
+ constraints: {
177
+ Pattern: new RegExp("([A-Za-z0-9]+(-[A-Za-z0-9]+)+)"),
178
+ MaxLength: 100,
179
+ MinLength: 1
180
+ },
181
+ serializedName: "troubleshooterName",
182
+ required: true,
183
+ type: {
184
+ name: "String"
185
+ }
186
+ }
187
+ };
188
+
189
+ export const continueRequestBody: OperationParameter = {
190
+ parameterPath: ["options", "continueRequestBody"],
191
+ mapper: ContinueRequestBodyMapper
192
+ };
@@ -0,0 +1,68 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * Code generated by Microsoft (R) AutoRest Code Generator.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ */
8
+
9
+ import { CheckNameAvailability } from "../operationsInterfaces";
10
+ import * as coreClient from "@azure/core-client";
11
+ import * as Mappers from "../models/mappers";
12
+ import * as Parameters from "../models/parameters";
13
+ import { HelpRP } from "../helpRP";
14
+ import {
15
+ CheckNameAvailabilityPostOptionalParams,
16
+ CheckNameAvailabilityPostResponse
17
+ } from "../models";
18
+
19
+ /** Class containing CheckNameAvailability operations. */
20
+ export class CheckNameAvailabilityImpl implements CheckNameAvailability {
21
+ private readonly client: HelpRP;
22
+
23
+ /**
24
+ * Initialize a new instance of the class CheckNameAvailability class.
25
+ * @param client Reference to the service client
26
+ */
27
+ constructor(client: HelpRP) {
28
+ this.client = client;
29
+ }
30
+
31
+ /**
32
+ * This API is used to check the uniqueness of a resource name used for a diagnostic, troubleshooter or
33
+ * solutions
34
+ * @param scope This is an extension resource provider and only resource level extension is supported
35
+ * at the moment.
36
+ * @param options The options parameters.
37
+ */
38
+ post(
39
+ scope: string,
40
+ options?: CheckNameAvailabilityPostOptionalParams
41
+ ): Promise<CheckNameAvailabilityPostResponse> {
42
+ return this.client.sendOperationRequest(
43
+ { scope, options },
44
+ postOperationSpec
45
+ );
46
+ }
47
+ }
48
+ // Operation Specifications
49
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
50
+
51
+ const postOperationSpec: coreClient.OperationSpec = {
52
+ path: "/{scope}/providers/Microsoft.Help/checkNameAvailability",
53
+ httpMethod: "POST",
54
+ responses: {
55
+ 200: {
56
+ bodyMapper: Mappers.CheckNameAvailabilityResponse
57
+ },
58
+ default: {
59
+ bodyMapper: Mappers.ErrorResponse
60
+ }
61
+ },
62
+ requestBody: Parameters.checkNameAvailabilityRequest,
63
+ queryParameters: [Parameters.apiVersion],
64
+ urlParameters: [Parameters.$host, Parameters.scope],
65
+ headerParameters: [Parameters.accept, Parameters.contentType],
66
+ mediaType: "json",
67
+ serializer
68
+ };
@@ -18,8 +18,6 @@ import {
18
18
  } from "@azure/core-lro";
19
19
  import { createLroSpec } from "../lroImpl";
20
20
  import {
21
- DiagnosticsCheckNameAvailabilityOptionalParams,
22
- DiagnosticsCheckNameAvailabilityResponse,
23
21
  DiagnosticsCreateOptionalParams,
24
22
  DiagnosticsCreateResponse,
25
23
  DiagnosticsGetOptionalParams,
@@ -39,27 +37,11 @@ export class DiagnosticsImpl implements Diagnostics {
39
37
  }
40
38
 
41
39
  /**
42
- * This API is used to check the uniqueness of a resource name used for a diagnostic check.
43
- * @param scope This is an extension resource provider and only resource level extension is supported
44
- * at the moment.
45
- * @param options The options parameters.
46
- */
47
- checkNameAvailability(
48
- scope: string,
49
- options?: DiagnosticsCheckNameAvailabilityOptionalParams
50
- ): Promise<DiagnosticsCheckNameAvailabilityResponse> {
51
- return this.client.sendOperationRequest(
52
- { scope, options },
53
- checkNameAvailabilityOperationSpec
54
- );
55
- }
56
-
57
- /**
58
- * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get
59
- * diagnostics once you discover and identify the relevant solution for your Azure issue.<br/><br/> You
60
- * can create diagnostics using the ‘solutionId’ from Solution Discovery API response and
61
- * ‘additionalParameters’ <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API
62
- * response must be passed via ‘additionalParameters’ as an input to Diagnostics API
40
+ * Creates a diagnostic for the specific resource using solutionId and requiredInputs* from discovery
41
+ * solutions. <br/>Diagnostics tells you precisely the root cause of the issue and the steps to address
42
+ * it. You can get diagnostics once you discover the relevant solution for your Azure issue. <br/><br/>
43
+ * <b>Note: </b> requiredInputs’ from Discovery solutions response must be passed via
44
+ * ‘additionalParameters’ as an input to Diagnostics API.
63
45
  * @param scope This is an extension resource provider and only resource level extension is supported
64
46
  * at the moment.
65
47
  * @param diagnosticsResourceName Unique resource name for insight resources
@@ -132,11 +114,11 @@ export class DiagnosticsImpl implements Diagnostics {
132
114
  }
133
115
 
134
116
  /**
135
- * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get
136
- * diagnostics once you discover and identify the relevant solution for your Azure issue.<br/><br/> You
137
- * can create diagnostics using the ‘solutionId’ from Solution Discovery API response and
138
- * ‘additionalParameters’ <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API
139
- * response must be passed via ‘additionalParameters’ as an input to Diagnostics API
117
+ * Creates a diagnostic for the specific resource using solutionId and requiredInputs* from discovery
118
+ * solutions. <br/>Diagnostics tells you precisely the root cause of the issue and the steps to address
119
+ * it. You can get diagnostics once you discover the relevant solution for your Azure issue. <br/><br/>
120
+ * <b>Note: </b> requiredInputs’ from Discovery solutions response must be passed via
121
+ * ‘additionalParameters’ as an input to Diagnostics API.
140
122
  * @param scope This is an extension resource provider and only resource level extension is supported
141
123
  * at the moment.
142
124
  * @param diagnosticsResourceName Unique resource name for insight resources
@@ -176,24 +158,6 @@ export class DiagnosticsImpl implements Diagnostics {
176
158
  // Operation Specifications
177
159
  const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
178
160
 
179
- const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = {
180
- path: "/{scope}/providers/Microsoft.Help/checkNameAvailability",
181
- httpMethod: "POST",
182
- responses: {
183
- 200: {
184
- bodyMapper: Mappers.CheckNameAvailabilityResponse
185
- },
186
- default: {
187
- bodyMapper: Mappers.ErrorResponse
188
- }
189
- },
190
- requestBody: Parameters.checkNameAvailabilityRequest,
191
- queryParameters: [Parameters.apiVersion],
192
- urlParameters: [Parameters.$host, Parameters.scope],
193
- headerParameters: [Parameters.accept, Parameters.contentType],
194
- mediaType: "json",
195
- serializer
196
- };
197
161
  const createOperationSpec: coreClient.OperationSpec = {
198
162
  path:
199
163
  "/{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName}",
@@ -35,13 +35,16 @@ export class DiscoverySolutionImpl implements DiscoverySolution {
35
35
  }
36
36
 
37
37
  /**
38
- * Solutions Discovery is the initial point of entry within Help API, which helps you identify the
39
- * relevant solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR
40
- * resourceUri + problemClassificationId.<br/><br/>We will do our best in returning relevant
41
- * diagnostics for your Azure issue.<br/><br/> Get the problemClassificationId(s) using this
42
- * [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/>
43
- * <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via
44
- * ‘additionalParameters’ as an input to Diagnostics API.
38
+ * Lists the relevant Azure diagnostics and solutions using [problemClassification
39
+ * API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) AND
40
+ * resourceUri or resourceType.<br/> Discovery Solutions is the initial entry point within Help API,
41
+ * which identifies relevant Azure diagnostics and solutions. We will do our best to return the most
42
+ * effective solutions based on the type of inputs, in the request URL <br/><br/> Mandatory input :
43
+ * problemClassificationId (Use the [problemClassification
44
+ * API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP))
45
+ * <br/>Optional input: resourceUri OR resource Type <br/><br/> <b>Note: </b> ‘requiredInputs’ from
46
+ * Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics
47
+ * and Solutions API.
45
48
  * @param scope This is an extension resource provider and only resource level extension is supported
46
49
  * at the moment.
47
50
  * @param options The options parameters.
@@ -100,13 +103,16 @@ export class DiscoverySolutionImpl implements DiscoverySolution {
100
103
  }
101
104
 
102
105
  /**
103
- * Solutions Discovery is the initial point of entry within Help API, which helps you identify the
104
- * relevant solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR
105
- * resourceUri + problemClassificationId.<br/><br/>We will do our best in returning relevant
106
- * diagnostics for your Azure issue.<br/><br/> Get the problemClassificationId(s) using this
107
- * [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/>
108
- * <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via
109
- * ‘additionalParameters’ as an input to Diagnostics API.
106
+ * Lists the relevant Azure diagnostics and solutions using [problemClassification
107
+ * API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP)) AND
108
+ * resourceUri or resourceType.<br/> Discovery Solutions is the initial entry point within Help API,
109
+ * which identifies relevant Azure diagnostics and solutions. We will do our best to return the most
110
+ * effective solutions based on the type of inputs, in the request URL <br/><br/> Mandatory input :
111
+ * problemClassificationId (Use the [problemClassification
112
+ * API](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP))
113
+ * <br/>Optional input: resourceUri OR resource Type <br/><br/> <b>Note: </b> ‘requiredInputs’ from
114
+ * Discovery solutions response must be passed via ‘additionalParameters’ as an input to Diagnostics
115
+ * and Solutions API.
110
116
  * @param scope This is an extension resource provider and only resource level extension is supported
111
117
  * at the moment.
112
118
  * @param options The options parameters.
@@ -7,5 +7,8 @@
7
7
  */
8
8
 
9
9
  export * from "./operations";
10
+ export * from "./checkNameAvailability";
10
11
  export * from "./diagnostics";
11
12
  export * from "./discoverySolution";
13
+ export * from "./solution";
14
+ export * from "./troubleshooters";
@@ -0,0 +1,349 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * Code generated by Microsoft (R) AutoRest Code Generator.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ */
8
+
9
+ import { Solution } from "../operationsInterfaces";
10
+ import * as coreClient from "@azure/core-client";
11
+ import * as Mappers from "../models/mappers";
12
+ import * as Parameters from "../models/parameters";
13
+ import { HelpRP } from "../helpRP";
14
+ import {
15
+ SimplePollerLike,
16
+ OperationState,
17
+ createHttpPoller
18
+ } from "@azure/core-lro";
19
+ import { createLroSpec } from "../lroImpl";
20
+ import {
21
+ SolutionCreateOptionalParams,
22
+ SolutionCreateResponse,
23
+ SolutionGetOptionalParams,
24
+ SolutionGetResponse,
25
+ SolutionUpdateOptionalParams,
26
+ SolutionUpdateResponse
27
+ } from "../models";
28
+
29
+ /** Class containing Solution operations. */
30
+ export class SolutionImpl implements Solution {
31
+ private readonly client: HelpRP;
32
+
33
+ /**
34
+ * Initialize a new instance of the class Solution class.
35
+ * @param client Reference to the service client
36
+ */
37
+ constructor(client: HelpRP) {
38
+ this.client = client;
39
+ }
40
+
41
+ /**
42
+ * Creates a solution for the specific Azure resource or subscription using the triggering criteria
43
+ * ‘solutionId and requiredInputs’ from discovery solutions.<br/> Solutions are a rich, insightful and
44
+ * a centralized self help experience that brings all the relevant content to troubleshoot an Azure
45
+ * issue into a unified experience. Solutions include the following components : Text, Diagnostics ,
46
+ * Troubleshooters, Images , Video tutorials, Tables , custom charts, images , AzureKB, etc, with
47
+ * capabilities to support new solutions types in the future. Each solution type may require one or
48
+ * more ‘requiredParameters’ that are required to execute the individual solution component. In the
49
+ * absence of the ‘requiredParameters’ it is likely that some of the solutions might fail execution,
50
+ * and you might see an empty response. <br/><br/> <b>Note:</b> <br/>1. ‘requiredInputs’ from
51
+ * Discovery solutions response must be passed via ‘parameters’ in the request body of Solutions API.
52
+ * <br/>2. ‘requiredParameters’ from the Solutions response is the same as ‘ additionalParameters’ in
53
+ * the request for diagnostics <br/>3. ‘requiredParameters’ from the Solutions response is the same as
54
+ * ‘properties.parameters’ in the request for Troubleshooters
55
+ * @param scope This is an extension resource provider and only resource level extension is supported
56
+ * at the moment.
57
+ * @param solutionResourceName Solution resource Name.
58
+ * @param options The options parameters.
59
+ */
60
+ async beginCreate(
61
+ scope: string,
62
+ solutionResourceName: string,
63
+ options?: SolutionCreateOptionalParams
64
+ ): Promise<
65
+ SimplePollerLike<
66
+ OperationState<SolutionCreateResponse>,
67
+ SolutionCreateResponse
68
+ >
69
+ > {
70
+ const directSendOperation = async (
71
+ args: coreClient.OperationArguments,
72
+ spec: coreClient.OperationSpec
73
+ ): Promise<SolutionCreateResponse> => {
74
+ return this.client.sendOperationRequest(args, spec);
75
+ };
76
+ const sendOperationFn = async (
77
+ args: coreClient.OperationArguments,
78
+ spec: coreClient.OperationSpec
79
+ ) => {
80
+ let currentRawResponse:
81
+ | coreClient.FullOperationResponse
82
+ | undefined = undefined;
83
+ const providedCallback = args.options?.onResponse;
84
+ const callback: coreClient.RawResponseCallback = (
85
+ rawResponse: coreClient.FullOperationResponse,
86
+ flatResponse: unknown
87
+ ) => {
88
+ currentRawResponse = rawResponse;
89
+ providedCallback?.(rawResponse, flatResponse);
90
+ };
91
+ const updatedArgs = {
92
+ ...args,
93
+ options: {
94
+ ...args.options,
95
+ onResponse: callback
96
+ }
97
+ };
98
+ const flatResponse = await directSendOperation(updatedArgs, spec);
99
+ return {
100
+ flatResponse,
101
+ rawResponse: {
102
+ statusCode: currentRawResponse!.status,
103
+ body: currentRawResponse!.parsedBody,
104
+ headers: currentRawResponse!.headers.toJSON()
105
+ }
106
+ };
107
+ };
108
+
109
+ const lro = createLroSpec({
110
+ sendOperationFn,
111
+ args: { scope, solutionResourceName, options },
112
+ spec: createOperationSpec
113
+ });
114
+ const poller = await createHttpPoller<
115
+ SolutionCreateResponse,
116
+ OperationState<SolutionCreateResponse>
117
+ >(lro, {
118
+ restoreFrom: options?.resumeFrom,
119
+ intervalInMs: options?.updateIntervalInMs,
120
+ resourceLocationConfig: "azure-async-operation"
121
+ });
122
+ await poller.poll();
123
+ return poller;
124
+ }
125
+
126
+ /**
127
+ * Creates a solution for the specific Azure resource or subscription using the triggering criteria
128
+ * ‘solutionId and requiredInputs’ from discovery solutions.<br/> Solutions are a rich, insightful and
129
+ * a centralized self help experience that brings all the relevant content to troubleshoot an Azure
130
+ * issue into a unified experience. Solutions include the following components : Text, Diagnostics ,
131
+ * Troubleshooters, Images , Video tutorials, Tables , custom charts, images , AzureKB, etc, with
132
+ * capabilities to support new solutions types in the future. Each solution type may require one or
133
+ * more ‘requiredParameters’ that are required to execute the individual solution component. In the
134
+ * absence of the ‘requiredParameters’ it is likely that some of the solutions might fail execution,
135
+ * and you might see an empty response. <br/><br/> <b>Note:</b> <br/>1. ‘requiredInputs’ from
136
+ * Discovery solutions response must be passed via ‘parameters’ in the request body of Solutions API.
137
+ * <br/>2. ‘requiredParameters’ from the Solutions response is the same as ‘ additionalParameters’ in
138
+ * the request for diagnostics <br/>3. ‘requiredParameters’ from the Solutions response is the same as
139
+ * ‘properties.parameters’ in the request for Troubleshooters
140
+ * @param scope This is an extension resource provider and only resource level extension is supported
141
+ * at the moment.
142
+ * @param solutionResourceName Solution resource Name.
143
+ * @param options The options parameters.
144
+ */
145
+ async beginCreateAndWait(
146
+ scope: string,
147
+ solutionResourceName: string,
148
+ options?: SolutionCreateOptionalParams
149
+ ): Promise<SolutionCreateResponse> {
150
+ const poller = await this.beginCreate(scope, solutionResourceName, options);
151
+ return poller.pollUntilDone();
152
+ }
153
+
154
+ /**
155
+ * Get the solution using the applicable solutionResourceName while creating the solution.
156
+ * @param scope This is an extension resource provider and only resource level extension is supported
157
+ * at the moment.
158
+ * @param solutionResourceName Solution resource Name.
159
+ * @param options The options parameters.
160
+ */
161
+ get(
162
+ scope: string,
163
+ solutionResourceName: string,
164
+ options?: SolutionGetOptionalParams
165
+ ): Promise<SolutionGetResponse> {
166
+ return this.client.sendOperationRequest(
167
+ { scope, solutionResourceName, options },
168
+ getOperationSpec
169
+ );
170
+ }
171
+
172
+ /**
173
+ * Update the requiredInputs or additional information needed to execute the solution
174
+ * @param scope This is an extension resource provider and only resource level extension is supported
175
+ * at the moment.
176
+ * @param solutionResourceName Solution resource Name.
177
+ * @param options The options parameters.
178
+ */
179
+ async beginUpdate(
180
+ scope: string,
181
+ solutionResourceName: string,
182
+ options?: SolutionUpdateOptionalParams
183
+ ): Promise<
184
+ SimplePollerLike<
185
+ OperationState<SolutionUpdateResponse>,
186
+ SolutionUpdateResponse
187
+ >
188
+ > {
189
+ const directSendOperation = async (
190
+ args: coreClient.OperationArguments,
191
+ spec: coreClient.OperationSpec
192
+ ): Promise<SolutionUpdateResponse> => {
193
+ return this.client.sendOperationRequest(args, spec);
194
+ };
195
+ const sendOperationFn = async (
196
+ args: coreClient.OperationArguments,
197
+ spec: coreClient.OperationSpec
198
+ ) => {
199
+ let currentRawResponse:
200
+ | coreClient.FullOperationResponse
201
+ | undefined = undefined;
202
+ const providedCallback = args.options?.onResponse;
203
+ const callback: coreClient.RawResponseCallback = (
204
+ rawResponse: coreClient.FullOperationResponse,
205
+ flatResponse: unknown
206
+ ) => {
207
+ currentRawResponse = rawResponse;
208
+ providedCallback?.(rawResponse, flatResponse);
209
+ };
210
+ const updatedArgs = {
211
+ ...args,
212
+ options: {
213
+ ...args.options,
214
+ onResponse: callback
215
+ }
216
+ };
217
+ const flatResponse = await directSendOperation(updatedArgs, spec);
218
+ return {
219
+ flatResponse,
220
+ rawResponse: {
221
+ statusCode: currentRawResponse!.status,
222
+ body: currentRawResponse!.parsedBody,
223
+ headers: currentRawResponse!.headers.toJSON()
224
+ }
225
+ };
226
+ };
227
+
228
+ const lro = createLroSpec({
229
+ sendOperationFn,
230
+ args: { scope, solutionResourceName, options },
231
+ spec: updateOperationSpec
232
+ });
233
+ const poller = await createHttpPoller<
234
+ SolutionUpdateResponse,
235
+ OperationState<SolutionUpdateResponse>
236
+ >(lro, {
237
+ restoreFrom: options?.resumeFrom,
238
+ intervalInMs: options?.updateIntervalInMs,
239
+ resourceLocationConfig: "azure-async-operation"
240
+ });
241
+ await poller.poll();
242
+ return poller;
243
+ }
244
+
245
+ /**
246
+ * Update the requiredInputs or additional information needed to execute the solution
247
+ * @param scope This is an extension resource provider and only resource level extension is supported
248
+ * at the moment.
249
+ * @param solutionResourceName Solution resource Name.
250
+ * @param options The options parameters.
251
+ */
252
+ async beginUpdateAndWait(
253
+ scope: string,
254
+ solutionResourceName: string,
255
+ options?: SolutionUpdateOptionalParams
256
+ ): Promise<SolutionUpdateResponse> {
257
+ const poller = await this.beginUpdate(scope, solutionResourceName, options);
258
+ return poller.pollUntilDone();
259
+ }
260
+ }
261
+ // Operation Specifications
262
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
263
+
264
+ const createOperationSpec: coreClient.OperationSpec = {
265
+ path: "/{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}",
266
+ httpMethod: "PUT",
267
+ responses: {
268
+ 200: {
269
+ bodyMapper: Mappers.SolutionResource
270
+ },
271
+ 201: {
272
+ bodyMapper: Mappers.SolutionResource
273
+ },
274
+ 202: {
275
+ bodyMapper: Mappers.SolutionResource
276
+ },
277
+ 204: {
278
+ bodyMapper: Mappers.SolutionResource
279
+ },
280
+ default: {
281
+ bodyMapper: Mappers.ErrorResponse
282
+ }
283
+ },
284
+ requestBody: Parameters.solutionRequestBody,
285
+ queryParameters: [Parameters.apiVersion],
286
+ urlParameters: [
287
+ Parameters.$host,
288
+ Parameters.scope,
289
+ Parameters.solutionResourceName
290
+ ],
291
+ headerParameters: [Parameters.accept, Parameters.contentType],
292
+ mediaType: "json",
293
+ serializer
294
+ };
295
+ const getOperationSpec: coreClient.OperationSpec = {
296
+ path: "/{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}",
297
+ httpMethod: "GET",
298
+ responses: {
299
+ 200: {
300
+ bodyMapper: Mappers.SolutionResource
301
+ },
302
+ default: {
303
+ bodyMapper: Mappers.ErrorResponse
304
+ }
305
+ },
306
+ queryParameters: [Parameters.apiVersion],
307
+ urlParameters: [
308
+ Parameters.$host,
309
+ Parameters.scope,
310
+ Parameters.solutionResourceName
311
+ ],
312
+ headerParameters: [Parameters.accept],
313
+ serializer
314
+ };
315
+ const updateOperationSpec: coreClient.OperationSpec = {
316
+ path: "/{scope}/providers/Microsoft.Help/solutions/{solutionResourceName}",
317
+ httpMethod: "PATCH",
318
+ responses: {
319
+ 200: {
320
+ bodyMapper: Mappers.SolutionResource,
321
+ headersMapper: Mappers.SolutionUpdateHeaders
322
+ },
323
+ 201: {
324
+ bodyMapper: Mappers.SolutionResource,
325
+ headersMapper: Mappers.SolutionUpdateHeaders
326
+ },
327
+ 202: {
328
+ bodyMapper: Mappers.SolutionResource,
329
+ headersMapper: Mappers.SolutionUpdateHeaders
330
+ },
331
+ 204: {
332
+ bodyMapper: Mappers.SolutionResource,
333
+ headersMapper: Mappers.SolutionUpdateHeaders
334
+ },
335
+ default: {
336
+ bodyMapper: Mappers.ErrorResponse
337
+ }
338
+ },
339
+ requestBody: Parameters.solutionPatchRequestBody,
340
+ queryParameters: [Parameters.apiVersion],
341
+ urlParameters: [
342
+ Parameters.$host,
343
+ Parameters.scope,
344
+ Parameters.solutionResourceName
345
+ ],
346
+ headerParameters: [Parameters.accept, Parameters.contentType],
347
+ mediaType: "json",
348
+ serializer
349
+ };