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 @@ -31,6 +31,8 @@
ImageVersionsClient,
)
from google.cloud.orchestration.airflow.service_v1.types.environments import (
AirflowMetadataRetentionPolicyConfig,
CheckUpgradeRequest,
CheckUpgradeResponse,
CloudDataLineageIntegration,
CreateEnvironmentRequest,
Expand Down Expand Up @@ -104,6 +106,8 @@
"EnvironmentsAsyncClient",
"ImageVersionsClient",
"ImageVersionsAsyncClient",
"AirflowMetadataRetentionPolicyConfig",
"CheckUpgradeRequest",
"CheckUpgradeResponse",
"CloudDataLineageIntegration",
"CreateEnvironmentRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from .services.environments import EnvironmentsAsyncClient, EnvironmentsClient
from .services.image_versions import ImageVersionsAsyncClient, ImageVersionsClient
from .types.environments import (
AirflowMetadataRetentionPolicyConfig,
CheckUpgradeRequest,
CheckUpgradeResponse,
CloudDataLineageIntegration,
CreateEnvironmentRequest,
Expand Down Expand Up @@ -92,6 +94,8 @@
__all__ = (
"EnvironmentsAsyncClient",
"ImageVersionsAsyncClient",
"AirflowMetadataRetentionPolicyConfig",
"CheckUpgradeRequest",
"CheckUpgradeResponse",
"CloudDataLineageIntegration",
"CreateEnvironmentRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"grpc": {
"libraryClient": "EnvironmentsClient",
"rpcs": {
"CheckUpgrade": {
"methods": [
"check_upgrade"
]
},
"CreateEnvironment": {
"methods": [
"create_environment"
Expand Down Expand Up @@ -130,6 +135,11 @@
"grpc-async": {
"libraryClient": "EnvironmentsAsyncClient",
"rpcs": {
"CheckUpgrade": {
"methods": [
"check_upgrade"
]
},
"CreateEnvironment": {
"methods": [
"create_environment"
Expand Down Expand Up @@ -250,6 +260,11 @@
"rest": {
"libraryClient": "EnvironmentsClient",
"rpcs": {
"CheckUpgrade": {
"methods": [
"check_upgrade"
]
},
"CreateEnvironment": {
"methods": [
"create_environment"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,109 @@ async def sample_list_workloads():
# Done; return the response.
return response

async def check_upgrade(
self,
request: Optional[Union[environments.CheckUpgradeRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Check if an upgrade operation on the environment will
succeed.
In case of problems detailed info can be found in the
returned Operation.

.. 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.orchestration.airflow import service_v1

async def sample_check_upgrade():
# Create a client
client = service_v1.EnvironmentsAsyncClient()

# Initialize request argument(s)
request = service_v1.CheckUpgradeRequest(
environment="environment_value",
)

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

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

response = (await operation).result()

# Handle the response
print(response)

Args:
request (Optional[Union[google.cloud.orchestration.airflow.service_v1.types.CheckUpgradeRequest, dict]]):
The request object. Request to check whether image
upgrade will succeed.
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.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.

The result type for the operation will be :class:`google.cloud.orchestration.airflow.service_v1.types.CheckUpgradeResponse` Message containing information about the result of an upgrade check
operation.

"""
# Create or coerce a protobuf request object.
# - 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, environments.CheckUpgradeRequest):
request = environments.CheckUpgradeRequest(request)

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

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

# 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,
environments.CheckUpgradeResponse,
metadata_type=operations.OperationMetadata,
)

# Done; return the response.
return response

async def create_user_workloads_secret(
self,
request: Optional[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1884,6 +1884,107 @@ def sample_list_workloads():
# Done; return the response.
return response

def check_upgrade(
self,
request: Optional[Union[environments.CheckUpgradeRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
r"""Check if an upgrade operation on the environment will
succeed.
In case of problems detailed info can be found in the
returned Operation.

.. 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.orchestration.airflow import service_v1

def sample_check_upgrade():
# Create a client
client = service_v1.EnvironmentsClient()

# Initialize request argument(s)
request = service_v1.CheckUpgradeRequest(
environment="environment_value",
)

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

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

response = operation.result()

# Handle the response
print(response)

Args:
request (Union[google.cloud.orchestration.airflow.service_v1.types.CheckUpgradeRequest, dict]):
The request object. Request to check whether image
upgrade will succeed.
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.api_core.operation.Operation:
An object representing a long-running operation.

The result type for the operation will be :class:`google.cloud.orchestration.airflow.service_v1.types.CheckUpgradeResponse` Message containing information about the result of an upgrade check
operation.

"""
# Create or coerce a protobuf request object.
# - 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, environments.CheckUpgradeRequest):
request = environments.CheckUpgradeRequest(request)

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

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

# Validate the universe domain.
self._validate_universe_domain()

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

# Wrap the response in an operation future.
response = operation.from_gapic(
response,
self._transport.operations_client,
environments.CheckUpgradeResponse,
metadata_type=operations.OperationMetadata,
)

# Done; return the response.
return response

def create_user_workloads_secret(
self,
request: Optional[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=None,
client_info=client_info,
),
self.check_upgrade: gapic_v1.method.wrap_method(
self.check_upgrade,
default_timeout=None,
client_info=client_info,
),
self.create_user_workloads_secret: gapic_v1.method.wrap_method(
self.create_user_workloads_secret,
default_timeout=None,
Expand Down Expand Up @@ -359,6 +364,15 @@ def list_workloads(
]:
raise NotImplementedError()

@property
def check_upgrade(
self,
) -> Callable[
[environments.CheckUpgradeRequest],
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
]:
raise NotImplementedError()

@property
def create_user_workloads_secret(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,35 @@ def list_workloads(
)
return self._stubs["list_workloads"]

@property
def check_upgrade(
self,
) -> Callable[[environments.CheckUpgradeRequest], operations_pb2.Operation]:
r"""Return a callable for the check upgrade method over gRPC.

Check if an upgrade operation on the environment will
succeed.
In case of problems detailed info can be found in the
returned Operation.

Returns:
Callable[[~.CheckUpgradeRequest],
~.Operation]:
A function that, when called, will call the underlying RPC
on the server.
"""
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pass in the functions for each.
if "check_upgrade" not in self._stubs:
self._stubs["check_upgrade"] = self.grpc_channel.unary_unary(
"/google.cloud.orchestration.airflow.service.v1.Environments/CheckUpgrade",
request_serializer=environments.CheckUpgradeRequest.serialize,
response_deserializer=operations_pb2.Operation.FromString,
)
return self._stubs["check_upgrade"]

@property
def create_user_workloads_secret(
self,
Expand Down
Loading