commonMain.protokt.v1.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
The newest version!
// Generated by protokt version 1.0.0-beta.2. Do not modify.
// Source: google/cloud/audit/audit_log.proto
@file:Suppress("DEPRECATION")
package protokt.v1.google.cloud.audit
import protokt.v1.AbstractDeserializer
import protokt.v1.AbstractMessage
import protokt.v1.BuilderDsl
import protokt.v1.Collections.copyList
import protokt.v1.Collections.copyMap
import protokt.v1.Collections.unmodifiableList
import protokt.v1.Collections.unmodifiableMap
import protokt.v1.Enum
import protokt.v1.EnumReader
import protokt.v1.GeneratedMessage
import protokt.v1.GeneratedProperty
import protokt.v1.Reader
import protokt.v1.SizeCodecs.sizeOf
import protokt.v1.UnknownFieldSet
import protokt.v1.Writer
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 kotlin.Any as KotlinAny
import protokt.v1.google.protobuf.Any as ProtobufAny
/**
* Common audit log format for Google Cloud Platform API operations.
*/
@GeneratedMessage("google.cloud.audit.AuditLog")
public class AuditLog private constructor(
/**
* The status of the overall operation.
*/
@GeneratedProperty(2)
public val status: Status?,
/**
* Authentication information.
*/
@GeneratedProperty(3)
public val authenticationInfo: AuthenticationInfo?,
/**
* Metadata about the operation.
*/
@GeneratedProperty(4)
public val requestMetadata: RequestMetadata?,
/**
* The name of the API service performing the operation. For example, `"compute.googleapis.com"`.
*/
@GeneratedProperty(7)
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"
*/
@GeneratedProperty(8)
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.
*/
@GeneratedProperty(9)
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"
*/
@GeneratedProperty(11)
public val resourceName: String,
/**
* The number of items returned from a List or Query API method, if applicable.
*/
@GeneratedProperty(12)
public val numResponseItems: Long,
/**
* Deprecated. Use the `metadata` field instead. Other service-specific data about the request,
* response, and other activities.
*/
@GeneratedProperty(15)
@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.
*/
@GeneratedProperty(16)
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.
*/
@GeneratedProperty(17)
public val response: Struct?,
/**
* Other service-specific data about the request, response, and other information associated with
* the current audited event.
*/
@GeneratedProperty(18)
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.
*/
@GeneratedProperty(19)
public val resourceOriginalState: Struct?,
/**
* The resource location information.
*/
@GeneratedProperty(20)
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.
*/
@GeneratedProperty(25)
public val policyViolationInfo: PolicyViolationInfo?,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
private val `$messageSize`: Int by lazy {
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()
result
}
override fun messageSize(): Int = `$messageSize`
override fun serialize(writer: Writer) {
if (status != null) {
writer.writeTag(18u).write(status)
}
if (authenticationInfo != null) {
writer.writeTag(26u).write(authenticationInfo)
}
if (requestMetadata != null) {
writer.writeTag(34u).write(requestMetadata)
}
if (serviceName.isNotEmpty()) {
writer.writeTag(58u).write(serviceName)
}
if (methodName.isNotEmpty()) {
writer.writeTag(66u).write(methodName)
}
authorizationInfo.forEach { writer.writeTag(74u).write(it) }
if (resourceName.isNotEmpty()) {
writer.writeTag(90u).write(resourceName)
}
if (numResponseItems != 0L) {
writer.writeTag(96u).write(numResponseItems)
}
if (serviceData != null) {
writer.writeTag(122u).write(serviceData)
}
if (request != null) {
writer.writeTag(130u).write(request)
}
if (response != null) {
writer.writeTag(138u).write(response)
}
if (metadata != null) {
writer.writeTag(146u).write(metadata)
}
if (resourceOriginalState != null) {
writer.writeTag(154u).write(resourceOriginalState)
}
if (resourceLocation != null) {
writer.writeTag(162u).write(resourceLocation)
}
if (policyViolationInfo != null) {
writer.writeTag(202u).write(policyViolationInfo)
}
writer.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()
@BuilderDsl
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 : AbstractDeserializer() {
@JvmStatic
override fun deserialize(reader: Reader): 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 (reader.readTag()) {
0u -> return AuditLog(
status,
authenticationInfo,
requestMetadata,
serviceName,
methodName,
unmodifiableList(authorizationInfo),
resourceName,
numResponseItems,
serviceData,
request,
response,
metadata,
resourceOriginalState,
resourceLocation,
policyViolationInfo,
UnknownFieldSet.from(unknownFields)
)
18u -> status = reader.readMessage(Status)
26u -> authenticationInfo = reader.readMessage(AuthenticationInfo)
34u -> requestMetadata = reader.readMessage(RequestMetadata)
58u -> serviceName = reader.readString()
66u -> methodName = reader.readString()
74u ->
authorizationInfo =
(authorizationInfo ?: mutableListOf()).apply {
reader.readRepeated(false) {
add(reader.readMessage(AuthorizationInfo))
}
}
90u -> resourceName = reader.readString()
96u -> numResponseItems = reader.readInt64()
122u -> serviceData = reader.readMessage(ProtobufAny)
130u -> request = reader.readMessage(Struct)
138u -> response = reader.readMessage(Struct)
146u -> metadata = reader.readMessage(Struct)
154u -> resourceOriginalState = reader.readMessage(Struct)
162u -> resourceLocation = reader.readMessage(ResourceLocation)
202u -> policyViolationInfo = reader.readMessage(PolicyViolationInfo)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(reader.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): AuditLog = Builder().apply(dsl).build()
}
}
/**
* Authentication information for the operation.
*/
@GeneratedMessage("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).
*/
@GeneratedProperty(1)
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.
*/
@GeneratedProperty(2)
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.
*/
@GeneratedProperty(4)
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}"
*/
@GeneratedProperty(5)
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.
*/
@GeneratedProperty(6)
public val serviceAccountDelegationInfo: List,
/**
* String representation of identity of requesting party. Populated for both first and third party
* identities.
*/
@GeneratedProperty(8)
public val principalSubject: String,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
private val `$messageSize`: Int by lazy {
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()
result
}
override fun messageSize(): Int = `$messageSize`
override fun serialize(writer: Writer) {
if (principalEmail.isNotEmpty()) {
writer.writeTag(10u).write(principalEmail)
}
if (authoritySelector.isNotEmpty()) {
writer.writeTag(18u).write(authoritySelector)
}
if (thirdPartyPrincipal != null) {
writer.writeTag(34u).write(thirdPartyPrincipal)
}
if (serviceAccountKeyName.isNotEmpty()) {
writer.writeTag(42u).write(serviceAccountKeyName)
}
serviceAccountDelegationInfo.forEach { writer.writeTag(50u).write(it) }
if (principalSubject.isNotEmpty()) {
writer.writeTag(66u).write(principalSubject)
}
writer.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()
@BuilderDsl
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 : AbstractDeserializer() {
@JvmStatic
override fun deserialize(reader: Reader): 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 (reader.readTag()) {
0u -> return AuthenticationInfo(
principalEmail,
authoritySelector,
thirdPartyPrincipal,
serviceAccountKeyName,
unmodifiableList(serviceAccountDelegationInfo),
principalSubject,
UnknownFieldSet.from(unknownFields)
)
10u -> principalEmail = reader.readString()
18u -> authoritySelector = reader.readString()
34u -> thirdPartyPrincipal = reader.readMessage(Struct)
42u -> serviceAccountKeyName = reader.readString()
50u ->
serviceAccountDelegationInfo =
(serviceAccountDelegationInfo ?: mutableListOf()).apply {
reader.readRepeated(false) {
add(reader.readMessage(ServiceAccountDelegationInfo))
}
}
66u -> principalSubject = reader.readString()
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(reader.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): AuthenticationInfo = Builder().apply(dsl).build()
}
}
/**
* Authorization information for the operation.
*/
@GeneratedMessage("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
*/
@GeneratedProperty(1)
public val resource: String,
/**
* The required IAM permission.
*/
@GeneratedProperty(2)
public val permission: String,
/**
* Whether or not authorization for `resource` and `permission` was granted.
*/
@GeneratedProperty(3)
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`.
*/
@GeneratedProperty(5)
public val resourceAttributes: AttributeContext.Resource?,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
private val `$messageSize`: Int by lazy {
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()
result
}
override fun messageSize(): Int = `$messageSize`
override fun serialize(writer: Writer) {
if (resource.isNotEmpty()) {
writer.writeTag(10u).write(resource)
}
if (permission.isNotEmpty()) {
writer.writeTag(18u).write(permission)
}
if (granted) {
writer.writeTag(24u).write(granted)
}
if (resourceAttributes != null) {
writer.writeTag(42u).write(resourceAttributes)
}
writer.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()
@BuilderDsl
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 : AbstractDeserializer() {
@JvmStatic
override fun deserialize(reader: Reader): AuthorizationInfo {
var resource = ""
var permission = ""
var granted = false
var resourceAttributes: AttributeContext.Resource? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (reader.readTag()) {
0u -> return AuthorizationInfo(
resource,
permission,
granted,
resourceAttributes,
UnknownFieldSet.from(unknownFields)
)
10u -> resource = reader.readString()
18u -> permission = reader.readString()
24u -> granted = reader.readBool()
42u -> resourceAttributes = reader.readMessage(AttributeContext.Resource)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(reader.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): AuthorizationInfo = Builder().apply(dsl).build()
}
}
/**
* Metadata about the request.
*/
@GeneratedMessage("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.
*/
@GeneratedProperty(1)
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.
*/
@GeneratedProperty(2)
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"
*/
@GeneratedProperty(3)
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`.
*/
@GeneratedProperty(7)
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.
*/
@GeneratedProperty(8)
public val destinationAttributes: AttributeContext.Peer?,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
private val `$messageSize`: Int by lazy {
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()
result
}
override fun messageSize(): Int = `$messageSize`
override fun serialize(writer: Writer) {
if (callerIp.isNotEmpty()) {
writer.writeTag(10u).write(callerIp)
}
if (callerSuppliedUserAgent.isNotEmpty()) {
writer.writeTag(18u).write(callerSuppliedUserAgent)
}
if (callerNetwork.isNotEmpty()) {
writer.writeTag(26u).write(callerNetwork)
}
if (requestAttributes != null) {
writer.writeTag(58u).write(requestAttributes)
}
if (destinationAttributes != null) {
writer.writeTag(66u).write(destinationAttributes)
}
writer.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()
@BuilderDsl
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 : AbstractDeserializer() {
@JvmStatic
override fun deserialize(reader: Reader): 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 (reader.readTag()) {
0u -> return RequestMetadata(
callerIp,
callerSuppliedUserAgent,
callerNetwork,
requestAttributes,
destinationAttributes,
UnknownFieldSet.from(unknownFields)
)
10u -> callerIp = reader.readString()
18u -> callerSuppliedUserAgent = reader.readString()
26u -> callerNetwork = reader.readString()
58u -> requestAttributes = reader.readMessage(AttributeContext.Request)
66u -> destinationAttributes = reader.readMessage(AttributeContext.Peer)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(reader.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): RequestMetadata = Builder().apply(dsl).build()
}
}
/**
* Location information about a resource.
*/
@GeneratedMessage("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"
*/
@GeneratedProperty(1)
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"
*/
@GeneratedProperty(2)
public val originalLocations: List,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
private val `$messageSize`: Int by lazy {
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()
result
}
override fun messageSize(): Int = `$messageSize`
override fun serialize(writer: Writer) {
currentLocations.forEach { writer.writeTag(10u).write(it) }
originalLocations.forEach { writer.writeTag(18u).write(it) }
writer.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()
@BuilderDsl
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 : AbstractDeserializer() {
@JvmStatic
override fun deserialize(reader: Reader): ResourceLocation {
var currentLocations: MutableList? = null
var originalLocations: MutableList? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (reader.readTag()) {
0u -> return ResourceLocation(
unmodifiableList(currentLocations),
unmodifiableList(originalLocations),
UnknownFieldSet.from(unknownFields)
)
10u ->
currentLocations =
(currentLocations ?: mutableListOf()).apply {
reader.readRepeated(false) {
add(reader.readString())
}
}
18u ->
originalLocations =
(originalLocations ?: mutableListOf()).apply {
reader.readRepeated(false) {
add(reader.readString())
}
}
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(reader.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): ResourceLocation = Builder().apply(dsl).build()
}
}
/**
* Identity delegation history of an authenticated service account.
*/
@GeneratedMessage("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}]`
*/
@GeneratedProperty(3)
public val principalSubject: String,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
private val `$messageSize`: Int by lazy {
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()
result
}
override fun messageSize(): Int = `$messageSize`
override fun serialize(writer: Writer) {
when (authority) {
is Authority.FirstPartyPrincipal ->
writer.writeTag(10u).write(authority.firstPartyPrincipal)
is Authority.ThirdPartyPrincipal ->
writer.writeTag(18u).write(authority.thirdPartyPrincipal)
null -> Unit
}
if (principalSubject.isNotEmpty()) {
writer.writeTag(26u).write(principalSubject)
}
writer.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(
@GeneratedProperty(1)
public val firstPartyPrincipal: ServiceAccountDelegationInfo.FirstPartyPrincipal
) : Authority()
/**
* Third party identity as the real authority.
*/
public data class ThirdPartyPrincipal(
@GeneratedProperty(2)
public val thirdPartyPrincipal: ServiceAccountDelegationInfo.ThirdPartyPrincipal
) : Authority()
}
@BuilderDsl
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 : AbstractDeserializer() {
@JvmStatic
override fun deserialize(reader: Reader): ServiceAccountDelegationInfo {
var authority: Authority? = null
var principalSubject = ""
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (reader.readTag()) {
0u -> return ServiceAccountDelegationInfo(
authority,
principalSubject,
UnknownFieldSet.from(unknownFields)
)
10u -> authority = Authority.FirstPartyPrincipal(reader.readMessage(FirstPartyPrincipal))
18u -> authority = Authority.ThirdPartyPrincipal(reader.readMessage(ThirdPartyPrincipal))
26u -> principalSubject = reader.readString()
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(reader.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): ServiceAccountDelegationInfo = Builder().apply(dsl).build()
}
/**
* First party identity principal.
*/
@GeneratedMessage("google.cloud.audit.ServiceAccountDelegationInfo.FirstPartyPrincipal")
public class FirstPartyPrincipal private constructor(
/**
* The email address of a Google account.
*/
@GeneratedProperty(1)
public val principalEmail: String,
/**
* Metadata about the service that uses the service account.
*/
@GeneratedProperty(2)
public val serviceMetadata: Struct?,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
private val `$messageSize`: Int by lazy {
var result = 0
if (principalEmail.isNotEmpty()) {
result += sizeOf(10u) + sizeOf(principalEmail)
}
if (serviceMetadata != null) {
result += sizeOf(18u) + sizeOf(serviceMetadata)
}
result += unknownFields.size()
result
}
override fun messageSize(): Int = `$messageSize`
override fun serialize(writer: Writer) {
if (principalEmail.isNotEmpty()) {
writer.writeTag(10u).write(principalEmail)
}
if (serviceMetadata != null) {
writer.writeTag(18u).write(serviceMetadata)
}
writer.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()
@BuilderDsl
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 : AbstractDeserializer() {
@JvmStatic
override fun deserialize(reader: Reader): FirstPartyPrincipal {
var principalEmail = ""
var serviceMetadata: Struct? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (reader.readTag()) {
0u -> return FirstPartyPrincipal(
principalEmail,
serviceMetadata,
UnknownFieldSet.from(unknownFields)
)
10u -> principalEmail = reader.readString()
18u -> serviceMetadata = reader.readMessage(Struct)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(reader.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): FirstPartyPrincipal = Builder().apply(dsl).build()
}
}
/**
* Third party identity principal.
*/
@GeneratedMessage("google.cloud.audit.ServiceAccountDelegationInfo.ThirdPartyPrincipal")
public class ThirdPartyPrincipal private constructor(
/**
* Metadata about third party identity.
*/
@GeneratedProperty(1)
public val thirdPartyClaims: Struct?,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
private val `$messageSize`: Int by lazy {
var result = 0
if (thirdPartyClaims != null) {
result += sizeOf(10u) + sizeOf(thirdPartyClaims)
}
result += unknownFields.size()
result
}
override fun messageSize(): Int = `$messageSize`
override fun serialize(writer: Writer) {
if (thirdPartyClaims != null) {
writer.writeTag(10u).write(thirdPartyClaims)
}
writer.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()
@BuilderDsl
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 : AbstractDeserializer() {
@JvmStatic
override fun deserialize(reader: Reader): ThirdPartyPrincipal {
var thirdPartyClaims: Struct? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (reader.readTag()) {
0u -> return ThirdPartyPrincipal(
thirdPartyClaims,
UnknownFieldSet.from(unknownFields)
)
10u -> thirdPartyClaims = reader.readMessage(Struct)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(reader.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): ThirdPartyPrincipal = Builder().apply(dsl).build()
}
}
}
/**
* Information related to policy violations for this request.
*/
@GeneratedMessage("google.cloud.audit.PolicyViolationInfo")
public class PolicyViolationInfo private constructor(
/**
* Indicates the orgpolicy violations for this resource.
*/
@GeneratedProperty(1)
public val orgPolicyViolationInfo: OrgPolicyViolationInfo?,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
private val `$messageSize`: Int by lazy {
var result = 0
if (orgPolicyViolationInfo != null) {
result += sizeOf(10u) + sizeOf(orgPolicyViolationInfo)
}
result += unknownFields.size()
result
}
override fun messageSize(): Int = `$messageSize`
override fun serialize(writer: Writer) {
if (orgPolicyViolationInfo != null) {
writer.writeTag(10u).write(orgPolicyViolationInfo)
}
writer.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()
@BuilderDsl
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 : AbstractDeserializer() {
@JvmStatic
override fun deserialize(reader: Reader): PolicyViolationInfo {
var orgPolicyViolationInfo: OrgPolicyViolationInfo? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (reader.readTag()) {
0u -> return PolicyViolationInfo(
orgPolicyViolationInfo,
UnknownFieldSet.from(unknownFields)
)
10u -> orgPolicyViolationInfo = reader.readMessage(OrgPolicyViolationInfo)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(reader.readUnknown())
}
}
}
}
@JvmStatic
public operator fun invoke(dsl: Builder.() -> Unit): PolicyViolationInfo = Builder().apply(dsl).build()
}
}
/**
* Represents OrgPolicy Violation information.
*/
@GeneratedMessage("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.
*/
@GeneratedProperty(1)
public val payload: Struct?,
/**
* Optional. Resource type that the orgpolicy is checked against. Example:
* compute.googleapis.com/Instance, store.googleapis.com/bucket
*/
@GeneratedProperty(2)
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.
*/
@GeneratedProperty(3)
public val resourceTags: Map,
/**
* Optional. Policy violations
*/
@GeneratedProperty(4)
public val violationInfo: List,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
private val `$messageSize`: Int by lazy {
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()
result
}
override fun messageSize(): Int = `$messageSize`
override fun serialize(writer: Writer) {
if (payload != null) {
writer.writeTag(10u).write(payload)
}
if (resourceType.isNotEmpty()) {
writer.writeTag(18u).write(resourceType)
}
resourceTags.entries.forEach {
writer.writeTag(26u).write(ResourceTagsEntry(it.key, it.value))
}
violationInfo.forEach { writer.writeTag(34u).write(it) }
writer.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()
@BuilderDsl
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 : AbstractDeserializer() {
@JvmStatic
override fun deserialize(reader: Reader): OrgPolicyViolationInfo {
var payload: Struct? = null
var resourceType = ""
var resourceTags: MutableMap? = null
var violationInfo: MutableList? = null
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (reader.readTag()) {
0u -> return OrgPolicyViolationInfo(
payload,
resourceType,
unmodifiableMap(resourceTags),
unmodifiableList(violationInfo),
UnknownFieldSet.from(unknownFields)
)
10u -> payload = reader.readMessage(Struct)
18u -> resourceType = reader.readString()
26u ->
resourceTags =
(resourceTags ?: mutableMapOf()).apply {
reader.readRepeated(false) {
reader.readMessage(ResourceTagsEntry).let {
put(it.key, it.value)
}
}
}
34u ->
violationInfo =
(violationInfo ?: mutableListOf()).apply {
reader.readRepeated(false) {
add(reader.readMessage(ViolationInfo))
}
}
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(reader.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
) : AbstractMessage() {
override fun messageSize(): Int = entrySize(key, value)
override fun serialize(writer: Writer) {
writer.writeTag(10u).write(key)
writer.writeTag(18u).write(`value`)
}
public companion object Deserializer : AbstractDeserializer() {
public fun entrySize(
key: String,
`value`: String
): Int =
sizeOf(10u) + sizeOf(key) +
sizeOf(18u) + sizeOf(`value`)
override fun deserialize(reader: Reader): ResourceTagsEntry {
var key = ""
var value = ""
while (true) {
when (reader.readTag()) {
0u -> return ResourceTagsEntry(key, value)
10u -> key = reader.readString()
18u -> value = reader.readString()
}
}
}
}
}
}
/**
* Provides information about the Policy violation info for this request.
*/
@GeneratedMessage("google.cloud.audit.ViolationInfo")
public class ViolationInfo private constructor(
/**
* Optional. Constraint name
*/
@GeneratedProperty(1)
public val constraint: String,
/**
* Optional. Error message that policy is indicating.
*/
@GeneratedProperty(2)
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
*/
@GeneratedProperty(3)
public val checkedValue: String,
/**
* Optional. Indicates the type of the policy.
*/
@GeneratedProperty(4)
public val policyType: PolicyType,
public val unknownFields: UnknownFieldSet = UnknownFieldSet.empty()
) : AbstractMessage() {
private val `$messageSize`: Int by lazy {
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()
result
}
override fun messageSize(): Int = `$messageSize`
override fun serialize(writer: Writer) {
if (constraint.isNotEmpty()) {
writer.writeTag(10u).write(constraint)
}
if (errorMessage.isNotEmpty()) {
writer.writeTag(18u).write(errorMessage)
}
if (checkedValue.isNotEmpty()) {
writer.writeTag(26u).write(checkedValue)
}
if (policyType.value != 0) {
writer.writeTag(32u).write(policyType)
}
writer.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()
@BuilderDsl
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 : AbstractDeserializer() {
@JvmStatic
override fun deserialize(reader: Reader): ViolationInfo {
var constraint = ""
var errorMessage = ""
var checkedValue = ""
var policyType = PolicyType.from(0)
var unknownFields: UnknownFieldSet.Builder? = null
while (true) {
when (reader.readTag()) {
0u -> return ViolationInfo(
constraint,
errorMessage,
checkedValue,
policyType,
UnknownFieldSet.from(unknownFields)
)
10u -> constraint = reader.readString()
18u -> errorMessage = reader.readString()
26u -> checkedValue = reader.readString()
32u -> policyType = reader.readEnum(PolicyType)
else ->
unknownFields =
(unknownFields ?: UnknownFieldSet.Builder()).also {
it.add(reader.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
) : Enum() {
/**
* 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 : EnumReader {
override fun from(`value`: Int): PolicyType =
when (value) {
0 -> POLICY_TYPE_UNSPECIFIED
1 -> BOOLEAN_CONSTRAINT
2 -> LIST_CONSTRAINT
3 -> CUSTOM_CONSTRAINT
else -> UNRECOGNIZED(value)
}
}
}
}