{-# 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.Config.PutEvaluations
(
PutEvaluations (..),
newPutEvaluations,
putEvaluations_evaluations,
putEvaluations_testMode,
putEvaluations_resultToken,
PutEvaluationsResponse (..),
newPutEvaluationsResponse,
putEvaluationsResponse_failedEvaluations,
putEvaluationsResponse_httpStatus,
)
where
import Amazonka.Config.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutEvaluations = PutEvaluations'
{
PutEvaluations -> Maybe [Evaluation]
evaluations :: Prelude.Maybe [Evaluation],
PutEvaluations -> Maybe Bool
testMode :: Prelude.Maybe Prelude.Bool,
PutEvaluations -> Text
resultToken :: Prelude.Text
}
deriving (PutEvaluations -> PutEvaluations -> Bool
(PutEvaluations -> PutEvaluations -> Bool)
-> (PutEvaluations -> PutEvaluations -> Bool) -> Eq PutEvaluations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutEvaluations -> PutEvaluations -> Bool
$c/= :: PutEvaluations -> PutEvaluations -> Bool
== :: PutEvaluations -> PutEvaluations -> Bool
$c== :: PutEvaluations -> PutEvaluations -> Bool
Prelude.Eq, ReadPrec [PutEvaluations]
ReadPrec PutEvaluations
Int -> ReadS PutEvaluations
ReadS [PutEvaluations]
(Int -> ReadS PutEvaluations)
-> ReadS [PutEvaluations]
-> ReadPrec PutEvaluations
-> ReadPrec [PutEvaluations]
-> Read PutEvaluations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutEvaluations]
$creadListPrec :: ReadPrec [PutEvaluations]
readPrec :: ReadPrec PutEvaluations
$creadPrec :: ReadPrec PutEvaluations
readList :: ReadS [PutEvaluations]
$creadList :: ReadS [PutEvaluations]
readsPrec :: Int -> ReadS PutEvaluations
$creadsPrec :: Int -> ReadS PutEvaluations
Prelude.Read, Int -> PutEvaluations -> ShowS
[PutEvaluations] -> ShowS
PutEvaluations -> String
(Int -> PutEvaluations -> ShowS)
-> (PutEvaluations -> String)
-> ([PutEvaluations] -> ShowS)
-> Show PutEvaluations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutEvaluations] -> ShowS
$cshowList :: [PutEvaluations] -> ShowS
show :: PutEvaluations -> String
$cshow :: PutEvaluations -> String
showsPrec :: Int -> PutEvaluations -> ShowS
$cshowsPrec :: Int -> PutEvaluations -> ShowS
Prelude.Show, (forall x. PutEvaluations -> Rep PutEvaluations x)
-> (forall x. Rep PutEvaluations x -> PutEvaluations)
-> Generic PutEvaluations
forall x. Rep PutEvaluations x -> PutEvaluations
forall x. PutEvaluations -> Rep PutEvaluations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutEvaluations x -> PutEvaluations
$cfrom :: forall x. PutEvaluations -> Rep PutEvaluations x
Prelude.Generic)
newPutEvaluations ::
Prelude.Text ->
PutEvaluations
newPutEvaluations :: Text -> PutEvaluations
newPutEvaluations Text
pResultToken_ =
PutEvaluations' :: Maybe [Evaluation] -> Maybe Bool -> Text -> PutEvaluations
PutEvaluations'
{ $sel:evaluations:PutEvaluations' :: Maybe [Evaluation]
evaluations = Maybe [Evaluation]
forall a. Maybe a
Prelude.Nothing,
$sel:testMode:PutEvaluations' :: Maybe Bool
testMode = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:resultToken:PutEvaluations' :: Text
resultToken = Text
pResultToken_
}
putEvaluations_evaluations :: Lens.Lens' PutEvaluations (Prelude.Maybe [Evaluation])
putEvaluations_evaluations :: (Maybe [Evaluation] -> f (Maybe [Evaluation]))
-> PutEvaluations -> f PutEvaluations
putEvaluations_evaluations = (PutEvaluations -> Maybe [Evaluation])
-> (PutEvaluations -> Maybe [Evaluation] -> PutEvaluations)
-> Lens
PutEvaluations
PutEvaluations
(Maybe [Evaluation])
(Maybe [Evaluation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEvaluations' {Maybe [Evaluation]
evaluations :: Maybe [Evaluation]
$sel:evaluations:PutEvaluations' :: PutEvaluations -> Maybe [Evaluation]
evaluations} -> Maybe [Evaluation]
evaluations) (\s :: PutEvaluations
s@PutEvaluations' {} Maybe [Evaluation]
a -> PutEvaluations
s {$sel:evaluations:PutEvaluations' :: Maybe [Evaluation]
evaluations = Maybe [Evaluation]
a} :: PutEvaluations) ((Maybe [Evaluation] -> f (Maybe [Evaluation]))
-> PutEvaluations -> f PutEvaluations)
-> ((Maybe [Evaluation] -> f (Maybe [Evaluation]))
-> Maybe [Evaluation] -> f (Maybe [Evaluation]))
-> (Maybe [Evaluation] -> f (Maybe [Evaluation]))
-> PutEvaluations
-> f PutEvaluations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Evaluation] [Evaluation] [Evaluation] [Evaluation]
-> Iso
(Maybe [Evaluation])
(Maybe [Evaluation])
(Maybe [Evaluation])
(Maybe [Evaluation])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Evaluation] [Evaluation] [Evaluation] [Evaluation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putEvaluations_testMode :: Lens.Lens' PutEvaluations (Prelude.Maybe Prelude.Bool)
putEvaluations_testMode :: (Maybe Bool -> f (Maybe Bool))
-> PutEvaluations -> f PutEvaluations
putEvaluations_testMode = (PutEvaluations -> Maybe Bool)
-> (PutEvaluations -> Maybe Bool -> PutEvaluations)
-> Lens PutEvaluations PutEvaluations (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEvaluations' {Maybe Bool
testMode :: Maybe Bool
$sel:testMode:PutEvaluations' :: PutEvaluations -> Maybe Bool
testMode} -> Maybe Bool
testMode) (\s :: PutEvaluations
s@PutEvaluations' {} Maybe Bool
a -> PutEvaluations
s {$sel:testMode:PutEvaluations' :: Maybe Bool
testMode = Maybe Bool
a} :: PutEvaluations)
putEvaluations_resultToken :: Lens.Lens' PutEvaluations Prelude.Text
putEvaluations_resultToken :: (Text -> f Text) -> PutEvaluations -> f PutEvaluations
putEvaluations_resultToken = (PutEvaluations -> Text)
-> (PutEvaluations -> Text -> PutEvaluations)
-> Lens PutEvaluations PutEvaluations Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEvaluations' {Text
resultToken :: Text
$sel:resultToken:PutEvaluations' :: PutEvaluations -> Text
resultToken} -> Text
resultToken) (\s :: PutEvaluations
s@PutEvaluations' {} Text
a -> PutEvaluations
s {$sel:resultToken:PutEvaluations' :: Text
resultToken = Text
a} :: PutEvaluations)
instance Core.AWSRequest PutEvaluations where
type
AWSResponse PutEvaluations =
PutEvaluationsResponse
request :: PutEvaluations -> Request PutEvaluations
request = Service -> PutEvaluations -> Request PutEvaluations
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutEvaluations
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutEvaluations)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutEvaluations))
-> Logger
-> Service
-> Proxy PutEvaluations
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutEvaluations)))
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 [Evaluation] -> Int -> PutEvaluationsResponse
PutEvaluationsResponse'
(Maybe [Evaluation] -> Int -> PutEvaluationsResponse)
-> Either String (Maybe [Evaluation])
-> Either String (Int -> PutEvaluationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [Evaluation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FailedEvaluations"
Either String (Maybe (Maybe [Evaluation]))
-> Maybe [Evaluation] -> Either String (Maybe [Evaluation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Evaluation]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> PutEvaluationsResponse)
-> Either String Int -> Either String PutEvaluationsResponse
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 PutEvaluations
instance Prelude.NFData PutEvaluations
instance Core.ToHeaders PutEvaluations where
toHeaders :: PutEvaluations -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutEvaluations -> 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
"StarlingDoveService.PutEvaluations" ::
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 PutEvaluations where
toJSON :: PutEvaluations -> Value
toJSON PutEvaluations' {Maybe Bool
Maybe [Evaluation]
Text
resultToken :: Text
testMode :: Maybe Bool
evaluations :: Maybe [Evaluation]
$sel:resultToken:PutEvaluations' :: PutEvaluations -> Text
$sel:testMode:PutEvaluations' :: PutEvaluations -> Maybe Bool
$sel:evaluations:PutEvaluations' :: PutEvaluations -> Maybe [Evaluation]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Evaluations" Text -> [Evaluation] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Evaluation] -> Pair) -> Maybe [Evaluation] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Evaluation]
evaluations,
(Text
"TestMode" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
testMode,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResultToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resultToken)
]
)
instance Core.ToPath PutEvaluations where
toPath :: PutEvaluations -> ByteString
toPath = ByteString -> PutEvaluations -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutEvaluations where
toQuery :: PutEvaluations -> QueryString
toQuery = QueryString -> PutEvaluations -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutEvaluationsResponse = PutEvaluationsResponse'
{
PutEvaluationsResponse -> Maybe [Evaluation]
failedEvaluations :: Prelude.Maybe [Evaluation],
PutEvaluationsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutEvaluationsResponse -> PutEvaluationsResponse -> Bool
(PutEvaluationsResponse -> PutEvaluationsResponse -> Bool)
-> (PutEvaluationsResponse -> PutEvaluationsResponse -> Bool)
-> Eq PutEvaluationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutEvaluationsResponse -> PutEvaluationsResponse -> Bool
$c/= :: PutEvaluationsResponse -> PutEvaluationsResponse -> Bool
== :: PutEvaluationsResponse -> PutEvaluationsResponse -> Bool
$c== :: PutEvaluationsResponse -> PutEvaluationsResponse -> Bool
Prelude.Eq, ReadPrec [PutEvaluationsResponse]
ReadPrec PutEvaluationsResponse
Int -> ReadS PutEvaluationsResponse
ReadS [PutEvaluationsResponse]
(Int -> ReadS PutEvaluationsResponse)
-> ReadS [PutEvaluationsResponse]
-> ReadPrec PutEvaluationsResponse
-> ReadPrec [PutEvaluationsResponse]
-> Read PutEvaluationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutEvaluationsResponse]
$creadListPrec :: ReadPrec [PutEvaluationsResponse]
readPrec :: ReadPrec PutEvaluationsResponse
$creadPrec :: ReadPrec PutEvaluationsResponse
readList :: ReadS [PutEvaluationsResponse]
$creadList :: ReadS [PutEvaluationsResponse]
readsPrec :: Int -> ReadS PutEvaluationsResponse
$creadsPrec :: Int -> ReadS PutEvaluationsResponse
Prelude.Read, Int -> PutEvaluationsResponse -> ShowS
[PutEvaluationsResponse] -> ShowS
PutEvaluationsResponse -> String
(Int -> PutEvaluationsResponse -> ShowS)
-> (PutEvaluationsResponse -> String)
-> ([PutEvaluationsResponse] -> ShowS)
-> Show PutEvaluationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutEvaluationsResponse] -> ShowS
$cshowList :: [PutEvaluationsResponse] -> ShowS
show :: PutEvaluationsResponse -> String
$cshow :: PutEvaluationsResponse -> String
showsPrec :: Int -> PutEvaluationsResponse -> ShowS
$cshowsPrec :: Int -> PutEvaluationsResponse -> ShowS
Prelude.Show, (forall x. PutEvaluationsResponse -> Rep PutEvaluationsResponse x)
-> (forall x.
Rep PutEvaluationsResponse x -> PutEvaluationsResponse)
-> Generic PutEvaluationsResponse
forall x. Rep PutEvaluationsResponse x -> PutEvaluationsResponse
forall x. PutEvaluationsResponse -> Rep PutEvaluationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutEvaluationsResponse x -> PutEvaluationsResponse
$cfrom :: forall x. PutEvaluationsResponse -> Rep PutEvaluationsResponse x
Prelude.Generic)
newPutEvaluationsResponse ::
Prelude.Int ->
PutEvaluationsResponse
newPutEvaluationsResponse :: Int -> PutEvaluationsResponse
newPutEvaluationsResponse Int
pHttpStatus_ =
PutEvaluationsResponse' :: Maybe [Evaluation] -> Int -> PutEvaluationsResponse
PutEvaluationsResponse'
{ $sel:failedEvaluations:PutEvaluationsResponse' :: Maybe [Evaluation]
failedEvaluations =
Maybe [Evaluation]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutEvaluationsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putEvaluationsResponse_failedEvaluations :: Lens.Lens' PutEvaluationsResponse (Prelude.Maybe [Evaluation])
putEvaluationsResponse_failedEvaluations :: (Maybe [Evaluation] -> f (Maybe [Evaluation]))
-> PutEvaluationsResponse -> f PutEvaluationsResponse
putEvaluationsResponse_failedEvaluations = (PutEvaluationsResponse -> Maybe [Evaluation])
-> (PutEvaluationsResponse
-> Maybe [Evaluation] -> PutEvaluationsResponse)
-> Lens
PutEvaluationsResponse
PutEvaluationsResponse
(Maybe [Evaluation])
(Maybe [Evaluation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEvaluationsResponse' {Maybe [Evaluation]
failedEvaluations :: Maybe [Evaluation]
$sel:failedEvaluations:PutEvaluationsResponse' :: PutEvaluationsResponse -> Maybe [Evaluation]
failedEvaluations} -> Maybe [Evaluation]
failedEvaluations) (\s :: PutEvaluationsResponse
s@PutEvaluationsResponse' {} Maybe [Evaluation]
a -> PutEvaluationsResponse
s {$sel:failedEvaluations:PutEvaluationsResponse' :: Maybe [Evaluation]
failedEvaluations = Maybe [Evaluation]
a} :: PutEvaluationsResponse) ((Maybe [Evaluation] -> f (Maybe [Evaluation]))
-> PutEvaluationsResponse -> f PutEvaluationsResponse)
-> ((Maybe [Evaluation] -> f (Maybe [Evaluation]))
-> Maybe [Evaluation] -> f (Maybe [Evaluation]))
-> (Maybe [Evaluation] -> f (Maybe [Evaluation]))
-> PutEvaluationsResponse
-> f PutEvaluationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Evaluation] [Evaluation] [Evaluation] [Evaluation]
-> Iso
(Maybe [Evaluation])
(Maybe [Evaluation])
(Maybe [Evaluation])
(Maybe [Evaluation])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Evaluation] [Evaluation] [Evaluation] [Evaluation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putEvaluationsResponse_httpStatus :: Lens.Lens' PutEvaluationsResponse Prelude.Int
putEvaluationsResponse_httpStatus :: (Int -> f Int)
-> PutEvaluationsResponse -> f PutEvaluationsResponse
putEvaluationsResponse_httpStatus = (PutEvaluationsResponse -> Int)
-> (PutEvaluationsResponse -> Int -> PutEvaluationsResponse)
-> Lens PutEvaluationsResponse PutEvaluationsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutEvaluationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutEvaluationsResponse' :: PutEvaluationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutEvaluationsResponse
s@PutEvaluationsResponse' {} Int
a -> PutEvaluationsResponse
s {$sel:httpStatus:PutEvaluationsResponse' :: Int
httpStatus = Int
a} :: PutEvaluationsResponse)
instance Prelude.NFData PutEvaluationsResponse