connection.proto 11 KB

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