{-# 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.StartLogging
(
StartLogging (..),
newStartLogging,
startLogging_name,
StartLoggingResponse (..),
newStartLoggingResponse,
startLoggingResponse_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 StartLogging = StartLogging'
{
StartLogging -> Text
name :: Prelude.Text
}
deriving (StartLogging -> StartLogging -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartLogging -> StartLogging -> Bool
$c/= :: StartLogging -> StartLogging -> Bool
== :: StartLogging -> StartLogging -> Bool
$c== :: StartLogging -> StartLogging -> Bool
Prelude.Eq, ReadPrec [StartLogging]
ReadPrec StartLogging
Int -> ReadS StartLogging
ReadS [StartLogging]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartLogging]
$creadListPrec :: ReadPrec [StartLogging]
readPrec :: ReadPrec StartLogging
$creadPrec :: ReadPrec StartLogging
readList :: ReadS [StartLogging]
$creadList :: ReadS [StartLogging]
readsPrec :: Int -> ReadS StartLogging
$creadsPrec :: Int -> ReadS StartLogging
Prelude.Read, Int -> StartLogging -> ShowS
[StartLogging] -> ShowS
StartLogging -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartLogging] -> ShowS
$cshowList :: [StartLogging] -> ShowS
show :: StartLogging -> String
$cshow :: StartLogging -> String
showsPrec :: Int -> StartLogging -> ShowS
$cshowsPrec :: Int -> StartLogging -> ShowS
Prelude.Show, forall x. Rep StartLogging x -> StartLogging
forall x. StartLogging -> Rep StartLogging x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartLogging x -> StartLogging
$cfrom :: forall x. StartLogging -> Rep StartLogging x
Prelude.Generic)
newStartLogging ::
Prelude.Text ->
StartLogging
newStartLogging :: Text -> StartLogging
newStartLogging Text
pName_ = StartLogging' {$sel:name:StartLogging' :: Text
name = Text
pName_}
startLogging_name :: Lens.Lens' StartLogging Prelude.Text
startLogging_name :: Lens' StartLogging Text
startLogging_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartLogging' {Text
name :: Text
$sel:name:StartLogging' :: StartLogging -> Text
name} -> Text
name) (\s :: StartLogging
s@StartLogging' {} Text
a -> StartLogging
s {$sel:name:StartLogging' :: Text
name = Text
a} :: StartLogging)
instance Core.AWSRequest StartLogging where
type AWSResponse StartLogging = StartLoggingResponse
request :: (Service -> Service) -> StartLogging -> Request StartLogging
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 StartLogging
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartLogging)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> StartLoggingResponse
StartLoggingResponse'
forall (f :: * -> *) a b. Functor 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 StartLogging where
hashWithSalt :: Int -> StartLogging -> Int
hashWithSalt Int
_salt StartLogging' {Text
name :: Text
$sel:name:StartLogging' :: StartLogging -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData StartLogging where
rnf :: StartLogging -> ()
rnf StartLogging' {Text
name :: Text
$sel:name:StartLogging' :: StartLogging -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToHeaders StartLogging where
toHeaders :: StartLogging -> 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.StartLogging" ::
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 StartLogging where
toJSON :: StartLogging -> Value
toJSON StartLogging' {Text
name :: Text
$sel:name:StartLogging' :: StartLogging -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)]
)
instance Data.ToPath StartLogging where
toPath :: StartLogging -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery StartLogging where
toQuery :: StartLogging -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data StartLoggingResponse = StartLoggingResponse'
{
StartLoggingResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartLoggingResponse -> StartLoggingResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartLoggingResponse -> StartLoggingResponse -> Bool
$c/= :: StartLoggingResponse -> StartLoggingResponse -> Bool
== :: StartLoggingResponse -> StartLoggingResponse -> Bool
$c== :: StartLoggingResponse -> StartLoggingResponse -> Bool
Prelude.Eq, ReadPrec [StartLoggingResponse]
ReadPrec StartLoggingResponse
Int -> ReadS StartLoggingResponse
ReadS [StartLoggingResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartLoggingResponse]
$creadListPrec :: ReadPrec [StartLoggingResponse]
readPrec :: ReadPrec StartLoggingResponse
$creadPrec :: ReadPrec StartLoggingResponse
readList :: ReadS [StartLoggingResponse]
$creadList :: ReadS [StartLoggingResponse]
readsPrec :: Int -> ReadS StartLoggingResponse
$creadsPrec :: Int -> ReadS StartLoggingResponse
Prelude.Read, Int -> StartLoggingResponse -> ShowS
[StartLoggingResponse] -> ShowS
StartLoggingResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartLoggingResponse] -> ShowS
$cshowList :: [StartLoggingResponse] -> ShowS
show :: StartLoggingResponse -> String
$cshow :: StartLoggingResponse -> String
showsPrec :: Int -> StartLoggingResponse -> ShowS
$cshowsPrec :: Int -> StartLoggingResponse -> ShowS
Prelude.Show, forall x. Rep StartLoggingResponse x -> StartLoggingResponse
forall x. StartLoggingResponse -> Rep StartLoggingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartLoggingResponse x -> StartLoggingResponse
$cfrom :: forall x. StartLoggingResponse -> Rep StartLoggingResponse x
Prelude.Generic)
newStartLoggingResponse ::
Prelude.Int ->
StartLoggingResponse
newStartLoggingResponse :: Int -> StartLoggingResponse
newStartLoggingResponse Int
pHttpStatus_ =
StartLoggingResponse' {$sel:httpStatus:StartLoggingResponse' :: Int
httpStatus = Int
pHttpStatus_}
startLoggingResponse_httpStatus :: Lens.Lens' StartLoggingResponse Prelude.Int
startLoggingResponse_httpStatus :: Lens' StartLoggingResponse Int
startLoggingResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartLoggingResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartLoggingResponse' :: StartLoggingResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartLoggingResponse
s@StartLoggingResponse' {} Int
a -> StartLoggingResponse
s {$sel:httpStatus:StartLoggingResponse' :: Int
httpStatus = Int
a} :: StartLoggingResponse)
instance Prelude.NFData StartLoggingResponse where
rnf :: StartLoggingResponse -> ()
rnf StartLoggingResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartLoggingResponse' :: StartLoggingResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus