@azure/arm-managedapplications 2.0.2-alpha.20221026.1 → 2.1.0-alpha.20221128.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +10 -11
  2. package/dist/index.js +164 -46
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.min.js +1 -1
  5. package/dist/index.min.js.map +1 -1
  6. package/dist-esm/src/applicationClient.d.ts +2 -0
  7. package/dist-esm/src/applicationClient.d.ts.map +1 -1
  8. package/dist-esm/src/applicationClient.js +68 -26
  9. package/dist-esm/src/applicationClient.js.map +1 -1
  10. package/dist-esm/src/index.d.ts +1 -0
  11. package/dist-esm/src/index.d.ts.map +1 -1
  12. package/dist-esm/src/index.js +1 -0
  13. package/dist-esm/src/index.js.map +1 -1
  14. package/dist-esm/src/models/index.d.ts +19 -8
  15. package/dist-esm/src/models/index.d.ts.map +1 -1
  16. package/dist-esm/src/models/index.js +11 -0
  17. package/dist-esm/src/models/index.js.map +1 -1
  18. package/dist-esm/src/operations/applicationDefinitions.d.ts.map +1 -1
  19. package/dist-esm/src/operations/applicationDefinitions.js +19 -7
  20. package/dist-esm/src/operations/applicationDefinitions.js.map +1 -1
  21. package/dist-esm/src/operations/applications.d.ts.map +1 -1
  22. package/dist-esm/src/operations/applications.js +37 -14
  23. package/dist-esm/src/operations/applications.js.map +1 -1
  24. package/dist-esm/src/pagingHelper.d.ts +13 -0
  25. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  26. package/dist-esm/src/pagingHelper.js +32 -0
  27. package/dist-esm/src/pagingHelper.js.map +1 -0
  28. package/dist-esm/test/sampleTest.js +11 -13
  29. package/dist-esm/test/sampleTest.js.map +1 -1
  30. package/package.json +12 -8
  31. package/review/arm-managedapplications.api.md +24 -32
  32. package/src/applicationClient.ts +81 -28
  33. package/src/index.ts +1 -0
  34. package/src/models/index.ts +19 -8
  35. package/src/operations/applicationDefinitions.ts +26 -9
  36. package/src/operations/applications.ts +46 -17
  37. package/src/pagingHelper.ts +39 -0
  38. package/tsconfig.json +0 -2
  39. package/types/arm-managedapplications.d.ts +30 -8
  40. package/types/tsdoc-metadata.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,15 +1,14 @@
1
1
  # Release History
2
-
3
- ## 2.0.2 (Unreleased)
4
-
5
- ### Features Added
6
-
7
- ### Breaking Changes
8
-
9
- ### Bugs Fixed
10
-
11
- ### Other Changes
12
-
2
+
3
+ ## 2.1.0 (2022-11-22)
4
+
5
+ **Features**
6
+
7
+ - Added Interface Application
8
+ - Added Interface ApplicationDefinition
9
+ - Added Interface ApplicationPatchable
10
+ - Added Interface GenericResource
11
+
13
12
  ## 2.0.1 (2022-04-18)
14
13
 
15
14
  **features**
package/dist/index.js CHANGED
@@ -28,6 +28,38 @@ function _interopNamespace(e) {
28
28
  var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
29
29
  var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline);
30
30
 
31
+ /*
32
+ * Copyright (c) Microsoft Corporation.
33
+ * Licensed under the MIT License.
34
+ *
35
+ * Code generated by Microsoft (R) AutoRest Code Generator.
36
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
37
+ */
38
+ const pageMap = new WeakMap();
39
+ /**
40
+ * Given a result page from a pageable operation, returns a
41
+ * continuation token that can be used to begin paging from
42
+ * that point later.
43
+ * @param page A result object from calling .byPage() on a paged operation.
44
+ * @returns The continuation token that can be passed into byPage().
45
+ */
46
+ function getContinuationToken(page) {
47
+ var _a;
48
+ if (typeof page !== "object" || page === null) {
49
+ return undefined;
50
+ }
51
+ return (_a = pageMap.get(page)) === null || _a === void 0 ? void 0 : _a.continuationToken;
52
+ }
53
+ function setContinuationToken(page, continuationToken) {
54
+ var _a;
55
+ if (typeof page !== "object" || page === null || !continuationToken) {
56
+ return;
57
+ }
58
+ const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {};
59
+ pageInfo.continuationToken = continuationToken;
60
+ pageMap.set(page, pageInfo);
61
+ }
62
+
31
63
  /*
32
64
  * Copyright (c) Microsoft Corporation.
33
65
  * Licensed under the MIT License.
@@ -38,16 +70,27 @@ var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipelin
38
70
  /** Known values of {@link ProvisioningState} that the service accepts. */
