Skip to content

Commit

Permalink
feat: add support for Salesforce connections, which are usable only b…
Browse files Browse the repository at this point in the history
…y 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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Jul 7, 2023
1 parent 3fa799f commit 23b18ca
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
ListConnectionsRequest,
ListConnectionsResponse,
MetastoreServiceConfig,
SalesforceDataCloudProperties,
SparkHistoryServerConfig,
SparkProperties,
UpdateConnectionRequest,
Expand All @@ -63,6 +64,7 @@
"ListConnectionsRequest",
"ListConnectionsResponse",
"MetastoreServiceConfig",
"SalesforceDataCloudProperties",
"SparkHistoryServerConfig",
"SparkProperties",
"UpdateConnectionRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
ListConnectionsRequest,
ListConnectionsResponse,
MetastoreServiceConfig,
SalesforceDataCloudProperties,
SparkHistoryServerConfig,
SparkProperties,
UpdateConnectionRequest,
Expand All @@ -61,6 +62,7 @@
"ListConnectionsRequest",
"ListConnectionsResponse",
"MetastoreServiceConfig",
"SalesforceDataCloudProperties",
"SparkHistoryServerConfig",
"SparkProperties",
"UpdateConnectionRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
ListConnectionsRequest,
ListConnectionsResponse,
MetastoreServiceConfig,
SalesforceDataCloudProperties,
SparkHistoryServerConfig,
SparkProperties,
UpdateConnectionRequest,
Expand All @@ -50,6 +51,7 @@
"ListConnectionsRequest",
"ListConnectionsResponse",
"MetastoreServiceConfig",
"SalesforceDataCloudProperties",
"SparkHistoryServerConfig",
"SparkProperties",
"UpdateConnectionRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"MetastoreServiceConfig",
"SparkHistoryServerConfig",
"SparkProperties",
"SalesforceDataCloudProperties",
},
)

