Skip to content

Commit bea1a52

Browse files
feat: [google-cloud-alloydb] added PSC config, PSC interface config, PSC instance config (#12134)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: added PSC config, PSC interface config, PSC instance config feat: added two boolean fields satisfies_pzi and satisfies_pzs feat: added instance network config feat: added ListDatabases API and Database object feat: changed field network in NetworkConfig from required to optional docs: clarified read pool config is for read pool type instances END_COMMIT_OVERRIDE PiperOrigin-RevId: 591902051 Source-Link: googleapis/googleapis@5e74f9d Source-Link: googleapis/googleapis-gen@be1a83a Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFsbG95ZGIvLk93bEJvdC55YW1sIiwiaCI6ImJlMWE4M2EyZDU5ZDRhYzMwMzI3MWRiMjM2ZjNjYzIyOWQ4MDQ0MTUifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 1729080 commit bea1a52

24 files changed

+4991
-2840
lines changed
Binary file not shown.

packages/google-cloud-alloydb/google/cloud/alloydb/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.3.5" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-alloydb/google/cloud/alloydb_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.3.5" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-alloydb/google/cloud/alloydb_v1alpha/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
ContinuousBackupConfig,
3030
ContinuousBackupInfo,
3131
ContinuousBackupSource,
32+
Database,
3233
DatabaseVersion,
3334
EncryptionConfig,
3435
EncryptionInfo,
@@ -69,6 +70,8 @@
6970
ListBackupsResponse,
7071
ListClustersRequest,
7172
ListClustersResponse,
73+
ListDatabasesRequest,
74+
ListDatabasesResponse,
7275
ListInstancesRequest,
7376
ListInstancesResponse,
7477
ListSupportedDatabaseFlagsRequest,
@@ -108,6 +111,7 @@
108111
"CreateSecondaryClusterRequest",
109112
"CreateSecondaryInstanceRequest",
110113
"CreateUserRequest",
114+
"Database",
111115
"DatabaseVersion",
112116
"DeleteBackupRequest",
113117
"DeleteClusterRequest",
@@ -130,6 +134,8 @@
130134
"ListBackupsResponse",
131135
"ListClustersRequest",
132136
"ListClustersResponse",
137+
"ListDatabasesRequest",
138+
"ListDatabasesResponse",
133139
"ListInstancesRequest",
134140
"ListInstancesResponse",
135141
"ListSupportedDatabaseFlagsRequest",

packages/google-cloud-alloydb/google/cloud/alloydb_v1alpha/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@
115115
"list_clusters"
116116
]
117117
},
118+
"ListDatabases": {
119+
"methods": [
120+
"list_databases"
121+
]
122+
},
118123
"ListInstances": {
119124
"methods": [
120125
"list_instances"
@@ -275,6 +280,11 @@
275280
"list_clusters"
276281
]
277282
},
283+
"ListDatabases": {
284+
"methods": [
285+
"list_databases"
286+
]
287+
},
278288
"ListInstances": {
279289
"methods": [
280290
"list_instances"
@@ -435,6 +445,11 @@
435445
"list_clusters"
436446
]
437447
},
448+
"ListDatabases": {
449+
"methods": [
450+
"list_databases"
451+
]
452+
},
438453
"ListInstances": {
439454
"methods": [
440455
"list_instances"

packages/google-cloud-alloydb/google/cloud/alloydb_v1alpha/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.3.5" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-alloydb/google/cloud/alloydb_v1alpha/services/alloy_db_admin/async_client.py

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ class AlloyDBAdminAsyncClient:
8080
parse_crypto_key_version_path = staticmethod(
8181
AlloyDBAdminClient.parse_crypto_key_version_path
8282
)
83+
database_path = staticmethod(AlloyDBAdminClient.database_path)
84+
parse_database_path = staticmethod(AlloyDBAdminClient.parse_database_path)
8385
instance_path = staticmethod(AlloyDBAdminClient.instance_path)
8486
parse_instance_path = staticmethod(AlloyDBAdminClient.parse_instance_path)
8587
network_path = staticmethod(AlloyDBAdminClient.network_path)
@@ -4064,6 +4066,130 @@ async def sample_delete_user():
40644066
metadata=metadata,
40654067
)
40664068

4069+
async def list_databases(
4070+
self,
4071+
request: Optional[Union[service.ListDatabasesRequest, dict]] = None,
4072+
*,
4073+
parent: Optional[str] = None,
4074+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
4075+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
4076+
metadata: Sequence[Tuple[str, str]] = (),
4077+
) -> pagers.ListDatabasesAsyncPager:
4078+
r"""Lists Databases in a given project and location.
4079+
4080+
.. code-block:: python
4081+
4082+
# This snippet has been automatically generated and should be regarded as a
4083+
# code template only.
4084+
# It will require modifications to work:
4085+
# - It may require correct/in-range values for request initialization.
4086+
# - It may require specifying regional endpoints when creating the service
4087+
# client as shown in:
4088+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
4089+
from google.cloud import alloydb_v1alpha
4090+
4091+
async def sample_list_databases():
4092+
# Create a client
4093+
client = alloydb_v1alpha.AlloyDBAdminAsyncClient()
4094+
4095+
# Initialize request argument(s)
4096+
request = alloydb_v1alpha.ListDatabasesRequest(
4097+
parent="parent_value",
4098+
)
4099+
4100+
# Make the request
4101+
page_result = client.list_databases(request=request)
4102+
4103+
# Handle the response
4104+
async for response in page_result:
4105+
print(response)
4106+
4107+
Args:
4108+
request (Optional[Union[google.cloud.alloydb_v1alpha.types.ListDatabasesRequest, dict]]):
4109+
The request object. Message for requesting list of
4110+
Databases.
4111+
parent (:class:`str`):
4112+
Required. Parent value for
4113+
ListDatabasesRequest.
4114+
4115+
This corresponds to the ``parent`` field
4116+
on the ``request`` instance; if ``request`` is provided, this
4117+
should not be set.
4118+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
4119+
should be retried.
4120+
timeout (float): The timeout for this request.
4121+
metadata (Sequence[Tuple[str, str]]): Strings which should be
4122+
sent along with the request as metadata.
4123+
4124+
Returns:
4125+
google.cloud.alloydb_v1alpha.services.alloy_db_admin.pagers.ListDatabasesAsyncPager:
4126+
Message for response to listing
4127+
Databases.
4128+
Iterating over this object will yield
4129+
results and resolve additional pages
4130+
automatically.
4131+
4132+
"""
4133+
# Create or coerce a protobuf request object.
4134+
# Quick check: If we got a request object, we should *not* have
4135+
# gotten any keyword arguments that map to the request.
4136+
has_flattened_params = any([parent])
4137+
if request is not None and has_flattened_params:
4138+
raise ValueError(
4139+
"If the `request` argument is set, then none of "
4140+
"the individual field arguments should be set."
4141+
)
4142+
4143+
request = service.ListDatabasesRequest(request)
4144+
4145+
# If we have keyword arguments corresponding to fields on the
4146+
# request, apply these.
4147+
if parent is not None:
4148+
request.parent = parent
4149+
4150+
# Wrap the RPC method; this adds retry and timeout information,
4151+
# and friendly error handling.
4152+
rpc = gapic_v1.method_async.wrap_method(
4153+
self._client._transport.list_databases,
4154+
default_retry=retries.AsyncRetry(
4155+
initial=1.0,
4156+
maximum=60.0,
4157+
multiplier=1.3,
4158+
predicate=retries.if_exception_type(
4159+
core_exceptions.ServiceUnavailable,
4160+
),
4161+
deadline=60.0,
4162+
),
4163+
default_timeout=60.0,
4164+
client_info=DEFAULT_CLIENT_INFO,
4165+
)
4166+
4167+
# Certain fields should be provided within the metadata header;
4168+
# add these here.
4169+
metadata = tuple(metadata) + (
4170+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
4171+
)
4172+
4173+
# Send the request.
4174+
response = await rpc(
4175+
request,
4176+
retry=retry,
4177+
timeout=timeout,
4178+
metadata=metadata,
4179+
)
4180+
4181+
# This method is paged; wrap the response in a pager, which provides
4182+
# an `__aiter__` convenience method.
4183+
response = pagers.ListDatabasesAsyncPager(
4184+
method=rpc,
4185+
request=request,
4186+
response=response,
4187+
metadata=metadata,
4188+
)
4189+
4190+
# Done; return the response.
4191+
return response
4192+
40674193
async def list_operations(
40684194
self,
40694195
request: Optional[operations_pb2.ListOperationsRequest] = None,

packages/google-cloud-alloydb/google/cloud/alloydb_v1alpha/services/alloy_db_admin/client.py

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,30 @@ def parse_crypto_key_version_path(path: str) -> Dict[str, str]:
279279
)
280280
return m.groupdict() if m else {}
281281

282+
@staticmethod
283+
def database_path(
284+
project: str,
285+
location: str,
286+
cluster: str,
287+
database: str,
288+
) -> str:
289+
"""Returns a fully-qualified database string."""
290+
return "projects/{project}/locations/{location}/clusters/{cluster}/databases/{database}".format(
291+
project=project,
292+
location=location,
293+
cluster=cluster,
294+
database=database,
295+
)
296+
297+
@staticmethod
298+
def parse_database_path(path: str) -> Dict[str, str]:
299+
"""Parses a database path into its component segments."""
300+
m = re.match(
301+
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/clusters/(?P<cluster>.+?)/databases/(?P<database>.+?)$",
302+
path,
303+
)
304+
return m.groupdict() if m else {}
305+
282306
@staticmethod
283307
def instance_path(
284308
project: str,
@@ -4343,6 +4367,121 @@ def sample_delete_user():
43434367
metadata=metadata,
43444368
)
43454369

4370+
def list_databases(
4371+
self,
4372+
request: Optional[Union[service.ListDatabasesRequest, dict]] = None,
4373+
*,
4374+
parent: Optional[str] = None,
4375+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
4376+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
4377+
metadata: Sequence[Tuple[str, str]] = (),
4378+
) -> pagers.ListDatabasesPager:
4379+
r"""Lists Databases in a given project and location.
4380+
4381+
.. code-block:: python
4382+
4383+
# This snippet has been automatically generated and should be regarded as a
4384+
# code template only.
4385+
# It will require modifications to work:
4386+
# - It may require correct/in-range values for request initialization.
4387+
# - It may require specifying regional endpoints when creating the service
4388+
# client as shown in:
4389+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
4390+
from google.cloud import alloydb_v1alpha
4391+
4392+
def sample_list_databases():
4393+
# Create a client
4394+
client = alloydb_v1alpha.AlloyDBAdminClient()
4395+
4396+
# Initialize request argument(s)
4397+
request = alloydb_v1alpha.ListDatabasesRequest(
4398+
parent="parent_value",
4399+
)
4400+
4401+
# Make the request
4402+
page_result = client.list_databases(request=request)
4403+
4404+
# Handle the response
4405+
for response in page_result:
4406+
print(response)
4407+
4408+
Args:
4409+
request (Union[google.cloud.alloydb_v1alpha.types.ListDatabasesRequest, dict]):
4410+
The request object. Message for requesting list of
4411+
Databases.
4412+
parent (str):
4413+
Required. Parent value for
4414+
ListDatabasesRequest.
4415+
4416+
This corresponds to the ``parent`` field
4417+
on the ``request`` instance; if ``request`` is provided, this
4418+
should not be set.
4419+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
4420+
should be retried.
4421+
timeout (float): The timeout for this request.
4422+
metadata (Sequence[Tuple[str, str]]): Strings which should be
4423+
sent along with the request as metadata.
4424+
4425+
Returns:
4426+
google.cloud.alloydb_v1alpha.services.alloy_db_admin.pagers.ListDatabasesPager:
4427+
Message for response to listing
4428+
Databases.
4429+
Iterating over this object will yield
4430+
results and resolve additional pages
4431+
automatically.
4432+
4433+
"""
4434+
# Create or coerce a protobuf request object.
4435+
# Quick check: If we got a request object, we should *not* have
4436+
# gotten any keyword arguments that map to the request.
4437+
has_flattened_params = any([parent])
4438+
if request is not None and has_flattened_params:
4439+
raise ValueError(
4440+
"If the `request` argument is set, then none of "
4441+
"the individual field arguments should be set."
4442+
)
4443+
4444+
# Minor optimization to avoid making a copy if the user passes
4445+
# in a service.ListDatabasesRequest.
4446+
# There's no risk of modifying the input as we've already verified
4447+
# there are no flattened fields.
4448+
if not isinstance(request, service.ListDatabasesRequest):
4449+
request = service.ListDatabasesRequest(request)
4450+
# If we have keyword arguments corresponding to fields on the
4451+
# request, apply these.
4452+
if parent is not None:
4453+
request.parent = parent
4454+
4455+
# Wrap the RPC method; this adds retry and timeout information,
4456+
# and friendly error handling.
4457+
rpc = self._transport._wrapped_methods[self._transport.list_databases]
4458+
4459+
# Certain fields should be provided within the metadata header;
4460+
# add these here.
4461+
metadata = tuple(metadata) + (
4462+
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
4463+
)
4464+
4465+
# Send the request.
4466+
response = rpc(
4467+
request,
4468+
retry=retry,
4469+
timeout=timeout,
4470+
metadata=metadata,
4471+
)
4472+
4473+
# This method is paged; wrap the response in a pager, which provides
4474+
# an `__iter__` convenience method.
4475+
response = pagers.ListDatabasesPager(
4476+
method=rpc,
4477+
request=request,
4478+
response=response,
4479+
metadata=metadata,
4480+
)
4481+
4482+
# Done; return the response.
4483+
return response
4484+
43464485
def __enter__(self) -> "AlloyDBAdminClient":
43474486
return self
43484487

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy