{-# 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 #-}
module Amazonka.MachineLearning.UpdateDataSource
(
UpdateDataSource (..),
newUpdateDataSource,
updateDataSource_dataSourceId,
updateDataSource_dataSourceName,
UpdateDataSourceResponse (..),
newUpdateDataSourceResponse,
updateDataSourceResponse_dataSourceId,
updateDataSourceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MachineLearning.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateDataSource = UpdateDataSource'
{
UpdateDataSource -> Text
dataSourceId :: Prelude.Text,
UpdateDataSource -> Text
dataSourceName :: Prelude.Text
}
deriving (UpdateDataSource -> UpdateDataSource -> Bool
(UpdateDataSource -> UpdateDataSource -> Bool)
-> (UpdateDataSource -> UpdateDataSource -> Bool)
-> Eq UpdateDataSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDataSource -> UpdateDataSource -> Bool
$c/= :: UpdateDataSource -> UpdateDataSource -> Bool
== :: UpdateDataSource -> UpdateDataSource -> Bool
$c== :: UpdateDataSource -> UpdateDataSource -> Bool
Prelude.Eq, ReadPrec [UpdateDataSource]
ReadPrec UpdateDataSource
Int -> ReadS UpdateDataSource
ReadS [UpdateDataSource]
(Int -> ReadS UpdateDataSource)
-> ReadS [UpdateDataSource]
-> ReadPrec UpdateDataSource
-> ReadPrec [UpdateDataSource]
-> Read UpdateDataSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDataSource]
$creadListPrec :: ReadPrec [UpdateDataSource]
readPrec :: ReadPrec UpdateDataSource
$creadPrec :: ReadPrec UpdateDataSource
readList :: ReadS [UpdateDataSource]
$creadList :: ReadS [UpdateDataSource]
readsPrec :: Int -> ReadS UpdateDataSource
$creadsPrec :: Int -> ReadS UpdateDataSource
Prelude.Read, Int -> UpdateDataSource -> ShowS
[UpdateDataSource] -> ShowS
UpdateDataSource -> String
(Int -> UpdateDataSource -> ShowS)
-> (UpdateDataSource -> String)
-> ([UpdateDataSource] -> ShowS)
-> Show UpdateDataSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDataSource] -> ShowS
$cshowList :: [UpdateDataSource] -> ShowS
show :: UpdateDataSource -> String
$cshow :: UpdateDataSource -> String
showsPrec :: Int -> UpdateDataSource -> ShowS
$cshowsPrec :: Int -> UpdateDataSource -> ShowS
Prelude.Show, (forall x. UpdateDataSource -> Rep UpdateDataSource x)
-> (forall x. Rep UpdateDataSource x -> UpdateDataSource)
-> Generic UpdateDataSource
forall x. Rep UpdateDataSource x -> UpdateDataSource
forall x. UpdateDataSource -> Rep UpdateDataSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDataSource x -> UpdateDataSource
$cfrom :: forall x. UpdateDataSource -> Rep UpdateDataSource x
Prelude.Generic)
newUpdateDataSource ::
Prelude.Text ->
Prelude.Text ->
UpdateDataSource
newUpdateDataSource :: Text -> Text -> UpdateDataSource
newUpdateDataSource Text
pDataSourceId_ Text
pDataSourceName_ =
UpdateDataSource' :: Text -> Text -> UpdateDataSource
UpdateDataSource'
{ $sel:dataSourceId:UpdateDataSource' :: Text
dataSourceId = Text
pDataSourceId_,
$sel:dataSourceName:UpdateDataSource' :: Text
dataSourceName = Text
pDataSourceName_
}
updateDataSource_dataSourceId :: Lens.Lens' UpdateDataSource Prelude.Text
updateDataSource_dataSourceId :: (Text -> f Text) -> UpdateDataSource -> f UpdateDataSource
updateDataSource_dataSourceId = (UpdateDataSource -> Text)
-> (UpdateDataSource -> Text -> UpdateDataSource)
-> Lens UpdateDataSource UpdateDataSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDataSource' {Text
dataSourceId :: Text
$sel:dataSourceId:UpdateDataSource' :: UpdateDataSource -> Text
dataSourceId} -> Text
dataSourceId) (\s :: UpdateDataSource
s@UpdateDataSource' {} Text
a -> UpdateDataSource
s {$sel:dataSourceId:UpdateDataSource' :: Text
dataSourceId = Text
a} :: UpdateDataSource)
updateDataSource_dataSourceName :: Lens.Lens' UpdateDataSource Prelude.Text
updateDataSource_dataSourceName :: (Text -> f Text) -> UpdateDataSource -> f UpdateDataSource
updateDataSource_dataSourceName = (UpdateDataSource -> Text)
-> (UpdateDataSource -> Text -> UpdateDataSource)
-> Lens UpdateDataSource UpdateDataSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDataSource' {Text
dataSourceName :: Text
$sel:dataSourceName:UpdateDataSource' :: UpdateDataSource -> Text
dataSourceName} -> Text
dataSourceName) (\s :: UpdateDataSource
s@UpdateDataSource' {} Text
a -> UpdateDataSource
s {$sel:dataSourceName:UpdateDataSource' :: Text
dataSourceName = Text
a} :: UpdateDataSource)
instance Core.AWSRequest UpdateDataSource where
type
AWSResponse UpdateDataSource =
UpdateDataSourceResponse
request :: UpdateDataSource -> Request UpdateDataSource
request = Service -> UpdateDataSource -> Request UpdateDataSource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateDataSource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateDataSource)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateDataSource))
-> Logger
-> Service
-> Proxy UpdateDataSource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateDataSource)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> UpdateDataSourceResponse
UpdateDataSourceResponse'
(Maybe Text -> Int -> UpdateDataSourceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateDataSourceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DataSourceId")
Either String (Int -> UpdateDataSourceResponse)
-> Either String Int -> Either String UpdateDataSourceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateDataSource
instance Prelude.NFData UpdateDataSource
instance Core.ToHeaders UpdateDataSource where
toHeaders :: UpdateDataSource -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateDataSource -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonML_20141212.UpdateDataSource" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON UpdateDataSource where
toJSON :: UpdateDataSource -> Value
toJSON UpdateDataSource' {Text
dataSourceName :: Text
dataSourceId :: Text
$sel:dataSourceName:UpdateDataSource' :: UpdateDataSource -> Text
$sel:dataSourceId:UpdateDataSource' :: UpdateDataSource -> 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
"DataSourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dataSourceId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"DataSourceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dataSourceName)
]
)
instance Core.ToPath UpdateDataSource where
toPath :: UpdateDataSource -> ByteString
toPath = ByteString -> UpdateDataSource -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateDataSource where
toQuery :: UpdateDataSource -> QueryString
toQuery = QueryString -> UpdateDataSource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateDataSourceResponse = UpdateDataSourceResponse'
{
UpdateDataSourceResponse -> Maybe Text
dataSourceId :: Prelude.Maybe Prelude.Text,
UpdateDataSourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateDataSourceResponse -> UpdateDataSourceResponse -> Bool
(UpdateDataSourceResponse -> UpdateDataSourceResponse -> Bool)
-> (UpdateDataSourceResponse -> UpdateDataSourceResponse -> Bool)
-> Eq UpdateDataSourceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDataSourceResponse -> UpdateDataSourceResponse -> Bool
$c/= :: UpdateDataSourceResponse -> UpdateDataSourceResponse -> Bool
== :: UpdateDataSourceResponse -> UpdateDataSourceResponse -> Bool
$c== :: UpdateDataSourceResponse -> UpdateDataSourceResponse -> Bool
Prelude.Eq, ReadPrec [UpdateDataSourceResponse]
ReadPrec UpdateDataSourceResponse
Int -> ReadS UpdateDataSourceResponse
ReadS [UpdateDataSourceResponse]
(Int -> ReadS UpdateDataSourceResponse)
-> ReadS [UpdateDataSourceResponse]
-> ReadPrec UpdateDataSourceResponse
-> ReadPrec [UpdateDataSourceResponse]
-> Read UpdateDataSourceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDataSourceResponse]
$creadListPrec :: ReadPrec [UpdateDataSourceResponse]
readPrec :: ReadPrec UpdateDataSourceResponse
$creadPrec :: ReadPrec UpdateDataSourceResponse
readList :: ReadS [UpdateDataSourceResponse]
$creadList :: ReadS [UpdateDataSourceResponse]
readsPrec :: Int -> ReadS UpdateDataSourceResponse
$creadsPrec :: Int -> ReadS UpdateDataSourceResponse
Prelude.Read, Int -> UpdateDataSourceResponse -> ShowS
[UpdateDataSourceResponse] -> ShowS
UpdateDataSourceResponse -> String
(Int -> UpdateDataSourceResponse -> ShowS)
-> (UpdateDataSourceResponse -> String)
-> ([UpdateDataSourceResponse] -> ShowS)
-> Show UpdateDataSourceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDataSourceResponse] -> ShowS
$cshowList :: [UpdateDataSourceResponse] -> ShowS
show :: UpdateDataSourceResponse -> String
$cshow :: UpdateDataSourceResponse -> String
showsPrec :: Int -> UpdateDataSourceResponse -> ShowS
$cshowsPrec :: Int -> UpdateDataSourceResponse -> ShowS
Prelude.Show, (forall x.
UpdateDataSourceResponse -> Rep UpdateDataSourceResponse x)
-> (forall x.
Rep UpdateDataSourceResponse x -> UpdateDataSourceResponse)
-> Generic UpdateDataSourceResponse
forall x.
Rep UpdateDataSourceResponse x -> UpdateDataSourceResponse
forall x.
UpdateDataSourceResponse -> Rep UpdateDataSourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDataSourceResponse x -> UpdateDataSourceResponse
$cfrom :: forall x.
UpdateDataSourceResponse -> Rep UpdateDataSourceResponse x
Prelude.Generic)
newUpdateDataSourceResponse ::
Prelude.Int ->
UpdateDataSourceResponse
newUpdateDataSourceResponse :: Int -> UpdateDataSourceResponse
newUpdateDataSourceResponse Int
pHttpStatus_ =
UpdateDataSourceResponse' :: Maybe Text -> Int -> UpdateDataSourceResponse
UpdateDataSourceResponse'
{ $sel:dataSourceId:UpdateDataSourceResponse' :: Maybe Text
dataSourceId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateDataSourceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateDataSourceResponse_dataSourceId :: Lens.Lens' UpdateDataSourceResponse (Prelude.Maybe Prelude.Text)
updateDataSourceResponse_dataSourceId :: (Maybe Text -> f (Maybe Text))
-> UpdateDataSourceResponse -> f UpdateDataSourceResponse
updateDataSourceResponse_dataSourceId = (UpdateDataSourceResponse -> Maybe Text)
-> (UpdateDataSourceResponse
-> Maybe Text -> UpdateDataSourceResponse)
-> Lens
UpdateDataSourceResponse
UpdateDataSourceResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDataSourceResponse' {Maybe Text
dataSourceId :: Maybe Text
$sel:dataSourceId:UpdateDataSourceResponse' :: UpdateDataSourceResponse -> Maybe Text
dataSourceId} -> Maybe Text
dataSourceId) (\s :: UpdateDataSourceResponse
s@UpdateDataSourceResponse' {} Maybe Text
a -> UpdateDataSourceResponse
s {$sel:dataSourceId:UpdateDataSourceResponse' :: Maybe Text
dataSourceId = Maybe Text
a} :: UpdateDataSourceResponse)
updateDataSourceResponse_httpStatus :: Lens.Lens' UpdateDataSourceResponse Prelude.Int
updateDataSourceResponse_httpStatus :: (Int -> f Int)
-> UpdateDataSourceResponse -> f UpdateDataSourceResponse
updateDataSourceResponse_httpStatus = (UpdateDataSourceResponse -> Int)
-> (UpdateDataSourceResponse -> Int -> UpdateDataSourceResponse)
-> Lens UpdateDataSourceResponse UpdateDataSourceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDataSourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateDataSourceResponse' :: UpdateDataSourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateDataSourceResponse
s@UpdateDataSourceResponse' {} Int
a -> UpdateDataSourceResponse
s {$sel:httpStatus:UpdateDataSourceResponse' :: Int
httpStatus = Int
a} :: UpdateDataSourceResponse)
instance Prelude.NFData UpdateDataSourceResponse