# 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.KeyHandle do
  @moduledoc """
  Resource-oriented representation of a request to Cloud KMS Autokey and the resulting provisioning of a CryptoKey.

  ## Attributes

  *   `kmsKey` (*type:* `String.t`, *default:* `nil`) - Output only. Name of a CryptoKey that has been provisioned for Customer Managed Encryption Key (CMEK) use in the KeyHandle project and location for the requested resource type. The CryptoKey project will reflect the value configured in the AutokeyConfig on the resource project's ancestor folder at the time of the KeyHandle creation. If more than one ancestor folder has a configured AutokeyConfig, the nearest of these configurations is used.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Identifier. Name of the KeyHandle resource, e.g. `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
  *   `resourceTypeSelector` (*type:* `String.t`, *default:* `nil`) - Required. Indicates the resource type that the resulting CryptoKey is meant to protect, e.g. `{SERVICE}.googleapis.com/{TYPE}`. See documentation for supported resource types.
  """

  use GoogleApi.Gax.ModelBase

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

  field(:kmsKey)
  field(:name)
  field(:resourceTypeSelector)
end

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

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