{-# 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.RDSMetadata
-- 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.RDSMetadata where

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

-- | The datasource details that are specific to Amazon RDS.
--
-- /See:/ 'newRDSMetadata' smart constructor.
data RDSMetadata = RDSMetadata'
  { -- | The SQL query that is supplied during CreateDataSourceFromRDS. Returns
    -- only if @Verbose@ is true in @GetDataSourceInput@.
    RDSMetadata -> Maybe Text
selectSqlQuery :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Data Pipeline instance that is used to carry to copy data
    -- from Amazon RDS to Amazon S3. You can use the ID to find details about
    -- the instance in the Data Pipeline console.
    RDSMetadata -> Maybe Text
dataPipelineId :: Prelude.Maybe Prelude.Text,
    -- | The database details required to connect to an Amazon RDS.
    RDSMetadata -> Maybe RDSDatabase
database :: Prelude.Maybe RDSDatabase,
    RDSMetadata -> Maybe Text
databaseUserName :: Prelude.Maybe Prelude.Text,
    -- | The role (DataPipelineDefaultResourceRole) assumed by an Amazon EC2
    -- instance to carry out the copy task from Amazon RDS to Amazon S3. For
    -- more information, see
    -- <https://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-iam-roles.html Role templates>
    -- for data pipelines.
    RDSMetadata -> Maybe Text
resourceRole :: Prelude.Maybe Prelude.Text,
    -- | The role (DataPipelineDefaultRole) assumed by the Data Pipeline service
    -- to monitor the progress of the copy task from Amazon RDS to Amazon S3.
    -- For more information, see
    -- <https://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-iam-roles.html Role templates>
    -- for data pipelines.
    RDSMetadata -> Maybe Text
serviceRole :: Prelude.Maybe Prelude.Text
  }
  deriving (RDSMetadata -> RDSMetadata -> Bool
(RDSMetadata -> RDSMetadata -> Bool)
-> (RDSMetadata -> RDSMetadata -> Bool) -> Eq RDSMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RDSMetadata -> RDSMetadata -> Bool
$c/= :: RDSMetadata -> RDSMetadata -> Bool
== :: RDSMetadata -> RDSMetadata -> Bool
$c== :: RDSMetadata -> RDSMetadata -> Bool
Prelude.Eq, ReadPrec [RDSMetadata]
ReadPrec RDSMetadata
Int -> ReadS RDSMetadata
ReadS [RDSMetadata]
(Int -> ReadS RDSMetadata)
-> ReadS [RDSMetadata]
-> ReadPrec RDSMetadata
-> ReadPrec [RDSMetadata]
-> Read RDSMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RDSMetadata]
$creadListPrec :: ReadPrec [RDSMetadata]
readPrec :: ReadPrec RDSMetadata
$creadPrec :: ReadPrec RDSMetadata
readList :: ReadS [RDSMetadata]
$creadList :: ReadS [RDSMetadata]
readsPrec :: Int -> ReadS RDSMetadata
$creadsPrec :: Int -> ReadS RDSMetadata
Prelude.Read, Int -> RDSMetadata -> ShowS
[RDSMetadata] -> ShowS
RDSMetadata -> String
(Int -> RDSMetadata -> ShowS)
-> (RDSMetadata -> String)
-> ([RDSMetadata] -> ShowS)
-> Show RDSMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RDSMetadata] -> ShowS
$cshowList :: [RDSMetadata] -> ShowS
show :: RDSMetadata -> String
$cshow :: RDSMetadata -> String
showsPrec :: Int -> RDSMetadata -> ShowS
$cshowsPrec :: Int -> RDSMetadata -> ShowS
Prelude.Show, (forall x. RDSMetadata -> Rep RDSMetadata x)
-> (forall x. Rep RDSMetadata x -> RDSMetadata)
-> Generic RDSMetadata
forall x. Rep RDSMetadata x -> RDSMetadata
forall x. RDSMetadata -> Rep RDSMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RDSMetadata x -> RDSMetadata
$cfrom :: forall x. RDSMetadata -> Rep RDSMetadata x
Prelude.Generic)

