{-# 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.MachineLearning.Types.RedshiftMetadata
-- 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.MachineLearning.Types.RedshiftMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MachineLearning.Types.RedshiftDatabase
import qualified Amazonka.Prelude as Prelude

-- | Describes the @DataSource@ details specific to Amazon Redshift.
--
-- /See:/ 'newRedshiftMetadata' smart constructor.
data RedshiftMetadata = RedshiftMetadata'
  { -- | The SQL query that is specified during CreateDataSourceFromRedshift.
    -- Returns only if @Verbose@ is true in GetDataSourceInput.
    RedshiftMetadata -> Maybe Text
selectSqlQuery :: Prelude.Maybe Prelude.Text,
    RedshiftMetadata -> Maybe RedshiftDatabase
redshiftDatabase :: Prelude.Maybe RedshiftDatabase,
    RedshiftMetadata -> Maybe Text
databaseUserName :: Prelude.Maybe Prelude.Text
  }
  deriving (RedshiftMetadata -> RedshiftMetadata -> Bool
(RedshiftMetadata -> RedshiftMetadata -> Bool)
-> (RedshiftMetadata -> RedshiftMetadata -> Bool)
-> Eq RedshiftMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RedshiftMetadata -> RedshiftMetadata -> Bool
$c/= :: RedshiftMetadata -> RedshiftMetadata -> Bool
== :: RedshiftMetadata -> RedshiftMetadata -> Bool
$c== :: RedshiftMetadata -> RedshiftMetadata -> Bool
Prelude.Eq, ReadPrec [RedshiftMetadata]
ReadPrec RedshiftMetadata
Int -> ReadS RedshiftMetadata
ReadS [RedshiftMetadata]
(Int -> ReadS RedshiftMetadata)
-> ReadS [RedshiftMetadata]
-> ReadPrec RedshiftMetadata
-> ReadPrec [RedshiftMetadata]
-> Read RedshiftMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RedshiftMetadata]
$creadListPrec :: ReadPrec [RedshiftMetadata]
readPrec :: ReadPrec RedshiftMetadata
$creadPrec :: ReadPrec RedshiftMetadata
readList :: ReadS [RedshiftMetadata]
$creadList :: ReadS [RedshiftMetadata]
readsPrec :: Int -> ReadS RedshiftMetadata
$creadsPrec :: Int -> ReadS RedshiftMetadata
Prelude.Read, Int -> RedshiftMetadata -> ShowS
[RedshiftMetadata] -> ShowS
RedshiftMetadata -> String
(Int -> RedshiftMetadata -> ShowS)
-> (RedshiftMetadata -> String)
-> ([RedshiftMetadata] -> ShowS)
-> Show RedshiftMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RedshiftMetadata] -> ShowS
$cshowList :: [RedshiftMetadata] -> ShowS
show :: RedshiftMetadata -> String
$cshow :: RedshiftMetadata -> String
showsPrec :: Int -> RedshiftMetadata -> ShowS
$cshowsPrec :: Int -> RedshiftMetadata -> ShowS
Prelude.Show, (forall x. RedshiftMetadata -> Rep RedshiftMetadata x)
-> (forall x. Rep RedshiftMetadata x -> RedshiftMetadata)
-> Generic RedshiftMetadata
forall x. Rep RedshiftMetadata x -> RedshiftMetadata
forall x. RedshiftMetadata -> Rep RedshiftMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RedshiftMetadata x -> RedshiftMetadata
$cfrom :: forall x. RedshiftMetadata -> Rep RedshiftMetadata x
Prelude.Generic)

-- |
-- Create a value of 'RedshiftMetadata' 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:
--
-- 'selectSqlQuery', 'redshiftMetadata_selectSqlQuery' - The SQL query that is specified during CreateDataSourceFromRedshift.
-- Returns only if @Verbose@ is true in GetDataSourceInput.
--
-- 'redshiftDatabase', 'redshiftMetadata_redshiftDatabase' - Undocumented member.
--
-- 'databaseUserName', 'redshiftMetadata_databaseUserName' - Undocumented member.
newRedshiftMetadata ::
  RedshiftMetadata
newRedshiftMetadata :: RedshiftMetadata
newRedshiftMetadata =
  RedshiftMetadata' :: Maybe Text
