@azure/arm-locks 2.1.0-alpha.20221102.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.
- package/CHANGELOG.md +1 -2
- package/dist/index.js +178 -53
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist-esm/src/index.d.ts +1 -0
- package/dist-esm/src/index.d.ts.map +1 -1
- package/dist-esm/src/index.js +1 -0
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/managementLockClient.d.ts +2 -0
- package/dist-esm/src/managementLockClient.d.ts.map +1 -1
- package/dist-esm/src/managementLockClient.js +48 -17
- package/dist-esm/src/managementLockClient.js.map +1 -1
- package/dist-esm/src/models/index.d.ts +7 -0
- package/dist-esm/src/models/index.d.ts.map +1 -1
- package/dist-esm/src/models/index.js +7 -0
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/operations/authorizationOperations.d.ts.map +1 -1
- package/dist-esm/src/operations/authorizationOperations.js +19 -7
- package/dist-esm/src/operations/authorizationOperations.js.map +1 -1
- package/dist-esm/src/operations/managementLocks.d.ts.map +1 -1
- package/dist-esm/src/operations/managementLocks.js +73 -28
- package/dist-esm/src/operations/managementLocks.js.map +1 -1
- package/dist-esm/src/pagingHelper.d.ts +13 -0
- package/dist-esm/src/pagingHelper.d.ts.map +1 -0
- package/dist-esm/src/pagingHelper.js +32 -0
- package/dist-esm/src/pagingHelper.js.map +1 -0
- package/dist-esm/test/locks_examples.d.ts.map +1 -1
- package/dist-esm/test/locks_examples.js +32 -51
- package/dist-esm/test/locks_examples.js.map +1 -1
- package/package.json +12 -8
- package/review/arm-locks.api.md +3 -7
- package/src/index.ts +1 -0
- package/src/managementLockClient.ts +59 -19
- package/src/models/index.ts +7 -0
- package/src/operations/authorizationOperations.ts +21 -8
- package/src/operations/managementLocks.ts +91 -43
- package/src/pagingHelper.ts +39 -0
- package/tsconfig.json +0 -2
- package/types/arm-locks.d.ts +18 -0
package/CHANGELOG.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
-
## 2.1.0 (2022-
|
3
|
+
## 2.1.0 (2022-11-22)
|
4
4
|
|
5
5
|
**Features**
|
6
6
|
|
@@ -11,7 +11,6 @@
|
|
11
11
|
- Added Type Alias CreatedByType
|
12
12
|
- Interface ManagementLockObject has a new optional parameter systemData
|
13
13
|
- Added Enum KnownCreatedByType
|
14
|
-
- Bug fix
|
15
14
|
|
16
15
|
|
17
16
|
## 2.0.0 (2021-12-07)
|
package/dist/index.js
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
+
var tslib = require('tslib');
|
5
6
|
var coreClient = require('@azure/core-client');
|
6
7
|
var coreRestPipeline = require('@azure/core-rest-pipeline');
|
7
|
-
var tslib = require('tslib');
|
8
8
|
|
9
9
|
function _interopNamespace(e) {
|
10
10
|
if (e && e.__esModule) return e;
|
@@ -27,6 +27,38 @@ function _interopNamespace(e) {
|
|
27
27
|
var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
|
28
28
|
var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline);
|
29
29
|
|
30
|
+
/*
|
31
|
+
* Copyright (c) Microsoft Corporation.
|
32
|
+
* Licensed under the MIT License.
|
33
|
+
*
|
34
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
35
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
36
|
+
*/
|
37
|
+
const pageMap = new WeakMap();
|
38
|
+
/**
|
39
|
+
* Given a result page from a pageable operation, returns a
|
40
|
+
* continuation token that can be used to begin paging from
|
41
|
+
* that point later.
|
42
|
+
* @param page A result object from calling .byPage() on a paged operation.
|
43
|
+
* @returns The continuation token that can be passed into byPage().
|
44
|
+
*/
|
45
|
+
function getContinuationToken(page) {
|
46
|
+
var _a;
|
47
|
+
if (typeof page !== "object" || page === null) {
|
48
|
+
return undefined;
|
49
|
+
}
|
50
|
+
return (_a = pageMap.get(page)) === null || _a === void 0 ? void 0 : _a.continuationToken;
|
51
|
+
}
|
52
|
+
function setContinuationToken(page, continuationToken) {
|
53
|
+
var _a;
|
54
|
+
if (typeof page !== "object" || page === null || !continuationToken) {
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {};
|
58
|
+
pageInfo.continuationToken = continuationToken;
|
59
|
+
pageMap.set(page, pageInfo);
|
60
|
+
}
|
61
|
+
|
30
62
|
/*
|
31
63
|
* Copyright (c) Microsoft Corporation.
|
32
64
|
* Licensed under the MIT License.
|
@@ -37,16 +69,23 @@ var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipelin
|
|
37
69
|
/** Known values of {@link LockLevel} that the service accepts. */
|
38
70
|
exports.KnownLockLevel = void 0;
|
39
71
|
(function (KnownLockLevel) {
|
72
|
+
/** NotSpecified */
|
40
73
|
KnownLockLevel["NotSpecified"] = "NotSpecified";
|
74
|
+
/** CanNotDelete */
|
41
75
|
KnownLockLevel["CanNotDelete"] = "CanNotDelete";
|
76
|
+
/** ReadOnly */
|
42
77
|
KnownLockLevel["ReadOnly"] = "ReadOnly";
|
43
78
|
})(exports.KnownLockLevel || (exports.KnownLockLevel = {}));
|
44
79
|
/** Known values of {@link CreatedByType} that the service accepts. */
|
45
80
|
exports.KnownCreatedByType = void 0;
|
46
81
|
(function (KnownCreatedByType) {
|
82
|
+
/** User */
|
47
83
|
KnownCreatedByType["User"] = "User";
|
84
|
+
/** Application */
|
48
85
|
KnownCreatedByType["Application"] = "Application";
|
86
|
+
/** ManagedIdentity */
|
49
87
|
KnownCreatedByType["ManagedIdentity"] = "ManagedIdentity";
|
88
|
+
/** Key */
|
50
89
|
KnownCreatedByType["Key"] = "Key";
|
51
90
|
})(exports.KnownCreatedByType || (exports.KnownCreatedByType = {}));
|
52
91
|
|
@@ -576,20 +615,31 @@ class AuthorizationOperationsImpl {
|
|
576
615
|
[Symbol.asyncIterator]() {
|
577
616
|
return this;
|
578
617
|
},
|
579
|
-
byPage: () => {
|
580
|
-
|
618
|
+
byPage: (settings) => {
|
619
|
+
if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
|
620
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
621
|
+
}
|
622
|
+
return this.listPagingPage(options, settings);
|
581
623
|
}
|
582
624
|
};
|
583
625
|
}
|
584
|
-
listPagingPage(options) {
|
626
|
+
listPagingPage(options, settings) {
|
585
627
|
return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
|
586
|
-
let result
|
587
|
-
|
588
|
-
|
628
|
+
let result;
|
629
|
+
let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
|
630
|
+
if (!continuationToken) {
|
631
|
+
result = yield tslib.__await(this._list(options));
|
632
|
+
let page = result.value || [];
|
633
|
+
continuationToken = result.nextLink;
|
634
|
+
setContinuationToken(page, continuationToken);
|
635
|
+
yield yield tslib.__await(page);
|
636
|
+
}
|
589
637
|
while (continuationToken) {
|
590
638
|
result = yield tslib.__await(this._listNext(continuationToken, options));
|
591
639
|
continuationToken = result.nextLink;
|
592
|
-
|
640
|
+
let page = result.value || [];
|
641
|
+
setContinuationToken(page, continuationToken);
|
642
|
+
yield yield tslib.__await(page);
|
593
643
|
}
|
594
644
|
});
|
595
645
|
}
|
@@ -693,20 +743,31 @@ class ManagementLocksImpl {
|
|
693
743
|
[Symbol.asyncIterator]() {
|
694
744
|
return this;
|
695
745
|
},
|
696
|
-
byPage: () => {
|
697
|
-
|
746
|
+
byPage: (settings) => {
|
747
|
+
if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
|
748
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
749
|
+
}
|
750
|
+
return this.listAtResourceGroupLevelPagingPage(resourceGroupName, options, settings);
|
698
751
|
}
|
699
752
|
};
|
700
753
|
}
|
701
|
-
listAtResourceGroupLevelPagingPage(resourceGroupName, options) {
|
754
|
+
listAtResourceGroupLevelPagingPage(resourceGroupName, options, settings) {
|
702
755
|
return tslib.__asyncGenerator(this, arguments, function* listAtResourceGroupLevelPagingPage_1() {
|
703
|
-
let result
|
704
|
-
|
705
|
-
|
756
|
+
let result;
|
757
|
+
let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
|
758
|
+
if (!continuationToken) {
|
759
|
+
result = yield tslib.__await(this._listAtResourceGroupLevel(resourceGroupName, options));
|
760
|
+
let page = result.value || [];
|
761
|
+
continuationToken = result.nextLink;
|
762
|
+
setContinuationToken(page, continuationToken);
|
763
|
+
yield yield tslib.__await(page);
|
764
|
+
}
|
706
765
|
while (continuationToken) {
|
707
766
|
result = yield tslib.__await(this._listAtResourceGroupLevelNext(resourceGroupName, continuationToken, options));
|
708
767
|
continuationToken = result.nextLink;
|
709
|
-
|
768
|
+
let page = result.value || [];
|
769
|
+
setContinuationToken(page, continuationToken);
|
770
|
+
yield yield tslib.__await(page);
|
710
771
|
}
|
711
772
|
});
|
712
773
|
}
|
@@ -747,20 +808,31 @@ class ManagementLocksImpl {
|
|
747
808
|
[Symbol.asyncIterator]() {
|
748
809
|
return this;
|
749
810
|
},
|
750
|
-
byPage: () => {
|
751
|
-
|
811
|
+
byPage: (settings) => {
|
812
|
+
if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
|
813
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
814
|
+
}
|
815
|
+
return this.listAtResourceLevelPagingPage(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options, settings);
|
752
816
|
}
|
753
817
|
};
|
754
818
|
}
|
755
|
-
listAtResourceLevelPagingPage(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options) {
|
819
|
+
listAtResourceLevelPagingPage(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options, settings) {
|
756
820
|
return tslib.__asyncGenerator(this, arguments, function* listAtResourceLevelPagingPage_1() {
|
757
|
-
let result
|
758
|
-
|
759
|
-
|
821
|
+
let result;
|
822
|
+
let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
|
823
|
+
if (!continuationToken) {
|
824
|
+
result = yield tslib.__await(this._listAtResourceLevel(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, options));
|
825
|
+
let page = result.value || [];
|
826
|
+
continuationToken = result.nextLink;
|
827
|
+
setContinuationToken(page, continuationToken);
|
828
|
+
yield yield tslib.__await(page);
|
829
|
+
}
|
760
830
|
while (continuationToken) {
|
761
831
|
result = yield tslib.__await(this._listAtResourceLevelNext(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, continuationToken, options));
|
762
832
|
continuationToken = result.nextLink;
|
763
|
-
|
833
|
+
let page = result.value || [];
|
834
|
+
setContinuationToken(page, continuationToken);
|
835
|
+
yield yield tslib.__await(page);
|
764
836
|
}
|
765
837
|
});
|
766
838
|
}
|
@@ -795,20 +867,31 @@ class ManagementLocksImpl {
|
|
795
867
|
[Symbol.asyncIterator]() {
|
796
868
|
return this;
|
797
869
|
},
|
798
|
-
byPage: () => {
|
799
|
-
|
870
|
+
byPage: (settings) => {
|
871
|
+
if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
|
872
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
873
|
+
}
|
874
|
+
return this.listAtSubscriptionLevelPagingPage(options, settings);
|
800
875
|
}
|
801
876
|
};
|
802
877
|
}
|
803
|
-
listAtSubscriptionLevelPagingPage(options) {
|
878
|
+
listAtSubscriptionLevelPagingPage(options, settings) {
|
804
879
|
return tslib.__asyncGenerator(this, arguments, function* listAtSubscriptionLevelPagingPage_1() {
|
805
|
-
let result
|
806
|
-
|
807
|
-
|
880
|
+
let result;
|
881
|
+
let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
|
882
|
+
if (!continuationToken) {
|
883
|
+
result = yield tslib.__await(this._listAtSubscriptionLevel(options));
|
884
|
+
let page = result.value || [];
|
885
|
+
continuationToken = result.nextLink;
|
886
|
+
setContinuationToken(page, continuationToken);
|
887
|
+
yield yield tslib.__await(page);
|
888
|
+
}
|
808
889
|
while (continuationToken) {
|
809
890
|
result = yield tslib.__await(this._listAtSubscriptionLevelNext(continuationToken, options));
|
810
891
|
continuationToken = result.nextLink;
|
811
|
-
|
892
|
+
let page = result.value || [];
|
893
|
+
setContinuationToken(page, continuationToken);
|
894
|
+
yield yield tslib.__await(page);
|
812
895
|
}
|
813
896
|
});
|
814
897
|
}
|
@@ -848,20 +931,31 @@ class ManagementLocksImpl {
|
|
848
931
|
[Symbol.asyncIterator]() {
|
849
932
|
return this;
|
850
933
|
},
|
851
|
-
byPage: () => {
|
852
|
-
|
934
|
+
byPage: (settings) => {
|
935
|
+
if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
|
936
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
937
|
+
}
|
938
|
+
return this.listByScopePagingPage(scope, options, settings);
|
853
939
|
}
|
854
940
|
};
|
855
941
|
}
|
856
|
-
listByScopePagingPage(scope, options) {
|
942
|
+
listByScopePagingPage(scope, options, settings) {
|
857
943
|
return tslib.__asyncGenerator(this, arguments, function* listByScopePagingPage_1() {
|
858
|
-
let result
|
859
|
-
|
860
|
-
|
944
|
+
let result;
|
945
|
+
let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
|
946
|
+
if (!continuationToken) {
|
947
|
+
result = yield tslib.__await(this._listByScope(scope, options));
|
948
|
+
let page = result.value || [];
|
949
|
+
continuationToken = result.nextLink;
|
950
|
+
setContinuationToken(page, continuationToken);
|
951
|
+
yield yield tslib.__await(page);
|
952
|
+
}
|
861
953
|
while (continuationToken) {
|
862
954
|
result = yield tslib.__await(this._listByScopeNext(scope, continuationToken, options));
|
863
955
|
continuationToken = result.nextLink;
|
864
|
-
|
956
|
+
let page = result.value || [];
|
957
|
+
setContinuationToken(page, continuationToken);
|
958
|
+
yield yield tslib.__await(page);
|
865
959
|
}
|
866
960
|
});
|
867
961
|
}
|
@@ -1593,7 +1687,7 @@ class ManagementLockClient extends coreClient__namespace.ServiceClient {
|
|
1593
1687
|
* @param options The parameter options
|
1594
1688
|
*/
|
1595
1689
|
constructor(credentials, subscriptionId, options) {
|
1596
|
-
var _a, _b;
|
1690
|
+
var _a, _b, _c;
|
1597
1691
|
if (credentials === undefined) {
|
1598
1692
|
throw new Error("'credentials' cannot be null");
|
1599
1693
|
}
|
@@ -1612,28 +1706,30 @@ class ManagementLockClient extends coreClient__namespace.ServiceClient {
|
|
1612
1706
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
1613
1707
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
1614
1708
|
: `${packageDetails}`;
|
1615
|
-
if (!options.credentialScopes) {
|
1616
|
-
options.credentialScopes = ["https://management.azure.com/.default"];
|
1617
|
-
}
|
1618
1709
|
const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
|
1619
1710
|
userAgentPrefix
|
1620
|
-
},
|
1711
|
+
}, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
|
1621
1712
|
super(optionsWithDefaults);
|
1713
|
+
let bearerTokenAuthenticationPolicyFound = false;
|
1622
1714
|
if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
|
1623
1715
|
const pipelinePolicies = options.pipeline.getOrderedPolicies();
|
1624
|
-
|
1716
|
+
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
|
1625
1717
|
coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1718
|
+
}
|
1719
|
+
if (!options ||
|
1720
|
+
!options.pipeline ||
|
1721
|
+
options.pipeline.getOrderedPolicies().length == 0 ||
|
1722
|
+
!bearerTokenAuthenticationPolicyFound) {
|
1723
|
+
this.pipeline.removePolicy({
|
1724
|
+
name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
|
1725
|
+
});
|
1726
|
+
this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
|
1727
|
+
credential: credentials,
|
1728
|
+
scopes: (_c = optionsWithDefaults.credentialScopes) !== null && _c !== void 0 ? _c : `${optionsWithDefaults.endpoint}/.default`,
|
1729
|
+
challengeCallbacks: {
|
1730
|
+
authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
|
1731
|
+
}
|
1732
|
+
}));
|
1637
1733
|
}
|
1638
1734
|
// Parameter assignments
|
1639
1735
|
this.subscriptionId = subscriptionId;
|
@@ -1642,8 +1738,37 @@ class ManagementLockClient extends coreClient__namespace.ServiceClient {
|
|
1642
1738
|
this.apiVersion = options.apiVersion || "2020-05-01";
|
1643
1739
|
this.authorizationOperations = new AuthorizationOperationsImpl(this);
|
1644
1740
|
this.managementLocks = new ManagementLocksImpl(this);
|
1741
|
+
this.addCustomApiVersionPolicy(options.apiVersion);
|
1742
|
+
}
|
1743
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
1744
|
+
addCustomApiVersionPolicy(apiVersion) {
|
1745
|
+
if (!apiVersion) {
|
1746
|
+
return;
|
1747
|
+
}
|
1748
|
+
const apiVersionPolicy = {
|
1749
|
+
name: "CustomApiVersionPolicy",
|
1750
|
+
sendRequest(request, next) {
|
1751
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
1752
|
+
const param = request.url.split("?");
|
1753
|
+
if (param.length > 1) {
|
1754
|
+
const newParams = param[1].split("&").map((item) => {
|
1755
|
+
if (item.indexOf("api-version") > -1) {
|
1756
|
+
return "api-version=" + apiVersion;
|
1757
|
+
}
|
1758
|
+
else {
|
1759
|
+
return item;
|
1760
|
+
}
|
1761
|
+
});
|
1762
|
+
request.url = param[0] + "?" + newParams.join("&");
|
1763
|
+
}
|
1764
|
+
return next(request);
|
1765
|
+
});
|
1766
|
+
}
|
1767
|
+
};
|
1768
|
+
this.pipeline.addPolicy(apiVersionPolicy);
|
1645
1769
|
}
|
1646
1770
|
}
|
1647
1771
|
|
1648
1772
|
exports.ManagementLockClient = ManagementLockClient;
|
1773
|
+
exports.getContinuationToken = getContinuationToken;
|
1649
1774
|
//# sourceMappingURL=index.js.map
|