-- |
-- Create a value of 'RDSMetadata' 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', 'rDSMetadata_selectSqlQuery' - The SQL query that is supplied during CreateDataSourceFromRDS. Returns
-- only if @Verbose@ is true in @GetDataSourceInput@.
--
-- 'dataPipelineId', 'rDSMetadata_dataPipelineId' - The ID of the Data Pipeline instance that is used to carry to copy data
-- from Amazon RDS to Amazon S3. You can use the ID to find details about
-- the instance in the Data Pipeline console.
--
-- 'database', 'rDSMetadata_database' - The database details required to connect to an Amazon RDS.
--
-- 'databaseUserName', 'rDSMetadata_databaseUserName' - Undocumented member.
--
-- 'resourceRole', 'rDSMetadata_resourceRole' - The role (DataPipelineDefaultResourceRole) assumed by an Amazon EC2
-- instance to carry out the copy task from Amazon RDS to Amazon S3. For
-- more information, see
-- <https://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-iam-roles.html Role templates>
-- for data pipelines.
--
-- 'serviceRole', 'rDSMetadata_serviceRole' - The role (DataPipelineDefaultRole) assumed by the Data Pipeline service
-- to monitor the progress of the copy task from Amazon RDS to Amazon S3.
-- For more information, see
-- <https://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-iam-roles.html Role templates>
-- for data pipelines.
newRDSMetadata ::
  RDSMetadata
newRDSMetadata :: RDSMetadata
newRDSMetadata =
  RDSMetadata' :: Maybe Text
-> Maybe Text
-> Maybe RDSDatabase
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> RDSMetadata
RDSMetadata'
    { $sel:selectSqlQuery:RDSMetadata' :: Maybe Text
selectSqlQuery = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataPipelineId:RDSMetadata' :: Maybe Text
dataPipelineId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:database:RDSMetadata' :: Maybe RDSDatabase
database = Maybe RDSDatabase
forall a. Maybe a
Prelude.Nothing,
      $sel:databaseUserName:RDSMetadata' :: Maybe Text
databaseUserName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceRole:RDSMetadata' :: Maybe Text
resourceRole = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceRole:RDSMetadata' :: Maybe Text
serviceRole = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The ID of the Data Pipeline instance that is used to carry to copy data
-- from Amazon RDS to Amazon S3. You can use the ID to find details about
-- the instance in the Data Pipeline console.
rDSMetadata_dataPipelineId :: Lens.Lens' RDSMetadata (Prelude.Maybe Prelude.Text)
rDSMetadata_dataPipelineId :: (Maybe Text -> f (Maybe Text)) -> RDSMetadata -> f RDSMetadata
rDSMetadata_dataPipelineId = (RDSMetadata -> Maybe Text)
-> (RDSMetadata -> Maybe Text -> RDSMetadata)
-> Lens RDSMetadata RDSMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RDSMetadata' {Maybe Text
dataPipelineId :: Maybe Text
$sel:dataPipelineId:RDSMetadata' :: RDSMetadata -> Maybe Text
dataPipelineId} -> Maybe Text
dataPipelineId) (\s :: RDSMetadata
s@RDSMetadata' {} Maybe Text
a -> RDSMetadata
s {$sel:dataPipelineId:RDSMetadata' :: Maybe Text
dataPipelineId = Maybe Text
a} :: RDSMetadata)

-- | The database details required to connect to an Amazon RDS.
rDSMetadata_database :: Lens.Lens' RDSMetadata (Prelude.Maybe RDSDatabase)
rDSMetadata_database :: (Maybe RDSDatabase -> f (Maybe RDSDatabase))
-> RDSMetadata -> f RDSMetadata
rDSMetadata_database = (RDSMetadata -> Maybe RDSDatabase)
-> (RDSMetadata -> Maybe RDSDatabase -> RDSMetadata)
-> Lens
     RDSMetadata RDSMetadata (Maybe RDSDatabase) (Maybe RDSDatabase)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RDSMetadata' {Maybe RDSDatabase
