{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateDataSourceFromRDS
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a @DataSource@ object from an
-- <http://aws.amazon.com/rds/ Amazon Relational Database Service> (Amazon
-- RDS). A @DataSource@ references data that can be used to perform
-- @CreateMLModel@, @CreateEvaluation@, or @CreateBatchPrediction@
-- operations.
--
-- @CreateDataSourceFromRDS@ is an asynchronous operation. In response to
-- @CreateDataSourceFromRDS@, Amazon Machine Learning (Amazon ML)
-- immediately returns and sets the @DataSource@ status to @PENDING@. After
-- the @DataSource@ is created and ready for use, Amazon ML sets the
-- @Status@ parameter to @COMPLETED@. @DataSource@ in the @COMPLETED@ or
-- @PENDING@ state can be used only to perform @>CreateMLModel@>,
-- @CreateEvaluation@, or @CreateBatchPrediction@ operations.
--
-- If Amazon ML cannot accept the input source, it sets the @Status@
-- parameter to @FAILED@ and includes an error message in the @Message@
-- attribute of the @GetDataSource@ operation response.
module Amazonka.MachineLearning.CreateDataSourceFromRDS
  ( -- * Creating a Request
    CreateDataSourceFromRDS (..),
    newCreateDataSourceFromRDS,

    -- * Request Lenses
    createDataSourceFromRDS_computeStatistics,
    createDataSourceFromRDS_dataSourceName,
    createDataSourceFromRDS_dataSourceId,
    createDataSourceFromRDS_rDSData,
    createDataSourceFromRDS_roleARN,

    -- * Destructuring the Response
    CreateDataSourceFromRDSResponse (..),
    newCreateDataSourceFromRDSResponse,

    -- * Response Lenses
    createDataSourceFromRDSResponse_dataSourceId,
    createDataSourceFromRDSResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MachineLearning.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateDataSourceFromRDS' smart constructor.
data CreateDataSourceFromRDS = CreateDataSourceFromRDS'
  { -- | The compute statistics for a @DataSource@. The statistics are generated
    -- from the observation data referenced by a @DataSource@. Amazon ML uses
    -- the statistics internally during @MLModel@ training. This parameter must
    -- be set to @true@ if the DataSource needs to be used for @MLModel@
    -- training.
    CreateDataSourceFromRDS -> Maybe Bool
computeStatistics :: Prelude.Maybe Prelude.Bool,
    -- | A user-supplied name or description of the @DataSource@.
    CreateDataSourceFromRDS -> Maybe Text
dataSourceName :: Prelude.Maybe Prelude.Text,
    -- | A user-supplied ID that uniquely identifies the @DataSource@. Typically,
    -- an Amazon Resource Number (ARN) becomes the ID for a @DataSource@.
    CreateDataSourceFromRDS -> Text
dataSourceId :: Prelude.Text,
    -- | The data specification of an Amazon RDS @DataSource@:
    --
    -- -   DatabaseInformation -
    --
    --     -   @DatabaseName@ - The name of the Amazon RDS database.
    --
    --     -   @InstanceIdentifier @ - A unique identifier for the Amazon RDS
    --         database instance.
    --
    -- -   DatabaseCredentials - AWS Identity and Access Management (IAM)
    --     credentials that are used to connect to the Amazon RDS database.
    --
    -- -   ResourceRole - A role (DataPipelineDefaultResourceRole) assumed by
    --     an EC2 instance to carry out the copy task from Amazon RDS to Amazon
    --     Simple Storage Service (Amazon S3). For more information, see
    --     <https://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-iam-roles.html Role templates>
    --     for data pipelines.
    --
    -- -   ServiceRole - A role (DataPipelineDefaultRole) assumed by the AWS
    --     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.
    --
    -- -   SecurityInfo - The security information to use to access an RDS DB
    --     instance. You need to set up appropriate ingress rules for the
    --     security entity IDs provided to allow access to the Amazon RDS
    --     instance. Specify a [@SubnetId@, @SecurityGroupIds@] pair for a
    --     VPC-based RDS DB instance.
    --
    -- -   SelectSqlQuery - A query that is used to retrieve the observation
    --     data for the @Datasource@.
    --
    -- -   S3StagingLocation - The Amazon S3 location for staging Amazon RDS
    --     data. The data retrieved from Amazon RDS using @SelectSqlQuery@ is
    --     stored in this location.
    --
    -- -   DataSchemaUri - The Amazon S3 location of the @DataSchema@.
    --
    -- -   DataSchema - A JSON string representing the schema. This is not
    --     required if @DataSchemaUri@ is specified.
    --
    -- -   DataRearrangement - A JSON string that represents the splitting and
    --     rearrangement requirements for the @Datasource@.
    --
    --     Sample -
    --     @ \"{\\\"splitting\\\":{\\\"percentBegin\\\":10,\\\"percentEnd\\\":60}}\"@
    CreateDataSourceFromRDS -> RDSDataSpec
rDSData :: RDSDataSpec,
    -- | The role that Amazon ML assumes on behalf of the user to create and
    -- activate a data pipeline in the user\'s account and copy data using the
    -- @SelectSqlQuery@ query from Amazon RDS to Amazon S3.
    CreateDataSourceFromRDS -> Text
roleARN :: Prelude.Text
  }
  deriving (CreateDataSourceFromRDS -> CreateDataSourceFromRDS -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDataSourceFromRDS -> CreateDataSourceFromRDS -> Bool
$c/= :: CreateDataSourceFromRDS -> CreateDataSourceFromRDS -> Bool
== :: CreateDataSourceFromRDS -> CreateDataSourceFromRDS -> Bool
$c== :: CreateDataSourceFromRDS -> CreateDataSourceFromRDS -> Bool
Prelude.Eq, ReadPrec [CreateDataSourceFromRDS]
ReadPrec CreateDataSourceFromRDS
Int -> ReadS CreateDataSourceFromRDS
ReadS [CreateDataSourceFromRDS]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDataSourceFromRDS]
$creadListPrec :: ReadPrec [CreateDataSourceFromRDS]
readPrec :: ReadPrec CreateDataSourceFromRDS
$creadPrec :: ReadPrec CreateDataSourceFromRDS
readList :: ReadS [CreateDataSourceFromRDS]
$creadList :: ReadS [CreateDataSourceFromRDS]
readsPrec :: Int -> ReadS CreateDataSourceFromRDS
$creadsPrec :: Int -> ReadS CreateDataSourceFromRDS
Prelude.Read, Int -> CreateDataSourceFromRDS -> ShowS
[CreateDataSourceFromRDS] -> ShowS
CreateDataSourceFromRDS -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDataSourceFromRDS] -> ShowS
$cshowList :: [CreateDataSourceFromRDS] -> ShowS
show :: CreateDataSourceFromRDS -> String
$cshow :: CreateDataSourceFromRDS -> String
showsPrec :: Int -> CreateDataSourceFromRDS -> ShowS
$cshowsPrec :: Int -> CreateDataSourceFromRDS -> ShowS
Prelude.Show, forall x. Rep CreateDataSourceFromRDS x -> CreateDataSourceFromRDS
forall x. CreateDataSourceFromRDS -> Rep CreateDataSourceFromRDS x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDataSourceFromRDS x -> CreateDataSourceFromRDS
$cfrom :: forall x. CreateDataSourceFromRDS -> Rep CreateDataSourceFromRDS x
Prelude.Generic)

