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

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(v1): add relationships (#281)
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 394579113

Committer yuwangyw@

Source-Link: googleapis/googleapis@9c7eb1f

Source-Link: googleapis/googleapis-gen@5934384

feat(v1): Add content type Relationship to support relationship search
  • Loading branch information
gcf-owl-bot[bot] committed Sep 3, 2021
1 parent d6a7dfb commit 038febe
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
4 changes: 4 additions & 0 deletions google/cloud/asset/__init__.py
Expand Up @@ -69,6 +69,8 @@
from google.cloud.asset_v1.types.assets import IamPolicySearchResult
from google.cloud.asset_v1.types.assets import RelatedAsset
from google.cloud.asset_v1.types.assets import RelatedAssets
from google.cloud.asset_v1.types.assets import RelatedResource
from google.cloud.asset_v1.types.assets import RelatedResources
from google.cloud.asset_v1.types.assets import RelationshipAttributes
from google.cloud.asset_v1.types.assets import Resource
from google.cloud.asset_v1.types.assets import ResourceSearchResult
Expand Down Expand Up @@ -125,6 +127,8 @@
"IamPolicySearchResult",
"RelatedAsset",
"RelatedAssets",
"RelatedResource",
"RelatedResources",
"RelationshipAttributes",
"Resource",
"ResourceSearchResult",
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/asset_v1/__init__.py
Expand Up @@ -63,6 +63,8 @@
from .types.assets import IamPolicySearchResult
from .types.assets import RelatedAsset
from .types.assets import RelatedAssets
from .types.assets import RelatedResource
from .types.assets import RelatedResources
from .types.assets import RelationshipAttributes
from .types.assets import Resource
from .types.assets import ResourceSearchResult
Expand Down Expand Up @@ -114,6 +116,8 @@
"PubsubDestination",
"RelatedAsset",
"RelatedAssets",
"RelatedResource",
"RelatedResources",
"RelationshipAttributes",
"Resource",
"ResourceSearchResult",
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/asset_v1/types/__init__.py
Expand Up @@ -62,6 +62,8 @@
IamPolicySearchResult,
RelatedAsset,
RelatedAssets,
RelatedResource,
RelatedResources,
RelationshipAttributes,
Resource,
ResourceSearchResult,
Expand Down Expand Up @@ -117,6 +119,8 @@
"IamPolicySearchResult",
"RelatedAsset",
"RelatedAssets",
"RelatedResource",
"RelatedResources",
"RelationshipAttributes",
"Resource",
"ResourceSearchResult",
Expand Down
40 changes: 40 additions & 0 deletions google/cloud/asset_v1/types/assets.py
Expand Up @@ -39,6 +39,8 @@
"ResourceSearchResult",
"VersionedResource",
"AttachedResource",
"RelatedResources",
"RelatedResource",
"IamPolicySearchResult",
"IamPolicyAnalysisState",
"ConditionEvaluation",
Expand Down Expand Up @@ -575,6 +577,13 @@ class ResourceSearchResult(proto.Message):
attributes of the attached resources are exposed in
``additional_attributes`` field, so as to allow users to
search on them.
relationships (Sequence[google.cloud.asset_v1.types.ResourceSearchResult.RelationshipsEntry]):
A map of related resources of this resource, keyed by the
relationship type. A relationship type is in the format of
{SourceType}*{ACTION}*\ {DestType}. Example:
``DISK_TO_INSTANCE``, ``DISK_TO_NETWORK``,
``INSTANCE_TO_INSTANCEGROUP``. See `supported relationship
types <https://cloud.google.com/asset-inventory/docs/supported-asset-types#supported_relationship_types>`__.
parent_asset_type (str):
The type of this resource's immediate parent, if there is
one.
Expand Down Expand Up @@ -615,6 +624,9 @@ class ResourceSearchResult(proto.Message):
attached_resources = proto.RepeatedField(
proto.MESSAGE, number=20, message="AttachedResource",
)
relationships = proto.MapField(
proto.STRING, proto.MESSAGE, number=21, message="RelatedResources",
)
parent_asset_type = proto.Field(proto.STRING, number=103,)


Expand Down Expand Up @@ -676,6 +688,34 @@ class AttachedResource(proto.Message):
)


class RelatedResources(proto.Message):
r"""The related resources of the primary resource.
Attributes:
related_resources (Sequence[google.cloud.asset_v1.types.RelatedResource]):
The detailed related resources of the primary
resource.
"""

related_resources = proto.RepeatedField(
proto.MESSAGE, number=1, message="RelatedResource",
)


class RelatedResource(proto.Message):
r"""The detailed related resource.
Attributes:
asset_type (str):
The type of the asset. Example:
``compute.googleapis.com/Instance``
full_resource_name (str):
The full resource name of the related resource. Example:
``//compute.googleapis.com/projects/my_proj_123/zones/instance/instance123``
"""

asset_type = proto.Field(proto.STRING, number=1,)
full_resource_name = proto.Field(proto.STRING, number=2,)


class IamPolicySearchResult(proto.Message):
r"""A result of IAM Policy search, containing information of an
IAM policy.
Expand Down

0 comments on commit 038febe

Please sign in to comment.