database :: Maybe RDSDatabase
$sel:database:RDSMetadata' :: RDSMetadata -> Maybe RDSDatabase
database} -> Maybe RDSDatabase
database) (\s :: RDSMetadata
s@RDSMetadata' {} Maybe RDSDatabase
a -> RDSMetadata
s {$sel:database:RDSMetadata' :: Maybe RDSDatabase
database = Maybe RDSDatabase
a} :: RDSMetadata)

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

-- | The role (DataPipelineDefaultResourceRole) assumed by an Amazon EC2
-- instance to carry out the copy task from Amazon RDS to Amazon S3. For
-- more information, see
-- <https://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-iam-roles.html Role templates>
-- for data pipelines.
rDSMetadata_resourceRole :: Lens.Lens' RDSMetadata (Prelude.Maybe Prelude.Text)
rDSMetadata_resourceRole :: (Maybe Text -> f (Maybe Text)) -> RDSMetadata -> f RDSMetadata
rDSMetadata_resourceRole = (RDSMetadata -> Maybe Text)
-> (RDSMetadata -> Maybe Text -> RDSMetadata)
-> Lens RDSMetadata RDSMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RDSMetadata' {Maybe Text
resourceRole :: Maybe Text
$sel:resourceRole:RDSMetadata' :: RDSMetadata -> Maybe Text
resourceRole} -> Maybe Text
resourceRole) (\s :: RDSMetadata
s@RDSMetadata' {} Maybe Text
a -> RDSMetadata
s {$sel:resourceRole:RDSMetadata' :: Maybe Text
resourceRole = Maybe Text
a} :: RDSMetadata)

-- | The role (DataPipelineDefaultRole) assumed by the Data Pipeline service
-- to monitor the progress of the copy task from Amazon RDS to Amazon S3.
-- For more information, see
-- <https://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-iam-roles.html Role templates>
-- for data pipelines.
rDSMetadata_serviceRole :: Lens.Lens' RDSMetadata (Prelude.Maybe Prelude.Text)
rDSMetadata_serviceRole :: (Maybe Text -> f (Maybe Text)) -> RDSMetadata -> f RDSMetadata
rDSMetadata_serviceRole = (RDSMetadata -> Maybe Text)
-> (RDSMetadata -> Maybe Text -> RDSMetadata)
-> Lens RDSMetadata RDSMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RDSMetadata' {Maybe Text
serviceRole :: Maybe Text
$sel:serviceRole:RDSMetadata' :: RDSMetadata -> Maybe Text
serviceRole} -> Maybe Text
serviceRole) (\s :: RDSMetadata
s@RDSMetadata' {} Maybe Text
a -> RDSMetadata
s {$sel:serviceRole:RDSMetadata' :: Maybe Text
serviceRole = Maybe Text
a} :: RDSMetadata)

instance Core.FromJSON RDSMetadata where
  parseJSON :: Value -> Parser RDSMetadata
parseJSON =
    String
-> (Object -> Parser RDSMetadata) -> Value -> Parser RDSMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RDSMetadata"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe RDSDatabase
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> RDSMetadata
RDSMetadata'
            (Maybe Text
 -> Maybe Text
 -> Maybe RDSDatabase
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> RDSMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe RDSDatabase
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> RDSMetadata)
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 Text
   -> Maybe RDSDatabase
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> RDSMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe RDSDatabase
      -> Maybe Text -> Maybe Text -> Maybe Text -> RDSMetadata)
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
"DataPipelineId")
            Parser
  (Maybe RDSDatabase
   -> Maybe Text -> Maybe Text -> Maybe Text -> RDSMetadata)
-> Parser (Maybe RDSDatabase)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> RDSMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RDSDatabase)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Database")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> RDSMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> RDSMetadata)
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")
            Parser (Maybe Text -> Maybe Text -> RDSMetadata)
-> Parser (Maybe Text) -> Parser (Maybe Text -> RDSMetadata)
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
"ResourceRole")
            Parser (Maybe Text -> RDSMetadata)
-> Parser (Maybe Text) -> Parser RDSMetadata
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
"ServiceRole")
      )

instance Prelude.Hashable RDSMetadata

instance Prelude.NFData RDSMetadata