Skip to content

Commit 23b18ca

Browse files
feat: add support for Salesforce connections, which are usable only by allowlisted partners (#323)
* feat: add support for Salesforce connections, which are usable only by allowlisted partners feat: add cloud spanner connection properties - use_data_boost feat: add cloud spanner connection properties - max_parallelism PiperOrigin-RevId: 546084599 Source-Link: googleapis/googleapis@b348970 Source-Link: googleapis/googleapis-gen@fd0c44b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZmQwYzQ0YjkxZTA5YWYyYzU2ODEwMzFjNDk3NTU5MGUwZmFmNzc5MiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 3fa799f commit 23b18ca

File tree

6 files changed

+116
-21
lines changed

6 files changed

+116
-21
lines changed

packages/google-cloud-bigquery-connection/google/cloud/bigquery_connection/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
ListConnectionsRequest,
4141
ListConnectionsResponse,
4242
MetastoreServiceConfig,
43+
SalesforceDataCloudProperties,
4344
SparkHistoryServerConfig,
4445
SparkProperties,
4546
UpdateConnectionRequest,
@@ -63,6 +64,7 @@
6364
"ListConnectionsRequest",
6465
"ListConnectionsResponse",
6566
"MetastoreServiceConfig",
67+
"SalesforceDataCloudProperties",
6668
"SparkHistoryServerConfig",
6769
"SparkProperties",
6870
"UpdateConnectionRequest",

packages/google-cloud-bigquery-connection/google/cloud/bigquery_connection_v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
ListConnectionsRequest,
3939
ListConnectionsResponse,
4040
MetastoreServiceConfig,
41+
SalesforceDataCloudProperties,
4142
SparkHistoryServerConfig,
4243
SparkProperties,
4344
UpdateConnectionRequest,
@@ -61,6 +62,7 @@
6162
"ListConnectionsRequest",
6263
"ListConnectionsResponse",
6364
"MetastoreServiceConfig",
65+
"SalesforceDataCloudProperties",
6466
"SparkHistoryServerConfig",
6567
"SparkProperties",
6668
"UpdateConnectionRequest",

packages/google-cloud-bigquery-connection/google/cloud/bigquery_connection_v1/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
ListConnectionsRequest,
3030
ListConnectionsResponse,
3131
MetastoreServiceConfig,
32+
SalesforceDataCloudProperties,
3233
SparkHistoryServerConfig,
3334
SparkProperties,
3435
UpdateConnectionRequest,
@@ -50,6 +51,7 @@
5051
"ListConnectionsRequest",
5152
"ListConnectionsResponse",
5253
"MetastoreServiceConfig",
54+
"SalesforceDataCloudProperties",
5355
"SparkHistoryServerConfig",
5456
"SparkProperties",
5557
"UpdateConnectionRequest",

packages/google-cloud-bigquery-connection/google/cloud/bigquery_connection_v1/types/connection.py

Lines changed: 81 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"MetastoreServiceConfig",
4242
"SparkHistoryServerConfig",
4343
"SparkProperties",
44+
"SalesforceDataCloudProperties",
4445
},
4546
)
4647