-- |
-- Create a value of 'CreateDataSourceFromRDS' 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:
--
-- 'computeStatistics', 'createDataSourceFromRDS_computeStatistics' - The compute statistics for a @DataSource@. The statistics are generated
-- from the observation data referenced by a @DataSource@. Amazon ML uses
-- the statistics internally during @MLModel@ training. This parameter must
-- be set to @true@ if the DataSource needs to be used for @MLModel@
-- training.
--
-- 'dataSourceName', 'createDataSourceFromRDS_dataSourceName' - A user-supplied name or description of the @DataSource@.
--
-- 'dataSourceId', 'createDataSourceFromRDS_dataSourceId' - A user-supplied ID that uniquely identifies the @DataSource@. Typically,
-- an Amazon Resource Number (ARN) becomes the ID for a @DataSource@.
--
-- 'rDSData', 'createDataSourceFromRDS_rDSData' - The data specification of an Amazon RDS @DataSource@:
--
-- -   DatabaseInformation -
--
--     -   @DatabaseName@ - The name of the Amazon RDS database.
--
--     -   @InstanceIdentifier @ - A unique identifier for the Amazon RDS
--         database instance.
--
-- -   DatabaseCredentials - AWS Identity and Access Management (IAM)
--     credentials that are used to connect to the Amazon RDS database.
--
-- -   ResourceRole - A role (DataPipelineDefaultResourceRole) assumed by
--     an EC2 instance to carry out the copy task from Amazon RDS to Amazon
--     Simple Storage Service (Amazon S3). For more information, see
--     <https://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-iam-roles.html Role templates>
--     for data pipelines.
--
-- -   ServiceRole - A role (DataPipelineDefaultRole) assumed by the AWS
--     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.
--
-- -   SecurityInfo - The security information to use to access an RDS DB
--     instance. You need to set up appropriate ingress rules for the
--     security entity IDs provided to allow access to the Amazon RDS
--     instance. Specify a [@SubnetId@, @SecurityGroupIds@] pair for a
--     VPC-based RDS DB instance.
--
-- -   SelectSqlQuery - A query that is used to retrieve the observation
--     data for the @Datasource@.
--
-- -   S3StagingLocation - The Amazon S3 location for staging Amazon RDS
--     data. The data retrieved from Amazon RDS using @SelectSqlQuery@ is
--     stored in this location.
--
-- -   DataSchemaUri - The Amazon S3 location of the @DataSchema@.
--
-- -   DataSchema - A JSON string representing the schema. This is not
--     required if @DataSchemaUri@ is specified.
--
-- -   DataRearrangement - A JSON string that represents the splitting and
--     rearrangement requirements for the @Datasource@.
--
--     Sample -
--     @ \"{\\\"splitting\\\":{\\\"percentBegin\\\":10,\\\"percentEnd\\\":60}}\"@
--
-- 'roleARN', 'createDataSourceFromRDS_roleARN' - The role that Amazon ML assumes on behalf of the user to create and
-- activate a data pipeline in the user\'s account and copy data using the
-- @SelectSqlQuery@ query from Amazon RDS to Amazon S3.
newCreateDataSourceFromRDS ::
  -- | 'dataSourceId'
  Prelude.Text ->
  -- | 'rDSData'
  RDSDataSpec ->
  -- | 'roleARN'
  Prelude.Text ->
  CreateDataSourceFromRDS
