Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.4.4" # {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.4.4" # {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.4.4" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@
ExecuteSqlMetadata,
ExecuteSqlRequest,
ExecuteSqlResponse,
ExportClusterRequest,
ExportClusterResponse,
FailoverInstanceRequest,
GcsDestination,
GenerateClientCertificateRequest,
GenerateClientCertificateResponse,
GetBackupRequest,
Expand Down Expand Up @@ -137,7 +140,10 @@
"ExecuteSqlMetadata",
"ExecuteSqlRequest",
"ExecuteSqlResponse",
"ExportClusterRequest",
"ExportClusterResponse",
"FailoverInstanceRequest",
"GcsDestination",
"GeminiClusterConfig",
"GeminiInstanceConfig",
"GenerateClientCertificateRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
"execute_sql"
]
},
"ExportCluster": {
"methods": [
"export_cluster"
]
},
"FailoverInstance": {
"methods": [
"failover_instance"
Expand Down Expand Up @@ -250,6 +255,11 @@
"execute_sql"
]
},
"ExportCluster": {
"methods": [
"export_cluster"
]
},
"FailoverInstance": {
"methods": [
"failover_instance"
Expand Down Expand Up @@ -430,6 +440,11 @@
"execute_sql"
]
},
"ExportCluster": {
"methods": [
"export_cluster"
]
},
"FailoverInstance": {
"methods": [
"failover_instance"
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.4.4" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,195 @@ async def sample_update_cluster():
# Done; return the response.
return response

async def export_cluster(
self,
request: Optional[Union[service.ExportClusterRequest, dict]] = None,
*,
name: Optional[str] = None,
gcs_destination: Optional[service.GcsDestination] = None,
database: Optional[str] = None,
csv_export_options: Optional[
service.ExportClusterRequest.CsvExportOptions
] = None,
sql_export_options: Optional[
service.ExportClusterRequest.SqlExportOptions
] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> operation_async.AsyncOperation:
r"""Exports data from the cluster.
Imperative only.

.. 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_v1beta

async def sample_export_cluster():
# Create a client
client = alloydb_v1beta.AlloyDBAdminAsyncClient()

# Initialize request argument(s)
gcs_destination = alloydb_v1beta.GcsDestination()
gcs_destination.uri = "uri_value"

csv_export_options = alloydb_v1beta.CsvExportOptions()
csv_export_options.select_query = "select_query_value"

request = alloydb_v1beta.ExportClusterRequest(
gcs_destination=gcs_destination,
csv_export_options=csv_export_options,
name="name_value",
database="database_value",
)

# Make the request
operation = client.export_cluster(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()

# Handle the response
print(response)

Args:
request (Optional[Union[google.cloud.alloydb_v1beta.types.ExportClusterRequest, dict]]):
The request object. Export cluster request.
name (:class:`str`):
Required. The resource name of the
cluster.

This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
gcs_destination (:class:`google.cloud.alloydb_v1beta.types.GcsDestination`):
Required. Option to export data to
cloud storage.

This corresponds to the ``gcs_destination`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
database (:class:`str`):
Required. Name of the database where the export command
will be executed. Note - Value provided should be the
same as expected from ``SELECT current_database();`` and
NOT as a resource reference.

This corresponds to the ``database`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
csv_export_options (:class:`google.cloud.alloydb_v1beta.types.ExportClusterRequest.CsvExportOptions`):
Options for exporting data in CSV
format. Required field to be set for CSV
file type.

This corresponds to the ``csv_export_options`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
sql_export_options (:class:`google.cloud.alloydb_v1beta.types.ExportClusterRequest.SqlExportOptions`):
Options for exporting data in SQL
format. Required field to be set for SQL
file type.

This corresponds to the ``sql_export_options`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.

Returns:
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.

The result type for the operation will be
:class:`google.cloud.alloydb_v1beta.types.ExportClusterResponse`
Response of export cluster rpc.

"""
# 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.
flattened_params = [
name,
gcs_destination,
database,
csv_export_options,
sql_export_options,
]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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."
)

# - Use the request object if provided (there's no risk of modifying the input as
# there are no flattened fields), or create one.
if not isinstance(request, service.ExportClusterRequest):
request = service.ExportClusterRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if name is not None:
request.name = name
if gcs_destination is not None:
request.gcs_destination = gcs_destination
if database is not None:
request.database = database
if csv_export_options is not None:
request.csv_export_options = csv_export_options
if sql_export_options is not None:
request.sql_export_options = sql_export_options

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

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

# Validate the universe domain.
self._client._validate_universe_domain()

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

# Wrap the response in an operation future.
response = operation_async.from_gapic(
response,
self._client._transport.operations_client,
service.ExportClusterResponse,
metadata_type=service.OperationMetadata,
)

# Done; return the response.
return response

async def upgrade_cluster(
self,
request: Optional[Union[service.UpgradeClusterRequest, dict]] = None,
Expand Down
Loading