/
types.go
527 lines (433 loc) · 19.4 KB
/
types.go
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
// Code generated by smithy-go-codegen DO NOT EDIT.
package types
import (
"time"
)
// Information about an AWS CodeCommit repository. The CodeCommit repository must
// be in the same AWS Region and AWS account where its CodeGuru Reviewer code
// reviews are configured.
type CodeCommitRepository struct {
// The name of the AWS CodeCommit repository. For more information, see
// repositoryName
// (https://docs.aws.amazon.com/codecommit/latest/APIReference/API_GetRepository.html#CodeCommit-GetRepository-request-repositoryName)
// in the AWS CodeCommit API Reference.
//
// This member is required.
Name *string
}
// Information about a code review. A code review belongs to the associated
// repository that contains the reviewed code.
type CodeReview struct {
// The Amazon Resource Name (ARN) of the RepositoryAssociation
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html)
// that contains the reviewed source code. You can retrieve associated repository
// ARNs by calling ListRepositoryAssociations
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html).
AssociationArn *string
// The Amazon Resource Name (ARN) of the CodeReview
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReview.html)
// object.
CodeReviewArn *string
// The time, in milliseconds since the epoch, when the code review was created.
CreatedTimeStamp *time.Time
// The time, in milliseconds since the epoch, when the code review was last
// updated.
LastUpdatedTimeStamp *time.Time
// The statistics from the code review.
Metrics *Metrics
// The name of the code review.
Name *string
// The owner of the repository. For an AWS CodeCommit repository, this is the AWS
// account ID of the account that owns the repository. For a GitHub, GitHub
// Enterprise Server, or Bitbucket repository, this is the username for the account
// that owns the repository.
Owner *string
// The type of repository that contains the reviewed code (for example, GitHub or
// Bitbucket).
ProviderType ProviderType
// The pull request ID for the code review.
PullRequestId *string
// The name of the repository.
RepositoryName *string
// The type of the source code for the code review.
SourceCodeType *SourceCodeType
// The valid code review states are:
//
// * Completed: The code review is complete.
//
// *
// Pending: The code review started and has not completed or failed.
//
// * Failed: The
// code review failed.
//
// * Deleting: The code review is being deleted.
State JobState
// The reason for the state of the code review.
StateReason *string
// The type of code review.
Type Type
}
// Information about the summary of the code review.
type CodeReviewSummary struct {
// The Amazon Resource Name (ARN) of the CodeReview
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReview.html)
// object.
CodeReviewArn *string
// The time, in milliseconds since the epoch, when the code review was created.
CreatedTimeStamp *time.Time
// The time, in milliseconds since the epoch, when the code review was last
// updated.
LastUpdatedTimeStamp *time.Time
// The statistics from the code review.
MetricsSummary *MetricsSummary
// The name of the code review.
Name *string
// The owner of the repository. For an AWS CodeCommit repository, this is the AWS
// account ID of the account that owns the repository. For a GitHub, GitHub
// Enterprise Server, or Bitbucket repository, this is the username for the account
// that owns the repository.
Owner *string
// The provider type of the repository association.
ProviderType ProviderType
// The pull request ID for the code review.
PullRequestId *string
// The name of the repository.
RepositoryName *string
// The state of the code review. The valid code review states are:
//
// * Completed:
// The code review is complete.
//
// * Pending: The code review started and has not
// completed or failed.
//
// * Failed: The code review failed.
//
// * Deleting: The code
// review is being deleted.
State JobState
// The type of the code review.
Type Type
}
// The type of a code review. There are two code review types:
//
// * PullRequest - A
// code review that is automatically triggered by a pull request on an assocaited
// repository. Because this type of code review is automatically generated, you
// cannot specify this code review type using CreateCodeReview
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CreateCodeReview).
//
// *
// RepositoryAnalysis - A code review that analyzes all code under a specified
// branch in an associated respository. The assocated repository is specified using
// its ARN in CreateCodeReview
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CreateCodeReview).
type CodeReviewType struct {
// A code review that analyzes all code under a specified branch in an associated
// respository. The assocated repository is specified using its ARN in
// CreateCodeReview
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CreateCodeReview).
//
// This member is required.
RepositoryAnalysis *RepositoryAnalysis
}
// A type of SourceCodeType
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType)
// that specifies the commit diff for a pull request on an associated repository.
type CommitDiffSourceCodeType struct {
// The SHA of the destination commit used to generate a commit diff.
DestinationCommit *string
// The SHA of the source commit used to generate a commit diff.
SourceCommit *string
}
// Information about the statistics from the code review.
type Metrics struct {
// Total number of recommendations found in the code review.
FindingsCount *int64
// Lines of code metered in the code review. For the initial code review pull
// request and all subsequent revisions, this includes all lines of code in the
// files added to the pull request. In subsequent revisions, for files that already
// existed in the pull request, this includes only the changed lines of code. In
// both cases, this does not include non-code lines such as comments and import
// statements. For example, if you submit a pull request containing 5 files, each
// with 500 lines of code, and in a subsequent revision you added a new file with
// 200 lines of code, and also modified a total of 25 lines across the initial 5
// files, MeteredLinesOfCodeCount includes the first 5 files (5 * 500 = 2,500
// lines), the new file (200 lines) and the 25 changed lines of code for a total of
// 2,725 lines of code.
MeteredLinesOfCodeCount *int64
}
// Information about metrics summaries.
type MetricsSummary struct {
// Total number of recommendations found in the code review.
FindingsCount *int64
// Lines of code metered in the code review. For the initial code review pull
// request and all subsequent revisions, this includes all lines of code in the
// files added to the pull request. In subsequent revisions, for files that already
// existed in the pull request, this includes only the changed lines of code. In
// both cases, this does not include non-code lines such as comments and import
// statements. For example, if you submit a pull request containing 5 files, each
// with 500 lines of code, and in a subsequent revision you added a new file with
// 200 lines of code, and also modified a total of 25 lines across the initial 5
// files, MeteredLinesOfCodeCount includes the first 5 files (5 * 500 = 2,500
// lines), the new file (200 lines) and the 25 changed lines of code for a total of
// 2,725 lines of code.
MeteredLinesOfCodeCount *int64
}
// Information about the recommendation feedback.
type RecommendationFeedback struct {
// The Amazon Resource Name (ARN) of the CodeReview
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReview.html)
// object.
CodeReviewArn *string
// The time at which the feedback was created.
CreatedTimeStamp *time.Time
// The time at which the feedback was last updated.
LastUpdatedTimeStamp *time.Time
// List for storing reactions. Reactions are utf-8 text code for emojis. You can
// send an empty list to clear off all your feedback.
Reactions []Reaction
// The recommendation ID that can be used to track the provided recommendations.
// Later on it can be used to collect the feedback.
RecommendationId *string
// The ID of the user that made the API call. The UserId is an IAM principal that
// can be specified as an AWS account ID or an Amazon Resource Name (ARN). For more
// information, see Specifying a Principal
// (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html#Principal_specifying)
// in the AWS Identity and Access Management User Guide.
UserId *string
}
// Information about recommendation feedback summaries.
type RecommendationFeedbackSummary struct {
// List for storing reactions. Reactions are utf-8 text code for emojis.
Reactions []Reaction
// The recommendation ID that can be used to track the provided recommendations.
// Later on it can be used to collect the feedback.
RecommendationId *string
// The ID of the user that gave the feedback. The UserId is an IAM principal that
// can be specified as an AWS account ID or an Amazon Resource Name (ARN). For more
// information, see Specifying a Principal
// (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html#Principal_specifying)
// in the AWS Identity and Access Management User Guide.
UserId *string
}
// Information about recommendations.
type RecommendationSummary struct {
// A description of the recommendation generated by CodeGuru Reviewer for the lines
// of code between the start line and the end line.
Description *string
// Last line where the recommendation is applicable in the source commit or source
// branch. For a single line comment the start line and end line values are the
// same.
EndLine *int32
// Name of the file on which a recommendation is provided.
FilePath *string
// The recommendation ID that can be used to track the provided recommendations.
// Later on it can be used to collect the feedback.
RecommendationId *string
// Start line from where the recommendation is applicable in the source commit or
// source branch.
StartLine *int32
}
// Information about an associated AWS CodeCommit repository or an associated
// repository that is managed by AWS CodeStar Connections (for example, Bitbucket).
// This Repository object is not used if your source code is in an associated
// GitHub repository.
type Repository struct {
// Information about a Bitbucket repository.
Bitbucket *ThirdPartySourceRepository
// Information about an AWS CodeCommit repository.
CodeCommit *CodeCommitRepository
// Information about a GitHub Enterprise Server repository.
GitHubEnterpriseServer *ThirdPartySourceRepository
}
// A code review type that analyzes all code under a specified branch in an
// associated respository. The assocated repository is specified using its ARN when
// you call CreateCodeReview
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CreateCodeReview).
type RepositoryAnalysis struct {
// A SourceCodeType
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType)
// that specifies the tip of a branch in an associated repository.
//
// This member is required.
RepositoryHead *RepositoryHeadSourceCodeType
}
// Information about a repository association. The DescribeRepositoryAssociation
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_DescribeRepositoryAssociation.html)
// operation returns a RepositoryAssociation object.
type RepositoryAssociation struct {
// The Amazon Resource Name (ARN) identifying the repository association.
AssociationArn *string
// The ID of the repository association.
AssociationId *string
// The Amazon Resource Name (ARN) of an AWS CodeStar Connections connection. Its
// format is
// arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id.
// For more information, see Connection
// (https://docs.aws.amazon.com/codestar-connections/latest/APIReference/API_Connection.html)
// in the AWS CodeStar Connections API Reference.
ConnectionArn *string
// The time, in milliseconds since the epoch, when the repository association was
// created.
CreatedTimeStamp *time.Time
// The time, in milliseconds since the epoch, when the repository association was
// last updated.
LastUpdatedTimeStamp *time.Time
// The name of the repository.
Name *string
// The owner of the repository. For an AWS CodeCommit repository, this is the AWS
// account ID of the account that owns the repository. For a GitHub, GitHub
// Enterprise Server, or Bitbucket repository, this is the username for the account
// that owns the repository.
Owner *string
// The provider type of the repository association.
ProviderType ProviderType
// The state of the repository association. The valid repository association states
// are:
//
// * Associated: The repository association is complete.
//
// * Associating:
// CodeGuru Reviewer is:
//
// * Setting up pull request notifications. This is required
// for pull requests to trigger a CodeGuru Reviewer review. If your repository
// ProviderType is GitHub, GitHub Enterprise Server, or Bitbucket, CodeGuru
// Reviewer creates webhooks in your repository to trigger CodeGuru Reviewer
// reviews. If you delete these webhooks, reviews of code in your repository cannot
// be triggered.
//
// * Setting up source code access. This is required for CodeGuru
// Reviewer to securely clone code in your repository.
//
// * Failed: The repository
// failed to associate or disassociate.
//
// * Disassociating: CodeGuru Reviewer is
// removing the repository's pull request notifications and source code access.
//
// *
// Disassociated: CodeGuru Reviewer successfully disassociated the repository. You
// can create a new association with this repository if you want to review source
// code in it later. You can control access to code reviews created in an
// associated repository with tags after it has been disassociated. For more
// information, see Using tags to control access to associated repositories
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/auth-and-access-control-using-tags.html)
// in the Amazon CodeGuru Reviewer User Guide.
State RepositoryAssociationState
// A description of why the repository association is in the current state.
StateReason *string
}
// Summary information about a repository association. The
// ListRepositoryAssociations
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html)
// operation returns a list of RepositoryAssociationSummary objects.
type RepositoryAssociationSummary struct {
// The Amazon Resource Name (ARN) of the RepositoryAssociation
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html)
// object. You can retrieve this ARN by calling ListRepositoryAssociations
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html).
AssociationArn *string
// The repository association ID.
AssociationId *string
// The Amazon Resource Name (ARN) of an AWS CodeStar Connections connection. Its
// format is
// arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id.
// For more information, see Connection
// (https://docs.aws.amazon.com/codestar-connections/latest/APIReference/API_Connection.html)
// in the AWS CodeStar Connections API Reference.
ConnectionArn *string
// The time, in milliseconds since the epoch, since the repository association was
// last updated.
LastUpdatedTimeStamp *time.Time
// The name of the repository association.
Name *string
// The owner of the repository. For an AWS CodeCommit repository, this is the AWS
// account ID of the account that owns the repository. For a GitHub, GitHub
// Enterprise Server, or Bitbucket repository, this is the username for the account
// that owns the repository.
Owner *string
// The provider type of the repository association.
ProviderType ProviderType
// The state of the repository association. The valid repository association states
// are:
//
// * Associated: The repository association is complete.
//
// * Associating:
// CodeGuru Reviewer is:
//
// * Setting up pull request notifications. This is required
// for pull requests to trigger a CodeGuru Reviewer review. If your repository
// ProviderType is GitHub, GitHub Enterprise Server, or Bitbucket, CodeGuru
// Reviewer creates webhooks in your repository to trigger CodeGuru Reviewer
// reviews. If you delete these webhooks, reviews of code in your repository cannot
// be triggered.
//
// * Setting up source code access. This is required for CodeGuru
// Reviewer to securely clone code in your repository.
//
// * Failed: The repository
// failed to associate or disassociate.
//
// * Disassociating: CodeGuru Reviewer is
// removing the repository's pull request notifications and source code access.
//
// *
// Disassociated: CodeGuru Reviewer successfully disassociated the repository. You
// can create a new association with this repository if you want to review source
// code in it later. You can control access to code reviews created in an
// associated repository with tags after it has been disassociated. For more
// information, see Using tags to control access to associated repositories
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/auth-and-access-control-using-tags.html)
// in the Amazon CodeGuru Reviewer User Guide.
State RepositoryAssociationState
}
// A SourceCodeType
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType)
// that specifies the tip of a branch in an associated repository.
type RepositoryHeadSourceCodeType struct {
// The name of the branch in an associated repository. The
// RepositoryHeadSourceCodeType specifies the tip of this branch.
//
// This member is required.
BranchName *string
}
// Specifies the source code that is analyzed in a code review. A code review can
// analyze the source code that is specified using a pull request diff or a branch
// in an associated repository.
type SourceCodeType struct {
// A SourceCodeType
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType)
// that specifies a commit diff created by a pull request on an associated
// repository.
CommitDiff *CommitDiffSourceCodeType
// A SourceCodeType
// (https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_SourceCodeType)
// that specifies the tip of a branch in an associated repository.
RepositoryHead *RepositoryHeadSourceCodeType
}
// Information about a third-party source repository connected to CodeGuru
// Reviewer.
type ThirdPartySourceRepository struct {
// The Amazon Resource Name (ARN) of an AWS CodeStar Connections connection. Its
// format is
// arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id.
// For more information, see Connection
// (https://docs.aws.amazon.com/codestar-connections/latest/APIReference/API_Connection.html)
// in the AWS CodeStar Connections API Reference.
//
// This member is required.
ConnectionArn *string
// The name of the third party source repository.
//
// This member is required.
Name *string
// The owner of the repository. For a GitHub, GitHub Enterprise, or Bitbucket
// repository, this is the username for the account that owns the repository.
//
// This member is required.
Owner *string
}