connection.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. // Copyright 2021 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.v1;
  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.V1";
  26. option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1;connection";
  27. option java_multiple_files = true;
  28. option java_package = "com.google.cloud.bigquery.connection.v1";
  29. option php_namespace = "Google\\Cloud\\BigQuery\\Connection\\V1";
  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: "/v1/{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: "/v1/{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: "/v1/{parent=projects/*/locations/*}/connections"
  55. };
  56. option (google.api.method_signature) = "parent";
  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: "/v1/{name=projects/*/locations/*/connections/*}"
  63. body: "connection"
  64. };
  65. option (google.api.method_signature) = "name,connection,update_mask";
  66. }
  67. // Deletes connection and associated credential.
  68. rpc DeleteConnection(DeleteConnectionRequest) returns (google.protobuf.Empty) {
  69. option (google.api.http) = {
  70. delete: "/v1/{name=projects/*/locations/*/connections/*}"
  71. };
  72. option (google.api.method_signature) = "name";
  73. }
  74. // Gets the access control policy for a resource.
  75. // Returns an empty policy if the resource exists and does not have a policy
  76. // set.
  77. rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) {
  78. option (google.api.http) = {
  79. post: "/v1/{resource=projects/*/locations/*/connections/*}:getIamPolicy"
  80. body: "*"
  81. };
  82. option (google.api.method_signature) = "resource,options";
  83. }
  84. // Sets the access control policy on the specified resource. Replaces any
  85. // existing policy.
  86. //
  87. // Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
  88. rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) {
  89. option (google.api.http) = {
  90. post: "/v1/{resource=projects/*/locations/*/connections/*}:setIamPolicy"
  91. body: "*"
  92. };
  93. option (google.api.method_signature) = "resource,policy";
  94. }
  95. // Returns permissions that a caller has on the specified resource.
  96. // If the resource does not exist, this will return an empty set of
  97. // permissions, not a `NOT_FOUND` error.
  98. //
  99. // Note: This operation is designed to be used for building permission-aware
  100. // UIs and command-line tools, not for authorization checking. This operation
  101. // may "fail open" without warning.
  102. rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) {
  103. option (google.api.http) = {
  104. post: "/v1/{resource=projects/*/locations/*/connections/*}:testIamPermissions"
  105. body: "*"
  106. };
  107. option (google.api.method_signature) = "resource,permissions";
  108. }
  109. }
  110. // The request for [ConnectionService.CreateConnection][google.cloud.bigquery.connection.v1.ConnectionService.CreateConnection].
  111. message CreateConnectionRequest {
  112. // Required. Parent resource name.
  113. // Must be in the format `projects/{project_id}/locations/{location_id}`
  114. string parent = 1 [
  115. (google.api.field_behavior) = REQUIRED,
  116. (google.api.resource_reference) = {
  117. type: "locations.googleapis.com/Location"
  118. }
  119. ];
  120. // Optional. Connection id that should be assigned to the created connection.
  121. string connection_id = 2 [(google.api.field_behavior) = OPTIONAL];
  122. // Required. Connection to create.
  123. Connection connection = 3 [(google.api.field_behavior) = REQUIRED];
  124. }
  125. // The request for [ConnectionService.GetConnection][google.cloud.bigquery.connection.v1.ConnectionService.GetConnection].
  126. message GetConnectionRequest {
  127. // Required. Name of the requested connection, for example:
  128. // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
  129. string name = 1 [
  130. (google.api.field_behavior) = REQUIRED,
  131. (google.api.resource_reference) = {
  132. type: "bigqueryconnection.googleapis.com/Connection"
  133. }
  134. ];
  135. }
  136. // The request for [ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections].
  137. message ListConnectionsRequest {
  138. // Required. Parent resource name.
  139. // Must be in the form: `projects/{project_id}/locations/{location_id}`
  140. string parent = 1 [
  141. (google.api.field_behavior) = REQUIRED,
  142. (google.api.resource_reference) = {
  143. type: "locations.googleapis.com/Location"
  144. }
  145. ];
  146. // Required. Page size.
  147. int32 page_size = 4 [(google.api.field_behavior) = REQUIRED];
  148. // Page token.
  149. string page_token = 3;
  150. }
  151. // The response for [ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections].
  152. message ListConnectionsResponse {
  153. // Next page token.
  154. string next_page_token = 1;
  155. // List of connections.
  156. repeated Connection connections = 2;
  157. }
  158. // The request for [ConnectionService.UpdateConnection][google.cloud.bigquery.connection.v1.ConnectionService.UpdateConnection].
  159. message UpdateConnectionRequest {
  160. // Required. Name of the connection to update, for example:
  161. // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
  162. string name = 1 [
  163. (google.api.field_behavior) = REQUIRED,
  164. (google.api.resource_reference) = {
  165. type: "bigqueryconnection.googleapis.com/Connection"
  166. }
  167. ];
  168. // Required. Connection containing the updated fields.
  169. Connection connection = 2 [(google.api.field_behavior) = REQUIRED];
  170. // Required. Update mask for the connection fields to be updated.
  171. google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED];
  172. }
  173. // The request for [ConnectionService.DeleteConnectionRequest][].
  174. message DeleteConnectionRequest {
  175. // Required. Name of the deleted connection, for example:
  176. // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
  177. string name = 1 [
  178. (google.api.field_behavior) = REQUIRED,
  179. (google.api.resource_reference) = {
  180. type: "bigqueryconnection.googleapis.com/Connection"
  181. }
  182. ];
  183. }
  184. // Configuration parameters to establish connection with an external data
  185. // source, except the credential attributes.
  186. message Connection {
  187. option (google.api.resource) = {
  188. type: "bigqueryconnection.googleapis.com/Connection"
  189. pattern: "projects/{project}/locations/{location}/connections/{connection}"
  190. };
  191. // The resource name of the connection in the form of:
  192. // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
  193. string name = 1;
  194. // User provided display name for the connection.
  195. string friendly_name = 2;
  196. // User provided description.
  197. string description = 3;
  198. // Properties specific to the underlying data source.
  199. oneof properties {
  200. // Cloud SQL properties.
  201. CloudSqlProperties cloud_sql = 4;
  202. // Amazon Web Services (AWS) properties.
  203. AwsProperties aws = 8;
  204. // Cloud Spanner properties.
  205. CloudSpannerProperties cloud_spanner = 21;
  206. }
  207. // Output only. The creation timestamp of the connection.
  208. int64 creation_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  209. // Output only. The last update timestamp of the connection.
  210. int64 last_modified_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  211. // Output only. True, if credential is configured for this connection.
  212. bool has_credential = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  213. }
  214. // Connection properties specific to the Cloud SQL.
  215. message CloudSqlProperties {
  216. // Supported Cloud SQL database types.
  217. enum DatabaseType {
  218. // Unspecified database type.
  219. DATABASE_TYPE_UNSPECIFIED = 0;
  220. // Cloud SQL for PostgreSQL.
  221. POSTGRES = 1;
  222. // Cloud SQL for MySQL.
  223. MYSQL = 2;
  224. }
  225. // Cloud SQL instance ID in the form `project:location:instance`.
  226. string instance_id = 1;
  227. // Database name.
  228. string database = 2;
  229. // Type of the Cloud SQL database.
  230. DatabaseType type = 3;
  231. // Input only. Cloud SQL credential.
  232. CloudSqlCredential credential = 4 [(google.api.field_behavior) = INPUT_ONLY];
  233. }
  234. // Credential info for the Cloud SQL.
  235. message CloudSqlCredential {
  236. // The username for the credential.
  237. string username = 1;
  238. // The password for the credential.
  239. string password = 2;
  240. }
  241. // Connection properties specific to Cloud Spanner.
  242. message CloudSpannerProperties {
  243. // Cloud Spanner database in the form `project/instance/database'
  244. string database = 1;
  245. // If parallelism should be used when reading from Cloud Spanner
  246. bool use_parallelism = 2;
  247. }
  248. // Connection properties specific to Amazon Web Services (AWS).
  249. message AwsProperties {
  250. // Authentication method chosen at connection creation.
  251. oneof authentication_method {
  252. // Authentication using Google owned AWS IAM user's access key to assume
  253. // into customer's AWS IAM Role.
  254. AwsCrossAccountRole cross_account_role = 2;
  255. // Authentication using Google owned service account to assume into
  256. // customer's AWS IAM Role.
  257. AwsAccessRole access_role = 3;
  258. }
  259. }
  260. // Authentication method for Amazon Web Services (AWS) that uses Google owned
  261. // AWS IAM user's access key to assume into customer's AWS IAM Role.
  262. message AwsCrossAccountRole {
  263. // The user’s AWS IAM Role that trusts the Google-owned AWS IAM user
  264. // Connection.
  265. string iam_role_id = 1;
  266. // Output only. Google-owned AWS IAM User for a Connection.
  267. string iam_user_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  268. // Output only. A Google-generated id for representing Connection’s identity in AWS.
  269. // External Id is also used for preventing the Confused Deputy Problem. See
  270. // https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html
  271. string external_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  272. }
  273. // Authentication method for Amazon Web Services (AWS) that uses Google owned
  274. // Google service account to assume into customer's AWS IAM Role.
  275. message AwsAccessRole {
  276. // The user’s AWS IAM Role that trusts the Google-owned AWS IAM user
  277. // Connection.
  278. string iam_role_id = 1;
  279. // A unique Google-owned and Google-generated identity for the Connection.
  280. // This identity will be used to access the user's AWS IAM Role.
  281. string identity = 2;
  282. }