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.cloud.talent.v4;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/cloud/talent/v4/common.proto";
24import "google/cloud/talent/v4/tenant.proto";
25import "google/protobuf/empty.proto";
26import "google/protobuf/field_mask.proto";
27
28option go_package = "cloud.google.com/go/talent/apiv4/talentpb;talentpb";
29option java_multiple_files = true;
30option java_outer_classname = "TenantServiceProto";
31option java_package = "com.google.cloud.talent.v4";
32option objc_class_prefix = "CTS";
33
34// A service that handles tenant management, including CRUD and enumeration.
35service TenantService {
36  option (google.api.default_host) = "jobs.googleapis.com";
37  option (google.api.oauth_scopes) =
38      "https://www.googleapis.com/auth/cloud-platform,"
39      "https://www.googleapis.com/auth/jobs";
40
41  // Creates a new tenant entity.
42  rpc CreateTenant(CreateTenantRequest) returns (Tenant) {
43    option (google.api.http) = {
44      post: "/v4/{parent=projects/*}/tenants"
45      body: "tenant"
46    };
47    option (google.api.method_signature) = "parent,tenant";
48  }
49
50  // Retrieves specified tenant.
51  rpc GetTenant(GetTenantRequest) returns (Tenant) {
52    option (google.api.http) = {
53      get: "/v4/{name=projects/*/tenants/*}"
54    };
55    option (google.api.method_signature) = "name";
56  }
57
58  // Updates specified tenant.
59  rpc UpdateTenant(UpdateTenantRequest) returns (Tenant) {
60    option (google.api.http) = {
61      patch: "/v4/{tenant.name=projects/*/tenants/*}"
62      body: "tenant"
63    };
64    option (google.api.method_signature) = "tenant,update_mask";
65  }
66
67  // Deletes specified tenant.
68  rpc DeleteTenant(DeleteTenantRequest) returns (google.protobuf.Empty) {
69    option (google.api.http) = {
70      delete: "/v4/{name=projects/*/tenants/*}"
71    };
72    option (google.api.method_signature) = "name";
73  }
74
75  // Lists all tenants associated with the project.
76  rpc ListTenants(ListTenantsRequest) returns (ListTenantsResponse) {
77    option (google.api.http) = {
78      get: "/v4/{parent=projects/*}/tenants"
79    };
80    option (google.api.method_signature) = "parent";
81  }
82}
83
84// The Request of the CreateTenant method.
85message CreateTenantRequest {
86  // Required. Resource name of the project under which the tenant is created.
87  //
88  // The format is "projects/{project_id}", for example,
89  // "projects/foo".
90  string parent = 1 [
91    (google.api.field_behavior) = REQUIRED,
92    (google.api.resource_reference) = {
93      type: "cloudresourcemanager.googleapis.com/Project"
94    }
95  ];
96
97  // Required. The tenant to be created.
98  Tenant tenant = 2 [(google.api.field_behavior) = REQUIRED];
99}
100
101// Request for getting a tenant by name.
102message GetTenantRequest {
103  // Required. The resource name of the tenant to be retrieved.
104  //
105  // The format is "projects/{project_id}/tenants/{tenant_id}", for example,
106  // "projects/foo/tenants/bar".
107  string name = 1 [
108    (google.api.field_behavior) = REQUIRED,
109    (google.api.resource_reference) = { type: "jobs.googleapis.com/Tenant" }
110  ];
111}
112
113// Request for updating a specified tenant.
114message UpdateTenantRequest {
115  // Required. The tenant resource to replace the current resource in the
116  // system.
117  Tenant tenant = 1 [(google.api.field_behavior) = REQUIRED];
118
119  // Strongly recommended for the best service experience.
120  //
121  // If [update_mask][google.cloud.talent.v4.UpdateTenantRequest.update_mask] is
122  // provided, only the specified fields in
123  // [tenant][google.cloud.talent.v4.UpdateTenantRequest.tenant] are updated.
124  // Otherwise all the fields are updated.
125  //
126  // A field mask to specify the tenant fields to be updated. Only
127  // top level fields of [Tenant][google.cloud.talent.v4.Tenant] are supported.
128  google.protobuf.FieldMask update_mask = 2;
129}
130
131// Request to delete a tenant.
132message DeleteTenantRequest {
133  // Required. The resource name of the tenant to be deleted.
134  //
135  // The format is "projects/{project_id}/tenants/{tenant_id}", for example,
136  // "projects/foo/tenants/bar".
137  string name = 1 [
138    (google.api.field_behavior) = REQUIRED,
139    (google.api.resource_reference) = { type: "jobs.googleapis.com/Tenant" }
140  ];
141}
142
143// List tenants for which the client has ACL visibility.
144message ListTenantsRequest {
145  // Required. Resource name of the project under which the tenant is created.
146  //
147  // The format is "projects/{project_id}", for example,
148  // "projects/foo".
149  string parent = 1 [
150    (google.api.field_behavior) = REQUIRED,
151    (google.api.resource_reference) = {
152      type: "cloudresourcemanager.googleapis.com/Project"
153    }
154  ];
155
156  // The starting indicator from which to return results.
157  string page_token = 2;
158
159  // The maximum number of tenants to be returned, at most 100.
160  // Default is 100 if a non-positive number is provided.
161  int32 page_size = 3;
162}
163
164// The List tenants response object.
165message ListTenantsResponse {
166  // Tenants for the current client.
167  repeated Tenant tenants = 1;
168
169  // A token to retrieve the next page of results.
170  string next_page_token = 2;
171
172  // Additional information for the API invocation, such as the request
173  // tracking id.
174  ResponseMetadata metadata = 3;
175}
176