@azure/arm-programmableconnectivity 1.0.0-alpha.20250620.1 → 1.0.0-alpha.20250722.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/api/gateways/operations.js +56 -22
- package/dist/browser/api/gateways/operations.js.map +1 -1
- package/dist/browser/api/operations/operations.js +8 -3
- package/dist/browser/api/operations/operations.js.map +1 -1
- package/dist/browser/api/operatorApiConnections/operations.js +58 -24
- package/dist/browser/api/operatorApiConnections/operations.js.map +1 -1
- package/dist/browser/api/operatorApiPlans/operations.js +19 -9
- package/dist/browser/api/operatorApiPlans/operations.js.map +1 -1
- package/dist/browser/api/programmableConnectivityContext.js +16 -10
- package/dist/browser/api/programmableConnectivityContext.js.map +1 -1
- package/dist/browser/classic/gateways/index.js +3 -1
- package/dist/browser/classic/gateways/index.js.map +1 -1
- package/dist/browser/classic/operations/index.js +3 -1
- package/dist/browser/classic/operations/index.js.map +1 -1
- package/dist/browser/classic/operatorApiConnections/index.js +3 -1
- package/dist/browser/classic/operatorApiConnections/index.js.map +1 -1
- package/dist/browser/classic/operatorApiPlans/index.js +3 -1
- package/dist/browser/classic/operatorApiPlans/index.js.map +1 -1
- package/dist/browser/programmableConnectivityClient.js +16 -3
- package/dist/browser/programmableConnectivityClient.js.map +1 -1
- package/dist/browser/restorePollerHelpers.js +11 -13
- package/dist/browser/restorePollerHelpers.js.map +1 -1
- package/dist/browser/static-helpers/pagingHelpers.js +31 -50
- package/dist/browser/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/browser/static-helpers/pollingHelpers.js +14 -11
- package/dist/browser/static-helpers/pollingHelpers.js.map +1 -1
- package/dist/browser/static-helpers/urlTemplate.js +3 -3
- package/dist/browser/static-helpers/urlTemplate.js.map +1 -1
- package/dist/commonjs/api/gateways/operations.js +56 -22
- package/dist/commonjs/api/gateways/operations.js.map +1 -1
- package/dist/commonjs/api/operations/operations.js +8 -3
- package/dist/commonjs/api/operations/operations.js.map +1 -1
- package/dist/commonjs/api/operatorApiConnections/operations.js +58 -24
- package/dist/commonjs/api/operatorApiConnections/operations.js.map +1 -1
- package/dist/commonjs/api/operatorApiPlans/operations.js +19 -9
- package/dist/commonjs/api/operatorApiPlans/operations.js.map +1 -1
- package/dist/commonjs/api/programmableConnectivityContext.js +16 -10
- package/dist/commonjs/api/programmableConnectivityContext.js.map +1 -1
- package/dist/commonjs/classic/gateways/index.js +3 -1
- package/dist/commonjs/classic/gateways/index.js.map +1 -1
- package/dist/commonjs/classic/operations/index.js +3 -1
- package/dist/commonjs/classic/operations/index.js.map +1 -1
- package/dist/commonjs/classic/operatorApiConnections/index.js +3 -1
- package/dist/commonjs/classic/operatorApiConnections/index.js.map +1 -1
- package/dist/commonjs/classic/operatorApiPlans/index.js +3 -1
- package/dist/commonjs/classic/operatorApiPlans/index.js.map +1 -1
- package/dist/commonjs/programmableConnectivityClient.js +16 -3
- package/dist/commonjs/programmableConnectivityClient.js.map +1 -1
- package/dist/commonjs/restorePollerHelpers.js +11 -13
- package/dist/commonjs/restorePollerHelpers.js.map +1 -1
- package/dist/commonjs/static-helpers/pagingHelpers.js +31 -50
- package/dist/commonjs/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/commonjs/static-helpers/pollingHelpers.js +14 -11
- package/dist/commonjs/static-helpers/pollingHelpers.js.map +1 -1
- package/dist/commonjs/static-helpers/urlTemplate.js +3 -3
- package/dist/commonjs/static-helpers/urlTemplate.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +11 -11
- package/dist/esm/api/gateways/operations.js +56 -22
- package/dist/esm/api/gateways/operations.js.map +1 -1
- package/dist/esm/api/operations/operations.js +8 -3
- package/dist/esm/api/operations/operations.js.map +1 -1
- package/dist/esm/api/operatorApiConnections/operations.js +58 -24
- package/dist/esm/api/operatorApiConnections/operations.js.map +1 -1
- package/dist/esm/api/operatorApiPlans/operations.js +19 -9
- package/dist/esm/api/operatorApiPlans/operations.js.map +1 -1
- package/dist/esm/api/programmableConnectivityContext.js +16 -10
- package/dist/esm/api/programmableConnectivityContext.js.map +1 -1
- package/dist/esm/classic/gateways/index.js +3 -1
- package/dist/esm/classic/gateways/index.js.map +1 -1
- package/dist/esm/classic/operations/index.js +3 -1
- package/dist/esm/classic/operations/index.js.map +1 -1
- package/dist/esm/classic/operatorApiConnections/index.js +3 -1
- package/dist/esm/classic/operatorApiConnections/index.js.map +1 -1
- package/dist/esm/classic/operatorApiPlans/index.js +3 -1
- package/dist/esm/classic/operatorApiPlans/index.js.map +1 -1
- package/dist/esm/programmableConnectivityClient.js +16 -3
- package/dist/esm/programmableConnectivityClient.js.map +1 -1
- package/dist/esm/restorePollerHelpers.js +11 -13
- package/dist/esm/restorePollerHelpers.js.map +1 -1
- package/dist/esm/static-helpers/pagingHelpers.js +31 -50
- package/dist/esm/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/esm/static-helpers/pollingHelpers.js +14 -11
- package/dist/esm/static-helpers/pollingHelpers.js.map +1 -1
- package/dist/esm/static-helpers/urlTemplate.js +3 -3
- package/dist/esm/static-helpers/urlTemplate.js.map +1 -1
- package/dist/react-native/api/gateways/operations.js +56 -22
- package/dist/react-native/api/gateways/operations.js.map +1 -1
- package/dist/react-native/api/operations/operations.js +8 -3
- package/dist/react-native/api/operations/operations.js.map +1 -1
- package/dist/react-native/api/operatorApiConnections/operations.js +58 -24
- package/dist/react-native/api/operatorApiConnections/operations.js.map +1 -1
- package/dist/react-native/api/operatorApiPlans/operations.js +19 -9
- package/dist/react-native/api/operatorApiPlans/operations.js.map +1 -1
- package/dist/react-native/api/programmableConnectivityContext.js +16 -10
- package/dist/react-native/api/programmableConnectivityContext.js.map +1 -1
- package/dist/react-native/classic/gateways/index.js +3 -1
- package/dist/react-native/classic/gateways/index.js.map +1 -1
- package/dist/react-native/classic/operations/index.js +3 -1
- package/dist/react-native/classic/operations/index.js.map +1 -1
- package/dist/react-native/classic/operatorApiConnections/index.js +3 -1
- package/dist/react-native/classic/operatorApiConnections/index.js.map +1 -1
- package/dist/react-native/classic/operatorApiPlans/index.js +3 -1
- package/dist/react-native/classic/operatorApiPlans/index.js.map +1 -1
- package/dist/react-native/programmableConnectivityClient.js +16 -3
- package/dist/react-native/programmableConnectivityClient.js.map +1 -1
- package/dist/react-native/restorePollerHelpers.js +11 -13
- package/dist/react-native/restorePollerHelpers.js.map +1 -1
- package/dist/react-native/static-helpers/pagingHelpers.js +31 -50
- package/dist/react-native/static-helpers/pagingHelpers.js.map +1 -1
- package/dist/react-native/static-helpers/pollingHelpers.js +14 -11
- package/dist/react-native/static-helpers/pollingHelpers.js.map +1 -1
- package/dist/react-native/static-helpers/urlTemplate.js +3 -3
- package/dist/react-native/static-helpers/urlTemplate.js.map +1 -1
- package/package.json +2 -2
- /package/review/{arm-programmableconnectivity-api-gateways.api.md → arm-programmableconnectivity-api-gateways-node.api.md} +0 -0
- /package/review/{arm-programmableconnectivity-api.api.md → arm-programmableconnectivity-api-node.api.md} +0 -0
- /package/review/{arm-programmableconnectivity-api-operations.api.md → arm-programmableconnectivity-api-operations-node.api.md} +0 -0
- /package/review/{arm-programmableconnectivity-api-operatorApiConnections.api.md → arm-programmableconnectivity-api-operatorApiConnections-node.api.md} +0 -0
- /package/review/{arm-programmableconnectivity-api-operatorApiPlans.api.md → arm-programmableconnectivity-api-operatorApiPlans-node.api.md} +0 -0
- /package/review/{arm-programmableconnectivity-models.api.md → arm-programmableconnectivity-models-node.api.md} +0 -0
- /package/review/{arm-programmableconnectivity.api.md → arm-programmableconnectivity-node.api.md} +0 -0
|
@@ -7,17 +7,22 @@ import { createRestError, operationOptionsToRequestParameters, } from "@azure-re
|
|
|
7
7
|
export function _listBySubscriptionSend(context, options = {
|
|
8
8
|
requestOptions: {},
|
|
9
9
|
}) {
|
|
10
|
-
var _a, _b;
|
|
11
10
|
const path = expandUrlTemplate("/subscriptions/{subscriptionId}/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans{?api%2Dversion,%24filter,%24top,%24skip}", {
|
|
12
11
|
subscriptionId: context.subscriptionId,
|
|
13
12
|
"api%2Dversion": context.apiVersion,
|
|
14
|
-
"%24filter": options
|
|
15
|
-
"%24top": options
|
|
16
|
-
"%24skip": options
|
|
13
|
+
"%24filter": options?.filter,
|
|
14
|
+
"%24top": options?.top,
|
|
15
|
+
"%24skip": options?.skip,
|
|
17
16
|
}, {
|
|
18
|
-
allowReserved:
|
|
17
|
+
allowReserved: options?.requestOptions?.skipUrlEncoding,
|
|
18
|
+
});
|
|
19
|
+
return context.path(path).get({
|
|
20
|
+
...operationOptionsToRequestParameters(options),
|
|
21
|
+
headers: {
|
|
22
|
+
accept: "application/json",
|
|
23
|
+
...options.requestOptions?.headers,
|
|
24
|
+
},
|
|
19
25
|
});
|
|
20
|
-
return context.path(path).get(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { headers: Object.assign({ accept: "application/json" }, (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.headers) }));
|
|
21
26
|
}
|
|
22
27
|
export async function _listBySubscriptionDeserialize(result) {
|
|
23
28
|
const expectedStatuses = ["200"];
|
|
@@ -35,15 +40,20 @@ export function listBySubscription(context, options = {
|
|
|
35
40
|
return buildPagedAsyncIterator(context, () => _listBySubscriptionSend(context, options), _listBySubscriptionDeserialize, ["200"], { itemName: "value", nextLinkName: "nextLink" });
|
|
36
41
|
}
|
|
37
42
|
export function _getSend(context, operatorApiPlanName, options = { requestOptions: {} }) {
|
|
38
|
-
var _a, _b;
|
|
39
43
|
const path = expandUrlTemplate("/subscriptions/{subscriptionId}/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans/{operatorApiPlanName}{?api%2Dversion}", {
|
|
40
44
|
subscriptionId: context.subscriptionId,
|
|
41
45
|
operatorApiPlanName: operatorApiPlanName,
|
|
42
46
|
"api%2Dversion": context.apiVersion,
|
|
43
47
|
}, {
|
|
44
|
-
allowReserved:
|
|
48
|
+
allowReserved: options?.requestOptions?.skipUrlEncoding,
|
|
49
|
+
});
|
|
50
|
+
return context.path(path).get({
|
|
51
|
+
...operationOptionsToRequestParameters(options),
|
|
52
|
+
headers: {
|
|
53
|
+
accept: "application/json",
|
|
54
|
+
...options.requestOptions?.headers,
|
|
55
|
+
},
|
|
45
56
|
});
|
|
46
|
-
return context.path(path).get(Object.assign(Object.assign({}, operationOptionsToRequestParameters(options)), { headers: Object.assign({ accept: "application/json" }, (_b = options.requestOptions) === null || _b === void 0 ? void 0 : _b.headers) }));
|
|
47
57
|
}
|
|
48
58
|
export async function _getDeserialize(result) {
|
|
49
59
|
const expectedStatuses = ["200"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/api/operatorApiPlans/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,yBAAyB,EAEzB,2BAA2B,EAE3B,sCAAsC,GACvC,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAEL,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAGL,eAAe,EACf,mCAAmC,GACpC,MAAM,yBAAyB,CAAC;AAEjC,MAAM,UAAU,uBAAuB,CACrC,OAAe,EACf,UAA4D;IAC1D,cAAc,EAAE,EAAE;CACnB
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/api/operatorApiPlans/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,yBAAyB,EAEzB,2BAA2B,EAE3B,sCAAsC,GACvC,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAEL,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAGL,eAAe,EACf,mCAAmC,GACpC,MAAM,yBAAyB,CAAC;AAEjC,MAAM,UAAU,uBAA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,mBAAmB,EAAE,OAAO,CAAC,CAAC;IACrE,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ProgrammableConnectivityContext as Client } from \"../index.js\";\nimport {\n errorResponseDeserializer,\n OperatorApiPlan,\n operatorApiPlanDeserializer,\n _OperatorApiPlanListResult,\n _operatorApiPlanListResultDeserializer,\n} from \"../../models/models.js\";\nimport {\n OperatorApiPlansListBySubscriptionOptionalParams,\n OperatorApiPlansGetOptionalParams,\n} from \"./options.js\";\nimport {\n PagedAsyncIterableIterator,\n buildPagedAsyncIterator,\n} from \"../../static-helpers/pagingHelpers.js\";\nimport { expandUrlTemplate } from \"../../static-helpers/urlTemplate.js\";\nimport {\n StreamableMethod,\n PathUncheckedResponse,\n createRestError,\n operationOptionsToRequestParameters,\n} from \"@azure-rest/core-client\";\n\nexport function _listBySubscriptionSend(\n context: Client,\n options: OperatorApiPlansListBySubscriptionOptionalParams = {\n requestOptions: {},\n },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/subscriptions/{subscriptionId}/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans{?api%2Dversion,%24filter,%24top,%24skip}\",\n {\n subscriptionId: context.subscriptionId,\n \"api%2Dversion\": context.apiVersion,\n \"%24filter\": options?.filter,\n \"%24top\": options?.top,\n \"%24skip\": options?.skip,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _listBySubscriptionDeserialize(\n result: PathUncheckedResponse,\n): Promise<_OperatorApiPlanListResult> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = errorResponseDeserializer(result.body);\n throw error;\n }\n\n return _operatorApiPlanListResultDeserializer(result.body);\n}\n\n/** List OperatorApiPlan resources by subscription ID. */\nexport function listBySubscription(\n context: Client,\n options: OperatorApiPlansListBySubscriptionOptionalParams = {\n requestOptions: {},\n },\n): PagedAsyncIterableIterator<OperatorApiPlan> {\n return buildPagedAsyncIterator(\n context,\n () => _listBySubscriptionSend(context, options),\n _listBySubscriptionDeserialize,\n [\"200\"],\n { itemName: \"value\", nextLinkName: \"nextLink\" },\n );\n}\n\nexport function _getSend(\n context: Client,\n operatorApiPlanName: string,\n options: OperatorApiPlansGetOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/subscriptions/{subscriptionId}/providers/Microsoft.ProgrammableConnectivity/operatorApiPlans/{operatorApiPlanName}{?api%2Dversion}\",\n {\n subscriptionId: context.subscriptionId,\n operatorApiPlanName: operatorApiPlanName,\n \"api%2Dversion\": context.apiVersion,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).get({\n ...operationOptionsToRequestParameters(options),\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n });\n}\n\nexport async function _getDeserialize(result: PathUncheckedResponse): Promise<OperatorApiPlan> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = errorResponseDeserializer(result.body);\n throw error;\n }\n\n return operatorApiPlanDeserializer(result.body);\n}\n\n/** Get an OperatorApiPlan resource by name. */\nexport async function get(\n context: Client,\n operatorApiPlanName: string,\n options: OperatorApiPlansGetOptionalParams = { requestOptions: {} },\n): Promise<OperatorApiPlan> {\n const result = await _getSend(context, operatorApiPlanName, options);\n return _getDeserialize(result);\n}\n"]}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { __rest } from "tslib";
|
|
4
3
|
import { logger } from "../logger.js";
|
|
5
4
|
import { getClient } from "@azure-rest/core-client";
|
|
6
5
|
/** Azure Programmable Connectivity Provider management API. */
|
|
7
6
|
export function createProgrammableConnectivity(credential, subscriptionId, options = {}) {
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const prefixFromOptions = (_c = options === null || options === void 0 ? void 0 : options.userAgentOptions) === null || _c === void 0 ? void 0 : _c.userAgentPrefix;
|
|
7
|
+
const endpointUrl = options.endpoint ?? options.baseUrl ?? "https://management.azure.com";
|
|
8
|
+
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
|
|
11
9
|
const userAgentInfo = `azsdk-js-arm-programmableconnectivity/1.0.0-beta.1`;
|
|
12
10
|
const userAgentPrefix = prefixFromOptions
|
|
13
11
|
? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`
|
|
14
12
|
: `azsdk-js-api ${userAgentInfo}`;
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const { apiVersion: _, ...updatedOptions } = {
|
|
14
|
+
...options,
|
|
15
|
+
userAgentOptions: { userAgentPrefix },
|
|
16
|
+
loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },
|
|
17
|
+
credentials: {
|
|
18
|
+
scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
18
21
|
const clientContext = getClient(endpointUrl, credential, updatedOptions);
|
|
19
22
|
clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
20
|
-
const apiVersion =
|
|
23
|
+
const apiVersion = options.apiVersion ?? "2024-01-15-preview";
|
|
21
24
|
clientContext.pipeline.addPolicy({
|
|
22
25
|
name: "ClientApiVersionPolicy",
|
|
23
26
|
sendRequest: (req, next) => {
|
|
@@ -30,7 +33,10 @@ export function createProgrammableConnectivity(credential, subscriptionId, optio
|
|
|
30
33
|
return next(req);
|
|
31
34
|
},
|
|
32
35
|
});
|
|
33
|
-
return
|
|
34
|
-
|
|
36
|
+
return {
|
|
37
|
+
...clientContext,
|
|
38
|
+
apiVersion,
|
|
39
|
+
subscriptionId,
|
|
40
|
+
};
|
|
35
41
|
}
|
|
36
42
|
//# sourceMappingURL=programmableConnectivityContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"programmableConnectivityContext.js","sourceRoot":"","sources":["../../../src/api/programmableConnectivityContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC
|
|
1
|
+
{"version":3,"file":"programmableConnectivityContext.js","sourceRoot":"","sources":["../../../src/api/programmableConnectivityContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAyB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAmB3E,+DAA+D;AAC/D,MAAM,UAAU,8BAA8B,CAC5C,UAA2B,EAC3B,cAAsB,EACtB,UAAwD,EAAE;IAE1D,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,IAAI,8BAA8B,CAAC;IAC1F,MAAM,iBAAiB,GAAG,OAAO,EAAE,gBAAgB,EAAE,eAAe,CAAC;IACrE,MAAM,aAAa,GAAG,oDAAoD,CAAC;IAC3E,MAAM,eAAe,GAAG,iBAAiB;QACvC,CAAC,CAAC,GAAG,iBAAiB,iBAAiB,aAAa,EAAE;QACtD,CAAC,CAAC,gBAAgB,aAAa,EAAE,CAAC;IACpC,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,GAAG;QAC3C,GAAG,OAAO;QACV,gBAAgB,EAAE,EAAE,eAAe,EAAE;QACrC,cAAc,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE;QACzE,WAAW,EAAE;YACX,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC,GAAG,WAAW,WAAW,CAAC;SACnE;KACF,CAAC;IACF,MAAM,aAAa,GAAG,SAAS,CAAC,WAAW,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;IACzE,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,oBAAoB,CAAC;IAC9D,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC/B,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;gBACzC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IACH,OAAO;QACL,GAAG,aAAa;QAChB,UAAU;QACV,cAAc;KACoB,CAAC;AACvC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\nimport { KnownVersions } from \"../models/models.js\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\n/** Azure Programmable Connectivity Provider management API. */\nexport interface ProgrammableConnectivityContext extends Client {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion: string;\n /** The ID of the target subscription. The value must be an UUID. */\n subscriptionId: string;\n}\n\n/** Optional parameters for the client. */\nexport interface ProgrammableConnectivityClientOptionalParams extends ClientOptions {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion?: string;\n}\n\n/** Azure Programmable Connectivity Provider management API. */\nexport function createProgrammableConnectivity(\n credential: TokenCredential,\n subscriptionId: string,\n options: ProgrammableConnectivityClientOptionalParams = {},\n): ProgrammableConnectivityContext {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? \"https://management.azure.com\";\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-arm-programmableconnectivity/1.0.0-beta.1`;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`\n : `azsdk-js-api ${userAgentInfo}`;\n const { apiVersion: _, ...updatedOptions } = {\n ...options,\n userAgentOptions: { userAgentPrefix },\n loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },\n credentials: {\n scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`],\n },\n };\n const clientContext = getClient(endpointUrl, credential, updatedOptions);\n clientContext.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n const apiVersion = options.apiVersion ?? \"2024-01-15-preview\";\n clientContext.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\")) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n return {\n ...clientContext,\n apiVersion,\n subscriptionId,\n } as ProgrammableConnectivityContext;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/gateways/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,cAAc,EACd,GAAG,GACJ,MAAM,kCAAkC,CAAC;AAgD1C,SAAS,YAAY,CAAC,OAAwC;IAC5D,OAAO;QACL,kBAAkB,EAAE,CAAC,OAAkD,EAAE,EAAE,CACzE,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC;QACtC,mBAAmB,EAAE,CACnB,iBAAyB,EACzB,OAAmD,EACnD,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC;QAC7D,MAAM,EAAE,CACN,iBAAyB,EACzB,WAAmB,EACnB,OAAsC,EACtC,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,CAAC;QAC9D,MAAM,EAAE,CACN,iBAAyB,EACzB,WAAmB,EACnB,UAA6B,EAC7B,OAAsC,EACtC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC;QACzE,cAAc,EAAE,CACd,iBAAyB,EACzB,WAAmB,EACnB,QAAiB,EACjB,OAA8C,EAC9C,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC;QAC/E,GAAG,EAAE,CAAC,iBAAyB,EAAE,WAAmB,EAAE,OAAmC,EAAE,EAAE,CAC3F,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,CAAC;KACxD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,OAAwC;IAExC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/gateways/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,cAAc,EACd,GAAG,GACJ,MAAM,kCAAkC,CAAC;AAgD1C,SAAS,YAAY,CAAC,OAAwC;IAC5D,OAAO;QACL,kBAAkB,EAAE,CAAC,OAAkD,EAAE,EAAE,CACzE,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC;QACtC,mBAAmB,EAAE,CACnB,iBAAyB,EACzB,OAAmD,EACnD,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC;QAC7D,MAAM,EAAE,CACN,iBAAyB,EACzB,WAAmB,EACnB,OAAsC,EACtC,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,CAAC;QAC9D,MAAM,EAAE,CACN,iBAAyB,EACzB,WAAmB,EACnB,UAA6B,EAC7B,OAAsC,EACtC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC;QACzE,cAAc,EAAE,CACd,iBAAyB,EACzB,WAAmB,EACnB,QAAiB,EACjB,OAA8C,EAC9C,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC;QAC/E,GAAG,EAAE,CAAC,iBAAyB,EAAE,WAAmB,EAAE,OAAmC,EAAE,EAAE,CAC3F,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,CAAC;KACxD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,OAAwC;IAExC,OAAO;QACL,GAAG,YAAY,CAAC,OAAO,CAAC;KACzB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ProgrammableConnectivityContext } from \"../../api/programmableConnectivityContext.js\";\nimport { Gateway, GatewayTagsUpdate } from \"../../models/models.js\";\nimport {\n GatewaysListBySubscriptionOptionalParams,\n GatewaysListByResourceGroupOptionalParams,\n GatewaysDeleteOptionalParams,\n GatewaysUpdateOptionalParams,\n GatewaysCreateOrUpdateOptionalParams,\n GatewaysGetOptionalParams,\n} from \"../../api/gateways/options.js\";\nimport {\n listBySubscription,\n listByResourceGroup,\n $delete,\n update,\n createOrUpdate,\n get,\n} from \"../../api/gateways/operations.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport { PollerLike, OperationState } from \"@azure/core-lro\";\n\n/** Interface representing a Gateways operations. */\nexport interface GatewaysOperations {\n /** List Gateway resources by subscription ID. */\n listBySubscription: (\n options?: GatewaysListBySubscriptionOptionalParams,\n ) => PagedAsyncIterableIterator<Gateway>;\n /** List Gateway resources by resource group. */\n listByResourceGroup: (\n resourceGroupName: string,\n options?: GatewaysListByResourceGroupOptionalParams,\n ) => PagedAsyncIterableIterator<Gateway>;\n /** Delete a Gateway. */\n /**\n * @fixme delete is a reserved word that cannot be used as an operation name.\n * Please add @clientName(\"clientName\") or @clientName(\"<JS-Specific-Name>\", \"javascript\")\n * to the operation to override the generated name.\n */\n delete: (\n resourceGroupName: string,\n gatewayName: string,\n options?: GatewaysDeleteOptionalParams,\n ) => PollerLike<OperationState<void>, void>;\n /** Update Gateway tags. */\n update: (\n resourceGroupName: string,\n gatewayName: string,\n properties: GatewayTagsUpdate,\n options?: GatewaysUpdateOptionalParams,\n ) => Promise<Gateway>;\n /** Create or update an APC Gateway. */\n createOrUpdate: (\n resourceGroupName: string,\n gatewayName: string,\n resource: Gateway,\n options?: GatewaysCreateOrUpdateOptionalParams,\n ) => PollerLike<OperationState<Gateway>, Gateway>;\n /** Get a Gateway resource by name. */\n get: (\n resourceGroupName: string,\n gatewayName: string,\n options?: GatewaysGetOptionalParams,\n ) => Promise<Gateway>;\n}\n\nfunction _getGateways(context: ProgrammableConnectivityContext) {\n return {\n listBySubscription: (options?: GatewaysListBySubscriptionOptionalParams) =>\n listBySubscription(context, options),\n listByResourceGroup: (\n resourceGroupName: string,\n options?: GatewaysListByResourceGroupOptionalParams,\n ) => listByResourceGroup(context, resourceGroupName, options),\n delete: (\n resourceGroupName: string,\n gatewayName: string,\n options?: GatewaysDeleteOptionalParams,\n ) => $delete(context, resourceGroupName, gatewayName, options),\n update: (\n resourceGroupName: string,\n gatewayName: string,\n properties: GatewayTagsUpdate,\n options?: GatewaysUpdateOptionalParams,\n ) => update(context, resourceGroupName, gatewayName, properties, options),\n createOrUpdate: (\n resourceGroupName: string,\n gatewayName: string,\n resource: Gateway,\n options?: GatewaysCreateOrUpdateOptionalParams,\n ) => createOrUpdate(context, resourceGroupName, gatewayName, resource, options),\n get: (resourceGroupName: string, gatewayName: string, options?: GatewaysGetOptionalParams) =>\n get(context, resourceGroupName, gatewayName, options),\n };\n}\n\nexport function _getGatewaysOperations(\n context: ProgrammableConnectivityContext,\n): GatewaysOperations {\n return {\n ..._getGateways(context),\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/operations/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAS1D,SAAS,cAAc,CAAC,OAAwC;IAC9D,OAAO;QACL,IAAI,EAAE,CAAC,OAAsC,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC;KACzE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,OAAwC;IAExC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/operations/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAS1D,SAAS,cAAc,CAAC,OAAwC;IAC9D,OAAO;QACL,IAAI,EAAE,CAAC,OAAsC,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC;KACzE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,OAAwC;IAExC,OAAO;QACL,GAAG,cAAc,CAAC,OAAO,CAAC;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ProgrammableConnectivityContext } from \"../../api/programmableConnectivityContext.js\";\nimport { Operation } from \"../../models/models.js\";\nimport { OperationsListOptionalParams } from \"../../api/operations/options.js\";\nimport { list } from \"../../api/operations/operations.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\n\n/** Interface representing a Operations operations. */\nexport interface OperationsOperations {\n /** List the operations for the provider */\n list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator<Operation>;\n}\n\nfunction _getOperations(context: ProgrammableConnectivityContext) {\n return {\n list: (options?: OperationsListOptionalParams) => list(context, options),\n };\n}\n\nexport function _getOperationsOperations(\n context: ProgrammableConnectivityContext,\n): OperationsOperations {\n return {\n ..._getOperations(context),\n };\n}\n"]}
|
|
@@ -12,6 +12,8 @@ function _getOperatorApiConnections(context) {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
export function _getOperatorApiConnectionsOperations(context) {
|
|
15
|
-
return
|
|
15
|
+
return {
|
|
16
|
+
..._getOperatorApiConnections(context),
|
|
17
|
+
};
|
|
16
18
|
}
|
|
17
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/operatorApiConnections/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,MAAM,EACN,GAAG,GACJ,MAAM,gDAAgD,CAAC;AAgDxD,SAAS,0BAA0B,CAAC,OAAwC;IAC1E,OAAO;QACL,kBAAkB,EAAE,CAAC,OAAgE,EAAE,EAAE,CACvF,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC;QACtC,mBAAmB,EAAE,CACnB,iBAAyB,EACzB,OAAiE,EACjE,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC;QAC7D,MAAM,EAAE,CACN,iBAAyB,EACzB,yBAAiC,EACjC,OAAoD,EACpD,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,OAAO,CAAC;QAC5E,MAAM,EAAE,CACN,iBAAyB,EACzB,yBAAiC,EACjC,UAAuC,EACvC,OAAoD,EACpD,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,UAAU,EAAE,OAAO,CAAC;QACvF,MAAM,EAAE,CACN,iBAAyB,EACzB,yBAAiC,EACjC,QAA+B,EAC/B,OAAoD,EACpD,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,QAAQ,EAAE,OAAO,CAAC;QACrF,GAAG,EAAE,CACH,iBAAyB,EACzB,yBAAiC,EACjC,OAAiD,EACjD,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,OAAO,CAAC;KACzE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oCAAoC,CAClD,OAAwC;IAExC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/operatorApiConnections/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,MAAM,EACN,GAAG,GACJ,MAAM,gDAAgD,CAAC;AAgDxD,SAAS,0BAA0B,CAAC,OAAwC;IAC1E,OAAO;QACL,kBAAkB,EAAE,CAAC,OAAgE,EAAE,EAAE,CACvF,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC;QACtC,mBAAmB,EAAE,CACnB,iBAAyB,EACzB,OAAiE,EACjE,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,CAAC;QAC7D,MAAM,EAAE,CACN,iBAAyB,EACzB,yBAAiC,EACjC,OAAoD,EACpD,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,OAAO,CAAC;QAC5E,MAAM,EAAE,CACN,iBAAyB,EACzB,yBAAiC,EACjC,UAAuC,EACvC,OAAoD,EACpD,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,UAAU,EAAE,OAAO,CAAC;QACvF,MAAM,EAAE,CACN,iBAAyB,EACzB,yBAAiC,EACjC,QAA+B,EAC/B,OAAoD,EACpD,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,QAAQ,EAAE,OAAO,CAAC;QACrF,GAAG,EAAE,CACH,iBAAyB,EACzB,yBAAiC,EACjC,OAAiD,EACjD,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,OAAO,CAAC;KACzE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oCAAoC,CAClD,OAAwC;IAExC,OAAO;QACL,GAAG,0BAA0B,CAAC,OAAO,CAAC;KACvC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ProgrammableConnectivityContext } from \"../../api/programmableConnectivityContext.js\";\nimport { OperatorApiConnection, OperatorApiConnectionUpdate } from \"../../models/models.js\";\nimport {\n OperatorApiConnectionsListBySubscriptionOptionalParams,\n OperatorApiConnectionsListByResourceGroupOptionalParams,\n OperatorApiConnectionsDeleteOptionalParams,\n OperatorApiConnectionsUpdateOptionalParams,\n OperatorApiConnectionsCreateOptionalParams,\n OperatorApiConnectionsGetOptionalParams,\n} from \"../../api/operatorApiConnections/options.js\";\nimport {\n listBySubscription,\n listByResourceGroup,\n $delete,\n update,\n create,\n get,\n} from \"../../api/operatorApiConnections/operations.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\nimport { PollerLike, OperationState } from \"@azure/core-lro\";\n\n/** Interface representing a OperatorApiConnections operations. */\nexport interface OperatorApiConnectionsOperations {\n /** List OperatorApiConnection resources by subscription ID. */\n listBySubscription: (\n options?: OperatorApiConnectionsListBySubscriptionOptionalParams,\n ) => PagedAsyncIterableIterator<OperatorApiConnection>;\n /** List OperatorApiConnection resources by resource group. */\n listByResourceGroup: (\n resourceGroupName: string,\n options?: OperatorApiConnectionsListByResourceGroupOptionalParams,\n ) => PagedAsyncIterableIterator<OperatorApiConnection>;\n /** Delete an Operator API Connection. */\n /**\n * @fixme delete is a reserved word that cannot be used as an operation name.\n * Please add @clientName(\"clientName\") or @clientName(\"<JS-Specific-Name>\", \"javascript\")\n * to the operation to override the generated name.\n */\n delete: (\n resourceGroupName: string,\n operatorApiConnectionName: string,\n options?: OperatorApiConnectionsDeleteOptionalParams,\n ) => PollerLike<OperationState<void>, void>;\n /** Update an Operator API Connection. */\n update: (\n resourceGroupName: string,\n operatorApiConnectionName: string,\n properties: OperatorApiConnectionUpdate,\n options?: OperatorApiConnectionsUpdateOptionalParams,\n ) => PollerLike<OperationState<OperatorApiConnection>, OperatorApiConnection>;\n /** Create an Operator API Connection. */\n create: (\n resourceGroupName: string,\n operatorApiConnectionName: string,\n resource: OperatorApiConnection,\n options?: OperatorApiConnectionsCreateOptionalParams,\n ) => PollerLike<OperationState<OperatorApiConnection>, OperatorApiConnection>;\n /** Get an Operator API Connection. */\n get: (\n resourceGroupName: string,\n operatorApiConnectionName: string,\n options?: OperatorApiConnectionsGetOptionalParams,\n ) => Promise<OperatorApiConnection>;\n}\n\nfunction _getOperatorApiConnections(context: ProgrammableConnectivityContext) {\n return {\n listBySubscription: (options?: OperatorApiConnectionsListBySubscriptionOptionalParams) =>\n listBySubscription(context, options),\n listByResourceGroup: (\n resourceGroupName: string,\n options?: OperatorApiConnectionsListByResourceGroupOptionalParams,\n ) => listByResourceGroup(context, resourceGroupName, options),\n delete: (\n resourceGroupName: string,\n operatorApiConnectionName: string,\n options?: OperatorApiConnectionsDeleteOptionalParams,\n ) => $delete(context, resourceGroupName, operatorApiConnectionName, options),\n update: (\n resourceGroupName: string,\n operatorApiConnectionName: string,\n properties: OperatorApiConnectionUpdate,\n options?: OperatorApiConnectionsUpdateOptionalParams,\n ) => update(context, resourceGroupName, operatorApiConnectionName, properties, options),\n create: (\n resourceGroupName: string,\n operatorApiConnectionName: string,\n resource: OperatorApiConnection,\n options?: OperatorApiConnectionsCreateOptionalParams,\n ) => create(context, resourceGroupName, operatorApiConnectionName, resource, options),\n get: (\n resourceGroupName: string,\n operatorApiConnectionName: string,\n options?: OperatorApiConnectionsGetOptionalParams,\n ) => get(context, resourceGroupName, operatorApiConnectionName, options),\n };\n}\n\nexport function _getOperatorApiConnectionsOperations(\n context: ProgrammableConnectivityContext,\n): OperatorApiConnectionsOperations {\n return {\n ..._getOperatorApiConnections(context),\n };\n}\n"]}
|
|
@@ -8,6 +8,8 @@ function _getOperatorApiPlans(context) {
|
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
export function _getOperatorApiPlansOperations(context) {
|
|
11
|
-
return
|
|
11
|
+
return {
|
|
12
|
+
..._getOperatorApiPlans(context),
|
|
13
|
+
};
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/operatorApiPlans/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,0CAA0C,CAAC;AAgBnF,SAAS,oBAAoB,CAAC,OAAwC;IACpE,OAAO;QACL,kBAAkB,EAAE,CAAC,OAA0D,EAAE,EAAE,CACjF,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC;QACtC,GAAG,EAAE,CAAC,mBAA2B,EAAE,OAA2C,EAAE,EAAE,CAChF,GAAG,CAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,CAAC;KAC7C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,OAAwC;IAExC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/classic/operatorApiPlans/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,0CAA0C,CAAC;AAgBnF,SAAS,oBAAoB,CAAC,OAAwC;IACpE,OAAO;QACL,kBAAkB,EAAE,CAAC,OAA0D,EAAE,EAAE,CACjF,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC;QACtC,GAAG,EAAE,CAAC,mBAA2B,EAAE,OAA2C,EAAE,EAAE,CAChF,GAAG,CAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,CAAC;KAC7C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,OAAwC;IAExC,OAAO;QACL,GAAG,oBAAoB,CAAC,OAAO,CAAC;KACjC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ProgrammableConnectivityContext } from \"../../api/programmableConnectivityContext.js\";\nimport { OperatorApiPlan } from \"../../models/models.js\";\nimport {\n OperatorApiPlansListBySubscriptionOptionalParams,\n OperatorApiPlansGetOptionalParams,\n} from \"../../api/operatorApiPlans/options.js\";\nimport { listBySubscription, get } from \"../../api/operatorApiPlans/operations.js\";\nimport { PagedAsyncIterableIterator } from \"../../static-helpers/pagingHelpers.js\";\n\n/** Interface representing a OperatorApiPlans operations. */\nexport interface OperatorApiPlansOperations {\n /** List OperatorApiPlan resources by subscription ID. */\n listBySubscription: (\n options?: OperatorApiPlansListBySubscriptionOptionalParams,\n ) => PagedAsyncIterableIterator<OperatorApiPlan>;\n /** Get an OperatorApiPlan resource by name. */\n get: (\n operatorApiPlanName: string,\n options?: OperatorApiPlansGetOptionalParams,\n ) => Promise<OperatorApiPlan>;\n}\n\nfunction _getOperatorApiPlans(context: ProgrammableConnectivityContext) {\n return {\n listBySubscription: (options?: OperatorApiPlansListBySubscriptionOptionalParams) =>\n listBySubscription(context, options),\n get: (operatorApiPlanName: string, options?: OperatorApiPlansGetOptionalParams) =>\n get(context, operatorApiPlanName, options),\n };\n}\n\nexport function _getOperatorApiPlansOperations(\n context: ProgrammableConnectivityContext,\n): OperatorApiPlansOperations {\n return {\n ..._getOperatorApiPlans(context),\n };\n}\n"]}
|
|
@@ -6,19 +6,32 @@ import { _getOperatorApiConnectionsOperations, } from "./classic/operatorApiConn
|
|
|
6
6
|
import { _getGatewaysOperations } from "./classic/gateways/index.js";
|
|
7
7
|
import { _getOperationsOperations } from "./classic/operations/index.js";
|
|
8
8
|
export class ProgrammableConnectivityClient {
|
|
9
|
+
_client;
|
|
10
|
+
/** The pipeline used by this client to make requests */
|
|
11
|
+
pipeline;
|
|
9
12
|
/** Azure Programmable Connectivity Provider management API. */
|
|
10
13
|
constructor(credential, subscriptionId, options = {}) {
|
|
11
|
-
|
|
12
|
-
const prefixFromOptions = (_a = options === null || options === void 0 ? void 0 : options.userAgentOptions) === null || _a === void 0 ? void 0 : _a.userAgentPrefix;
|
|
14
|
+
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
|
|
13
15
|
const userAgentPrefix = prefixFromOptions
|
|
14
16
|
? `${prefixFromOptions} azsdk-js-client`
|
|
15
17
|
: `azsdk-js-client`;
|
|
16
|
-
this._client = createProgrammableConnectivity(credential, subscriptionId,
|
|
18
|
+
this._client = createProgrammableConnectivity(credential, subscriptionId, {
|
|
19
|
+
...options,
|
|
20
|
+
userAgentOptions: { userAgentPrefix },
|
|
21
|
+
});
|
|
17
22
|
this.pipeline = this._client.pipeline;
|
|
18
23
|
this.operatorApiPlans = _getOperatorApiPlansOperations(this._client);
|
|
19
24
|
this.operatorApiConnections = _getOperatorApiConnectionsOperations(this._client);
|
|
20
25
|
this.gateways = _getGatewaysOperations(this._client);
|
|
21
26
|
this.operations = _getOperationsOperations(this._client);
|
|
22
27
|
}
|
|
28
|
+
/** The operation groups for operatorApiPlans */
|
|
29
|
+
operatorApiPlans;
|
|
30
|
+
/** The operation groups for operatorApiConnections */
|
|
31
|
+
operatorApiConnections;
|
|
32
|
+
/** The operation groups for gateways */
|
|
33
|
+
gateways;
|
|
34
|
+
/** The operation groups for operations */
|
|
35
|
+
operations;
|
|
23
36
|
}
|
|
24
37
|
//# sourceMappingURL=programmableConnectivityClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"programmableConnectivityClient.js","sourceRoot":"","sources":["../../src/programmableConnectivityClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,GAG/B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,8BAA8B,GAC/B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAEL,oCAAoC,GACrC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAsB,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAwB,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAM/F,MAAM,OAAO,8BAA8B;
|
|
1
|
+
{"version":3,"file":"programmableConnectivityClient.js","sourceRoot":"","sources":["../../src/programmableConnectivityClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,8BAA8B,GAG/B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,8BAA8B,GAC/B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAEL,oCAAoC,GACrC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAsB,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAwB,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAM/F,MAAM,OAAO,8BAA8B;IACjC,OAAO,CAAkC;IACjD,wDAAwD;IACxC,QAAQ,CAAW;IAEnC,+DAA+D;IAC/D,YACE,UAA2B,EAC3B,cAAsB,EACtB,UAAwD,EAAE;QAE1D,MAAM,iBAAiB,GAAG,OAAO,EAAE,gBAAgB,EAAE,eAAe,CAAC;QACrE,MAAM,eAAe,GAAG,iBAAiB;YACvC,CAAC,CAAC,GAAG,iBAAiB,kBAAkB;YACxC,CAAC,CAAC,iBAAiB,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,8BAA8B,CAAC,UAAU,EAAE,cAAc,EAAE;YACxE,GAAG,OAAO;YACV,gBAAgB,EAAE,EAAE,eAAe,EAAE;SACtC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QACtC,IAAI,CAAC,gBAAgB,GAAG,8BAA8B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrE,IAAI,CAAC,sBAAsB,GAAG,oCAAoC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjF,IAAI,CAAC,QAAQ,GAAG,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,gDAAgD;IAChC,gBAAgB,CAA6B;IAC7D,sDAAsD;IACtC,sBAAsB,CAAmC;IACzE,wCAAwC;IACxB,QAAQ,CAAqB;IAC7C,0CAA0C;IAC1B,UAAU,CAAuB;CAClD","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n createProgrammableConnectivity,\n ProgrammableConnectivityContext,\n ProgrammableConnectivityClientOptionalParams,\n} from \"./api/index.js\";\nimport {\n OperatorApiPlansOperations,\n _getOperatorApiPlansOperations,\n} from \"./classic/operatorApiPlans/index.js\";\nimport {\n OperatorApiConnectionsOperations,\n _getOperatorApiConnectionsOperations,\n} from \"./classic/operatorApiConnections/index.js\";\nimport { GatewaysOperations, _getGatewaysOperations } from \"./classic/gateways/index.js\";\nimport { OperationsOperations, _getOperationsOperations } from \"./classic/operations/index.js\";\nimport { Pipeline } from \"@azure/core-rest-pipeline\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport { ProgrammableConnectivityClientOptionalParams } from \"./api/programmableConnectivityContext.js\";\n\nexport class ProgrammableConnectivityClient {\n private _client: ProgrammableConnectivityContext;\n /** The pipeline used by this client to make requests */\n public readonly pipeline: Pipeline;\n\n /** Azure Programmable Connectivity Provider management API. */\n constructor(\n credential: TokenCredential,\n subscriptionId: string,\n options: ProgrammableConnectivityClientOptionalParams = {},\n ) {\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-client`\n : `azsdk-js-client`;\n this._client = createProgrammableConnectivity(credential, subscriptionId, {\n ...options,\n userAgentOptions: { userAgentPrefix },\n });\n this.pipeline = this._client.pipeline;\n this.operatorApiPlans = _getOperatorApiPlansOperations(this._client);\n this.operatorApiConnections = _getOperatorApiConnectionsOperations(this._client);\n this.gateways = _getGatewaysOperations(this._client);\n this.operations = _getOperationsOperations(this._client);\n }\n\n /** The operation groups for operatorApiPlans */\n public readonly operatorApiPlans: OperatorApiPlansOperations;\n /** The operation groups for operatorApiConnections */\n public readonly operatorApiConnections: OperatorApiConnectionsOperations;\n /** The operation groups for gateways */\n public readonly gateways: GatewaysOperations;\n /** The operation groups for operations */\n public readonly operations: OperationsOperations;\n}\n"]}
|
|
@@ -10,21 +10,20 @@ import { deserializeState, } from "@azure/core-lro";
|
|
|
10
10
|
* needs to be constructed after the original one is not in scope.
|
|
11
11
|
*/
|
|
12
12
|
export function restorePoller(client, serializedState, sourceOperation, options) {
|
|
13
|
-
var _a, _b, _c;
|
|
14
13
|
const pollerConfig = deserializeState(serializedState).config;
|
|
15
14
|
const { initialRequestUrl, requestMethod, metadata } = pollerConfig;
|
|
16
15
|
if (!initialRequestUrl || !requestMethod) {
|
|
17
|
-
throw new Error(`Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation
|
|
16
|
+
throw new Error(`Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`);
|
|
18
17
|
}
|
|
19
|
-
const resourceLocationConfig = metadata
|
|
20
|
-
const { deserializer, expectedStatuses = [] } =
|
|
21
|
-
const deserializeHelper =
|
|
18
|
+
const resourceLocationConfig = metadata?.["resourceLocationConfig"];
|
|
19
|
+
const { deserializer, expectedStatuses = [] } = getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};
|
|
20
|
+
const deserializeHelper = options?.processResponseBody ?? deserializer;
|
|
22
21
|
if (!deserializeHelper) {
|
|
23
|
-
throw new Error(`Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation
|
|
22
|
+
throw new Error(`Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`);
|
|
24
23
|
}
|
|
25
|
-
return getLongRunningPoller(
|
|
26
|
-
updateIntervalInMs: options
|
|
27
|
-
abortSignal: options
|
|
24
|
+
return getLongRunningPoller(client["_client"] ?? client, deserializeHelper, expectedStatuses, {
|
|
25
|
+
updateIntervalInMs: options?.updateIntervalInMs,
|
|
26
|
+
abortSignal: options?.abortSignal,
|
|
28
27
|
resourceLocationConfig,
|
|
29
28
|
restoreFrom: serializedState,
|
|
30
29
|
initialRequestUrl,
|
|
@@ -47,7 +46,6 @@ const deserializeMap = {
|
|
|
47
46
|
},
|
|
48
47
|
};
|
|
49
48
|
function getDeserializationHelper(urlStr, method) {
|
|
50
|
-
var _a, _b, _c, _d;
|
|
51
49
|
const path = new URL(urlStr).pathname;
|
|
52
50
|
const pathParts = path.split("/");
|
|
53
51
|
// Traverse list to match the longest candidate
|
|
@@ -67,13 +65,13 @@ function getDeserializationHelper(urlStr, method) {
|
|
|
67
65
|
// track if we have found a match to return the values found.
|
|
68
66
|
let found = true;
|
|
69
67
|
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
70
|
-
if (
|
|
71
|
-
const start = candidateParts[i].indexOf("}") + 1, end =
|
|
68
|
+
if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
|
|
69
|
+
const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
|
|
72
70
|
// If the current part of the candidate is a "template" part
|
|
73
71
|
// Try to use the suffix of pattern to match the path
|
|
74
72
|
// {guid} ==> $
|
|
75
73
|
// {guid}:export ==> :export$
|
|
76
|
-
const isMatched = new RegExp(`${
|
|
74
|
+
const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
|
|
77
75
|
if (!isMatched) {
|
|
78
76
|
found = false;
|
|
79
77
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restorePollerHelpers.js","sourceRoot":"","sources":["../../src/restorePollerHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,mBAAmB,IAAI,2BAA2B,EAClD,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAG1E,OAAO,EAGL,gBAAgB,GAEjB,MAAM,iBAAiB,CAAC;AAgBzB;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAsC,EACtC,eAAuB,EACvB,eAAiF,EACjF,OAAuC;;IAEvC,MAAM,YAAY,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC;IAC9D,MAAM,EAAE,iBAAiB,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC;IACpE,IAAI,CAAC,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KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ProgrammableConnectivityClient } from \"./programmableConnectivityClient.js\";\nimport {\n _$deleteDeserialize,\n _updateDeserialize,\n _createDeserialize,\n} from \"./api/operatorApiConnections/operations.js\";\nimport {\n _$deleteDeserialize as _$deleteDeserializeGateways,\n _createOrUpdateDeserialize,\n} from \"./api/gateways/operations.js\";\nimport { getLongRunningPoller } from \"./static-helpers/pollingHelpers.js\";\nimport { OperationOptions, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport {\n PollerLike,\n OperationState,\n deserializeState,\n ResourceLocationConfig,\n} from \"@azure/core-lro\";\n\nexport interface RestorePollerOptions<\n TResult,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n> extends OperationOptions {\n /** Delay to wait until next poll, in milliseconds. */\n updateIntervalInMs?: number;\n /**\n * The signal which can be used to abort requests.\n */\n abortSignal?: AbortSignalLike;\n /** Deserialization function for raw response body */\n processResponseBody?: (result: TResponse) => Promise<TResult>;\n}\n\n/**\n * Creates a poller from the serialized state of another poller. This can be\n * useful when you want to create pollers on a different host or a poller\n * needs to be constructed after the original one is not in scope.\n */\nexport function restorePoller<TResponse extends PathUncheckedResponse, TResult>(\n client: ProgrammableConnectivityClient,\n serializedState: string,\n sourceOperation: (...args: any[]) => PollerLike<OperationState<TResult>, TResult>,\n options?: RestorePollerOptions<TResult>,\n): PollerLike<OperationState<TResult>, TResult> {\n const pollerConfig = deserializeState(serializedState).config;\n const { initialRequestUrl, requestMethod, metadata } = pollerConfig;\n if (!initialRequestUrl || !requestMethod) {\n throw new Error(\n `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`,\n );\n }\n const resourceLocationConfig = metadata?.[\"resourceLocationConfig\"] as\n | ResourceLocationConfig\n | undefined;\n const { deserializer, expectedStatuses = [] } =\n getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};\n const deserializeHelper = options?.processResponseBody ?? deserializer;\n if (!deserializeHelper) {\n throw new Error(\n `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`,\n );\n }\n return getLongRunningPoller(\n (client as any)[\"_client\"] ?? client,\n deserializeHelper as (result: TResponse) => Promise<TResult>,\n expectedStatuses,\n {\n updateIntervalInMs: options?.updateIntervalInMs,\n abortSignal: options?.abortSignal,\n resourceLocationConfig,\n restoreFrom: serializedState,\n initialRequestUrl,\n },\n );\n}\n\ninterface DeserializationHelper {\n deserializer: Function;\n expectedStatuses: string[];\n}\n\nconst deserializeMap: Record<string, DeserializationHelper> = {\n \"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections/{operatorApiConnectionName}\":\n {\n deserializer: _$deleteDeserialize,\n expectedStatuses: [\"202\", \"204\", \"200\"],\n },\n \"PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections/{operatorApiConnectionName}\":\n { deserializer: _updateDeserialize, expectedStatuses: [\"200\", \"202\"] },\n \"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections/{operatorApiConnectionName}\":\n { deserializer: _createDeserialize, expectedStatuses: [\"200\", \"201\"] },\n \"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/gateways/{gatewayName}\":\n {\n deserializer: _$deleteDeserializeGateways,\n expectedStatuses: [\"202\", \"204\", \"200\"],\n },\n \"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/gateways/{gatewayName}\":\n {\n deserializer: _createOrUpdateDeserialize,\n expectedStatuses: [\"200\", \"201\"],\n },\n};\n\nfunction getDeserializationHelper(\n urlStr: string,\n method: string,\n): DeserializationHelper | undefined {\n const path = new URL(urlStr).pathname;\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: DeserializationHelper | undefined;\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(deserializeMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"restorePollerHelpers.js","sourceRoot":"","sources":["../../src/restorePollerHelpers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,GACnB,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CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ProgrammableConnectivityClient } from \"./programmableConnectivityClient.js\";\nimport {\n _$deleteDeserialize,\n _updateDeserialize,\n _createDeserialize,\n} from \"./api/operatorApiConnections/operations.js\";\nimport {\n _$deleteDeserialize as _$deleteDeserializeGateways,\n _createOrUpdateDeserialize,\n} from \"./api/gateways/operations.js\";\nimport { getLongRunningPoller } from \"./static-helpers/pollingHelpers.js\";\nimport { OperationOptions, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { AbortSignalLike } from \"@azure/abort-controller\";\nimport {\n PollerLike,\n OperationState,\n deserializeState,\n ResourceLocationConfig,\n} from \"@azure/core-lro\";\n\nexport interface RestorePollerOptions<\n TResult,\n TResponse extends PathUncheckedResponse = PathUncheckedResponse,\n> extends OperationOptions {\n /** Delay to wait until next poll, in milliseconds. */\n updateIntervalInMs?: number;\n /**\n * The signal which can be used to abort requests.\n */\n abortSignal?: AbortSignalLike;\n /** Deserialization function for raw response body */\n processResponseBody?: (result: TResponse) => Promise<TResult>;\n}\n\n/**\n * Creates a poller from the serialized state of another poller. This can be\n * useful when you want to create pollers on a different host or a poller\n * needs to be constructed after the original one is not in scope.\n */\nexport function restorePoller<TResponse extends PathUncheckedResponse, TResult>(\n client: ProgrammableConnectivityClient,\n serializedState: string,\n sourceOperation: (...args: any[]) => PollerLike<OperationState<TResult>, TResult>,\n options?: RestorePollerOptions<TResult>,\n): PollerLike<OperationState<TResult>, TResult> {\n const pollerConfig = deserializeState(serializedState).config;\n const { initialRequestUrl, requestMethod, metadata } = pollerConfig;\n if (!initialRequestUrl || !requestMethod) {\n throw new Error(\n `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`,\n );\n }\n const resourceLocationConfig = metadata?.[\"resourceLocationConfig\"] as\n | ResourceLocationConfig\n | undefined;\n const { deserializer, expectedStatuses = [] } =\n getDeserializationHelper(initialRequestUrl, requestMethod) ?? {};\n const deserializeHelper = options?.processResponseBody ?? deserializer;\n if (!deserializeHelper) {\n throw new Error(\n `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`,\n );\n }\n return getLongRunningPoller(\n (client as any)[\"_client\"] ?? client,\n deserializeHelper as (result: TResponse) => Promise<TResult>,\n expectedStatuses,\n {\n updateIntervalInMs: options?.updateIntervalInMs,\n abortSignal: options?.abortSignal,\n resourceLocationConfig,\n restoreFrom: serializedState,\n initialRequestUrl,\n },\n );\n}\n\ninterface DeserializationHelper {\n deserializer: Function;\n expectedStatuses: string[];\n}\n\nconst deserializeMap: Record<string, DeserializationHelper> = {\n \"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections/{operatorApiConnectionName}\":\n {\n deserializer: _$deleteDeserialize,\n expectedStatuses: [\"202\", \"204\", \"200\"],\n },\n \"PATCH /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections/{operatorApiConnectionName}\":\n { deserializer: _updateDeserialize, expectedStatuses: [\"200\", \"202\"] },\n \"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/operatorApiConnections/{operatorApiConnectionName}\":\n { deserializer: _createDeserialize, expectedStatuses: [\"200\", \"201\"] },\n \"DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/gateways/{gatewayName}\":\n {\n deserializer: _$deleteDeserializeGateways,\n expectedStatuses: [\"202\", \"204\", \"200\"],\n },\n \"PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgrammableConnectivity/gateways/{gatewayName}\":\n {\n deserializer: _createOrUpdateDeserialize,\n expectedStatuses: [\"200\", \"201\"],\n },\n};\n\nfunction getDeserializationHelper(\n urlStr: string,\n method: string,\n): DeserializationHelper | undefined {\n const path = new URL(urlStr).pathname;\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: DeserializationHelper | undefined;\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(deserializeMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
4
3
|
import { createRestError } from "@azure-rest/core-client";
|
|
5
4
|
import { RestError } from "@azure/core-rest-pipeline";
|
|
6
5
|
/**
|
|
7
6
|
* Helper to paginate results in a generic way and return a PagedAsyncIterableIterator
|
|
8
7
|
*/
|
|
9
8
|
export function buildPagedAsyncIterator(client, getInitialResponse, processResponseBody, expectedStatuses, options = {}) {
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const nextLinkName = (_b = options.nextLinkName) !== null && _b !== void 0 ? _b : "nextLink";
|
|
9
|
+
const itemName = options.itemName ?? "value";
|
|
10
|
+
const nextLinkName = options.nextLinkName ?? "nextLink";
|
|
13
11
|
const pagedResult = {
|
|
14
12
|
getPage: async (pageLink) => {
|
|
15
13
|
const result = pageLink === undefined
|
|
@@ -25,7 +23,7 @@ export function buildPagedAsyncIterator(client, getInitialResponse, processRespo
|
|
|
25
23
|
};
|
|
26
24
|
},
|
|
27
25
|
byPage: (settings) => {
|
|
28
|
-
const { continuationToken } = settings
|
|
26
|
+
const { continuationToken } = settings ?? {};
|
|
29
27
|
return getPageAsyncIterator(pagedResult, {
|
|
30
28
|
pageLink: continuationToken,
|
|
31
29
|
});
|
|
@@ -41,7 +39,6 @@ export function buildPagedAsyncIterator(client, getInitialResponse, processRespo
|
|
|
41
39
|
* @returns a paged async iterator that iterates over results.
|
|
42
40
|
*/
|
|
43
41
|
function getPagedAsyncIterator(pagedResult) {
|
|
44
|
-
var _a;
|
|
45
42
|
const iter = getItemAsyncIterator(pagedResult);
|
|
46
43
|
return {
|
|
47
44
|
next() {
|
|
@@ -50,55 +47,39 @@ function getPagedAsyncIterator(pagedResult) {
|
|
|
50
47
|
[Symbol.asyncIterator]() {
|
|
51
48
|
return this;
|
|
52
49
|
},
|
|
53
|
-
byPage:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
byPage: pagedResult?.byPage ??
|
|
51
|
+
((settings) => {
|
|
52
|
+
const { continuationToken } = settings ?? {};
|
|
53
|
+
return getPageAsyncIterator(pagedResult, {
|
|
54
|
+
pageLink: continuationToken,
|
|
55
|
+
});
|
|
56
|
+
}),
|
|
59
57
|
};
|
|
60
58
|
}
|
|
61
|
-
function getItemAsyncIterator(pagedResult) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
for (var _d = true, pages_1 = __asyncValues(pages), pages_1_1; pages_1_1 = yield __await(pages_1.next()), _a = pages_1_1.done, !_a; _d = true) {
|
|
67
|
-
_c = pages_1_1.value;
|
|
68
|
-
_d = false;
|
|
69
|
-
const page = _c;
|
|
70
|
-
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
74
|
-
finally {
|
|
75
|
-
try {
|
|
76
|
-
if (!_d && !_a && (_b = pages_1.return)) yield __await(_b.call(pages_1));
|
|
77
|
-
}
|
|
78
|
-
finally { if (e_1) throw e_1.error; }
|
|
79
|
-
}
|
|
80
|
-
});
|
|
59
|
+
async function* getItemAsyncIterator(pagedResult) {
|
|
60
|
+
const pages = getPageAsyncIterator(pagedResult);
|
|
61
|
+
for await (const page of pages) {
|
|
62
|
+
yield* page;
|
|
63
|
+
}
|
|
81
64
|
}
|
|
82
|
-
function getPageAsyncIterator(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
65
|
+
async function* getPageAsyncIterator(pagedResult, options = {}) {
|
|
66
|
+
const { pageLink } = options;
|
|
67
|
+
let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);
|
|
68
|
+
if (!response) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
let result = response.page;
|
|
72
|
+
result.continuationToken = response.nextPageLink;
|
|
73
|
+
yield result;
|
|
74
|
+
while (response.nextPageLink) {
|
|
75
|
+
response = await pagedResult.getPage(response.nextPageLink);
|
|
86
76
|
if (!response) {
|
|
87
|
-
return
|
|
77
|
+
return;
|
|
88
78
|
}
|
|
89
|
-
|
|
79
|
+
result = response.page;
|
|
90
80
|
result.continuationToken = response.nextPageLink;
|
|
91
|
-
yield
|
|
92
|
-
|
|
93
|
-
response = yield __await(pagedResult.getPage(response.nextPageLink));
|
|
94
|
-
if (!response) {
|
|
95
|
-
return yield __await(void 0);
|
|
96
|
-
}
|
|
97
|
-
result = response.page;
|
|
98
|
-
result.continuationToken = response.nextPageLink;
|
|
99
|
-
yield yield __await(result);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
81
|
+
yield result;
|
|
82
|
+
}
|
|
102
83
|
}
|
|
103
84
|
/**
|
|
104
85
|
* Gets for the value of nextLink in the body
|
|
@@ -124,7 +105,7 @@ function getElements(body, itemName) {
|
|
|
124
105
|
if (!Array.isArray(value)) {
|
|
125
106
|
throw new RestError(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
126
107
|
}
|
|
127
|
-
return value
|
|
108
|
+
return value ?? [];
|
|
128
109
|
}
|
|
129
110
|
/**
|
|
130
111
|
* Checks if a request failed
|