Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style |
| 3 | # license that can be found in the LICENSE file or at |
| 4 | # https://developers.google.com/open-source/licenses/bsd |
| 5 | |
| 6 | """Protocol buffers for Monorail API.""" |
| 7 | |
| 8 | from __future__ import print_function |
| 9 | from __future__ import division |
| 10 | from __future__ import absolute_import |
| 11 | |
| 12 | from endpoints import ResourceContainer |
| 13 | from protorpc import messages |
| 14 | from protorpc import message_types |
| 15 | |
| 16 | from proto import usergroup_pb2 |
| 17 | |
| 18 | |
| 19 | ########################## Helper Message ########################## |
| 20 | |
| 21 | |
| 22 | class ErrorMessage(messages.Message): |
| 23 | """Request error.""" |
| 24 | code = messages.IntegerField( |
| 25 | 1, required=True, variant=messages.Variant.INT32) |
| 26 | reason = messages.StringField(2, required=True) |
| 27 | message = messages.StringField(3, required=True) |
| 28 | |
| 29 | |
| 30 | class Status(messages.Message): |
| 31 | """Issue status.""" |
| 32 | status = messages.StringField(1, required=True) |
| 33 | meansOpen = messages.BooleanField(2, required=True) |
| 34 | description = messages.StringField(3) |
| 35 | |
| 36 | |
| 37 | class Label(messages.Message): |
| 38 | """Issue label.""" |
| 39 | label = messages.StringField(1, required=True) |
| 40 | description = messages.StringField(2) |
| 41 | |
| 42 | |
| 43 | class Prompt(messages.Message): |
| 44 | """Default issue template values.""" |
| 45 | name = messages.StringField(1, required=True) |
| 46 | title = messages.StringField(2) |
| 47 | description = messages.StringField(3) |
| 48 | titleMustBeEdited = messages.BooleanField(4) |
| 49 | status = messages.StringField(5) |
| 50 | labels = messages.StringField(6, repeated=True) |
| 51 | membersOnly = messages.BooleanField(7) |
| 52 | defaultToMember = messages.BooleanField(8) |
| 53 | componentRequired = messages.BooleanField(9) |
| 54 | |
| 55 | |
| 56 | class Role(messages.Enum): |
| 57 | """User role.""" |
| 58 | owner = 1 |
| 59 | member = 2 |
| 60 | contributor = 3 |
| 61 | |
| 62 | |
| 63 | class IssueState(messages.Enum): |
| 64 | """Issue state.""" |
| 65 | closed = 0 |
| 66 | open = 1 |
| 67 | |
| 68 | |
| 69 | class CannedQuery(messages.Enum): |
| 70 | """Canned query to search issues.""" |
| 71 | all = 0 |
| 72 | new = 1 |
| 73 | open = 2 |
| 74 | owned = 3 |
| 75 | reported = 4 |
| 76 | starred = 5 |
| 77 | to_verify = 6 |
| 78 | |
| 79 | |
| 80 | class AtomPerson(messages.Message): |
| 81 | """Atomic person.""" |
| 82 | name = messages.StringField(1, required=True) |
| 83 | htmlLink = messages.StringField(2) |
| 84 | kind = messages.StringField(3) |
| 85 | last_visit_days_ago = messages.IntegerField(4) |
| 86 | email_bouncing = messages.BooleanField(5) |
| 87 | vacation_message = messages.StringField(6) |
| 88 | |
| 89 | |
| 90 | class Attachment(messages.Message): |
| 91 | """Issue attachment.""" |
| 92 | attachmentId = messages.IntegerField( |
| 93 | 1, variant=messages.Variant.INT64, required=True) |
| 94 | fileName = messages.StringField(2, required=True) |
| 95 | fileSize = messages.IntegerField( |
| 96 | 3, required=True, variant=messages.Variant.INT32) |
| 97 | mimetype = messages.StringField(4, required=True) |
| 98 | isDeleted = messages.BooleanField(5) |
| 99 | |
| 100 | |
| 101 | class IssueRef(messages.Message): |
| 102 | "Issue reference." |
| 103 | issueId = messages.IntegerField( |
| 104 | 1, required=True, variant=messages.Variant.INT32) |
| 105 | projectId = messages.StringField(2) |
| 106 | kind = messages.StringField(3) |
| 107 | |
| 108 | |
| 109 | class FieldValueOperator(messages.Enum): |
| 110 | """Operator of field values.""" |
| 111 | add = 1 |
| 112 | remove = 2 |
| 113 | clear = 3 |
| 114 | |
| 115 | |
| 116 | class FieldValue(messages.Message): |
| 117 | """Custom field values.""" |
| 118 | fieldName = messages.StringField(1, required=True) |
| 119 | fieldValue = messages.StringField(2) |
| 120 | derived = messages.BooleanField(3, default=False) |
| 121 | operator = messages.EnumField(FieldValueOperator, 4, default='add') |
| 122 | phaseName = messages.StringField(5) |
| 123 | approvalName = messages.StringField(6) |
| 124 | |
| 125 | |
| 126 | class Update(messages.Message): |
| 127 | """Issue update.""" |
| 128 | summary = messages.StringField(1) |
| 129 | status = messages.StringField(2) |
| 130 | owner = messages.StringField(3) |
| 131 | labels = messages.StringField(4, repeated=True) |
| 132 | cc = messages.StringField(5, repeated=True) |
| 133 | blockedOn = messages.StringField(6, repeated=True) |
| 134 | blocking = messages.StringField(7, repeated=True) |
| 135 | mergedInto = messages.StringField(8) |
| 136 | kind = messages.StringField(9) |
| 137 | components = messages.StringField(10, repeated=True) |
| 138 | moveToProject = messages.StringField(11) |
| 139 | fieldValues = messages.MessageField(FieldValue, 12, repeated=True) |
| 140 | is_description = messages.BooleanField(13) |
| 141 | |
| 142 | |
| 143 | class ApprovalUpdate(messages.Message): |
| 144 | """Approval update.""" |
| 145 | approvers = messages.StringField(1, repeated=True) |
| 146 | status = messages.StringField(2) |
| 147 | kind = messages.StringField(3) |
| 148 | fieldValues = messages.MessageField(FieldValue, 4, repeated=True) |
| 149 | |
| 150 | |
| 151 | class ProjectIssueConfig(messages.Message): |
| 152 | """Issue configuration of project.""" |
| 153 | kind = messages.StringField(1) |
| 154 | restrictToKnown = messages.BooleanField(2) |
| 155 | defaultColumns = messages.StringField(3, repeated=True) |
| 156 | defaultSorting = messages.StringField(4, repeated=True) |
| 157 | statuses = messages.MessageField(Status, 5, repeated=True) |
| 158 | labels = messages.MessageField(Label, 6, repeated=True) |
| 159 | prompts = messages.MessageField(Prompt, 7, repeated=True) |
| 160 | defaultPromptForMembers = messages.IntegerField( |
| 161 | 8, variant=messages.Variant.INT32) |
| 162 | defaultPromptForNonMembers = messages.IntegerField( |
| 163 | 9, variant=messages.Variant.INT32) |
| 164 | usersCanSetLabels = messages.BooleanField(10) |
| 165 | |
| 166 | |
| 167 | class Phase(messages.Message): |
| 168 | """Issue phase details.""" |
| 169 | phaseName = messages.StringField(1) |
| 170 | rank = messages.IntegerField(2) |
| 171 | |
| 172 | |
| 173 | class IssueCommentWrapper(messages.Message): |
| 174 | """Issue comment details.""" |
| 175 | attachments = messages.MessageField(Attachment, 1, repeated=True) |
| 176 | author = messages.MessageField(AtomPerson, 2) |
| 177 | canDelete = messages.BooleanField(3) |
| 178 | content = messages.StringField(4) |
| 179 | deletedBy = messages.MessageField(AtomPerson, 5) |
| 180 | id = messages.IntegerField(6, variant=messages.Variant.INT32) |
| 181 | published = message_types.DateTimeField(7) |
| 182 | updates = messages.MessageField(Update, 8) |
| 183 | kind = messages.StringField(9) |
| 184 | is_description = messages.BooleanField(10) |
| 185 | |
| 186 | |
| 187 | class ApprovalCommentWrapper(messages.Message): |
| 188 | """Approval comment details.""" |
| 189 | attachments = messages.MessageField(Attachment, 1, repeated=True) |
| 190 | author = messages.MessageField(AtomPerson, 2) |
| 191 | canDelete = messages.BooleanField(3) |
| 192 | content = messages.StringField(4) |
| 193 | deletedBy = messages.MessageField(AtomPerson, 5) |
| 194 | id = messages.IntegerField(6, variant=messages.Variant.INT32) |
| 195 | published = message_types.DateTimeField(7) |
| 196 | approvalUpdates = messages.MessageField(ApprovalUpdate, 8) |
| 197 | kind = messages.StringField(9) |
| 198 | is_description = messages.BooleanField(10) |
| 199 | |
| 200 | |
| 201 | class ApprovalStatus(messages.Enum): |
| 202 | """Allowed Approval Statuses.""" |
| 203 | needsReview = 1 |
| 204 | nA = 2 |
| 205 | reviewRequested = 3 |
| 206 | reviewStarted = 4 |
| 207 | needInfo = 5 |
| 208 | approved = 6 |
| 209 | notApproved = 7 |
| 210 | notSet = 8 |
| 211 | |
| 212 | |
| 213 | class Approval(messages.Message): |
| 214 | """Approval Value details""" |
| 215 | approvalName = messages.StringField(1) |
| 216 | approvers = messages.MessageField(AtomPerson, 2, repeated=True) |
| 217 | status = messages.EnumField(ApprovalStatus, 3) |
| 218 | setter = messages.MessageField(AtomPerson, 4) |
| 219 | setOn = message_types.DateTimeField(5) |
| 220 | phaseName = messages.StringField(6) |
| 221 | |
| 222 | |
| 223 | class IssueWrapper(messages.Message): |
| 224 | """Issue details.""" |
| 225 | author = messages.MessageField(AtomPerson, 1) |
| 226 | blockedOn = messages.MessageField(IssueRef, 2, repeated=True) |
| 227 | blocking = messages.MessageField(IssueRef, 3, repeated=True) |
| 228 | canComment = messages.BooleanField(4) |
| 229 | canEdit = messages.BooleanField(5) |
| 230 | cc = messages.MessageField(AtomPerson, 6, repeated=True) |
| 231 | closed = message_types.DateTimeField(7) |
| 232 | description = messages.StringField(8) |
| 233 | id = messages.IntegerField(9, variant=messages.Variant.INT32) |
| 234 | kind = messages.StringField(10) |
| 235 | labels = messages.StringField(11, repeated=True) |
| 236 | owner = messages.MessageField(AtomPerson, 12) |
| 237 | published = message_types.DateTimeField(13) |
| 238 | starred = messages.BooleanField(14) |
| 239 | stars = messages.IntegerField(15, variant=messages.Variant.INT32) |
| 240 | state = messages.EnumField(IssueState, 16) |
| 241 | status = messages.StringField(17, required=True) |
| 242 | summary = messages.StringField(18, required=True) |
| 243 | title = messages.StringField(19) |
| 244 | updated = message_types.DateTimeField(20) |
| 245 | components = messages.StringField(21, repeated=True) |
| 246 | projectId = messages.StringField(22, required=True) |
| 247 | mergedInto = messages.MessageField(IssueRef, 23) |
| 248 | fieldValues = messages.MessageField(FieldValue, 24, repeated=True) |
| 249 | owner_modified = message_types.DateTimeField(25) |
| 250 | status_modified = message_types.DateTimeField(26) |
| 251 | component_modified = message_types.DateTimeField(27) |
| 252 | approvalValues = messages.MessageField(Approval, 28, repeated=True) |
| 253 | phases = messages.MessageField(Phase, 29, repeated=True) |
| 254 | |
| 255 | |
| 256 | class ProjectWrapper(messages.Message): |
| 257 | """Project details.""" |
| 258 | kind = messages.StringField(1) |
| 259 | name = messages.StringField(2) |
| 260 | externalId = messages.StringField(3, required=True) |
| 261 | htmlLink = messages.StringField(4, required=True) |
| 262 | summary = messages.StringField(5) |
| 263 | description = messages.StringField(6) |
| 264 | versionControlSystem = messages.StringField(7) |
| 265 | repositoryUrls = messages.StringField(8, repeated=True) |
| 266 | issuesConfig = messages.MessageField(ProjectIssueConfig, 9) |
| 267 | role = messages.EnumField(Role, 10) |
| 268 | members = messages.MessageField(AtomPerson, 11, repeated=True) |
| 269 | |
| 270 | |
| 271 | class UserGroupSettingsWrapper(messages.Message): |
| 272 | """User group settings.""" |
| 273 | groupName = messages.StringField(1, required=True) |
| 274 | who_can_view_members = messages.EnumField( |
| 275 | usergroup_pb2.MemberVisibility, 2, |
| 276 | default=usergroup_pb2.MemberVisibility.MEMBERS) |
| 277 | ext_group_type = messages.EnumField(usergroup_pb2.GroupType, 3) |
| 278 | last_sync_time = messages.IntegerField( |
| 279 | 4, default=0, variant=messages.Variant.INT32) |
| 280 | |
| 281 | |
| 282 | class GroupCitizens(messages.Message): |
| 283 | """Group members and owners.""" |
| 284 | groupOwners = messages.StringField(1, repeated=True) |
| 285 | groupMembers = messages.StringField(2, repeated=True) |
| 286 | |
| 287 | |
| 288 | ########################## Comments Message ########################## |
| 289 | |
| 290 | # pylint: disable=pointless-string-statement |
| 291 | |
| 292 | """Request to delete/undelete an issue's comments.""" |
| 293 | ISSUES_COMMENTS_DELETE_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 294 | message_types.VoidMessage, |
| 295 | projectId=messages.StringField(1, required=True), |
| 296 | issueId=messages.IntegerField( |
| 297 | 2, required=True, variant=messages.Variant.INT32), |
| 298 | commentId=messages.IntegerField( |
| 299 | 3, required=True, variant=messages.Variant.INT32) |
| 300 | ) |
| 301 | |
| 302 | |
| 303 | class IssuesCommentsDeleteResponse(messages.Message): |
| 304 | """Response message of request to delete/undelete an issue's comments.""" |
| 305 | error = messages.MessageField(ErrorMessage, 1) |
| 306 | |
| 307 | |
| 308 | """Request to insert an issue's comments.""" |
| 309 | ISSUES_COMMENTS_INSERT_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 310 | IssueCommentWrapper, |
| 311 | projectId=messages.StringField(1, required=True), |
| 312 | issueId=messages.IntegerField( |
| 313 | 2, required=True, variant=messages.Variant.INT32), |
| 314 | sendEmail=messages.BooleanField(3) |
| 315 | ) |
| 316 | |
| 317 | |
| 318 | class IssuesCommentsInsertResponse(messages.Message): |
| 319 | """Response message of request to insert an issue's comments.""" |
| 320 | error = messages.MessageField(ErrorMessage, 1) |
| 321 | id = messages.IntegerField(2, variant=messages.Variant.INT32) |
| 322 | kind = messages.StringField(3) |
| 323 | author = messages.MessageField(AtomPerson, 4) |
| 324 | content = messages.StringField(5) |
| 325 | published = message_types.DateTimeField(6) |
| 326 | updates = messages.MessageField(Update, 7) |
| 327 | canDelete = messages.BooleanField(8) |
| 328 | |
| 329 | |
| 330 | """Request to list an issue's comments.""" |
| 331 | ISSUES_COMMENTS_LIST_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 332 | message_types.VoidMessage, |
| 333 | projectId=messages.StringField(1, required=True), |
| 334 | issueId=messages.IntegerField( |
| 335 | 2, required=True, variant=messages.Variant.INT32), |
| 336 | maxResults=messages.IntegerField( |
| 337 | 3, default=100, variant=messages.Variant.INT32), |
| 338 | startIndex=messages.IntegerField( |
| 339 | 4, default=0, variant=messages.Variant.INT32) |
| 340 | ) |
| 341 | |
| 342 | |
| 343 | class IssuesCommentsListResponse(messages.Message): |
| 344 | """Response message of request to list an issue's comments.""" |
| 345 | error = messages.MessageField(ErrorMessage, 1) |
| 346 | items = messages.MessageField(IssueCommentWrapper, 2, repeated=True) |
| 347 | totalResults = messages.IntegerField(3, variant=messages.Variant.INT32) |
| 348 | kind = messages.StringField(4) |
| 349 | |
| 350 | ########################## ApprovalComments Message ################ |
| 351 | |
| 352 | """Request to insert an issue approval's comments.""" |
| 353 | APPROVALS_COMMENTS_INSERT_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 354 | ApprovalCommentWrapper, |
| 355 | projectId=messages.StringField(1, required=True), |
| 356 | issueId=messages.IntegerField( |
| 357 | 2, required=True, variant=messages.Variant.INT32), |
| 358 | approvalName=messages.StringField(3, required=True), |
| 359 | sendEmail=messages.BooleanField(4) |
| 360 | ) |
| 361 | |
| 362 | |
| 363 | class ApprovalsCommentsInsertResponse(messages.Message): |
| 364 | """Response message of request to insert an isuse's comments.""" |
| 365 | error = messages.MessageField(ErrorMessage, 1) |
| 366 | id = messages.IntegerField(2, variant=messages.Variant.INT32) |
| 367 | kind = messages.StringField(3) |
| 368 | author = messages.MessageField(AtomPerson, 4) |
| 369 | content = messages.StringField(5) |
| 370 | published = message_types.DateTimeField(6) |
| 371 | approvalUpdates = messages.MessageField(ApprovalUpdate, 7) |
| 372 | canDelete = messages.BooleanField(8) |
| 373 | approvalName = messages.StringField(9) |
| 374 | |
| 375 | |
| 376 | """Requests to list an approval's comments.""" |
| 377 | APPROVALS_COMMENTS_LIST_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 378 | message_types.VoidMessage, |
| 379 | projectId=messages.StringField(1, required=True), |
| 380 | issueId=messages.IntegerField( |
| 381 | 2, required=True, variant=messages.Variant.INT32), |
| 382 | approvalName=messages.StringField(3, required=True), |
| 383 | maxResults=messages.IntegerField( |
| 384 | 4, default=100, variant=messages.Variant.INT32), |
| 385 | startIndex=messages.IntegerField( |
| 386 | 5, default=0, variant=messages.Variant.INT32) |
| 387 | ) |
| 388 | |
| 389 | |
| 390 | class ApprovalsCommentsListResponse(messages.Message): |
| 391 | """Response message of request to list an approval's comments.""" |
| 392 | error = messages.MessageField(ErrorMessage, 1) |
| 393 | items = messages.MessageField(ApprovalCommentWrapper, 2, repeated=True) |
| 394 | totalResults = messages.IntegerField(3, variant=messages.Variant.INT32) |
| 395 | kind = messages.StringField(4) |
| 396 | |
| 397 | ########################## Users Message ########################## |
| 398 | |
| 399 | """Request to get a user.""" |
| 400 | USERS_GET_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 401 | message_types.VoidMessage, |
| 402 | userId=messages.StringField(1, required=True), |
| 403 | ownerProjectsOnly=messages.BooleanField(2, default=False) |
| 404 | ) |
| 405 | |
| 406 | |
| 407 | class UsersGetResponse(messages.Message): |
| 408 | """Response message of request to get a user.""" |
| 409 | error = messages.MessageField(ErrorMessage, 1) |
| 410 | id = messages.StringField(2) |
| 411 | kind = messages.StringField(3) |
| 412 | projects = messages.MessageField(ProjectWrapper, 4, repeated=True) |
| 413 | |
| 414 | |
| 415 | ########################## Issues Message ########################## |
| 416 | |
| 417 | """Request to get an issue.""" |
| 418 | ISSUES_GET_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 419 | message_types.VoidMessage, |
| 420 | projectId=messages.StringField(1, required=True), |
| 421 | issueId=messages.IntegerField( |
| 422 | 2, required=True, variant=messages.Variant.INT32) |
| 423 | ) |
| 424 | |
| 425 | |
| 426 | """Request to insert an issue.""" |
| 427 | ISSUES_INSERT_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 428 | IssueWrapper, |
| 429 | projectId=messages.StringField(1, required=True), |
| 430 | sendEmail=messages.BooleanField(2, default=True) |
| 431 | ) |
| 432 | |
| 433 | |
| 434 | class IssuesGetInsertResponse(messages.Message): |
| 435 | """Response message of request to get/insert an issue.""" |
| 436 | error = messages.MessageField(ErrorMessage, 1) |
| 437 | kind = messages.StringField(2) |
| 438 | id = messages.IntegerField(3, variant=messages.Variant.INT32) |
| 439 | title = messages.StringField(4) |
| 440 | summary = messages.StringField(5) |
| 441 | stars = messages.IntegerField(6, variant=messages.Variant.INT32) |
| 442 | starred = messages.BooleanField(7) |
| 443 | status = messages.StringField(8) |
| 444 | state = messages.EnumField(IssueState, 9) |
| 445 | labels = messages.StringField(10, repeated=True) |
| 446 | author = messages.MessageField(AtomPerson, 11) |
| 447 | owner = messages.MessageField(AtomPerson, 12) |
| 448 | cc = messages.MessageField(AtomPerson, 13, repeated=True) |
| 449 | updated = message_types.DateTimeField(14) |
| 450 | published = message_types.DateTimeField(15) |
| 451 | closed = message_types.DateTimeField(16) |
| 452 | blockedOn = messages.MessageField(IssueRef, 17, repeated=True) |
| 453 | blocking = messages.MessageField(IssueRef, 18, repeated=True) |
| 454 | projectId = messages.StringField(19) |
| 455 | canComment = messages.BooleanField(20) |
| 456 | canEdit = messages.BooleanField(21) |
| 457 | components = messages.StringField(22, repeated=True) |
| 458 | mergedInto = messages.MessageField(IssueRef, 23) |
| 459 | fieldValues = messages.MessageField(FieldValue, 24, repeated=True) |
| 460 | owner_modified = message_types.DateTimeField(25) |
| 461 | status_modified = message_types.DateTimeField(26) |
| 462 | component_modified = message_types.DateTimeField(27) |
| 463 | approvalValues = messages.MessageField(Approval, 28, repeated=True) |
| 464 | phases = messages.MessageField(Phase, 29, repeated=True) |
| 465 | |
| 466 | |
| 467 | """Request to list issues.""" |
| 468 | ISSUES_LIST_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 469 | message_types.VoidMessage, |
| 470 | projectId=messages.StringField(1, required=True), |
| 471 | additionalProject=messages.StringField(2, repeated=True), |
| 472 | can=messages.EnumField(CannedQuery, 3, default='all'), |
| 473 | label=messages.StringField(4), |
| 474 | maxResults=messages.IntegerField( |
| 475 | 5, default=100, variant=messages.Variant.INT32), |
| 476 | owner=messages.StringField(6), |
| 477 | publishedMax=messages.IntegerField(7, variant=messages.Variant.INT64), |
| 478 | publishedMin=messages.IntegerField(8, variant=messages.Variant.INT64), |
| 479 | q=messages.StringField(9), |
| 480 | sort=messages.StringField(10), |
| 481 | startIndex=messages.IntegerField( |
| 482 | 11, default=0, variant=messages.Variant.INT32), |
| 483 | status=messages.StringField(12), |
| 484 | updatedMax=messages.IntegerField(13, variant=messages.Variant.INT64), |
| 485 | updatedMin=messages.IntegerField(14, variant=messages.Variant.INT64) |
| 486 | ) |
| 487 | |
| 488 | |
| 489 | class IssuesListResponse(messages.Message): |
| 490 | """Response message of request to list issues.""" |
| 491 | error = messages.MessageField(ErrorMessage, 1) |
| 492 | items = messages.MessageField(IssueWrapper, 2, repeated=True) |
| 493 | totalResults = messages.IntegerField(3, variant=messages.Variant.INT32) |
| 494 | kind = messages.StringField(4) |
| 495 | |
| 496 | |
| 497 | """Request to list group settings.""" |
| 498 | GROUPS_SETTINGS_LIST_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 499 | message_types.VoidMessage, |
| 500 | importedGroupsOnly=messages.BooleanField(1, default=False) |
| 501 | ) |
| 502 | |
| 503 | |
| 504 | class GroupsSettingsListResponse(messages.Message): |
| 505 | """Response message of request to list group settings.""" |
| 506 | error = messages.MessageField(ErrorMessage, 1) |
| 507 | groupSettings = messages.MessageField( |
| 508 | UserGroupSettingsWrapper, 2, repeated=True) |
| 509 | |
| 510 | |
| 511 | """Request to create a group.""" |
| 512 | GROUPS_CREATE_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 513 | message_types.VoidMessage, |
| 514 | groupName = messages.StringField(1, required=True), |
| 515 | who_can_view_members = messages.EnumField( |
| 516 | usergroup_pb2.MemberVisibility, 2, |
| 517 | default=usergroup_pb2.MemberVisibility.MEMBERS, required=True), |
| 518 | ext_group_type = messages.EnumField(usergroup_pb2.GroupType, 3) |
| 519 | ) |
| 520 | |
| 521 | |
| 522 | class GroupsCreateResponse(messages.Message): |
| 523 | """Response message of request to create a group.""" |
| 524 | error = messages.MessageField(ErrorMessage, 1) |
| 525 | groupID = messages.IntegerField( |
| 526 | 2, variant=messages.Variant.INT32) |
| 527 | |
| 528 | |
| 529 | """Request to get a group.""" |
| 530 | GROUPS_GET_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 531 | message_types.VoidMessage, |
| 532 | groupName = messages.StringField(1, required=True) |
| 533 | ) |
| 534 | |
| 535 | |
| 536 | class GroupsGetResponse(messages.Message): |
| 537 | """Response message of request to create a group.""" |
| 538 | error = messages.MessageField(ErrorMessage, 1) |
| 539 | groupID = messages.IntegerField( |
| 540 | 2, variant=messages.Variant.INT32) |
| 541 | groupSettings = messages.MessageField( |
| 542 | UserGroupSettingsWrapper, 3) |
| 543 | groupOwners = messages.StringField(4, repeated=True) |
| 544 | groupMembers = messages.StringField(5, repeated=True) |
| 545 | |
| 546 | |
| 547 | """Request to update a group.""" |
| 548 | GROUPS_UPDATE_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 549 | GroupCitizens, |
| 550 | groupName = messages.StringField(1, required=True), |
| 551 | who_can_view_members = messages.EnumField( |
| 552 | usergroup_pb2.MemberVisibility, 2), |
| 553 | ext_group_type = messages.EnumField(usergroup_pb2.GroupType, 3), |
| 554 | last_sync_time = messages.IntegerField( |
| 555 | 4, default=0, variant=messages.Variant.INT32), |
| 556 | friend_projects = messages.StringField(5, repeated=True), |
| 557 | ) |
| 558 | |
| 559 | |
| 560 | class GroupsUpdateResponse(messages.Message): |
| 561 | """Response message of request to update a group.""" |
| 562 | error = messages.MessageField(ErrorMessage, 1) |
| 563 | |
| 564 | |
| 565 | ########################## Component Message ########################## |
| 566 | |
| 567 | class Component(messages.Message): |
| 568 | """Component PB.""" |
| 569 | componentId = messages.IntegerField( |
| 570 | 1, required=True, variant=messages.Variant.INT32) |
| 571 | projectName = messages.StringField(2, required=True) |
| 572 | componentPath = messages.StringField(3, required=True) |
| 573 | description = messages.StringField(4) |
| 574 | admin = messages.StringField(5, repeated=True) |
| 575 | cc = messages.StringField(6, repeated=True) |
| 576 | deprecated = messages.BooleanField(7, default=False) |
| 577 | created = message_types.DateTimeField(8) |
| 578 | creator = messages.StringField(9) |
| 579 | modified = message_types.DateTimeField(10) |
| 580 | modifier = messages.StringField(11) |
| 581 | |
| 582 | |
| 583 | """Request to get components of a project.""" |
| 584 | COMPONENTS_LIST_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 585 | message_types.VoidMessage, |
| 586 | projectId=messages.StringField(1, required=True), |
| 587 | ) |
| 588 | |
| 589 | |
| 590 | class ComponentsListResponse(messages.Message): |
| 591 | """Response to list components.""" |
| 592 | components = messages.MessageField( |
| 593 | Component, 1, repeated=True) |
| 594 | |
| 595 | |
| 596 | class ComponentCreateRequestBody(messages.Message): |
| 597 | """Request body to create a component.""" |
| 598 | parentPath = messages.StringField(1) |
| 599 | description = messages.StringField(2) |
| 600 | admin = messages.StringField(3, repeated=True) |
| 601 | cc = messages.StringField(4, repeated=True) |
| 602 | deprecated = messages.BooleanField(5, default=False) |
| 603 | |
| 604 | |
| 605 | """Request to create component of a project.""" |
| 606 | COMPONENTS_CREATE_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 607 | ComponentCreateRequestBody, |
| 608 | projectId=messages.StringField(1, required=True), |
| 609 | componentName=messages.StringField(2, required=True), |
| 610 | ) |
| 611 | |
| 612 | |
| 613 | """Request to delete a component.""" |
| 614 | COMPONENTS_DELETE_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 615 | message_types.VoidMessage, |
| 616 | projectId=messages.StringField(1, required=True), |
| 617 | componentPath=messages.StringField(2, required=True), |
| 618 | ) |
| 619 | |
| 620 | |
| 621 | class ComponentUpdateFieldID(messages.Enum): |
| 622 | """Possible fields that can be updated in a component.""" |
| 623 | LEAF_NAME = 1 |
| 624 | DESCRIPTION = 2 |
| 625 | ADMIN = 3 |
| 626 | CC = 4 |
| 627 | DEPRECATED = 5 |
| 628 | |
| 629 | |
| 630 | class ComponentUpdate(messages.Message): |
| 631 | """Component update.""" |
| 632 | # 'field' allows a field to be cleared |
| 633 | field = messages.EnumField(ComponentUpdateFieldID, 1, required=True) |
| 634 | leafName = messages.StringField(2) |
| 635 | description = messages.StringField(3) |
| 636 | admin = messages.StringField(4, repeated=True) |
| 637 | cc = messages.StringField(5, repeated=True) |
| 638 | deprecated = messages.BooleanField(6) |
| 639 | |
| 640 | |
| 641 | class ComponentUpdateRequestBody(messages.Message): |
| 642 | """Request body to update a component.""" |
| 643 | updates = messages.MessageField(ComponentUpdate, 1, repeated=True) |
| 644 | |
| 645 | |
| 646 | """Request to update a component.""" |
| 647 | COMPONENTS_UPDATE_REQUEST_RESOURCE_CONTAINER = ResourceContainer( |
| 648 | ComponentUpdateRequestBody, |
| 649 | projectId=messages.StringField(1, required=True), |
| 650 | componentPath=messages.StringField(2, required=True), |
| 651 | ) |