xref: /aosp_15_r20/external/googleapis/google/cloud/bigquery/connection/v1beta1/connection.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2022 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.bigquery.connection.v1beta1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/iam/v1/iam_policy.proto";
24import "google/iam/v1/policy.proto";
25import "google/protobuf/empty.proto";
26import "google/protobuf/field_mask.proto";
27import "google/protobuf/wrappers.proto";
28
29option csharp_namespace = "Google.Cloud.BigQuery.Connection.V1Beta1";
30option go_package = "cloud.google.com/go/bigquery/connection/apiv1beta1/connectionpb;connectionpb";
31option java_outer_classname = "ConnectionProto";
32option java_package = "com.google.cloud.bigquery.connection.v1beta1";
33option php_namespace = "Google\\Cloud\\BigQuery\\Connection\\V1beta1";
34
35// Manages external data source connections and credentials.
36service ConnectionService {
37  option (google.api.default_host) = "bigqueryconnection.googleapis.com";
38  option (google.api.oauth_scopes) =
39      "https://www.googleapis.com/auth/bigquery,"
40      "https://www.googleapis.com/auth/cloud-platform";
41
42  // Creates a new connection.
43  rpc CreateConnection(CreateConnectionRequest) returns (Connection) {
44    option (google.api.http) = {
45      post: "/v1beta1/{parent=projects/*/locations/*}/connections"
46      body: "connection"
47    };
48    option (google.api.method_signature) = "parent,connection,connection_id";
49  }
50
51  // Returns specified connection.
52  rpc GetConnection(GetConnectionRequest) returns (Connection) {
53    option (google.api.http) = {
54      get: "/v1beta1/{name=projects/*/locations/*/connections/*}"
55    };
56    option (google.api.method_signature) = "name";
57  }
58
59  // Returns a list of connections in the given project.
60  rpc ListConnections(ListConnectionsRequest)
61      returns (ListConnectionsResponse) {
62    option (google.api.http) = {
63      get: "/v1beta1/{parent=projects/*/locations/*}/connections"
64    };
65    option (google.api.method_signature) = "parent,max_results";
66  }
67
68  // Updates the specified connection. For security reasons, also resets
69  // credential if connection properties are in the update field mask.
70  rpc UpdateConnection(UpdateConnectionRequest) returns (Connection) {
71    option (google.api.http) = {
72      patch: "/v1beta1/{name=projects/*/locations/*/connections/*}"
73      body: "connection"
74    };
75    option (google.api.method_signature) = "name,connection,update_mask";
76  }
77
78  // Sets the credential for the specified connection.
79  rpc UpdateConnectionCredential(UpdateConnectionCredentialRequest)
80      returns (google.protobuf.Empty) {
81    option (google.api.http) = {
82      patch: "/v1beta1/{name=projects/*/locations/*/connections/*/credential}"
83      body: "credential"
84    };
85    option (google.api.method_signature) = "name,credential";
86  }
87
88  // Deletes connection and associated credential.
89  rpc DeleteConnection(DeleteConnectionRequest)
90      returns (google.protobuf.Empty) {
91    option (google.api.http) = {
92      delete: "/v1beta1/{name=projects/*/locations/*/connections/*}"
93    };
94    option (google.api.method_signature) = "name";
95  }
96
97  // Gets the access control policy for a resource.
98  // Returns an empty policy if the resource exists and does not have a policy
99  // set.
100  rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest)
101      returns (google.iam.v1.Policy) {
102    option (google.api.http) = {
103      post: "/v1beta1/{resource=projects/*/locations/*/connections/*}:getIamPolicy"
104      body: "*"
105    };
106    option (google.api.method_signature) = "resource,options";
107  }
108
109  // Sets the access control policy on the specified resource. Replaces any
110  // existing policy.
111  //
112  // Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
113  rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest)
114      returns (google.iam.v1.Policy) {
115    option (google.api.http) = {
116      post: "/v1beta1/{resource=projects/*/locations/*/connections/*}:setIamPolicy"
117      body: "*"
118    };
119    option (google.api.method_signature) = "resource,policy";
120  }
121
122  // Returns permissions that a caller has on the specified resource.
123  // If the resource does not exist, this will return an empty set of
124  // permissions, not a `NOT_FOUND` error.
125  //
126  // Note: This operation is designed to be used for building permission-aware
127  // UIs and command-line tools, not for authorization checking. This operation
128  // may "fail open" without warning.
129  rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest)
130      returns (google.iam.v1.TestIamPermissionsResponse) {
131    option (google.api.http) = {
132      post: "/v1beta1/{resource=projects/*/locations/*/connections/*}:testIamPermissions"
133      body: "*"
134    };
135    option (google.api.method_signature) = "resource,permissions";
136  }
137}
138
139// The request for
140// [ConnectionService.CreateConnection][google.cloud.bigquery.connection.v1beta1.ConnectionService.CreateConnection].
141message CreateConnectionRequest {
142  // Required. Parent resource name.
143  // Must be in the format `projects/{project_id}/locations/{location_id}`
144  string parent = 1 [
145    (google.api.field_behavior) = REQUIRED,
146    (google.api.resource_reference) = {
147      type: "locations.googleapis.com/Location"
148    }
149  ];
150
151  // Optional. Connection id that should be assigned to the created connection.
152  string connection_id = 2 [(google.api.field_behavior) = OPTIONAL];
153
154  // Required. Connection to create.
155  Connection connection = 3 [(google.api.field_behavior) = REQUIRED];
156}
157
158// The request for
159// [ConnectionService.GetConnection][google.cloud.bigquery.connection.v1beta1.ConnectionService.GetConnection].
160message GetConnectionRequest {
161  // Required. Name of the requested connection, for example:
162  // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
163  string name = 1 [
164    (google.api.field_behavior) = REQUIRED,
165    (google.api.resource_reference) = {
166      type: "bigqueryconnection.googleapis.com/Connection"
167    }
168  ];
169}
170
171// The request for
172// [ConnectionService.ListConnections][google.cloud.bigquery.connection.v1beta1.ConnectionService.ListConnections].
173message ListConnectionsRequest {
174  // Required. Parent resource name.
175  // Must be in the form: `projects/{project_id}/locations/{location_id}`
176  string parent = 1 [
177    (google.api.field_behavior) = REQUIRED,
178    (google.api.resource_reference) = {
179      type: "locations.googleapis.com/Location"
180    }
181  ];
182
183  // Required. Maximum number of results per page.
184  google.protobuf.UInt32Value max_results = 2
185      [(google.api.field_behavior) = REQUIRED];
186
187  // Page token.
188  string page_token = 3;
189}
190
191// The response for
192// [ConnectionService.ListConnections][google.cloud.bigquery.connection.v1beta1.ConnectionService.ListConnections].
193message ListConnectionsResponse {
194  // Next page token.
195  string next_page_token = 1;
196
197  // List of connections.
198  repeated Connection connections = 2;
199}
200
201// The request for
202// [ConnectionService.UpdateConnection][google.cloud.bigquery.connection.v1beta1.ConnectionService.UpdateConnection].
203message UpdateConnectionRequest {
204  // Required. Name of the connection to update, for example:
205  // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
206  string name = 1 [
207    (google.api.field_behavior) = REQUIRED,
208    (google.api.resource_reference) = {
209      type: "bigqueryconnection.googleapis.com/Connection"
210    }
211  ];
212
213  // Required. Connection containing the updated fields.
214  Connection connection = 2 [(google.api.field_behavior) = REQUIRED];
215
216  // Required. Update mask for the connection fields to be updated.
217  google.protobuf.FieldMask update_mask = 3
218      [(google.api.field_behavior) = REQUIRED];
219}
220
221// The request for
222// [ConnectionService.UpdateConnectionCredential][google.cloud.bigquery.connection.v1beta1.ConnectionService.UpdateConnectionCredential].
223message UpdateConnectionCredentialRequest {
224  // Required. Name of the connection, for example:
225  // `projects/{project_id}/locations/{location_id}/connections/{connection_id}/credential`
226  string name = 1 [(google.api.field_behavior) = REQUIRED];
227
228  // Required. Credential to use with the connection.
229  ConnectionCredential credential = 2 [(google.api.field_behavior) = REQUIRED];
230}
231
232// The request for [ConnectionService.DeleteConnectionRequest][].
233message DeleteConnectionRequest {
234  // Required. Name of the deleted connection, for example:
235  // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
236  string name = 1 [
237    (google.api.field_behavior) = REQUIRED,
238    (google.api.resource_reference) = {
239      type: "bigqueryconnection.googleapis.com/Connection"
240    }
241  ];
242}
243
244// Configuration parameters to establish connection with an external data
245// source, except the credential attributes.
246message Connection {
247  option (google.api.resource) = {
248    type: "bigqueryconnection.googleapis.com/Connection"
249    pattern: "projects/{project}/locations/{location}/connections/{connection}"
250  };
251
252  // The resource name of the connection in the form of:
253  // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
254  string name = 1;
255
256  // User provided display name for the connection.
257  string friendly_name = 2;
258
259  // User provided description.
260  string description = 3;
261
262  // Properties specific to the underlying data source.
263  oneof properties {
264    // Cloud SQL properties.
265    CloudSqlProperties cloud_sql = 4;
266  }
267
268  // Output only. The creation timestamp of the connection.
269  int64 creation_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
270
271  // Output only. The last update timestamp of the connection.
272  int64 last_modified_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
273
274  // Output only. True, if credential is configured for this connection.
275  bool has_credential = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
276}
277
278// Credential to use with a connection.
279message ConnectionCredential {
280  // Credential specific to the underlying data source.
281  oneof credential {
282    // Credential for Cloud SQL database.
283    CloudSqlCredential cloud_sql = 1;
284  }
285}
286
287// Connection properties specific to the Cloud SQL.
288message CloudSqlProperties {
289  // Supported Cloud SQL database types.
290  enum DatabaseType {
291    // Unspecified database type.
292    DATABASE_TYPE_UNSPECIFIED = 0;
293
294    // Cloud SQL for PostgreSQL.
295    POSTGRES = 1;
296
297    // Cloud SQL for MySQL.
298    MYSQL = 2;
299  }
300
301  // Cloud SQL instance ID in the form `project:location:instance`.
302  string instance_id = 1;
303
304  // Database name.
305  string database = 2;
306
307  // Type of the Cloud SQL database.
308  DatabaseType type = 3;
309
310  // Input only. Cloud SQL credential.
311  CloudSqlCredential credential = 4 [(google.api.field_behavior) = INPUT_ONLY];
312
313  // Output only. The account ID of the service used for the purpose of this
314  // connection.
315  //
316  // When the connection is used in the context of an operation in
317  // BigQuery, this service account will serve as the identity being used for
318  // connecting to the CloudSQL instance specified in this connection.
319  string service_account_id = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
320}
321
322// Credential info for the Cloud SQL.
323message CloudSqlCredential {
324  // The username for the credential.
325  string username = 1;
326
327  // The password for the credential.
328  string password = 2;
329}
330