@@ -24,6 +24,7 @@ import "google/iam/v1/iam_policy.proto";
2424import "google/iam/v1/policy.proto" ;
2525import "google/longrunning/operations.proto" ;
2626import "google/protobuf/empty.proto" ;
27+ import "google/protobuf/field_mask.proto" ;
2728import "google/protobuf/timestamp.proto" ;
2829
2930option csharp_namespace = "Google.Cloud.SecureSourceManager.V1" ;
@@ -195,6 +196,64 @@ service SecureSourceManager {
195196 };
196197 option (google.api.method_signature ) = "resource" ;
197198 }
199+
200+ // CreateBranchRule creates a branch rule in a given repository.
201+ rpc CreateBranchRule (CreateBranchRuleRequest )
202+ returns (google.longrunning.Operation ) {
203+ option (google.api.http ) = {
204+ post : "/v1/{parent=projects/*/locations/*/repositories/*}/branchRules"
205+ body : "branch_rule"
206+ };
207+ option (google.api.method_signature ) = "parent,branch_rule,branch_rule_id" ;
208+ option (google.longrunning.operation_info ) = {
209+ response_type : "BranchRule"
210+ metadata_type : "OperationMetadata"
211+ };
212+ }
213+
214+ // ListBranchRules lists branch rules in a given repository.
215+ rpc ListBranchRules (ListBranchRulesRequest )
216+ returns (ListBranchRulesResponse ) {
217+ option (google.api.http ) = {
218+ get : "/v1/{parent=projects/*/locations/*/repositories/*}/branchRules"
219+ };
220+ option (google.api.method_signature ) = "parent" ;
221+ }
222+
223+ // GetBranchRule gets a branch rule.
224+ rpc GetBranchRule (GetBranchRuleRequest ) returns (BranchRule ) {
225+ option (google.api.http ) = {
226+ get : "/v1/{name=projects/*/locations/*/repositories/*/branchRules/*}"
227+ };
228+ option (google.api.method_signature ) = "name" ;
229+ }
230+
231+ // UpdateBranchRule updates a branch rule.
232+ rpc UpdateBranchRule (UpdateBranchRuleRequest )
233+ returns (google.longrunning.Operation ) {
234+ option (google.api.http ) = {
235+ patch : "/v1/{branch_rule.name=projects/*/locations/*/repositories/*/branchRules/*}"
236+ body : "branch_rule"
237+ };
238+ option (google.api.method_signature ) = "branch_rule,update_mask" ;
239+ option (google.longrunning.operation_info ) = {
240+ response_type : "BranchRule"
241+ metadata_type : "OperationMetadata"
242+ };
243+ }
244+
245+ // DeleteBranchRule deletes a branch rule.
246+ rpc DeleteBranchRule (DeleteBranchRuleRequest )
247+ returns (google.longrunning.Operation ) {
248+ option (google.api.http ) = {
249+ delete : "/v1/{name=projects/*/locations/*/repositories/*/branchRules/*}"
250+ };
251+ option (google.api.method_signature ) = "name" ;
252+ option (google.longrunning.operation_info ) = {
253+ response_type : "google.protobuf.Empty"
254+ metadata_type : "OperationMetadata"
255+ };
256+ }
198257}
199258
200259// A resource that represents a Secure Source Manager instance.
@@ -290,6 +349,12 @@ message Instance {
290349 type : "compute.googleapis.com/ServiceAttachment"
291350 }
292351 ];
352+
353+ // Optional. Additional allowed projects for setting up PSC connections.
354+ // Instance host project is automatically allowed and does not need to be
355+ // included in this list.
356+ repeated string psc_allowed_projects = 6
357+ [(google.api.field_behavior ) = OPTIONAL ];
293358 }
294359
295360 // Optional. A unique identifier for an instance. The name should be of the
@@ -513,9 +578,8 @@ message Repository {
513578 // `projects/{project_number}/locations/{location_id}/instances/{instance_id}`
514579 // When creating repository via
515580 // securesourcemanager.googleapis.com (Control Plane API), this field is used
516- // as input.
517- // When creating repository via *.sourcemanager.dev (Data Plane API), this
518- // field is output only.
581+ // as input. When creating repository via *.sourcemanager.dev (Data Plane
582+ // API), this field is output only.
519583 string instance = 3 [
520584 (google.api.field_behavior ) = OPTIONAL ,
521585 (google.api.resource_reference ) = {
@@ -546,6 +610,83 @@ message Repository {
546610 InitialConfig initial_config = 10 [(google.api.field_behavior ) = INPUT_ONLY ];
547611}
548612
613+ // Metadata of a BranchRule. BranchRule is the protection rule to enforce
614+ // pre-defined rules on desginated branches within a repository.
615+ message BranchRule {
616+ option (google.api.resource ) = {
617+ type : "securesourcemanager.googleapis.com/BranchRule"
618+ pattern : "projects/{project}/locations/{location}/repositories/{repository}/branchRules/{branch_rule}"
619+ };
620+
621+ // Check is a type for status check.
622+ message Check {
623+ // Required. The context of the check.
624+ string context = 1 [(google.api.field_behavior ) = REQUIRED ];
625+ }
626+
627+ // Optional. A unique identifier for a BranchRule. The name should be of the
628+ // format:
629+ // `projects/{project}/locations/{location}/repositories/{repository}/branchRules/{branch_rule}`
630+ string name = 1 [(google.api.field_behavior ) = OPTIONAL ];
631+
632+ // Output only. Unique identifier of the repository.
633+ string uid = 2 [(google.api.field_behavior ) = OUTPUT_ONLY ];
634+
635+ // Output only. Create timestamp.
636+ google.protobuf.Timestamp create_time = 3
637+ [(google.api.field_behavior ) = OUTPUT_ONLY ];
638+
639+ // Output only. Update timestamp.
640+ google.protobuf.Timestamp update_time = 4
641+ [(google.api.field_behavior ) = OUTPUT_ONLY ];
642+
643+ // Optional. User annotations. These attributes can only be set and used by
644+ // the user. See https://google.aip.dev/128#annotations for more details such
645+ // as format and size limitations.
646+ map <string , string > annotations = 5 [(google.api.field_behavior ) = OPTIONAL ];
647+
648+ // Optional. This checksum is computed by the server based on the value of
649+ // other fields, and may be sent on update and delete requests to ensure the
650+ // client has an up-to-date value before proceeding.
651+ string etag = 6 [(google.api.field_behavior ) = OPTIONAL ];
652+
653+ // Optional. The pattern of the branch that can match to this BranchRule.
654+ // Specified as regex.
655+ // .* for all branches. Examples: main, (main|release.*).
656+ // Current MVP phase only support `.*` for wildcard.
657+ string include_pattern = 7 [(google.api.field_behavior ) = OPTIONAL ];
658+
659+ // Optional. Determines if the branch rule is disabled or not.
660+ bool disabled = 8 [(google.api.field_behavior ) = OPTIONAL ];
661+
662+ // Optional. Determines if the branch rule requires a pull request or not.
663+ bool require_pull_request = 9 [(google.api.field_behavior ) = OPTIONAL ];
664+
665+ // Optional. The minimum number of reviews required for the branch rule to be
666+ // matched.
667+ int32 minimum_reviews_count = 10 [(google.api.field_behavior ) = OPTIONAL ];
668+
669+ // Optional. The minimum number of approvals required for the branch rule to
670+ // be matched.
671+ int32 minimum_approvals_count = 11 [(google.api.field_behavior ) = OPTIONAL ];
672+
673+ // Optional. Determines if require comments resolved before merging to the
674+ // branch.
675+ bool require_comments_resolved = 12 [(google.api.field_behavior ) = OPTIONAL ];
676+
677+ // Optional. Determines if allow stale reviews or approvals before merging to
678+ // the branch.
679+ bool allow_stale_reviews = 15 [(google.api.field_behavior ) = OPTIONAL ];
680+
681+ // Optional. Determines if require linear history before merging to the
682+ // branch.
683+ bool require_linear_history = 13 [(google.api.field_behavior ) = OPTIONAL ];
684+
685+ // Optional. List of required status checks before merging to the branch.
686+ repeated Check required_status_checks = 14
687+ [(google.api.field_behavior ) = OPTIONAL ];
688+ }
689+
549690// ListInstancesRequest is the request to list instances.
550691message ListInstancesRequest {
551692 // Required. Parent value for ListInstancesRequest.
@@ -772,3 +913,84 @@ message DeleteRepositoryRequest {
772913 // succeed but no action will be taken on the server.
773914 bool allow_missing = 2 [(google.api.field_behavior ) = OPTIONAL ];
774915}
916+
917+ // GetBranchRuleRequest is the request for getting a branch rule.
918+ message GetBranchRuleRequest {
919+ // Required. Name of the repository to retrieve.
920+ // The format is
921+ // `projects/{project}/locations/{location}/repositories/{repository}/branchRules/{branch_rule}`.
922+ string name = 1 [
923+ (google.api.field_behavior ) = REQUIRED ,
924+ (google.api.resource_reference ) = {
925+ type : "securesourcemanager.googleapis.com/BranchRule"
926+ }
927+ ];
928+ }
929+
930+ // CreateBranchRuleRequest is the request to create a branch rule.
931+ message CreateBranchRuleRequest {
932+ string parent = 1 [
933+ (google.api.field_behavior ) = REQUIRED ,
934+ (google.api.resource_reference ) = {
935+ child_type : "securesourcemanager.googleapis.com/BranchRule"
936+ }
937+ ];
938+
939+ BranchRule branch_rule = 2 [(google.api.field_behavior ) = REQUIRED ];
940+
941+ string branch_rule_id = 3 [(google.api.field_behavior ) = REQUIRED ];
942+ }
943+
944+ // ListBranchRulesRequest is the request to list branch rules.
945+ message ListBranchRulesRequest {
946+ string parent = 1 [
947+ (google.api.field_behavior ) = REQUIRED ,
948+ (google.api.resource_reference ) = {
949+ child_type : "securesourcemanager.googleapis.com/BranchRule"
950+ }
951+ ];
952+
953+ int32 page_size = 2 [(google.api.field_behavior ) = OPTIONAL ];
954+
955+ string page_token = 3 [(google.api.field_behavior ) = OPTIONAL ];
956+ }
957+
958+ // DeleteBranchRuleRequest is the request to delete a branch rule.
959+ message DeleteBranchRuleRequest {
960+ string name = 1 [
961+ (google.api.field_behavior ) = REQUIRED ,
962+ (google.api.resource_reference ) = {
963+ type : "securesourcemanager.googleapis.com/BranchRule"
964+ }
965+ ];
966+
967+ // Optional. If set to true, and the branch rule is not found, the request
968+ // will succeed but no action will be taken on the server.
969+ bool allow_missing = 2 [(google.api.field_behavior ) = OPTIONAL ];
970+ }
971+
972+ // UpdateBranchRuleRequest is the request to update a branchRule.
973+ message UpdateBranchRuleRequest {
974+ BranchRule branch_rule = 1 [(google.api.field_behavior ) = REQUIRED ];
975+
976+ // Optional. If set, validate the request and preview the review, but do not
977+ // actually post it. (https://google.aip.dev/163, for declarative friendly)
978+ bool validate_only = 2 [(google.api.field_behavior ) = OPTIONAL ];
979+
980+ // Required. Field mask is used to specify the fields to be overwritten in the
981+ // branchRule resource by the update.
982+ // The fields specified in the update_mask are relative to the resource, not
983+ // the full request. A field will be overwritten if it is in the mask.
984+ // The special value "*" means full replacement.
985+ google.protobuf.FieldMask update_mask = 3
986+ [(google.api.field_behavior ) = REQUIRED ];
987+ }
988+
989+ // ListBranchRulesResponse is the response to listing branchRules.
990+ message ListBranchRulesResponse {
991+ // The list of branch rules.
992+ repeated BranchRule branch_rules = 1 ;
993+
994+ // A token identifying a page of results the server should return.
995+ string next_page_token = 2 ;
996+ }
0 commit comments