1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.devtools.cloudbuild.v2; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/httpbody.proto"; 23import "google/api/resource.proto"; 24import "google/devtools/cloudbuild/v2/cloudbuild.proto"; 25import "google/longrunning/operations.proto"; 26import "google/protobuf/empty.proto"; 27import "google/protobuf/field_mask.proto"; 28import "google/protobuf/timestamp.proto"; 29 30option csharp_namespace = "Google.Cloud.CloudBuild.V2"; 31option go_package = "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb;cloudbuildpb"; 32option java_multiple_files = true; 33option java_outer_classname = "RepositoryManagerProto"; 34option java_package = "com.google.cloudbuild.v2"; 35option objc_class_prefix = "GCB"; 36option php_namespace = "Google\\Cloud\\Build\\V2"; 37option ruby_package = "Google::Cloud::Build::V2"; 38option (google.api.resource_definition) = { 39 type: "servicedirectory.googleapis.com/Service" 40 pattern: "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}" 41}; 42 43// Manages connections to source code repositories. 44service RepositoryManager { 45 option (google.api.default_host) = "cloudbuild.googleapis.com"; 46 option (google.api.oauth_scopes) = 47 "https://www.googleapis.com/auth/cloud-platform"; 48 49 // Creates a Connection. 50 rpc CreateConnection(CreateConnectionRequest) 51 returns (google.longrunning.Operation) { 52 option (google.api.http) = { 53 post: "/v2/{parent=projects/*/locations/*}/connections" 54 body: "connection" 55 }; 56 option (google.api.method_signature) = "parent,connection,connection_id"; 57 option (google.longrunning.operation_info) = { 58 response_type: "Connection" 59 metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" 60 }; 61 } 62 63 // Gets details of a single connection. 64 rpc GetConnection(GetConnectionRequest) returns (Connection) { 65 option (google.api.http) = { 66 get: "/v2/{name=projects/*/locations/*/connections/*}" 67 }; 68 option (google.api.method_signature) = "name"; 69 } 70 71 // Lists Connections in a given project and location. 72 rpc ListConnections(ListConnectionsRequest) 73 returns (ListConnectionsResponse) { 74 option (google.api.http) = { 75 get: "/v2/{parent=projects/*/locations/*}/connections" 76 }; 77 option (google.api.method_signature) = "parent"; 78 } 79 80 // Updates a single connection. 81 rpc UpdateConnection(UpdateConnectionRequest) 82 returns (google.longrunning.Operation) { 83 option (google.api.http) = { 84 patch: "/v2/{connection.name=projects/*/locations/*/connections/*}" 85 body: "connection" 86 }; 87 option (google.api.method_signature) = "connection,update_mask"; 88 option (google.longrunning.operation_info) = { 89 response_type: "Connection" 90 metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" 91 }; 92 } 93 94 // Deletes a single connection. 95 rpc DeleteConnection(DeleteConnectionRequest) 96 returns (google.longrunning.Operation) { 97 option (google.api.http) = { 98 delete: "/v2/{name=projects/*/locations/*/connections/*}" 99 }; 100 option (google.api.method_signature) = "name"; 101 option (google.longrunning.operation_info) = { 102 response_type: "google.protobuf.Empty" 103 metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" 104 }; 105 } 106 107 // Creates a Repository. 108 rpc CreateRepository(CreateRepositoryRequest) 109 returns (google.longrunning.Operation) { 110 option (google.api.http) = { 111 post: "/v2/{parent=projects/*/locations/*/connections/*}/repositories" 112 body: "repository" 113 }; 114 option (google.api.method_signature) = "parent,repository,repository_id"; 115 option (google.longrunning.operation_info) = { 116 response_type: "Repository" 117 metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" 118 }; 119 } 120 121 // Creates multiple repositories inside a connection. 122 rpc BatchCreateRepositories(BatchCreateRepositoriesRequest) 123 returns (google.longrunning.Operation) { 124 option (google.api.http) = { 125 post: "/v2/{parent=projects/*/locations/*/connections/*}/repositories:batchCreate" 126 body: "*" 127 }; 128 option (google.api.method_signature) = "parent,requests"; 129 option (google.longrunning.operation_info) = { 130 response_type: "BatchCreateRepositoriesResponse" 131 metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" 132 }; 133 } 134 135 // Gets details of a single repository. 136 rpc GetRepository(GetRepositoryRequest) returns (Repository) { 137 option (google.api.http) = { 138 get: "/v2/{name=projects/*/locations/*/connections/*/repositories/*}" 139 }; 140 option (google.api.method_signature) = "name"; 141 } 142 143 // Lists Repositories in a given connection. 144 rpc ListRepositories(ListRepositoriesRequest) 145 returns (ListRepositoriesResponse) { 146 option (google.api.http) = { 147 get: "/v2/{parent=projects/*/locations/*/connections/*}/repositories" 148 }; 149 option (google.api.method_signature) = "parent"; 150 } 151 152 // Deletes a single repository. 153 rpc DeleteRepository(DeleteRepositoryRequest) 154 returns (google.longrunning.Operation) { 155 option (google.api.http) = { 156 delete: "/v2/{name=projects/*/locations/*/connections/*/repositories/*}" 157 }; 158 option (google.api.method_signature) = "name"; 159 option (google.longrunning.operation_info) = { 160 response_type: "google.protobuf.Empty" 161 metadata_type: "google.devtools.cloudbuild.v2.OperationMetadata" 162 }; 163 } 164 165 // Fetches read/write token of a given repository. 166 rpc FetchReadWriteToken(FetchReadWriteTokenRequest) 167 returns (FetchReadWriteTokenResponse) { 168 option (google.api.http) = { 169 post: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:accessReadWriteToken" 170 body: "*" 171 }; 172 option (google.api.method_signature) = "repository"; 173 } 174 175 // Fetches read token of a given repository. 176 rpc FetchReadToken(FetchReadTokenRequest) returns (FetchReadTokenResponse) { 177 option (google.api.http) = { 178 post: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:accessReadToken" 179 body: "*" 180 }; 181 option (google.api.method_signature) = "repository"; 182 } 183 184 // FetchLinkableRepositories get repositories from SCM that are 185 // accessible and could be added to the connection. 186 rpc FetchLinkableRepositories(FetchLinkableRepositoriesRequest) 187 returns (FetchLinkableRepositoriesResponse) { 188 option (google.api.http) = { 189 get: "/v2/{connection=projects/*/locations/*/connections/*}:fetchLinkableRepositories" 190 }; 191 } 192 193 // Fetch the list of branches or tags for a given repository. 194 rpc FetchGitRefs(FetchGitRefsRequest) returns (FetchGitRefsResponse) { 195 option (google.api.http) = { 196 get: "/v2/{repository=projects/*/locations/*/connections/*/repositories/*}:fetchGitRefs" 197 }; 198 option (google.api.method_signature) = "repository"; 199 } 200} 201 202// A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Data Center, 203// Bitbucket Cloud or GitLab. 204message Connection { 205 option (google.api.resource) = { 206 type: "cloudbuild.googleapis.com/Connection" 207 pattern: "projects/{project}/locations/{location}/connections/{connection}" 208 plural: "connections" 209 singular: "connection" 210 style: DECLARATIVE_FRIENDLY 211 }; 212 213 // Immutable. The resource name of the connection, in the format 214 // `projects/{project}/locations/{location}/connections/{connection_id}`. 215 string name = 1 [(google.api.field_behavior) = IMMUTABLE]; 216 217 // Output only. Server assigned timestamp for when the connection was created. 218 google.protobuf.Timestamp create_time = 3 219 [(google.api.field_behavior) = OUTPUT_ONLY]; 220 221 // Output only. Server assigned timestamp for when the connection was updated. 222 google.protobuf.Timestamp update_time = 4 223 [(google.api.field_behavior) = OUTPUT_ONLY]; 224 225 // Configuration for the connection depending on the type of provider. 226 oneof connection_config { 227 // Configuration for connections to github.com. 228 GitHubConfig github_config = 5; 229 230 // Configuration for connections to an instance of GitHub Enterprise. 231 GitHubEnterpriseConfig github_enterprise_config = 6; 232 233 // Configuration for connections to gitlab.com or an instance of GitLab 234 // Enterprise. 235 GitLabConfig gitlab_config = 7; 236 237 // Configuration for connections to Bitbucket Data Center. 238 BitbucketDataCenterConfig bitbucket_data_center_config = 8; 239 240 // Configuration for connections to Bitbucket Cloud. 241 BitbucketCloudConfig bitbucket_cloud_config = 9; 242 } 243 244 // Output only. Installation state of the Connection. 245 InstallationState installation_state = 12 246 [(google.api.field_behavior) = OUTPUT_ONLY]; 247 248 // If disabled is set to true, functionality is disabled for this connection. 249 // Repository based API methods and webhooks processing for repositories in 250 // this connection will be disabled. 251 bool disabled = 13; 252 253 // Output only. Set to true when the connection is being set up or updated in 254 // the background. 255 bool reconciling = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; 256 257 // Allows clients to store small amounts of arbitrary data. 258 map<string, string> annotations = 15; 259 260 // This checksum is computed by the server based on the value of other 261 // fields, and may be sent on update and delete requests to ensure the 262 // client has an up-to-date value before proceeding. 263 string etag = 16; 264} 265 266// Describes stage and necessary actions to be taken by the 267// user to complete the installation. Used for GitHub and GitHub Enterprise 268// based connections. 269message InstallationState { 270 // Stage of the installation process. 271 enum Stage { 272 // No stage specified. 273 STAGE_UNSPECIFIED = 0; 274 275 // Only for GitHub Enterprise. An App creation has been requested. 276 // The user needs to confirm the creation in their GitHub enterprise host. 277 PENDING_CREATE_APP = 1; 278 279 // User needs to authorize the GitHub (or Enterprise) App via OAuth. 280 PENDING_USER_OAUTH = 2; 281 282 // User needs to follow the link to install the GitHub (or Enterprise) App. 283 PENDING_INSTALL_APP = 3; 284 285 // Installation process has been completed. 286 COMPLETE = 10; 287 } 288 289 // Output only. Current step of the installation process. 290 Stage stage = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 291 292 // Output only. Message of what the user should do next to continue the 293 // installation. Empty string if the installation is already complete. 294 string message = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; 295 296 // Output only. Link to follow for next action. Empty string if the 297 // installation is already complete. 298 string action_uri = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; 299} 300 301// Request message for FetchLinkableRepositories. 302message FetchLinkableRepositoriesRequest { 303 // Required. The name of the Connection. 304 // Format: `projects/*/locations/*/connections/*`. 305 string connection = 1 [ 306 (google.api.field_behavior) = REQUIRED, 307 (google.api.resource_reference) = { 308 type: "cloudbuild.googleapis.com/Connection" 309 } 310 ]; 311 312 // Number of results to return in the list. Default to 20. 313 int32 page_size = 2; 314 315 // Page start. 316 string page_token = 3; 317} 318 319// Response message for FetchLinkableRepositories. 320message FetchLinkableRepositoriesResponse { 321 // repositories ready to be created. 322 repeated Repository repositories = 1; 323 324 // A token identifying a page of results the server should return. 325 string next_page_token = 2; 326} 327 328// Configuration for connections to github.com. 329message GitHubConfig { 330 // OAuth credential of the account that authorized the Cloud Build GitHub App. 331 // It is recommended to use a robot account instead of a human user account. 332 // The OAuth token must be tied to the Cloud Build GitHub App. 333 OAuthCredential authorizer_credential = 1; 334 335 // GitHub App installation id. 336 int64 app_installation_id = 2; 337} 338 339// Configuration for connections to an instance of GitHub Enterprise. 340message GitHubEnterpriseConfig { 341 // Required. The URI of the GitHub Enterprise host this connection is for. 342 string host_uri = 1 [(google.api.field_behavior) = REQUIRED]; 343 344 // Required. API Key used for authentication of webhook events. 345 string api_key = 12 [(google.api.field_behavior) = REQUIRED]; 346 347 // Id of the GitHub App created from the manifest. 348 int64 app_id = 2; 349 350 // The URL-friendly name of the GitHub App. 351 string app_slug = 13; 352 353 // SecretManager resource containing the private key of the GitHub App, 354 // formatted as `projects/*/secrets/*/versions/*`. 355 string private_key_secret_version = 4 [(google.api.resource_reference) = { 356 type: "secretmanager.googleapis.com/SecretVersion" 357 }]; 358 359 // SecretManager resource containing the webhook secret of the GitHub App, 360 // formatted as `projects/*/secrets/*/versions/*`. 361 string webhook_secret_secret_version = 5 [(google.api.resource_reference) = { 362 type: "secretmanager.googleapis.com/SecretVersion" 363 }]; 364 365 // ID of the installation of the GitHub App. 366 int64 app_installation_id = 9; 367 368 // Configuration for using Service Directory to privately connect to a GitHub 369 // Enterprise server. This should only be set if the GitHub Enterprise server 370 // is hosted on-premises and not reachable by public internet. If this field 371 // is left empty, calls to the GitHub Enterprise server will be made over the 372 // public internet. 373 ServiceDirectoryConfig service_directory_config = 10; 374 375 // SSL certificate to use for requests to GitHub Enterprise. 376 string ssl_ca = 11; 377 378 // Output only. GitHub Enterprise version installed at the host_uri. 379 string server_version = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; 380} 381 382// Configuration for connections to gitlab.com or an instance of GitLab 383// Enterprise. 384message GitLabConfig { 385 // The URI of the GitLab Enterprise host this connection is for. 386 // If not specified, the default value is https://gitlab.com. 387 string host_uri = 1; 388 389 // Required. Immutable. SecretManager resource containing the webhook secret 390 // of a GitLab Enterprise project, formatted as 391 // `projects/*/secrets/*/versions/*`. 392 string webhook_secret_secret_version = 2 [ 393 (google.api.field_behavior) = REQUIRED, 394 (google.api.field_behavior) = IMMUTABLE, 395 (google.api.resource_reference) = { 396 type: "secretmanager.googleapis.com/SecretVersion" 397 } 398 ]; 399 400 // Required. A GitLab personal access token with the minimum `read_api` scope 401 // access. 402 UserCredential read_authorizer_credential = 3 403 [(google.api.field_behavior) = REQUIRED]; 404 405 // Required. A GitLab personal access token with the `api` scope access. 406 UserCredential authorizer_credential = 4 407 [(google.api.field_behavior) = REQUIRED]; 408 409 // Configuration for using Service Directory to privately connect to a GitLab 410 // Enterprise server. This should only be set if the GitLab Enterprise server 411 // is hosted on-premises and not reachable by public internet. If this field 412 // is left empty, calls to the GitLab Enterprise server will be made over the 413 // public internet. 414 ServiceDirectoryConfig service_directory_config = 5; 415 416 // SSL certificate to use for requests to GitLab Enterprise. 417 string ssl_ca = 6; 418 419 // Output only. Version of the GitLab Enterprise server running on the 420 // `host_uri`. 421 string server_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; 422} 423 424// Configuration for connections to Bitbucket Data Center. 425message BitbucketDataCenterConfig { 426 // Required. The URI of the Bitbucket Data Center instance or cluster this 427 // connection is for. 428 string host_uri = 1 [(google.api.field_behavior) = REQUIRED]; 429 430 // Required. Immutable. SecretManager resource containing the webhook secret 431 // used to verify webhook events, formatted as 432 // `projects/*/secrets/*/versions/*`. 433 string webhook_secret_secret_version = 2 [ 434 (google.api.field_behavior) = REQUIRED, 435 (google.api.field_behavior) = IMMUTABLE, 436 (google.api.resource_reference) = { 437 type: "secretmanager.googleapis.com/SecretVersion" 438 } 439 ]; 440 441 // Required. A http access token with the `REPO_READ` access. 442 UserCredential read_authorizer_credential = 3 443 [(google.api.field_behavior) = REQUIRED]; 444 445 // Required. A http access token with the `REPO_ADMIN` scope access. 446 UserCredential authorizer_credential = 4 447 [(google.api.field_behavior) = REQUIRED]; 448 449 // Optional. Configuration for using Service Directory to privately connect to 450 // a Bitbucket Data Center. This should only be set if the Bitbucket Data 451 // Center is hosted on-premises and not reachable by public internet. If this 452 // field is left empty, calls to the Bitbucket Data Center will be made over 453 // the public internet. 454 ServiceDirectoryConfig service_directory_config = 5 455 [(google.api.field_behavior) = OPTIONAL]; 456 457 // Optional. SSL certificate to use for requests to the Bitbucket Data Center. 458 string ssl_ca = 6 [(google.api.field_behavior) = OPTIONAL]; 459 460 // Output only. Version of the Bitbucket Data Center running on the 461 // `host_uri`. 462 string server_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; 463} 464 465// Configuration for connections to Bitbucket Cloud. 466message BitbucketCloudConfig { 467 // Required. The Bitbucket Cloud Workspace ID to be connected to Google Cloud 468 // Platform. 469 string workspace = 1 [(google.api.field_behavior) = REQUIRED]; 470 471 // Required. SecretManager resource containing the webhook secret used to 472 // verify webhook events, formatted as `projects/*/secrets/*/versions/*`. 473 string webhook_secret_secret_version = 2 [ 474 (google.api.field_behavior) = REQUIRED, 475 (google.api.resource_reference) = { 476 type: "secretmanager.googleapis.com/SecretVersion" 477 } 478 ]; 479 480 // Required. An access token with the `repository` access. It can be either a 481 // workspace, project or repository access token. It's recommended to use a 482 // system account to generate the credentials. 483 UserCredential read_authorizer_credential = 3 484 [(google.api.field_behavior) = REQUIRED]; 485 486 // Required. An access token with the `webhook`, `repository`, 487 // `repository:admin` and `pullrequest` scope access. It can be either a 488 // workspace, project or repository access token. It's recommended to use a 489 // system account to generate these credentials. 490 UserCredential authorizer_credential = 4 491 [(google.api.field_behavior) = REQUIRED]; 492} 493 494// ServiceDirectoryConfig represents Service Directory configuration for a 495// connection. 496message ServiceDirectoryConfig { 497 // Required. The Service Directory service name. 498 // Format: 499 // projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}. 500 string service = 1 [ 501 (google.api.field_behavior) = REQUIRED, 502 (google.api.resource_reference) = { 503 type: "servicedirectory.googleapis.com/Service" 504 } 505 ]; 506} 507 508// A repository associated to a parent connection. 509message Repository { 510 option (google.api.resource) = { 511 type: "cloudbuild.googleapis.com/Repository" 512 pattern: "projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}" 513 plural: "repositories" 514 singular: "repository" 515 style: DECLARATIVE_FRIENDLY 516 }; 517 518 // Immutable. Resource name of the repository, in the format 519 // `projects/*/locations/*/connections/*/repositories/*`. 520 string name = 1 [(google.api.field_behavior) = IMMUTABLE]; 521 522 // Required. Git Clone HTTPS URI. 523 string remote_uri = 2 [(google.api.field_behavior) = REQUIRED]; 524 525 // Output only. Server assigned timestamp for when the connection was created. 526 google.protobuf.Timestamp create_time = 4 527 [(google.api.field_behavior) = OUTPUT_ONLY]; 528 529 // Output only. Server assigned timestamp for when the connection was updated. 530 google.protobuf.Timestamp update_time = 5 531 [(google.api.field_behavior) = OUTPUT_ONLY]; 532 533 // Allows clients to store small amounts of arbitrary data. 534 map<string, string> annotations = 6; 535 536 // This checksum is computed by the server based on the value of other 537 // fields, and may be sent on update and delete requests to ensure the 538 // client has an up-to-date value before proceeding. 539 string etag = 7; 540 541 // Output only. External ID of the webhook created for the repository. 542 string webhook_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; 543} 544 545// Represents an OAuth token of the account that authorized the Connection, 546// and associated metadata. 547message OAuthCredential { 548 // A SecretManager resource containing the OAuth token that authorizes 549 // the Cloud Build connection. Format: `projects/*/secrets/*/versions/*`. 550 string oauth_token_secret_version = 1 [(google.api.resource_reference) = { 551 type: "secretmanager.googleapis.com/SecretVersion" 552 }]; 553 554 // Output only. The username associated to this token. 555 string username = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; 556} 557 558// Represents a personal access token that authorized the Connection, 559// and associated metadata. 560message UserCredential { 561 // Required. A SecretManager resource containing the user token that 562 // authorizes the Cloud Build connection. Format: 563 // `projects/*/secrets/*/versions/*`. 564 string user_token_secret_version = 1 [ 565 (google.api.field_behavior) = REQUIRED, 566 (google.api.resource_reference) = { 567 type: "secretmanager.googleapis.com/SecretVersion" 568 } 569 ]; 570 571 // Output only. The username associated to this token. 572 string username = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; 573} 574 575// Message for creating a Connection 576message CreateConnectionRequest { 577 // Required. Project and location where the connection will be created. 578 // Format: `projects/*/locations/*`. 579 string parent = 1 [ 580 (google.api.field_behavior) = REQUIRED, 581 (google.api.resource_reference) = { 582 child_type: "cloudbuild.googleapis.com/Connection" 583 } 584 ]; 585 586 // Required. The Connection to create. 587 Connection connection = 2 [(google.api.field_behavior) = REQUIRED]; 588 589 // Required. The ID to use for the Connection, which will become the final 590 // component of the Connection's resource name. Names must be unique 591 // per-project per-location. Allows alphanumeric characters and any of 592 // -._~%!$&'()*+,;=@. 593 string connection_id = 3 [(google.api.field_behavior) = REQUIRED]; 594} 595 596// Message for getting the details of a Connection. 597message GetConnectionRequest { 598 // Required. The name of the Connection to retrieve. 599 // Format: `projects/*/locations/*/connections/*`. 600 string name = 1 [ 601 (google.api.field_behavior) = REQUIRED, 602 (google.api.resource_reference) = { 603 type: "cloudbuild.googleapis.com/Connection" 604 } 605 ]; 606} 607 608// Message for requesting list of Connections. 609message ListConnectionsRequest { 610 // Required. The parent, which owns this collection of Connections. 611 // Format: `projects/*/locations/*`. 612 string parent = 1 [ 613 (google.api.field_behavior) = REQUIRED, 614 (google.api.resource_reference) = { 615 child_type: "cloudbuild.googleapis.com/Connection" 616 } 617 ]; 618 619 // Number of results to return in the list. 620 int32 page_size = 2; 621 622 // Page start. 623 string page_token = 3; 624} 625 626// Message for response to listing Connections. 627message ListConnectionsResponse { 628 // The list of Connections. 629 repeated Connection connections = 1; 630 631 // A token identifying a page of results the server should return. 632 string next_page_token = 2; 633} 634 635// Message for updating a Connection. 636message UpdateConnectionRequest { 637 // Required. The Connection to update. 638 Connection connection = 1 [(google.api.field_behavior) = REQUIRED]; 639 640 // The list of fields to be updated. 641 google.protobuf.FieldMask update_mask = 2; 642 643 // If set to true, and the connection is not found a new connection 644 // will be created. In this situation `update_mask` is ignored. 645 // The creation will succeed only if the input connection has all the 646 // necessary information (e.g a github_config with both user_oauth_token and 647 // installation_id properties). 648 bool allow_missing = 3; 649 650 // The current etag of the connection. 651 // If an etag is provided and does not match the current etag of the 652 // connection, update will be blocked and an ABORTED error will be returned. 653 string etag = 4; 654} 655 656// Message for deleting a Connection. 657message DeleteConnectionRequest { 658 // Required. The name of the Connection to delete. 659 // Format: `projects/*/locations/*/connections/*`. 660 string name = 1 [ 661 (google.api.field_behavior) = REQUIRED, 662 (google.api.resource_reference) = { 663 type: "cloudbuild.googleapis.com/Connection" 664 } 665 ]; 666 667 // The current etag of the connection. 668 // If an etag is provided and does not match the current etag of the 669 // connection, deletion will be blocked and an ABORTED error will be returned. 670 string etag = 2; 671 672 // If set, validate the request, but do not actually post it. 673 bool validate_only = 3; 674} 675 676// Message for creating a Repository. 677message CreateRepositoryRequest { 678 // Required. The connection to contain the repository. If the request is part 679 // of a BatchCreateRepositoriesRequest, this field should be empty or match 680 // the parent specified there. 681 string parent = 1 [ 682 (google.api.field_behavior) = REQUIRED, 683 (google.api.resource_reference) = { 684 type: "cloudbuild.googleapis.com/Connection" 685 } 686 ]; 687 688 // Required. The repository to create. 689 Repository repository = 2 [(google.api.field_behavior) = REQUIRED]; 690 691 // Required. The ID to use for the repository, which will become the final 692 // component of the repository's resource name. This ID should be unique in 693 // the connection. Allows alphanumeric characters and any of 694 // -._~%!$&'()*+,;=@. 695 string repository_id = 3 [(google.api.field_behavior) = REQUIRED]; 696} 697 698// Message for creating repositoritories in batch. 699message BatchCreateRepositoriesRequest { 700 // Required. The connection to contain all the repositories being created. 701 // Format: projects/*/locations/*/connections/* 702 // The parent field in the CreateRepositoryRequest messages 703 // must either be empty or match this field. 704 string parent = 1 [ 705 (google.api.field_behavior) = REQUIRED, 706 (google.api.resource_reference) = { 707 type: "cloudbuild.googleapis.com/Connection" 708 } 709 ]; 710 711 // Required. The request messages specifying the repositories to create. 712 repeated CreateRepositoryRequest requests = 2 713 [(google.api.field_behavior) = REQUIRED]; 714} 715 716// Message for response of creating repositories in batch. 717message BatchCreateRepositoriesResponse { 718 // Repository resources created. 719 repeated Repository repositories = 1; 720} 721 722// Message for getting the details of a Repository. 723message GetRepositoryRequest { 724 // Required. The name of the Repository to retrieve. 725 // Format: `projects/*/locations/*/connections/*/repositories/*`. 726 string name = 1 [ 727 (google.api.field_behavior) = REQUIRED, 728 (google.api.resource_reference) = { 729 type: "cloudbuild.googleapis.com/Repository" 730 } 731 ]; 732} 733 734// Message for requesting list of Repositories. 735message ListRepositoriesRequest { 736 // Required. The parent, which owns this collection of Repositories. 737 // Format: `projects/*/locations/*/connections/*`. 738 string parent = 1 [ 739 (google.api.field_behavior) = REQUIRED, 740 (google.api.resource_reference) = { 741 child_type: "cloudbuild.googleapis.com/Repository" 742 } 743 ]; 744 745 // Number of results to return in the list. 746 int32 page_size = 2; 747 748 // Page start. 749 string page_token = 3; 750 751 // A filter expression that filters resources listed in the response. 752 // Expressions must follow API improvement proposal 753 // [AIP-160](https://google.aip.dev/160). e.g. 754 // `remote_uri:"https://github.com*"`. 755 string filter = 4; 756} 757 758// Message for response to listing Repositories. 759message ListRepositoriesResponse { 760 // The list of Repositories. 761 repeated Repository repositories = 1; 762 763 // A token identifying a page of results the server should return. 764 string next_page_token = 2; 765} 766 767// Message for deleting a Repository. 768message DeleteRepositoryRequest { 769 // Required. The name of the Repository to delete. 770 // Format: `projects/*/locations/*/connections/*/repositories/*`. 771 string name = 1 [ 772 (google.api.field_behavior) = REQUIRED, 773 (google.api.resource_reference) = { 774 type: "cloudbuild.googleapis.com/Repository" 775 } 776 ]; 777 778 // The current etag of the repository. 779 // If an etag is provided and does not match the current etag of the 780 // repository, deletion will be blocked and an ABORTED error will be returned. 781 string etag = 2; 782 783 // If set, validate the request, but do not actually post it. 784 bool validate_only = 3; 785} 786 787// Message for fetching SCM read/write token. 788message FetchReadWriteTokenRequest { 789 // Required. The resource name of the repository in the format 790 // `projects/*/locations/*/connections/*/repositories/*`. 791 string repository = 1 [ 792 (google.api.field_behavior) = REQUIRED, 793 (google.api.resource_reference) = { 794 type: "cloudbuild.googleapis.com/Repository" 795 } 796 ]; 797} 798 799// Message for fetching SCM read token. 800message FetchReadTokenRequest { 801 // Required. The resource name of the repository in the format 802 // `projects/*/locations/*/connections/*/repositories/*`. 803 string repository = 1 [ 804 (google.api.field_behavior) = REQUIRED, 805 (google.api.resource_reference) = { 806 type: "cloudbuild.googleapis.com/Repository" 807 } 808 ]; 809} 810 811// Message for responding to get read token. 812message FetchReadTokenResponse { 813 // The token content. 814 string token = 1; 815 816 // Expiration timestamp. Can be empty if unknown or non-expiring. 817 google.protobuf.Timestamp expiration_time = 2; 818} 819 820// Message for responding to get read/write token. 821message FetchReadWriteTokenResponse { 822 // The token content. 823 string token = 1; 824 825 // Expiration timestamp. Can be empty if unknown or non-expiring. 826 google.protobuf.Timestamp expiration_time = 2; 827} 828 829// RPC request object accepted by the ProcessWebhook RPC method. 830message ProcessWebhookRequest { 831 // Required. Project and location where the webhook will be received. 832 // Format: `projects/*/locations/*`. 833 string parent = 1 [ 834 (google.api.field_behavior) = REQUIRED, 835 (google.api.resource_reference) = { 836 child_type: "cloudbuild.googleapis.com/Connection" 837 } 838 ]; 839 840 // HTTP request body. 841 google.api.HttpBody body = 2; 842 843 // Arbitrary additional key to find the maching repository for a webhook event 844 // if needed. 845 string webhook_key = 3; 846} 847 848// Request for fetching git refs 849message FetchGitRefsRequest { 850 // Type of refs 851 enum RefType { 852 // No type specified. 853 REF_TYPE_UNSPECIFIED = 0; 854 855 // To fetch tags. 856 TAG = 1; 857 858 // To fetch branches. 859 BRANCH = 2; 860 } 861 862 // Required. The resource name of the repository in the format 863 // `projects/*/locations/*/connections/*/repositories/*`. 864 string repository = 1 [ 865 (google.api.field_behavior) = REQUIRED, 866 (google.api.resource_reference) = { 867 type: "cloudbuild.googleapis.com/Repository" 868 } 869 ]; 870 871 // Type of refs to fetch 872 RefType ref_type = 2; 873} 874 875// Response for fetching git refs 876message FetchGitRefsResponse { 877 // Name of the refs fetched. 878 repeated string ref_names = 1; 879} 880