forked from MrRefactoring/jira.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeployments.ts
231 lines (220 loc) · 10.5 KB
/
deployments.ts
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
import * as Models from './models';
import * as Parameters from './parameters';
import { Client } from '../clients';
import { Callback } from '../callback';
import { RequestConfig } from '../requestConfig';
export class Deployments {
constructor(private client: Client) {}
/**
* Update / insert deployment data.
*
* Deployments are identified by the combination of `pipelineId`, `environmentId` and `deploymentSequenceNumber`, and
* existing deployment data for the same deployment will be replaced if it exists and the `updateSequenceNumber` of
* existing data is less than the incoming data.
*
* Submissions are processed asynchronously. Submitted data will eventually be available in Jira. Most updates are
* available within a short period of time, but may take some time during peak load and/or maintenance times. The
* `getDeploymentByKey` operation can be used to confirm that data has been stored successfully (if needed).
*
* In the case of multiple deployments being submitted in one request, each is validated individually prior to
* submission. Details of which deployments failed submission (if any) are available in the response object.
*
* Only Connect apps that define the `jiraDeploymentInfoProvider` module, and on-premise integrations, can access this
* resource. This resource requires the 'WRITE' scope for Connect apps.
*/
async submitDeployments<T = Models.SubmitDeployments>(
parameters: Parameters.SubmitDeployments,
callback: Callback<T>,
): Promise<void>;
/**
* Update / insert deployment data.
*
* Deployments are identified by the combination of `pipelineId`, `environmentId` and `deploymentSequenceNumber`, and
* existing deployment data for the same deployment will be replaced if it exists and the `updateSequenceNumber` of
* existing data is less than the incoming data.
*
* Submissions are processed asynchronously. Submitted data will eventually be available in Jira. Most updates are
* available within a short period of time, but may take some time during peak load and/or maintenance times. The
* `getDeploymentByKey` operation can be used to confirm that data has been stored successfully (if needed).
*
* In the case of multiple deployments being submitted in one request, each is validated individually prior to
* submission. Details of which deployments failed submission (if any) are available in the response object.
*
* Only Connect apps that define the `jiraDeploymentInfoProvider` module, and on-premise integrations, can access this
* resource. This resource requires the 'WRITE' scope for Connect apps.
*/
async submitDeployments<T = Models.SubmitDeployments>(
parameters: Parameters.SubmitDeployments,
callback?: never,
): Promise<T>;
async submitDeployments<T = Models.SubmitDeployments>(
parameters: Parameters.SubmitDeployments,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/deployments/0.1/bulk',
method: 'POST',
data: {
properties: parameters.properties,
deployments: parameters.deployments,
providerMetadata: parameters.providerMetadata,
},
};
return this.client.sendRequest(config, callback);
}
/**
* Bulk delete all deployments that match the given request.
*
* One or more query params must be supplied to specify the Properties to delete by. Optional param
* `_updateSequenceNumber` is no longer supported. If more than one Property is provided, data will be deleted that
* matches ALL of the Properties (i.e. treated as AND). See the documentation for the `submitDeployments` operation
* for more details.
*
* Example operation: DELETE /bulkByProperties?accountId=account-123&createdBy=user-456
*
* Deletion is performed asynchronously. The `getDeploymentByKey` operation can be used to confirm that data has been
* deleted successfully (if needed).
*
* Only Connect apps that define the `jiraDeploymentInfoProvider` module, and on-premise integrations, can access this
* resource. This resource requires the 'DELETE' scope for Connect apps.
*/
async deleteDeploymentsByProperty<T = unknown>(
parameters: Parameters.DeleteDeploymentsByProperty,
callback: Callback<T>,
): Promise<void>;
/**
* Bulk delete all deployments that match the given request.
*
* One or more query params must be supplied to specify the Properties to delete by. Optional param
* `_updateSequenceNumber` is no longer supported. If more than one Property is provided, data will be deleted that
* matches ALL of the Properties (i.e. treated as AND). See the documentation for the `submitDeployments` operation
* for more details.
*
* Example operation: DELETE /bulkByProperties?accountId=account-123&createdBy=user-456
*
* Deletion is performed asynchronously. The `getDeploymentByKey` operation can be used to confirm that data has been
* deleted successfully (if needed).
*
* Only Connect apps that define the `jiraDeploymentInfoProvider` module, and on-premise integrations, can access this
* resource. This resource requires the 'DELETE' scope for Connect apps.
*/
async deleteDeploymentsByProperty<T = unknown>(
parameters: Parameters.DeleteDeploymentsByProperty,
callback?: never,
): Promise<T>;
async deleteDeploymentsByProperty<T = unknown>(
parameters: Parameters.DeleteDeploymentsByProperty,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: '/rest/deployments/0.1/bulkByProperties',
method: 'DELETE',
params: {
_updateSequenceNumber: parameters.updateSequenceNumber,
},
};
return this.client.sendRequest(config, callback);
}
/**
* Retrieve the currently stored deployment data for the given `pipelineId`, `environmentId` and
* `deploymentSequenceNumber` combination.
*
* The result will be what is currently stored, ignoring any pending updates or deletes.
*
* Only Connect apps that define the `jiraDeploymentInfoProvider` module, and on-premise integrations, can access this
* resource. This resource requires the 'READ' scope for Connect apps.
*/
async getDeploymentByKey<T = Models.GetDeploymentByKey>(
parameters: Parameters.GetDeploymentByKey,
callback: Callback<T>,
): Promise<void>;
/**
* Retrieve the currently stored deployment data for the given `pipelineId`, `environmentId` and
* `deploymentSequenceNumber` combination.
*
* The result will be what is currently stored, ignoring any pending updates or deletes.
*
* Only Connect apps that define the `jiraDeploymentInfoProvider` module, and on-premise integrations, can access this
* resource. This resource requires the 'READ' scope for Connect apps.
*/
async getDeploymentByKey<T = Models.GetDeploymentByKey>(
parameters: Parameters.GetDeploymentByKey,
callback?: never,
): Promise<T>;
async getDeploymentByKey<T = Models.GetDeploymentByKey>(
parameters: Parameters.GetDeploymentByKey,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/deployments/0.1/pipelines/${parameters.pipelineId}/environments/${parameters.environmentId}/deployments/${parameters.deploymentSequenceNumber}`,
method: 'GET',
};
return this.client.sendRequest(config, callback);
}
/**
* Delete the currently stored deployment data for the given `pipelineId`, `environmentId` and
* `deploymentSequenceNumber` combination.
*
* Deletion is performed asynchronously. The `getDeploymentByKey` operation can be used to confirm that data has been
* deleted successfully (if needed).
*
* Only Connect apps that define the `jiraDeploymentInfoProvider` module, and on-premise integrations, can access this
* resource. This resource requires the 'DELETE' scope for Connect apps.
*/
async deleteDeploymentByKey<T = unknown>(
parameters: Parameters.DeleteDeploymentByKey,
callback: Callback<T>,
): Promise<void>;
/**
* Delete the currently stored deployment data for the given `pipelineId`, `environmentId` and
* `deploymentSequenceNumber` combination.
*
* Deletion is performed asynchronously. The `getDeploymentByKey` operation can be used to confirm that data has been
* deleted successfully (if needed).
*
* Only Connect apps that define the `jiraDeploymentInfoProvider` module, and on-premise integrations, can access this
* resource. This resource requires the 'DELETE' scope for Connect apps.
*/
async deleteDeploymentByKey<T = unknown>(parameters: Parameters.DeleteDeploymentByKey, callback?: never): Promise<T>;
async deleteDeploymentByKey<T = unknown>(
parameters: Parameters.DeleteDeploymentByKey,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/deployments/0.1/pipelines/${parameters.pipelineId}/environments/${parameters.environmentId}/deployments/${parameters.deploymentSequenceNumber}`,
method: 'DELETE',
params: {
_updateSequenceNumber: parameters.updateSequenceNumber,
},
};
return this.client.sendRequest(config, callback);
}
/**
* Retrieve the Deployment gating status for the given `pipelineId + environmentId + deploymentSequenceNumber`
* combination. Only apps that define the `jiraDeploymentInfoProvider` module can access this resource. This resource
* requires the 'READ' scope.
*/
async getDeploymentGatingStatusByKey<T = Models.GetDeploymentGatingStatusByKey>(
parameters: Parameters.GetDeploymentGatingStatusByKey,
callback: Callback<T>,
): Promise<void>;
/**
* Retrieve the Deployment gating status for the given `pipelineId + environmentId + deploymentSequenceNumber`
* combination. Only apps that define the `jiraDeploymentInfoProvider` module can access this resource. This resource
* requires the 'READ' scope.
*/
async getDeploymentGatingStatusByKey<T = Models.GetDeploymentGatingStatusByKey>(
parameters: Parameters.GetDeploymentGatingStatusByKey,
callback?: never,
): Promise<T>;
async getDeploymentGatingStatusByKey<T = Models.GetDeploymentGatingStatusByKey>(
parameters: Parameters.GetDeploymentGatingStatusByKey,
callback?: Callback<T>,
): Promise<void | T> {
const config: RequestConfig = {
url: `/rest/deployments/0.1/pipelines/${parameters.pipelineId}/environments/${parameters.environmentId}/deployments/${parameters.deploymentSequenceNumber}/gating-status`,
method: 'GET',
};
return this.client.sendRequest(config, callback);
}
}