Skip to content

Commit 76ce4a1

Browse files
authored
fix: add *.proto files to google-cloud-audit-log (#14587)
This PR adds *.proto files to `packages/google-cloud-audit-log` for consistency with what we have in googleapis-common-protos: https://github.com/googleapis/google-cloud-python/tree/main/packages/googleapis-common-protos/google/api
1 parent f3f3e3a commit 76ce4a1

File tree

2 files changed

+1710
-0
lines changed

2 files changed

+1710
-0
lines changed
Lines changed: 376 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,376 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.cloud.audit;
18+
19+
import "google/api/field_behavior.proto";
20+
import "google/protobuf/any.proto";
21+
import "google/protobuf/struct.proto";
22+
import "google/rpc/context/attribute_context.proto";
23+
import "google/rpc/status.proto";
24+
25+
option cc_enable_arenas = true;
26+
option go_package = "google.golang.org/genproto/googleapis/cloud/audit;audit";
27+
option java_multiple_files = true;
28+
option java_outer_classname = "AuditLogProto";
29+
option java_package = "com.google.cloud.audit";
30+
31+
// Common audit log format for Google Cloud Platform API operations.
32+
message AuditLog {
33+
// The name of the API service performing the operation. For example,
34+
// `"compute.googleapis.com"`.
35+
string service_name = 7;
36+
37+
// The name of the service method or operation.
38+
// For API calls, this should be the name of the API method.
39+
// For example,
40+
//
41+
// "google.cloud.bigquery.v2.TableService.InsertTable"
42+
// "google.logging.v2.ConfigServiceV2.CreateSink"
43+
string method_name = 8;
44+
45+
// The resource or collection that is the target of the operation.
46+
// The name is a scheme-less URI, not including the API service name.
47+
// For example:
48+
//
49+
// "projects/PROJECT_ID/zones/us-central1-a/instances"
50+
// "projects/PROJECT_ID/datasets/DATASET_ID"
51+
string resource_name = 11;
52+
53+
// The resource location information.
54+
ResourceLocation resource_location = 20;
55+
56+
// The resource's original state before mutation. Present only for
57+
// operations which have successfully modified the targeted resource(s).
58+
// In general, this field should contain all changed fields, except those
59+
// that are already been included in `request`, `response`, `metadata` or
60+
// `service_data` fields.
61+
// When the JSON object represented here has a proto equivalent,
62+
// the proto name will be indicated in the `@type` property.
63+
google.protobuf.Struct resource_original_state = 19;
64+
65+
// The number of items returned from a List or Query API method,
66+
// if applicable.
67+
int64 num_response_items = 12;
68+
69+
// The status of the overall operation.
70+
google.rpc.Status status = 2;
71+
72+
// Authentication information.
73+
AuthenticationInfo authentication_info = 3;
74+
75+
// Authorization information. If there are multiple
76+
// resources or permissions involved, then there is
77+
// one AuthorizationInfo element for each {resource, permission} tuple.
78+
repeated AuthorizationInfo authorization_info = 9;
79+
80+
// Indicates the policy violations for this request. If the request
81+
// is denied by the policy, violation information will be logged
82+
// here.
83+
PolicyViolationInfo policy_violation_info = 25;
84+
85+
// Metadata about the operation.
86+
RequestMetadata request_metadata = 4;
87+
88+
// The operation request. This may not include all request parameters,
89+
// such as those that are too large, privacy-sensitive, or duplicated
90+
// elsewhere in the log record.
91+
// It should never include user-generated data, such as file contents.
92+
// When the JSON object represented here has a proto equivalent, the proto
93+
// name will be indicated in the `@type` property.
94+
google.protobuf.Struct request = 16;
95+
96+
// The operation response. This may not include all response elements,
97+
// such as those that are too large, privacy-sensitive, or duplicated
98+
// elsewhere in the log record.
99+
// It should never include user-generated data, such as file contents.
100+
// When the JSON object represented here has a proto equivalent, the proto
101+
// name will be indicated in the `@type` property.
102+
google.protobuf.Struct response = 17;
103+
104+
// Other service-specific data about the request, response, and other
105+
// information associated with the current audited event.
106+
google.protobuf.Struct metadata = 18;
107+
108+
// Deprecated. Use the `metadata` field instead.
109+
// Other service-specific data about the request, response, and other
110+
// activities.
111+
google.protobuf.Any service_data = 15 [deprecated = true];
112+
}
113+
114+
// Authentication information for the operation.
115+
message AuthenticationInfo {
116+
// The email address of the authenticated user (or service account on behalf
117+
// of third party principal) making the request. For third party identity
118+
// callers, the `principal_subject` field is populated instead of this field.
119+
// For privacy reasons, the principal email address is sometimes redacted.
120+
// For more information, see [Caller identities in audit
121+
// logs](https://cloud.google.com/logging/docs/audit#user-id).
122+
string principal_email = 1;
123+
124+
// The authority selector specified by the requestor, if any.
125+
// It is not guaranteed that the principal was allowed to use this authority.
126+
string authority_selector = 2;
127+
128+
// The third party identification (if any) of the authenticated user making
129+
// the request.
130+
// When the JSON object represented here has a proto equivalent, the proto
131+
// name will be indicated in the `@type` property.
132+
google.protobuf.Struct third_party_principal = 4;
133+
134+
// The name of the service account key used to create or exchange
135+
// credentials for authenticating the service account making the request.
136+
// This is a scheme-less URI full resource name. For example:
137+
//
138+
// "//iam.googleapis.com/projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}"
139+
string service_account_key_name = 5;
140+
141+
// Identity delegation history of an authenticated service account that makes
142+
// the request. It contains information on the real authorities that try to
143+
// access GCP resources by delegating on a service account. When multiple
144+
// authorities present, they are guaranteed to be sorted based on the original
145+
// ordering of the identity delegation events.
146+
repeated ServiceAccountDelegationInfo service_account_delegation_info = 6;
147+
148+
// String representation of identity of requesting party.
149+
// Populated for both first and third party identities.
150+
string principal_subject = 8;
151+
}
152+
153+
// Authorization information for the operation.
154+
message AuthorizationInfo {
155+
// The list of valid permission types that can be checked.
156+
enum PermissionType {
157+
// Default. Should not be used.
158+
PERMISSION_TYPE_UNSPECIFIED = 0;
159+
160+
// Permissions that gate reading resource configuration or metadata.
161+
ADMIN_READ = 1;
162+
163+
// Permissions that gate modification of resource configuration or metadata.
164+
ADMIN_WRITE = 2;
165+
166+
// Permissions that gate reading user-provided data.
167+
DATA_READ = 3;
168+
169+
// Permissions that gate writing user-provided data.
170+
DATA_WRITE = 4;
171+
}
172+
173+
// The resource being accessed, as a REST-style or cloud resource string.
174+
// For example:
175+
//
176+
// bigquery.googleapis.com/projects/PROJECTID/datasets/DATASETID
177+
// or
178+
// projects/PROJECTID/datasets/DATASETID
179+
string resource = 1;
180+
181+
// The required IAM permission.
182+
string permission = 2;
183+
184+
// Whether or not authorization for `resource` and `permission`
185+
// was granted.
186+
bool granted = 3;
187+
188+
// Resource attributes used in IAM condition evaluation. This field contains
189+
// resource attributes like resource type and resource name.
190+
//
191+
// To get the whole view of the attributes used in IAM
192+
// condition evaluation, the user must also look into
193+
// `AuditLog.request_metadata.request_attributes`.
194+
google.rpc.context.AttributeContext.Resource resource_attributes = 5;
195+
196+
// The type of the permission that was checked. For data access audit logs
197+
// this corresponds with the permission type that must be enabled in the
198+
// project/folder/organization IAM policy in order for the log to be written.
199+
PermissionType permission_type = 7;
200+
}
201+
202+
// Metadata about the request.
203+
message RequestMetadata {
204+
// The IP address of the caller.
205+
// For a caller from the internet, this will be the public IPv4 or IPv6
206+
// address. For calls made from inside Google's internal production network
207+
// from one GCP service to another, `caller_ip` will be redacted to "private".
208+
// For a caller from a Compute Engine VM with a external IP address,
209+
// `caller_ip` will be the VM's external IP address. For a caller from a
210+
// Compute Engine VM without a external IP address, if the VM is in the same
211+
// organization (or project) as the accessed resource, `caller_ip` will be the
212+
// VM's internal IPv4 address, otherwise `caller_ip` will be redacted to
213+
// "gce-internal-ip". See https://cloud.google.com/compute/docs/vpc/ for more
214+
// information.
215+
string caller_ip = 1;
216+
217+
// The user agent of the caller.
218+
// This information is not authenticated and should be treated accordingly.
219+
// For example:
220+
//
221+
// + `google-api-python-client/1.4.0`:
222+
// The request was made by the Google API client for Python.
223+
// + `Cloud SDK Command Line Tool apitools-client/1.0 gcloud/0.9.62`:
224+
// The request was made by the Google Cloud SDK CLI (gcloud).
225+
// + `AppEngine-Google; (+http://code.google.com/appengine; appid:
226+
// s~my-project`:
227+
// The request was made from the `my-project` App Engine app.
228+
string caller_supplied_user_agent = 2;
229+
230+
// The network of the caller.
231+
// Set only if the network host project is part of the same GCP organization
232+
// (or project) as the accessed resource.
233+
// See https://cloud.google.com/compute/docs/vpc/ for more information.
234+
// This is a scheme-less URI full resource name. For example:
235+
//
236+
// "//compute.googleapis.com/projects/PROJECT_ID/global/networks/NETWORK_ID"
237+
string caller_network = 3;
238+
239+
// Request attributes used in IAM condition evaluation. This field contains
240+
// request attributes like request time and access levels associated with
241+
// the request.
242+
//
243+
//
244+
// To get the whole view of the attributes used in IAM
245+
// condition evaluation, the user must also look into
246+
// `AuditLog.authentication_info.resource_attributes`.
247+
google.rpc.context.AttributeContext.Request request_attributes = 7;
248+
249+
// The destination of a network activity, such as accepting a TCP connection.
250+
// In a multi hop network activity, the destination represents the receiver of
251+
// the last hop. Only two fields are used in this message, Peer.port and
252+
// Peer.ip. These fields are optionally populated by those services utilizing
253+
// the IAM condition feature.
254+
google.rpc.context.AttributeContext.Peer destination_attributes = 8;
255+
}
256+
257+
// Location information about a resource.
258+
message ResourceLocation {
259+
// The locations of a resource after the execution of the operation.
260+
// Requests to create or delete a location based resource must populate
261+
// the 'current_locations' field and not the 'original_locations' field.
262+
// For example:
263+
//
264+
// "europe-west1-a"
265+
// "us-east1"
266+
// "nam3"
267+
repeated string current_locations = 1;
268+
269+
// The locations of a resource prior to the execution of the operation.
270+
// Requests that mutate the resource's location must populate both the
271+
// 'original_locations' as well as the 'current_locations' fields.
272+
// For example:
273+
//
274+
// "europe-west1-a"
275+
// "us-east1"
276+
// "nam3"
277+
repeated string original_locations = 2;
278+
}
279+
280+
// Identity delegation history of an authenticated service account.
281+
message ServiceAccountDelegationInfo {
282+
// First party identity principal.
283+
message FirstPartyPrincipal {
284+
// The email address of a Google account.
285+
string principal_email = 1;
286+
287+
// Metadata about the service that uses the service account.
288+
google.protobuf.Struct service_metadata = 2;
289+
}
290+
291+
// Third party identity principal.
292+
message ThirdPartyPrincipal {
293+
// Metadata about third party identity.
294+
google.protobuf.Struct third_party_claims = 1;
295+
}
296+
297+
// A string representing the principal_subject associated with the identity.
298+
// For most identities, the format will be
299+
// `principal://iam.googleapis.com/{identity pool name}/subject/{subject)`
300+
// except for some GKE identities (GKE_WORKLOAD, FREEFORM, GKE_HUB_WORKLOAD)
301+
// that are still in the legacy format `serviceAccount:{identity pool
302+
// name}[{subject}]`
303+
string principal_subject = 3;
304+
305+
// Entity that creates credentials for service account and assumes its
306+
// identity for authentication.
307+
oneof Authority {
308+
// First party (Google) identity as the real authority.
309+
FirstPartyPrincipal first_party_principal = 1;
310+
311+
// Third party identity as the real authority.
312+
ThirdPartyPrincipal third_party_principal = 2;
313+
}
314+
}
315+
316+
// Information related to policy violations for this request.
317+
message PolicyViolationInfo {
318+
// Indicates the orgpolicy violations for this resource.
319+
OrgPolicyViolationInfo org_policy_violation_info = 1;
320+
}
321+
322+
// Represents OrgPolicy Violation information.
323+
message OrgPolicyViolationInfo {
324+
// Optional. Resource payload that is currently in scope and is subjected to orgpolicy
325+
// conditions. This payload may be the subset of the actual Resource that may
326+
// come in the request. This payload should not contain any core content.
327+
google.protobuf.Struct payload = 1 [(google.api.field_behavior) = OPTIONAL];
328+
329+
// Optional. Resource type that the orgpolicy is checked against.
330+
// Example: compute.googleapis.com/Instance, store.googleapis.com/bucket
331+
string resource_type = 2 [(google.api.field_behavior) = OPTIONAL];
332+
333+
// Optional. Tags referenced on the resource at the time of evaluation. These also
334+
// include the federated tags, if they are supplied in the CheckOrgPolicy
335+
// or CheckCustomConstraints Requests.
336+
//
337+
// Optional field as of now. These tags are the Cloud tags that are
338+
// available on the resource during the policy evaluation and will
339+
// be available as part of the OrgPolicy check response for logging purposes.
340+
map<string, string> resource_tags = 3 [(google.api.field_behavior) = OPTIONAL];
341+
342+
// Optional. Policy violations
343+
repeated ViolationInfo violation_info = 4 [(google.api.field_behavior) = OPTIONAL];
344+
}
345+
346+
// Provides information about the Policy violation info for this request.
347+
message ViolationInfo {
348+
// Policy Type enum
349+
enum PolicyType {
350+
// Default value. This value should not be used.
351+
POLICY_TYPE_UNSPECIFIED = 0;
352+
353+
// Indicates boolean policy constraint
354+
BOOLEAN_CONSTRAINT = 1;
355+
356+
// Indicates list policy constraint
357+
LIST_CONSTRAINT = 2;
358+
359+
// Indicates custom policy constraint
360+
CUSTOM_CONSTRAINT = 3;
361+
}
362+
363+
// Optional. Constraint name
364+
string constraint = 1 [(google.api.field_behavior) = OPTIONAL];
365+
366+
// Optional. Error message that policy is indicating.
367+
string error_message = 2 [(google.api.field_behavior) = OPTIONAL];
368+
369+
// Optional. Value that is being checked for the policy.
370+
// This could be in encrypted form (if pii sensitive).
371+
// This field will only be emitted in LIST_POLICY types
372+
string checked_value = 3 [(google.api.field_behavior) = OPTIONAL];
373+
374+
// Optional. Indicates the type of the policy.
375+
PolicyType policy_type = 4 [(google.api.field_behavior) = OPTIONAL];
376+
}

0 commit comments

Comments
 (0)