Skip to content

Commit a8f9295

Browse files
feat: add org policy and access context manager protos (#304)
* feat: add org policy and access context manager protos * fix: add comments in synth.py
1 parent 4352879 commit a8f9295

29 files changed

+18052
-10581
lines changed

packages/google-cloud-asset/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"docs": "jsdoc -c .jsdoc.js",
3636
"docs-test": "linkinator docs",
3737
"fix": "gts fix",
38-
"lint": "gts check",
38+
"lint": "gts fix && eslint --fix samples/*.js",
3939
"predocs-test": "npm run docs",
4040
"prepare": "npm run compile",
4141
"system-test": "c8 mocha build/system-test",

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

+41-40
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC.
1+
// Copyright 2020 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -11,7 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
//
1514

1615
syntax = "proto3";
1716

@@ -26,6 +25,7 @@ import "google/longrunning/operations.proto";
2625
import "google/protobuf/empty.proto";
2726
import "google/protobuf/field_mask.proto";
2827
import "google/protobuf/timestamp.proto";
28+
import "google/type/expr.proto";
2929

3030
option csharp_namespace = "Google.Cloud.Asset.V1";
3131
option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1;asset";
@@ -125,10 +125,10 @@ message ExportAssetsRequest {
125125
];
126126

127127
// Timestamp to take an asset snapshot. This can only be set to a timestamp
128-
// between 2018-10-02 UTC (inclusive) and the current time. If not specified,
129-
// the current time will be used. Due to delays in resource data collection
130-
// and indexing, there is a volatile window during which running the same
131-
// query may get different results.
128+
// between the current time and the current time minus 35 days (inclusive).
129+
// If not specified, the current time will be used. Due to delays in resource
130+
// data collection and indexing, there is a volatile window during which
131+
// running the same query may get different results.
132132
google.protobuf.Timestamp read_time = 2;
133133

134134
// A list of asset types of which to take a snapshot for. For example:
@@ -187,11 +187,11 @@ message BatchGetAssetsHistoryRequest {
187187
ContentType content_type = 3 [(google.api.field_behavior) = OPTIONAL];
188188

189189
// Optional. The time window for the asset history. Both start_time and
190-
// end_time are optional and if set, it must be after 2018-10-02 UTC. If
191-
// end_time is not set, it is default to current timestamp. If start_time is
192-
// not set, the snapshot of the assets at end_time will be returned. The
193-
// returned results contain all temporal assets whose time window overlap with
194-
// read_time_window.
190+
// end_time are optional and if set, it must be after the current time minus
191+
// 35 days. If end_time is not set, it is default to current timestamp.
192+
// If start_time is not set, the snapshot of the assets at end_time will be
193+
// returned. The returned results contain all temporal assets whose time
194+
// window overlap with read_time_window.
195195
TimeWindow read_time_window = 4 [(google.api.field_behavior) = OPTIONAL];
196196
}
197197

@@ -321,7 +321,7 @@ message BigQueryDestination {
321321
// Required. The BigQuery dataset in format
322322
// "projects/projectId/datasets/datasetId", to which the snapshot result
323323
// should be exported. If this dataset does not exist, the export call returns
324-
// an error.
324+
// an INVALID_ARGUMENT error.
325325
string dataset = 1 [(google.api.field_behavior) = REQUIRED];
326326

327327
// Required. The BigQuery table to which the snapshot result should be
@@ -331,41 +331,23 @@ message BigQueryDestination {
331331

332332
// If the destination table already exists and this flag is `TRUE`, the
333333
// table will be overwritten by the contents of assets snapshot. If the flag
334-
// is not set and the destination table already exists, the export call
335-
// returns an error.
334+
// is `FALSE` or unset and the destination table already exists, the export
335+
// call returns an INVALID_ARGUMEMT error.
336336
bool force = 3;
337337
}
338338

339-
// A Cloud Pubsub destination.
339+
// A Pub/Sub destination.
340340
message PubsubDestination {
341-
// The name of the Cloud Pub/Sub topic to publish to.
341+
// The name of the Pub/Sub topic to publish to.
342342
// For example: `projects/PROJECT_ID/topics/TOPIC_ID`.
343343
string topic = 1;
344344
}
345345

346-
// Asset content type.
347-
enum ContentType {
348-
// Unspecified content type.
349-
CONTENT_TYPE_UNSPECIFIED = 0;
350-
351-
// Resource metadata.
352-
RESOURCE = 1;
353-
354-
// The actual IAM policy set on a resource.
355-
IAM_POLICY = 2;
356-
357-
// The Cloud Organization Policy set on an asset.
358-
ORG_POLICY = 4;
359-
360-
// The Cloud Access context mananger Policy set on an asset.
361-
ACCESS_POLICY = 5;
362-
}
363-
364346
// Output configuration for asset feed destination.
365347
message FeedOutputConfig {
366348
// Asset feed destination.
367349
oneof destination {
368-
// Destination on Cloud Pubsub.
350+
// Destination on Pub/Sub.
369351
PubsubDestination pubsub_destination = 1;
370352
}
371353
}
@@ -374,7 +356,7 @@ message FeedOutputConfig {
374356
// An asset feed filter controls what updates are exported.
375357
// The asset feed must be created within a project, organization, or
376358
// folder. Supported destinations are:
377-
// Cloud Pub/Sub topics.
359+
// Pub/Sub topics.
378360
message Feed {
379361
option (google.api.resource) = {
380362
type: "cloudasset.googleapis.com/Feed"
@@ -406,10 +388,11 @@ message Feed {
406388
// A list of types of the assets to receive updates. You must specify either
407389
// or both of asset_names and asset_types. Only asset updates matching
408390
// specified asset_names and asset_types are exported to the feed.
409-
// For example:
410-
// "compute.googleapis.com/Disk" See [Introduction to Cloud Asset
411-
// Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview)
412-
// for all supported asset types.
391+
// For example: `"compute.googleapis.com/Disk"`
392+
//
393+
// See [this
394+
// topic](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
395+
// for a list of all supported asset types.
413396
repeated string asset_types = 3;
414397

415398
// Asset content type. If not specified, no content but the asset name and
@@ -420,3 +403,21 @@ message Feed {
420403
// published to.
421404
FeedOutputConfig feed_output_config = 5 [(google.api.field_behavior) = REQUIRED];
422405
}
406+
407+
// Asset content type.
408+
enum ContentType {
409+
// Unspecified content type.
410+
CONTENT_TYPE_UNSPECIFIED = 0;
411+
412+
// Resource metadata.
413+
RESOURCE = 1;
414+
415+
// The actual IAM policy set on a resource.
416+
IAM_POLICY = 2;
417+
418+
// The Cloud Organization Policy set on an asset.
419+
ORG_POLICY = 4;
420+
421+
// The Cloud Access context mananger Policy set on an asset.
422+
ACCESS_POLICY = 5;
423+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC.
1+
// Copyright 2020 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -11,14 +11,17 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
//
1514

1615
syntax = "proto3";
1716

1817
package google.cloud.asset.v1;
1918

2019
import "google/api/resource.proto";
20+
import "google/cloud/orgpolicy/v1/orgpolicy.proto";
2121
import "google/iam/v1/policy.proto";
22+
import "google/identity/accesscontextmanager/v1/access_level.proto";
23+
import "google/identity/accesscontextmanager/v1/access_policy.proto";
24+
import "google/identity/accesscontextmanager/v1/service_perimeter.proto";
2225
import "google/protobuf/any.proto";
2326
import "google/protobuf/struct.proto";
2427
import "google/protobuf/timestamp.proto";
@@ -32,101 +35,138 @@ option java_outer_classname = "AssetProto";
3235
option java_package = "com.google.cloud.asset.v1";
3336
option php_namespace = "Google\\Cloud\\Asset\\V1";
3437

35-
// Temporal asset. In addition to the asset, the temporal asset includes the
36-
// status of the asset and valid from and to time of it.
38+
// An asset in Google Cloud and its temporal metadata, including the time window
39+
// when it was observed and its status during that window.
3740
message TemporalAsset {
3841
// The time window when the asset data and state was observed.
3942
TimeWindow window = 1;
4043

41-
// If the asset is deleted or not.
44+
// Whether the asset has been deleted or not.
4245
bool deleted = 2;
4346

44-
// Asset.
47+
// An asset in Google Cloud.
4548
Asset asset = 3;
4649
}
4750

48-
// A time window of (start_time, end_time].
51+
// A time window specified by its "start_time" and "end_time".
4952
message TimeWindow {
5053
// Start time of the time window (exclusive).
5154
google.protobuf.Timestamp start_time = 1;
5255

53-
// End time of the time window (inclusive).
54-
// Current timestamp if not specified.
56+
// End time of the time window (inclusive). If not specified, the current
57+
// timestamp is used instead.
5558
google.protobuf.Timestamp end_time = 2;
5659
}
5760

58-
// Cloud asset. This includes all Google Cloud Platform resources,
59-
// Cloud IAM policies, and other non-GCP assets.
61+
// An asset in Google Cloud. An asset can be any resource in the Google Cloud
62+
// [resource
63+
// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
64+
// a resource outside the Google Cloud resource hierarchy (such as Google
65+
// Kubernetes Engine clusters and objects), or a Cloud IAM policy.
6066
message Asset {
6167
option (google.api.resource) = {
6268
type: "cloudasset.googleapis.com/Asset"
6369
pattern: "*"
6470
};
6571

6672
// The full name of the asset. For example:
67-
// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
73+
// "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1"
74+
//
6875
// See [Resource
69-
// Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
76+
// names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
7077
// for more information.
7178
string name = 1;
7279

73-
// Type of the asset. Example: "compute.googleapis.com/Disk".
80+
// The type of the asset. For example: "compute.googleapis.com/Disk"
81+
//
82+
// See [Supported asset
83+
// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
84+
// for more information.
7485
string asset_type = 2;
7586

76-
// Representation of the resource.
87+
// A representation of the resource.
7788
Resource resource = 3;
7889

79-
// Representation of the actual Cloud IAM policy set on a cloud resource. For
80-
// each resource, there must be at most one Cloud IAM policy set on it.
90+
// A representation of the Cloud IAM policy set on a Google Cloud resource.
91+
// There can be a maximum of one Cloud IAM policy set on any given resource.
92+
// In addition, Cloud IAM policies inherit their granted access scope from any
93+
// policies set on parent resources in the resource hierarchy. Therefore, the
94+
// effectively policy is the union of both the policy set on this resource
95+
// and each policy set on all of the resource's ancestry resource levels in
96+
// the hierarchy. See
97+
// [this topic](https://cloud.google.com/iam/docs/policies#inheritance) for
98+
// more information.
8199
google.iam.v1.Policy iam_policy = 4;
82100

83-
// Asset's ancestry path in Cloud Resource Manager (CRM) hierarchy,
84-
// represented as a list of relative resource names. Ancestry path starts with
85-
// the closest CRM ancestor and ends at root. If the asset is a CRM
86-
// project/folder/organization, this starts from the asset itself.
101+
// A representation of an [organization
102+
// policy](https://cloud.google.com/resource-manager/docs/organization-policy/overview#organization_policy).
103+
// There can be more than one organization policy with different constraints
104+
// set on a given resource.
105+
repeated google.cloud.orgpolicy.v1.Policy org_policy = 6;
106+
107+
// A representation of an [access
108+
// policy](https://cloud.google.com/access-context-manager/docs/overview#access-policies).
109+
oneof access_context_policy {
110+
google.identity.accesscontextmanager.v1.AccessPolicy access_policy = 7;
111+
112+
google.identity.accesscontextmanager.v1.AccessLevel access_level = 8;
113+
114+
google.identity.accesscontextmanager.v1.ServicePerimeter service_perimeter = 9;
115+
}
116+
117+
// The ancestry path of an asset in Google Cloud [resource
118+
// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
119+
// represented as a list of relative resource names. An ancestry path starts
120+
// with the closest ancestor in the hierarchy and ends at root. If the asset
121+
// is a project, folder, or organization, the ancestry path starts from the
122+
// asset itself.
87123
//
88-
// Example: ["projects/123456789", "folders/5432", "organizations/1234"]
124+
// For example: `["projects/123456789", "folders/5432", "organizations/1234"]`
89125
repeated string ancestors = 10;
90126
}
91127

92-
// Representation of a cloud resource.
128+
// A representation of a Google Cloud resource.
93129
message Resource {
94-
// The API version. Example: "v1".
130+
// The API version. For example: "v1"
95131
string version = 1;
96132

97133
// The URL of the discovery document containing the resource's JSON schema.
98134
// For example:
99-
// `"https://www.googleapis.com/discovery/v1/apis/compute/v1/rest"`.
100-
// It will be left unspecified for resources without a discovery-based API,
101-
// such as Cloud Bigtable.
135+
// "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest"
136+
//
137+
// This value is unspecified for resources that do not have an API based on a
138+
// discovery document, such as Cloud Bigtable.
102139
string discovery_document_uri = 2;
103140

104-
// The JSON schema name listed in the discovery document.
105-
// Example: "Project". It will be left unspecified for resources (such as
106-
// Cloud Bigtable) without a discovery-based API.
141+
// The JSON schema name listed in the discovery document. For example:
142+
// "Project"
143+
//
144+
// This value is unspecified for resources that do not have an API based on a
145+
// discovery document, such as Cloud Bigtable.
107146
string discovery_name = 3;
108147

109-
// The REST URL for accessing the resource. An HTTP GET operation using this
110-
// URL returns the resource itself.
111-
// Example:
112-
// `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`.
113-
// It will be left unspecified for resources without a REST API.
148+
// The REST URL for accessing the resource. An HTTP `GET` request using this
149+
// URL returns the resource itself. For example:
150+
// "https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123"
151+
//
152+
// This value is unspecified for resources without a REST API.
114153
string resource_url = 4;
115154

116155
// The full name of the immediate parent of this resource. See
117156
// [Resource
118157
// Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
119158
// for more information.
120159
//
121-
// For GCP assets, it is the parent resource defined in the [Cloud IAM policy
160+
// For Google Cloud assets, this value is the parent resource defined in the
161+
// [Cloud IAM policy
122162
// hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy).
123163
// For example:
124-
// `"//cloudresourcemanager.googleapis.com/projects/my_project_123"`.
164+
// "//cloudresourcemanager.googleapis.com/projects/my_project_123"
125165
//
126-
// For third-party assets, it is up to the users to define.
166+
// For third-party assets, this field may be set differently.
127167
string parent = 5;
128168

129-
// The content of the resource, in which some sensitive fields are scrubbed
130-
// away and may not be present.
169+
// The content of the resource, in which some sensitive fields are removed
170+
// and may not be present.
131171
google.protobuf.Struct data = 6;
132172
}

0 commit comments

Comments
 (0)