{-# 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.Lens as Lens
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
(StartLogging -> StartLogging -> Bool)
-> (StartLogging -> StartLogging -> Bool) -> Eq StartLogging
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]
(Int -> ReadS StartLogging)
-> ReadS [StartLogging]
-> ReadPrec StartLogging
-> ReadPrec [StartLogging]
-> Read 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
(Int -> StartLogging -> ShowS)
-> (StartLogging -> String)
-> ([StartLogging] -> ShowS)
-> Show StartLogging
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. StartLogging -> Rep StartLogging x)
-> (forall x. Rep StartLogging x -> StartLogging)
-> Generic StartLogging
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' :: Text -> StartLogging
StartLogging' {$sel:name:StartLogging' :: Text
name = Text
pName_}
startLogging_name :: Lens.Lens' StartLogging Prelude.Text
startLogging_name :: (Text -> f Text) -> StartLogging -> f StartLogging
startLogging_name = (StartLogging -> Text)
-> (StartLogging -> Text -> StartLogging)
-> Lens StartLogging StartLogging Text Text
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 :: StartLogging -> Request StartLogging
request = Service -> StartLogging -> Request StartLogging
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartLogging
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartLogging)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse StartLogging))
-> Logger
-> Service
-> Proxy StartLogging
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartLogging)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> StartLoggingResponse
StartLoggingResponse'
(Int -> StartLoggingResponse)
-> Either String Int -> Either String StartLoggingResponse
forall (f :: * -> *) a b. Functor 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 StartLogging
instance Prelude.NFData StartLogging
instance Core.ToHeaders StartLogging where
toHeaders :: StartLogging -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartLogging -> 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
"com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.StartLogging" ::
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 StartLogging where
toJSON :: StartLogging -> Value
toJSON StartLogging' {Text
name :: Text
$sel:name:StartLogging' :: StartLogging -> 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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
)
instance Core.ToPath StartLogging where
toPath :: StartLogging -> ByteString
toPath = ByteString -> StartLogging -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartLogging where
toQuery :: StartLogging -> QueryString
toQuery = QueryString -> StartLogging -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartLoggingResponse = StartLoggingResponse'
{
StartLoggingResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartLoggingResponse -> StartLoggingResponse -> Bool
(StartLoggingResponse -> StartLoggingResponse -> Bool)
-> (StartLoggingResponse -> StartLoggingResponse -> Bool)
-> Eq StartLoggingResponse
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]
(Int -> ReadS StartLoggingResponse)
-> ReadS [StartLoggingResponse]
-> ReadPrec StartLoggingResponse
-> ReadPrec [StartLoggingResponse]
-> Read 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
(Int -> StartLoggingResponse -> ShowS)
-> (StartLoggingResponse -> String)
-> ([StartLoggingResponse] -> ShowS)
-> Show StartLoggingResponse
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. StartLoggingResponse -> Rep StartLoggingResponse x)
-> (forall x. Rep StartLoggingResponse x -> StartLoggingResponse)
-> Generic StartLoggingResponse
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' :: Int -> StartLoggingResponse
StartLoggingResponse' {$sel:httpStatus:StartLoggingResponse' :: Int
httpStatus = Int
pHttpStatus_}
startLoggingResponse_httpStatus :: Lens.Lens' StartLoggingResponse Prelude.Int
startLoggingResponse_httpStatus :: (Int -> f Int) -> StartLoggingResponse -> f StartLoggingResponse
startLoggingResponse_httpStatus = (StartLoggingResponse -> Int)
-> (StartLoggingResponse -> Int -> StartLoggingResponse)
-> Lens StartLoggingResponse StartLoggingResponse Int Int
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