Skip to content

Commit 6ccf5c2

Browse files
feat: Release of relationships in v1, Add content type Relationship to support relationship export (#537)
Committer: lvv@ PiperOrigin-RevId: 391065985 Source-Link: googleapis/googleapis@b9e69f8 Source-Link: googleapis/googleapis-gen@6d0f250
1 parent 1e017a6 commit 6ccf5c2

6 files changed

Lines changed: 1916 additions & 335 deletions

File tree

packages/google-cloud-asset/protos/google/cloud/asset/v1/asset_service.proto

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,8 @@ service AssetService {
193193
// Represents the metadata of the longrunning operation for the
194194
// AnalyzeIamPolicyLongrunning rpc.
195195
message AnalyzeIamPolicyLongrunningMetadata {
196-
// The time the operation was created.
197-
google.protobuf.Timestamp create_time = 1
198-
[(google.api.field_behavior) = OUTPUT_ONLY];
196+
// Output only. The time the operation was created.
197+
google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
199198
}
200199

201200
// Export asset request.
@@ -244,6 +243,23 @@ message ExportAssetsRequest {
244243

245244
// Required. Output configuration indicating where the results will be output to.
246245
OutputConfig output_config = 5 [(google.api.field_behavior) = REQUIRED];
246+
247+
// A list of relationship types to export, for example:
248+
// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
249+
// content_type=RELATIONSHIP.
250+
// * If specified:
251+
// it snapshots specified relationships. It returns an error if
252+
// any of the [relationship_types] doesn't belong to the supported
253+
// relationship types of the [asset_types] or if any of the [asset_types]
254+
// doesn't belong to the source types of the [relationship_types].
255+
// * Otherwise:
256+
// it snapshots the supported relationships for all [asset_types] or returns
257+
// an error if any of the [asset_types] has no relationship support.
258+
// An unspecified asset types field means all supported asset_types.
259+
// See [Introduction to Cloud Asset
260+
// Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all
261+
// supported asset types and relationship types.
262+
repeated string relationship_types = 6;
247263
}
248264

249265
// The export asset response. This message is returned by the
@@ -316,6 +332,23 @@ message ListAssetsRequest {
316332
// unspecified for the first `ListAssetsRequest`. It is a continuation of a
317333
// prior `ListAssets` call, and the API should return the next page of assets.
318334
string page_token = 6;
335+
336+
// A list of relationship types to output, for example:
337+
// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
338+
// content_type=RELATIONSHIP.
339+
// * If specified:
340+
// it snapshots specified relationships. It returns an error if
341+
// any of the [relationship_types] doesn't belong to the supported
342+
// relationship types of the [asset_types] or if any of the [asset_types]
343+
// doesn't belong to the source types of the [relationship_types].
344+
// * Otherwise:
345+
// it snapshots the supported relationships for all [asset_types] or returns
346+
// an error if any of the [asset_types] has no relationship support.
347+
// An unspecified asset types field means all supported asset_types.
348+
// See [Introduction to Cloud Asset
349+
// Inventory](https://cloud.google.com/asset-inventory/docs/overview)
350+
// for all supported asset types and relationship types.
351+
repeated string relationship_types = 7;
319352
}
320353

321354
// ListAssets response.
@@ -364,6 +397,24 @@ message BatchGetAssetsHistoryRequest {
364397
// returned. The returned results contain all temporal assets whose time
365398
// window overlap with read_time_window.
366399
TimeWindow read_time_window = 4 [(google.api.field_behavior) = OPTIONAL];
400+
401+
// Optional. A list of relationship types to output, for example:
402+
// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
403+
// content_type=RELATIONSHIP.
404+
// * If specified:
405+
// it outputs specified relationships' history on the [asset_names]. It
406+
// returns an error if any of the [relationship_types] doesn't belong to the
407+
// supported relationship types of the [asset_names] or if any of the
408+
// [asset_names]'s types doesn't belong to the source types of the
409+
// [relationship_types].
410+
// * Otherwise:
411+
// it outputs the supported relationships' history on the [asset_names] or
412+
// returns an error if any of the [asset_names]'s types has no relationship
413+
// support.
414+
// See [Introduction to Cloud Asset
415+
// Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all
416+
// supported asset types and relationship types.
417+
repeated string relationship_types = 5 [(google.api.field_behavior) = OPTIONAL];
367418
}
368419

369420
// Batch get assets history response.
@@ -682,6 +733,24 @@ message Feed {
682733
// guide](https://cloud.google.com/asset-inventory/docs/monitoring-asset-changes-with-condition)
683734
// for detailed instructions.
684735
google.type.Expr condition = 6;
736+
737+
// A list of relationship types to output, for example:
738+
// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
739+
// content_type=RELATIONSHIP.
740+
// * If specified:
741+
// it outputs specified relationship updates on the [asset_names] or the
742+
// [asset_types]. It returns an error if any of the [relationship_types]
743+
// doesn't belong to the supported relationship types of the [asset_names] or
744+
// [asset_types], or any of the [asset_names] or the [asset_types] doesn't
745+
// belong to the source types of the [relationship_types].
746+
// * Otherwise:
747+
// it outputs the supported relationships of the types of [asset_names] and
748+
// [asset_types] or returns an error if any of the [asset_names] or the
749+
// [asset_types] has no replationship support.
750+
// See [Introduction to Cloud Asset
751+
// Inventory](https://cloud.google.com/asset-inventory/docs/overview)
752+
// for all supported asset types and relationship types.
753+
repeated string relationship_types = 7;
685754
}
686755

687756
// Search all resources request.
@@ -1353,4 +1422,7 @@ enum ContentType {
13531422

13541423
// The runtime OS Inventory information.
13551424
OS_INVENTORY = 6;
1425+
1426+
// The related resources.
1427+
RELATIONSHIP = 7;
13561428
}

packages/google-cloud-asset/protos/google/cloud/asset/v1/assets.proto

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ import "google/identity/accesscontextmanager/v1/access_level.proto";
2323
import "google/identity/accesscontextmanager/v1/access_policy.proto";
2424
import "google/cloud/osconfig/v1/inventory.proto";
2525
import "google/identity/accesscontextmanager/v1/service_perimeter.proto";
26+
import "google/protobuf/any.proto";
2627
import "google/protobuf/struct.proto";
2728
import "google/protobuf/timestamp.proto";
2829
import "google/rpc/code.proto";
30+
import "google/api/annotations.proto";
2931

3032
option cc_enable_arenas = true;
3133
option csharp_namespace = "Google.Cloud.Asset.V1";
@@ -158,6 +160,10 @@ message Asset {
158160
// for more information.
159161
google.cloud.osconfig.v1.Inventory os_inventory = 12;
160162

163+
// The related assets of the asset of one relationship type.
164+
// One asset only represents one type of relationship.
165+
RelatedAssets related_assets = 13;
166+
161167
// The ancestry path of an asset in Google Cloud [resource
162168
// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
163169
// represented as a list of relative resource names. An ancestry path starts
@@ -219,6 +225,67 @@ message Resource {
219225
string location = 8;
220226
}
221227

228+
// The detailed related assets with the `relationship_type`.
229+
message RelatedAssets {
230+
// The detailed relationship attributes.
231+
RelationshipAttributes relationship_attributes = 1;
232+
233+
// The peer resources of the relationship.
234+
repeated RelatedAsset assets = 2;
235+
}
236+
237+
// The relationship attributes which include `type`, `source_resource_type`,
238+
// `target_resource_type` and `action`.
239+
message RelationshipAttributes {
240+
// The unique identifier of the relationship type. Example:
241+
// `INSTANCE_TO_INSTANCEGROUP`
242+
string type = 4;
243+
244+
// The source asset type. Example: `compute.googleapis.com/Instance`
245+
string source_resource_type = 1;
246+
247+
// The target asset type. Example: `compute.googleapis.com/Disk`
248+
string target_resource_type = 2;
249+
250+
// The detail of the relationship, e.g. `contains`, `attaches`
251+
string action = 3;
252+
}
253+
254+
// An asset identify in Google Cloud which contains its name, type and
255+
// ancestors. An asset can be any resource in the Google Cloud [resource
256+
// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
257+
// a resource outside the Google Cloud resource hierarchy (such as Google
258+
// Kubernetes Engine clusters and objects), or a policy (e.g. Cloud IAM policy).
259+
// See [Supported asset
260+
// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
261+
// for more information.
262+
message RelatedAsset {
263+
// The full name of the asset. Example:
264+
// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`
265+
//
266+
// See [Resource
267+
// names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
268+
// for more information.
269+
string asset = 1 [(google.api.resource_reference) = {
270+
type: "cloudasset.googleapis.com/Asset"
271+
}];
272+
273+
// The type of the asset. Example: `compute.googleapis.com/Disk`
274+
//
275+
// See [Supported asset
276+
// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
277+
// for more information.
278+
string asset_type = 2;
279+
280+
// The ancestors of an asset in Google Cloud [resource
281+
// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
282+
// represented as a list of relative resource names. An ancestry path starts
283+
// with the closest ancestor in the hierarchy and ends at root.
284+
//
285+
// Example: `["projects/123456789", "folders/5432", "organizations/1234"]`
286+
repeated string ancestors = 3;
287+
}
288+
222289
// A result of Resource Search, containing information of a cloud resource.
223290
message ResourceSearchResult {
224291
// The full resource name of this resource. Example:

0 commit comments

Comments
 (0)