newCreateDataSourceFromRDS :: Text -> RDSDataSpec -> Text -> CreateDataSourceFromRDS
newCreateDataSourceFromRDS
  Text
pDataSourceId_
  RDSDataSpec
pRDSData_
  Text
pRoleARN_ =
    CreateDataSourceFromRDS'
      { $sel:computeStatistics:CreateDataSourceFromRDS' :: Maybe Bool
computeStatistics =
          forall a. Maybe a
Prelude.Nothing,
        $sel:dataSourceName:CreateDataSourceFromRDS' :: Maybe Text
dataSourceName = forall a. Maybe a
Prelude.Nothing,
        $sel:dataSourceId:CreateDataSourceFromRDS' :: Text
dataSourceId = Text
pDataSourceId_,
        $sel:rDSData:CreateDataSourceFromRDS' :: RDSDataSpec
rDSData = RDSDataSpec
pRDSData_,
        $sel:roleARN:CreateDataSourceFromRDS' :: Text
roleARN = Text
pRoleARN_
      }

-- | The compute statistics for a @DataSource@. The statistics are generated
-- from the observation data referenced by a @DataSource@. Amazon ML uses
-- the statistics internally during @MLModel@ training. This parameter must
-- be set to @true@ if the DataSource needs to be used for @MLModel@
-- training.
createDataSourceFromRDS_computeStatistics :: Lens.Lens' CreateDataSourceFromRDS (Prelude.Maybe Prelude.Bool)
createDataSourceFromRDS_computeStatistics :: Lens' CreateDataSourceFromRDS (Maybe Bool)
createDataSourceFromRDS_computeStatistics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSourceFromRDS' {Maybe Bool
computeStatistics :: Maybe Bool
$sel:computeStatistics:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Maybe Bool
computeStatistics} -> Maybe Bool
computeStatistics) (\s :: CreateDataSourceFromRDS
s@CreateDataSourceFromRDS' {} Maybe Bool
a -> CreateDataSourceFromRDS
s {$sel:computeStatistics:CreateDataSourceFromRDS' :: Maybe Bool
computeStatistics = Maybe Bool
a} :: CreateDataSourceFromRDS)

