{-# 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.CloudTrail.StartQuery
(
StartQuery (..),
newStartQuery,
startQuery_deliveryS3Uri,
startQuery_queryStatement,
StartQueryResponse (..),
newStartQueryResponse,
startQueryResponse_queryId,
startQueryResponse_httpStatus,
)
where
import Amazonka.CloudTrail.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StartQuery = StartQuery'
{
StartQuery -> Maybe Text
deliveryS3Uri :: Prelude.Maybe Prelude.Text,
StartQuery -> Text
queryStatement :: Prelude.Text
}
deriving (StartQuery -> StartQuery -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartQuery -> StartQuery -> Bool
$c/= :: StartQuery -> StartQuery -> Bool
== :: StartQuery -> StartQuery -> Bool
$c== :: StartQuery -> StartQuery -> Bool
Prelude.Eq, ReadPrec [StartQuery]
ReadPrec StartQuery
Int -> ReadS StartQuery
ReadS [StartQuery]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartQuery]
$creadListPrec :: ReadPrec [StartQuery]
readPrec :: ReadPrec StartQuery
$creadPrec :: ReadPrec StartQuery
readList :: ReadS [StartQuery]
$creadList :: ReadS [StartQuery]
readsPrec :: Int -> ReadS StartQuery
$creadsPrec :: Int -> ReadS StartQuery
Prelude.Read, Int -> StartQuery -> ShowS
[StartQuery] -> ShowS
StartQuery -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartQuery] -> ShowS
$cshowList :: [StartQuery] -> ShowS
show :: StartQuery -> String
$cshow :: StartQuery -> String
showsPrec :: Int -> StartQuery -> ShowS
$cshowsPrec :: Int -> StartQuery -> ShowS
Prelude.Show, forall x. Rep StartQuery x -> StartQuery
forall x. StartQuery -> Rep StartQuery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartQuery x -> StartQuery
$cfrom :: forall x. StartQuery -> Rep StartQuery x
Prelude.Generic)
newStartQuery ::
Prelude.Text ->
StartQuery
newStartQuery :: Text -> StartQuery
newStartQuery Text
pQueryStatement_ =
StartQuery'
{ $sel:deliveryS3Uri:StartQuery' :: Maybe Text
deliveryS3Uri = forall a. Maybe a
Prelude.Nothing,
$sel:queryStatement:StartQuery' :: Text
queryStatement = Text
pQueryStatement_
}
startQuery_deliveryS3Uri :: Lens.Lens' StartQuery (Prelude.Maybe Prelude.Text)
startQuery_deliveryS3Uri :: Lens' StartQuery (Maybe Text)
startQuery_deliveryS3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQuery' {Maybe Text
deliveryS3Uri :: Maybe Text
$sel:deliveryS3Uri:StartQuery' :: StartQuery -> Maybe Text
deliveryS3Uri} -> Maybe Text
deliveryS3Uri) (\s :: StartQuery
s@StartQuery' {} Maybe Text
a -> StartQuery
s {$sel:deliveryS3Uri:StartQuery' :: Maybe Text
deliveryS3Uri = Maybe Text
a} :: StartQuery)
startQuery_queryStatement :: Lens.Lens' StartQuery Prelude.Text
startQuery_queryStatement :: Lens' StartQuery Text
startQuery_queryStatement = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQuery' {Text
queryStatement :: Text
$sel:queryStatement:StartQuery' :: StartQuery -> Text
queryStatement} -> Text
queryStatement) (\s :: StartQuery
s@StartQuery' {} Text
a -> StartQuery
s {$sel:queryStatement:StartQuery' :: Text
queryStatement = Text
a} :: StartQuery)
instance Core.AWSRequest StartQuery where
type AWSResponse StartQuery = StartQueryResponse
request :: (Service -> Service) -> StartQuery -> Request StartQuery
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 StartQuery
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartQuery)))
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 -> StartQueryResponse
StartQueryResponse'
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
"QueryId")
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 StartQuery where
hashWithSalt :: Int -> StartQuery -> Int
hashWithSalt Int
_salt StartQuery' {Maybe Text
Text
queryStatement :: Text
deliveryS3Uri :: Maybe Text
$sel:queryStatement:StartQuery' :: StartQuery -> Text
$sel:deliveryS3Uri:StartQuery' :: StartQuery -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deliveryS3Uri
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
queryStatement
instance Prelude.NFData StartQuery where
rnf :: StartQuery -> ()
rnf StartQuery' {Maybe Text
Text
queryStatement :: Text
deliveryS3Uri :: Maybe Text
$sel:queryStatement:StartQuery' :: StartQuery -> Text
$sel:deliveryS3Uri:StartQuery' :: StartQuery -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deliveryS3Uri
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
queryStatement
instance Data.ToHeaders StartQuery where
toHeaders :: StartQuery -> 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
"com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.StartQuery" ::
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 StartQuery where
toJSON :: StartQuery -> Value
toJSON StartQuery' {Maybe Text
Text
queryStatement :: Text
deliveryS3Uri :: Maybe Text
$sel:queryStatement:StartQuery' :: StartQuery -> Text
$sel:deliveryS3Uri:StartQuery' :: StartQuery -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DeliveryS3Uri" 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
deliveryS3Uri,
forall a. a -> Maybe a
Prelude.Just
(Key
"QueryStatement" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
queryStatement)
]
)
instance Data.ToPath StartQuery where
toPath :: StartQuery -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery StartQuery where
toQuery :: StartQuery -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data StartQueryResponse = StartQueryResponse'
{
StartQueryResponse -> Maybe Text
queryId :: Prelude.Maybe Prelude.Text,
StartQueryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartQueryResponse -> StartQueryResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartQueryResponse -> StartQueryResponse -> Bool
$c/= :: StartQueryResponse -> StartQueryResponse -> Bool
== :: StartQueryResponse -> StartQueryResponse -> Bool
$c== :: StartQueryResponse -> StartQueryResponse -> Bool
Prelude.Eq, ReadPrec [StartQueryResponse]
ReadPrec StartQueryResponse
Int -> ReadS StartQueryResponse
ReadS [StartQueryResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartQueryResponse]
$creadListPrec :: ReadPrec [StartQueryResponse]
readPrec :: ReadPrec StartQueryResponse
$creadPrec :: ReadPrec StartQueryResponse
readList :: ReadS [StartQueryResponse]
$creadList :: ReadS [StartQueryResponse]
readsPrec :: Int -> ReadS StartQueryResponse
$creadsPrec :: Int -> ReadS StartQueryResponse
Prelude.Read, Int -> StartQueryResponse -> ShowS
[StartQueryResponse] -> ShowS
StartQueryResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartQueryResponse] -> ShowS
$cshowList :: [StartQueryResponse] -> ShowS
show :: StartQueryResponse -> String
$cshow :: StartQueryResponse -> String
showsPrec :: Int -> StartQueryResponse -> ShowS
$cshowsPrec :: Int -> StartQueryResponse -> ShowS
Prelude.Show, forall x. Rep StartQueryResponse x -> StartQueryResponse
forall x. StartQueryResponse -> Rep StartQueryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartQueryResponse x -> StartQueryResponse
$cfrom :: forall x. StartQueryResponse -> Rep StartQueryResponse x
Prelude.Generic)
newStartQueryResponse ::
Prelude.Int ->
StartQueryResponse
newStartQueryResponse :: Int -> StartQueryResponse
newStartQueryResponse Int
pHttpStatus_ =
StartQueryResponse'
{ $sel:queryId:StartQueryResponse' :: Maybe Text
queryId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartQueryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startQueryResponse_queryId :: Lens.Lens' StartQueryResponse (Prelude.Maybe Prelude.Text)
startQueryResponse_queryId :: Lens' StartQueryResponse (Maybe Text)
startQueryResponse_queryId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQueryResponse' {Maybe Text
queryId :: Maybe Text
$sel:queryId:StartQueryResponse' :: StartQueryResponse -> Maybe Text
queryId} -> Maybe Text
queryId) (\s :: StartQueryResponse
s@StartQueryResponse' {} Maybe Text
a -> StartQueryResponse
s {$sel:queryId:StartQueryResponse' :: Maybe Text
queryId = Maybe Text
a} :: StartQueryResponse)
startQueryResponse_httpStatus :: Lens.Lens' StartQueryResponse Prelude.Int
startQueryResponse_httpStatus :: Lens' StartQueryResponse Int
startQueryResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartQueryResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartQueryResponse' :: StartQueryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartQueryResponse
s@StartQueryResponse' {} Int
a -> StartQueryResponse
s {$sel:httpStatus:StartQueryResponse' :: Int
httpStatus = Int
a} :: StartQueryResponse)
instance Prelude.NFData StartQueryResponse where
rnf :: StartQueryResponse -> ()
rnf StartQueryResponse' {Int
Maybe Text
httpStatus :: Int
queryId :: Maybe Text
$sel:httpStatus:StartQueryResponse' :: StartQueryResponse -> Int
$sel:queryId:StartQueryResponse' :: StartQueryResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
queryId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus