Skip to content

Commit

Permalink
feat: add cloud spanner connection properties - serverless analytics (#…
Browse files Browse the repository at this point in the history
…296)

* feat: add cloud spanner connection properties - serverless analytics
feat: add cloud spanner connection properties - database role

PiperOrigin-RevId: 511807110

Source-Link: googleapis/googleapis@a563815

Source-Link: googleapis/googleapis-gen@a28f65a
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTI4ZjY1YWNhY2UxMjUwNGRmZTQ0OGIyYmRjNTUxM2VlODk4NjI2NSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: Update gapic-generator-python to v1.8.5

PiperOrigin-RevId: 511892190

Source-Link: googleapis/googleapis@a45d9c0

Source-Link: googleapis/googleapis-gen@1907294
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTkwNzI5NGIxZDgzNjVlYTI0ZjhjNWYyZTA1OWE2NDEyNGM0ZWQzYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: Fixed Ruby documentation generation

PiperOrigin-RevId: 512672271

Source-Link: googleapis/googleapis@bc22d91

Source-Link: googleapis/googleapis-gen@cad484d
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2FkNDg0ZDRkYmRjNDM0YmFiOWJkZWIxN2NkZDA3ODQ1N2M3YzcwZCJ9

* 🦉 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>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people authored Feb 28, 2023
1 parent 28dcedc commit 44fa6cb
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ async def sample_list_connections():
Returns:
google.cloud.bigquery_connection_v1.services.connection_service.pagers.ListConnectionsAsyncPager:
The response for
[ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections].
[ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ def sample_list_connections():
Returns:
google.cloud.bigquery_connection_v1.services.connection_service.pagers.ListConnectionsPager:
The response for
[ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections].
[ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import dataclasses
import json # type: ignore
import re
from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
import warnings

from google.api_core import gapic_v1, path_template, rest_helpers, rest_streaming
Expand Down Expand Up @@ -404,7 +404,7 @@ class _CreateConnection(ConnectionServiceRestStub):
def __hash__(self):
return hash("CreateConnection")

__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {}
__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}

@classmethod
def _get_unset_required_fields(cls, message_dict):
Expand Down Expand Up @@ -506,7 +506,7 @@ class _DeleteConnection(ConnectionServiceRestStub):
def __hash__(self):
return hash("DeleteConnection")

__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {}
__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}

@classmethod
def _get_unset_required_fields(cls, message_dict):
Expand Down Expand Up @@ -584,7 +584,7 @@ class _GetConnection(ConnectionServiceRestStub):
def __hash__(self):
return hash("GetConnection")

__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {}
__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}

@classmethod
def _get_unset_required_fields(cls, message_dict):
Expand Down Expand Up @@ -675,7 +675,7 @@ class _GetIamPolicy(ConnectionServiceRestStub):
def __hash__(self):
return hash("GetIamPolicy")

__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {}
__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}

@classmethod
def _get_unset_required_fields(cls, message_dict):
Expand Down Expand Up @@ -844,7 +844,7 @@ class _ListConnections(ConnectionServiceRestStub):
def __hash__(self):
return hash("ListConnections")

__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {
__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
"pageSize": 0,
}

Expand Down Expand Up @@ -938,7 +938,7 @@ class _SetIamPolicy(ConnectionServiceRestStub):
def __hash__(self):
return hash("SetIamPolicy")

__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {}
__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}

@classmethod
def _get_unset_required_fields(cls, message_dict):
Expand Down Expand Up @@ -1107,7 +1107,7 @@ class _TestIamPermissions(ConnectionServiceRestStub):
def __hash__(self):
return hash("TestIamPermissions")

__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {}
__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}

@classmethod
def _get_unset_required_fields(cls, message_dict):
Expand Down Expand Up @@ -1204,7 +1204,7 @@ class _UpdateConnection(ConnectionServiceRestStub):
def __hash__(self):
return hash("UpdateConnection")