-- | A user-supplied name or description of the @DataSource@.
createDataSourceFromRDS_dataSourceName :: Lens.Lens' CreateDataSourceFromRDS (Prelude.Maybe Prelude.Text)
createDataSourceFromRDS_dataSourceName :: Lens' CreateDataSourceFromRDS (Maybe Text)
createDataSourceFromRDS_dataSourceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSourceFromRDS' {Maybe Text
dataSourceName :: Maybe Text
$sel:dataSourceName:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Maybe Text
dataSourceName} -> Maybe Text
dataSourceName) (\s :: CreateDataSourceFromRDS
s@CreateDataSourceFromRDS' {} Maybe Text
a -> CreateDataSourceFromRDS
s {$sel:dataSourceName:CreateDataSourceFromRDS' :: Maybe Text
dataSourceName = Maybe Text
a} :: CreateDataSourceFromRDS)

-- | A user-supplied ID that uniquely identifies the @DataSource@. Typically,
-- an Amazon Resource Number (ARN) becomes the ID for a @DataSource@.
createDataSourceFromRDS_dataSourceId :: Lens.Lens' CreateDataSourceFromRDS Prelude.Text
createDataSourceFromRDS_dataSourceId :: Lens' CreateDataSourceFromRDS Text
createDataSourceFromRDS_dataSourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSourceFromRDS' {Text
dataSourceId :: Text
$sel:dataSourceId:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Text
dataSourceId} -> Text
dataSourceId) (\s :: CreateDataSourceFromRDS
s@CreateDataSourceFromRDS' {} Text
a -> CreateDataSourceFromRDS
s {$sel:dataSourceId:CreateDataSourceFromRDS' :: Text
dataSourceId = Text
a} :: CreateDataSourceFromRDS)

-- | The data specification of an Amazon RDS @DataSource@:
--
-- -   DatabaseInformation -
--
--     -   @DatabaseName@ - The name of the Amazon RDS database.
--
--     -   @InstanceIdentifier @ - A unique identifier for the Amazon RDS
--         database instance.
--
-- -   DatabaseCredentials - AWS Identity and Access Management (IAM)
--     credentials that are used to connect to the Amazon RDS database.
--
-- -   ResourceRole - A role (DataPipelineDefaultResourceRole) assumed by
--     an EC2 instance to carry out the copy task from Amazon RDS to Amazon
--     Simple Storage Service (Amazon S3). For more information, see
--     <https://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-iam-roles.html Role templates>
--     for data pipelines.
--
-- -   ServiceRole - A role (DataPipelineDefaultRole) assumed by the AWS
--     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.
--
-- -   SecurityInfo - The security information to use to access an RDS DB
--     instance. You need to set up appropriate ingress rules for the
--     security entity IDs provided to allow access to the Amazon RDS
--     instance. Specify a [@SubnetId@, @SecurityGroupIds@] pair for a
--     VPC-based RDS DB instance.
--
-- -   SelectSqlQuery - A query that is used to retrieve the observation
--     data for the @Datasource@.
--
-- -   S3StagingLocation - The Amazon S3 location for staging Amazon RDS
--     data. The data retrieved from Amazon RDS using @SelectSqlQuery@ is
--     stored in this location.
--
-- -   DataSchemaUri - The Amazon S3 location of the @DataSchema@.
--
-- -   DataSchema - A JSON string representing the schema. This is not
--     required if @DataSchemaUri@ is specified.
--
-- -   DataRearrangement - A JSON string that represents the splitting and
--     rearrangement requirements for the @Datasource@.
--
--     Sample -
--     @ \"{\\\"splitting\\\":{\\\"percentBegin\\\":10,\\\"percentEnd\\\":60}}\"@
createDataSourceFromRDS_rDSData :: Lens.Lens' CreateDataSourceFromRDS RDSDataSpec
createDataSourceFromRDS_rDSData :: Lens' CreateDataSourceFromRDS RDSDataSpec
createDataSourceFromRDS_rDSData = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSourceFromRDS' {RDSDataSpec
rDSData :: RDSDataSpec
$sel:rDSData:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> RDSDataSpec
rDSData} -> RDSDataSpec
rDSData) (\s :: CreateDataSourceFromRDS
s@CreateDataSourceFromRDS' {} RDSDataSpec
a -> CreateDataSourceFromRDS
s {$sel:rDSData:CreateDataSourceFromRDS' :: RDSDataSpec
rDSData = RDSDataSpec
a} :: CreateDataSourceFromRDS)