Expand Down Expand Up @@ -235,6 +236,14 @@ class Connection(proto.Message):
spark (google.cloud.bigquery_connection_v1.types.SparkProperties):
Spark properties.
This field is a member of `oneof`_ ``properties``.
salesforce_data_cloud (google.cloud.bigquery_connection_v1.types.SalesforceDataCloudProperties):
Optional. Salesforce DataCloud properties.
This field is intended for use only by
Salesforce partner projects. This field contains
properties for your Salesforce DataCloud
connection.
This field is a member of `oneof`_ ``properties``.
creation_time (int):
Output only. The creation timestamp of the
Expand Down Expand Up @@ -295,6 +304,12 @@ class Connection(proto.Message):
oneof="properties",
message="SparkProperties",
)
salesforce_data_cloud: "SalesforceDataCloudProperties" = proto.Field(
proto.MESSAGE,
number=24,
oneof="properties",
message="SalesforceDataCloudProperties",
)
creation_time: int = proto.Field(
proto.INT64,
number=5,
Expand Down Expand Up @@ -402,30 +417,38 @@ class CloudSpannerProperties(proto.Message):
use_parallelism (bool):
If parallelism should be used when reading
from Cloud Spanner
max_parallelism (int):
Allows setting max parallelism per query when executing on
Spanner independent compute resources. If unspecified,
default values of parallelism are chosen that are dependent
on the Cloud Spanner instance configuration.
REQUIRES: ``use_parallelism`` must be set. REQUIRES: Either
``use_data_boost`` or ``use_serverless_analytics`` must be
set.
use_serverless_analytics (bool):
If the serverless analytics service should be used to read
data from Cloud Spanner. Note: ``use_parallelism`` must be
set when using serverless analytics.
use_data_boost (bool):
If set, the request will be executed via Spanner independent
compute resources. REQUIRES: ``use_parallelism`` must be
set.
NOTE: ``use_serverless_analytics`` will be deprecated.
Prefer ``use_data_boost`` over ``use_serverless_analytics``.
database_role (str):
Optional. Cloud Spanner database role for
fine-grained access control. A database role is
a collection of fine-grained access privileges.
Example: Admin predefines roles that provides
user a set of permissions (SELECT, INSERT, ..).
The user can then specify a predefined role on a
connection to execute their Cloud Spanner query.
The role is passthrough here. If the user is not
authorized to use the specified role, they get
an error. This validation happens on Cloud
Spanner.
See
https://cloud.google.com/spanner/docs/fgac-about
for more details.
REQUIRES: database role name must start with
uppercase/lowercase letter and only contain
uppercase/lowercase letters, numbers, and
underscores.
Optional. Cloud Spanner database role for fine-grained
access control. The Cloud Spanner admin should have
provisioned the database role with appropriate permissions,
such as ``SELECT`` and ``INSERT``. Other users should only
use roles provided by their Cloud Spanner admins.
For more details, see [About fine-grained access control]
(https://cloud.google.com/spanner/docs/fgac-about).
REQUIRES: The database role name must start with a letter,
and can only contain letters, numbers, and underscores.
"""

database: str = proto.Field(
Expand All @@ -436,10 +459,18 @@ class CloudSpannerProperties(proto.Message):
proto.BOOL,
number=2,
)
max_parallelism: int = proto.Field(
proto.INT32,
number=5,
)
use_serverless_analytics: bool = proto.Field(
proto.BOOL,
number=3,
)
use_data_boost: bool = proto.Field(
proto.BOOL,
number=6,
)
database_role: str = proto.Field(
proto.STRING,
number=4,
Expand Down Expand Up @@ -683,7 +714,7 @@ class SparkProperties(proto.Message):
permissions to the service account. When the
connection is used in the context of a stored
procedure for Apache Spark in BigQuery, the
service account will be used to connect to the
service account is used to connect to the
desired resources in Google Cloud.
The account ID is in the form of:
bqcx-<projectnumber>-<uniqueid>@gcp-sa-bigquery-consp.iam.gserviceaccount.com
Expand Down Expand Up @@ -711,4 +742,34 @@ class SparkProperties(proto.Message):
)


class SalesforceDataCloudProperties(proto.Message):
r"""Connection properties specific to Salesforce DataCloud. This
is intended for use only by Salesforce partner projects.
Attributes:
instance_uri (str):
The URL to the user's Salesforce DataCloud
instance.
identity (str):
Output only. A unique Google-owned and
Google-generated service account identity for
the connection.
tenant_id (str):
The ID of the user's Salesforce tenant.
"""

instance_uri: str = proto.Field(
proto.STRING,
number=1,
)
identity: str = proto.Field(
proto.STRING,
number=2,
)
tenant_id: str = proto.Field(
proto.STRING,
number=3,
)


__all__ = tuple(sorted(__protobuf__.manifest))
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-bigquery-connection",
"version": "1.12.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3047,7 +3047,9 @@ def test_create_connection_rest(request_type):
"cloud_spanner": {
"database": "database_value",
"use_parallelism": True,
"max_parallelism": 1595,
"use_serverless_analytics": True,
"use_data_boost": True,
"database_role": "database_role_value",
},
"cloud_resource": {"service_account_id": "service_account_id_value"},
Expand All @@ -3060,6 +3062,11 @@ def test_create_connection_rest(request_type):
"dataproc_cluster": "dataproc_cluster_value"
},
},
"salesforce_data_cloud": {
"instance_uri": "instance_uri_value",
"identity": "identity_value",
"tenant_id": "tenant_id_value",
},
"creation_time": 1379,
"last_modified_time": 1890,
"has_credential": True,
Expand Down Expand Up @@ -3296,7 +3303,9 @@ def test_create_connection_rest_bad_request(
"cloud_spanner": {
"database": "database_value",
"use_parallelism": True,
"max_parallelism": 1595,
"use_serverless_analytics": True,
"use_data_boost": True,
"database_role": "database_role_value",
},
"cloud_resource": {"service_account_id": "service_account_id_value"},
Expand All @@ -3309,6 +3318,11 @@ def test_create_connection_rest_bad_request(
"dataproc_cluster": "dataproc_cluster_value"
},
},
"salesforce_data_cloud": {
"instance_uri": "instance_uri_value",
"identity": "identity_value",
"tenant_id": "tenant_id_value",
},
"creation_time": 1379,
"last_modified_time": 1890,
"has_credential": True,
Expand Down Expand Up @@ -4080,7 +4094,9 @@ def test_update_connection_rest(request_type):
"cloud_spanner": {
"database": "database_value",
"use_parallelism": True,
"max_parallelism": 1595,
"use_serverless_analytics": True,
"use_data_boost": True,
"database_role": "database_role_value",
},
"cloud_resource": {"service_account_id": "service_account_id_value"},
Expand All @@ -4093,6 +4109,11 @@ def test_update_connection_rest(request_type):
"dataproc_cluster": "dataproc_cluster_value"
},
},
"salesforce_data_cloud": {
"instance_uri": "instance_uri_value",
"identity": "identity_value",
"tenant_id": "tenant_id_value",
},
"creation_time": 1379,
"last_modified_time": 1890,
"has_credential": True,
Expand Down Expand Up @@ -4330,7 +4351,9 @@ def test_update_connection_rest_bad_request(
"cloud_spanner": {
"database": "database_value",
"use_parallelism": True,
"max_parallelism": 1595,
"use_serverless_analytics": True,
"use_data_boost": True,
"database_role": "database_role_value",
},
"cloud_resource": {"service_account_id": "service_account_id_value"},
Expand All @@ -4343,6 +4366,11 @@ def test_update_connection_rest_bad_request(
"dataproc_cluster": "dataproc_cluster_value"
},
},
"salesforce_data_cloud": {
"instance_uri": "instance_uri_value",
"identity": "identity_value",
"tenant_id": "tenant_id_value",
},
"creation_time": 1379,
"last_modified_time": 1890,
"has_credential": True,
Expand Down

0 comments on commit 23b18ca

Please sign in to comment.