{-# 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.IoT.StartOnDemandAuditTask
(
StartOnDemandAuditTask (..),
newStartOnDemandAuditTask,
startOnDemandAuditTask_targetCheckNames,
StartOnDemandAuditTaskResponse (..),
newStartOnDemandAuditTaskResponse,
startOnDemandAuditTaskResponse_taskId,
startOnDemandAuditTaskResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.Types
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 StartOnDemandAuditTask = StartOnDemandAuditTask'
{
StartOnDemandAuditTask -> [Text]
targetCheckNames :: [Prelude.Text]
}
deriving (StartOnDemandAuditTask -> StartOnDemandAuditTask -> Bool
(StartOnDemandAuditTask -> StartOnDemandAuditTask -> Bool)
-> (StartOnDemandAuditTask -> StartOnDemandAuditTask -> Bool)
-> Eq StartOnDemandAuditTask
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartOnDemandAuditTask -> StartOnDemandAuditTask -> Bool
$c/= :: StartOnDemandAuditTask -> StartOnDemandAuditTask -> Bool
== :: StartOnDemandAuditTask -> StartOnDemandAuditTask -> Bool
$c== :: StartOnDemandAuditTask -> StartOnDemandAuditTask -> Bool
Prelude.Eq, ReadPrec [StartOnDemandAuditTask]
ReadPrec StartOnDemandAuditTask
Int -> ReadS StartOnDemandAuditTask
ReadS [StartOnDemandAuditTask]
(Int -> ReadS StartOnDemandAuditTask)
-> ReadS [StartOnDemandAuditTask]
-> ReadPrec StartOnDemandAuditTask
-> ReadPrec [StartOnDemandAuditTask]
-> Read StartOnDemandAuditTask
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartOnDemandAuditTask]
$creadListPrec :: ReadPrec [StartOnDemandAuditTask]
readPrec :: ReadPrec StartOnDemandAuditTask
$creadPrec :: ReadPrec StartOnDemandAuditTask
readList :: ReadS [StartOnDemandAuditTask]
$creadList :: ReadS [StartOnDemandAuditTask]
readsPrec :: Int -> ReadS StartOnDemandAuditTask
$creadsPrec :: Int -> ReadS StartOnDemandAuditTask
Prelude.Read, Int -> StartOnDemandAuditTask -> ShowS
[StartOnDemandAuditTask] -> ShowS
StartOnDemandAuditTask -> String
(Int -> StartOnDemandAuditTask -> ShowS)
-> (StartOnDemandAuditTask -> String)
-> ([StartOnDemandAuditTask] -> ShowS)
-> Show StartOnDemandAuditTask
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartOnDemandAuditTask] -> ShowS
$cshowList :: [StartOnDemandAuditTask] -> ShowS
show :: StartOnDemandAuditTask -> String
$cshow :: StartOnDemandAuditTask -> String
showsPrec :: Int -> StartOnDemandAuditTask -> ShowS
$cshowsPrec :: Int -> StartOnDemandAuditTask -> ShowS
Prelude.Show, (forall x. StartOnDemandAuditTask -> Rep StartOnDemandAuditTask x)
-> (forall x.
Rep StartOnDemandAuditTask x -> StartOnDemandAuditTask)
-> Generic StartOnDemandAuditTask
forall x. Rep StartOnDemandAuditTask x -> StartOnDemandAuditTask
forall x. StartOnDemandAuditTask -> Rep StartOnDemandAuditTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartOnDemandAuditTask x -> StartOnDemandAuditTask
$cfrom :: forall x. StartOnDemandAuditTask -> Rep StartOnDemandAuditTask x
Prelude.Generic)
newStartOnDemandAuditTask ::
StartOnDemandAuditTask
newStartOnDemandAuditTask :: StartOnDemandAuditTask
newStartOnDemandAuditTask =
StartOnDemandAuditTask' :: [Text] -> StartOnDemandAuditTask
StartOnDemandAuditTask'
{ $sel:targetCheckNames:StartOnDemandAuditTask' :: [Text]
targetCheckNames =
[Text]
forall a. Monoid a => a
Prelude.mempty
}
startOnDemandAuditTask_targetCheckNames :: Lens.Lens' StartOnDemandAuditTask [Prelude.Text]
startOnDemandAuditTask_targetCheckNames :: ([Text] -> f [Text])
-> StartOnDemandAuditTask -> f StartOnDemandAuditTask
startOnDemandAuditTask_targetCheckNames = (StartOnDemandAuditTask -> [Text])
-> (StartOnDemandAuditTask -> [Text] -> StartOnDemandAuditTask)
-> Lens StartOnDemandAuditTask StartOnDemandAuditTask [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOnDemandAuditTask' {[Text]
targetCheckNames :: [Text]
$sel:targetCheckNames:StartOnDemandAuditTask' :: StartOnDemandAuditTask -> [Text]
targetCheckNames} -> [Text]
targetCheckNames) (\s :: StartOnDemandAuditTask
s@StartOnDemandAuditTask' {} [Text]
a -> StartOnDemandAuditTask
s {$sel:targetCheckNames:StartOnDemandAuditTask' :: [Text]
targetCheckNames = [Text]
a} :: StartOnDemandAuditTask) (([Text] -> f [Text])
-> StartOnDemandAuditTask -> f StartOnDemandAuditTask)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> StartOnDemandAuditTask
-> f StartOnDemandAuditTask
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest StartOnDemandAuditTask where
type
AWSResponse StartOnDemandAuditTask =
StartOnDemandAuditTaskResponse
request :: StartOnDemandAuditTask -> Request StartOnDemandAuditTask
request = Service -> StartOnDemandAuditTask -> Request StartOnDemandAuditTask
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartOnDemandAuditTask
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartOnDemandAuditTask)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartOnDemandAuditTask))
-> Logger
-> Service
-> Proxy StartOnDemandAuditTask
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartOnDemandAuditTask)))
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 -> StartOnDemandAuditTaskResponse
StartOnDemandAuditTaskResponse'
(Maybe Text -> Int -> StartOnDemandAuditTaskResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartOnDemandAuditTaskResponse)
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
"taskId")
Either String (Int -> StartOnDemandAuditTaskResponse)
-> Either String Int
-> Either String StartOnDemandAuditTaskResponse
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 StartOnDemandAuditTask
instance Prelude.NFData StartOnDemandAuditTask
instance Core.ToHeaders StartOnDemandAuditTask where
toHeaders :: StartOnDemandAuditTask -> ResponseHeaders
toHeaders = ResponseHeaders -> StartOnDemandAuditTask -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON StartOnDemandAuditTask where
toJSON :: StartOnDemandAuditTask -> Value
toJSON StartOnDemandAuditTask' {[Text]
targetCheckNames :: [Text]
$sel:targetCheckNames:StartOnDemandAuditTask' :: StartOnDemandAuditTask -> [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
"targetCheckNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
targetCheckNames)
]
)
instance Core.ToPath StartOnDemandAuditTask where
toPath :: StartOnDemandAuditTask -> ByteString
toPath = ByteString -> StartOnDemandAuditTask -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/audit/tasks"
instance Core.ToQuery StartOnDemandAuditTask where
toQuery :: StartOnDemandAuditTask -> QueryString
toQuery = QueryString -> StartOnDemandAuditTask -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartOnDemandAuditTaskResponse = StartOnDemandAuditTaskResponse'
{
StartOnDemandAuditTaskResponse -> Maybe Text
taskId :: Prelude.Maybe Prelude.Text,
StartOnDemandAuditTaskResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartOnDemandAuditTaskResponse
-> StartOnDemandAuditTaskResponse -> Bool
(StartOnDemandAuditTaskResponse
-> StartOnDemandAuditTaskResponse -> Bool)
-> (StartOnDemandAuditTaskResponse
-> StartOnDemandAuditTaskResponse -> Bool)
-> Eq StartOnDemandAuditTaskResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartOnDemandAuditTaskResponse
-> StartOnDemandAuditTaskResponse -> Bool
$c/= :: StartOnDemandAuditTaskResponse
-> StartOnDemandAuditTaskResponse -> Bool
== :: StartOnDemandAuditTaskResponse
-> StartOnDemandAuditTaskResponse -> Bool
$c== :: StartOnDemandAuditTaskResponse
-> StartOnDemandAuditTaskResponse -> Bool
Prelude.Eq, ReadPrec [StartOnDemandAuditTaskResponse]
ReadPrec StartOnDemandAuditTaskResponse
Int -> ReadS StartOnDemandAuditTaskResponse
ReadS [StartOnDemandAuditTaskResponse]
(Int -> ReadS StartOnDemandAuditTaskResponse)
-> ReadS [StartOnDemandAuditTaskResponse]
-> ReadPrec StartOnDemandAuditTaskResponse
-> ReadPrec [StartOnDemandAuditTaskResponse]
-> Read StartOnDemandAuditTaskResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartOnDemandAuditTaskResponse]
$creadListPrec :: ReadPrec [StartOnDemandAuditTaskResponse]
readPrec :: ReadPrec StartOnDemandAuditTaskResponse
$creadPrec :: ReadPrec StartOnDemandAuditTaskResponse
readList :: ReadS [StartOnDemandAuditTaskResponse]
$creadList :: ReadS [StartOnDemandAuditTaskResponse]
readsPrec :: Int -> ReadS StartOnDemandAuditTaskResponse
$creadsPrec :: Int -> ReadS StartOnDemandAuditTaskResponse
Prelude.Read, Int -> StartOnDemandAuditTaskResponse -> ShowS
[StartOnDemandAuditTaskResponse] -> ShowS
StartOnDemandAuditTaskResponse -> String
(Int -> StartOnDemandAuditTaskResponse -> ShowS)
-> (StartOnDemandAuditTaskResponse -> String)
-> ([StartOnDemandAuditTaskResponse] -> ShowS)
-> Show StartOnDemandAuditTaskResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartOnDemandAuditTaskResponse] -> ShowS
$cshowList :: [StartOnDemandAuditTaskResponse] -> ShowS
show :: StartOnDemandAuditTaskResponse -> String
$cshow :: StartOnDemandAuditTaskResponse -> String
showsPrec :: Int -> StartOnDemandAuditTaskResponse -> ShowS
$cshowsPrec :: Int -> StartOnDemandAuditTaskResponse -> ShowS
Prelude.Show, (forall x.
StartOnDemandAuditTaskResponse
-> Rep StartOnDemandAuditTaskResponse x)
-> (forall x.
Rep StartOnDemandAuditTaskResponse x
-> StartOnDemandAuditTaskResponse)
-> Generic StartOnDemandAuditTaskResponse
forall x.
Rep StartOnDemandAuditTaskResponse x
-> StartOnDemandAuditTaskResponse
forall x.
StartOnDemandAuditTaskResponse
-> Rep StartOnDemandAuditTaskResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartOnDemandAuditTaskResponse x
-> StartOnDemandAuditTaskResponse
$cfrom :: forall x.
StartOnDemandAuditTaskResponse
-> Rep StartOnDemandAuditTaskResponse x
Prelude.Generic)
newStartOnDemandAuditTaskResponse ::
Prelude.Int ->
StartOnDemandAuditTaskResponse
newStartOnDemandAuditTaskResponse :: Int -> StartOnDemandAuditTaskResponse
newStartOnDemandAuditTaskResponse Int
pHttpStatus_ =
StartOnDemandAuditTaskResponse' :: Maybe Text -> Int -> StartOnDemandAuditTaskResponse
StartOnDemandAuditTaskResponse'
{ $sel:taskId:StartOnDemandAuditTaskResponse' :: Maybe Text
taskId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartOnDemandAuditTaskResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startOnDemandAuditTaskResponse_taskId :: Lens.Lens' StartOnDemandAuditTaskResponse (Prelude.Maybe Prelude.Text)
startOnDemandAuditTaskResponse_taskId :: (Maybe Text -> f (Maybe Text))
-> StartOnDemandAuditTaskResponse
-> f StartOnDemandAuditTaskResponse
startOnDemandAuditTaskResponse_taskId = (StartOnDemandAuditTaskResponse -> Maybe Text)
-> (StartOnDemandAuditTaskResponse
-> Maybe Text -> StartOnDemandAuditTaskResponse)
-> Lens
StartOnDemandAuditTaskResponse
StartOnDemandAuditTaskResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOnDemandAuditTaskResponse' {Maybe Text
taskId :: Maybe Text
$sel:taskId:StartOnDemandAuditTaskResponse' :: StartOnDemandAuditTaskResponse -> Maybe Text
taskId} -> Maybe Text
taskId) (\s :: StartOnDemandAuditTaskResponse
s@StartOnDemandAuditTaskResponse' {} Maybe Text
a -> StartOnDemandAuditTaskResponse
s {$sel:taskId:StartOnDemandAuditTaskResponse' :: Maybe Text
taskId = Maybe Text
a} :: StartOnDemandAuditTaskResponse)
startOnDemandAuditTaskResponse_httpStatus :: Lens.Lens' StartOnDemandAuditTaskResponse Prelude.Int
startOnDemandAuditTaskResponse_httpStatus :: (Int -> f Int)
-> StartOnDemandAuditTaskResponse
-> f StartOnDemandAuditTaskResponse
startOnDemandAuditTaskResponse_httpStatus = (StartOnDemandAuditTaskResponse -> Int)
-> (StartOnDemandAuditTaskResponse
-> Int -> StartOnDemandAuditTaskResponse)
-> Lens
StartOnDemandAuditTaskResponse
StartOnDemandAuditTaskResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartOnDemandAuditTaskResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartOnDemandAuditTaskResponse' :: StartOnDemandAuditTaskResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartOnDemandAuditTaskResponse
s@StartOnDemandAuditTaskResponse' {} Int
a -> StartOnDemandAuditTaskResponse
s {$sel:httpStatus:StartOnDemandAuditTaskResponse' :: Int
httpStatus = Int
a} :: StartOnDemandAuditTaskResponse)
instance
Prelude.NFData
StartOnDemandAuditTaskResponse