__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {
__REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
"updateMask": {},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from __future__ import annotations

from typing import MutableMapping, MutableSequence

from google.protobuf import field_mask_pb2 # type: ignore
Expand Down Expand Up @@ -310,10 +312,11 @@ class CloudSqlProperties(proto.Message):
service_account_id (str):
Output only. The account ID of the service
used for the purpose of this connection.
When the connection is used in the context of an
operation in BigQuery, this service account will
serve as identity being used for connecting to
the CloudSQL instance specified in this
serve as the identity being used for connecting
to the CloudSQL instance specified in this
connection.
"""

Expand Down Expand Up @@ -386,6 +389,30 @@ class CloudSpannerProperties(proto.Message):
use_parallelism (bool):
If parallelism should be used when reading
from Cloud Spanner
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.
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.
"""

database: str = proto.Field(
Expand All @@ -396,6 +423,14 @@ class CloudSpannerProperties(proto.Message):
proto.BOOL,
number=2,
)
use_serverless_analytics: bool = proto.Field(
proto.BOOL,
number=3,
)
database_role: str = proto.Field(
proto.STRING,
number=4,
)


class AwsProperties(proto.Message):
Expand Down Expand Up @@ -514,7 +549,7 @@ class AzureProperties(proto.Message):
The URL user will be redirected to after
granting consent during connection setup.
federated_application_client_id (str):
The client id of the user's Azure Active
The client ID of the user's Azure Active
Directory Application used for a federated
connection.
identity (str):
Expand Down Expand Up @@ -562,6 +597,7 @@ class CloudResourceProperties(proto.Message):
service_account_id (str):
Output only. The account ID of the service
created for the purpose of this connection.
The service account does not have any
permissions associated with it when it is
created. After creation, customers delegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3049,7 +3049,12 @@ def test_create_connection_rest(request_type):
"federated_application_client_id": "federated_application_client_id_value",
"identity": "identity_value",
},
"cloud_spanner": {"database": "database_value", "use_parallelism": True},
"cloud_spanner": {
"database": "database_value",
"use_parallelism": True,
"use_serverless_analytics": True,
"database_role": "database_role_value",
},
"cloud_resource": {"service_account_id": "service_account_id_value"},
"creation_time": 1379,
"last_modified_time": 1890,
Expand Down Expand Up @@ -3287,7 +3292,12 @@ def test_create_connection_rest_bad_request(
"federated_application_client_id": "federated_application_client_id_value",
"identity": "identity_value",
},
"cloud_spanner": {"database": "database_value", "use_parallelism": True},
"cloud_spanner": {
"database": "database_value",
"use_parallelism": True,
"use_serverless_analytics": True,
"database_role": "database_role_value",
},
"cloud_resource": {"service_account_id": "service_account_id_value"},
"creation_time": 1379,
"last_modified_time": 1890,
Expand Down Expand Up @@ -4058,7 +4068,12 @@ def test_update_connection_rest(request_type):
"federated_application_client_id": "federated_application_client_id_value",
"identity": "identity_value",
},
"cloud_spanner": {"database": "database_value", "use_parallelism": True},
"cloud_spanner": {
"database": "database_value",
"use_parallelism": True,
"use_serverless_analytics": True,
"database_role": "database_role_value",
},
"cloud_resource": {"service_account_id": "service_account_id_value"},
"creation_time": 1379,
"last_modified_time": 1890,
Expand Down Expand Up @@ -4297,7 +4312,12 @@ def test_update_connection_rest_bad_request(
"federated_application_client_id": "federated_application_client_id_value",
"identity": "identity_value",
},
"cloud_spanner": {"database": "database_value", "use_parallelism": True},
"cloud_spanner": {
"database": "database_value",
"use_parallelism": True,
"use_serverless_analytics": True,
"database_role": "database_role_value",
},
"cloud_resource": {"service_account_id": "service_account_id_value"},
"creation_time": 1379,
"last_modified_time": 1890,
Expand Down

0 comments on commit 44fa6cb

Please sign in to comment.