{-# 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.AMP.CreateLoggingConfiguration
(
CreateLoggingConfiguration (..),
newCreateLoggingConfiguration,
createLoggingConfiguration_clientToken,
createLoggingConfiguration_logGroupArn,
createLoggingConfiguration_workspaceId,
CreateLoggingConfigurationResponse (..),
newCreateLoggingConfigurationResponse,
createLoggingConfigurationResponse_httpStatus,
createLoggingConfigurationResponse_status,
)
where
import Amazonka.AMP.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 CreateLoggingConfiguration = CreateLoggingConfiguration'
{
CreateLoggingConfiguration -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreateLoggingConfiguration -> Text
logGroupArn :: Prelude.Text,
CreateLoggingConfiguration -> Text
workspaceId :: Prelude.Text
}
deriving (CreateLoggingConfiguration -> CreateLoggingConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLoggingConfiguration -> CreateLoggingConfiguration -> Bool
$c/= :: CreateLoggingConfiguration -> CreateLoggingConfiguration -> Bool
== :: CreateLoggingConfiguration -> CreateLoggingConfiguration -> Bool
$c== :: CreateLoggingConfiguration -> CreateLoggingConfiguration -> Bool
Prelude.Eq, ReadPrec [CreateLoggingConfiguration]
ReadPrec CreateLoggingConfiguration
Int -> ReadS CreateLoggingConfiguration
ReadS [CreateLoggingConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLoggingConfiguration]
$creadListPrec :: ReadPrec [CreateLoggingConfiguration]
readPrec :: ReadPrec CreateLoggingConfiguration
$creadPrec :: ReadPrec CreateLoggingConfiguration
readList :: ReadS [CreateLoggingConfiguration]
$creadList :: ReadS [CreateLoggingConfiguration]
readsPrec :: Int -> ReadS CreateLoggingConfiguration
$creadsPrec :: Int -> ReadS CreateLoggingConfiguration
Prelude.Read, Int -> CreateLoggingConfiguration -> ShowS
[CreateLoggingConfiguration] -> ShowS
CreateLoggingConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLoggingConfiguration] -> ShowS
$cshowList :: [CreateLoggingConfiguration] -> ShowS
show :: CreateLoggingConfiguration -> String
$cshow :: CreateLoggingConfiguration -> String
showsPrec :: Int -> CreateLoggingConfiguration -> ShowS
$cshowsPrec :: Int -> CreateLoggingConfiguration -> ShowS
Prelude.Show, forall x.
Rep CreateLoggingConfiguration x -> CreateLoggingConfiguration
forall x.
CreateLoggingConfiguration -> Rep CreateLoggingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLoggingConfiguration x -> CreateLoggingConfiguration
$cfrom :: forall x.
CreateLoggingConfiguration -> Rep CreateLoggingConfiguration x
Prelude.Generic)
newCreateLoggingConfiguration ::
Prelude.Text ->
Prelude.Text ->
CreateLoggingConfiguration
newCreateLoggingConfiguration :: Text -> Text -> CreateLoggingConfiguration
newCreateLoggingConfiguration
Text
pLogGroupArn_
Text
pWorkspaceId_ =
CreateLoggingConfiguration'
{ $sel:clientToken:CreateLoggingConfiguration' :: Maybe Text
clientToken =
forall a. Maybe a
Prelude.Nothing,
$sel:logGroupArn:CreateLoggingConfiguration' :: Text
logGroupArn = Text
pLogGroupArn_,
$sel:workspaceId:CreateLoggingConfiguration' :: Text
workspaceId = Text
pWorkspaceId_
}
createLoggingConfiguration_clientToken :: Lens.Lens' CreateLoggingConfiguration (Prelude.Maybe Prelude.Text)
createLoggingConfiguration_clientToken :: Lens' CreateLoggingConfiguration (Maybe Text)
createLoggingConfiguration_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggingConfiguration' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateLoggingConfiguration
s@CreateLoggingConfiguration' {} Maybe Text
a -> CreateLoggingConfiguration
s {$sel:clientToken:CreateLoggingConfiguration' :: Maybe Text
clientToken = Maybe Text
a} :: CreateLoggingConfiguration)
createLoggingConfiguration_logGroupArn :: Lens.Lens' CreateLoggingConfiguration Prelude.Text
createLoggingConfiguration_logGroupArn :: Lens' CreateLoggingConfiguration Text
createLoggingConfiguration_logGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggingConfiguration' {Text
logGroupArn :: Text
$sel:logGroupArn:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Text
logGroupArn} -> Text
logGroupArn) (\s :: CreateLoggingConfiguration
s@CreateLoggingConfiguration' {} Text
a -> CreateLoggingConfiguration
s {$sel:logGroupArn:CreateLoggingConfiguration' :: Text
logGroupArn = Text
a} :: CreateLoggingConfiguration)
createLoggingConfiguration_workspaceId :: Lens.Lens' CreateLoggingConfiguration Prelude.Text
createLoggingConfiguration_workspaceId :: Lens' CreateLoggingConfiguration Text
createLoggingConfiguration_workspaceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggingConfiguration' {Text
workspaceId :: Text
$sel:workspaceId:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Text
workspaceId} -> Text
workspaceId) (\s :: CreateLoggingConfiguration
s@CreateLoggingConfiguration' {} Text
a -> CreateLoggingConfiguration
s {$sel:workspaceId:CreateLoggingConfiguration' :: Text
workspaceId = Text
a} :: CreateLoggingConfiguration)
instance Core.AWSRequest CreateLoggingConfiguration where
type
AWSResponse CreateLoggingConfiguration =
CreateLoggingConfigurationResponse
request :: (Service -> Service)
-> CreateLoggingConfiguration -> Request CreateLoggingConfiguration
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 CreateLoggingConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateLoggingConfiguration)))
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 ->
Int
-> LoggingConfigurationStatus -> CreateLoggingConfigurationResponse
CreateLoggingConfigurationResponse'
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))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"status")
)
instance Prelude.Hashable CreateLoggingConfiguration where
hashWithSalt :: Int -> CreateLoggingConfiguration -> Int
hashWithSalt Int
_salt CreateLoggingConfiguration' {Maybe Text
Text
workspaceId :: Text
logGroupArn :: Text
clientToken :: Maybe Text
$sel:workspaceId:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Text
$sel:logGroupArn:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Text
$sel:clientToken:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
logGroupArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workspaceId
instance Prelude.NFData CreateLoggingConfiguration where
rnf :: CreateLoggingConfiguration -> ()
rnf CreateLoggingConfiguration' {Maybe Text
Text
workspaceId :: Text
logGroupArn :: Text
clientToken :: Maybe Text
$sel:workspaceId:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Text
$sel:logGroupArn:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Text
$sel:clientToken:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
logGroupArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workspaceId
instance Data.ToHeaders CreateLoggingConfiguration where
toHeaders :: CreateLoggingConfiguration -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateLoggingConfiguration where
toJSON :: CreateLoggingConfiguration -> Value
toJSON CreateLoggingConfiguration' {Maybe Text
Text
workspaceId :: Text
logGroupArn :: Text
clientToken :: Maybe Text
$sel:workspaceId:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Text
$sel:logGroupArn:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Text
$sel:clientToken:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"clientToken" 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
clientToken,
forall a. a -> Maybe a
Prelude.Just (Key
"logGroupArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
logGroupArn)
]
)
instance Data.ToPath CreateLoggingConfiguration where
toPath :: CreateLoggingConfiguration -> ByteString
toPath CreateLoggingConfiguration' {Maybe Text
Text
workspaceId :: Text
logGroupArn :: Text
clientToken :: Maybe Text
$sel:workspaceId:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Text
$sel:logGroupArn:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Text
$sel:clientToken:CreateLoggingConfiguration' :: CreateLoggingConfiguration -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/workspaces/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
workspaceId, ByteString
"/logging"]
instance Data.ToQuery CreateLoggingConfiguration where
toQuery :: CreateLoggingConfiguration -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateLoggingConfigurationResponse = CreateLoggingConfigurationResponse'
{
CreateLoggingConfigurationResponse -> Int
httpStatus :: Prelude.Int,
CreateLoggingConfigurationResponse -> LoggingConfigurationStatus
status :: LoggingConfigurationStatus
}
deriving (CreateLoggingConfigurationResponse
-> CreateLoggingConfigurationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLoggingConfigurationResponse
-> CreateLoggingConfigurationResponse -> Bool
$c/= :: CreateLoggingConfigurationResponse
-> CreateLoggingConfigurationResponse -> Bool
== :: CreateLoggingConfigurationResponse
-> CreateLoggingConfigurationResponse -> Bool
$c== :: CreateLoggingConfigurationResponse
-> CreateLoggingConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [CreateLoggingConfigurationResponse]
ReadPrec CreateLoggingConfigurationResponse
Int -> ReadS CreateLoggingConfigurationResponse
ReadS [CreateLoggingConfigurationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLoggingConfigurationResponse]
$creadListPrec :: ReadPrec [CreateLoggingConfigurationResponse]
readPrec :: ReadPrec CreateLoggingConfigurationResponse
$creadPrec :: ReadPrec CreateLoggingConfigurationResponse
readList :: ReadS [CreateLoggingConfigurationResponse]
$creadList :: ReadS [CreateLoggingConfigurationResponse]
readsPrec :: Int -> ReadS CreateLoggingConfigurationResponse
$creadsPrec :: Int -> ReadS CreateLoggingConfigurationResponse
Prelude.Read, Int -> CreateLoggingConfigurationResponse -> ShowS
[CreateLoggingConfigurationResponse] -> ShowS
CreateLoggingConfigurationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLoggingConfigurationResponse] -> ShowS
$cshowList :: [CreateLoggingConfigurationResponse] -> ShowS
show :: CreateLoggingConfigurationResponse -> String
$cshow :: CreateLoggingConfigurationResponse -> String
showsPrec :: Int -> CreateLoggingConfigurationResponse -> ShowS
$cshowsPrec :: Int -> CreateLoggingConfigurationResponse -> ShowS
Prelude.Show, forall x.
Rep CreateLoggingConfigurationResponse x
-> CreateLoggingConfigurationResponse
forall x.
CreateLoggingConfigurationResponse
-> Rep CreateLoggingConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLoggingConfigurationResponse x
-> CreateLoggingConfigurationResponse
$cfrom :: forall x.
CreateLoggingConfigurationResponse
-> Rep CreateLoggingConfigurationResponse x
Prelude.Generic)
newCreateLoggingConfigurationResponse ::
Prelude.Int ->
LoggingConfigurationStatus ->
CreateLoggingConfigurationResponse
newCreateLoggingConfigurationResponse :: Int
-> LoggingConfigurationStatus -> CreateLoggingConfigurationResponse
newCreateLoggingConfigurationResponse
Int
pHttpStatus_
LoggingConfigurationStatus
pStatus_ =
CreateLoggingConfigurationResponse'
{ $sel:httpStatus:CreateLoggingConfigurationResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:status:CreateLoggingConfigurationResponse' :: LoggingConfigurationStatus
status = LoggingConfigurationStatus
pStatus_
}
createLoggingConfigurationResponse_httpStatus :: Lens.Lens' CreateLoggingConfigurationResponse Prelude.Int
createLoggingConfigurationResponse_httpStatus :: Lens' CreateLoggingConfigurationResponse Int
createLoggingConfigurationResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggingConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateLoggingConfigurationResponse' :: CreateLoggingConfigurationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateLoggingConfigurationResponse
s@CreateLoggingConfigurationResponse' {} Int
a -> CreateLoggingConfigurationResponse
s {$sel:httpStatus:CreateLoggingConfigurationResponse' :: Int
httpStatus = Int
a} :: CreateLoggingConfigurationResponse)
createLoggingConfigurationResponse_status :: Lens.Lens' CreateLoggingConfigurationResponse LoggingConfigurationStatus
createLoggingConfigurationResponse_status :: Lens' CreateLoggingConfigurationResponse LoggingConfigurationStatus
createLoggingConfigurationResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggingConfigurationResponse' {LoggingConfigurationStatus
status :: LoggingConfigurationStatus
$sel:status:CreateLoggingConfigurationResponse' :: CreateLoggingConfigurationResponse -> LoggingConfigurationStatus
status} -> LoggingConfigurationStatus
status) (\s :: CreateLoggingConfigurationResponse
s@CreateLoggingConfigurationResponse' {} LoggingConfigurationStatus
a -> CreateLoggingConfigurationResponse
s {$sel:status:CreateLoggingConfigurationResponse' :: LoggingConfigurationStatus
status = LoggingConfigurationStatus
a} :: CreateLoggingConfigurationResponse)
instance
Prelude.NFData
CreateLoggingConfigurationResponse
where
rnf :: CreateLoggingConfigurationResponse -> ()
rnf CreateLoggingConfigurationResponse' {Int
LoggingConfigurationStatus
status :: LoggingConfigurationStatus
httpStatus :: Int
$sel:status:CreateLoggingConfigurationResponse' :: CreateLoggingConfigurationResponse -> LoggingConfigurationStatus
$sel:httpStatus:CreateLoggingConfigurationResponse' :: CreateLoggingConfigurationResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf LoggingConfigurationStatus
status