-- | The role that Amazon ML assumes on behalf of the user to create and
-- activate a data pipeline in the user\'s account and copy data using the
-- @SelectSqlQuery@ query from Amazon RDS to Amazon S3.
createDataSourceFromRDS_roleARN :: Lens.Lens' CreateDataSourceFromRDS Prelude.Text
createDataSourceFromRDS_roleARN :: Lens' CreateDataSourceFromRDS Text
createDataSourceFromRDS_roleARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSourceFromRDS' {Text
roleARN :: Text
$sel:roleARN:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Text
roleARN} -> Text
roleARN) (\s :: CreateDataSourceFromRDS
s@CreateDataSourceFromRDS' {} Text
a -> CreateDataSourceFromRDS
s {$sel:roleARN:CreateDataSourceFromRDS' :: Text
roleARN = Text
a} :: CreateDataSourceFromRDS)

instance Core.AWSRequest CreateDataSourceFromRDS where
  type
    AWSResponse CreateDataSourceFromRDS =
      CreateDataSourceFromRDSResponse
  request :: (Service -> Service)
-> CreateDataSourceFromRDS -> Request CreateDataSourceFromRDS
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateDataSourceFromRDS
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDataSourceFromRDS)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> CreateDataSourceFromRDSResponse
CreateDataSourceFromRDSResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DataSourceId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateDataSourceFromRDS where
  hashWithSalt :: Int -> CreateDataSourceFromRDS -> Int
hashWithSalt Int
_salt CreateDataSourceFromRDS' {Maybe Bool
Maybe Text
Text
RDSDataSpec
roleARN :: Text
rDSData :: RDSDataSpec
dataSourceId :: Text
dataSourceName :: Maybe Text
computeStatistics :: Maybe Bool
$sel:roleARN:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Text
$sel:rDSData:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> RDSDataSpec
$sel:dataSourceId:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Text
$sel:dataSourceName:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Maybe Text
$sel:computeStatistics:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
computeStatistics
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dataSourceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dataSourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RDSDataSpec
rDSData
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleARN

instance Prelude.NFData CreateDataSourceFromRDS where
  rnf :: CreateDataSourceFromRDS -> ()
rnf CreateDataSourceFromRDS' {Maybe Bool
Maybe Text
Text
RDSDataSpec
roleARN :: Text
rDSData :: RDSDataSpec
dataSourceId :: Text
dataSourceName :: Maybe Text
computeStatistics :: Maybe Bool
$sel:roleARN:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Text
$sel:rDSData:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> RDSDataSpec
$sel:dataSourceId:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Text
$sel:dataSourceName:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Maybe Text
$sel:computeStatistics:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
computeStatistics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dataSourceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
dataSourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RDSDataSpec
rDSData
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleARN

