{-# 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.CloudWatchLogs.CreateLogGroup
(
CreateLogGroup (..),
newCreateLogGroup,
createLogGroup_kmsKeyId,
createLogGroup_tags,
createLogGroup_logGroupName,
CreateLogGroupResponse (..),
newCreateLogGroupResponse,
)
where
import Amazonka.CloudWatchLogs.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 CreateLogGroup = CreateLogGroup'
{
CreateLogGroup -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
CreateLogGroup -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateLogGroup -> Text
logGroupName :: Prelude.Text
}
deriving (CreateLogGroup -> CreateLogGroup -> Bool
(CreateLogGroup -> CreateLogGroup -> Bool)
-> (CreateLogGroup -> CreateLogGroup -> Bool) -> Eq CreateLogGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLogGroup -> CreateLogGroup -> Bool
$c/= :: CreateLogGroup -> CreateLogGroup -> Bool
== :: CreateLogGroup -> CreateLogGroup -> Bool
$c== :: CreateLogGroup -> CreateLogGroup -> Bool
Prelude.Eq, ReadPrec [CreateLogGroup]
ReadPrec CreateLogGroup
Int -> ReadS CreateLogGroup
ReadS [CreateLogGroup]
(Int -> ReadS CreateLogGroup)
-> ReadS [CreateLogGroup]
-> ReadPrec CreateLogGroup
-> ReadPrec [CreateLogGroup]
-> Read CreateLogGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLogGroup]
$creadListPrec :: ReadPrec [CreateLogGroup]
readPrec :: ReadPrec CreateLogGroup
$creadPrec :: ReadPrec CreateLogGroup
readList :: ReadS [CreateLogGroup]
$creadList :: ReadS [CreateLogGroup]
readsPrec :: Int -> ReadS CreateLogGroup
$creadsPrec :: Int -> ReadS CreateLogGroup
Prelude.Read, Int -> CreateLogGroup -> ShowS
[CreateLogGroup] -> ShowS
CreateLogGroup -> String
(Int -> CreateLogGroup -> ShowS)
-> (CreateLogGroup -> String)
-> ([CreateLogGroup] -> ShowS)
-> Show CreateLogGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLogGroup] -> ShowS
$cshowList :: [CreateLogGroup] -> ShowS
show :: CreateLogGroup -> String
$cshow :: CreateLogGroup -> String
showsPrec :: Int -> CreateLogGroup -> ShowS
$cshowsPrec :: Int -> CreateLogGroup -> ShowS
Prelude.Show, (forall x. CreateLogGroup -> Rep CreateLogGroup x)
-> (forall x. Rep CreateLogGroup x -> CreateLogGroup)
-> Generic CreateLogGroup
forall x. Rep CreateLogGroup x -> CreateLogGroup
forall x. CreateLogGroup -> Rep CreateLogGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLogGroup x -> CreateLogGroup
$cfrom :: forall x. CreateLogGroup -> Rep CreateLogGroup x
Prelude.Generic)
newCreateLogGroup ::
Prelude.Text ->
CreateLogGroup
newCreateLogGroup :: Text -> CreateLogGroup
newCreateLogGroup Text
pLogGroupName_ =
CreateLogGroup' :: Maybe Text -> Maybe (HashMap Text Text) -> Text -> CreateLogGroup
CreateLogGroup'
{ $sel:kmsKeyId:CreateLogGroup' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateLogGroup' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:logGroupName:CreateLogGroup' :: Text
logGroupName = Text
pLogGroupName_
}
createLogGroup_kmsKeyId :: Lens.Lens' CreateLogGroup (Prelude.Maybe Prelude.Text)
createLogGroup_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> CreateLogGroup -> f CreateLogGroup
createLogGroup_kmsKeyId = (CreateLogGroup -> Maybe Text)
-> (CreateLogGroup -> Maybe Text -> CreateLogGroup)
-> Lens CreateLogGroup CreateLogGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLogGroup' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CreateLogGroup' :: CreateLogGroup -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CreateLogGroup
s@CreateLogGroup' {} Maybe Text
a -> CreateLogGroup
s {$sel:kmsKeyId:CreateLogGroup' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CreateLogGroup)
createLogGroup_tags :: Lens.Lens' CreateLogGroup (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createLogGroup_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateLogGroup -> f CreateLogGroup
createLogGroup_tags = (CreateLogGroup -> Maybe (HashMap Text Text))
-> (CreateLogGroup -> Maybe (HashMap Text Text) -> CreateLogGroup)
-> Lens
CreateLogGroup
CreateLogGroup
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLogGroup' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateLogGroup' :: CreateLogGroup -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateLogGroup
s@CreateLogGroup' {} Maybe (HashMap Text Text)
a -> CreateLogGroup
s {$sel:tags:CreateLogGroup' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateLogGroup) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateLogGroup -> f CreateLogGroup)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateLogGroup
-> f CreateLogGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createLogGroup_logGroupName :: Lens.Lens' CreateLogGroup Prelude.Text
createLogGroup_logGroupName :: (Text -> f Text) -> CreateLogGroup -> f CreateLogGroup
createLogGroup_logGroupName = (CreateLogGroup -> Text)
-> (CreateLogGroup -> Text -> CreateLogGroup)
-> Lens CreateLogGroup CreateLogGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLogGroup' {Text
logGroupName :: Text
$sel:logGroupName:CreateLogGroup' :: CreateLogGroup -> Text
logGroupName} -> Text
logGroupName) (\s :: CreateLogGroup
s@CreateLogGroup' {} Text
a -> CreateLogGroup
s {$sel:logGroupName:CreateLogGroup' :: Text
logGroupName = Text
a} :: CreateLogGroup)
instance Core.AWSRequest CreateLogGroup where
type
AWSResponse CreateLogGroup =
CreateLogGroupResponse
request :: CreateLogGroup -> Request CreateLogGroup
request = Service -> CreateLogGroup -> Request CreateLogGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateLogGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLogGroup)))
response =
AWSResponse CreateLogGroup
-> Logger
-> Service
-> Proxy CreateLogGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLogGroup)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse CreateLogGroup
CreateLogGroupResponse
CreateLogGroupResponse'
instance Prelude.Hashable CreateLogGroup
instance Prelude.NFData CreateLogGroup
instance Core.ToHeaders CreateLogGroup where
toHeaders :: CreateLogGroup -> [Header]
toHeaders =
[Header] -> CreateLogGroup -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"Logs_20140328.CreateLogGroup" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreateLogGroup where
toJSON :: CreateLogGroup -> Value
toJSON CreateLogGroup' {Maybe Text
Maybe (HashMap Text Text)
Text
logGroupName :: Text
tags :: Maybe (HashMap Text Text)
kmsKeyId :: Maybe Text
$sel:logGroupName:CreateLogGroup' :: CreateLogGroup -> Text
$sel:tags:CreateLogGroup' :: CreateLogGroup -> Maybe (HashMap Text Text)
$sel:kmsKeyId:CreateLogGroup' :: CreateLogGroup -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"kmsKeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
(Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"logGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
logGroupName)
]
)
instance Core.ToPath CreateLogGroup where
toPath :: CreateLogGroup -> ByteString
toPath = ByteString -> CreateLogGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateLogGroup where
toQuery :: CreateLogGroup -> QueryString
toQuery = QueryString -> CreateLogGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateLogGroupResponse = CreateLogGroupResponse'
{
}
deriving (CreateLogGroupResponse -> CreateLogGroupResponse -> Bool
(CreateLogGroupResponse -> CreateLogGroupResponse -> Bool)
-> (CreateLogGroupResponse -> CreateLogGroupResponse -> Bool)
-> Eq CreateLogGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLogGroupResponse -> CreateLogGroupResponse -> Bool
$c/= :: CreateLogGroupResponse -> CreateLogGroupResponse -> Bool
== :: CreateLogGroupResponse -> CreateLogGroupResponse -> Bool
$c== :: CreateLogGroupResponse -> CreateLogGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateLogGroupResponse]
ReadPrec CreateLogGroupResponse
Int -> ReadS CreateLogGroupResponse
ReadS [CreateLogGroupResponse]
(Int -> ReadS CreateLogGroupResponse)
-> ReadS [CreateLogGroupResponse]
-> ReadPrec CreateLogGroupResponse
-> ReadPrec [CreateLogGroupResponse]
-> Read CreateLogGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLogGroupResponse]
$creadListPrec :: ReadPrec [CreateLogGroupResponse]
readPrec :: ReadPrec CreateLogGroupResponse
$creadPrec :: ReadPrec CreateLogGroupResponse
readList :: ReadS [CreateLogGroupResponse]
$creadList :: ReadS [CreateLogGroupResponse]
readsPrec :: Int -> ReadS CreateLogGroupResponse
$creadsPrec :: Int -> ReadS CreateLogGroupResponse
Prelude.Read, Int -> CreateLogGroupResponse -> ShowS
[CreateLogGroupResponse] -> ShowS
CreateLogGroupResponse -> String
(Int -> CreateLogGroupResponse -> ShowS)
-> (CreateLogGroupResponse -> String)
-> ([CreateLogGroupResponse] -> ShowS)
-> Show CreateLogGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLogGroupResponse] -> ShowS
$cshowList :: [CreateLogGroupResponse] -> ShowS
show :: CreateLogGroupResponse -> String
$cshow :: CreateLogGroupResponse -> String
showsPrec :: Int -> CreateLogGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateLogGroupResponse -> ShowS
Prelude.Show, (forall x. CreateLogGroupResponse -> Rep CreateLogGroupResponse x)
-> (forall x.
Rep CreateLogGroupResponse x -> CreateLogGroupResponse)
-> Generic CreateLogGroupResponse
forall x. Rep CreateLogGroupResponse x -> CreateLogGroupResponse
forall x. CreateLogGroupResponse -> Rep CreateLogGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLogGroupResponse x -> CreateLogGroupResponse
$cfrom :: forall x. CreateLogGroupResponse -> Rep CreateLogGroupResponse x
Prelude.Generic)
newCreateLogGroupResponse ::
CreateLogGroupResponse
newCreateLogGroupResponse :: CreateLogGroupResponse
newCreateLogGroupResponse = CreateLogGroupResponse
CreateLogGroupResponse'
instance Prelude.NFData CreateLogGroupResponse