{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AppFlow.Types.SnowflakeConnectorProfileCredentials where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 :: Core.Sensitive Prelude.Text
  }
  deriving (SnowflakeConnectorProfileCredentials
-> SnowflakeConnectorProfileCredentials -> Bool
(SnowflakeConnectorProfileCredentials
 -> SnowflakeConnectorProfileCredentials -> Bool)
-> (SnowflakeConnectorProfileCredentials
    -> SnowflakeConnectorProfileCredentials -> Bool)
-> Eq SnowflakeConnectorProfileCredentials
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
(Int -> SnowflakeConnectorProfileCredentials -> ShowS)
-> (SnowflakeConnectorProfileCredentials -> String)
-> ([SnowflakeConnectorProfileCredentials] -> ShowS)
-> Show SnowflakeConnectorProfileCredentials
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.
 SnowflakeConnectorProfileCredentials
 -> Rep SnowflakeConnectorProfileCredentials x)
-> (forall x.
    Rep SnowflakeConnectorProfileCredentials x
    -> SnowflakeConnectorProfileCredentials)
-> Generic SnowflakeConnectorProfileCredentials
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' :: Text -> Sensitive Text -> SnowflakeConnectorProfileCredentials
SnowflakeConnectorProfileCredentials'
      { $sel:username:SnowflakeConnectorProfileCredentials' :: Text
username =
          Text
pUsername_,
        $sel:password:SnowflakeConnectorProfileCredentials' :: Sensitive Text
password =
          Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
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 :: (Text -> f Text)
-> SnowflakeConnectorProfileCredentials
-> f SnowflakeConnectorProfileCredentials
snowflakeConnectorProfileCredentials_username = (SnowflakeConnectorProfileCredentials -> Text)
-> (SnowflakeConnectorProfileCredentials
    -> Text -> SnowflakeConnectorProfileCredentials)
-> Lens
     SnowflakeConnectorProfileCredentials
     SnowflakeConnectorProfileCredentials
     Text
     Text
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 :: (Text -> f Text)
-> SnowflakeConnectorProfileCredentials
-> f SnowflakeConnectorProfileCredentials
snowflakeConnectorProfileCredentials_password = (SnowflakeConnectorProfileCredentials -> Sensitive Text)
-> (SnowflakeConnectorProfileCredentials
    -> Sensitive Text -> SnowflakeConnectorProfileCredentials)
-> Lens
     SnowflakeConnectorProfileCredentials
     SnowflakeConnectorProfileCredentials
     (Sensitive Text)
     (Sensitive Text)
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) ((Sensitive Text -> f (Sensitive Text))
 -> SnowflakeConnectorProfileCredentials
 -> f SnowflakeConnectorProfileCredentials)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> SnowflakeConnectorProfileCredentials
-> f SnowflakeConnectorProfileCredentials
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance
  Prelude.Hashable
    SnowflakeConnectorProfileCredentials

instance
  Prelude.NFData
    SnowflakeConnectorProfileCredentials

instance
  Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"username" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
username),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"password" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
password)
          ]
      )