@@ -235,6 +236,14 @@ class Connection(proto.Message):
235236
spark (google.cloud.bigquery_connection_v1.types.SparkProperties):
236237
Spark properties.
237238
239+
This field is a member of `oneof`_ ``properties``.
240+
salesforce_data_cloud (google.cloud.bigquery_connection_v1.types.SalesforceDataCloudProperties):
241+
Optional. Salesforce DataCloud properties.
242+
This field is intended for use only by
243+
Salesforce partner projects. This field contains
244+
properties for your Salesforce DataCloud
245+
connection.
246+
238247
This field is a member of `oneof`_ ``properties``.
239248
creation_time (int):
240249
Output only. The creation timestamp of the
@@ -295,6 +304,12 @@ class Connection(proto.Message):
295304
oneof="properties",
296305
message="SparkProperties",
297306
)
307+
salesforce_data_cloud: "SalesforceDataCloudProperties" = proto.Field(
308+
proto.MESSAGE,
309+
number=24,
310+
oneof="properties",
311+
message="SalesforceDataCloudProperties",
312+
)
298313
creation_time: int = proto.Field(
299314
proto.INT64,
300315
number=5,
@@ -402,30 +417,38 @@ class CloudSpannerProperties(proto.Message):
402417
use_parallelism (bool):
403418
If parallelism should be used when reading
404419
from Cloud Spanner
420+
max_parallelism (int):
421+
Allows setting max parallelism per query when executing on
422+
Spanner independent compute resources. If unspecified,
423+
default values of parallelism are chosen that are dependent
424+
on the Cloud Spanner instance configuration.
425+
426+
REQUIRES: ``use_parallelism`` must be set. REQUIRES: Either
427+
``use_data_boost`` or ``use_serverless_analytics`` must be
428+
set.
405429
use_serverless_analytics (bool):
406430
If the serverless analytics service should be used to read
407431
data from Cloud Spanner. Note: ``use_parallelism`` must be
408432
set when using serverless analytics.
433+
use_data_boost (bool):
434+
If set, the request will be executed via Spanner independent
435+
compute resources. REQUIRES: ``use_parallelism`` must be
436+
set.
437+
438+
NOTE: ``use_serverless_analytics`` will be deprecated.
439+
Prefer ``use_data_boost`` over ``use_serverless_analytics``.
409440
database_role (str):
410-
Optional. Cloud Spanner database role for
411-
fine-grained access control. A database role is
412-
a collection of fine-grained access privileges.
413-
Example: Admin predefines roles that provides
414-
user a set of permissions (SELECT, INSERT, ..).
415-
The user can then specify a predefined role on a
416-
connection to execute their Cloud Spanner query.
417-
The role is passthrough here. If the user is not
418-
authorized to use the specified role, they get
419-
an error. This validation happens on Cloud
420-
Spanner.
421-
422-
See
423-
https://cloud.google.com/spanner/docs/fgac-about
424-
for more details.
425-
REQUIRES: database role name must start with
426-
uppercase/lowercase letter and only contain
427-
uppercase/lowercase letters, numbers, and
428-
underscores.
441+
Optional. Cloud Spanner database role for fine-grained
442+
access control. The Cloud Spanner admin should have
443+
provisioned the database role with appropriate permissions,
444+
such as ``SELECT`` and ``INSERT``. Other users should only
445+
use roles provided by their Cloud Spanner admins.
446+
447+
For more details, see [About fine-grained access control]
448+
(https://cloud.google.com/spanner/docs/fgac-about).
449+
450+
REQUIRES: The database role name must start with a letter,
451+
and can only contain letters, numbers, and underscores.
429452
"""
430453

431454
database: str = proto.Field(
@@ -436,10 +459,18 @@ class CloudSpannerProperties(proto.Message):
436459
proto.BOOL,
437460
number=2,
438461
)
462+
max_parallelism: int = proto.Field(
463+
proto.INT32,
464+
number=5,
465+
)
439466
use_serverless_analytics: bool = proto.Field(
440467
proto.BOOL,
441468
number=3,
442469
)
470+
use_data_boost: bool = proto.Field(
471+
proto.BOOL,
472+
number=6,
473+
)
443474
database_role: str = proto.Field(
444475
proto.STRING,
445476
number=4,
@@ -683,7 +714,7 @@ class SparkProperties(proto.Message):
683714
permissions to the service account. When the
684715
connection is used in the context of a stored
685716
procedure for Apache Spark in BigQuery, the
686-
service account will be used to connect to the
717+
service account is used to connect to the
687718
desired resources in Google Cloud.
688719
The account ID is in the form of:
689720
bqcx-<projectnumber>-<uniqueid>@gcp-sa-bigquery-consp.iam.gserviceaccount.com
@@ -711,4 +742,34 @@ class SparkProperties(proto.Message):
711742
)
712743

713744

745+
class SalesforceDataCloudProperties(proto.Message):
746+
r"""Connection properties specific to Salesforce DataCloud. This
747+
is intended for use only by Salesforce partner projects.
748+
749+
Attributes:
750+
instance_uri (str):
751+
The URL to the user's Salesforce DataCloud
752+
instance.
753+
identity (str):
754+
Output only. A unique Google-owned and
755+
Google-generated service account identity for
756+
the connection.
757+
tenant_id (str):
758+
The ID of the user's Salesforce tenant.
759+
"""
760+
761+
instance_uri: str = proto.Field(
762+
proto.STRING,
763+
number=1,
764+
)
765+
identity: str = proto.Field(
766+
proto.STRING,
767+
number=2,
768+
)
769+
tenant_id: str = proto.Field(
770+
proto.STRING,
771+
number=3,
772+
)
773+
774+
714775
__all__ = tuple(sorted(__protobuf__.manifest))

packages/google-cloud-bigquery-connection/samples/generated_samples/snippet_metadata_google.cloud.bigquery.connection.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-bigquery-connection",
11-
"version": "1.12.1"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-bigquery-connection/tests/unit/gapic/bigquery_connection_v1/test_connection_service.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3047,7 +3047,9 @@ def test_create_connection_rest(request_type):
30473047
"cloud_spanner": {
30483048
"database": "database_value",
30493049
"use_parallelism": True,
3050+
"max_parallelism": 1595,
30503051
"use_serverless_analytics": True,
3052+
"use_data_boost": True,
30513053
"database_role": "database_role_value",
30523054
},
30533055
"cloud_resource": {"service_account_id": "service_account_id_value"},
@@ -3060,6 +3062,11 @@ def test_create_connection_rest(request_type):
30603062
"dataproc_cluster": "dataproc_cluster_value"
30613063
},
30623064
},
3065+
"salesforce_data_cloud": {
3066+
"instance_uri": "instance_uri_value",
3067+
"identity": "identity_value",
3068+
"tenant_id": "tenant_id_value",
3069+
},
30633070
"creation_time": 1379,
30643071
"last_modified_time": 1890,
30653072
"has_credential": True,
@@ -3296,7 +3303,9 @@ def test_create_connection_rest_bad_request(
32963303
"cloud_spanner": {
32973304
"database": "database_value",
32983305
"use_parallelism": True,
3306+
"max_parallelism": 1595,
32993307
"use_serverless_analytics": True,
3308+
"use_data_boost": True,
33003309
"database_role": "database_role_value",
33013310
},
33023311
"cloud_resource": {"service_account_id": "service_account_id_value"},
@@ -3309,6 +3318,11 @@ def test_create_connection_rest_bad_request(
33093318
"dataproc_cluster": "dataproc_cluster_value"
33103319
},
33113320
},
3321+
"salesforce_data_cloud": {
3322+
"instance_uri": "instance_uri_value",
3323+
"identity": "identity_value",
3324+
"tenant_id": "tenant_id_value",
3325+
},
33123326
"creation_time": 1379,
33133327
"last_modified_time": 1890,
33143328
"has_credential": True,
@@ -4080,7 +4094,9 @@ def test_update_connection_rest(request_type):
40804094
"cloud_spanner": {
40814095
"database": "database_value",
40824096
"use_parallelism": True,
4097+
"max_parallelism": 1595,
40834098
"use_serverless_analytics": True,
4099+
"use_data_boost": True,
40844100
"database_role": "database_role_value",
40854101
},
40864102
"cloud_resource": {"service_account_id": "service_account_id_value"},
@@ -4093,6 +4109,11 @@ def test_update_connection_rest(request_type):
40934109
"dataproc_cluster": "dataproc_cluster_value"
40944110
},
40954111
},
4112+
"salesforce_data_cloud": {
4113+
"instance_uri": "instance_uri_value",
4114+
"identity": "identity_value",
4115+
"tenant_id": "tenant_id_value",
4116+
},
40964117
"creation_time": 1379,
40974118
"last_modified_time": 1890,
40984119
"has_credential": True,
@@ -4330,7 +4351,9 @@ def test_update_connection_rest_bad_request(
43304351
"cloud_spanner": {
43314352
"database": "database_value",
43324353
"use_parallelism": True,
4354+
"max_parallelism": 1595,
43334355
"use_serverless_analytics": True,
4356+
"use_data_boost": True,
43344357
"database_role": "database_role_value",
43354358
},
43364359
"cloud_resource": {"service_account_id": "service_account_id_value"},
@@ -4343,6 +4366,11 @@ def test_update_connection_rest_bad_request(
43434366
"dataproc_cluster": "dataproc_cluster_value"
43444367
},
43454368
},
4369+
"salesforce_data_cloud": {
4370+
"instance_uri": "instance_uri_value",
4371+
"identity": "identity_value",
4372+
"tenant_id": "tenant_id_value",
4373+
},
43464374
"creation_time": 1379,
43474375
"last_modified_time": 1890,
43484376
"has_credential": True,

0 commit comments

Comments
 (0)