instance Data.ToHeaders CreateDataSourceFromRDS where
  toHeaders :: CreateDataSourceFromRDS -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonML_20141212.CreateDataSourceFromRDS" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateDataSourceFromRDS where
  toJSON :: CreateDataSourceFromRDS -> Value
toJSON CreateDataSourceFromRDS' {Maybe Bool
Maybe Text
Text
RDSDataSpec
roleARN :: Text
rDSData :: RDSDataSpec
dataSourceId :: Text
dataSourceName :: Maybe Text
computeStatistics :: Maybe Bool
$sel:roleARN:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Text
$sel:rDSData:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> RDSDataSpec
$sel:dataSourceId:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Text
$sel:dataSourceName:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Maybe Text
$sel:computeStatistics:CreateDataSourceFromRDS' :: CreateDataSourceFromRDS -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ComputeStatistics" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
computeStatistics,
            (Key
"DataSourceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
dataSourceName,
            forall a. a -> Maybe a
Prelude.Just (Key
"DataSourceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
dataSourceId),
            forall a. a -> Maybe a
Prelude.Just (Key
"RDSData" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= RDSDataSpec
rDSData),
            forall a. a -> Maybe a
Prelude.Just (Key
"RoleARN" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleARN)
          ]
      )

instance Data.ToPath CreateDataSourceFromRDS where
  toPath :: CreateDataSourceFromRDS -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery CreateDataSourceFromRDS where
  toQuery :: CreateDataSourceFromRDS -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | Represents the output of a @CreateDataSourceFromRDS@ operation, and is
