# 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.GoogleCloudIntegrationsV1alphaCredential do
  @moduledoc """
  Defines parameters for a single, canonical credential.

  ## Attributes

  *   `authToken` (*type:* `GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaAuthToken.t`, *default:* `nil`) - Auth token credential
  *   `credentialType` (*type:* `String.t`, *default:* `nil`) - Credential type associated with auth config.
  *   `jwt` (*type:* `GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaJwt.t`, *default:* `nil`) - JWT credential
  *   `oauth2AuthorizationCode` (*type:* `GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaOAuth2AuthorizationCode.t`, *default:* `nil`) - The api_key and oauth2_implicit are not covered in v1 and will be picked up once v1 is implemented. ApiKey api_key = 3; OAuth2 authorization code credential
  *   `oauth2ClientCredentials` (*type:* `GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaOAuth2ClientCredentials.t`, *default:* `nil`) - OAuth2Implicit oauth2_implicit = 5; OAuth2 client credentials
  *   `oauth2ResourceOwnerCredentials` (*type:* `GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaOAuth2ResourceOwnerCredentials.t`, *default:* `nil`) - OAuth2 resource owner credentials
  *   `oidcToken` (*type:* `GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaOidcToken.t`, *default:* `nil`) - Google OIDC ID Token
  *   `serviceAccountCredentials` (*type:* `GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaServiceAccountCredentials.t`, *default:* `nil`) - Service account credential
  *   `usernameAndPassword` (*type:* `GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaUsernameAndPassword.t`, *default:* `nil`) - Username and password credential
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :authToken =>
            GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaAuthToken.t() | nil,
          :credentialType => String.t() | nil,
          :jwt =>
            GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaJwt.t() | nil,
          :oauth2AuthorizationCode =>
            GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaOAuth2AuthorizationCode.t()
            | nil,
          :oauth2ClientCredentials =>
            GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaOAuth2ClientCredentials.t()
            | nil,
          :oauth2ResourceOwnerCredentials =>
            GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaOAuth2ResourceOwnerCredentials.t()
            | nil,
          :oidcToken =>
            GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaOidcToken.t() | nil,
          :serviceAccountCredentials =>
            GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaServiceAccountCredentials.t()
            | nil,
          :usernameAndPassword =>
            GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaUsernameAndPassword.t()
            | nil
        }

  field(:authToken,
    as: GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaAuthToken
  )

  field(:credentialType)
  field(:jwt, as: GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaJwt)

  field(:oauth2AuthorizationCode,
    as: GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaOAuth2AuthorizationCode
  )

  field(:oauth2ClientCredentials,
    as: GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaOAuth2ClientCredentials
  )

  field(:oauth2ResourceOwnerCredentials,
    as:
      GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaOAuth2ResourceOwnerCredentials
  )

  field(:oidcToken,
    as: GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaOidcToken
  )

  field(:serviceAccountCredentials,
    as:
      GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaServiceAccountCredentials
  )

  field(:usernameAndPassword,
    as: GoogleApi.Integrations.V1alpha.Model.GoogleCloudIntegrationsV1alphaUsernameAndPassword
  )
end

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

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