@spottoai/types-package 1.0.2-beta.422 → 1.0.2-beta.424
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/azure/governance.d.ts +5 -0
- package/dist/azure/governance.d.ts.map +1 -1
- package/dist/azure/payloads.d.ts +24 -0
- package/dist/azure/payloads.d.ts.map +1 -1
- package/dist/azure/payloads.js +88 -0
- package/dist/azure/payloads.js.map +1 -1
- package/dist/azure/reportEvidence.d.ts +9 -3
- package/dist/azure/reportEvidence.d.ts.map +1 -1
- package/dist/azure/reportEvidenceValidation.d.ts.map +1 -1
- package/dist/azure/reportEvidenceValidation.js +9 -0
- package/dist/azure/reportEvidenceValidation.js.map +1 -1
- package/dist/esm/azure/payloads.js +85 -1
- package/dist/esm/azure/reportEvidenceValidation.js +9 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/scheduler/bastionSchedule.js +1 -0
- package/dist/esm/scheduler/bastionScheduleProfile.js +206 -0
- package/dist/esm/scheduler/bastionScheduleValidation.js +399 -0
- package/dist/esm/scheduler/resourceStrategyContracts.js +4 -0
- package/dist/esm/scheduler/resourceStrategyScheduleValidation.js +67 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/scheduler/bastionSchedule.d.ts +113 -0
- package/dist/scheduler/bastionSchedule.d.ts.map +1 -0
- package/dist/scheduler/bastionSchedule.js +3 -0
- package/dist/scheduler/bastionSchedule.js.map +1 -0
- package/dist/scheduler/bastionScheduleProfile.d.ts +24 -0
- package/dist/scheduler/bastionScheduleProfile.d.ts.map +1 -0
- package/dist/scheduler/bastionScheduleProfile.js +210 -0
- package/dist/scheduler/bastionScheduleProfile.js.map +1 -0
- package/dist/scheduler/bastionScheduleValidation.d.ts +10 -0
- package/dist/scheduler/bastionScheduleValidation.d.ts.map +1 -0
- package/dist/scheduler/bastionScheduleValidation.js +410 -0
- package/dist/scheduler/bastionScheduleValidation.js.map +1 -0
- package/dist/scheduler/resourceStrategyContracts.d.ts +26 -0
- package/dist/scheduler/resourceStrategyContracts.d.ts.map +1 -1
- package/dist/scheduler/resourceStrategyContracts.js +4 -0
- package/dist/scheduler/resourceStrategyContracts.js.map +1 -1
- package/dist/scheduler/resourceStrategyScheduleValidation.d.ts +3 -1
- package/dist/scheduler/resourceStrategyScheduleValidation.d.ts.map +1 -1
- package/dist/scheduler/resourceStrategyScheduleValidation.js +68 -1
- package/dist/scheduler/resourceStrategyScheduleValidation.js.map +1 -1
- package/dist/scheduler/scheduler.d.ts +159 -6
- package/dist/scheduler/scheduler.d.ts.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
const MAX_ID_LENGTH = 2048;
|
|
2
|
+
const MAX_NAME_LENGTH = 120;
|
|
3
|
+
const MAX_NOTES_LENGTH = 1000;
|
|
4
|
+
const MAX_ACTION_COUNT = 64;
|
|
5
|
+
const MAX_WINDOWS = 14;
|
|
6
|
+
const MAX_WRITE_REQUEST_BYTES = 32 * 1024;
|
|
7
|
+
const MAX_PUBLIC_DTO_BYTES = 16 * 1024;
|
|
8
|
+
const MINUTES_PER_WEEK = 7 * 24 * 60;
|
|
9
|
+
const readinessStatuses = new Set(['confirmed', 'missing', 'unknown', 'unsupported']);
|
|
10
|
+
const readinessReasonCodes = new Set([
|
|
11
|
+
'feature-disabled',
|
|
12
|
+
'resource-not-found',
|
|
13
|
+
'unsupported-profile',
|
|
14
|
+
'unsupported-region',
|
|
15
|
+
'missing-permission',
|
|
16
|
+
'permission-unknown',
|
|
17
|
+
'management-lock',
|
|
18
|
+
]);
|
|
19
|
+
const availabilityPhases = new Set(['available', 'removing', 'absent', 'restoring']);
|
|
20
|
+
const availabilityResults = new Set(['succeeded', 'skipped', 'blocked', 'failed', 'pending']);
|
|
21
|
+
const availabilityReasonCodes = new Set([
|
|
22
|
+
...readinessReasonCodes,
|
|
23
|
+
'active-sessions',
|
|
24
|
+
'session-state-unknown',
|
|
25
|
+
'snapshot-failed',
|
|
26
|
+
'active-snapshot-missing',
|
|
27
|
+
'source-drift',
|
|
28
|
+
'dependency-missing',
|
|
29
|
+
'dependency-drift',
|
|
30
|
+
'stale-run',
|
|
31
|
+
'continuation-overdue',
|
|
32
|
+
'azure-operation-failed',
|
|
33
|
+
'restore-timeout',
|
|
34
|
+
]);
|
|
35
|
+
function isPlainRecord(value) {
|
|
36
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
const prototype = Object.getPrototypeOf(value);
|
|
41
|
+
return prototype === Object.prototype || prototype === null;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function hasExactFields(value, requiredFields, optionalFields = []) {
|
|
48
|
+
if (!isPlainRecord(value)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const allowedFields = new Set([...requiredFields, ...optionalFields]);
|
|
53
|
+
const keys = Object.keys(value);
|
|
54
|
+
return requiredFields.every(field => Object.prototype.hasOwnProperty.call(value, field)) && keys.every(field => allowedFields.has(field));
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function utf8ByteLength(value) {
|
|
61
|
+
let bytes = 0;
|
|
62
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
63
|
+
const code = value.charCodeAt(index);
|
|
64
|
+
if (code <= 0x7f) {
|
|
65
|
+
bytes += 1;
|
|
66
|
+
}
|
|
67
|
+
else if (code <= 0x7ff) {
|
|
68
|
+
bytes += 2;
|
|
69
|
+
}
|
|
70
|
+
else if (code >= 0xd800 &&
|
|
71
|
+
code <= 0xdbff &&
|
|
72
|
+
index + 1 < value.length &&
|
|
73
|
+
value.charCodeAt(index + 1) >= 0xdc00 &&
|
|
74
|
+
value.charCodeAt(index + 1) <= 0xdfff) {
|
|
75
|
+
bytes += 4;
|
|
76
|
+
index += 1;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
bytes += 3;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return bytes;
|
|
83
|
+
}
|
|
84
|
+
function isWithinJsonSize(value, maximumBytes) {
|
|
85
|
+
try {
|
|
86
|
+
const json = JSON.stringify(value);
|
|
87
|
+
return typeof json === 'string' && utf8ByteLength(json) <= maximumBytes;
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function isBoundedString(value, maximumLength, allowEmpty = false) {
|
|
94
|
+
return typeof value === 'string' && value.length <= maximumLength && (allowEmpty || value.trim().length > 0);
|
|
95
|
+
}
|
|
96
|
+
function isPositiveSafeInteger(value) {
|
|
97
|
+
return Number.isSafeInteger(value) && typeof value === 'number' && value > 0;
|
|
98
|
+
}
|
|
99
|
+
function isIsoUtcTimestamp(value) {
|
|
100
|
+
if (typeof value !== 'string' || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z$/.test(value)) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
const parsed = new Date(value);
|
|
104
|
+
if (!Number.isFinite(parsed.getTime())) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
const normalizedInput = value.includes('.')
|
|
108
|
+
? value.replace(/\.(\d{1,3})Z$/, (_, fraction) => `.${fraction.padEnd(3, '0')}Z`)
|
|
109
|
+
: value.replace('Z', '.000Z');
|
|
110
|
+
return parsed.toISOString() === normalizedInput;
|
|
111
|
+
}
|
|
112
|
+
function localTimeToMinutes(value) {
|
|
113
|
+
if (typeof value !== 'string' || !/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(value)) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
const [hours, minutes] = value.split(':');
|
|
117
|
+
return Number(hours) * 60 + Number(minutes);
|
|
118
|
+
}
|
|
119
|
+
function isUniqueBoundedStringArray(value, minimumLength, maximumLength) {
|
|
120
|
+
if (!Array.isArray(value) ||
|
|
121
|
+
value.length < minimumLength ||
|
|
122
|
+
value.length > maximumLength ||
|
|
123
|
+
!value.every(item => isBoundedString(item, MAX_ID_LENGTH))) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
return new Set(value).size === value.length;
|
|
127
|
+
}
|
|
128
|
+
function isAvailabilityConfiguration(value) {
|
|
129
|
+
if (!hasExactFields(value, ['accessWindows'])) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
const windows = value.accessWindows;
|
|
133
|
+
if (!Array.isArray(windows) || windows.length < 1 || windows.length > MAX_WINDOWS) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
const windowIds = new Set();
|
|
137
|
+
const intervals = [];
|
|
138
|
+
for (const window of windows) {
|
|
139
|
+
if (!hasExactFields(window, ['windowId', 'daysOfWeek', 'accessStartTimeLocal', 'accessEndTimeLocal']) ||
|
|
140
|
+
!isBoundedString(window.windowId, MAX_ID_LENGTH) ||
|
|
141
|
+
windowIds.has(window.windowId)) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
windowIds.add(window.windowId);
|
|
145
|
+
if (!Array.isArray(window.daysOfWeek) ||
|
|
146
|
+
window.daysOfWeek.length < 1 ||
|
|
147
|
+
window.daysOfWeek.length > 7 ||
|
|
148
|
+
!window.daysOfWeek.every(day => Number.isInteger(day) && typeof day === 'number' && day >= 0 && day <= 6) ||
|
|
149
|
+
new Set(window.daysOfWeek).size !== window.daysOfWeek.length) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
const startTime = localTimeToMinutes(window.accessStartTimeLocal);
|
|
153
|
+
const endTime = localTimeToMinutes(window.accessEndTimeLocal);
|
|
154
|
+
if (startTime === undefined || endTime === undefined || startTime === endTime) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
for (const day of window.daysOfWeek) {
|
|
158
|
+
const start = day * 24 * 60 + startTime;
|
|
159
|
+
const end = day * 24 * 60 + endTime + (endTime <= startTime ? 24 * 60 : 0);
|
|
160
|
+
intervals.push({ start, end });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return !intervals.some((left, leftIndex) => intervals.some((right, rightIndex) => {
|
|
164
|
+
if (rightIndex <= leftIndex) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
return [-MINUTES_PER_WEEK, 0, MINUTES_PER_WEEK].some(offset => {
|
|
168
|
+
const shiftedStart = right.start + offset;
|
|
169
|
+
const shiftedEnd = right.end + offset;
|
|
170
|
+
return left.start < shiftedEnd && shiftedStart < left.end;
|
|
171
|
+
});
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
export function isBastionAvailabilityWeeklyScheduleWriteRequest(value) {
|
|
175
|
+
if (!isWithinJsonSize(value, MAX_WRITE_REQUEST_BYTES) ||
|
|
176
|
+
!hasExactFields(value, [
|
|
177
|
+
'definitionType',
|
|
178
|
+
'name',
|
|
179
|
+
'providerName',
|
|
180
|
+
'providerScopeId',
|
|
181
|
+
'cloudAccountId',
|
|
182
|
+
'resourceId',
|
|
183
|
+
'timezone',
|
|
184
|
+
'acknowledgementVersion',
|
|
185
|
+
'configuration',
|
|
186
|
+
], ['targetResourceType', 'notes'])) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
return (value.definitionType === 'bastion-availability-weekly' &&
|
|
190
|
+
isBoundedString(value.name, MAX_NAME_LENGTH) &&
|
|
191
|
+
isBoundedString(value.providerName, MAX_ID_LENGTH) &&
|
|
192
|
+
isBoundedString(value.providerScopeId, MAX_ID_LENGTH) &&
|
|
193
|
+
isBoundedString(value.cloudAccountId, MAX_ID_LENGTH) &&
|
|
194
|
+
isBoundedString(value.resourceId, MAX_ID_LENGTH) &&
|
|
195
|
+
isBoundedString(value.timezone, MAX_ID_LENGTH) &&
|
|
196
|
+
(value.targetResourceType === undefined || value.targetResourceType === 'Microsoft.Network/bastionHosts') &&
|
|
197
|
+
(value.notes === undefined || isBoundedString(value.notes, MAX_NOTES_LENGTH, true)) &&
|
|
198
|
+
value.acknowledgementVersion === 'bastion-delete-recreate-v1' &&
|
|
199
|
+
isAvailabilityConfiguration(value.configuration));
|
|
200
|
+
}
|
|
201
|
+
export function isBastionAvailabilityWeeklyScheduleDefinition(value) {
|
|
202
|
+
if (!isWithinJsonSize(value, MAX_PUBLIC_DTO_BYTES) ||
|
|
203
|
+
!hasExactFields(value, [
|
|
204
|
+
'definitionId',
|
|
205
|
+
'definitionClass',
|
|
206
|
+
'definitionType',
|
|
207
|
+
'companyId',
|
|
208
|
+
'providerName',
|
|
209
|
+
'providerScopeId',
|
|
210
|
+
'cloudAccountId',
|
|
211
|
+
'resourceId',
|
|
212
|
+
'targetResourceType',
|
|
213
|
+
'name',
|
|
214
|
+
'timezone',
|
|
215
|
+
'status',
|
|
216
|
+
'definitionRevision',
|
|
217
|
+
'acknowledgementVersion',
|
|
218
|
+
'configuration',
|
|
219
|
+
'createdAtUtc',
|
|
220
|
+
'updatedAtUtc',
|
|
221
|
+
], ['notes', 'compiledScheduleIds', 'nextRunUtc', 'lastRunAtUtc', 'lastSuccessfulRunAtUtc', 'lastRunStatus', 'createdByUserId', 'updatedByUserId'])) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
return (value.definitionId !== undefined &&
|
|
225
|
+
isBoundedString(value.definitionId, MAX_ID_LENGTH) &&
|
|
226
|
+
value.definitionClass === 'composite' &&
|
|
227
|
+
value.definitionType === 'bastion-availability-weekly' &&
|
|
228
|
+
isBoundedString(value.companyId, MAX_ID_LENGTH) &&
|
|
229
|
+
isBoundedString(value.providerName, MAX_ID_LENGTH) &&
|
|
230
|
+
isBoundedString(value.providerScopeId, MAX_ID_LENGTH) &&
|
|
231
|
+
isBoundedString(value.cloudAccountId, MAX_ID_LENGTH) &&
|
|
232
|
+
isBoundedString(value.resourceId, MAX_ID_LENGTH) &&
|
|
233
|
+
value.targetResourceType === 'Microsoft.Network/bastionHosts' &&
|
|
234
|
+
isBoundedString(value.name, MAX_NAME_LENGTH) &&
|
|
235
|
+
isBoundedString(value.timezone, MAX_ID_LENGTH) &&
|
|
236
|
+
(value.status === 'active' || value.status === 'paused') &&
|
|
237
|
+
isPositiveSafeInteger(value.definitionRevision) &&
|
|
238
|
+
value.acknowledgementVersion === 'bastion-delete-recreate-v1' &&
|
|
239
|
+
isAvailabilityConfiguration(value.configuration) &&
|
|
240
|
+
(value.notes === undefined || isBoundedString(value.notes, MAX_NOTES_LENGTH, true)) &&
|
|
241
|
+
(value.compiledScheduleIds === undefined || isUniqueBoundedStringArray(value.compiledScheduleIds, 0, 28)) &&
|
|
242
|
+
(value.nextRunUtc === undefined || isIsoUtcTimestamp(value.nextRunUtc)) &&
|
|
243
|
+
(value.lastRunAtUtc === undefined || isIsoUtcTimestamp(value.lastRunAtUtc)) &&
|
|
244
|
+
(value.lastSuccessfulRunAtUtc === undefined || isIsoUtcTimestamp(value.lastSuccessfulRunAtUtc)) &&
|
|
245
|
+
(value.lastRunStatus === undefined ||
|
|
246
|
+
value.lastRunStatus === 'success' ||
|
|
247
|
+
value.lastRunStatus === 'dispatch-failed' ||
|
|
248
|
+
value.lastRunStatus === 'dispatching') &&
|
|
249
|
+
isIsoUtcTimestamp(value.createdAtUtc) &&
|
|
250
|
+
isIsoUtcTimestamp(value.updatedAtUtc) &&
|
|
251
|
+
(value.createdByUserId === undefined || isBoundedString(value.createdByUserId, MAX_ID_LENGTH)) &&
|
|
252
|
+
(value.updatedByUserId === undefined || isBoundedString(value.updatedByUserId, MAX_ID_LENGTH)));
|
|
253
|
+
}
|
|
254
|
+
export function isBastionScheduleRun(value) {
|
|
255
|
+
if (!isWithinJsonSize(value, MAX_PUBLIC_DTO_BYTES) ||
|
|
256
|
+
!isPlainRecord(value) ||
|
|
257
|
+
(value['compiledOperation'] !== 'remove' && value['compiledOperation'] !== 'restore')) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
const commonRequiredFields = [
|
|
261
|
+
'scheduleId',
|
|
262
|
+
'scheduleRunId',
|
|
263
|
+
'targetType',
|
|
264
|
+
'selectorType',
|
|
265
|
+
'scheduleType',
|
|
266
|
+
'providerScopeId',
|
|
267
|
+
'cloudAccountId',
|
|
268
|
+
'resourceId',
|
|
269
|
+
'definitionId',
|
|
270
|
+
'definitionClass',
|
|
271
|
+
'definitionType',
|
|
272
|
+
'compiledRuleId',
|
|
273
|
+
'compiledOperation',
|
|
274
|
+
'definitionRevision',
|
|
275
|
+
'scheduledForUtc',
|
|
276
|
+
];
|
|
277
|
+
const requiredFields = value['compiledOperation'] === 'remove' ? [...commonRequiredFields, 'controlGeneration'] : commonRequiredFields;
|
|
278
|
+
if (!hasExactFields(value, requiredFields, [
|
|
279
|
+
'scheduleName',
|
|
280
|
+
'scheduleGroupId',
|
|
281
|
+
'scheduleGroupType',
|
|
282
|
+
'targetCount',
|
|
283
|
+
'createdByUserId',
|
|
284
|
+
'updatedByUserId',
|
|
285
|
+
])) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
return (isBoundedString(value.scheduleId, MAX_ID_LENGTH) &&
|
|
289
|
+
isBoundedString(value.scheduleRunId, MAX_ID_LENGTH) &&
|
|
290
|
+
(value.scheduleName === undefined || isBoundedString(value.scheduleName, MAX_NAME_LENGTH)) &&
|
|
291
|
+
value.targetType === 'resource-operation' &&
|
|
292
|
+
value.selectorType === 'single-resource' &&
|
|
293
|
+
value.scheduleType === 'recurring' &&
|
|
294
|
+
isBoundedString(value.providerScopeId, MAX_ID_LENGTH) &&
|
|
295
|
+
isBoundedString(value.cloudAccountId, MAX_ID_LENGTH) &&
|
|
296
|
+
isBoundedString(value.resourceId, MAX_ID_LENGTH) &&
|
|
297
|
+
isBoundedString(value.definitionId, MAX_ID_LENGTH) &&
|
|
298
|
+
value.definitionClass === 'composite' &&
|
|
299
|
+
value.definitionType === 'bastion-availability-weekly' &&
|
|
300
|
+
isBoundedString(value.compiledRuleId, MAX_ID_LENGTH) &&
|
|
301
|
+
isPositiveSafeInteger(value.definitionRevision) &&
|
|
302
|
+
isIsoUtcTimestamp(value.scheduledForUtc) &&
|
|
303
|
+
(value.scheduleGroupId === undefined || isBoundedString(value.scheduleGroupId, MAX_ID_LENGTH)) &&
|
|
304
|
+
(value.scheduleGroupType === undefined || value.scheduleGroupType === 'resource-schedule-definition') &&
|
|
305
|
+
(value.targetCount === undefined || value.targetCount === 1) &&
|
|
306
|
+
(value.createdByUserId === undefined || isBoundedString(value.createdByUserId, MAX_ID_LENGTH)) &&
|
|
307
|
+
(value.updatedByUserId === undefined || isBoundedString(value.updatedByUserId, MAX_ID_LENGTH)) &&
|
|
308
|
+
(value.compiledOperation === 'restore' || isPositiveSafeInteger(value.controlGeneration)));
|
|
309
|
+
}
|
|
310
|
+
export function isBastionScheduleControlV1(value) {
|
|
311
|
+
return (isWithinJsonSize(value, MAX_PUBLIC_DTO_BYTES) &&
|
|
312
|
+
hasExactFields(value, [
|
|
313
|
+
'schemaVersion',
|
|
314
|
+
'companyId',
|
|
315
|
+
'resourceId',
|
|
316
|
+
'definitionId',
|
|
317
|
+
'definitionRevision',
|
|
318
|
+
'controlGeneration',
|
|
319
|
+
'desiredStatus',
|
|
320
|
+
'updatedAtUtc',
|
|
321
|
+
]) &&
|
|
322
|
+
value.schemaVersion === 1 &&
|
|
323
|
+
isBoundedString(value.companyId, MAX_ID_LENGTH) &&
|
|
324
|
+
isBoundedString(value.resourceId, MAX_ID_LENGTH) &&
|
|
325
|
+
isBoundedString(value.definitionId, MAX_ID_LENGTH) &&
|
|
326
|
+
isPositiveSafeInteger(value.definitionRevision) &&
|
|
327
|
+
isPositiveSafeInteger(value.controlGeneration) &&
|
|
328
|
+
(value.desiredStatus === 'active' || value.desiredStatus === 'paused') &&
|
|
329
|
+
isIsoUtcTimestamp(value.updatedAtUtc));
|
|
330
|
+
}
|
|
331
|
+
export function isBastionScheduleReadinessV1(value) {
|
|
332
|
+
if (!isWithinJsonSize(value, MAX_PUBLIC_DTO_BYTES) ||
|
|
333
|
+
!hasExactFields(value, ['schemaVersion', 'status', 'companyId', 'cloudAccountId', 'subscriptionId', 'resourceId', 'requiredActions', 'missingActions', 'checkedAtUtc'], ['reasonCode'])) {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
const requiredActions = value.requiredActions;
|
|
337
|
+
const missingActions = value.missingActions;
|
|
338
|
+
if (value.schemaVersion !== 1 ||
|
|
339
|
+
typeof value.status !== 'string' ||
|
|
340
|
+
!readinessStatuses.has(value.status) ||
|
|
341
|
+
!isBoundedString(value.companyId, MAX_ID_LENGTH) ||
|
|
342
|
+
!isBoundedString(value.cloudAccountId, MAX_ID_LENGTH) ||
|
|
343
|
+
!isBoundedString(value.subscriptionId, MAX_ID_LENGTH) ||
|
|
344
|
+
!isBoundedString(value.resourceId, MAX_ID_LENGTH) ||
|
|
345
|
+
!isUniqueBoundedStringArray(requiredActions, 1, MAX_ACTION_COUNT) ||
|
|
346
|
+
!isUniqueBoundedStringArray(missingActions, 0, MAX_ACTION_COUNT) ||
|
|
347
|
+
!missingActions.every(action => requiredActions.includes(action)) ||
|
|
348
|
+
(value.status === 'confirmed' && missingActions.length !== 0) ||
|
|
349
|
+
(value.status === 'missing' && missingActions.length === 0) ||
|
|
350
|
+
!isIsoUtcTimestamp(value.checkedAtUtc)) {
|
|
351
|
+
return false;
|
|
352
|
+
}
|
|
353
|
+
return value.reasonCode === undefined || (typeof value.reasonCode === 'string' && readinessReasonCodes.has(value.reasonCode));
|
|
354
|
+
}
|
|
355
|
+
export function isBastionAvailabilityStatusV1(value) {
|
|
356
|
+
return (isWithinJsonSize(value, MAX_PUBLIC_DTO_BYTES) &&
|
|
357
|
+
hasExactFields(value, [
|
|
358
|
+
'schemaVersion',
|
|
359
|
+
'companyId',
|
|
360
|
+
'resourceId',
|
|
361
|
+
'definitionId',
|
|
362
|
+
'definitionRevision',
|
|
363
|
+
'phase',
|
|
364
|
+
'lastOperation',
|
|
365
|
+
'lastResult',
|
|
366
|
+
'restoreAvailable',
|
|
367
|
+
'updatedAtUtc',
|
|
368
|
+
], ['reasonCode', 'snapshotCapturedAtUtc']) &&
|
|
369
|
+
value.schemaVersion === 1 &&
|
|
370
|
+
isBoundedString(value.companyId, MAX_ID_LENGTH) &&
|
|
371
|
+
isBoundedString(value.resourceId, MAX_ID_LENGTH) &&
|
|
372
|
+
isBoundedString(value.definitionId, MAX_ID_LENGTH) &&
|
|
373
|
+
isPositiveSafeInteger(value.definitionRevision) &&
|
|
374
|
+
typeof value.phase === 'string' &&
|
|
375
|
+
availabilityPhases.has(value.phase) &&
|
|
376
|
+
(value.lastOperation === 'remove' || value.lastOperation === 'restore') &&
|
|
377
|
+
typeof value.lastResult === 'string' &&
|
|
378
|
+
availabilityResults.has(value.lastResult) &&
|
|
379
|
+
(value.reasonCode === undefined || (typeof value.reasonCode === 'string' && availabilityReasonCodes.has(value.reasonCode))) &&
|
|
380
|
+
(value.snapshotCapturedAtUtc === undefined || isIsoUtcTimestamp(value.snapshotCapturedAtUtc)) &&
|
|
381
|
+
typeof value.restoreAvailable === 'boolean' &&
|
|
382
|
+
isIsoUtcTimestamp(value.updatedAtUtc));
|
|
383
|
+
}
|
|
384
|
+
export function isBastionPauseResponse(value) {
|
|
385
|
+
return (isWithinJsonSize(value, MAX_PUBLIC_DTO_BYTES) &&
|
|
386
|
+
hasExactFields(value, ['status', 'resourceId', 'controlGeneration', 'requestedAtUtc']) &&
|
|
387
|
+
(value.status === 'paused' || value.status === 'pause-pending') &&
|
|
388
|
+
isBoundedString(value.resourceId, MAX_ID_LENGTH) &&
|
|
389
|
+
isPositiveSafeInteger(value.controlGeneration) &&
|
|
390
|
+
isIsoUtcTimestamp(value.requestedAtUtc));
|
|
391
|
+
}
|
|
392
|
+
export function isBastionRestoreNowResponse(value) {
|
|
393
|
+
return (isWithinJsonSize(value, MAX_PUBLIC_DTO_BYTES) &&
|
|
394
|
+
hasExactFields(value, ['accepted', 'scheduleRunId', 'resourceId', 'requestedAtUtc']) &&
|
|
395
|
+
typeof value.accepted === 'boolean' &&
|
|
396
|
+
isBoundedString(value.scheduleRunId, MAX_ID_LENGTH) &&
|
|
397
|
+
isBoundedString(value.resourceId, MAX_ID_LENGTH) &&
|
|
398
|
+
isIsoUtcTimestamp(value.requestedAtUtc));
|
|
399
|
+
}
|
|
@@ -9,6 +9,10 @@ export const RESOURCE_STRATEGY_CONTRACT_LIMITS = {
|
|
|
9
9
|
grantGroups: 128,
|
|
10
10
|
permissionOperations: 8192,
|
|
11
11
|
listResults: 100,
|
|
12
|
+
dryRunChecks: 8,
|
|
13
|
+
dryRunReasonCodes: 32,
|
|
14
|
+
dryRunDtoBytes: 16384,
|
|
15
|
+
dryRunMaxTtlMs: 5 * 60000,
|
|
12
16
|
parameterBytes: 32768,
|
|
13
17
|
publicDtoBytes: 262144,
|
|
14
18
|
};
|
|
@@ -174,6 +174,72 @@ export function isResourceStrategyWeeklyScheduleProjection(value) {
|
|
|
174
174
|
(value.acknowledgement === undefined || isAcknowledgement(value.acknowledgement)) &&
|
|
175
175
|
(value.firstExecutionAcknowledgement === undefined || isAcknowledgement(value.firstExecutionAcknowledgement)));
|
|
176
176
|
}
|
|
177
|
+
const RESOURCE_SCHEDULE_DRY_RUN_CHECK_NAMES = [
|
|
178
|
+
'ownership',
|
|
179
|
+
'readiness',
|
|
180
|
+
'mutation-contention',
|
|
181
|
+
'busy-policy',
|
|
182
|
+
'blackout',
|
|
183
|
+
'admission-budgets',
|
|
184
|
+
'evidence-freshness',
|
|
185
|
+
'notification-routing',
|
|
186
|
+
];
|
|
187
|
+
function isResourceScheduleDryRunCheckProjection(value) {
|
|
188
|
+
if (!isRecord(value) ||
|
|
189
|
+
!hasOnlyKeys(value, ['name', 'status', 'reasonCodes']) ||
|
|
190
|
+
!RESOURCE_SCHEDULE_DRY_RUN_CHECK_NAMES.includes(value.name) ||
|
|
191
|
+
(value.status !== 'ready' && value.status !== 'blocked') ||
|
|
192
|
+
!Array.isArray(value.reasonCodes) ||
|
|
193
|
+
value.reasonCodes.length > RESOURCE_STRATEGY_CONTRACT_LIMITS.dryRunReasonCodes ||
|
|
194
|
+
!value.reasonCodes.every(reasonCode => isBoundedString(reasonCode, 200)) ||
|
|
195
|
+
new Set(value.reasonCodes).size !== value.reasonCodes.length) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
return value.status === 'ready' ? value.reasonCodes.length === 0 : value.reasonCodes.length > 0;
|
|
199
|
+
}
|
|
200
|
+
/** Validates one bounded authoritative dry-run result for a schedule revision. */
|
|
201
|
+
export function isResourceScheduleDryRunProjection(value) {
|
|
202
|
+
if (!isWithinJsonByteLimit(value, RESOURCE_STRATEGY_CONTRACT_LIMITS.dryRunDtoBytes) ||
|
|
203
|
+
!isRecord(value) ||
|
|
204
|
+
containsForbiddenKey(value) ||
|
|
205
|
+
!hasOnlyKeys(value, [
|
|
206
|
+
'scheduleId',
|
|
207
|
+
'definitionRevision',
|
|
208
|
+
'controlGeneration',
|
|
209
|
+
'evaluatedAtUtc',
|
|
210
|
+
'expiresAtUtc',
|
|
211
|
+
'freshness',
|
|
212
|
+
'windowStartUtc',
|
|
213
|
+
'windowEndUtc',
|
|
214
|
+
'occurrenceCount',
|
|
215
|
+
'status',
|
|
216
|
+
'checks',
|
|
217
|
+
]) ||
|
|
218
|
+
!isBoundedString(value.scheduleId, 200) ||
|
|
219
|
+
!isPositiveInteger(value.definitionRevision) ||
|
|
220
|
+
!isPositiveInteger(value.controlGeneration) ||
|
|
221
|
+
!isIsoTimestamp(value.evaluatedAtUtc) ||
|
|
222
|
+
!isIsoTimestamp(value.expiresAtUtc) ||
|
|
223
|
+
Date.parse(value.expiresAtUtc) <= Date.parse(value.evaluatedAtUtc) ||
|
|
224
|
+
Date.parse(value.expiresAtUtc) - Date.parse(value.evaluatedAtUtc) > RESOURCE_STRATEGY_CONTRACT_LIMITS.dryRunMaxTtlMs ||
|
|
225
|
+
(value.freshness !== 'fresh' && value.freshness !== 'stale') ||
|
|
226
|
+
!isIsoTimestamp(value.windowStartUtc) ||
|
|
227
|
+
!isIsoTimestamp(value.windowEndUtc) ||
|
|
228
|
+
Date.parse(value.windowEndUtc) <= Date.parse(value.windowStartUtc) ||
|
|
229
|
+
!isNonNegativeInteger(value.occurrenceCount) ||
|
|
230
|
+
(value.status !== 'ready' && value.status !== 'blocked') ||
|
|
231
|
+
!Array.isArray(value.checks) ||
|
|
232
|
+
value.checks.length !== RESOURCE_STRATEGY_CONTRACT_LIMITS.dryRunChecks ||
|
|
233
|
+
!value.checks.every(isResourceScheduleDryRunCheckProjection)) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
const checkNames = value.checks.map(check => check.name);
|
|
237
|
+
if (new Set(checkNames).size !== RESOURCE_SCHEDULE_DRY_RUN_CHECK_NAMES.length ||
|
|
238
|
+
!RESOURCE_SCHEDULE_DRY_RUN_CHECK_NAMES.every(name => checkNames.includes(name))) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
return value.status === (value.checks.every(check => check.status === 'ready') ? 'ready' : 'blocked');
|
|
242
|
+
}
|
|
177
243
|
function isManifestRef(value) {
|
|
178
244
|
return (isRecord(value) &&
|
|
179
245
|
hasOnlyKeys(value, ['version', 'contentHash']) &&
|
|
@@ -318,7 +384,7 @@ export function isResourceStrategyScheduleCommand(value) {
|
|
|
318
384
|
}
|
|
319
385
|
if (value.command === 'leave-current-state')
|
|
320
386
|
return isBoundedString(value.acknowledgement, 2000);
|
|
321
|
-
return ['pause', 'resume', 'restore-now'].includes(String(value.command)) && value.acknowledgement === undefined;
|
|
387
|
+
return ['pause', 'resume', 'rerun-dry-run', 'restore-now'].includes(String(value.command)) && value.acknowledgement === undefined;
|
|
322
388
|
}
|
|
323
389
|
export function isResourceStrategyWeeklyScheduleListResponse(value) {
|
|
324
390
|
return (isWithinJsonByteLimit(value, RESOURCE_STRATEGY_CONTRACT_LIMITS.publicDtoBytes) &&
|
package/dist/index.d.ts
CHANGED
|
@@ -63,6 +63,9 @@ export * from './common/artifactEvidence';
|
|
|
63
63
|
export * from './company';
|
|
64
64
|
export * from './customProperties';
|
|
65
65
|
export * from './scheduler';
|
|
66
|
+
export * from './scheduler/bastionSchedule';
|
|
67
|
+
export * from './scheduler/bastionScheduleProfile';
|
|
68
|
+
export * from './scheduler/bastionScheduleValidation';
|
|
66
69
|
export * from './ai';
|
|
67
70
|
export * from './environment';
|
|
68
71
|
export * from './events';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uCAAuC,CAAC;AACtD,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,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pH,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,oCAAoC,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAC5H,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yCAAyC,CAAC;AACxD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,MAAM,CAAC;AACrB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -85,6 +85,9 @@ __exportStar(require("./common/artifactEvidence"), exports);
|
|
|
85
85
|
__exportStar(require("./company"), exports);
|
|
86
86
|
__exportStar(require("./customProperties"), exports);
|
|
87
87
|
__exportStar(require("./scheduler"), exports);
|
|
88
|
+
__exportStar(require("./scheduler/bastionSchedule"), exports);
|
|
89
|
+
__exportStar(require("./scheduler/bastionScheduleProfile"), exports);
|
|
90
|
+
__exportStar(require("./scheduler/bastionScheduleValidation"), exports);
|
|
88
91
|
__exportStar(require("./ai"), exports);
|
|
89
92
|
__exportStar(require("./environment"), exports);
|
|
90
93
|
__exportStar(require("./events"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iEAAiE;AACjE,iDAA+B;AAC/B,0DAAwC;AACxC,gEAA8C;AAC9C,uDAAqC;AACrC,8DAA4C;AAC5C,wEAAsD;AACtD,kDAAgC;AAChC,4DAA0C;AAC1C,oEAAkD;AAClD,gEAA8C;AAC9C,0EAAwD;AACxD,+DAA6C;AAC7C,uDAAqC;AACrC,mDAAiC;AACjC,8DAA4C;AAC5C,oDAAkC;AAClC,kDAAgC;AAChC,kDAAgC;AAChC,mDAAiC;AACjC,0DAAwC;AACxC,yDAAuC;AACvC,iDAA+B;AAC/B,wDAAsC;AACtC,0DAAwC;AACxC,+DAA6C;AAC7C,8DAA4C;AAC5C,iEAA+C;AAC/C,8DAA4C;AAC5C,+DAA6C;AAC7C,oDAAkC;AAClC,kDAAgC;AAChC,yDAAuC;AACvC,mEAAiD;AACjD,2DAAyC;AACzC,qEAAmD;AACnD,sDAAoC;AACpC,uEAAoH;AAA3G,6HAAA,oBAAoB,OAAA;AAAE,gIAAA,uBAAuB,OAAA;AAAE,6HAAA,oBAAoB,OAAA;AAC5E,6DAA2C;AAC3C,0DAAwC;AACxC,uDAAqC;AACrC,yDAAuC;AACvC,wDAAsC;AACtC,gDAA8B;AAC9B,mDAAiC;AACjC,kDAAgC;AAChC,mGAA4H;AAAnH,2JAAA,oCAAoC,OAAA;AAAE,8IAAA,uBAAuB,OAAA;AACtE,4DAA0C;AAC1C,iEAA+C;AAC/C,0EAAwD;A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,oCAAoC,OAAA;AAAE,8IAAA,uBAAuB,OAAA;AACtE,4DAA0C;AAC1C,iEAA+C;AAC/C,0EAAwD;AACxD,+DAA6C;AAC7C,4DAA0C;AAC1C,qDAAmC;AACnC,4DAA0C;AAC1C,yDAAuC;AACvC,4DAA0C;AAC1C,wCAAsB;AACtB,6CAA2B;AAC3B,gDAA8B;AAC9B,0CAAwB;AACxB,2CAAyB;AACzB,4DAA0C;AAC1C,4CAA0B;AAC1B,qDAAmC;AACnC,8CAA4B;AAC5B,8DAA4C;AAC5C,qEAAmD;AACnD,wEAAsD;AACtD,uCAAqB;AACrB,gDAA8B;AAC9B,2CAAyB;AACzB,iDAA+B;AAC/B,6CAA2B;AAC3B,6DAA2C;AAC3C,yCAAuB;AACvB,8CAA4B"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { ResourceScheduleDefinitionBase, SchedulerBatchRunItemBase, WeekdayNumber } from './scheduler';
|
|
2
|
+
export type BastionScheduleDefinitionType = 'bastion-availability-weekly';
|
|
3
|
+
export type BastionAvailabilityOperation = 'remove' | 'restore';
|
|
4
|
+
export interface BastionAvailabilityWindow {
|
|
5
|
+
windowId: string;
|
|
6
|
+
daysOfWeek: WeekdayNumber[];
|
|
7
|
+
accessStartTimeLocal: string;
|
|
8
|
+
accessEndTimeLocal: string;
|
|
9
|
+
}
|
|
10
|
+
export interface BastionAvailabilityWeeklyConfiguration {
|
|
11
|
+
accessWindows: BastionAvailabilityWindow[];
|
|
12
|
+
}
|
|
13
|
+
export interface BastionAvailabilityWeeklyScheduleWriteRequest {
|
|
14
|
+
definitionType: BastionScheduleDefinitionType;
|
|
15
|
+
name: string;
|
|
16
|
+
providerName: string;
|
|
17
|
+
providerScopeId: string;
|
|
18
|
+
cloudAccountId: string;
|
|
19
|
+
resourceId: string;
|
|
20
|
+
targetResourceType?: 'Microsoft.Network/bastionHosts';
|
|
21
|
+
timezone: string;
|
|
22
|
+
notes?: string;
|
|
23
|
+
acknowledgementVersion: 'bastion-delete-recreate-v1';
|
|
24
|
+
configuration: BastionAvailabilityWeeklyConfiguration;
|
|
25
|
+
}
|
|
26
|
+
export interface BastionAvailabilityWeeklyScheduleDefinition extends ResourceScheduleDefinitionBase {
|
|
27
|
+
definitionClass: 'composite';
|
|
28
|
+
definitionType: BastionScheduleDefinitionType;
|
|
29
|
+
cloudAccountId: string;
|
|
30
|
+
resourceId: string;
|
|
31
|
+
targetResourceType: 'Microsoft.Network/bastionHosts';
|
|
32
|
+
definitionRevision: number;
|
|
33
|
+
acknowledgementVersion: 'bastion-delete-recreate-v1';
|
|
34
|
+
configuration: BastionAvailabilityWeeklyConfiguration;
|
|
35
|
+
executionPolicy?: never;
|
|
36
|
+
}
|
|
37
|
+
interface BastionScheduleRunBase extends SchedulerBatchRunItemBase {
|
|
38
|
+
targetType: 'resource-operation';
|
|
39
|
+
selectorType: 'single-resource';
|
|
40
|
+
scheduleType: 'recurring';
|
|
41
|
+
cloudAccountId: string;
|
|
42
|
+
resourceId: string;
|
|
43
|
+
definitionId: string;
|
|
44
|
+
definitionClass: 'composite';
|
|
45
|
+
definitionType: BastionScheduleDefinitionType;
|
|
46
|
+
compiledRuleId: string;
|
|
47
|
+
definitionRevision: number;
|
|
48
|
+
scheduledForUtc: string;
|
|
49
|
+
}
|
|
50
|
+
export interface BastionRemoveScheduleRun extends BastionScheduleRunBase {
|
|
51
|
+
compiledOperation: 'remove';
|
|
52
|
+
controlGeneration: number;
|
|
53
|
+
}
|
|
54
|
+
export interface BastionRestoreScheduleRun extends BastionScheduleRunBase {
|
|
55
|
+
compiledOperation: 'restore';
|
|
56
|
+
controlGeneration?: never;
|
|
57
|
+
}
|
|
58
|
+
export type BastionScheduleRun = BastionRemoveScheduleRun | BastionRestoreScheduleRun;
|
|
59
|
+
export interface BastionScheduleControlV1 {
|
|
60
|
+
schemaVersion: 1;
|
|
61
|
+
companyId: string;
|
|
62
|
+
resourceId: string;
|
|
63
|
+
definitionId: string;
|
|
64
|
+
definitionRevision: number;
|
|
65
|
+
controlGeneration: number;
|
|
66
|
+
desiredStatus: 'active' | 'paused';
|
|
67
|
+
updatedAtUtc: string;
|
|
68
|
+
}
|
|
69
|
+
export type BastionScheduleReadinessStatus = 'confirmed' | 'missing' | 'unknown' | 'unsupported';
|
|
70
|
+
export type BastionScheduleReadinessReasonCode = 'feature-disabled' | 'resource-not-found' | 'unsupported-profile' | 'unsupported-region' | 'missing-permission' | 'permission-unknown' | 'management-lock';
|
|
71
|
+
export interface BastionScheduleReadinessV1 {
|
|
72
|
+
schemaVersion: 1;
|
|
73
|
+
status: BastionScheduleReadinessStatus;
|
|
74
|
+
companyId: string;
|
|
75
|
+
cloudAccountId: string;
|
|
76
|
+
subscriptionId: string;
|
|
77
|
+
resourceId: string;
|
|
78
|
+
requiredActions: string[];
|
|
79
|
+
missingActions: string[];
|
|
80
|
+
reasonCode?: BastionScheduleReadinessReasonCode;
|
|
81
|
+
checkedAtUtc: string;
|
|
82
|
+
}
|
|
83
|
+
export type BastionAvailabilityPhase = 'available' | 'removing' | 'absent' | 'restoring';
|
|
84
|
+
export type BastionAvailabilityResult = 'succeeded' | 'skipped' | 'blocked' | 'failed' | 'pending';
|
|
85
|
+
export type BastionAvailabilityReasonCode = 'feature-disabled' | 'resource-not-found' | 'unsupported-profile' | 'unsupported-region' | 'missing-permission' | 'permission-unknown' | 'management-lock' | 'active-sessions' | 'session-state-unknown' | 'snapshot-failed' | 'active-snapshot-missing' | 'source-drift' | 'dependency-missing' | 'dependency-drift' | 'stale-run' | 'continuation-overdue' | 'azure-operation-failed' | 'restore-timeout';
|
|
86
|
+
export interface BastionAvailabilityStatusV1 {
|
|
87
|
+
schemaVersion: 1;
|
|
88
|
+
companyId: string;
|
|
89
|
+
resourceId: string;
|
|
90
|
+
definitionId: string;
|
|
91
|
+
definitionRevision: number;
|
|
92
|
+
phase: BastionAvailabilityPhase;
|
|
93
|
+
lastOperation: BastionAvailabilityOperation;
|
|
94
|
+
lastResult: BastionAvailabilityResult;
|
|
95
|
+
reasonCode?: BastionAvailabilityReasonCode;
|
|
96
|
+
snapshotCapturedAtUtc?: string;
|
|
97
|
+
restoreAvailable: boolean;
|
|
98
|
+
updatedAtUtc: string;
|
|
99
|
+
}
|
|
100
|
+
export interface BastionPauseResponse {
|
|
101
|
+
status: 'paused' | 'pause-pending';
|
|
102
|
+
resourceId: string;
|
|
103
|
+
controlGeneration: number;
|
|
104
|
+
requestedAtUtc: string;
|
|
105
|
+
}
|
|
106
|
+
export interface BastionRestoreNowResponse {
|
|
107
|
+
accepted: boolean;
|
|
108
|
+
scheduleRunId: string;
|
|
109
|
+
resourceId: string;
|
|
110
|
+
requestedAtUtc: string;
|
|
111
|
+
}
|
|
112
|
+
export {};
|
|
113
|
+
//# sourceMappingURL=bastionSchedule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bastionSchedule.d.ts","sourceRoot":"","sources":["../../src/scheduler/bastionSchedule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5G,MAAM,MAAM,6BAA6B,GAAG,6BAA6B,CAAC;AAC1E,MAAM,MAAM,4BAA4B,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEhE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,sCAAsC;IACrD,aAAa,EAAE,yBAAyB,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,6CAA6C;IAC5D,cAAc,EAAE,6BAA6B,CAAC;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,UAA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