{-# 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.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 CreateLogStream = CreateLogStream'
{
CreateLogStream -> Text
logGroupName :: Prelude.Text,
CreateLogStream -> Text
logStreamName :: Prelude.Text
}
deriving (CreateLogStream -> CreateLogStream -> Bool
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]
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
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. 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'
{ $sel:logGroupName:CreateLogStream' :: Text
logGroupName = Text
pLogGroupName_,
$sel:logStreamName:CreateLogStream' :: Text
logStreamName = Text
pLogStreamName_
}
createLogStream_logGroupName :: Lens.Lens' CreateLogStream Prelude.Text
createLogStream_logGroupName :: Lens' CreateLogStream Text
createLogStream_logGroupName = 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 :: Lens' CreateLogStream Text
createLogStream_logStreamName = 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 :: (Service -> Service) -> CreateLogStream -> Request CreateLogStream
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 CreateLogStream
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateLogStream)))
response =
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull CreateLogStreamResponse
CreateLogStreamResponse'
instance Prelude.Hashable CreateLogStream where
hashWithSalt :: Int -> CreateLogStream -> Int
hashWithSalt Int
_salt CreateLogStream' {Text
logStreamName :: Text
logGroupName :: Text
$sel:logStreamName:CreateLogStream' :: CreateLogStream -> Text
$sel:logGroupName:CreateLogStream' :: CreateLogStream -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
logGroupName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
logStreamName
instance Prelude.NFData CreateLogStream where
rnf :: CreateLogStream -> ()
rnf CreateLogStream' {Text
logStreamName :: Text
logGroupName :: Text
$sel:logStreamName:CreateLogStream' :: CreateLogStream -> Text
$sel:logGroupName:CreateLogStream' :: CreateLogStream -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
logGroupName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
logStreamName
instance Data.ToHeaders CreateLogStream where
toHeaders :: CreateLogStream -> [Header]
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 -> [Header]
Data.=# ( ByteString
"Logs_20140328.CreateLogStream" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"logGroupName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
logGroupName),
forall a. a -> Maybe a
Prelude.Just
(Key
"logStreamName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
logStreamName)
]
)
instance Data.ToPath CreateLogStream where
toPath :: CreateLogStream -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateLogStream where
toQuery :: CreateLogStream -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateLogStreamResponse = CreateLogStreamResponse'
{
}
deriving (CreateLogStreamResponse -> CreateLogStreamResponse -> Bool
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]
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
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. 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 where
rnf :: CreateLogStreamResponse -> ()
rnf CreateLogStreamResponse
_ = ()