Skip to content

Commit

Permalink
feat: Release of relationships in v1, Add content type Relationship t…
Browse files Browse the repository at this point in the history
…o support relationship export (#537)

Committer: lvv@

PiperOrigin-RevId: 391065985

Source-Link: googleapis/googleapis@b9e69f8

Source-Link: googleapis/googleapis-gen@6d0f250
  • Loading branch information
gcf-owl-bot[bot] authored Aug 16, 2021
1 parent 6a669d3 commit ec747d8
Show file tree
Hide file tree
Showing 6 changed files with 1,916 additions and 335 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,8 @@ service AssetService {
// Represents the metadata of the longrunning operation for the
// AnalyzeIamPolicyLongrunning rpc.
message AnalyzeIamPolicyLongrunningMetadata {
// The time the operation was created.
google.protobuf.Timestamp create_time = 1
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The time the operation was created.
google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Export asset request.
Expand Down Expand Up @@ -244,6 +243,23 @@ message ExportAssetsRequest {

// Required. Output configuration indicating where the results will be output to.
OutputConfig output_config = 5 [(google.api.field_behavior) = REQUIRED];

// A list of relationship types to export, for example:
// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
// content_type=RELATIONSHIP.
// * If specified:
// it snapshots specified relationships. It returns an error if
// any of the [relationship_types] doesn't belong to the supported
// relationship types of the [asset_types] or if any of the [asset_types]
// doesn't belong to the source types of the [relationship_types].
// * Otherwise:
// it snapshots the supported relationships for all [asset_types] or returns
// an error if any of the [asset_types] has no relationship support.
// An unspecified asset types field means all supported asset_types.
// See [Introduction to Cloud Asset
// Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all
// supported asset types and relationship types.
repeated string relationship_types = 6;
}

// The export asset response. This message is returned by the
Expand Down Expand Up @@ -316,6 +332,23 @@ message ListAssetsRequest {
// unspecified for the first `ListAssetsRequest`. It is a continuation of a
// prior `ListAssets` call, and the API should return the next page of assets.
string page_token = 6;

// A list of relationship types to output, for example:
// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
// content_type=RELATIONSHIP.
// * If specified:
// it snapshots specified relationships. It returns an error if
// any of the [relationship_types] doesn't belong to the supported
// relationship types of the [asset_types] or if any of the [asset_types]
// doesn't belong to the source types of the [relationship_types].
// * Otherwise:
// it snapshots the supported relationships for all [asset_types] or returns
// an error if any of the [asset_types] has no relationship support.
// An unspecified asset types field means all supported asset_types.
// See [Introduction to Cloud Asset
// Inventory](https://cloud.google.com/asset-inventory/docs/overview)
// for all supported asset types and relationship types.
repeated string relationship_types = 7;
}

// ListAssets response.
Expand Down Expand Up @@ -364,6 +397,24 @@ message BatchGetAssetsHistoryRequest {
// returned. The returned results contain all temporal assets whose time
// window overlap with read_time_window.
TimeWindow read_time_window = 4 [(google.api.field_behavior) = OPTIONAL];

// Optional. A list of relationship types to output, for example:
// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
// content_type=RELATIONSHIP.
// * If specified:
// it outputs specified relationships' history on the [asset_names]. It
// returns an error if any of the [relationship_types] doesn't belong to the
// supported relationship types of the [asset_names] or if any of the
// [asset_names]'s types doesn't belong to the source types of the
// [relationship_types].
// * Otherwise:
// it outputs the supported relationships' history on the [asset_names] or
// returns an error if any of the [asset_names]'s types has no relationship
// support.
// See [Introduction to Cloud Asset
// Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all
// supported asset types and relationship types.
repeated string relationship_types = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Batch get assets history response.
Expand Down Expand Up @@ -682,6 +733,24 @@ message Feed {
// guide](https://cloud.google.com/asset-inventory/docs/monitoring-asset-changes-with-condition)
// for detailed instructions.
google.type.Expr condition = 6;

// A list of relationship types to output, for example:
// `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if
// content_type=RELATIONSHIP.
// * If specified:
// it outputs specified relationship updates on the [asset_names] or the
// [asset_types]. It returns an error if any of the [relationship_types]
// doesn't belong to the supported relationship types of the [asset_names] or
// [asset_types], or any of the [asset_names] or the [asset_types] doesn't
// belong to the source types of the [relationship_types].
// * Otherwise:
// it outputs the supported relationships of the types of [asset_names] and
// [asset_types] or returns an error if any of the [asset_names] or the
// [asset_types] has no replationship support.
// See [Introduction to Cloud Asset
// Inventory](https://cloud.google.com/asset-inventory/docs/overview)
// for all supported asset types and relationship types.
repeated string relationship_types = 7;
}

// Search all resources request.
Expand Down Expand Up @@ -1353,4 +1422,7 @@ enum ContentType {

// The runtime OS Inventory information.
OS_INVENTORY = 6;

// The related resources.
RELATIONSHIP = 7;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ import "google/identity/accesscontextmanager/v1/access_level.proto";
import "google/identity/accesscontextmanager/v1/access_policy.proto";
import "google/cloud/osconfig/v1/inventory.proto";
import "google/identity/accesscontextmanager/v1/service_perimeter.proto";
import "google/protobuf/any.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "google/rpc/code.proto";
import "google/api/annotations.proto";

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

// The related assets of the asset of one relationship type.
// One asset only represents one type of relationship.
RelatedAssets related_assets = 13;

// The ancestry path of an asset in Google Cloud [resource
// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
// represented as a list of relative resource names. An ancestry path starts
Expand Down Expand Up @@ -219,6 +225,67 @@ message Resource {
string location = 8;
}

// The detailed related assets with the `relationship_type`.
message RelatedAssets {
// The detailed relationship attributes.
RelationshipAttributes relationship_attributes = 1;

// The peer resources of the relationship.
repeated RelatedAsset assets = 2;
}

// The relationship attributes which include `type`, `source_resource_type`,
// `target_resource_type` and `action`.
message RelationshipAttributes {
// The unique identifier of the relationship type. Example:
// `INSTANCE_TO_INSTANCEGROUP`
string type = 4;

// The source asset type. Example: `compute.googleapis.com/Instance`
string source_resource_type = 1;

// The target asset type. Example: `compute.googleapis.com/Disk`
string target_resource_type = 2;

// The detail of the relationship, e.g. `contains`, `attaches`
string action = 3;
}

// An asset identify in Google Cloud which contains its name, type and
// ancestors. An asset can be any resource in the Google Cloud [resource
// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
// a resource outside the Google Cloud resource hierarchy (such as Google
// Kubernetes Engine clusters and objects), or a policy (e.g. Cloud IAM policy).
// See [Supported asset
// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
// for more information.
message RelatedAsset {
// The full name of the asset. Example:
// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`
//
// See [Resource
// names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
// for more information.
string asset = 1 [(google.api.resource_reference) = {
type: "cloudasset.googleapis.com/Asset"
}];

// The type of the asset. Example: `compute.googleapis.com/Disk`
//
// See [Supported asset
// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
// for more information.
string asset_type = 2;

// The ancestors of an asset in Google Cloud [resource
// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
// represented as a list of relative resource names. An ancestry path starts
// with the closest ancestor in the hierarchy and ends at root.
//
// Example: `["projects/123456789", "folders/5432", "organizations/1234"]`
repeated string ancestors = 3;
}

// A result of Resource Search, containing information of a cloud resource.
message ResourceSearchResult {
// The full resource name of this resource. Example:
Expand Down
Loading

0 comments on commit ec747d8

Please sign in to comment.