39
71
  exports.KnownProvisioningState = void 0;
40
72
  (function (KnownProvisioningState) {
73
+ /** Accepted */
41
74
  KnownProvisioningState["Accepted"] = "Accepted";
75
+ /** Running */
42
76
  KnownProvisioningState["Running"] = "Running";
77
+ /** Ready */
43
78
  KnownProvisioningState["Ready"] = "Ready";
79
+ /** Creating */
44
80
  KnownProvisioningState["Creating"] = "Creating";
81
+ /** Created */
45
82
  KnownProvisioningState["Created"] = "Created";
83
+ /** Deleting */
46
84
  KnownProvisioningState["Deleting"] = "Deleting";
85
+ /** Deleted */
47
86
  KnownProvisioningState["Deleted"] = "Deleted";
87
+ /** Canceled */
48
88
  KnownProvisioningState["Canceled"] = "Canceled";
89
+ /** Failed */
49
90
  KnownProvisioningState["Failed"] = "Failed";
91
+ /** Succeeded */
50
92
  KnownProvisioningState["Succeeded"] = "Succeeded";
93
+ /** Updating */
51
94
  KnownProvisioningState["Updating"] = "Updating";
52
95
  })(exports.KnownProvisioningState || (exports.KnownProvisioningState = {}));
53
96
 
@@ -874,20 +917,31 @@ class ApplicationsImpl {
874
917
  [Symbol.asyncIterator]() {
875
918
  return this;
876
919
  },
877
- byPage: () => {
878
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
920
+ byPage: (settings) => {
921
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
922
+ throw new Error("maxPageSize is not supported by this operation.");
923
+ }
924
+ return this.listByResourceGroupPagingPage(resourceGroupName, options, settings);
879
925
  }
880
926
  };
881
927
  }
882
- listByResourceGroupPagingPage(resourceGroupName, options) {
928
+ listByResourceGroupPagingPage(resourceGroupName, options, settings) {
883
929
  return tslib.__asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() {
884
- let result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
885
- yield yield tslib.__await(result.value || []);
886
- let continuationToken = result.nextLink;
930
+ let result;
931
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
932
+ if (!continuationToken) {
933
+ result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
934
+ let page = result.value || [];
935
+ continuationToken = result.nextLink;
936
+ setContinuationToken(page, continuationToken);
937
+ yield yield tslib.__await(page);
938
+ }
887
939
  while (continuationToken) {
888
940
  result = yield tslib.__await(this._listByResourceGroupNext(resourceGroupName, continuationToken, options));
889
941
  continuationToken = result.nextLink;
890
- yield yield tslib.__await(result.value || []);
942
+ let page = result.value || [];
943
+ setContinuationToken(page, continuationToken);
944
+ yield yield tslib.__await(page);
891
945
  }
892
946
  });
893
947
  }
@@ -922,20 +976,31 @@ class ApplicationsImpl {
922
976
  [Symbol.asyncIterator]() {
923
977
  return this;
924
978
  },
925
- byPage: () => {
926
- return this.listBySubscriptionPagingPage(options);
979
+ byPage: (settings) => {
980
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
981
+ throw new Error("maxPageSize is not supported by this operation.");
982
+ }
983
+ return this.listBySubscriptionPagingPage(options, settings);
927
984
  }
928
985
  };
929
986
  }
