# 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.CloudDeploy.V1.Model.DeployPolicyEvaluationEvent do
  @moduledoc """
  Payload proto for "clouddeploy.googleapis.com/deploypolicy_evaluation" Platform Log event that describes the deploy policy evaluation event.

  ## Attributes

  *   `allowed` (*type:* `boolean()`, *default:* `nil`) - Whether the request is allowed. Allowed is set as true if: (1) the request complies with the policy; or (2) the request doesn't comply with the policy but the policy was overridden; or (3) the request doesn't comply with the policy but the policy was suspended
  *   `deliveryPipeline` (*type:* `String.t`, *default:* `nil`) - The name of the `Delivery Pipeline`.
  *   `deployPolicy` (*type:* `String.t`, *default:* `nil`) - The name of the `DeployPolicy`.
  *   `deployPolicyUid` (*type:* `String.t`, *default:* `nil`) - Unique identifier of the `DeployPolicy`.
  *   `invoker` (*type:* `String.t`, *default:* `nil`) - What invoked the action (e.g. a user or automation).
  *   `message` (*type:* `String.t`, *default:* `nil`) - Debug message for when a deploy policy event occurs.
  *   `overrides` (*type:* `list(String.t)`, *default:* `nil`) - Things that could have overridden the policy verdict. Overrides together with verdict decide whether the request is allowed.
  *   `pipelineUid` (*type:* `String.t`, *default:* `nil`) - Unique identifier of the `Delivery Pipeline`.
  *   `rule` (*type:* `String.t`, *default:* `nil`) - Rule id.
  *   `ruleType` (*type:* `String.t`, *default:* `nil`) - Rule type (e.g. Restrict Rollouts).
  *   `target` (*type:* `String.t`, *default:* `nil`) - The name of the `Target`. This is an optional field, as a `Target` may not always be applicable to a policy.
  *   `targetUid` (*type:* `String.t`, *default:* `nil`) - Unique identifier of the `Target`. This is an optional field, as a `Target` may not always be applicable to a policy.
  *   `verdict` (*type:* `String.t`, *default:* `nil`) - The policy verdict of the request.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :allowed => boolean() | nil,
          :deliveryPipeline => String.t() | nil,
          :deployPolicy => String.t() | nil,
          :deployPolicyUid => String.t() | nil,
          :invoker => String.t() | nil,
          :message => String.t() | nil,
          :overrides => list(String.t()) | nil,
          :pipelineUid => String.t() | nil,
          :rule => String.t() | nil,
          :ruleType => String.t() | nil,
          :target => String.t() | nil,
          :targetUid => String.t() | nil,
          :verdict => String.t() | nil
        }

  field(:allowed)
  field(:deliveryPipeline)
  field(:deployPolicy)
  field(:deployPolicyUid)
  field(:invoker)
  field(:message)
  field(:overrides, type: :list)
  field(:pipelineUid)
  field(:rule)
  field(:ruleType)
  field(:target)
  field(:targetUid)
  field(:verdict)
end

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

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