{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AppFlow.Types.SnowflakeConnectorProfileCredentials
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AppFlow.Types.SnowflakeConnectorProfileCredentials where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The connector-specific profile credentials required when using
-- Snowflake.
--
-- /See:/ 'newSnowflakeConnectorProfileCredentials' smart constructor.
data SnowflakeConnectorProfileCredentials = SnowflakeConnectorProfileCredentials'
  { -- | The name of the user.
    SnowflakeConnectorProfileCredentials -> Text
username :: Prelude.Text,
    -- | The password that corresponds to the user name.
    SnowflakeConnectorProfileCredentials -> Sensitive Text
password :: Data.Sensitive Prelude.Text
  }
  deriving (SnowflakeConnectorProfileCredentials
-> SnowflakeConnectorProfileCredentials -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SnowflakeConnectorProfileCredentials
-> SnowflakeConnectorProfileCredentials -> Bool
$c/= :: SnowflakeConnectorProfileCredentials
-> SnowflakeConnectorProfileCredentials -> Bool
== :: SnowflakeConnectorProfileCredentials
-> SnowflakeConnectorProfileCredentials -> Bool
$c== :: SnowflakeConnectorProfileCredentials
-> SnowflakeConnectorProfileCredentials -> Bool
Prelude.Eq, Int -> SnowflakeConnectorProfileCredentials -> ShowS
[SnowflakeConnectorProfileCredentials] -> ShowS
SnowflakeConnectorProfileCredentials -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SnowflakeConnectorProfileCredentials] -> ShowS
$cshowList :: [SnowflakeConnectorProfileCredentials] -> ShowS
show :: SnowflakeConnectorProfileCredentials -> String
$cshow :: SnowflakeConnectorProfileCredentials -> String
showsPrec :: Int -> SnowflakeConnectorProfileCredentials -> ShowS
$cshowsPrec :: Int -> SnowflakeConnectorProfileCredentials -> ShowS
Prelude.Show, forall x.
Rep SnowflakeConnectorProfileCredentials x
-> SnowflakeConnectorProfileCredentials
forall x.
SnowflakeConnectorProfileCredentials
-> Rep SnowflakeConnectorProfileCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SnowflakeConnectorProfileCredentials x
-> SnowflakeConnectorProfileCredentials
$cfrom :: forall x.
SnowflakeConnectorProfileCredentials
-> Rep SnowflakeConnectorProfileCredentials x
Prelude.Generic)

-- |
-- Create a value of 'SnowflakeConnectorProfileCredentials' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'username', 'snowflakeConnectorProfileCredentials_username' - The name of the user.
--
-- 'password', 'snowflakeConnectorProfileCredentials_password' - The password that corresponds to the user name.
newSnowflakeConnectorProfileCredentials ::
  -- | 'username'
  Prelude.Text ->
  -- | 'password'
  Prelude.Text ->
  SnowflakeConnectorProfileCredentials
newSnowflakeConnectorProfileCredentials :: Text -> Text -> SnowflakeConnectorProfileCredentials
newSnowflakeConnectorProfileCredentials
  Text
pUsername_
  Text
pPassword_ =
    SnowflakeConnectorProfileCredentials'
      { $sel:username:SnowflakeConnectorProfileCredentials' :: Text
username =
          Text
pUsername_,
        $sel:password:SnowflakeConnectorProfileCredentials' :: Sensitive Text
password =
          forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pPassword_
      }

-- | The name of the user.
snowflakeConnectorProfileCredentials_username :: Lens.Lens' SnowflakeConnectorProfileCredentials Prelude.Text
snowflakeConnectorProfileCredentials_username :: Lens' SnowflakeConnectorProfileCredentials Text
snowflakeConnectorProfileCredentials_username = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnowflakeConnectorProfileCredentials' {Text
username :: Text
$sel:username:SnowflakeConnectorProfileCredentials' :: SnowflakeConnectorProfileCredentials -> Text
username} -> Text
username) (\s :: SnowflakeConnectorProfileCredentials
s@SnowflakeConnectorProfileCredentials' {} Text
a -> SnowflakeConnectorProfileCredentials
s {$sel:username:SnowflakeConnectorProfileCredentials' :: Text
username = Text
a} :: SnowflakeConnectorProfileCredentials)

-- | The password that corresponds to the user name.
snowflakeConnectorProfileCredentials_password :: Lens.Lens' SnowflakeConnectorProfileCredentials Prelude.Text
snowflakeConnectorProfileCredentials_password :: Lens' SnowflakeConnectorProfileCredentials Text
snowflakeConnectorProfileCredentials_password = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnowflakeConnectorProfileCredentials' {Sensitive Text
password :: Sensitive Text
$sel:password:SnowflakeConnectorProfileCredentials' :: SnowflakeConnectorProfileCredentials -> Sensitive Text
password} -> Sensitive Text
password) (\s :: SnowflakeConnectorProfileCredentials
s@SnowflakeConnectorProfileCredentials' {} Sensitive Text
a -> SnowflakeConnectorProfileCredentials
s {$sel:password:SnowflakeConnectorProfileCredentials' :: Sensitive Text
password = Sensitive Text
a} :: SnowflakeConnectorProfileCredentials) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

instance
  Prelude.Hashable
    SnowflakeConnectorProfileCredentials
  where
  hashWithSalt :: Int -> SnowflakeConnectorProfileCredentials -> Int
hashWithSalt
    Int
_salt
    SnowflakeConnectorProfileCredentials' {Text
Sensitive Text
password :: Sensitive Text
username :: Text
$sel:password:SnowflakeConnectorProfileCredentials' :: SnowflakeConnectorProfileCredentials -> Sensitive Text
$sel:username:SnowflakeConnectorProfileCredentials' :: SnowflakeConnectorProfileCredentials -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
username
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
password

instance
  Prelude.NFData
    SnowflakeConnectorProfileCredentials
  where
  rnf :: SnowflakeConnectorProfileCredentials -> ()
rnf SnowflakeConnectorProfileCredentials' {Text
Sensitive Text
password :: Sensitive Text
username :: Text
$sel:password:SnowflakeConnectorProfileCredentials' :: SnowflakeConnectorProfileCredentials -> Sensitive Text
$sel:username:SnowflakeConnectorProfileCredentials' :: SnowflakeConnectorProfileCredentials -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
username
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
password

instance
  Data.ToJSON
    SnowflakeConnectorProfileCredentials
  where
  toJSON :: SnowflakeConnectorProfileCredentials -> Value
toJSON SnowflakeConnectorProfileCredentials' {Text
Sensitive Text
password :: Sensitive Text
username :: Text
$sel:password:SnowflakeConnectorProfileCredentials' :: SnowflakeConnectorProfileCredentials -> Sensitive Text
$sel:username:SnowflakeConnectorProfileCredentials' :: SnowflakeConnectorProfileCredentials -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"username" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
username),
            forall a. a -> Maybe a
Prelude.Just (Key
"password" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
password)
          ]
      )