# 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.GoogleCloudSecuritycenterV2SecurityPosture do
  @moduledoc """
  Represents a posture that is deployed on Google Cloud by the Security Command Center Posture Management service. A posture contains one or more policy sets. A policy set is a group of policies that enforce a set of security rules on Google Cloud.

  ## Attributes

  *   `changedPolicy` (*type:* `String.t`, *default:* `nil`) - The name of the updated policy, for example, `projects/{project_id}/policies/{constraint_name}`.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Name of the posture, for example, `CIS-Posture`.
  *   `policy` (*type:* `String.t`, *default:* `nil`) - The ID of the updated policy, for example, `compute-policy-1`.
  *   `policyDriftDetails` (*type:* `list(GoogleApi.SecurityCenter.V1.Model.GoogleCloudSecuritycenterV2PolicyDriftDetails.t)`, *default:* `nil`) - The details about a change in an updated policy that violates the deployed posture.
  *   `policySet` (*type:* `String.t`, *default:* `nil`) - The name of the updated policy set, for example, `cis-policyset`.
  *   `postureDeployment` (*type:* `String.t`, *default:* `nil`) - The name of the posture deployment, for example, `organizations/{org_id}/posturedeployments/{posture_deployment_id}`.
  *   `postureDeploymentResource` (*type:* `String.t`, *default:* `nil`) - The project, folder, or organization on which the posture is deployed, for example, `projects/{project_number}`.
  *   `revisionId` (*type:* `String.t`, *default:* `nil`) - The version of the posture, for example, `c7cfa2a8`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :changedPolicy => String.t() | nil,
          :name => String.t() | nil,
          :policy => String.t() | nil,
          :policyDriftDetails =>
            list(
              GoogleApi.SecurityCenter.V1.Model.GoogleCloudSecuritycenterV2PolicyDriftDetails.t()
            )
            | nil,
          :policySet => String.t() | nil,
          :postureDeployment => String.t() | nil,
          :postureDeploymentResource => String.t() | nil,
          :revisionId => String.t() | nil
        }

  field(:changedPolicy)
  field(:name)
  field(:policy)

  field(:policyDriftDetails,
    as: GoogleApi.SecurityCenter.V1.Model.GoogleCloudSecuritycenterV2PolicyDriftDetails,
    type: :list
  )

  field(:policySet)
  field(:postureDeployment)
  field(:postureDeploymentResource)
  field(:revisionId)
end

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

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