# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.SecurityCenter.V1.Model.GoogleCloudSecuritycenterV1CustomConfig do
  @moduledoc """
  Defines the properties in a custom module configuration for Security Health Analytics. Use the custom module configuration to create custom detectors that generate custom findings for resources that you specify.

  ## Attributes

  *   `customOutput` (*type:* `GoogleApi.SecurityCenter.V1.Model.GoogleCloudSecuritycenterV1CustomOutputSpec.t`, *default:* `nil`) - Custom output properties.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Text that describes the vulnerability or misconfiguration that the custom module detects. This explanation is returned with each finding instance to help investigators understand the detected issue. The text must be enclosed in quotation marks.
  *   `predicate` (*type:* `GoogleApi.SecurityCenter.V1.Model.Expr.t`, *default:* `nil`) - The CEL expression to evaluate to produce findings. When the expression evaluates to true against a resource, a finding is generated.
  *   `recommendation` (*type:* `String.t`, *default:* `nil`) - An explanation of the recommended steps that security teams can take to resolve the detected issue. This explanation is returned with each finding generated by this module in the `nextSteps` property of the finding JSON.
  *   `resourceSelector` (*type:* `GoogleApi.SecurityCenter.V1.Model.GoogleCloudSecuritycenterV1ResourceSelector.t`, *default:* `nil`) - The resource types that the custom module operates on. Each custom module can specify up to 5 resource types.
  *   `severity` (*type:* `String.t`, *default:* `nil`) - The severity to assign to findings generated by the module.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :customOutput =>
            GoogleApi.SecurityCenter.V1.Model.GoogleCloudSecuritycenterV1CustomOutputSpec.t()
            | nil,
          :description => String.t() | nil,
          :predicate => GoogleApi.SecurityCenter.V1.Model.Expr.t() | nil,
          :recommendation => String.t() | nil,
          :resourceSelector =>
            GoogleApi.SecurityCenter.V1.Model.GoogleCloudSecuritycenterV1ResourceSelector.t()
            | nil,
          :severity => String.t() | nil
        }

  field(:customOutput,
    as: GoogleApi.SecurityCenter.V1.Model.GoogleCloudSecuritycenterV1CustomOutputSpec
  )

  field(:description)
  field(:predicate, as: GoogleApi.SecurityCenter.V1.Model.Expr)
  field(:recommendation)

  field(:resourceSelector,
    as: GoogleApi.SecurityCenter.V1.Model.GoogleCloudSecuritycenterV1ResourceSelector
  )

  field(:severity)
end

defimpl Poison.Decoder,
  for: GoogleApi.SecurityCenter.V1.Model.GoogleCloudSecuritycenterV1CustomConfig do
  def decode(value, options) do
    GoogleApi.SecurityCenter.V1.Model.GoogleCloudSecuritycenterV1CustomConfig.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.SecurityCenter.V1.Model.GoogleCloudSecuritycenterV1CustomConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