-> Maybe RedshiftDatabase -> Maybe Text -> RedshiftMetadata
RedshiftMetadata'
    { $sel:selectSqlQuery:RedshiftMetadata' :: Maybe Text
selectSqlQuery = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:redshiftDatabase:RedshiftMetadata' :: Maybe RedshiftDatabase
redshiftDatabase = Maybe RedshiftDatabase
forall a. Maybe a
Prelude.Nothing,
      $sel:databaseUserName:RedshiftMetadata' :: Maybe Text
databaseUserName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The SQL query that is specified during CreateDataSourceFromRedshift.
-- Returns only if @Verbose@ is true in GetDataSourceInput.
redshiftMetadata_selectSqlQuery :: Lens.Lens' RedshiftMetadata (Prelude.Maybe Prelude.Text)
redshiftMetadata_selectSqlQuery :: (Maybe Text -> f (Maybe Text))
-> RedshiftMetadata -> f RedshiftMetadata
redshiftMetadata_selectSqlQuery = (RedshiftMetadata -> Maybe Text)
-> (RedshiftMetadata -> Maybe Text -> RedshiftMetadata)
-> Lens RedshiftMetadata RedshiftMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RedshiftMetadata' {Maybe Text
selectSqlQuery :: Maybe Text
$sel:selectSqlQuery:RedshiftMetadata' :: RedshiftMetadata -> Maybe Text
selectSqlQuery} -> Maybe Text
selectSqlQuery) (\s :: RedshiftMetadata
s@RedshiftMetadata' {} Maybe Text
a -> RedshiftMetadata
s {$sel:selectSqlQuery:RedshiftMetadata' :: Maybe Text
selectSqlQuery = Maybe Text
a} :: RedshiftMetadata)

-- | Undocumented member.
redshiftMetadata_redshiftDatabase :: Lens.Lens' RedshiftMetadata (Prelude.Maybe RedshiftDatabase)
redshiftMetadata_redshiftDatabase :: (Maybe RedshiftDatabase -> f (Maybe RedshiftDatabase))
-> RedshiftMetadata -> f RedshiftMetadata
redshiftMetadata_redshiftDatabase = (RedshiftMetadata -> Maybe RedshiftDatabase)
-> (RedshiftMetadata -> Maybe RedshiftDatabase -> RedshiftMetadata)
-> Lens
     RedshiftMetadata
     RedshiftMetadata
     (Maybe RedshiftDatabase)
     (Maybe RedshiftDatabase)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RedshiftMetadata' {Maybe RedshiftDatabase
redshiftDatabase :: Maybe RedshiftDatabase
$sel:redshiftDatabase:RedshiftMetadata' :: RedshiftMetadata -> Maybe RedshiftDatabase
redshiftDatabase} -> Maybe RedshiftDatabase
redshiftDatabase) (\s :: RedshiftMetadata
s@RedshiftMetadata' {} Maybe RedshiftDatabase
a -> RedshiftMetadata
s {$sel:redshiftDatabase:RedshiftMetadata' :: Maybe RedshiftDatabase
redshiftDatabase = Maybe RedshiftDatabase
a} :: RedshiftMetadata)

-- | Undocumented member.
redshiftMetadata_databaseUserName :: Lens.Lens' RedshiftMetadata (Prelude.Maybe Prelude.Text)
redshiftMetadata_databaseUserName :: (Maybe Text -> f (Maybe Text))
-> RedshiftMetadata -> f RedshiftMetadata
redshiftMetadata_databaseUserName = (RedshiftMetadata -> Maybe Text)
-> (RedshiftMetadata -> Maybe Text -> RedshiftMetadata)
-> Lens RedshiftMetadata RedshiftMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RedshiftMetadata' {Maybe Text
databaseUserName :: Maybe Text
$sel:databaseUserName:RedshiftMetadata' :: RedshiftMetadata -> Maybe Text
databaseUserName} -> Maybe Text
databaseUserName) (\s :: RedshiftMetadata
s@RedshiftMetadata' {} Maybe Text
a -> RedshiftMetadata
s {$sel:databaseUserName:RedshiftMetadata' :: Maybe Text
databaseUserName = Maybe Text
a} :: RedshiftMetadata)

instance Core.FromJSON RedshiftMetadata where
  parseJSON :: Value -> Parser RedshiftMetadata
parseJSON =
    String
-> (Object -> Parser RedshiftMetadata)
-> Value
-> Parser RedshiftMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RedshiftMetadata"
      ( \Object
x ->
          Maybe Text
-> Maybe RedshiftDatabase -> Maybe Text -> RedshiftMetadata
RedshiftMetadata'
            (Maybe Text
 -> Maybe RedshiftDatabase -> Maybe Text -> RedshiftMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe RedshiftDatabase -> Maybe Text -> RedshiftMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SelectSqlQuery")
            Parser (Maybe RedshiftDatabase -> Maybe Text -> RedshiftMetadata)
-> Parser (Maybe RedshiftDatabase)
-> Parser (Maybe Text -> RedshiftMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RedshiftDatabase)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RedshiftDatabase")
            Parser (Maybe Text -> RedshiftMetadata)
-> Parser (Maybe Text) -> Parser RedshiftMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DatabaseUserName")
      )

instance Prelude.Hashable RedshiftMetadata

instance Prelude.NFData RedshiftMetadata