-- an acknowledgement that Amazon ML received the request.
--
-- The @CreateDataSourceFromRDS@> operation is asynchronous. You can poll
-- for updates by using the @GetBatchPrediction@ operation and checking the
-- @Status@ parameter. You can inspect the @Message@ when @Status@ shows up
-- as @FAILED@. You can also check the progress of the copy operation by
-- going to the @DataPipeline@ console and looking up the pipeline using
-- the @pipelineId @ from the describe call.
--
-- /See:/ 'newCreateDataSourceFromRDSResponse' smart constructor.
data CreateDataSourceFromRDSResponse = CreateDataSourceFromRDSResponse'
  { -- | A user-supplied ID that uniquely identifies the datasource. This value
    -- should be identical to the value of the @DataSourceID@ in the request.
    CreateDataSourceFromRDSResponse -> Maybe Text
dataSourceId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateDataSourceFromRDSResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDataSourceFromRDSResponse
-> CreateDataSourceFromRDSResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDataSourceFromRDSResponse
-> CreateDataSourceFromRDSResponse -> Bool
$c/= :: CreateDataSourceFromRDSResponse
-> CreateDataSourceFromRDSResponse -> Bool
== :: CreateDataSourceFromRDSResponse
-> CreateDataSourceFromRDSResponse -> Bool
$c== :: CreateDataSourceFromRDSResponse
-> CreateDataSourceFromRDSResponse -> Bool
Prelude.Eq, ReadPrec [CreateDataSourceFromRDSResponse]
ReadPrec CreateDataSourceFromRDSResponse
Int -> ReadS CreateDataSourceFromRDSResponse
ReadS [CreateDataSourceFromRDSResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDataSourceFromRDSResponse]
$creadListPrec :: ReadPrec [CreateDataSourceFromRDSResponse]
readPrec :: ReadPrec CreateDataSourceFromRDSResponse
$creadPrec :: ReadPrec CreateDataSourceFromRDSResponse
readList :: ReadS [CreateDataSourceFromRDSResponse]
$creadList :: ReadS [CreateDataSourceFromRDSResponse]
readsPrec :: Int -> ReadS CreateDataSourceFromRDSResponse
$creadsPrec :: Int -> ReadS CreateDataSourceFromRDSResponse
Prelude.Read, Int -> CreateDataSourceFromRDSResponse -> ShowS
[CreateDataSourceFromRDSResponse] -> ShowS
CreateDataSourceFromRDSResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDataSourceFromRDSResponse] -> ShowS
$cshowList :: [CreateDataSourceFromRDSResponse] -> ShowS
show :: CreateDataSourceFromRDSResponse -> String
$cshow :: CreateDataSourceFromRDSResponse -> String
showsPrec :: Int -> CreateDataSourceFromRDSResponse -> ShowS
$cshowsPrec :: Int -> CreateDataSourceFromRDSResponse -> ShowS
Prelude.Show, forall x.
Rep CreateDataSourceFromRDSResponse x
-> CreateDataSourceFromRDSResponse
forall x.
CreateDataSourceFromRDSResponse
-> Rep CreateDataSourceFromRDSResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDataSourceFromRDSResponse x
-> CreateDataSourceFromRDSResponse
$cfrom :: forall x.
CreateDataSourceFromRDSResponse
-> Rep CreateDataSourceFromRDSResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDataSourceFromRDSResponse' 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:
--
-- 'dataSourceId', 'createDataSourceFromRDSResponse_dataSourceId' - A user-supplied ID that uniquely identifies the datasource. This value
-- should be identical to the value of the @DataSourceID@ in the request.
--
-- 'httpStatus', 'createDataSourceFromRDSResponse_httpStatus' - The response's http status code.
newCreateDataSourceFromRDSResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDataSourceFromRDSResponse
newCreateDataSourceFromRDSResponse :: Int -> CreateDataSourceFromRDSResponse
newCreateDataSourceFromRDSResponse Int
pHttpStatus_ =
  CreateDataSourceFromRDSResponse'
    { $sel:dataSourceId:CreateDataSourceFromRDSResponse' :: Maybe Text
dataSourceId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDataSourceFromRDSResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A user-supplied ID that uniquely identifies the datasource. This value
-- should be identical to the value of the @DataSourceID@ in the request.
createDataSourceFromRDSResponse_dataSourceId :: Lens.Lens' CreateDataSourceFromRDSResponse (Prelude.Maybe Prelude.Text)
createDataSourceFromRDSResponse_dataSourceId :: Lens' CreateDataSourceFromRDSResponse (Maybe Text)
createDataSourceFromRDSResponse_dataSourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSourceFromRDSResponse' {Maybe Text
dataSourceId :: Maybe Text
$sel:dataSourceId:CreateDataSourceFromRDSResponse' :: CreateDataSourceFromRDSResponse -> Maybe Text
dataSourceId} -> Maybe Text
dataSourceId) (\s :: CreateDataSourceFromRDSResponse
s@CreateDataSourceFromRDSResponse' {} Maybe Text
a -> CreateDataSourceFromRDSResponse
s {$sel:dataSourceId:CreateDataSourceFromRDSResponse' :: Maybe Text
dataSourceId = Maybe Text
a} :: CreateDataSourceFromRDSResponse)

-- | The response's http status code.
createDataSourceFromRDSResponse_httpStatus :: Lens.Lens' CreateDataSourceFromRDSResponse Prelude.Int
createDataSourceFromRDSResponse_httpStatus :: Lens' CreateDataSourceFromRDSResponse Int
createDataSourceFromRDSResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDataSourceFromRDSResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDataSourceFromRDSResponse' :: CreateDataSourceFromRDSResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDataSourceFromRDSResponse
s@CreateDataSourceFromRDSResponse' {} Int
a -> CreateDataSourceFromRDSResponse
s {$sel:httpStatus:CreateDataSourceFromRDSResponse' :: Int
httpStatus = Int
a} :: CreateDataSourceFromRDSResponse)

instance
  Prelude.NFData
    CreateDataSourceFromRDSResponse
  where
  rnf :: CreateDataSourceFromRDSResponse -> ()
rnf CreateDataSourceFromRDSResponse' {Int
Maybe Text
httpStatus :: Int
dataSourceId :: Maybe Text
$sel:httpStatus:CreateDataSourceFromRDSResponse' :: CreateDataSourceFromRDSResponse -> Int
$sel:dataSourceId:CreateDataSourceFromRDSResponse' :: CreateDataSourceFromRDSResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dataSourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus