Repository navigation
Expand file tree
/
Copy pathtypes.d.ts
More file actions
678 lines (657 loc) · 24.5 KB
/
Copy pathtypes.d.ts
File metadata and controls
678 lines (657 loc) · 24.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
/**
* Find the first non-finished step in a pipeline execution
* @param execution - the execution
* @returns the step state or a falsy object if all steps are finished
*/
declare function getCurrentStep(execution: PipelineExecution): PipelineExecutionStepState;
/**
* Find the first waiting step in a pipeline execution
* @param execution - the execution
* @returns the step state or a falsy object if no step is waiting
*/
declare function getWaitingStep(execution: PipelineExecution): PipelineExecutionStepState;
/**
* Returns a Promise that resolves with a new CloudManagerAPI object.
* @param orgId - the organization id
* @param apiKey - the API key for your integration
* @param accessToken - the access token for your integration
* @param baseUrl - the base URL to access the API (defaults to https://cloudmanager.adobe.io)
* @returns a Promise with a CloudManagerAPI object
*/
declare function init(orgId: string, apiKey: string, accessToken: string, baseUrl: string): Promise<CloudManagerAPI>;
/**
* This class provides methods to call your Cloud Manager APIs.
* Before calling any method initialize the instance by calling the `init` method on it
* with valid values for orgId, apiKey and accessToken
*/
declare class CloudManagerAPI {
/**
* Initializes a CloudManagerAPI object and returns it.
* @param orgId - the organization id
* @param apiKey - the API key for your integration
* @param accessToken - the access token for your integration
* @param baseUrl - the base URL to access the API (defaults to https://cloudmanager.adobe.io)
* @returns a CloudManagerAPI object
*/
init(orgId: string, apiKey: string, accessToken: string, baseUrl: string): Promise<CloudManagerAPI>;
/**
* The organization id
*/
orgId: string;
/**
* The api key from your integration
*/
apiKey: string;
/**
* The access token from your integration
*/
accessToken: string;
/**
* The base URL for the API endpoint
*/
baseUrl: string;
/**
* Obtain a list of programs for the target organization.
* @returns an array of Programs
*/
listPrograms(): Promise<EmbeddedProgram[]>;
/**
* Obtain a list of pipelines for the target program.
* @param programId - the program id
* @param options - options
* @returns an array of Pipelines
*/
listPipelines(programId: string, options: ListPipelineOptions): Promise<Pipeline[]>;
/**
* Create a new execution for a pipeline, returning the execution.
* @param programId - the program id
* @param pipelineId - the pipeline id
* @param mode - the pipeline execution mode
* @returns the new execution
*/
createExecution(programId: string, pipelineId: string, mode: string): Promise<PipelineExecution>;
/**
* Start an execution for a pipeline, returning the url of the new execution
* @param programId - the program id
* @param pipelineId - the pipeline id
* @param mode - the pipeline execution mode
* @returns the execution url
*/
startExecution(programId: string, pipelineId: string, mode: string): Promise<string>;
/**
* Invalidate the cache for a pipeline
* @param programId - the program id
* @param pipelineId - the pipeline id
* @returns a truthy object
*/
invalidatePipelineCache(programId: string, pipelineId: string): Promise<object>;
/**
* Get the current execution for a pipeline
* @param programId - the program id
* @param pipelineId - the pipeline id
* @returns the execution
*/
getCurrentExecution(programId: string, pipelineId: string): Promise<PipelineExecution>;
/**
* List the most recent executions for a pipeline
* @param programId - the program id
* @param pipelineId - the pipeline id
* @param limit - the maximum number of executions to return (defaults to 20)
* @returns the list of executions
*/
listExecutions(programId: string, pipelineId: string, limit?: number): Promise<PipelineExecution[]>;
/**
* Get an execution for a pipeline
* @param programId - the program id
* @param pipelineId - the pipeline id
* @param executionId - the execution id
* @returns the execution
*/
getExecution(programId: string, pipelineId: string, executionId: string): Promise<PipelineExecution>;
/**
* Get the quality gate results for a pipeline step
* @param programId - the program id
* @param pipelineId - the pipeline id
* @param executionId - the execution id
* @param action - the action name
* @returns the execution
*/
getQualityGateResults(programId: string, pipelineId: string, executionId: string, action: string): Promise<PipelineStepMetrics>;
/**
* Cancel current execution
* @param programId - the program id
* @param pipelineId - the pipeline id
* @returns a truthy value
*/
cancelCurrentExecution(programId: string, pipelineId: string): Promise<object>;
/**
* Advance current execution
* @param programId - the program id
* @param pipelineId - the pipeline id
* @returns a truthy value
*/
advanceCurrentExecution(programId: string, pipelineId: string): Promise<object>;
/**
* List environments for a program
* @param programId - the program id
* @returns a list of environments
*/
listEnvironments(programId: string): Promise<Environment[]>;
/**
* Write step log to an output stream.
* @param programId - the program id
* @param pipelineId - the pipeline id
* @param executionId - the execution id
* @param action - the action
* @param logFile - the log file to select a non-default value
* @param outputStream - the output stream to write to
* @returns a truthy value
*/
getExecutionStepLog(programId: string, pipelineId: string, executionId: string, action: string, logFile: string, outputStream: any): Promise<object>;
/**
* Tail step log to an output stream.
* @param programId - the program id
* @param pipelineId - the pipeline id
* @param action - the action
* @param logFile - the log file to select a non-default value
* @param outputStream - the output stream to write to
* @returns the completed step state
*/
tailExecutionStepLog(programId: string, pipelineId: string, action: string, logFile: string, outputStream: any): Promise<PipelineExecutionStepState>;
/**
* List the log options available for an environment
* @param programId - the program id
* @param environmentId - the environment id
* @returns the log options for the environment
*/
listAvailableLogOptions(programId: string, environmentId: string): Promise<LogOptionRepresentation[]>;
/**
* Download log files from the environment to a specified directory.
* @param programId - the program id
* @param environmentId - the environment id
* @param service - the service specification
* @param name - the log name
* @param days - the number of days
* @param outputDirectory - the output directory
* @returns the list of downloaded logs
*/
downloadLogs(programId: string, environmentId: string, service: string, name: string, days: number, outputDirectory: string): Promise<DownloadedLog[]>;
/**
* Delete a pipeline
* @param programId - the program id
* @param pipelineId - the pipeline id
* @returns a truthy object
*/
deletePipeline(programId: string, pipelineId: string): Promise<object>;
/**
* Update a pipeline
* @param programId - the program id
* @param pipelineId - the pipeline id
* @param changes - the changes
* @returns the new pipeline definition
*/
updatePipeline(programId: string, pipelineId: string, changes: PipelineUpdate): Promise<Pipeline>;
/**
* Get the link to the developer console
* @param programId - the program id
* @param environmentId - the environment id
* @returns the console url
*/
getDeveloperConsoleUrl(programId: string, environmentId: string): Promise<string>;
/**
* Get the list of variables for an environment
* @param programId - the program id
* @param environmentId - the environment id
* @returns the variables
*/
getEnvironmentVariables(programId: string, environmentId: string): Promise<Variable[]>;
/**
* Set the variables for an environment
* @param programId - the program id
* @param environmentId - the environment id
* @param variables - the variables
* @returns a truthy value
*/
setEnvironmentVariables(programId: string, environmentId: string, variables: Variable[]): Promise<object>;
/**
* Get the list of variables for a pipeline
* @param programId - the program id
* @param pipelineId - the pipeline id
* @returns the variables
*/
getPipelineVariables(programId: string, pipelineId: string): Promise<Variable[]>;
/**
* Set the variables for a pipeline
* @param programId - the program id
* @param pipelineId - the pipeline id
* @param variables - the variables
* @returns a truthy value
*/
setPipelineVariables(programId: string, pipelineId: string, variables: Variable[]): Promise<object>;
/**
* Delete a program
* @param programId - the program id
* @returns a truthy value
*/
deleteProgram(programId: string): Promise<object>;
/**
* Delete an environment
* @param programId - the program id
* @param environmentId - the environment id
* @returns a truthy value
*/
deleteEnvironment(programId: string, environmentId: string): Promise<object>;
/**
* List the program's defined IP Allow Lists
* @param programId - the program id
* @returns - the IP Allow Lists
*/
listIpAllowlists(programId: string): Promise<IPAllowedList>;
/**
* Create IP Allow List
* @param programId - the program id
* @param name - the name
* @param cidrBlocks - the CIDR blocks
* @returns a truthy value
*/
createIpAllowlist(programId: string, name: string, cidrBlocks: string[]): Promise<IPAllowedList>;
/**
* Update the CIDR blocks of an IP Allow List
* @param programId - the program id
* @param ipAllowlistId - the allow list id
* @param cidrBlocks - the replacement CIDR blocks
* @returns a truthy value
*/
updateIpAllowlist(programId: string, ipAllowlistId: string, cidrBlocks: string[]): Promise<object>;
/**
* Update the CIDR blocks of an IP Allow List
* @param programId - the program id
* @param ipAllowlistId - the allow list id
* @returns a truthy value
*/
deleteIpAllowlist(programId: string, ipAllowlistId: string): Promise<object>;
/**
* Bind an IP Allow List to an environment
* @param programId - the program id
* @param ipAllowlistId - the allow list id
* @param environmentId - the environment id
* @param service - the service name
* @returns a truthy value
*/
addIpAllowlistBinding(programId: string, ipAllowlistId: string, environmentId: string, service: string): Promise<object>;
/**
* Unbind an IP Allow List from an environment
* @param programId - the program id
* @param ipAllowlistId - the allow list id
* @param environmentId - the environment id
* @param service - the service name
* @returns a truthy value
*/
removeIpAllowlistBinding(programId: string, ipAllowlistId: string, environmentId: string, service: string): Promise<object>;
/**
* Create a Content set
* @param programId - the program id
* @param contentSet - the body of the content set.
* @returns the created content set
*/
createContentSet(programId: string, contentSet: string): Promise<ContentSet>;
/**
* Delete Content Set
* @param programId - the program id
* @param contentSetId - the content set id
* @returns a truthy value
*/
deleteContentSet(programId: string, contentSetId: string): Promise<object>;
/**
* Get Content Set
* @param programId - the program id
* @param contentSetId - the content set id
* @returns the content set
*/
getContentSet(programId: string, contentSetId: string): Promise<ContentSet>;
/**
* List Content Sets for program
* @param programId - the program id
* @returns list of the content sets for the program
*/
listContentSets(programId: string): Promise<ContentSet[]>;
/**
* Update the content set definition.
*
* The operation is a PUT, so the entire body has to be provided.
* @param programId - The program id
* @param contentSetId - The content set id
* @param updatedContentSet - the body (JSON format)
* @returns the updated content set
*/
updateContentSet(programId: string, contentSetId: string, updatedContentSet: string): Promise<ContentSet>;
/**
* Create content Set Flow for environment
* @param programId - The program id
* @param environmentId - The environment id
* @param contentFlow - The body of the contentFlow
* @returns the created content flow representation
*/
createContentFlow(programId: string, environmentId: string, contentFlow: ContentFlow): Promise<ContentFlow>;
/**
* Get Content Flow
* @param programId - The program id
* @param contentFlowId - the content flow id
* @returns the Content Flow
*/
getContentFlow(programId: string, contentFlowId: string): Promise<ContentFlow>;
/**
* List content flows for program
* @param programId - The program id
* @returns an array of content flows
*/
listContentFlows(programId: string): Promise<ContentFlow[]>;
/**
* Cancel a content flow
* Cancels an in progress flow
* @param programId - the program id
* @param contentFlowId - the flow id
* @returns a truthy value
*/
cancelContentFlow(programId: string, contentFlowId: string): Promise<object>;
}
/**
* A lightweight representation of a Program
* @property id - Identifier of the program. Unique within the space.
* @property name - Name of the program
* @property enabled - Whether this Program has been enabled for Cloud Manager usage
* @property tenantId - Tenant Id
* @property status - Status of the program
* @property createdAt - Created time
* @property updatedAt - Date of last change
*/
declare type EmbeddedProgram = {
id: string;
name: string;
enabled: boolean;
tenantId: string;
status: string;
createdAt: string;
updatedAt: string;
};
/**
* A representation of a CI/CD Pipeline
* @property id - Identifier of the pipeline. Unique within the program.
* @property programId - Identifier of the program. Unique within the space.
* @property name - Name of the pipeline
* @property trigger - How should the execution be triggered. ON_COMMIT: each time one or more commits are pushed and the Pipeline is idle then a execution is triggered. MANUAL: triggerd through UI or API.
* @property status - Pipeline status
* @property createdAt - Create date
* @property updatedAt - Update date
* @property lastStartedAt - Last pipeline execution start
* @property lastFinishedAt - Last pipeline execution end
* @property phases - Pipeline phases in execution order
* @property type - Pipeline type
*/
declare type Pipeline = {
id: string;
programId: string;
name: string;
trigger: string;
status: string;
createdAt: string;
updatedAt: string;
lastStartedAt: string;
lastFinishedAt: string;
phases: PipelinePhase[];
type: string;
};
/**
* Describes a phase of a pipeline
* @property name - Name of the phase
* @property type - Type of the phase
* @property repositoryId - Identifier of the source repository. The code from this repository will be build at the start of this phase.
* Mandatory if type=BUILD
* @property branch - Name of the tracked branch or a fully qualified git tag (e.g. refs/tags/v1).
* Assumed to be `master` if missing.
* @property environmentId - Identifier of the target environment. Mandatory if type=DEPLOY
* @property environmentType - Type of environment (for example stage or prod, readOnly = true)
* @property steps - Steps to be included in the phase in execution order. Might be added or not, depending on permissions or configuration
*/
declare type PipelinePhase = {
name: string;
type: string;
repositoryId: string;
branch: string;
environmentId: string;
environmentType: string;
steps: PipelineStep[];
};
/**
* A representation of an execution of a CI/CD Pipeline.
* @property id - Pipeline execution identifier
* @property programId - Identifier of the program. Unique within the space.
* @property pipelineId - Identifier of the pipeline. Unique within the space.
* @property artifactsVersion - Version of the artifacts generated during this execution
* @property user - AdobeID who started the pipeline. Empty for auto triggered builds
* @property status - Status of the execution
* @property trigger - How the execution was triggered.
* @property pipelineExecutionMode - The mode in which the execution occurred. EMERGENCY mode will skip certain steps and is only available to select AMS customers
* @property createdAt - Timestamp at which the execution was created
* @property updatedAt - Timestamp at which the status of the execution last changed
* @property finishedAt - Timestamp at which the execution completed
* @property pipelineType - Pipeline type
*/
declare type PipelineExecution = {
id: string;
programId: string;
pipelineId: string;
artifactsVersion: string;
user: string;
status: string;
trigger: string;
pipelineExecutionMode: string;
createdAt: string;
updatedAt: string;
finishedAt: string;
pipelineType: string;
};
/**
* Describes the status of a particular pipeline execution step for display purposes
* @property action - Name of the action
* @property repository - Target repository
* @property branch - Target branch
* @property environment - Target environment
* @property environmentId - Target environment id
* @property environmentType - Target environment type
* @property startedAt - Timestamp at which the step state started running
* @property finishedAt - Timestamp at which the step completed
* @property commitId - Target commit id
* @property details - Additional details of the step
* @property status - Action status
*/
declare type PipelineExecutionStepState = {
id: string;
stepId: string;
phaseId: string;
action: string;
repository: string;
branch: string;
environment: string;
environmentId: string;
environmentType: string;
startedAt: string;
finishedAt: string;
commitId: string;
details: any;
status: string;
};
/**
* @property metrics - metrics
*/
declare type PipelineStepMetrics = {
metrics: Metric[];
};
/**
* A representation of a specific metric generated by a CI/CD Pipeline step.
* @property id - KPI result identifier
* @property severity - Severity of the metric
* @property passed - Whether metric is considered passed
* @property override - Whether user override the failed metric
* @property actualValue - Expected value for the metric
* @property expectedValue - Expected value for the metric
* @property comparator - Comparator used for the metric
* @property kpi - KPI identifier
*/
declare type Metric = {
id: string;
severity: string;
passed: boolean;
override: boolean;
actualValue: string;
expectedValue: string;
comparator: string;
kpi: string;
};
/**
* A representation of an Environment known to Cloud Manager.
* @property id - id
* @property programId - Identifier of the program. Unique within the space.
* @property name - Name of the environment
* @property description - Description of the environment
* @property type - Type of the environment
* @property status - Status of the environment
* @property region - Region of the environment
* @property availableLogOptions - List of logs available in the environment
*/
declare type Environment = {
id: string;
programId: string;
name: string;
description: string;
type: string;
status: string;
region: string;
availableLogOptions: LogOptionRepresentation[];
};
/**
* A named value than can be set on an Environment or Pipeline
* @property name - Name of the variable. Can only consist of a-z, A-Z, _ and 0-9 and cannot begin with a number.
* @property value - Value of the variable. Read-Write for non-secrets, write-only for secrets. The length of `secretString` values must be less than 500 characters. An empty value causes a variable to be deleted.
* @property type - Type of the variable. Default `string` if missing. `secretString` variables are encrypted at rest. The type of a variable be changed after creation; the variable must be deleted and recreated.
* @property service - Service of the variable. When not provided, the variable applies to all services. Currently the values 'author', 'publish', and 'preview' are supported. Note - this value is case-sensitive.
* @property status - Status of the variable
*/
declare type Variable = {
name: string;
value: string;
type: string;
service: string;
status: string;
};
/**
* A representation of a ContentSet custom
* @property id - Identifier of the Content Set
* @property name - The name of the content set
* @property paths - Included asset paths
* @property programId - Identifier of the program. Unique within the space.
* @property createdAt - Create date
* @property updatedAt - Update date
*/
declare type ContentSet = {
id: string;
name: string;
paths: ContentSetPath[];
programId: string;
createdAt: string;
updatedAt: string;
};
/**
* The Content Flow Execution
* @property contentSetId - The content set id
* @property contentSetName - The content set name
* @property srcEnvironmentId - Source environment id
* @property srcEnvironmentName - Source environment name
* @property destEnvironmentId - Destination environment id
* @property destEnvironmentName - Destination environment name
* @property tier - The tier, for example author
* @property status - Status of the flows
* @property destProgramId - Destination program id
* @property resultDetails - Details of this content flow result
*/
declare type ContentFlow = {
contentSetId: string;
contentSetName: string;
srcEnvironmentId: string;
srcEnvironmentName: string;
destEnvironmentId: string;
destEnvironmentName: string;
tier: string;
status: string;
destProgramId: string;
resultDetails: undefined;
};
/**
* @property service - Name of the service in environment. Example: author
* @property name - Name of the log for service in environment. Example: aemerror
*/
declare type LogOptionRepresentation = {
service: string;
name: string;
};
/**
* Describes an __IP Allowed List Binding__
* @property id - Identifier of the IP Allowed List Binding to an Environment
* @property tier - Tier of the environment.
* @property status - Status of the binding.
* @property programId - Identifier of the program.
* @property ipAllowListId - Identifier of the IP allow list.
* @property environmentId - Identifier of the environment.
*/
declare type IPAllowedListBinding = {
id: integer;
tier: string;
status: string;
programId: integer;
ipAllowListId: integer;
environmentId: integer;
};
/**
* Describes an __IP Allowed List__
* @property id - Identifier of the IP Allowed List
* @property name - Name of the IP Allowed List
* @property programId - Identifier of the program.
* @property ipCidrSet - IP CIDR Set
* @property bindings - IP Allowlist bindings
*/
declare type IPAllowedList = {
id: integer;
name: string;
programId: integer;
ipCidrSet: string[];
bindings: IPAllowedListBinding[];
};
/**
* Options to the listPipeline function
* @property busy - if true, only busy pipelines will be returned
*/
declare type ListPipelineOptions = {
busy: boolean;
};
/**
* @property path - the path where the log was stored
* @property url - the url of the log that was downloaded
*/
declare type DownloadedLog = {
path: string;
url: string;
};
/**
* @property branch - the new branch
* @property repositoryId - the new repository id
* @property devEnvironmentId - the new dev environment id
* @property stageEnvironmentId - the new stage environment id
* @property prodEnvironmentId - the new prod environment id
*/
declare type PipelineUpdate = {
branch: string;
repositoryId: string;
devEnvironmentId: string;
stageEnvironmentId: string;
prodEnvironmentId: string;
};