{-# 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.CreateLogStream
(
CreateLogStream (..),
newCreateLogStream,
createLogStream_logGroupName,
createLogStream_logStreamName,
CreateLogStreamResponse (..),
newCreateLogStreamResponse,
)
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 CreateLogStream = CreateLogStream'
{
CreateLogStream -> Text
logGroupName :: Prelude.Text,
CreateLogStream -> Text
logStreamName :: Prelude.Text
}
deriving (CreateLogStream -> CreateLogStream -> Bool
(CreateLogStream -> CreateLogStream -> Bool)
-> (CreateLogStream -> CreateLogStream -> Bool)
-> Eq CreateLogStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLogStream -> CreateLogStream -> Bool
$c/= :: CreateLogStream -> CreateLogStream -> Bool
== :: CreateLogStream -> CreateLogStream -> Bool
$c== :: CreateLogStream -> CreateLogStream -> Bool
Prelude.Eq, ReadPrec [CreateLogStream]
ReadPrec CreateLogStream
Int -> ReadS CreateLogStream
ReadS [CreateLogStream]
(Int -> ReadS CreateLogStream)
-> ReadS [CreateLogStream]
-> ReadPrec CreateLogStream
-> ReadPrec [CreateLogStream]
-> Read CreateLogStream
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLogStream]
$creadListPrec :: ReadPrec [CreateLogStream]
readPrec :: ReadPrec CreateLogStream
$creadPrec :: ReadPrec CreateLogStream
readList :: ReadS [CreateLogStream]
$creadList :: ReadS [CreateLogStream]
readsPrec :: Int -> ReadS CreateLogStream
$creadsPrec :: Int -> ReadS CreateLogStream
Prelude.Read, Int -> CreateLogStream -> ShowS
[CreateLogStream] -> ShowS
CreateLogStream -> String
(Int -> CreateLogStream -> ShowS)
-> (CreateLogStream -> String)
-> ([CreateLogStream] -> ShowS)
-> Show CreateLogStream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLogStream] -> ShowS
$cshowList :: [CreateLogStream] -> ShowS
show :: CreateLogStream -> String
$cshow :: CreateLogStream -> String
showsPrec :: Int -> CreateLogStream -> ShowS
$cshowsPrec :: Int -> CreateLogStream -> ShowS
Prelude.Show, (forall x. CreateLogStream -> Rep CreateLogStream x)
-> (forall x. Rep CreateLogStream x -> CreateLogStream)
-> Generic CreateLogStream
forall x. Rep CreateLogStream x -> CreateLogStream
forall x. CreateLogStream -> Rep CreateLogStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLogStream x -> CreateLogStream
$cfrom :: forall x. CreateLogStream -> Rep CreateLogStream x
Prelude.Generic)
newCreateLogStream ::
Prelude.Text ->
Prelude.Text ->
CreateLogStream
newCreateLogStream :: Text -> Text -> CreateLogStream
newCreateLogStream Text
pLogGroupName_ Text
pLogStreamName_ =
CreateLogStream' :: Text -> Text -> CreateLogStream
CreateLogStream'
{ $sel:logGroupName:CreateLogStream' :: Text
logGroupName = Text
pLogGroupName_,
$sel:logStreamName:CreateLogStream' :: Text
logStreamName = Text
pLogStreamName_
}
createLogStream_logGroupName :: Lens.Lens' CreateLogStream Prelude.Text
createLogStream_logGroupName :: (Text -> f Text) -> CreateLogStream -> f CreateLogStream
createLogStream_logGroupName = (CreateLogStream -> Text)
-> (CreateLogStream -> Text -> CreateLogStream)
-> Lens CreateLogStream CreateLogStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLogStream' {Text
logGroupName :: Text
$sel:logGroupName:CreateLogStream' :: CreateLogStream -> Text
logGroupName} -> Text
logGroupName) (\s :: CreateLogStream
s@CreateLogStream' {} Text
a -> CreateLogStream
s {$sel:logGroupName:CreateLogStream' :: Text
logGroupName = Text
a} :: CreateLogStream)
createLogStream_logStreamName :: Lens.Lens' CreateLogStream Prelude.Text
createLogStream_logStreamName :: (Text -> f Text) -> CreateLogStream -> f CreateLogStream
createLogStream_logStreamName = (CreateLogStream -> Text)
-> (CreateLogStream -> Text -> CreateLogStream)
-> Lens CreateLogStream CreateLogStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLogStream' {Text
logStreamName :: Text
$sel:logStreamName:CreateLogStream' :: CreateLogStream -> Text
logStreamName} -> Text
logStreamName) (\s :: CreateLogStream
s@CreateLogStream' {} Text
a -> CreateLogStream
s {$sel:logStreamName:CreateLogStream' :: Text
logStreamName = Text
a} :: CreateLogStream)
instance Core.AWSRequest CreateLogStream where
type
AWSResponse CreateLogStream =
CreateLogStreamResponse
request :: CreateLogStream -> Request CreateLogStream
request = Service -> CreateLogStream -> Request CreateLogStream
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateLogStream
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLogStream)))
response =
AWSResponse CreateLogStream
-> Logger
-> Service
-> Proxy CreateLogStream
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLogStream)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse CreateLogStream
CreateLogStreamResponse
CreateLogStreamResponse'
instance Prelude.Hashable CreateLogStream
instance Prelude.NFData CreateLogStream
instance Core.ToHeaders CreateLogStream where
toHeaders :: CreateLogStream -> [Header]
toHeaders =
[Header] -> CreateLogStream -> [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.CreateLogStream" ::
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 CreateLogStream where
toJSON :: CreateLogStream -> Value
toJSON CreateLogStream' {Text
logStreamName :: Text
logGroupName :: Text
$sel:logStreamName:CreateLogStream' :: CreateLogStream -> Text
$sel:logGroupName:CreateLogStream' :: CreateLogStream -> 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
"logGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
logGroupName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"logStreamName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
logStreamName)
]
)
instance Core.ToPath CreateLogStream where
toPath :: CreateLogStream -> ByteString
toPath = ByteString -> CreateLogStream -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateLogStream where
toQuery :: CreateLogStream -> QueryString
toQuery = QueryString -> CreateLogStream -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateLogStreamResponse = CreateLogStreamResponse'
{
}
deriving (CreateLogStreamResponse -> CreateLogStreamResponse -> Bool
(CreateLogStreamResponse -> CreateLogStreamResponse -> Bool)
-> (CreateLogStreamResponse -> CreateLogStreamResponse -> Bool)
-> Eq CreateLogStreamResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLogStreamResponse -> CreateLogStreamResponse -> Bool
$c/= :: CreateLogStreamResponse -> CreateLogStreamResponse -> Bool
== :: CreateLogStreamResponse -> CreateLogStreamResponse -> Bool
$c== :: CreateLogStreamResponse -> CreateLogStreamResponse -> Bool
Prelude.Eq, ReadPrec [CreateLogStreamResponse]
ReadPrec CreateLogStreamResponse
Int -> ReadS CreateLogStreamResponse
ReadS [CreateLogStreamResponse]
(Int -> ReadS CreateLogStreamResponse)
-> ReadS [CreateLogStreamResponse]
-> ReadPrec CreateLogStreamResponse
-> ReadPrec [CreateLogStreamResponse]
-> Read CreateLogStreamResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLogStreamResponse]
$creadListPrec :: ReadPrec [CreateLogStreamResponse]
readPrec :: ReadPrec CreateLogStreamResponse
$creadPrec :: ReadPrec CreateLogStreamResponse
readList :: ReadS [CreateLogStreamResponse]
$creadList :: ReadS [CreateLogStreamResponse]
readsPrec :: Int -> ReadS CreateLogStreamResponse
$creadsPrec :: Int -> ReadS CreateLogStreamResponse
Prelude.Read, Int -> CreateLogStreamResponse -> ShowS
[CreateLogStreamResponse] -> ShowS
CreateLogStreamResponse -> String
(Int -> CreateLogStreamResponse -> ShowS)
-> (CreateLogStreamResponse -> String)
-> ([CreateLogStreamResponse] -> ShowS)
-> Show CreateLogStreamResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLogStreamResponse] -> ShowS
$cshowList :: [CreateLogStreamResponse] -> ShowS
show :: CreateLogStreamResponse -> String
$cshow :: CreateLogStreamResponse -> String
showsPrec :: Int -> CreateLogStreamResponse -> ShowS
$cshowsPrec :: Int -> CreateLogStreamResponse -> ShowS
Prelude.Show, (forall x.
CreateLogStreamResponse -> Rep CreateLogStreamResponse x)
-> (forall x.
Rep CreateLogStreamResponse x -> CreateLogStreamResponse)
-> Generic CreateLogStreamResponse
forall x. Rep CreateLogStreamResponse x -> CreateLogStreamResponse
forall x. CreateLogStreamResponse -> Rep CreateLogStreamResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLogStreamResponse x -> CreateLogStreamResponse
$cfrom :: forall x. CreateLogStreamResponse -> Rep CreateLogStreamResponse x
Prelude.Generic)
newCreateLogStreamResponse ::
CreateLogStreamResponse
newCreateLogStreamResponse :: CreateLogStreamResponse
newCreateLogStreamResponse = CreateLogStreamResponse
CreateLogStreamResponse'
instance Prelude.NFData CreateLogStreamResponse