Skip to content

Commit b464b68

Browse files
feat: [google-cloud-asset] A new message ResourceOwners is added (#13838)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: A new message `ResourceOwners` is added feat: A new value `REMOVE_GRANT` is added to enum `MethodType` feat: A new value `GOVERN_TAGS` is added to enum `MethodType` feat: A new message `AssetEnrichment` is added feat: A new field `enrichments` is added to message `.google.cloud.asset.v1.ResourceSearchResult` docs: A comment for field `service_account_impersonation_analysis` in message `.google.cloud.asset.v1.AnalyzeIamPolicyResponse` is changed docs: A comment for field `consolidated_policy` in message `.google.cloud.asset.v1.AnalyzeOrgPoliciesResponse` is changed docs: A comment for field `policy_bundle` in message `.google.cloud.asset.v1.AnalyzeOrgPoliciesResponse` is changed docs: A comment for field `policy_bundle` in message `.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse` is changed docs: A comment for field `policy_bundle` in message `.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse` is changed docs: A comment for field `attached_resource` in message `.google.cloud.asset.v1.EffectiveTagDetails` is changed END_COMMIT_OVERRIDE feat: A new value `REMOVE_GRANT` is added to enum `MethodType` feat: A new value `GOVERN_TAGS` is added to enum `MethodType` feat: A new message `AssetEnrichment` is added feat: A new field `enrichments` is added to message `.google.cloud.asset.v1.ResourceSearchResult` docs: A comment for field `service_account_impersonation_analysis` in message `.google.cloud.asset.v1.AnalyzeIamPolicyResponse` is changed docs: A comment for field `consolidated_policy` in message `.google.cloud.asset.v1.AnalyzeOrgPoliciesResponse` is changed docs: A comment for field `policy_bundle` in message `.google.cloud.asset.v1.AnalyzeOrgPoliciesResponse` is changed docs: A comment for field `policy_bundle` in message `.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse` is changed docs: A comment for field `policy_bundle` in message `.google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse` is changed docs: A comment for field `attached_resource` in message `.google.cloud.asset.v1.EffectiveTagDetails` is changed PiperOrigin-RevId: 750916403 Source-Link: googleapis/googleapis@261895f Source-Link: googleapis/googleapis-gen@023cbda Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFzc2V0Ly5Pd2xCb3QueWFtbCIsImgiOiIwMjNjYmRhZWJjODZlOGMzM2VhZDc4MGY3OGZlMGNiMWRhODlkMWZkIn0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent c5153d1 commit b464b68

File tree

6 files changed

+132
-8
lines changed

6 files changed

+132
-8
lines changed

packages/google-cloud-asset/google/cloud/asset/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
AssetServiceAsyncClient,
2323
)
2424
from google.cloud.asset_v1.services.asset_service.client import AssetServiceClient
25+
from google.cloud.asset_v1.types.asset_enrichment_resourceowners import ResourceOwners
2526
from google.cloud.asset_v1.types.asset_service import (
2627
AnalyzeIamPolicyLongrunningMetadata,
2728
AnalyzeIamPolicyLongrunningRequest,
@@ -87,6 +88,7 @@
8788
)
8889
from google.cloud.asset_v1.types.assets import (
8990
Asset,
91+
AssetEnrichment,
9092
AttachedResource,
9193
ConditionEvaluation,
9294
EffectiveTagDetails,
@@ -109,6 +111,7 @@
109111
__all__ = (
110112
"AssetServiceClient",
111113
"AssetServiceAsyncClient",
114+
"ResourceOwners",
112115
"AnalyzeIamPolicyLongrunningMetadata",
113116
"AnalyzeIamPolicyLongrunningRequest",
114117
"AnalyzeIamPolicyLongrunningResponse",
@@ -171,6 +174,7 @@
171174
"UpdateSavedQueryRequest",
172175
"ContentType",
173176
"Asset",
177+
"AssetEnrichment",
174178
"AttachedResource",
175179
"ConditionEvaluation",
176180
"EffectiveTagDetails",

packages/google-cloud-asset/google/cloud/asset_v1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020

2121
from .services.asset_service import AssetServiceAsyncClient, AssetServiceClient
22+
from .types.asset_enrichment_resourceowners import ResourceOwners
2223
from .types.asset_service import (
2324
AnalyzeIamPolicyLongrunningMetadata,
2425
AnalyzeIamPolicyLongrunningRequest,
@@ -84,6 +85,7 @@
8485
)
8586
from .types.assets import (
8687
Asset,
88+
AssetEnrichment,
8789
AttachedResource,
8890
ConditionEvaluation,
8991
EffectiveTagDetails,
@@ -121,6 +123,7 @@
121123
"AnalyzerOrgPolicy",
122124
"AnalyzerOrgPolicyConstraint",
123125
"Asset",
126+
"AssetEnrichment",
124127
"AssetServiceClient",
125128
"AttachedResource",
126129
"BatchGetAssetsHistoryRequest",
@@ -171,6 +174,7 @@
171174
"RelatedResources",
172175
"RelationshipAttributes",
173176
"Resource",
177+
"ResourceOwners",
174178
"ResourceSearchResult",
175179
"SavedQuery",
176180
"SearchAllIamPoliciesRequest",

packages/google-cloud-asset/google/cloud/asset_v1/types/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
from .asset_enrichment_resourceowners import ResourceOwners
1617
from .asset_service import (
1718
AnalyzeIamPolicyLongrunningMetadata,
1819
AnalyzeIamPolicyLongrunningRequest,
@@ -78,6 +79,7 @@
7879
)
7980
from .assets import (
8081
Asset,
82+
AssetEnrichment,
8183
AttachedResource,
8284
ConditionEvaluation,
8385
EffectiveTagDetails,
@@ -98,6 +100,7 @@
98100
)
99101

100102
__all__ = (
103+
"ResourceOwners",
101104
"AnalyzeIamPolicyLongrunningMetadata",
102105
"AnalyzeIamPolicyLongrunningRequest",
103106
"AnalyzeIamPolicyLongrunningResponse",
@@ -160,6 +163,7 @@
160163
"UpdateSavedQueryRequest",
161164
"ContentType",
162165
"Asset",
166+
"AssetEnrichment",
163167
"AttachedResource",
164168
"ConditionEvaluation",
165169
"EffectiveTagDetails",
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2025 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
from __future__ import annotations
17+
18+
from typing import MutableMapping, MutableSequence
19+
20+
import proto # type: ignore
21+
22+
__protobuf__ = proto.module(
23+
package="google.cloud.asset.v1",
24+
manifest={
25+
"ResourceOwners",
26+
},
27+
)
28+
29+
30+
class ResourceOwners(proto.Message):
31+
r"""The resource owners information.
32+
33+
Attributes:
34+
resource_owners (MutableSequence[str]):
35+
List of resource owners.
36+
"""
37+
38+
resource_owners: MutableSequence[str] = proto.RepeatedField(
39+
proto.STRING,
40+
number=1,
41+
)
42+
43+
44+
__all__ = tuple(sorted(__protobuf__.manifest))

packages/google-cloud-asset/google/cloud/asset_v1/types/asset_service.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ class AnalyzeIamPolicyResponse(proto.Message):
18561856
request.
18571857
service_account_impersonation_analysis (MutableSequence[google.cloud.asset_v1.types.AnalyzeIamPolicyResponse.IamPolicyAnalysis]):
18581858
The service account impersonation analysis if
1859-
[AnalyzeIamPolicyRequest.analyze_service_account_impersonation][]
1859+
[IamPolicyAnalysisQuery.Options.analyze_service_account_impersonation][google.cloud.asset.v1.IamPolicyAnalysisQuery.Options.analyze_service_account_impersonation]
18601860
is enabled.
18611861
fully_explored (bool):
18621862
Represents whether all entries in the
@@ -3448,11 +3448,19 @@ class MethodType(proto.Enum):
34483448
DELETE (3):
34493449
Constraint applied when deleting the
34503450
resource.
3451+
REMOVE_GRANT (4):
3452+
Constraint applied when removing an IAM
3453+
grant.
3454+
GOVERN_TAGS (5):
3455+
Constraint applied when enforcing forced
3456+
tagging.
34513457
"""
34523458
METHOD_TYPE_UNSPECIFIED = 0
34533459
CREATE = 1
34543460
UPDATE = 2
34553461
DELETE = 3
3462+
REMOVE_GRANT = 4
3463+
GOVERN_TAGS = 5
34563464

34573465
class ActionType(proto.Enum):
34583466
r"""Allow or deny type.
@@ -3612,12 +3620,13 @@ class OrgPolicyResult(proto.Message):
36123620
The consolidated organization policy for the analyzed
36133621
resource. The consolidated organization policy is computed
36143622
by merging and evaluating
3615-
[AnalyzeOrgPoliciesResponse.policy_bundle][]. The evaluation
3616-
will respect the organization policy `hierarchy
3623+
[policy_bundle][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.OrgPolicyResult.policy_bundle].
3624+
The evaluation will respect the organization policy
3625+
`hierarchy
36173626
rules <https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy>`__.
36183627
policy_bundle (MutableSequence[google.cloud.asset_v1.types.AnalyzerOrgPolicy]):
36193628
The ordered list of all organization policies from the
3620-
[AnalyzeOrgPoliciesResponse.OrgPolicyResult.consolidated_policy.attached_resource][].
3629+
[consolidated_policy.attached_resource][google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource].
36213630
to the scope specified in the request.
36223631
36233632
If the constraint is defined with default policy, it will
@@ -3790,7 +3799,7 @@ class GovernedContainer(proto.Message):
37903799
rules <https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy>`__.
37913800
policy_bundle (MutableSequence[google.cloud.asset_v1.types.AnalyzerOrgPolicy]):
37923801
The ordered list of all organization policies from the
3793-
[AnalyzeOrgPoliciesResponse.OrgPolicyResult.consolidated_policy.attached_resource][].
3802+
[consolidated_policy.attached_resource][google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource].
37943803
to the scope specified in the request.
37953804
37963805
If the constraint is defined with default policy, it will
@@ -4144,7 +4153,7 @@ class GovernedAsset(proto.Message):
41444153
rules <https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy>`__.
41454154
policy_bundle (MutableSequence[google.cloud.asset_v1.types.AnalyzerOrgPolicy]):
41464155
The ordered list of all organization policies from the
4147-
[AnalyzeOrgPoliciesResponse.OrgPolicyResult.consolidated_policy.attached_resource][]
4156+
[consolidated_policy.attached_resource][google.cloud.asset.v1.AnalyzerOrgPolicy.attached_resource]
41484157
to the scope specified in the request.
41494158
41504159
If the constraint is defined with default policy, it will

packages/google-cloud-asset/google/cloud/asset_v1/types/assets.py

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@
3030
from google.rpc import code_pb2 # type: ignore
3131
import proto # type: ignore
3232

33+
from google.cloud.asset_v1.types import asset_enrichment_resourceowners
34+
3335
__protobuf__ = proto.module(
3436
package="google.cloud.asset.v1",
3537
manifest={
3638
"TemporalAsset",
3739
"TimeWindow",
40+
"AssetEnrichment",
3841
"Asset",
3942
"Resource",
4043
"RelatedAssets",
@@ -147,6 +150,30 @@ class TimeWindow(proto.Message):
147150
)
148151

149152

153+
class AssetEnrichment(proto.Message):
154+
r"""The enhanced metadata information for a resource.
155+
156+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
157+
158+
Attributes:
159+
resource_owners (google.cloud.asset_v1.types.ResourceOwners):
160+
The resource owners for a resource.
161+
162+
Note that this field only contains the members
163+
that have "roles/owner" role in the resource's
164+
IAM Policy.
165+
166+
This field is a member of `oneof`_ ``EnrichmentData``.
167+
"""
168+
169+
resource_owners: asset_enrichment_resourceowners.ResourceOwners = proto.Field(
170+
proto.MESSAGE,
171+
number=7,
172+
oneof="EnrichmentData",
173+
message=asset_enrichment_resourceowners.ResourceOwners,
174+
)
175+
176+
150177
class Asset(proto.Message):
151178
r"""An asset in Google Cloud. An asset can be any resource in the Google
152179
Cloud `resource
@@ -571,8 +598,9 @@ class EffectiveTagDetails(proto.Message):
571598
attached_resource (str):
572599
The `full resource
573600
name <https://cloud.google.com/asset-inventory/docs/resource-name-format>`__
574-
of the ancestor from which an [effective_tag][] is
575-
inherited, according to `tag
601+
of the ancestor from which
602+
[effective_tags][google.cloud.asset.v1.EffectiveTagDetails.effective_tags]
603+
are inherited, according to `tag
576604
inheritance <https://cloud.google.com/resource-manager/docs/tags/tags-overview#inheritance>`__.
577605
578606
This field is a member of `oneof`_ ``_attached_resource``.
@@ -943,6 +971,32 @@ class ResourceSearchResult(proto.Message):
943971
- ``effectiveTagValues:"123456789/env/prod*"``
944972
- ``effectiveTagValues="123456789/env/prod"``
945973
- ``effectiveTagValueIds="tagValues/456"``
974+
enrichments (MutableSequence[google.cloud.asset_v1.types.AssetEnrichment]):
975+
Enrichments of the asset. Currently supported enrichment
976+
types with SearchAllResources API:
977+
978+
- RESOURCE_OWNERS
979+
980+
The corresponding read masks in order to get the enrichment:
981+
982+
- enrichments.resource_owners
983+
984+
The corresponding required permissions:
985+
986+
- cloudasset.assets.searchEnrichmentResourceOwners
987+
988+
Example query to get resource owner enrichment:
989+
990+
::
991+
992+
scope: "projects/my-project"
993+
query: "name: my-project"
994+
assetTypes: "cloudresourcemanager.googleapis.com/Project"
995+
readMask: {
996+
paths: "asset_type"
997+
paths: "name"
998+
paths: "enrichments.resource_owners"
999+
}
9461000
parent_asset_type (str):
9471001
The type of this resource's immediate parent, if there is
9481002
one.
@@ -1077,6 +1131,11 @@ class ResourceSearchResult(proto.Message):
10771131
number=30,
10781132
message="EffectiveTagDetails",
10791133
)
1134+
enrichments: MutableSequence["AssetEnrichment"] = proto.RepeatedField(
1135+
proto.MESSAGE,
1136+
number=31,
1137+
message="AssetEnrichment",
1138+
)
10801139
parent_asset_type: str = proto.Field(
10811140
proto.STRING,
10821141
number=103,

0 commit comments

Comments
 (0)