Skip to content

Commit

Permalink
feat: [google-cloud-alloydb] added PSC config, PSC interface config, …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
3 people authored Dec 19, 2023
1 parent 1729080 commit bea1a52
Show file tree
Hide file tree
Showing 24 changed files with 4,991 additions and 2,840 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.3.5" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.3.5" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
ContinuousBackupConfig,
ContinuousBackupInfo,
ContinuousBackupSource,
Database,
DatabaseVersion,
EncryptionConfig,
EncryptionInfo,
Expand Down Expand Up @@ -69,6 +70,8 @@
ListBackupsResponse,
ListClustersRequest,
ListClustersResponse,
ListDatabasesRequest,
ListDatabasesResponse,
ListInstancesRequest,
ListInstancesResponse,
ListSupportedDatabaseFlagsRequest,
Expand Down Expand Up @@ -108,6 +111,7 @@
"CreateSecondaryClusterRequest",
"CreateSecondaryInstanceRequest",
"CreateUserRequest",
"Database",
"DatabaseVersion",
"DeleteBackupRequest",
"DeleteClusterRequest",
Expand All @@ -130,6 +134,8 @@
"ListBackupsResponse",
"ListClustersRequest",
"ListClustersResponse",
"ListDatabasesRequest",
"ListDatabasesResponse",
"ListInstancesRequest",
"ListInstancesResponse",
"ListSupportedDatabaseFlagsRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@
"list_clusters"
]
},
"ListDatabases": {
"methods": [
"list_databases"
]
},
"ListInstances": {
"methods": [
"list_instances"
Expand Down Expand Up @@ -275,6 +280,11 @@
"list_clusters"
]
},
"ListDatabases": {
"methods": [
"list_databases"
]
},
"ListInstances": {
"methods": [
"list_instances"
Expand Down Expand Up @@ -435,6 +445,11 @@
"list_clusters"
]
},
"ListDatabases": {
"methods": [
"list_databases"
]
},
"ListInstances": {
"methods": [
"list_instances"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.3.5" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class AlloyDBAdminAsyncClient:
parse_crypto_key_version_path = staticmethod(
AlloyDBAdminClient.parse_crypto_key_version_path
)
database_path = staticmethod(AlloyDBAdminClient.database_path)
parse_database_path = staticmethod(AlloyDBAdminClient.parse_database_path)
instance_path = staticmethod(AlloyDBAdminClient.instance_path)
parse_instance_path = staticmethod(AlloyDBAdminClient.parse_instance_path)
network_path = staticmethod(AlloyDBAdminClient.network_path)
Expand Down Expand Up @@ -4064,6 +4066,130 @@ async def sample_delete_user():
metadata=metadata,
)

async def list_databases(
self,
request: Optional[Union[service.ListDatabasesRequest, dict]] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListDatabasesAsyncPager:
r"""Lists Databases in a given project and location.
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import alloydb_v1alpha
async def sample_list_databases():
# Create a client
client = alloydb_v1alpha.AlloyDBAdminAsyncClient()
# Initialize request argument(s)
request = alloydb_v1alpha.ListDatabasesRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_databases(request=request)
# Handle the response
async for response in page_result:
print(response)
Args:
request (Optional[Union[google.cloud.alloydb_v1alpha.types.ListDatabasesRequest, dict]]):
The request object. Message for requesting list of
Databases.
parent (:class:`str`):
Required. Parent value for
ListDatabasesRequest.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.cloud.alloydb_v1alpha.services.alloy_db_admin.pagers.ListDatabasesAsyncPager:
Message for response to listing
Databases.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

request = service.ListDatabasesRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.list_databases,
default_retry=retries.AsyncRetry(
initial=1.0,
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
core_exceptions.ServiceUnavailable,
),
deadline=60.0,
),
default_timeout=60.0,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListDatabasesAsyncPager(
method=rpc,
request=request,
response=response,
metadata=metadata,
)

# Done; return the response.
return response

async def list_operations(
self,
request: Optional[operations_pb2.ListOperationsRequest] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,30 @@ def parse_crypto_key_version_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def database_path(
project: str,
location: str,
cluster: str,
database: str,
) -> str:
"""Returns a fully-qualified database string."""
return "projects/{project}/locations/{location}/clusters/{cluster}/databases/{database}".format(
project=project,
location=location,
cluster=cluster,
database=database,
)

@staticmethod
def parse_database_path(path: str) -> Dict[str, str]:
"""Parses a database path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/clusters/(?P<cluster>.+?)/databases/(?P<database>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def instance_path(
project: str,
Expand Down Expand Up @@ -4343,6 +4367,121 @@ def sample_delete_user():
metadata=metadata,
)

def list_databases(
self,
request: Optional[Union[service.ListDatabasesRequest, dict]] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListDatabasesPager:
r"""Lists Databases in a given project and location.
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import alloydb_v1alpha
def sample_list_databases():
# Create a client
client = alloydb_v1alpha.AlloyDBAdminClient()
# Initialize request argument(s)
request = alloydb_v1alpha.ListDatabasesRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_databases(request=request)
# Handle the response
for response in page_result:
print(response)
Args:
request (Union[google.cloud.alloydb_v1alpha.types.ListDatabasesRequest, dict]):
The request object. Message for requesting list of
Databases.
parent (str):
Required. Parent value for
ListDatabasesRequest.
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.cloud.alloydb_v1alpha.services.alloy_db_admin.pagers.ListDatabasesPager:
Message for response to listing
Databases.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# Minor optimization to avoid making a copy if the user passes
# in a service.ListDatabasesRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(request, service.ListDatabasesRequest):
request = service.ListDatabasesRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.list_databases]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# This method is paged; wrap the response in a pager, which provides
# an `__iter__` convenience method.
response = pagers.ListDatabasesPager(
method=rpc,
request=request,
response=response,
metadata=metadata,
)

# Done; return the response.
return response

def __enter__(self) -> "AlloyDBAdminClient":
return self

Expand Down
Loading

0 comments on commit bea1a52

Please sign in to comment.