Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// Generated by protokt version 1.0.0-alpha.8. Do not modify.
// Source: google/cloud/audit/audit_log.proto
@file:Suppress("DEPRECATION")
package protokt.v1.google.cloud.audit
import protokt.v1.AbstractKtDeserializer
import protokt.v1.AbstractKtMessage
import protokt.v1.Collections.copyList
import protokt.v1.Collections.copyMap
import protokt.v1.Collections.unmodifiableList
import protokt.v1.Collections.unmodifiableMap
import protokt.v1.KtBuilderDsl
import protokt.v1.KtEnum
import protokt.v1.KtEnumDeserializer
import protokt.v1.KtMessageDeserializer
import protokt.v1.KtMessageSerializer
import protokt.v1.SizeCodecs.sizeOf
import protokt.v1.UnknownFieldSet
import protokt.v1.google.protobuf.Struct
import protokt.v1.google.rpc.Status
import protokt.v1.google.rpc.context.AttributeContext
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.Map
import kotlin.collections.MutableList
import kotlin.collections.MutableMap
import kotlin.jvm.JvmStatic
import com.toasttab.protokt.rt.KtGeneratedMessage as RtKtGeneratedMessage
import kotlin.Any as KotlinAny
import protokt.v1.KtGeneratedMessage as V1KtGeneratedMessage
import protokt.v1.google.protobuf.Any as ProtobufAny
/**
* Common audit log format for Google Cloud Platform API operations.
*/
@V1KtGeneratedMessage("google.cloud.audit.AuditLog")
@RtKtGeneratedMessage("google.cloud.audit.AuditLog")
public class AuditLog private constructor(
/**
* The status of the overall operation.
*/
public val status: Status?,
/**
* Authentication information.
*/
public val authenticationInfo: AuthenticationInfo?,
/**
* Metadata about the operation.
*/
public val requestMetadata: RequestMetadata?,
/**
* The name of the API service performing the operation. For example, `"compute.googleapis.com"`.
*/
public 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"
*/
public val methodName: String,
/**
* Authorization information. If there are multiple resources or permissions involved, then there
* is one AuthorizationInfo element for each {resource, permission} tuple.
*/
public 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"
*/
public val resourceName: String,
/**
* The number of items returned from a List or Query API method, if applicable.
*/
public val numResponseItems: Long,
/**
* Deprecated. Use the `metadata` field instead. Other service-specific data about the request,
* response, and other activities.
*/
@Deprecated("deprecated in proto")
public val serviceData: ProtobufAny?,
/**
* 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.
*/
public 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.
*/
public val response: Struct?,
/**
* Other service-specific data about the request, response, and other information associated with
* the current audited event.
*/
public 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.
*/
public val resourceOriginalState: Struct?,
/**
* The resource location information.
*/
public val resourceLocation: ResourceLocation?,
/**
* Indicates the policy violations for this request. If the request is denied by the policy,
* violation information will be logged here.
*/
public val policyViolationInfo: PolicyViolationInfo?,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (status != null) {
result += sizeOf(18u) + sizeOf(status)
}
if (authenticationInfo != null) {
result += sizeOf(26u) + sizeOf(authenticationInfo)
}
if (requestMetadata != null) {
result += sizeOf(34u) + sizeOf(requestMetadata)
}
if (serviceName.isNotEmpty()) {
result += sizeOf(58u) + sizeOf(serviceName)
}
if (methodName.isNotEmpty()) {
result += sizeOf(66u) + sizeOf(methodName)
}
if (authorizationInfo.isNotEmpty()) {
result += (sizeOf(74u) * authorizationInfo.size) + authorizationInfo.sumOf { sizeOf(it) }
}
if (resourceName.isNotEmpty()) {
result += sizeOf(90u) + sizeOf(resourceName)
}
if (numResponseItems != 0L) {
result += sizeOf(96u) + sizeOf(numResponseItems)
}
if (serviceData != null) {
result += sizeOf(122u) + sizeOf(serviceData)
}
if (request != null) {
result += sizeOf(130u) + sizeOf(request)
}
if (response != null) {
result += sizeOf(138u) + sizeOf(response)
}
if (metadata != null) {
result += sizeOf(146u) + sizeOf(metadata)
}
if (resourceOriginalState != null) {
result += sizeOf(154u) + sizeOf(resourceOriginalState)
}
if (resourceLocation != null) {
result += sizeOf(162u) + sizeOf(resourceLocation)
}
if (policyViolationInfo != null) {
result += sizeOf(202u) + sizeOf(policyViolationInfo)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (status != null) {
serializer.writeTag(18u).write(status)
}
if (authenticationInfo != null) {
serializer.writeTag(26u).write(authenticationInfo)
}
if (requestMetadata != null) {
serializer.writeTag(34u).write(requestMetadata)
}
if (serviceName.isNotEmpty()) {
serializer.writeTag(58u).write(serviceName)
}
if (methodName.isNotEmpty()) {
serializer.writeTag(66u).write(methodName)
}
authorizationInfo.forEach { serializer.writeTag(74u).write(it) }
if (resourceName.isNotEmpty()) {
serializer.writeTag(90u).write(resourceName)
}
if (numResponseItems != 0L) {
serializer.writeTag(96u).write(numResponseItems)
}
if (serviceData != null) {
serializer.writeTag(122u).write(serviceData)
}
if (request != null) {
serializer.writeTag(130u).write(request)
}
if (response != null) {
serializer.writeTag(138u).write(response)
}
if (metadata != null) {
serializer.writeTag(146u).write(metadata)
}
if (resourceOriginalState != null) {
serializer.writeTag(154u).write(resourceOriginalState)
}
if (resourceLocation != null) {
serializer.writeTag(162u).write(resourceLocation)
}
if (policyViolationInfo != null) {
serializer.writeTag(202u).write(policyViolationInfo)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): 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.policyViolationInfo == policyViolationInfo &&
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()
result = 31 * result + policyViolationInfo.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, " +
"policyViolationInfo=$policyViolationInfo" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): AuditLog =
Builder().apply {
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]
policyViolationInfo = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var status: Status? = null
public var authenticationInfo: AuthenticationInfo? = null
public var requestMetadata: RequestMetadata? = null
public var serviceName: String = ""
public var methodName: String = ""
public var authorizationInfo: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
public var resourceName: String = ""
public var numResponseItems: Long = 0L
@Deprecated("deprecated in proto")
public var serviceData: ProtobufAny? = null
public var request: Struct? = null
public var response: Struct? = null
public var metadata: Struct? = null
public var resourceOriginalState: Struct? = null
public var resourceLocation: ResourceLocation? = null
public var policyViolationInfo: PolicyViolationInfo? = null
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): AuditLog =
AuditLog(
status,
authenticationInfo,
requestMetadata,
serviceName,
methodName,
unmodifiableList(authorizationInfo),
resourceName,
numResponseItems,
serviceData,
request,
response,
metadata,
resourceOriginalState,
resourceLocation,
policyViolationInfo,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
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: ProtobufAny? = null
var request: Struct? = null
var response: Struct? = null
var metadata: Struct? = null
var resourceOriginalState: Struct? = null
var resourceLocation: ResourceLocation? = null
var policyViolationInfo: PolicyViolationInfo? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (deserializer.readTag()) {
0 -> return AuditLog(
status,
authenticationInfo,
requestMetadata,
serviceName,
methodName,
unmodifiableList(authorizationInfo),
resourceName,
numResponseItems,
serviceData,
request,
response,
metadata,
resourceOriginalState,
resourceLocation,
policyViolationInfo,
UnknownFieldSet.from(unknownFields)
)
18 -> status = deserializer.readMessage(Status)
26 -> authenticationInfo = deserializer.readMessage(AuthenticationInfo)
34 -> requestMetadata = deserializer.readMessage(RequestMetadata)
58 -> serviceName = deserializer.readString()
66 -> methodName = deserializer.readString()
74 ->
authorizationInfo =
(authorizationInfo ?: mutableListOf()).apply {
deserializer.readRepeated(false) {
add(deserializer.readMessage(AuthorizationInfo))
}
}
90 -> resourceName = deserializer.readString()
96 -> numResponseItems = deserializer.readInt64()
122 -> serviceData = deserializer.readMessage(ProtobufAny)
130 -> request = deserializer.readMessage(Struct)
138 -> response = deserializer.readMessage(Struct)
146 -> metadata = deserializer.readMessage(Struct)
154 -> resourceOriginalState = deserializer.readMessage(Struct)
162 -> resourceLocation = deserializer.readMessage(ResourceLocation)
202 -> policyViolationInfo = deserializer.readMessage(PolicyViolationInfo)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): AuditLog = Builder().apply(dsl).build()
}
}
/**
* Authentication information for the operation.
*/
@V1KtGeneratedMessage("google.cloud.audit.AuthenticationInfo")
@RtKtGeneratedMessage("google.cloud.audit.AuthenticationInfo")
public 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 [Caller identities in audit
* logs](https://cloud.google.com/logging/docs/audit#user-id).
*/
public 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.
*/
public 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.
*/
public 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}"
*/
public 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.
*/
public val serviceAccountDelegationInfo: List,
/**
* String representation of identity of requesting party. Populated for both first and third party
* identities.
*/
public val principalSubject: String,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (principalEmail.isNotEmpty()) {
result += sizeOf(10u) + sizeOf(principalEmail)
}
if (authoritySelector.isNotEmpty()) {
result += sizeOf(18u) + sizeOf(authoritySelector)
}
if (thirdPartyPrincipal != null) {
result += sizeOf(34u) + sizeOf(thirdPartyPrincipal)
}
if (serviceAccountKeyName.isNotEmpty()) {
result += sizeOf(42u) + sizeOf(serviceAccountKeyName)
}
if (serviceAccountDelegationInfo.isNotEmpty()) {
result += (sizeOf(50u) * serviceAccountDelegationInfo.size) +
serviceAccountDelegationInfo.sumOf { sizeOf(it) }
}
if (principalSubject.isNotEmpty()) {
result += sizeOf(66u) + sizeOf(principalSubject)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (principalEmail.isNotEmpty()) {
serializer.writeTag(10u).write(principalEmail)
}
if (authoritySelector.isNotEmpty()) {
serializer.writeTag(18u).write(authoritySelector)
}
if (thirdPartyPrincipal != null) {
serializer.writeTag(34u).write(thirdPartyPrincipal)
}
if (serviceAccountKeyName.isNotEmpty()) {
serializer.writeTag(42u).write(serviceAccountKeyName)
}
serviceAccountDelegationInfo.forEach { serializer.writeTag(50u).write(it) }
if (principalSubject.isNotEmpty()) {
serializer.writeTag(66u).write(principalSubject)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): 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)"
public fun copy(builder: Builder.() -> Unit): AuthenticationInfo =
Builder().apply {
principalEmail = [email protected]
authoritySelector = [email protected]
thirdPartyPrincipal = [email protected]
serviceAccountKeyName = [email protected]
serviceAccountDelegationInfo = [email protected]
principalSubject = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var principalEmail: String = ""
public var authoritySelector: String = ""
public var thirdPartyPrincipal: Struct? = null
public var serviceAccountKeyName: String = ""
public var serviceAccountDelegationInfo: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
public var principalSubject: String = ""
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): AuthenticationInfo =
AuthenticationInfo(
principalEmail,
authoritySelector,
thirdPartyPrincipal,
serviceAccountKeyName,
unmodifiableList(serviceAccountDelegationInfo),
principalSubject,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
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,
unmodifiableList(serviceAccountDelegationInfo),
principalSubject,
UnknownFieldSet.from(unknownFields)
)
10 -> principalEmail = deserializer.readString()
18 -> authoritySelector = deserializer.readString()
34 -> thirdPartyPrincipal = deserializer.readMessage(Struct)
42 -> serviceAccountKeyName = deserializer.readString()
50 ->
serviceAccountDelegationInfo =
(serviceAccountDelegationInfo ?: mutableListOf()).apply {
deserializer.readRepeated(false) {
add(deserializer.readMessage(ServiceAccountDelegationInfo))
}
}
66 -> principalSubject = deserializer.readString()
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): AuthenticationInfo = Builder().apply(dsl).build()
}
}
/**
* Authorization information for the operation.
*/
@V1KtGeneratedMessage("google.cloud.audit.AuthorizationInfo")
@RtKtGeneratedMessage("google.cloud.audit.AuthorizationInfo")
public 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
*/
public val resource: String,
/**
* The required IAM permission.
*/
public val permission: String,
/**
* Whether or not authorization for `resource` and `permission` was granted.
*/
public 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`.
*/
public val resourceAttributes: AttributeContext.Resource?,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (resource.isNotEmpty()) {
result += sizeOf(10u) + sizeOf(resource)
}
if (permission.isNotEmpty()) {
result += sizeOf(18u) + sizeOf(permission)
}
if (granted) {
result += sizeOf(24u) + 1
}
if (resourceAttributes != null) {
result += sizeOf(42u) + sizeOf(resourceAttributes)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (resource.isNotEmpty()) {
serializer.writeTag(10u).write(resource)
}
if (permission.isNotEmpty()) {
serializer.writeTag(18u).write(permission)
}
if (granted) {
serializer.writeTag(24u).write(granted)
}
if (resourceAttributes != null) {
serializer.writeTag(42u).write(resourceAttributes)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): 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)"
public fun copy(builder: Builder.() -> Unit): AuthorizationInfo =
Builder().apply {
resource = [email protected]
permission = [email protected]
granted = [email protected]
resourceAttributes = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var resource: String = ""
public var permission: String = ""
public var granted: Boolean = false
public var resourceAttributes: AttributeContext.Resource? = null
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): AuthorizationInfo =
AuthorizationInfo(
resource,
permission,
granted,
resourceAttributes,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
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(AttributeContext.Resource)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): AuthorizationInfo = Builder().apply(dsl).build()
}
}
/**
* Metadata about the request.
*/
@V1KtGeneratedMessage("google.cloud.audit.RequestMetadata")
@RtKtGeneratedMessage("google.cloud.audit.RequestMetadata")
public class RequestMetadata private constructor(
/**
* The IP address of the caller. For a caller from the internet, this will be the public IPv4 or
* IPv6 address. For calls made from inside Google's internal production network from one GCP service
* to another, `caller_ip` will be redacted to "private". For a caller from a Compute Engine VM with
* a external IP address, `caller_ip` will be the VM's external IP address. For a caller from a
* Compute Engine VM without a 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
* `caller_ip` will be redacted to "gce-internal-ip". See https://cloud.google.com/compute/docs/vpc/
* for more information.
*/
public 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.
*/
public 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"
*/
public 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`.
*/
public 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.
*/
public val destinationAttributes: AttributeContext.Peer?,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (callerIp.isNotEmpty()) {
result += sizeOf(10u) + sizeOf(callerIp)
}
if (callerSuppliedUserAgent.isNotEmpty()) {
result += sizeOf(18u) + sizeOf(callerSuppliedUserAgent)
}
if (callerNetwork.isNotEmpty()) {
result += sizeOf(26u) + sizeOf(callerNetwork)
}
if (requestAttributes != null) {
result += sizeOf(58u) + sizeOf(requestAttributes)
}
if (destinationAttributes != null) {
result += sizeOf(66u) + sizeOf(destinationAttributes)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (callerIp.isNotEmpty()) {
serializer.writeTag(10u).write(callerIp)
}
if (callerSuppliedUserAgent.isNotEmpty()) {
serializer.writeTag(18u).write(callerSuppliedUserAgent)
}
if (callerNetwork.isNotEmpty()) {
serializer.writeTag(26u).write(callerNetwork)
}
if (requestAttributes != null) {
serializer.writeTag(58u).write(requestAttributes)
}
if (destinationAttributes != null) {
serializer.writeTag(66u).write(destinationAttributes)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): 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)"
public fun copy(builder: Builder.() -> Unit): RequestMetadata =
Builder().apply {
callerIp = [email protected]
callerSuppliedUserAgent = [email protected]
callerNetwork = [email protected]
requestAttributes = [email protected]
destinationAttributes = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var callerIp: String = ""
public var callerSuppliedUserAgent: String = ""
public var callerNetwork: String = ""
public var requestAttributes: AttributeContext.Request? = null
public var destinationAttributes: AttributeContext.Peer? = null
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): RequestMetadata =
RequestMetadata(
callerIp,
callerSuppliedUserAgent,
callerNetwork,
requestAttributes,
destinationAttributes,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
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(AttributeContext.Request)
66 -> destinationAttributes = deserializer.readMessage(AttributeContext.Peer)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): RequestMetadata = Builder().apply(dsl).build()
}
}
/**
* Location information about a resource.
*/
@V1KtGeneratedMessage("google.cloud.audit.ResourceLocation")
@RtKtGeneratedMessage("google.cloud.audit.ResourceLocation")
public 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"
*/
public 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"
*/
public val originalLocations: List,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (currentLocations.isNotEmpty()) {
result += (sizeOf(10u) * currentLocations.size) + currentLocations.sumOf { sizeOf(it) }
}
if (originalLocations.isNotEmpty()) {
result += (sizeOf(18u) * originalLocations.size) + originalLocations.sumOf { sizeOf(it) }
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
currentLocations.forEach { serializer.writeTag(10u).write(it) }
originalLocations.forEach { serializer.writeTag(18u).write(it) }
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): 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)"
public fun copy(builder: Builder.() -> Unit): ResourceLocation =
Builder().apply {
currentLocations = [email protected]
originalLocations = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var currentLocations: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
public var originalLocations: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): ResourceLocation =
ResourceLocation(
unmodifiableList(currentLocations),
unmodifiableList(originalLocations),
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
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(
unmodifiableList(currentLocations),
unmodifiableList(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())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): ResourceLocation = Builder().apply(dsl).build()
}
}
/**
* Identity delegation history of an authenticated service account.
*/
@V1KtGeneratedMessage("google.cloud.audit.ServiceAccountDelegationInfo")
@RtKtGeneratedMessage("google.cloud.audit.ServiceAccountDelegationInfo")
public class ServiceAccountDelegationInfo private constructor(
/**
* Entity that creates credentials for service account and assumes its identity for
* authentication.
*/
public 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}]`
*/
public val principalSubject: String,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
when (authority) {
is Authority.FirstPartyPrincipal ->
result += sizeOf(10u) + sizeOf(authority.firstPartyPrincipal)
is Authority.ThirdPartyPrincipal ->
result += sizeOf(18u) + sizeOf(authority.thirdPartyPrincipal)
null -> Unit
}
if (principalSubject.isNotEmpty()) {
result += sizeOf(26u) + sizeOf(principalSubject)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
when (authority) {
is Authority.FirstPartyPrincipal ->
serializer.writeTag(10u).write(authority.firstPartyPrincipal)
is Authority.ThirdPartyPrincipal ->
serializer.writeTag(18u).write(authority.thirdPartyPrincipal)
null -> Unit
}
if (principalSubject.isNotEmpty()) {
serializer.writeTag(26u).write(principalSubject)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): 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)"
public fun copy(builder: Builder.() -> Unit): ServiceAccountDelegationInfo =
Builder().apply {
authority = [email protected]
principalSubject = [email protected]
unknownFields = [email protected]
builder()
}.build()
public sealed class Authority {
/**
* First party (Google) identity as the real authority.
*/
public data class FirstPartyPrincipal(
public val firstPartyPrincipal: ServiceAccountDelegationInfo.FirstPartyPrincipal
) : Authority()
/**
* Third party identity as the real authority.
*/
public data class ThirdPartyPrincipal(
public val thirdPartyPrincipal: ServiceAccountDelegationInfo.ThirdPartyPrincipal
) : Authority()
}
@KtBuilderDsl
public class Builder {
public var authority: Authority? = null
public var principalSubject: String = ""
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): ServiceAccountDelegationInfo =
ServiceAccountDelegationInfo(
authority,
principalSubject,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
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(FirstPartyPrincipal))
18 ->
authority =
Authority.ThirdPartyPrincipal(deserializer.readMessage(ThirdPartyPrincipal))
26 -> principalSubject = deserializer.readString()
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): ServiceAccountDelegationInfo = Builder().apply(dsl).build()
}
/**
* First party identity principal.
*/
@V1KtGeneratedMessage("google.cloud.audit.FirstPartyPrincipal")
@RtKtGeneratedMessage("google.cloud.audit.FirstPartyPrincipal")
public class FirstPartyPrincipal private constructor(
/**
* The email address of a Google account.
*/
public val principalEmail: String,
/**
* Metadata about the service that uses the service account.
*/
public val serviceMetadata: Struct?,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (principalEmail.isNotEmpty()) {
result += sizeOf(10u) + sizeOf(principalEmail)
}
if (serviceMetadata != null) {
result += sizeOf(18u) + sizeOf(serviceMetadata)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (principalEmail.isNotEmpty()) {
serializer.writeTag(10u).write(principalEmail)
}
if (serviceMetadata != null) {
serializer.writeTag(18u).write(serviceMetadata)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): 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)"
public fun copy(builder: Builder.() -> Unit): FirstPartyPrincipal =
Builder().apply {
principalEmail = [email protected]
serviceMetadata = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var principalEmail: String = ""
public var serviceMetadata: Struct? = null
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): FirstPartyPrincipal =
FirstPartyPrincipal(
principalEmail,
serviceMetadata,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
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(Struct)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): FirstPartyPrincipal = Builder().apply(dsl).build()
}
}
/**
* Third party identity principal.
*/
@V1KtGeneratedMessage("google.cloud.audit.ThirdPartyPrincipal")
@RtKtGeneratedMessage("google.cloud.audit.ThirdPartyPrincipal")
public class ThirdPartyPrincipal private constructor(
/**
* Metadata about third party identity.
*/
public val thirdPartyClaims: Struct?,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (thirdPartyClaims != null) {
result += sizeOf(10u) + sizeOf(thirdPartyClaims)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (thirdPartyClaims != null) {
serializer.writeTag(10u).write(thirdPartyClaims)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): 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)"
public fun copy(builder: Builder.() -> Unit): ThirdPartyPrincipal =
Builder().apply {
thirdPartyClaims = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var thirdPartyClaims: Struct? = null
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): ThirdPartyPrincipal =
ThirdPartyPrincipal(
thirdPartyClaims,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
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(Struct)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): ThirdPartyPrincipal = Builder().apply(dsl).build()
}
}
}
/**
* Information related to policy violations for this request.
*/
@V1KtGeneratedMessage("google.cloud.audit.PolicyViolationInfo")
@RtKtGeneratedMessage("google.cloud.audit.PolicyViolationInfo")
public class PolicyViolationInfo private constructor(
/**
* Indicates the orgpolicy violations for this resource.
*/
public val orgPolicyViolationInfo: OrgPolicyViolationInfo?,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (orgPolicyViolationInfo != null) {
result += sizeOf(10u) + sizeOf(orgPolicyViolationInfo)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (orgPolicyViolationInfo != null) {
serializer.writeTag(10u).write(orgPolicyViolationInfo)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): Boolean =
other is PolicyViolationInfo &&
other.orgPolicyViolationInfo == orgPolicyViolationInfo &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + orgPolicyViolationInfo.hashCode()
return result
}
override fun toString(): String =
"PolicyViolationInfo(" +
"orgPolicyViolationInfo=$orgPolicyViolationInfo" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): PolicyViolationInfo =
Builder().apply {
orgPolicyViolationInfo = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var orgPolicyViolationInfo: OrgPolicyViolationInfo? = null
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): PolicyViolationInfo =
PolicyViolationInfo(
orgPolicyViolationInfo,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
override fun deserialize(deserializer: KtMessageDeserializer): PolicyViolationInfo {
var orgPolicyViolationInfo: OrgPolicyViolationInfo? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (deserializer.readTag()) {
0 -> return PolicyViolationInfo(
orgPolicyViolationInfo,
UnknownFieldSet.from(unknownFields)
)
10 -> orgPolicyViolationInfo = deserializer.readMessage(OrgPolicyViolationInfo)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): PolicyViolationInfo = Builder().apply(dsl).build()
}
}
/**
* Represents OrgPolicy Violation information.
*/
@V1KtGeneratedMessage("google.cloud.audit.OrgPolicyViolationInfo")
@RtKtGeneratedMessage("google.cloud.audit.OrgPolicyViolationInfo")
public class OrgPolicyViolationInfo private constructor(
/**
* Optional. Resource payload that is currently in scope and is subjected to orgpolicy conditions.
* This payload may be the subset of the actual Resource that may come in the request. This payload
* should not contain any core content.
*/
public val payload: Struct?,
/**
* Optional. Resource type that the orgpolicy is checked against. Example:
* compute.googleapis.com/Instance, store.googleapis.com/bucket
*/
public val resourceType: String,
/**
* Optional. Tags referenced on the resource at the time of evaluation. These also include the
* federated tags, if they are supplied in the CheckOrgPolicy or CheckCustomConstraints Requests.
*
* Optional field as of now. These tags are the Cloud tags that are available on the resource
* during the policy evaluation and will be available as part of the OrgPolicy check response for
* logging purposes.
*/
public val resourceTags: Map,
/**
* Optional. Policy violations
*/
public val violationInfo: List,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (payload != null) {
result += sizeOf(10u) + sizeOf(payload)
}
if (resourceType.isNotEmpty()) {
result += sizeOf(18u) + sizeOf(resourceType)
}
if (resourceTags.isNotEmpty()) {
result +=
sizeOf(resourceTags, 26u) { k, v ->
ResourceTagsEntry.entrySize(k, v)
}
}
if (violationInfo.isNotEmpty()) {
result += (sizeOf(34u) * violationInfo.size) + violationInfo.sumOf { sizeOf(it) }
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (payload != null) {
serializer.writeTag(10u).write(payload)
}
if (resourceType.isNotEmpty()) {
serializer.writeTag(18u).write(resourceType)
}
resourceTags.entries.forEach {
serializer.writeTag(26u).write(ResourceTagsEntry(it.key, it.value))
}
violationInfo.forEach { serializer.writeTag(34u).write(it) }
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): Boolean =
other is OrgPolicyViolationInfo &&
other.payload == payload &&
other.resourceType == resourceType &&
other.resourceTags == resourceTags &&
other.violationInfo == violationInfo &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + payload.hashCode()
result = 31 * result + resourceType.hashCode()
result = 31 * result + resourceTags.hashCode()
result = 31 * result + violationInfo.hashCode()
return result
}
override fun toString(): String =
"OrgPolicyViolationInfo(" +
"payload=$payload, " +
"resourceType=$resourceType, " +
"resourceTags=$resourceTags, " +
"violationInfo=$violationInfo" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): OrgPolicyViolationInfo =
Builder().apply {
payload = [email protected]
resourceType = [email protected]
resourceTags = [email protected]
violationInfo = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var payload: Struct? = null
public var resourceType: String = ""
public var resourceTags: Map = emptyMap()
set(newValue) {
field = copyMap(newValue)
}
public var violationInfo: List = emptyList()
set(newValue) {
field = copyList(newValue)
}
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): OrgPolicyViolationInfo =
OrgPolicyViolationInfo(
payload,
resourceType,
unmodifiableMap(resourceTags),
unmodifiableList(violationInfo),
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
override fun deserialize(deserializer: KtMessageDeserializer): OrgPolicyViolationInfo {
var payload: Struct? = null
var resourceType = ""
var resourceTags: MutableMap? = null
var violationInfo: MutableList? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (deserializer.readTag()) {
0 -> return OrgPolicyViolationInfo(
payload,
resourceType,
unmodifiableMap(resourceTags),
unmodifiableList(violationInfo),
UnknownFieldSet.from(unknownFields)
)
10 -> payload = deserializer.readMessage(Struct)
18 -> resourceType = deserializer.readString()
26 ->
resourceTags =
(resourceTags ?: mutableMapOf()).apply {
deserializer.readRepeated(false) {
deserializer.readMessage(ResourceTagsEntry).let {
put(it.key, it.value)
}
}
}
34 ->
violationInfo =
(violationInfo ?: mutableListOf()).apply {
deserializer.readRepeated(false) {
add(deserializer.readMessage(ViolationInfo))
}
}
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): OrgPolicyViolationInfo = Builder().apply(dsl).build()
}
private class ResourceTagsEntry(
public val key: String,
public val `value`: String
) : AbstractKtMessage() {
override val messageSize: Int
get() = entrySize(key, value)
override fun serialize(serializer: KtMessageSerializer) {
serializer.writeTag(10u).write(key)
serializer.writeTag(18u).write(`value`)
}
public companion object Deserializer : AbstractKtDeserializer() {
public fun entrySize(
key: String,
`value`: String
): Int =
sizeOf(10u) + sizeOf(key) +
sizeOf(18u) + sizeOf(`value`)
override fun deserialize(deserializer: KtMessageDeserializer): ResourceTagsEntry {
var key = ""
var value = ""
while (true) {
when (deserializer.readTag()) {
0 -> return ResourceTagsEntry(key, value)
10 -> key = deserializer.readString()
18 -> value = deserializer.readString()
}
}
}
}
}
}
/**
* Provides information about the Policy violation info for this request.
*/
@V1KtGeneratedMessage("google.cloud.audit.ViolationInfo")
@RtKtGeneratedMessage("google.cloud.audit.ViolationInfo")
public class ViolationInfo private constructor(
/**
* Optional. Constraint name
*/
public val constraint: String,
/**
* Optional. Error message that policy is indicating.
*/
public val errorMessage: String,
/**
* Optional. Value that is being checked for the policy. This could be in encrypted form (if pii
* sensitive). This field will only be emitted in LIST_POLICY types
*/
public val checkedValue: String,
/**
* Optional. Indicates the type of the policy.
*/
public val policyType: PolicyType,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractKtMessage() {
override val messageSize: Int by lazy { messageSize() }
private fun messageSize(): Int {
var result = 0
if (constraint.isNotEmpty()) {
result += sizeOf(10u) + sizeOf(constraint)
}
if (errorMessage.isNotEmpty()) {
result += sizeOf(18u) + sizeOf(errorMessage)
}
if (checkedValue.isNotEmpty()) {
result += sizeOf(26u) + sizeOf(checkedValue)
}
if (policyType.value != 0) {
result += sizeOf(32u) + sizeOf(policyType)
}
result += unknownFields.size()
return result
}
override fun serialize(serializer: KtMessageSerializer) {
if (constraint.isNotEmpty()) {
serializer.writeTag(10u).write(constraint)
}
if (errorMessage.isNotEmpty()) {
serializer.writeTag(18u).write(errorMessage)
}
if (checkedValue.isNotEmpty()) {
serializer.writeTag(26u).write(checkedValue)
}
if (policyType.value != 0) {
serializer.writeTag(32u).write(policyType)
}
serializer.writeUnknown(unknownFields)
}
override fun equals(other: KotlinAny?): Boolean =
other is ViolationInfo &&
other.constraint == constraint &&
other.errorMessage == errorMessage &&
other.checkedValue == checkedValue &&
other.policyType == policyType &&
other.unknownFields == unknownFields
override fun hashCode(): Int {
var result = unknownFields.hashCode()
result = 31 * result + constraint.hashCode()
result = 31 * result + errorMessage.hashCode()
result = 31 * result + checkedValue.hashCode()
result = 31 * result + policyType.hashCode()
return result
}
override fun toString(): String =
"ViolationInfo(" +
"constraint=$constraint, " +
"errorMessage=$errorMessage, " +
"checkedValue=$checkedValue, " +
"policyType=$policyType" +
if (unknownFields.isEmpty()) ")" else ", unknownFields=$unknownFields)"
public fun copy(builder: Builder.() -> Unit): ViolationInfo =
Builder().apply {
constraint = [email protected]
errorMessage = [email protected]
checkedValue = [email protected]
policyType = [email protected]
unknownFields = [email protected]
builder()
}.build()
@KtBuilderDsl
public class Builder {
public var constraint: String = ""
public var errorMessage: String = ""
public var checkedValue: String = ""
public var policyType: PolicyType = PolicyType.from(0)
public var unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
public fun build(): ViolationInfo =
ViolationInfo(
constraint,
errorMessage,
checkedValue,
policyType,
unknownFields
)
}
public companion object Deserializer : AbstractKtDeserializer() {
@JvmStatic
override fun deserialize(deserializer: KtMessageDeserializer): ViolationInfo {
var constraint = ""
var errorMessage = ""
var checkedValue = ""
var policyType = PolicyType.from(0)
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (deserializer.readTag()) {
0 -> return ViolationInfo(
constraint,
errorMessage,
checkedValue,
policyType,
UnknownFieldSet.from(unknownFields)
)
10 -> constraint = deserializer.readString()
18 -> errorMessage = deserializer.readString()
26 -> checkedValue = deserializer.readString()
32 -> policyType = deserializer.readEnum(PolicyType)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(deserializer.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): ViolationInfo = Builder().apply(dsl).build()
}
/**
* Policy Type enum
*/
public sealed class PolicyType(
override val `value`: Int,
override val name: String
) : KtEnum() {
/**
* Default value. This value should not be used.
*/
public object POLICY_TYPE_UNSPECIFIED : PolicyType(0, "POLICY_TYPE_UNSPECIFIED")
/**
* Indicates boolean policy constraint
*/
public object BOOLEAN_CONSTRAINT : PolicyType(1, "BOOLEAN_CONSTRAINT")
/**
* Indicates list policy constraint
*/
public object LIST_CONSTRAINT : PolicyType(2, "LIST_CONSTRAINT")
/**
* Indicates custom policy constraint
*/
public object CUSTOM_CONSTRAINT : PolicyType(3, "CUSTOM_CONSTRAINT")
public class UNRECOGNIZED(
`value`: Int
) : PolicyType(value, "UNRECOGNIZED")
public companion object Deserializer : KtEnumDeserializer {
override fun from(`value`: Int): PolicyType =
when (value) {
0 -> POLICY_TYPE_UNSPECIFIED
1 -> BOOLEAN_CONSTRAINT
2 -> LIST_CONSTRAINT
3 -> CUSTOM_CONSTRAINT
else -> UNRECOGNIZED(value)
}
}
}
}