930
- listBySubscriptionPagingPage(options) {
987
+ listBySubscriptionPagingPage(options, settings) {
931
988
  return tslib.__asyncGenerator(this, arguments, function* listBySubscriptionPagingPage_1() {
932
- let result = yield tslib.__await(this._listBySubscription(options));
933
- yield yield tslib.__await(result.value || []);
934
- let continuationToken = result.nextLink;
989
+ let result;
990
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
991
+ if (!continuationToken) {
992
+ result = yield tslib.__await(this._listBySubscription(options));
993
+ let page = result.value || [];
994
+ continuationToken = result.nextLink;
995
+ setContinuationToken(page, continuationToken);
996
+ yield yield tslib.__await(page);
997
+ }
935
998
  while (continuationToken) {
936
999
  result = yield tslib.__await(this._listBySubscriptionNext(continuationToken, options));
937
1000
  continuationToken = result.nextLink;
938
- yield yield tslib.__await(result.value || []);
1001
+ let page = result.value || [];
1002
+ setContinuationToken(page, continuationToken);
1003
+ yield yield tslib.__await(page);
939
1004
  }
940
1005
  });
941
1006
  }
@@ -1531,20 +1596,31 @@ class ApplicationDefinitionsImpl {
1531
1596
  [Symbol.asyncIterator]() {
1532
1597
  return this;
1533
1598
  },
1534
- byPage: () => {
1535
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
1599
+ byPage: (settings) => {
1600
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1601
+ throw new Error("maxPageSize is not supported by this operation.");
1602
+ }
1603
+ return this.listByResourceGroupPagingPage(resourceGroupName, options, settings);
1536
1604
  }
1537
1605
  };
1538
1606
  }
1539
- listByResourceGroupPagingPage(resourceGroupName, options) {
1607
+ listByResourceGroupPagingPage(resourceGroupName, options, settings) {
1540
1608
  return tslib.__asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() {
1541
- let result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
1542
- yield yield tslib.__await(result.value || []);
1543
- let continuationToken = result.nextLink;
1609
+ let result;
1610
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1611
+ if (!continuationToken) {
1612
+ result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
1613
+ let page = result.value || [];
1614
+ continuationToken = result.nextLink;
1615
+ setContinuationToken(page, continuationToken);
1616
+ yield yield tslib.__await(page);
1617
+ }
1544
1618
  while (continuationToken) {
1545
1619
  result = yield tslib.__await(this._listByResourceGroupNext(resourceGroupName, continuationToken, options));
1546
1620
  continuationToken = result.nextLink;
1547
- yield yield tslib.__await(result.value || []);
1621
+ let page = result.value || [];
1622
+ setContinuationToken(page, continuationToken);
1623
+ yield yield tslib.__await(page);
1548
1624
  }
1549
1625
  });
1550
1626
  }
@@ -2022,7 +2098,7 @@ class ApplicationClient extends coreClient__namespace.ServiceClient {
2022
2098
  * @param options The parameter options
2023
2099
  */
2024
2100
  constructor(credentials, subscriptionId, options) {
2025
- var _a, _b;
2101
+ var _a, _b, _c;
2026
2102
  if (credentials === undefined) {
2027
2103
  throw new Error("'credentials' cannot be null");
2028
2104
  }
@@ -2037,32 +2113,34 @@ class ApplicationClient extends coreClient__namespace.ServiceClient {
2037
2113
  requestContentType: "application/json; charset=utf-8",
2038
2114
  credential: credentials
2039
2115
  };
2040
- const packageDetails = `azsdk-js-arm-managedapplications/2.0.2`;
2116
+ const packageDetails = `azsdk-js-arm-managedapplications/2.1.0`;
2041
2117
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
2042
2118
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
2043
2119
  : `${packageDetails}`;
2044
- if (!options.credentialScopes) {
2045
- options.credentialScopes = ["https://management.azure.com/.default"];
2046
- }
2047
2120
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
2048
2121
  userAgentPrefix
2049
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
2122
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
2050
2123
  super(optionsWithDefaults);
2124
+ let bearerTokenAuthenticationPolicyFound = false;
2051
2125
  if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
2052
2126
  const pipelinePolicies = options.pipeline.getOrderedPolicies();
2053
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
2127
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
2054
2128
  coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
2055
- if (!bearerTokenAuthenticationPolicyFound) {
2056
- this.pipeline.removePolicy({
2057
- name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
2058
- });
2059
- this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
2060
- scopes: `${optionsWithDefaults.baseUri}/.default`,
2061
- challengeCallbacks: {
2062
- authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
2063
- }
2064
- }));
2065
- }
2129
+ }
2130
+ if (!options ||
2131
+ !options.pipeline ||
2132
+ options.pipeline.getOrderedPolicies().length == 0 ||
2133
+ !bearerTokenAuthenticationPolicyFound) {
2134
+ this.pipeline.removePolicy({
2135
+ name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
2136
+ });
2137
+ this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
2138
+ credential: credentials,
2139
+ scopes: (_c = optionsWithDefaults.credentialScopes) !== null && _c !== void 0 ? _c : `${optionsWithDefaults.endpoint}/.default`,
2140
+ challengeCallbacks: {
2141
+ authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
2142
+ }
2143
+ }));
2066
2144
  }
