connection.proto 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  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.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. option csharp_namespace = "Google.Cloud.BigQuery.Connection.V1";
  25. option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1;connection";
  26. option java_multiple_files = true;
  27. option java_package = "com.google.cloud.bigquery.connection.v1";
  28. option php_namespace = "Google\\Cloud\\BigQuery\\Connection\\V1";
  29. // Manages external data source connections and credentials.
  30. service ConnectionService {
  31. option (google.api.default_host) = "bigqueryconnection.googleapis.com";
  32. option (google.api.oauth_scopes) =
  33. "https://www.googleapis.com/auth/bigquery,"
  34. "https://www.googleapis.com/auth/cloud-platform";
  35. // Creates a new connection.
  36. rpc CreateConnection(CreateConnectionRequest) returns (Connection) {
  37. option (google.api.http) = {
  38. post: "/v1/{parent=projects/*/locations/*}/connections"
  39. body: "connection"
  40. };
  41. option (google.api.method_signature) = "parent,connection,connection_id";
  42. }
  43. // Returns specified connection.
  44. rpc GetConnection(GetConnectionRequest) returns (Connection) {
  45. option (google.api.http) = {
  46. get: "/v1/{name=projects/*/locations/*/connections/*}"
  47. };
  48. option (google.api.method_signature) = "name";
  49. }
  50. // Returns a list of connections in the given project.
  51. rpc ListConnections(ListConnectionsRequest) returns (ListConnectionsResponse) {
  52. option (google.api.http) = {
  53. get: "/v1/{parent=projects/*/locations/*}/connections"
  54. };
  55. option (google.api.method_signature) = "parent";
  56. }
  57. // Updates the specified connection. For security reasons, also resets
  58. // credential if connection properties are in the update field mask.
  59. rpc UpdateConnection(UpdateConnectionRequest) returns (Connection) {
  60. option (google.api.http) = {
  61. patch: "/v1/{name=projects/*/locations/*/connections/*}"
  62. body: "connection"
  63. };
  64. option (google.api.method_signature) = "name,connection,update_mask";
  65. }
  66. // Deletes connection and associated credential.
  67. rpc DeleteConnection(DeleteConnectionRequest) returns (google.protobuf.Empty) {
  68. option (google.api.http) = {
  69. delete: "/v1/{name=projects/*/locations/*/connections/*}"
  70. };
  71. option (google.api.method_signature) = "name";
  72. }
  73. // Gets the access control policy for a resource.
  74. // Returns an empty policy if the resource exists and does not have a policy
  75. // set.
  76. rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) {
  77. option (google.api.http) = {
  78. post: "/v1/{resource=projects/*/locations/*/connections/*}:getIamPolicy"
  79. body: "*"
  80. };
  81. option (google.api.method_signature) = "resource,options";
  82. }
  83. // Sets the access control policy on the specified resource. Replaces any
  84. // existing policy.
  85. //
  86. // Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
  87. rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) {
  88. option (google.api.http) = {
  89. post: "/v1/{resource=projects/*/locations/*/connections/*}:setIamPolicy"
  90. body: "*"
  91. };
  92. option (google.api.method_signature) = "resource,policy";
  93. }
  94. // Returns permissions that a caller has on the specified resource.
  95. // If the resource does not exist, this will return an empty set of
  96. // permissions, not a `NOT_FOUND` error.
  97. //
  98. // Note: This operation is designed to be used for building permission-aware
  99. // UIs and command-line tools, not for authorization checking. This operation
  100. // may "fail open" without warning.
  101. rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) {
  102. option (google.api.http) = {
  103. post: "/v1/{resource=projects/*/locations/*/connections/*}:testIamPermissions"
  104. body: "*"
  105. };
  106. option (google.api.method_signature) = "resource,permissions";
  107. }
  108. }
  109. // The request for [ConnectionService.CreateConnection][google.cloud.bigquery.connection.v1.ConnectionService.CreateConnection].
  110. message CreateConnectionRequest {
  111. // Required. Parent resource name.
  112. // Must be in the format `projects/{project_id}/locations/{location_id}`
  113. string parent = 1 [
  114. (google.api.field_behavior) = REQUIRED,
  115. (google.api.resource_reference) = {
  116. type: "locations.googleapis.com/Location"
  117. }
  118. ];
  119. // Optional. Connection id that should be assigned to the created connection.
  120. string connection_id = 2 [(google.api.field_behavior) = OPTIONAL];
  121. // Required. Connection to create.
  122. Connection connection = 3 [(google.api.field_behavior) = REQUIRED];
  123. }
  124. // The request for [ConnectionService.GetConnection][google.cloud.bigquery.connection.v1.ConnectionService.GetConnection].
  125. message GetConnectionRequest {
  126. // Required. Name of the requested connection, for example:
  127. // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
  128. string name = 1 [
  129. (google.api.field_behavior) = REQUIRED,
  130. (google.api.resource_reference) = {
  131. type: "bigqueryconnection.googleapis.com/Connection"
  132. }
  133. ];
  134. }
  135. // The request for [ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections].
  136. message ListConnectionsRequest {
  137. // Required. Parent resource name.
  138. // Must be in the form: `projects/{project_id}/locations/{location_id}`
  139. string parent = 1 [
  140. (google.api.field_behavior) = REQUIRED,
  141. (google.api.resource_reference) = {
  142. type: "locations.googleapis.com/Location"
  143. }
  144. ];
  145. // Required. Page size.
  146. int32 page_size = 4 [(google.api.field_behavior) = REQUIRED];
  147. // Page token.
  148. string page_token = 3;
  149. }
  150. // The response for [ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections].
  151. message ListConnectionsResponse {
  152. // Next page token.
  153. string next_page_token = 1;
  154. // List of connections.
  155. repeated Connection connections = 2;
  156. }
  157. // The request for [ConnectionService.UpdateConnection][google.cloud.bigquery.connection.v1.ConnectionService.UpdateConnection].
  158. message UpdateConnectionRequest {
  159. // Required. Name of the connection to update, for example:
  160. // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
  161. string name = 1 [
  162. (google.api.field_behavior) = REQUIRED,
  163. (google.api.resource_reference) = {
  164. type: "bigqueryconnection.googleapis.com/Connection"
  165. }
  166. ];
  167. // Required. Connection containing the updated fields.
  168. Connection connection = 2 [(google.api.field_behavior) = REQUIRED];
  169. // Required. Update mask for the connection fields to be updated.
  170. google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED];
  171. }
  172. // The request for [ConnectionService.DeleteConnectionRequest][].
  173. message DeleteConnectionRequest {
  174. // Required. Name of the deleted connection, for example:
  175. // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
  176. string name = 1 [
  177. (google.api.field_behavior) = REQUIRED,
  178. (google.api.resource_reference) = {
  179. type: "bigqueryconnection.googleapis.com/Connection"
  180. }
  181. ];
  182. }
  183. // Configuration parameters to establish connection with an external data
  184. // source, except the credential attributes.
  185. message Connection {
  186. option (google.api.resource) = {
  187. type: "bigqueryconnection.googleapis.com/Connection"
  188. pattern: "projects/{project}/locations/{location}/connections/{connection}"
  189. };
  190. // The resource name of the connection in the form of:
  191. // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
  192. string name = 1;
  193. // User provided display name for the connection.
  194. string friendly_name = 2;
  195. // User provided description.
  196. string description = 3;
  197. // Properties specific to the underlying data source.
  198. oneof properties {
  199. // Cloud SQL properties.
  200. CloudSqlProperties cloud_sql = 4;
  201. // Amazon Web Services (AWS) properties.
  202. AwsProperties aws = 8;
  203. // Azure properties.
  204. AzureProperties azure = 11;
  205. // Cloud Spanner properties.
  206. CloudSpannerProperties cloud_spanner = 21;
  207. // Cloud Resource properties.
  208. CloudResourceProperties cloud_resource = 22;
  209. }
  210. // Output only. The creation timestamp of the connection.
  211. int64 creation_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  212. // Output only. The last update timestamp of the connection.
  213. int64 last_modified_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  214. // Output only. True, if credential is configured for this connection.
  215. bool has_credential = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  216. }
  217. // Connection properties specific to the Cloud SQL.
  218. message CloudSqlProperties {
  219. // Supported Cloud SQL database types.
  220. enum DatabaseType {
  221. // Unspecified database type.
  222. DATABASE_TYPE_UNSPECIFIED = 0;
  223. // Cloud SQL for PostgreSQL.
  224. POSTGRES = 1;
  225. // Cloud SQL for MySQL.
  226. MYSQL = 2;
  227. }
  228. // Cloud SQL instance ID in the form `project:location:instance`.
  229. string instance_id = 1;
  230. // Database name.
  231. string database = 2;
  232. // Type of the Cloud SQL database.
  233. DatabaseType type = 3;
  234. // Input only. Cloud SQL credential.
  235. CloudSqlCredential credential = 4 [(google.api.field_behavior) = INPUT_ONLY];
  236. // Output only. The account ID of the service used for the purpose of this connection.
  237. //
  238. // When the connection is used in the context of an operation in
  239. // BigQuery, this service account will serve as identity being used for
  240. // connecting to the CloudSQL instance specified in this connection.
  241. string service_account_id = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  242. }
  243. // Credential info for the Cloud SQL.
  244. message CloudSqlCredential {
  245. // The username for the credential.
  246. string username = 1;
  247. // The password for the credential.
  248. string password = 2;
  249. }
  250. // Connection properties specific to Cloud Spanner.
  251. message CloudSpannerProperties {
  252. // Cloud Spanner database in the form `project/instance/database'
  253. string database = 1;
  254. // If parallelism should be used when reading from Cloud Spanner
  255. bool use_parallelism = 2;
  256. }
  257. // Connection properties specific to Amazon Web Services (AWS).
  258. message AwsProperties {
  259. // Authentication method chosen at connection creation.
  260. oneof authentication_method {
  261. // Authentication using Google owned AWS IAM user's access key to assume
  262. // into customer's AWS IAM Role.
  263. // Deprecated, do not use.
  264. AwsCrossAccountRole cross_account_role = 2 [deprecated = true];
  265. // Authentication using Google owned service account to assume into
  266. // customer's AWS IAM Role.
  267. AwsAccessRole access_role = 3;
  268. }
  269. }
  270. // Authentication method for Amazon Web Services (AWS) that uses Google owned
  271. // AWS IAM user's access key to assume into customer's AWS IAM Role.
  272. message AwsCrossAccountRole {
  273. // The user’s AWS IAM Role that trusts the Google-owned AWS IAM user
  274. // Connection.
  275. string iam_role_id = 1;
  276. // Output only. Google-owned AWS IAM User for a Connection.
  277. string iam_user_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  278. // Output only. A Google-generated id for representing Connection’s identity in AWS.
  279. // External Id is also used for preventing the Confused Deputy Problem. See
  280. // https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html
  281. string external_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  282. }
  283. // Authentication method for Amazon Web Services (AWS) that uses Google owned
  284. // Google service account to assume into customer's AWS IAM Role.
  285. message AwsAccessRole {
  286. // The user’s AWS IAM Role that trusts the Google-owned AWS IAM user
  287. // Connection.
  288. string iam_role_id = 1;
  289. // A unique Google-owned and Google-generated identity for the Connection.
  290. // This identity will be used to access the user's AWS IAM Role.
  291. string identity = 2;
  292. }
  293. // Container for connection properties specific to Azure.
  294. message AzureProperties {
  295. // Output only. The name of the Azure Active Directory Application.
  296. string application = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  297. // Output only. The client id of the Azure Active Directory Application.
  298. string client_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  299. // Output only. The object id of the Azure Active Directory Application.
  300. string object_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  301. // The id of customer's directory that host the data.
  302. string customer_tenant_id = 4;
  303. // The URL user will be redirected to after granting consent during connection
  304. // setup.
  305. string redirect_uri = 5;
  306. // The client id of the user's Azure Active Directory Application used for a
  307. // federated connection.
  308. string federated_application_client_id = 6;
  309. // Output only. A unique Google-owned and Google-generated identity for the Connection.
  310. // This identity will be used to access the user's Azure Active Directory
  311. // Application.
  312. string identity = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  313. }
  314. // Container for connection properties for delegation of access to GCP
  315. // resources.
  316. message CloudResourceProperties {
  317. // Output only. The account ID of the service created for the purpose of this connection.
  318. //
  319. // The service account does not have any permissions associated with it
  320. // when it is created. After creation, customers delegate permissions
  321. // to the service account. When the connection is used in the context of an
  322. // operation in BigQuery, the service account will be used to connect to the
  323. // desired resources in GCP.
  324. //
  325. // The account ID is in the form of:
  326. // <service-1234>@gcp-sa-bigquery-cloudresource.iam.gserviceaccount.com
  327. string service_account_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  328. }