use serde::{Deserialize, Serialize}; /*
                                      * Service Control API
                                      *
                                      * Provides admission control and telemetry reporting for services integrated with Service Infrastructure.
                                      *
                                      * The version of the OpenAPI document: v1
                                      *
                                      * Generated by: https://openapi-generator.tech
                                      */

use crate::google_rest_apis::servicecontrol_v1::models;

/// AuditLog : Common audit log format for Google Cloud Platform API operations.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AuditLog {
    #[serde(rename = "authenticationInfo", skip_serializing_if = "Option::is_none")]
    pub authentication_info: Option<Box<models::AuthenticationInfo>>,
    /// Authorization information. If there are multiple resources or permissions involved, then there is one AuthorizationInfo element for each {resource, permission} tuple.
    #[serde(rename = "authorizationInfo", skip_serializing_if = "Option::is_none")]
    pub authorization_info: Option<Vec<models::AuthorizationInfo>>,
    /// Other service-specific data about the request, response, and other information associated with the current audited event.
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// 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\"
    #[serde(rename = "methodName", skip_serializing_if = "Option::is_none")]
    pub method_name: Option<String>,
    /// The number of items returned from a List or Query API method, if applicable.
    #[serde(rename = "numResponseItems", skip_serializing_if = "Option::is_none")]
    pub num_response_items: Option<String>,
    #[serde(
        rename = "policyViolationInfo",
        skip_serializing_if = "Option::is_none"
    )]
    pub policy_violation_info: Option<Box<models::PolicyViolationInfo>>,
    /// 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.
    #[serde(rename = "request", skip_serializing_if = "Option::is_none")]
    pub request: Option<std::collections::HashMap<String, serde_json::Value>>,
    #[serde(rename = "requestMetadata", skip_serializing_if = "Option::is_none")]
    pub request_metadata: Option<Box<models::RequestMetadata>>,
    #[serde(rename = "resourceLocation", skip_serializing_if = "Option::is_none")]
    pub resource_location: Option<Box<models::ResourceLocation>>,
    /// 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\"
    #[serde(rename = "resourceName", skip_serializing_if = "Option::is_none")]
    pub resource_name: Option<String>,
    /// 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.
    #[serde(
        rename = "resourceOriginalState",
        skip_serializing_if = "Option::is_none"
    )]
    pub resource_original_state: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// 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.
    #[serde(rename = "response", skip_serializing_if = "Option::is_none")]
    pub response: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// Deprecated. Use the `metadata` field instead. Other service-specific data about the request, response, and other activities.
    #[serde(rename = "serviceData", skip_serializing_if = "Option::is_none")]
    pub service_data: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// The name of the API service performing the operation. For example, `\"compute.googleapis.com\"`.
    #[serde(rename = "serviceName", skip_serializing_if = "Option::is_none")]
    pub service_name: Option<String>,
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Box<models::Status>>,
}

impl AuditLog {
    /// Common audit log format for Google Cloud Platform API operations.
    pub fn new() -> AuditLog {
        AuditLog {
            authentication_info: None,
            authorization_info: None,
            metadata: None,
            method_name: None,
            num_response_items: None,
            policy_violation_info: None,
            request: None,
            request_metadata: None,
            resource_location: None,
            resource_name: None,
            resource_original_state: None,
            response: None,
            service_data: None,
            service_name: None,
            status: None,
        }
    }
}
