com.google.cloud.audit.audit_log.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of proto-google-common-protos-lite Show documentation
Show all versions of proto-google-common-protos-lite Show documentation
Protobuf compiler and runtime for Kotlin
// Generated by protokt version 0.12.0. Do not modify.
// Source: google/cloud/audit/audit_log.proto
package com.google.cloud.audit
import com.google.rpc.Status
import com.google.rpc.context.AttributeContext
import com.toasttab.protokt.Any
import com.toasttab.protokt.Struct
import com.toasttab.protokt.rt.Int64
import com.toasttab.protokt.rt.KtDeserializer
import com.toasttab.protokt.rt.KtGeneratedMessage
import com.toasttab.protokt.rt.KtMessage
import com.toasttab.protokt.rt.KtMessageDeserializer
import com.toasttab.protokt.rt.KtMessageSerializer
import com.toasttab.protokt.rt.Tag
import com.toasttab.protokt.rt.UnknownFieldSet
import com.toasttab.protokt.rt.copyList
import com.toasttab.protokt.rt.finishList
import com.toasttab.protokt.rt.sizeof
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Int
import kotlin.Long
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.MutableList
/**
* Common audit log format for Google Cloud Platform API operations.
*/
@KtGeneratedMessage("google.cloud.audit.AuditLog")
@Suppress("DEPRECATION")
class AuditLog private constructor(
/**
* The status of the overall operation.
*/
val status: Status?,
/**
* Authentication information.
*/
val authenticationInfo: AuthenticationInfo?,
/**
* Metadata about the operation.
*/
val requestMetadata: RequestMetadata?,
/**
* The name of the API service performing the operation. For example,
* `"compute.googleapis.com"`.
*/
val serviceName: String,
/**
* The name of the service method or operation. For API calls, this should be the name of the
* API method. For example,
*
* "google.cloud.bigquery.v2.TableService.InsertTable"
* "google.logging.v2.ConfigServiceV2.CreateSink"
*/
val methodName: String,
/**
* Authorization information. If there are multiple resources or permissions involved, then
* there is one AuthorizationInfo element for each {resource, permission} tuple.
*/
val authorizationInfo: List,
/**
* The resource or collection that is the target of the operation. The name is a scheme-less
* URI, not including the API service name. For example:
*
* "projects/PROJECT_ID/zones/us-central1-a/instances"
* "projects/PROJECT_ID/datasets/DATASET_ID"
*/
val resourceName: String,
/**
* The number of items returned from a List or Query API method, if applicable.
*/
val numResponseItems: Long,
/**
* Deprecated. Use the `metadata` field instead. Other service-specific data about the request,
* response, and other activities.
*/
@Deprecated("deprecated in proto")
val serviceData: Any?,
/**
* The operation request. This may not include all request parameters, such as those that are
* too large, privacy-sensitive, or duplicated elsewhere in the log record. It should never include
* user-generated data, such as file contents. When the JSON object represented here has a proto
* equivalent, the proto name will be indicated in the `@type` property.
*/
val request: Struct?,
/**
* The operation response. This may not include all response elements, such as those that are
* too large, privacy-sensitive, or duplicated elsewhere in the log record. It should never include
* user-generated data, such as file contents. When the JSON object represented here has a proto
* equivalent, the proto name will be indicated in the `@type` property.
*/
val response: Struct?,
/**
* Other service-specific data about the request, response, and other information associated
* with the current audited event.
*/
val metadata: Struct?,
/**
* The resource's original state before mutation. Present only for operations which have
* successfully modified the targeted resource(s). In general, this field should contain all
* changed fields, except those that are already been included in `request`, `response`, `metadata`
* or `service_data` fields. When the JSON object represented here has a proto equivalent, the
* proto name will be indicated in the `@type` property.
*/
val resourceOriginalState: Struct?,
/**
* The resource location information.
*/
val resourceLocation: ResourceLocation?,
val unknownFields: UnknownFieldSet = UnknownFieldSet.empty(),
) : KtMessage {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (status != null) {
result += sizeof(Tag(2)) + sizeof(status)
}
if (authenticationInfo != null) {
result += sizeof(Tag(3)) + sizeof(authenticationInfo)
}
if (requestMetadata != null) {
result += sizeof(Tag(4)) + sizeof(requestMetadata)
}
if (serviceName.isNotEmpty()) {
result += sizeof(Tag(7)) + sizeof(serviceName)
}
if (methodName.isNotEmpty()) {
result += sizeof(Tag(8)) + sizeof(methodName)
}
if (authorizationInfo.isNotEmpty()) {
result += (sizeof(Tag(9)) * authorizationInfo.size) + authorizationInfo.sumOf {
sizeof(it) }
}
if (resourceName.isNotEmpty()) {
result += sizeof(Tag(11)) + sizeof(resourceName)
}
if (numResponseItems != 0L) {
result += sizeof(Tag(12)) + sizeof(Int64(numResponseItems))
}
if (serviceData != null) {
result += sizeof(Tag(15)) + sizeof(serviceData)
}
if (request != null) {
result += sizeof(Tag(16)) + sizeof(request)
}
if (response != null) {
result += sizeof(Tag(17)) + sizeof(response)
}
if (metadata != null) {
result += sizeof(Tag(18)) + sizeof(metadata)
}
if (resourceOriginalState != null) {
result += sizeof(Tag(19)) + sizeof(resourceOriginalState)
}
if (resourceLocation != null) {
result += sizeof(Tag(20)) + sizeof(resourceLocation)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (status != null) {
serializer.write(Tag(18)).write(status)
}
if (authenticationInfo != null) {
serializer.write(Tag(26)).write(authenticationInfo)
}
if (requestMetadata != null) {
serializer.write(Tag(34)).write(requestMetadata)
}
if (serviceName.isNotEmpty()) {
serializer.write(Tag(58)).write(serviceName)
}
if (methodName.isNotEmpty()) {
serializer.write(Tag(66)).write(methodName)
}
if (authorizationInfo.isNotEmpty()) {
authorizationInfo.forEach { serializer.write(Tag(74)).write(it) }
}
if (resourceName.isNotEmpty()) {
serializer.write(Tag(90)).write(resourceName)
}
if (numResponseItems != 0L) {
serializer.write(Tag(96)).write(Int64(numResponseItems))
}
if (serviceData != null) {
serializer.write(Tag(122)).write(serviceData)
}
if (request != null) {
serializer.write(Tag(130)).write(request)
}
if (response != null) {
serializer.write(Tag(138)).write(response)
}
if (metadata != null) {
serializer.write(Tag(146)).write(metadata)
}
if (resourceOriginalState != null) {
serializer.write(Tag(154)).write(resourceOriginalState)
}
if (resourceLocation != null) {
serializer.write(Tag(162)).write(resourceLocation)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: kotlin.Any?): Boolean = other is AuditLog &&
other.status == status &&
other.authenticationInfo == authenticationInfo &&
other.requestMetadata == requestMetadata &&
other.serviceName == serviceName &&
other.methodName == methodName &&
other.authorizationInfo == authorizationInfo &&
other.resourceName == resourceName &&
other.numResponseItems == numResponseItems &&
other.serviceData == serviceData &&
other.request == request &&
other.response == response &&
other.metadata == metadata &&
other.resourceOriginalState == resourceOriginalState &&
other.resourceLocation == resourceLocation &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + status.hashCode()
result = 31 * result + authenticationInfo.hashCode()
result = 31 * result + requestMetadata.hashCode()
result = 31 * result + serviceName.hashCode()
result = 31 * result + methodName.hashCode()
result = 31 * result + authorizationInfo.hashCode()
result = 31 * result + resourceName.hashCode()
result = 31 * result + numResponseItems.hashCode()
result = 31 * result + serviceData.hashCode()
result = 31 * result + request.hashCode()
result = 31 * result + response.hashCode()
result = 31 * result + metadata.hashCode()
result = 31 * result + resourceOriginalState.hashCode()
result = 31 * result + resourceLocation.hashCode()
return result
}
override fun toString(): String = "AuditLog(" +
"status=$status, " +
"authenticationInfo=$authenticationInfo, " +
"requestMetadata=$requestMetadata, " +
"serviceName=$serviceName, " +
"methodName=$methodName, " +
"authorizationInfo=$authorizationInfo, " +
"resourceName=$resourceName, " +
"numResponseItems=$numResponseItems, " +
"serviceData=$serviceData, " +
"request=$request, " +
"response=$response, " +
"metadata=$metadata, " +
"resourceOriginalState=$resourceOriginalState, " +
"resourceLocation=$resourceLocation" +
"${if (unknownFields.isEmpty()) "" else ", unknownFields=$unknownFields"})"
fun copy(dsl: AuditLogDsl.() -> Unit): AuditLog = AuditLog.Deserializer {
status = [email protected]
authenticationInfo = [email protected]
requestMetadata = [email protected]
serviceName = [email protected]
methodName = [email protected]
authorizationInfo = [email protected]
resourceName = [email protected]
numResponseItems = [email protected]
serviceData = [email protected]
request = [email protected]
response = [email protected]
metadata = [email protected]
resourceOriginalState = [email protected]
resourceLocation = [email protected]
unknownFields = [email protected]
dsl()
}
class AuditLogDsl {
var status: Status? = null
var authenticationInfo: AuthenticationInfo? = null
var requestMetadata: RequestMetadata? = null
var serviceName: String = ""
var methodName: String = ""
var authorizationInfo: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
var resourceName: String = ""
var numResponseItems: Long = 0L
@Deprecated("deprecated in proto")
var serviceData: Any? = null
var request: Struct? = null
var response: Struct? = null
var metadata: Struct? = null
var resourceOriginalState: Struct? = null
var resourceLocation: ResourceLocation? = null
var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
fun build(): AuditLog = AuditLog(status,
authenticationInfo,
requestMetadata,
serviceName,
methodName,
finishList(authorizationInfo),
resourceName,
numResponseItems,
serviceData,
request,
response,
metadata,
resourceOriginalState,
resourceLocation,
unknownFields)
}
companion object Deserializer : KtDeserializer,
(AuditLogDsl.() -> Unit) -> AuditLog {
override fun deserialize(deserializer: KtMessageDeserializer): AuditLog {
var status : Status? = null
var authenticationInfo : AuthenticationInfo? = null
var requestMetadata : RequestMetadata? = null
var serviceName = ""
var methodName = ""
var authorizationInfo : MutableList? = null
var resourceName = ""
var numResponseItems = 0L
var serviceData : Any? = null
var request : Struct? = null
var response : Struct? = null
var metadata : Struct? = null
var resourceOriginalState : Struct? = null
var resourceLocation : ResourceLocation? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when(deserializer.readTag()) {
0 -> return AuditLog(status,
authenticationInfo,
requestMetadata,
serviceName,
methodName,
finishList(authorizationInfo),
resourceName,
numResponseItems,
serviceData,
request,
response,
metadata,
resourceOriginalState,
resourceLocation,
UnknownFieldSet.from(unknownFields))
18 -> status = deserializer.readMessage(com.google.rpc.Status)
26 -> authenticationInfo =
deserializer.readMessage(com.google.cloud.audit.AuthenticationInfo)
34 -> requestMetadata =
deserializer.readMessage(com.google.cloud.audit.RequestMetadata)
58 -> serviceName = deserializer.readString()
66 -> methodName = deserializer.readString()
74 -> authorizationInfo = (authorizationInfo ?: mutableListOf()).apply {
deserializer.readRepeated(false) {
add(deserializer.readMessage(com.google.cloud.audit.AuthorizationInfo))
}
}
90 -> resourceName = deserializer.readString()
96 -> numResponseItems = deserializer.readInt64()
122 -> serviceData = deserializer.readMessage(com.toasttab.protokt.Any)
130 -> request = deserializer.readMessage(com.toasttab.protokt.Struct)
138 -> response = deserializer.readMessage(com.toasttab.protokt.Struct)
146 -> metadata = deserializer.readMessage(com.toasttab.protokt.Struct)
154 -> resourceOriginalState =
deserializer.readMessage(com.toasttab.protokt.Struct)
162 -> resourceLocation =
deserializer.readMessage(com.google.cloud.audit.ResourceLocation)
else -> unknownFields = (unknownFields ?:
UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
}
}
}
override fun invoke(dsl: AuditLogDsl.() -> Unit): AuditLog =
AuditLogDsl().apply(dsl).build()
}
}
/**
* Authentication information for the operation.
*/
@KtGeneratedMessage("google.cloud.audit.AuthenticationInfo")
class AuthenticationInfo private constructor(
/**
* The email address of the authenticated user (or service account on behalf of third party
* principal) making the request. For third party identity callers, the `principal_subject` field
* is populated instead of this field. For privacy reasons, the principal email address is
* sometimes redacted. For more information, see
* https://cloud.google.com/logging/docs/audit#user-id.
*/
val principalEmail: String,
/**
* The authority selector specified by the requestor, if any. It is not guaranteed that the
* principal was allowed to use this authority.
*/
val authoritySelector: String,
/**
* The third party identification (if any) of the authenticated user making the request. When
* the JSON object represented here has a proto equivalent, the proto name will be indicated in the
* `@type` property.
*/
val thirdPartyPrincipal: Struct?,
/**
* The name of the service account key used to create or exchange credentials for authenticating
* the service account making the request. This is a scheme-less URI full resource name. For
* example:
*
* "//iam.googleapis.com/projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}"
*/
val serviceAccountKeyName: String,
/**
* Identity delegation history of an authenticated service account that makes the request. It
* contains information on the real authorities that try to access GCP resources by delegating on a
* service account. When multiple authorities present, they are guaranteed to be sorted based on
* the original ordering of the identity delegation events.
*/
val serviceAccountDelegationInfo: List,
/**
* String representation of identity of requesting party. Populated for both first and third
* party identities.
*/
val principalSubject: String,
val unknownFields: UnknownFieldSet = UnknownFieldSet.empty(),
) : KtMessage {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (principalEmail.isNotEmpty()) {
result += sizeof(Tag(1)) + sizeof(principalEmail)
}
if (authoritySelector.isNotEmpty()) {
result += sizeof(Tag(2)) + sizeof(authoritySelector)
}
if (thirdPartyPrincipal != null) {
result += sizeof(Tag(4)) + sizeof(thirdPartyPrincipal)
}
if (serviceAccountKeyName.isNotEmpty()) {
result += sizeof(Tag(5)) + sizeof(serviceAccountKeyName)
}
if (serviceAccountDelegationInfo.isNotEmpty()) {
result += (sizeof(Tag(6)) * serviceAccountDelegationInfo.size) +
serviceAccountDelegationInfo.sumOf { sizeof(it) }
}
if (principalSubject.isNotEmpty()) {
result += sizeof(Tag(8)) + sizeof(principalSubject)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (principalEmail.isNotEmpty()) {
serializer.write(Tag(10)).write(principalEmail)
}
if (authoritySelector.isNotEmpty()) {
serializer.write(Tag(18)).write(authoritySelector)
}
if (thirdPartyPrincipal != null) {
serializer.write(Tag(34)).write(thirdPartyPrincipal)
}
if (serviceAccountKeyName.isNotEmpty()) {
serializer.write(Tag(42)).write(serviceAccountKeyName)
}
if (serviceAccountDelegationInfo.isNotEmpty()) {
serviceAccountDelegationInfo.forEach { serializer.write(Tag(50)).write(it) }
}
if (principalSubject.isNotEmpty()) {
serializer.write(Tag(66)).write(principalSubject)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: kotlin.Any?): Boolean = other is AuthenticationInfo &&
other.principalEmail == principalEmail &&
other.authoritySelector == authoritySelector &&
other.thirdPartyPrincipal == thirdPartyPrincipal &&
other.serviceAccountKeyName == serviceAccountKeyName &&
other.serviceAccountDelegationInfo == serviceAccountDelegationInfo &&
other.principalSubject == principalSubject &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + principalEmail.hashCode()
result = 31 * result + authoritySelector.hashCode()
result = 31 * result + thirdPartyPrincipal.hashCode()
result = 31 * result + serviceAccountKeyName.hashCode()
result = 31 * result + serviceAccountDelegationInfo.hashCode()
result = 31 * result + principalSubject.hashCode()
return result
}
override fun toString(): String = "AuthenticationInfo(" +
"principalEmail=$principalEmail, " +
"authoritySelector=$authoritySelector, " +
"thirdPartyPrincipal=$thirdPartyPrincipal, " +
"serviceAccountKeyName=$serviceAccountKeyName, " +
"serviceAccountDelegationInfo=$serviceAccountDelegationInfo, " +
"principalSubject=$principalSubject" +
"${if (unknownFields.isEmpty()) "" else ", unknownFields=$unknownFields"})"
fun copy(dsl: AuthenticationInfoDsl.() -> Unit): AuthenticationInfo =
AuthenticationInfo.Deserializer {
principalEmail = [email protected]
authoritySelector = [email protected]
thirdPartyPrincipal = [email protected]
serviceAccountKeyName = [email protected]
serviceAccountDelegationInfo = [email protected]
principalSubject = [email protected]
unknownFields = [email protected]
dsl()
}
class AuthenticationInfoDsl {
var principalEmail: String = ""
var authoritySelector: String = ""
var thirdPartyPrincipal: Struct? = null
var serviceAccountKeyName: String = ""
var serviceAccountDelegationInfo: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
var principalSubject: String = ""
var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
fun build(): AuthenticationInfo = AuthenticationInfo(principalEmail,
authoritySelector,
thirdPartyPrincipal,
serviceAccountKeyName,
finishList(serviceAccountDelegationInfo),
principalSubject,
unknownFields)
}
companion object Deserializer : KtDeserializer,
(AuthenticationInfoDsl.() -> Unit) -> AuthenticationInfo {
override fun deserialize(deserializer: KtMessageDeserializer): AuthenticationInfo {
var principalEmail = ""
var authoritySelector = ""
var thirdPartyPrincipal : Struct? = null
var serviceAccountKeyName = ""
var serviceAccountDelegationInfo : MutableList? = null
var principalSubject = ""
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when(deserializer.readTag()) {
0 -> return AuthenticationInfo(principalEmail,
authoritySelector,
thirdPartyPrincipal,
serviceAccountKeyName,
finishList(serviceAccountDelegationInfo),
principalSubject,
UnknownFieldSet.from(unknownFields))
10 -> principalEmail = deserializer.readString()
18 -> authoritySelector = deserializer.readString()
34 -> thirdPartyPrincipal =
deserializer.readMessage(com.toasttab.protokt.Struct)
42 -> serviceAccountKeyName = deserializer.readString()
50 -> serviceAccountDelegationInfo = (serviceAccountDelegationInfo ?:
mutableListOf()).apply {
deserializer.readRepeated(false) {
add(deserializer.readMessage(com.google.cloud.audit.ServiceAccountDelegationInfo))
}
}
66 -> principalSubject = deserializer.readString()
else -> unknownFields = (unknownFields ?:
UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
}
}
}
override fun invoke(dsl: AuthenticationInfoDsl.() -> Unit): AuthenticationInfo =
AuthenticationInfoDsl().apply(dsl).build()
}
}
/**
* Authorization information for the operation.
*/
@KtGeneratedMessage("google.cloud.audit.AuthorizationInfo")
class AuthorizationInfo private constructor(
/**
* The resource being accessed, as a REST-style or cloud resource string. For example:
*
* bigquery.googleapis.com/projects/PROJECTID/datasets/DATASETID or
* projects/PROJECTID/datasets/DATASETID
*/
val resource: String,
/**
* The required IAM permission.
*/
val permission: String,
/**
* Whether or not authorization for `resource` and `permission` was granted.
*/
val granted: Boolean,
/**
* Resource attributes used in IAM condition evaluation. This field contains resource attributes
* like resource type and resource name.
*
* To get the whole view of the attributes used in IAM condition evaluation, the user must also
* look into `AuditLog.request_metadata.request_attributes`.
*/
val resourceAttributes: AttributeContext.Resource?,
val unknownFields: UnknownFieldSet = UnknownFieldSet.empty(),
) : KtMessage {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (resource.isNotEmpty()) {
result += sizeof(Tag(1)) + sizeof(resource)
}
if (permission.isNotEmpty()) {
result += sizeof(Tag(2)) + sizeof(permission)
}
if (granted) {
result += sizeof(Tag(3)) + sizeof(granted)
}
if (resourceAttributes != null) {
result += sizeof(Tag(5)) + sizeof(resourceAttributes)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (resource.isNotEmpty()) {
serializer.write(Tag(10)).write(resource)
}
if (permission.isNotEmpty()) {
serializer.write(Tag(18)).write(permission)
}
if (granted) {
serializer.write(Tag(24)).write(granted)
}
if (resourceAttributes != null) {
serializer.write(Tag(42)).write(resourceAttributes)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: kotlin.Any?): Boolean = other is AuthorizationInfo &&
other.resource == resource &&
other.permission == permission &&
other.granted == granted &&
other.resourceAttributes == resourceAttributes &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + resource.hashCode()
result = 31 * result + permission.hashCode()
result = 31 * result + granted.hashCode()
result = 31 * result + resourceAttributes.hashCode()
return result
}
override fun toString(): String = "AuthorizationInfo(" +
"resource=$resource, " +
"permission=$permission, " +
"granted=$granted, " +
"resourceAttributes=$resourceAttributes" +
"${if (unknownFields.isEmpty()) "" else ", unknownFields=$unknownFields"})"
fun copy(dsl: AuthorizationInfoDsl.() -> Unit): AuthorizationInfo =
AuthorizationInfo.Deserializer {
resource = [email protected]
permission = [email protected]
granted = [email protected]
resourceAttributes = [email protected]
unknownFields = [email protected]
dsl()
}
class AuthorizationInfoDsl {
var resource: String = ""
var permission: String = ""
var granted: Boolean = false
var resourceAttributes: AttributeContext.Resource? = null
var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
fun build(): AuthorizationInfo = AuthorizationInfo(resource,
permission,
granted,
resourceAttributes,
unknownFields)
}
companion object Deserializer : KtDeserializer,
(AuthorizationInfoDsl.() -> Unit) -> AuthorizationInfo {
override fun deserialize(deserializer: KtMessageDeserializer): AuthorizationInfo {
var resource = ""
var permission = ""
var granted = false
var resourceAttributes : AttributeContext.Resource? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when(deserializer.readTag()) {
0 -> return AuthorizationInfo(resource,
permission,
granted,
resourceAttributes,
UnknownFieldSet.from(unknownFields))
10 -> resource = deserializer.readString()
18 -> permission = deserializer.readString()
24 -> granted = deserializer.readBool()
42 -> resourceAttributes =
deserializer.readMessage(com.google.rpc.context.AttributeContext.Resource)
else -> unknownFields = (unknownFields ?:
UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
}
}
}
override fun invoke(dsl: AuthorizationInfoDsl.() -> Unit): AuthorizationInfo =
AuthorizationInfoDsl().apply(dsl).build()
}
}
/**
* Metadata about the request.
*/
@KtGeneratedMessage("google.cloud.audit.RequestMetadata")
class RequestMetadata private constructor(
/**
* The IP address of the caller. For caller from internet, this will be public IPv4 or IPv6
* address. For caller from a Compute Engine VM with external IP address, this will be the VM's
* external IP address. For caller from a Compute Engine VM without external IP address, if the VM
* is in the same organization (or project) as the accessed resource, `caller_ip` will be the VM's
* internal IPv4 address, otherwise the `caller_ip` will be redacted to "gce-internal-ip". See
* https://cloud.google.com/compute/docs/vpc/ for more information.
*/
val callerIp: String,
/**
* The user agent of the caller. This information is not authenticated and should be treated
* accordingly. For example:
*
* + `google-api-python-client/1.4.0`: The request was made by the Google API client for
* Python. + `Cloud SDK Command Line Tool apitools-client/1.0 gcloud/0.9.62`: The request was
* made by the Google Cloud SDK CLI (gcloud). + `AppEngine-Google;
* (+http://code.google.com/appengine; appid: s~my-project`: The request was made from the
* `my-project` App Engine app.
*/
val callerSuppliedUserAgent: String,
/**
* The network of the caller. Set only if the network host project is part of the same GCP
* organization (or project) as the accessed resource. See
* https://cloud.google.com/compute/docs/vpc/ for more information. This is a scheme-less URI full
* resource name. For example:
*
* "//compute.googleapis.com/projects/PROJECT_ID/global/networks/NETWORK_ID"
*/
val callerNetwork: String,
/**
* Request attributes used in IAM condition evaluation. This field contains request attributes
* like request time and access levels associated with the request.
*
*
*
* To get the whole view of the attributes used in IAM condition evaluation, the user must also
* look into `AuditLog.authentication_info.resource_attributes`.
*/
val requestAttributes: AttributeContext.Request?,
/**
* The destination of a network activity, such as accepting a TCP connection. In a multi hop
* network activity, the destination represents the receiver of the last hop. Only two fields are
* used in this message, Peer.port and Peer.ip. These fields are optionally populated by those
* services utilizing the IAM condition feature.
*/
val destinationAttributes: AttributeContext.Peer?,
val unknownFields: UnknownFieldSet = UnknownFieldSet.empty(),
) : KtMessage {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (callerIp.isNotEmpty()) {
result += sizeof(Tag(1)) + sizeof(callerIp)
}
if (callerSuppliedUserAgent.isNotEmpty()) {
result += sizeof(Tag(2)) + sizeof(callerSuppliedUserAgent)
}
if (callerNetwork.isNotEmpty()) {
result += sizeof(Tag(3)) + sizeof(callerNetwork)
}
if (requestAttributes != null) {
result += sizeof(Tag(7)) + sizeof(requestAttributes)
}
if (destinationAttributes != null) {
result += sizeof(Tag(8)) + sizeof(destinationAttributes)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (callerIp.isNotEmpty()) {
serializer.write(Tag(10)).write(callerIp)
}
if (callerSuppliedUserAgent.isNotEmpty()) {
serializer.write(Tag(18)).write(callerSuppliedUserAgent)
}
if (callerNetwork.isNotEmpty()) {
serializer.write(Tag(26)).write(callerNetwork)
}
if (requestAttributes != null) {
serializer.write(Tag(58)).write(requestAttributes)
}
if (destinationAttributes != null) {
serializer.write(Tag(66)).write(destinationAttributes)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: kotlin.Any?): Boolean = other is RequestMetadata &&
other.callerIp == callerIp &&
other.callerSuppliedUserAgent == callerSuppliedUserAgent &&
other.callerNetwork == callerNetwork &&
other.requestAttributes == requestAttributes &&
other.destinationAttributes == destinationAttributes &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + callerIp.hashCode()
result = 31 * result + callerSuppliedUserAgent.hashCode()
result = 31 * result + callerNetwork.hashCode()
result = 31 * result + requestAttributes.hashCode()
result = 31 * result + destinationAttributes.hashCode()
return result
}
override fun toString(): String = "RequestMetadata(" +
"callerIp=$callerIp, " +
"callerSuppliedUserAgent=$callerSuppliedUserAgent, " +
"callerNetwork=$callerNetwork, " +
"requestAttributes=$requestAttributes, " +
"destinationAttributes=$destinationAttributes" +
"${if (unknownFields.isEmpty()) "" else ", unknownFields=$unknownFields"})"
fun copy(dsl: RequestMetadataDsl.() -> Unit): RequestMetadata =
RequestMetadata.Deserializer {
callerIp = [email protected]
callerSuppliedUserAgent = [email protected]
callerNetwork = [email protected]
requestAttributes = [email protected]
destinationAttributes = [email protected]
unknownFields = [email protected]
dsl()
}
class RequestMetadataDsl {
var callerIp: String = ""
var callerSuppliedUserAgent: String = ""
var callerNetwork: String = ""
var requestAttributes: AttributeContext.Request? = null
var destinationAttributes: AttributeContext.Peer? = null
var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
fun build(): RequestMetadata = RequestMetadata(callerIp,
callerSuppliedUserAgent,
callerNetwork,
requestAttributes,
destinationAttributes,
unknownFields)
}
companion object Deserializer : KtDeserializer,
(RequestMetadataDsl.() -> Unit) -> RequestMetadata {
override fun deserialize(deserializer: KtMessageDeserializer): RequestMetadata {
var callerIp = ""
var callerSuppliedUserAgent = ""
var callerNetwork = ""
var requestAttributes : AttributeContext.Request? = null
var destinationAttributes : AttributeContext.Peer? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when(deserializer.readTag()) {
0 -> return RequestMetadata(callerIp,
callerSuppliedUserAgent,
callerNetwork,
requestAttributes,
destinationAttributes,
UnknownFieldSet.from(unknownFields))
10 -> callerIp = deserializer.readString()
18 -> callerSuppliedUserAgent = deserializer.readString()
26 -> callerNetwork = deserializer.readString()
58 -> requestAttributes =
deserializer.readMessage(com.google.rpc.context.AttributeContext.Request)
66 -> destinationAttributes =
deserializer.readMessage(com.google.rpc.context.AttributeContext.Peer)
else -> unknownFields = (unknownFields ?:
UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
}
}
}
override fun invoke(dsl: RequestMetadataDsl.() -> Unit): RequestMetadata =
RequestMetadataDsl().apply(dsl).build()
}
}
/**
* Location information about a resource.
*/
@KtGeneratedMessage("google.cloud.audit.ResourceLocation")
class ResourceLocation private constructor(
/**
* The locations of a resource after the execution of the operation. Requests to create or
* delete a location based resource must populate the 'current_locations' field and not the
* 'original_locations' field. For example:
*
* "europe-west1-a" "us-east1" "nam3"
*/
val currentLocations: List,
/**
* The locations of a resource prior to the execution of the operation. Requests that mutate the
* resource's location must populate both the 'original_locations' as well as the
* 'current_locations' fields. For example:
*
* "europe-west1-a" "us-east1" "nam3"
*/
val originalLocations: List,
val unknownFields: UnknownFieldSet = UnknownFieldSet.empty(),
) : KtMessage {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (currentLocations.isNotEmpty()) {
result += (sizeof(Tag(1)) * currentLocations.size) + currentLocations.sumOf { sizeof(it)
}
}
if (originalLocations.isNotEmpty()) {
result += (sizeof(Tag(2)) * originalLocations.size) + originalLocations.sumOf {
sizeof(it) }
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (currentLocations.isNotEmpty()) {
currentLocations.forEach { serializer.write(Tag(10)).write(it) }
}
if (originalLocations.isNotEmpty()) {
originalLocations.forEach { serializer.write(Tag(18)).write(it) }
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: kotlin.Any?): Boolean = other is ResourceLocation &&
other.currentLocations == currentLocations &&
other.originalLocations == originalLocations &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + currentLocations.hashCode()
result = 31 * result + originalLocations.hashCode()
return result
}
override fun toString(): String = "ResourceLocation(" +
"currentLocations=$currentLocations, " +
"originalLocations=$originalLocations" +
"${if (unknownFields.isEmpty()) "" else ", unknownFields=$unknownFields"})"
fun copy(dsl: ResourceLocationDsl.() -> Unit): ResourceLocation =
ResourceLocation.Deserializer {
currentLocations = [email protected]
originalLocations = [email protected]
unknownFields = [email protected]
dsl()
}
class ResourceLocationDsl {
var currentLocations: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
var originalLocations: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
fun build(): ResourceLocation = ResourceLocation(finishList(currentLocations),
finishList(originalLocations),
unknownFields)
}
companion object Deserializer : KtDeserializer,
(ResourceLocationDsl.() -> Unit) -> ResourceLocation {
override fun deserialize(deserializer: KtMessageDeserializer): ResourceLocation {
var currentLocations : MutableList? = null
var originalLocations : MutableList? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when(deserializer.readTag()) {
0 -> return ResourceLocation(finishList(currentLocations),
finishList(originalLocations),
UnknownFieldSet.from(unknownFields))
10 -> currentLocations = (currentLocations ?: mutableListOf()).apply {
deserializer.readRepeated(false) {
add(deserializer.readString())
}
}
18 -> originalLocations = (originalLocations ?: mutableListOf()).apply {
deserializer.readRepeated(false) {
add(deserializer.readString())
}
}
else -> unknownFields = (unknownFields ?:
UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
}
}
}
override fun invoke(dsl: ResourceLocationDsl.() -> Unit): ResourceLocation =
ResourceLocationDsl().apply(dsl).build()
}
}
/**
* Identity delegation history of an authenticated service account.
*/
@KtGeneratedMessage("google.cloud.audit.ServiceAccountDelegationInfo")
class ServiceAccountDelegationInfo private constructor(
/**
* Entity that creates credentials for service account and assumes its identity for
* authentication.
*/
val authority: Authority?,
/**
* A string representing the principal_subject associated with the identity. For most
* identities, the format will be `principal://iam.googleapis.com/{identity pool
* name}/subject/{subject)` except for some GKE identities (GKE_WORKLOAD, FREEFORM,
* GKE_HUB_WORKLOAD) that are still in the legacy format `serviceAccount:{identity pool
* name}[{subject}]`
*/
val principalSubject: String,
val unknownFields: UnknownFieldSet = UnknownFieldSet.empty(),
) : KtMessage {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
when (authority) {
is ServiceAccountDelegationInfo.Authority.FirstPartyPrincipal -> {
result += sizeof(Tag(1)) + sizeof(authority.firstPartyPrincipal)}
is ServiceAccountDelegationInfo.Authority.ThirdPartyPrincipal -> {
result += sizeof(Tag(2)) + sizeof(authority.thirdPartyPrincipal)}
null -> Unit
}
if (principalSubject.isNotEmpty()) {
result += sizeof(Tag(3)) + sizeof(principalSubject)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
when (authority) {
is ServiceAccountDelegationInfo.Authority.FirstPartyPrincipal -> {
serializer.write(Tag(10)).write(authority.firstPartyPrincipal)
}
is ServiceAccountDelegationInfo.Authority.ThirdPartyPrincipal -> {
serializer.write(Tag(18)).write(authority.thirdPartyPrincipal)
}
null -> Unit
}
if (principalSubject.isNotEmpty()) {
serializer.write(Tag(26)).write(principalSubject)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: kotlin.Any?): Boolean =
other is ServiceAccountDelegationInfo &&
other.authority == authority &&
other.principalSubject == principalSubject &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + authority.hashCode()
result = 31 * result + principalSubject.hashCode()
return result
}
override fun toString(): String = "ServiceAccountDelegationInfo(" +
"authority=$authority, " +
"principalSubject=$principalSubject" +
"${if (unknownFields.isEmpty()) "" else ", unknownFields=$unknownFields"})"
fun copy(dsl: ServiceAccountDelegationInfoDsl.() -> Unit): ServiceAccountDelegationInfo =
ServiceAccountDelegationInfo.Deserializer {
authority = [email protected]
principalSubject = [email protected]
unknownFields = [email protected]
dsl()
}
sealed class Authority {
/**
* First party (Google) identity as the real authority.
*/
data class FirstPartyPrincipal(
val firstPartyPrincipal: ServiceAccountDelegationInfo.FirstPartyPrincipal,
) : Authority()
/**
* Third party identity as the real authority.
*/
data class ThirdPartyPrincipal(
val thirdPartyPrincipal: ServiceAccountDelegationInfo.ThirdPartyPrincipal,
) : Authority()
}
class ServiceAccountDelegationInfoDsl {
var authority: Authority? = null
var principalSubject: String = ""
var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
fun build(): ServiceAccountDelegationInfo = ServiceAccountDelegationInfo(authority,
principalSubject,
unknownFields)
}
companion object Deserializer : KtDeserializer,
(ServiceAccountDelegationInfoDsl.() -> Unit) -> ServiceAccountDelegationInfo {
override fun deserialize(deserializer: KtMessageDeserializer):
ServiceAccountDelegationInfo {
var authority : Authority? = null
var principalSubject = ""
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when(deserializer.readTag()) {
0 -> return ServiceAccountDelegationInfo(authority,
principalSubject,
UnknownFieldSet.from(unknownFields))
10 -> authority =
Authority.FirstPartyPrincipal(deserializer.readMessage(com.google.cloud.audit.ServiceAccountDelegationInfo.FirstPartyPrincipal))
18 -> authority =
Authority.ThirdPartyPrincipal(deserializer.readMessage(com.google.cloud.audit.ServiceAccountDelegationInfo.ThirdPartyPrincipal))
26 -> principalSubject = deserializer.readString()
else -> unknownFields = (unknownFields ?:
UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown()) }
}
}
}
override fun invoke(dsl: ServiceAccountDelegationInfoDsl.() -> Unit):
ServiceAccountDelegationInfo = ServiceAccountDelegationInfoDsl().apply(dsl).build()
}
/**
* First party identity principal.
*/
@KtGeneratedMessage("google.cloud.audit.FirstPartyPrincipal")
class FirstPartyPrincipal private constructor(
/**
* The email address of a Google account.
*/
val principalEmail: String,
/**
* Metadata about the service that uses the service account.
*/
val serviceMetadata: Struct?,
val unknownFields: UnknownFieldSet = UnknownFieldSet.empty(),
) : KtMessage {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (principalEmail.isNotEmpty()) {
result += sizeof(Tag(1)) + sizeof(principalEmail)
}
if (serviceMetadata != null) {
result += sizeof(Tag(2)) + sizeof(serviceMetadata)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (principalEmail.isNotEmpty()) {
serializer.write(Tag(10)).write(principalEmail)
}
if (serviceMetadata != null) {
serializer.write(Tag(18)).write(serviceMetadata)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: kotlin.Any?): Boolean = other is FirstPartyPrincipal &&
other.principalEmail == principalEmail &&
other.serviceMetadata == serviceMetadata &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + principalEmail.hashCode()
result = 31 * result + serviceMetadata.hashCode()
return result
}
override fun toString(): String = "FirstPartyPrincipal(" +
"principalEmail=$principalEmail, " +
"serviceMetadata=$serviceMetadata" +
"${if (unknownFields.isEmpty()) "" else ", unknownFields=$unknownFields"})"
fun copy(dsl: FirstPartyPrincipalDsl.() -> Unit): FirstPartyPrincipal =
FirstPartyPrincipal.Deserializer {
principalEmail = [email protected]
serviceMetadata = [email protected]
unknownFields = [email protected]
dsl()
}
class FirstPartyPrincipalDsl {
var principalEmail: String = ""
var serviceMetadata: Struct? = null
var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
fun build(): FirstPartyPrincipal = FirstPartyPrincipal(principalEmail,
serviceMetadata,
unknownFields)
}
companion object Deserializer : KtDeserializer,
(FirstPartyPrincipalDsl.() -> Unit) -> FirstPartyPrincipal {
override fun deserialize(deserializer: KtMessageDeserializer):
FirstPartyPrincipal {
var principalEmail = ""
var serviceMetadata : Struct? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when(deserializer.readTag()) {
0 -> return FirstPartyPrincipal(principalEmail,
serviceMetadata,
UnknownFieldSet.from(unknownFields))
10 -> principalEmail = deserializer.readString()
18 -> serviceMetadata =
deserializer.readMessage(com.toasttab.protokt.Struct)
else -> unknownFields = (unknownFields ?:
UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown())
}
}
}
}
override fun invoke(dsl: FirstPartyPrincipalDsl.() -> Unit): FirstPartyPrincipal
= FirstPartyPrincipalDsl().apply(dsl).build()
}
}
/**
* Third party identity principal.
*/
@KtGeneratedMessage("google.cloud.audit.ThirdPartyPrincipal")
class ThirdPartyPrincipal private constructor(
/**
* Metadata about third party identity.
*/
val thirdPartyClaims: Struct?,
val unknownFields: UnknownFieldSet = UnknownFieldSet.empty(),
) : KtMessage {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (thirdPartyClaims != null) {
result += sizeof(Tag(1)) + sizeof(thirdPartyClaims)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (thirdPartyClaims != null) {
serializer.write(Tag(10)).write(thirdPartyClaims)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: kotlin.Any?): Boolean = other is ThirdPartyPrincipal &&
other.thirdPartyClaims == thirdPartyClaims &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + thirdPartyClaims.hashCode()
return result
}
override fun toString(): String = "ThirdPartyPrincipal(" +
"thirdPartyClaims=$thirdPartyClaims" +
"${if (unknownFields.isEmpty()) "" else ", unknownFields=$unknownFields"})"
fun copy(dsl: ThirdPartyPrincipalDsl.() -> Unit): ThirdPartyPrincipal =
ThirdPartyPrincipal.Deserializer {
thirdPartyClaims = [email protected]
unknownFields = [email protected]
dsl()
}
class ThirdPartyPrincipalDsl {
var thirdPartyClaims: Struct? = null
var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
fun build(): ThirdPartyPrincipal = ThirdPartyPrincipal(thirdPartyClaims,
unknownFields)
}
companion object Deserializer : KtDeserializer,
(ThirdPartyPrincipalDsl.() -> Unit) -> ThirdPartyPrincipal {
override fun deserialize(deserializer: KtMessageDeserializer):
ThirdPartyPrincipal {
var thirdPartyClaims : Struct? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when(deserializer.readTag()) {
0 -> return ThirdPartyPrincipal(thirdPartyClaims,
UnknownFieldSet.from(unknownFields))
10 -> thirdPartyClaims =
deserializer.readMessage(com.toasttab.protokt.Struct)
else -> unknownFields = (unknownFields ?:
UnknownFieldSet.Builder()).also {it.add(deserializer.readUnknown())
}
}
}
}
override fun invoke(dsl: ThirdPartyPrincipalDsl.() -> Unit): ThirdPartyPrincipal
= ThirdPartyPrincipalDsl().apply(dsl).build()
}
}
}