# 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.CloudKMS.V1.Model.AutokeyConfig do
  @moduledoc """
  Cloud KMS Autokey configuration for a folder.

  ## Attributes

  *   `keyProject` (*type:* `String.t`, *default:* `nil`) - Optional. Name of the key project, e.g. `projects/{PROJECT_ID}` or `projects/{PROJECT_NUMBER}`, where Cloud KMS Autokey will provision a new CryptoKey when a KeyHandle is created. On UpdateAutokeyConfig, the caller will require `cloudkms.cryptoKeys.setIamPolicy` permission on this key project. Once configured, for Cloud KMS Autokey to function properly, this key project must have the Cloud KMS API activated and the Cloud KMS Service Agent for this key project must be granted the `cloudkms.admin` role (or pertinent permissions). A request with an empty key project field will clear the configuration.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Identifier. Name of the AutokeyConfig resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig`.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. The state for the AutokeyConfig.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :keyProject => String.t() | nil,
          :name => String.t() | nil,
          :state => String.t() | nil
        }

  field(:keyProject)
  field(:name)
  field(:state)
end

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

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