{-# 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.QuickSight.Types.SnowflakeParameters
-- 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.QuickSight.Types.SnowflakeParameters where

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

-- | The parameters for Snowflake.
--
-- /See:/ 'newSnowflakeParameters' smart constructor.
data SnowflakeParameters = SnowflakeParameters'
  { -- | Host.
    SnowflakeParameters -> Text
host :: Prelude.Text,
    -- | Database.
    SnowflakeParameters -> Text
database :: Prelude.Text,
    -- | Warehouse.
    SnowflakeParameters -> Text
warehouse :: Prelude.Text
  }
  deriving (SnowflakeParameters -> SnowflakeParameters -> Bool
(SnowflakeParameters -> SnowflakeParameters -> Bool)
-> (SnowflakeParameters -> SnowflakeParameters -> Bool)
-> Eq SnowflakeParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SnowflakeParameters -> SnowflakeParameters -> Bool
$c/= :: SnowflakeParameters -> SnowflakeParameters -> Bool
== :: SnowflakeParameters -> SnowflakeParameters -> Bool
$c== :: SnowflakeParameters -> SnowflakeParameters -> Bool
Prelude.Eq, ReadPrec [SnowflakeParameters]
ReadPrec SnowflakeParameters
Int -> ReadS SnowflakeParameters
ReadS [SnowflakeParameters]
(Int -> ReadS SnowflakeParameters)
-> ReadS [SnowflakeParameters]
-> ReadPrec SnowflakeParameters
-> ReadPrec [SnowflakeParameters]
-> Read SnowflakeParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SnowflakeParameters]
$creadListPrec :: ReadPrec [SnowflakeParameters]
readPrec :: ReadPrec SnowflakeParameters
$creadPrec :: ReadPrec SnowflakeParameters
readList :: ReadS [SnowflakeParameters]
$creadList :: ReadS [SnowflakeParameters]
readsPrec :: Int -> ReadS SnowflakeParameters
$creadsPrec :: Int -> ReadS SnowflakeParameters
Prelude.Read, Int -> SnowflakeParameters -> ShowS
[SnowflakeParameters] -> ShowS
SnowflakeParameters -> String
(Int -> SnowflakeParameters -> ShowS)
-> (SnowflakeParameters -> String)
-> ([SnowflakeParameters] -> ShowS)
-> Show SnowflakeParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SnowflakeParameters] -> ShowS
$cshowList :: [SnowflakeParameters] -> ShowS
show :: SnowflakeParameters -> String
$cshow :: SnowflakeParameters -> String
showsPrec :: Int -> SnowflakeParameters -> ShowS
$cshowsPrec :: Int -> SnowflakeParameters -> ShowS
Prelude.Show, (forall x. SnowflakeParameters -> Rep SnowflakeParameters x)
-> (forall x. Rep SnowflakeParameters x -> SnowflakeParameters)
-> Generic SnowflakeParameters
forall x. Rep SnowflakeParameters x -> SnowflakeParameters
forall x. SnowflakeParameters -> Rep SnowflakeParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SnowflakeParameters x -> SnowflakeParameters
$cfrom :: forall x. SnowflakeParameters -> Rep SnowflakeParameters x
Prelude.Generic)

-- |
-- Create a value of 'SnowflakeParameters' 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:
--
-- 'host', 'snowflakeParameters_host' - Host.
--
-- 'database', 'snowflakeParameters_database' - Database.
--
-- 'warehouse', 'snowflakeParameters_warehouse' - Warehouse.
newSnowflakeParameters ::
  -- | 'host'
  Prelude.Text ->
  -- | 'database'
  Prelude.Text ->
  -- | 'warehouse'
  Prelude.Text ->
  SnowflakeParameters
newSnowflakeParameters :: Text -> Text -> Text -> SnowflakeParameters
newSnowflakeParameters Text
pHost_ Text
pDatabase_ Text
pWarehouse_ =
  SnowflakeParameters' :: Text -> Text -> Text -> SnowflakeParameters
