Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
feat: update definitions for cloud/datafusion/v1 and cloud/datafusion…
Browse files Browse the repository at this point in the history
…/v1beta1 (#58)

fix(v1): multiple fields now have field_behavior REQUIRED
fix(v1beta1): multiple fields now have field_behavior REQUIRED

- [ ] Regenerate this pull request now.

Committer: @viacheslav-rostovtsev
PiperOrigin-RevId: 421416031

Source-Link: googleapis/googleapis@5438a17

Source-Link: googleapis/googleapis-gen@cc7213f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2M3MjEzZjBjMmFjNjYyM2M0ZThkNGJhNTcyMzM3YzgzNzk5MGJmNSJ9
  • Loading branch information
gcf-owl-bot[bot] committed Jan 14, 2022
1 parent d532013 commit 6b38819
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 56 deletions.
31 changes: 19 additions & 12 deletions google/cloud/data_fusion_v1/services/data_fusion/async_client.py
Expand Up @@ -54,6 +54,8 @@ class DataFusionAsyncClient:
DEFAULT_ENDPOINT = DataFusionClient.DEFAULT_ENDPOINT
DEFAULT_MTLS_ENDPOINT = DataFusionClient.DEFAULT_MTLS_ENDPOINT

crypto_key_path = staticmethod(DataFusionClient.crypto_key_path)
parse_crypto_key_path = staticmethod(DataFusionClient.parse_crypto_key_path)
instance_path = staticmethod(DataFusionClient.instance_path)
parse_instance_path = staticmethod(DataFusionClient.parse_instance_path)
common_billing_account_path = staticmethod(
Expand Down Expand Up @@ -376,8 +378,8 @@ async def create_instance(
The request object. Request message for creating a Data
Fusion instance.
parent (:class:`str`):
The instance's project and location
in the format
Required. The instance's project and
location in the format
projects/{project}/locations/{location}.
This corresponds to the ``parent`` field
Expand All @@ -389,7 +391,9 @@ async def create_instance(
on the ``request`` instance; if ``request`` is provided, this
should not be set.
instance_id (:class:`str`):
The name of the instance to create.
Required. The name of the instance to
create.
This corresponds to the ``instance_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand Down Expand Up @@ -473,8 +477,8 @@ async def delete_instance(
The request object. Request message for deleting a Data
Fusion instance.
name (:class:`str`):
The instance resource name in the
format
Required. The instance resource name
in the format
projects/{project}/locations/{location}/instances/{instance}
This corresponds to the ``name`` field
Expand Down Expand Up @@ -564,14 +568,17 @@ async def update_instance(
Args:
request (Union[google.cloud.data_fusion_v1.types.UpdateInstanceRequest, dict]):
The request object.
The request object. Request message for updating a Data
Fusion instance. Data Fusion allows updating the labels,
options, and stack driver settings. This is also used
for CDF version upgrade.
instance (:class:`google.cloud.data_fusion_v1.types.Instance`):
The instance resource that replaces
the resource on the server. Currently,
Data Fusion only allows replacing
labels, options, and stack driver
settings. All other fields will be
ignored.
Required. The instance resource that
replaces the resource on the server.
Currently, Data Fusion only allows
replacing labels, options, and stack
driver settings. All other fields will
be ignored.
This corresponds to the ``instance`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
50 changes: 38 additions & 12 deletions google/cloud/data_fusion_v1/services/data_fusion/client.py
Expand Up @@ -165,6 +165,27 @@ def transport(self) -> DataFusionTransport:
"""
return self._transport

@staticmethod
def crypto_key_path(
project: str, location: str, key_ring: str, crypto_key: str,
) -> str:
"""Returns a fully-qualified crypto_key string."""
return "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}".format(
project=project,
location=location,
key_ring=key_ring,
crypto_key=crypto_key,
)

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

@staticmethod
def instance_path(project: str, location: str, instance: str,) -> str:
"""Returns a fully-qualified instance string."""
Expand Down Expand Up @@ -574,8 +595,8 @@ def create_instance(
The request object. Request message for creating a Data
Fusion instance.
parent (str):
The instance's project and location
in the format
Required. The instance's project and
location in the format
projects/{project}/locations/{location}.
This corresponds to the ``parent`` field
Expand All @@ -587,7 +608,9 @@ def create_instance(
on the ``request`` instance; if ``request`` is provided, this
should not be set.
instance_id (str):
The name of the instance to create.
Required. The name of the instance to
create.
This corresponds to the ``instance_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
Expand Down Expand Up @@ -671,8 +694,8 @@ def delete_instance(
The request object. Request message for deleting a Data
Fusion instance.
name (str):
The instance resource name in the
format
Required. The instance resource name
in the format
projects/{project}/locations/{location}/instances/{instance}
This corresponds to the ``name`` field
Expand Down Expand Up @@ -762,14 +785,17 @@ def update_instance(
Args:
request (Union[google.cloud.data_fusion_v1.types.UpdateInstanceRequest, dict]):
The request object.
The request object. Request message for updating a Data
Fusion instance. Data Fusion allows updating the labels,
options, and stack driver settings. This is also used
for CDF version upgrade.
instance (google.cloud.data_fusion_v1.types.Instance):
The instance resource that replaces
the resource on the server. Currently,
Data Fusion only allows replacing
labels, options, and stack driver
settings. All other fields will be
ignored.
Required. The instance resource that
replaces the resource on the server.
Currently, Data Fusion only allows
replacing labels, options, and stack
driver settings. All other fields will
be ignored.
This corresponds to the ``instance`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
59 changes: 44 additions & 15 deletions google/cloud/data_fusion_v1/types/datafusion.py
Expand Up @@ -86,11 +86,23 @@ class Version(proto.Message):
available_features (Sequence[str]):
Represents a list of available feature names
for a given version.
type_ (google.cloud.data_fusion_v1.types.Version.Type):
Type represents the release availability of
the version
"""

class Type(proto.Enum):
r"""Each type represents the release availability of a CDF
version
"""
TYPE_UNSPECIFIED = 0
TYPE_PREVIEW = 1
TYPE_GENERAL_AVAILABILITY = 2

version_number = proto.Field(proto.STRING, number=1,)
default_version = proto.Field(proto.BOOL, number=2,)
available_features = proto.RepeatedField(proto.STRING, number=3,)
type_ = proto.Field(proto.ENUM, number=4, enum=Type,)


class Accelerator(proto.Message):
Expand Down Expand Up @@ -230,6 +242,9 @@ class Instance(proto.Message):
The crypto key configuration. This field is
used by the Customer-Managed Encryption Keys
(CMEK) feature.
disabled_reason (Sequence[google.cloud.data_fusion_v1.types.Instance.DisabledReason]):
Output only. If the instance state is
DISABLED, the reason for disabling the instance.
"""

class Type(proto.Enum):
Expand All @@ -253,6 +268,14 @@ class State(proto.Enum):
UPDATING = 7
AUTO_UPDATING = 8
AUTO_UPGRADING = 9
DISABLED = 10

class DisabledReason(proto.Enum):
r"""The reason for disabling the instance if the state is
DISABLED.
"""
DISABLED_REASON_UNSPECIFIED = 0
KMS_KEY_ISSUE = 1

name = proto.Field(proto.STRING, number=1,)
description = proto.Field(proto.STRING, number=2,)
Expand Down Expand Up @@ -289,15 +312,16 @@ class State(proto.Enum):
crypto_key_config = proto.Field(
proto.MESSAGE, number=28, message="CryptoKeyConfig",
)
disabled_reason = proto.RepeatedField(proto.ENUM, number=29, enum=DisabledReason,)


class ListInstancesRequest(proto.Message):
r"""Request message for listing Data Fusion instances.
Attributes:
parent (str):
The project and location for which to
retrieve instance information in the format
Required. The project and location for which
to retrieve instance information in the format
projects/{project}/locations/{location}. If the
location is specified as '-' (wildcard), then
all regions available to the project are
Expand Down Expand Up @@ -397,7 +421,8 @@ class GetInstanceRequest(proto.Message):
Attributes:
name (str):
The instance resource name in the format
Required. The instance resource name in the
format
projects/{project}/locations/{location}/instances/{instance}.
"""

Expand All @@ -409,10 +434,11 @@ class CreateInstanceRequest(proto.Message):
Attributes:
parent (str):
The instance's project and location in the
format projects/{project}/locations/{location}.
Required. The instance's project and location
in the format
projects/{project}/locations/{location}.
instance_id (str):
The name of the instance to create.
Required. The name of the instance to create.
instance (google.cloud.data_fusion_v1.types.Instance):
An instance resource.
"""
Expand All @@ -427,23 +453,26 @@ class DeleteInstanceRequest(proto.Message):
Attributes:
name (str):
The instance resource name in the format
Required. The instance resource name in the
format
projects/{project}/locations/{location}/instances/{instance}
"""

name = proto.Field(proto.STRING, number=1,)


class UpdateInstanceRequest(proto.Message):
r"""
r"""Request message for updating a Data Fusion instance.
Data Fusion allows updating the labels, options, and stack
driver settings. This is also used for CDF version upgrade.
Attributes:
instance (google.cloud.data_fusion_v1.types.Instance):
The instance resource that replaces the
resource on the server. Currently, Data Fusion
only allows replacing labels, options, and stack
driver settings. All other fields will be
ignored.
Required. The instance resource that replaces
the resource on the server. Currently, Data
Fusion only allows replacing labels, options,
and stack driver settings. All other fields will
be ignored.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
Field mask is used to specify the fields that the update
will overwrite in an instance resource. The fields specified
Expand All @@ -465,8 +494,8 @@ class RestartInstanceRequest(proto.Message):
Attributes:
name (str):
Name of the Data Fusion instance which need
to be restarted in the form of
Required. Name of the Data Fusion instance
which need to be restarted in the form of
projects/{project}/locations/{location}/instances/{instance}
"""

Expand Down

0 comments on commit 6b38819

Please sign in to comment.