2067
2145
  // Parameter assignments
2068
2146
  this.subscriptionId = subscriptionId;
@@ -2071,6 +2149,34 @@ class ApplicationClient extends coreClient__namespace.ServiceClient {
2071
2149
  this.apiVersion = options.apiVersion || "2018-06-01";
2072
2150
  this.applications = new ApplicationsImpl(this);
2073
2151
  this.applicationDefinitions = new ApplicationDefinitionsImpl(this);
2152
+ this.addCustomApiVersionPolicy(options.apiVersion);
2153
+ }
2154
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
2155
+ addCustomApiVersionPolicy(apiVersion) {
2156
+ if (!apiVersion) {
2157
+ return;
2158
+ }
2159
+ const apiVersionPolicy = {
2160
+ name: "CustomApiVersionPolicy",
2161
+ sendRequest(request, next) {
2162
+ return tslib.__awaiter(this, void 0, void 0, function* () {
2163
+ const param = request.url.split("?");
2164
+ if (param.length > 1) {
2165
+ const newParams = param[1].split("&").map((item) => {
2166
+ if (item.indexOf("api-version") > -1) {
2167
+ return "api-version=" + apiVersion;
2168
+ }
2169
+ else {
2170
+ return item;
2171
+ }
2172
+ });
2173
+ request.url = param[0] + "?" + newParams.join("&");
2174
+ }
2175
+ return next(request);
2176
+ });
2177
+ }
2178
+ };
2179
+ this.pipeline.addPolicy(apiVersionPolicy);
2074
2180
  }
2075
2181
  /**
2076
2182
  * Lists all of the available Microsoft.Solutions REST API operations.
@@ -2085,20 +2191,31 @@ class ApplicationClient extends coreClient__namespace.ServiceClient {
2085
2191
  [Symbol.asyncIterator]() {
2086
2192
  return this;
2087
2193
  },
2088
- byPage: () => {
2089
- return this.listOperationsPagingPage(options);
2194
+ byPage: (settings) => {
2195
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
2196
+ throw new Error("maxPageSize is not supported by this operation.");
2197
+ }
2198
+ return this.listOperationsPagingPage(options, settings);
2090
2199
  }
2091
2200
  };
2092
2201
  }
2093
- listOperationsPagingPage(options) {
2202
+ listOperationsPagingPage(options, settings) {
2094
2203
  return tslib.__asyncGenerator(this, arguments, function* listOperationsPagingPage_1() {
2095
- let result = yield tslib.__await(this._listOperations(options));
2096
- yield yield tslib.__await(result.value || []);
2097
- let continuationToken = result.nextLink;
2204
+ let result;
2205
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
2206
+ if (!continuationToken) {
2207
+ result = yield tslib.__await(this._listOperations(options));
2208
+ let page = result.value || [];
2209
+ continuationToken = result.nextLink;
2210
+ setContinuationToken(page, continuationToken);
2211
+ yield yield tslib.__await(page);
2212
+ }
2098
2213
  while (continuationToken) {
2099
2214
  result = yield tslib.__await(this._listOperationsNext(continuationToken, options));
2100
2215
  continuationToken = result.nextLink;
2101
- yield yield tslib.__await(result.value || []);
2216
+ let page = result.value || [];
2217
+ setContinuationToken(page, continuationToken);
2218
+ yield yield tslib.__await(page);
2102
2219
  }
2103
2220
  });
2104
2221
  }
@@ -2166,4 +2283,5 @@ const listOperationsNextOperationSpec = {
2166
2283
  };
2167
2284
 
2168
2285
  exports.ApplicationClient = ApplicationClient;
2286
+ exports.getContinuationToken = getContinuationToken;
2169
2287
  //# sourceMappingURL=index.js.map