SnowflakeParameters'
    { $sel:host:SnowflakeParameters' :: Text
host = Text
pHost_,
      $sel:database:SnowflakeParameters' :: Text
database = Text
pDatabase_,
      $sel:warehouse:SnowflakeParameters' :: Text
warehouse = Text
pWarehouse_
    }

-- | Host.
snowflakeParameters_host :: Lens.Lens' SnowflakeParameters Prelude.Text
snowflakeParameters_host :: (Text -> f Text) -> SnowflakeParameters -> f SnowflakeParameters
snowflakeParameters_host = (SnowflakeParameters -> Text)
-> (SnowflakeParameters -> Text -> SnowflakeParameters)
-> Lens SnowflakeParameters SnowflakeParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnowflakeParameters' {Text
host :: Text
$sel:host:SnowflakeParameters' :: SnowflakeParameters -> Text
host} -> Text
host) (\s :: SnowflakeParameters
s@SnowflakeParameters' {} Text
a -> SnowflakeParameters
s {$sel:host:SnowflakeParameters' :: Text
host = Text
a} :: SnowflakeParameters)

-- | Database.
snowflakeParameters_database :: Lens.Lens' SnowflakeParameters Prelude.Text
snowflakeParameters_database :: (Text -> f Text) -> SnowflakeParameters -> f SnowflakeParameters
snowflakeParameters_database = (SnowflakeParameters -> Text)
-> (SnowflakeParameters -> Text -> SnowflakeParameters)
-> Lens SnowflakeParameters SnowflakeParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnowflakeParameters' {Text
database :: Text
$sel:database:SnowflakeParameters' :: SnowflakeParameters -> Text
database} -> Text
database) (\s :: SnowflakeParameters
s@SnowflakeParameters' {} Text
a -> SnowflakeParameters
s {$sel:database:SnowflakeParameters' :: Text
database = Text
a} :: SnowflakeParameters)

-- | Warehouse.
snowflakeParameters_warehouse :: Lens.Lens' SnowflakeParameters Prelude.Text
snowflakeParameters_warehouse :: (Text -> f Text) -> SnowflakeParameters -> f SnowflakeParameters
snowflakeParameters_warehouse = (SnowflakeParameters -> Text)
-> (SnowflakeParameters -> Text -> SnowflakeParameters)
-> Lens SnowflakeParameters SnowflakeParameters Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SnowflakeParameters' {Text
warehouse :: Text
$sel:warehouse:SnowflakeParameters' :: SnowflakeParameters -> Text
warehouse} -> Text
warehouse) (\s :: SnowflakeParameters
s@SnowflakeParameters' {} Text
a -> SnowflakeParameters
s {$sel:warehouse:SnowflakeParameters' :: Text
warehouse = Text
a} :: SnowflakeParameters)

instance Core.FromJSON SnowflakeParameters where
  parseJSON :: Value -> Parser SnowflakeParameters
parseJSON =
    String
-> (Object -> Parser SnowflakeParameters)
-> Value
-> Parser SnowflakeParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SnowflakeParameters"
      ( \Object
x ->
          Text -> Text -> Text -> SnowflakeParameters
SnowflakeParameters'
            (Text -> Text -> Text -> SnowflakeParameters)
-> Parser Text -> Parser (Text -> Text -> SnowflakeParameters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Host")
            Parser (Text -> Text -> SnowflakeParameters)
-> Parser Text -> Parser (Text -> SnowflakeParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Database")
            Parser (Text -> SnowflakeParameters)
-> Parser Text -> Parser SnowflakeParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Warehouse")
      )

instance Prelude.Hashable SnowflakeParameters

instance Prelude.NFData SnowflakeParameters

instance Core.ToJSON SnowflakeParameters where
  toJSON :: SnowflakeParameters -> Value
toJSON SnowflakeParameters' {Text
warehouse :: Text
database :: Text
host :: Text
$sel:warehouse:SnowflakeParameters' :: SnowflakeParameters -> Text
$sel:database:SnowflakeParameters' :: SnowflakeParameters -> Text
$sel:host:SnowflakeParameters' :: SnowflakeParameters -> 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
"Host" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
host),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Database" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
database),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Warehouse" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
warehouse)
          ]
      )