# 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.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaAuthConfig do
  @moduledoc """
  The AuthConfig resource use to hold channels and connection config data.

  ## Attributes

  *   `certificateId` (*type:* `String.t`, *default:* `nil`) - Certificate id for client certificate
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The timestamp when the auth config is created.
  *   `creatorEmail` (*type:* `String.t`, *default:* `nil`) - The creator's email address. Generated based on the End User Credentials/LOAS role of the user making the call.
  *   `credentialType` (*type:* `String.t`, *default:* `nil`) - Credential type of the encrypted credential.
  *   `decryptedCredential` (*type:* `GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaCredential.t`, *default:* `nil`) - Raw auth credentials.
  *   `description` (*type:* `String.t`, *default:* `nil`) - A description of the auth config.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Required. The name of the auth config.
  *   `encryptedCredential` (*type:* `String.t`, *default:* `nil`) - Auth credential encrypted by Cloud KMS. Can be decrypted as Credential with proper KMS key.
  *   `expiryNotificationDuration` (*type:* `list(String.t)`, *default:* `nil`) - User can define the time to receive notification after which the auth config becomes invalid. Support up to 30 days. Support granularity in hours.
  *   `lastModifierEmail` (*type:* `String.t`, *default:* `nil`) - The last modifier's email address. Generated based on the End User Credentials/LOAS role of the user making the call.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Resource name of the auth config. For more information, see Manage authentication profiles. projects/{project}/locations/{location}/authConfigs/{authConfig}.
  *   `overrideValidTime` (*type:* `DateTime.t`, *default:* `nil`) - User provided expiry time to override. For the example of Salesforce, username/password credentials can be valid for 6 months depending on the instance settings.
  *   `reason` (*type:* `String.t`, *default:* `nil`) - The reason / details of the current status.
  *   `state` (*type:* `String.t`, *default:* `nil`) - The status of the auth config.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The timestamp when the auth config is modified.
  *   `validTime` (*type:* `DateTime.t`, *default:* `nil`) - The time until the auth config is valid. Empty or max value is considered the auth config won't expire.
  *   `visibility` (*type:* `String.t`, *default:* `nil`) - The visibility of the auth config.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :certificateId => String.t() | nil,
          :createTime => DateTime.t() | nil,
          :creatorEmail => String.t() | nil,
          :credentialType => String.t() | nil,
          :decryptedCredential =>
            GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaCredential.t()
            | nil,
          :description => String.t() | nil,
          :displayName => String.t() | nil,
          :encryptedCredential => String.t() | nil,
          :expiryNotificationDuration => list(String.t()) | nil,
          :lastModifierEmail => String.t() | nil,
          :name => String.t() | nil,
          :overrideValidTime => DateTime.t() | nil,
          :reason => String.t() | nil,
          :state => String.t() | nil,
          :updateTime => DateTime.t() | nil,
          :validTime => DateTime.t() | nil,
          :visibility => String.t() | nil
        }

  field(:certificateId)
  field(:createTime, as: DateTime)
  field(:creatorEmail)
  field(:credentialType)

  field(:decryptedCredential,
    as: GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaCredential
  )

  field(:description)
  field(:displayName)
  field(:encryptedCredential)
  field(:expiryNotificationDuration, type: :list)
  field(:lastModifierEmail)
  field(:name)
  field(:overrideValidTime, as: DateTime)
  field(:reason)
  field(:state)
  field(:updateTime, as: DateTime)
  field(:validTime, as: DateTime)
  field(:visibility)
end

defimpl Poison.Decoder,
  for: GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaAuthConfig do
  def decode(value, options) do
    GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaAuthConfig.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaAuthConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
