{-# 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.GetLogGroupFields
(
GetLogGroupFields (..),
newGetLogGroupFields,
getLogGroupFields_time,
getLogGroupFields_logGroupName,
GetLogGroupFieldsResponse (..),
newGetLogGroupFieldsResponse,
getLogGroupFieldsResponse_logGroupFields,
getLogGroupFieldsResponse_httpStatus,
)
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 GetLogGroupFields = GetLogGroupFields'
{
GetLogGroupFields -> Maybe Natural
time :: Prelude.Maybe Prelude.Natural,
GetLogGroupFields -> Text
logGroupName :: Prelude.Text
}
deriving (GetLogGroupFields -> GetLogGroupFields -> Bool
(GetLogGroupFields -> GetLogGroupFields -> Bool)
-> (GetLogGroupFields -> GetLogGroupFields -> Bool)
-> Eq GetLogGroupFields
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLogGroupFields -> GetLogGroupFields -> Bool
$c/= :: GetLogGroupFields -> GetLogGroupFields -> Bool
== :: GetLogGroupFields -> GetLogGroupFields -> Bool
$c== :: GetLogGroupFields -> GetLogGroupFields -> Bool
Prelude.Eq, ReadPrec [GetLogGroupFields]
ReadPrec GetLogGroupFields
Int -> ReadS GetLogGroupFields
ReadS [GetLogGroupFields]
(Int -> ReadS GetLogGroupFields)
-> ReadS [GetLogGroupFields]
-> ReadPrec GetLogGroupFields
-> ReadPrec [GetLogGroupFields]
-> Read GetLogGroupFields
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLogGroupFields]
$creadListPrec :: ReadPrec [GetLogGroupFields]
readPrec :: ReadPrec GetLogGroupFields
$creadPrec :: ReadPrec GetLogGroupFields
readList :: ReadS [GetLogGroupFields]
$creadList :: ReadS [GetLogGroupFields]
readsPrec :: Int -> ReadS GetLogGroupFields
$creadsPrec :: Int -> ReadS GetLogGroupFields
Prelude.Read, Int -> GetLogGroupFields -> ShowS
[GetLogGroupFields] -> ShowS
GetLogGroupFields -> String
(Int -> GetLogGroupFields -> ShowS)
-> (GetLogGroupFields -> String)
-> ([GetLogGroupFields] -> ShowS)
-> Show GetLogGroupFields
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLogGroupFields] -> ShowS
$cshowList :: [GetLogGroupFields] -> ShowS
show :: GetLogGroupFields -> String
$cshow :: GetLogGroupFields -> String
showsPrec :: Int -> GetLogGroupFields -> ShowS
$cshowsPrec :: Int -> GetLogGroupFields -> ShowS
Prelude.Show, (forall x. GetLogGroupFields -> Rep GetLogGroupFields x)
-> (forall x. Rep GetLogGroupFields x -> GetLogGroupFields)
-> Generic GetLogGroupFields
forall x. Rep GetLogGroupFields x -> GetLogGroupFields
forall x. GetLogGroupFields -> Rep GetLogGroupFields x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetLogGroupFields x -> GetLogGroupFields
$cfrom :: forall x. GetLogGroupFields -> Rep GetLogGroupFields x
Prelude.Generic)
newGetLogGroupFields ::
Prelude.Text ->
GetLogGroupFields
newGetLogGroupFields :: Text -> GetLogGroupFields
newGetLogGroupFields Text
pLogGroupName_ =
GetLogGroupFields' :: Maybe Natural -> Text -> GetLogGroupFields
GetLogGroupFields'
{ $sel:time:GetLogGroupFields' :: Maybe Natural
time = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:logGroupName:GetLogGroupFields' :: Text
logGroupName = Text
pLogGroupName_
}
getLogGroupFields_time :: Lens.Lens' GetLogGroupFields (Prelude.Maybe Prelude.Natural)
getLogGroupFields_time :: (Maybe Natural -> f (Maybe Natural))
-> GetLogGroupFields -> f GetLogGroupFields
getLogGroupFields_time = (GetLogGroupFields -> Maybe Natural)
-> (GetLogGroupFields -> Maybe Natural -> GetLogGroupFields)
-> Lens
GetLogGroupFields GetLogGroupFields (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLogGroupFields' {Maybe Natural
time :: Maybe Natural
$sel:time:GetLogGroupFields' :: GetLogGroupFields -> Maybe Natural
time} -> Maybe Natural
time) (\s :: GetLogGroupFields
s@GetLogGroupFields' {} Maybe Natural
a -> GetLogGroupFields
s {$sel:time:GetLogGroupFields' :: Maybe Natural
time = Maybe Natural
a} :: GetLogGroupFields)
getLogGroupFields_logGroupName :: Lens.Lens' GetLogGroupFields Prelude.Text
getLogGroupFields_logGroupName :: (Text -> f Text) -> GetLogGroupFields -> f GetLogGroupFields
getLogGroupFields_logGroupName = (GetLogGroupFields -> Text)
-> (GetLogGroupFields -> Text -> GetLogGroupFields)
-> Lens GetLogGroupFields GetLogGroupFields Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLogGroupFields' {Text
logGroupName :: Text
$sel:logGroupName:GetLogGroupFields' :: GetLogGroupFields -> Text
logGroupName} -> Text
logGroupName) (\s :: GetLogGroupFields
s@GetLogGroupFields' {} Text
a -> GetLogGroupFields
s {$sel:logGroupName:GetLogGroupFields' :: Text
logGroupName = Text
a} :: GetLogGroupFields)
instance Core.AWSRequest GetLogGroupFields where
type
AWSResponse GetLogGroupFields =
GetLogGroupFieldsResponse
request :: GetLogGroupFields -> Request GetLogGroupFields
request = Service -> GetLogGroupFields -> Request GetLogGroupFields
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetLogGroupFields
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetLogGroupFields)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetLogGroupFields))
-> Logger
-> Service
-> Proxy GetLogGroupFields
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetLogGroupFields)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [LogGroupField] -> Int -> GetLogGroupFieldsResponse
GetLogGroupFieldsResponse'
(Maybe [LogGroupField] -> Int -> GetLogGroupFieldsResponse)
-> Either String (Maybe [LogGroupField])
-> Either String (Int -> GetLogGroupFieldsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [LogGroupField]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"logGroupFields" Either String (Maybe (Maybe [LogGroupField]))
-> Maybe [LogGroupField] -> Either String (Maybe [LogGroupField])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [LogGroupField]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetLogGroupFieldsResponse)
-> Either String Int -> Either String GetLogGroupFieldsResponse
forall (f :: * -> *) a b. Applicative f => 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 GetLogGroupFields
instance Prelude.NFData GetLogGroupFields
instance Core.ToHeaders GetLogGroupFields where
toHeaders :: GetLogGroupFields -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetLogGroupFields -> 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
"Logs_20140328.GetLogGroupFields" ::
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 GetLogGroupFields where
toJSON :: GetLogGroupFields -> Value
toJSON GetLogGroupFields' {Maybe Natural
Text
logGroupName :: Text
time :: Maybe Natural
$sel:logGroupName:GetLogGroupFields' :: GetLogGroupFields -> Text
$sel:time:GetLogGroupFields' :: GetLogGroupFields -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"time" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
time,
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 GetLogGroupFields where
toPath :: GetLogGroupFields -> ByteString
toPath = ByteString -> GetLogGroupFields -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetLogGroupFields where
toQuery :: GetLogGroupFields -> QueryString
toQuery = QueryString -> GetLogGroupFields -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetLogGroupFieldsResponse = GetLogGroupFieldsResponse'
{
GetLogGroupFieldsResponse -> Maybe [LogGroupField]
logGroupFields :: Prelude.Maybe [LogGroupField],
GetLogGroupFieldsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetLogGroupFieldsResponse -> GetLogGroupFieldsResponse -> Bool
(GetLogGroupFieldsResponse -> GetLogGroupFieldsResponse -> Bool)
-> (GetLogGroupFieldsResponse -> GetLogGroupFieldsResponse -> Bool)
-> Eq GetLogGroupFieldsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLogGroupFieldsResponse -> GetLogGroupFieldsResponse -> Bool
$c/= :: GetLogGroupFieldsResponse -> GetLogGroupFieldsResponse -> Bool
== :: GetLogGroupFieldsResponse -> GetLogGroupFieldsResponse -> Bool
$c== :: GetLogGroupFieldsResponse -> GetLogGroupFieldsResponse -> Bool
Prelude.Eq, ReadPrec [GetLogGroupFieldsResponse]
ReadPrec GetLogGroupFieldsResponse
Int -> ReadS GetLogGroupFieldsResponse
ReadS [GetLogGroupFieldsResponse]
(Int -> ReadS GetLogGroupFieldsResponse)
-> ReadS [GetLogGroupFieldsResponse]
-> ReadPrec GetLogGroupFieldsResponse
-> ReadPrec [GetLogGroupFieldsResponse]
-> Read GetLogGroupFieldsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLogGroupFieldsResponse]
$creadListPrec :: ReadPrec [GetLogGroupFieldsResponse]
readPrec :: ReadPrec GetLogGroupFieldsResponse
$creadPrec :: ReadPrec GetLogGroupFieldsResponse
readList :: ReadS [GetLogGroupFieldsResponse]
$creadList :: ReadS [GetLogGroupFieldsResponse]
readsPrec :: Int -> ReadS GetLogGroupFieldsResponse
$creadsPrec :: Int -> ReadS GetLogGroupFieldsResponse
Prelude.Read, Int -> GetLogGroupFieldsResponse -> ShowS
[GetLogGroupFieldsResponse] -> ShowS
GetLogGroupFieldsResponse -> String
(Int -> GetLogGroupFieldsResponse -> ShowS)
-> (GetLogGroupFieldsResponse -> String)
-> ([GetLogGroupFieldsResponse] -> ShowS)
-> Show GetLogGroupFieldsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLogGroupFieldsResponse] -> ShowS
$cshowList :: [GetLogGroupFieldsResponse] -> ShowS
show :: GetLogGroupFieldsResponse -> String
$cshow :: GetLogGroupFieldsResponse -> String
showsPrec :: Int -> GetLogGroupFieldsResponse -> ShowS
$cshowsPrec :: Int -> GetLogGroupFieldsResponse -> ShowS
Prelude.Show, (forall x.
GetLogGroupFieldsResponse -> Rep GetLogGroupFieldsResponse x)
-> (forall x.
Rep GetLogGroupFieldsResponse x -> GetLogGroupFieldsResponse)
-> Generic GetLogGroupFieldsResponse
forall x.
Rep GetLogGroupFieldsResponse x -> GetLogGroupFieldsResponse
forall x.
GetLogGroupFieldsResponse -> Rep GetLogGroupFieldsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetLogGroupFieldsResponse x -> GetLogGroupFieldsResponse
$cfrom :: forall x.
GetLogGroupFieldsResponse -> Rep GetLogGroupFieldsResponse x
Prelude.Generic)
newGetLogGroupFieldsResponse ::
Prelude.Int ->
GetLogGroupFieldsResponse
newGetLogGroupFieldsResponse :: Int -> GetLogGroupFieldsResponse
newGetLogGroupFieldsResponse Int
pHttpStatus_ =
GetLogGroupFieldsResponse' :: Maybe [LogGroupField] -> Int -> GetLogGroupFieldsResponse
GetLogGroupFieldsResponse'
{ $sel:logGroupFields:GetLogGroupFieldsResponse' :: Maybe [LogGroupField]
logGroupFields =
Maybe [LogGroupField]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetLogGroupFieldsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getLogGroupFieldsResponse_logGroupFields :: Lens.Lens' GetLogGroupFieldsResponse (Prelude.Maybe [LogGroupField])
getLogGroupFieldsResponse_logGroupFields :: (Maybe [LogGroupField] -> f (Maybe [LogGroupField]))
-> GetLogGroupFieldsResponse -> f GetLogGroupFieldsResponse
getLogGroupFieldsResponse_logGroupFields = (GetLogGroupFieldsResponse -> Maybe [LogGroupField])
-> (GetLogGroupFieldsResponse
-> Maybe [LogGroupField] -> GetLogGroupFieldsResponse)
-> Lens
GetLogGroupFieldsResponse
GetLogGroupFieldsResponse
(Maybe [LogGroupField])
(Maybe [LogGroupField])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLogGroupFieldsResponse' {Maybe [LogGroupField]
logGroupFields :: Maybe [LogGroupField]
$sel:logGroupFields:GetLogGroupFieldsResponse' :: GetLogGroupFieldsResponse -> Maybe [LogGroupField]
logGroupFields} -> Maybe [LogGroupField]
logGroupFields) (\s :: GetLogGroupFieldsResponse
s@GetLogGroupFieldsResponse' {} Maybe [LogGroupField]
a -> GetLogGroupFieldsResponse
s {$sel:logGroupFields:GetLogGroupFieldsResponse' :: Maybe [LogGroupField]
logGroupFields = Maybe [LogGroupField]
a} :: GetLogGroupFieldsResponse) ((Maybe [LogGroupField] -> f (Maybe [LogGroupField]))
-> GetLogGroupFieldsResponse -> f GetLogGroupFieldsResponse)
-> ((Maybe [LogGroupField] -> f (Maybe [LogGroupField]))
-> Maybe [LogGroupField] -> f (Maybe [LogGroupField]))
-> (Maybe [LogGroupField] -> f (Maybe [LogGroupField]))
-> GetLogGroupFieldsResponse
-> f GetLogGroupFieldsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[LogGroupField] [LogGroupField] [LogGroupField] [LogGroupField]
-> Iso
(Maybe [LogGroupField])
(Maybe [LogGroupField])
(Maybe [LogGroupField])
(Maybe [LogGroupField])
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
[LogGroupField] [LogGroupField] [LogGroupField] [LogGroupField]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getLogGroupFieldsResponse_httpStatus :: Lens.Lens' GetLogGroupFieldsResponse Prelude.Int
getLogGroupFieldsResponse_httpStatus :: (Int -> f Int)
-> GetLogGroupFieldsResponse -> f GetLogGroupFieldsResponse
getLogGroupFieldsResponse_httpStatus = (GetLogGroupFieldsResponse -> Int)
-> (GetLogGroupFieldsResponse -> Int -> GetLogGroupFieldsResponse)
-> Lens GetLogGroupFieldsResponse GetLogGroupFieldsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLogGroupFieldsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetLogGroupFieldsResponse' :: GetLogGroupFieldsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetLogGroupFieldsResponse
s@GetLogGroupFieldsResponse' {} Int
a -> GetLogGroupFieldsResponse
s {$sel:httpStatus:GetLogGroupFieldsResponse' :: Int
httpStatus = Int
a} :: GetLogGroupFieldsResponse)
instance Prelude.NFData GetLogGroupFieldsResponse