{-# 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.DescribeDestinations
(
DescribeDestinations (..),
newDescribeDestinations,
describeDestinations_destinationNamePrefix,
describeDestinations_limit,
describeDestinations_nextToken,
DescribeDestinationsResponse (..),
newDescribeDestinationsResponse,
describeDestinationsResponse_destinations,
describeDestinationsResponse_nextToken,
describeDestinationsResponse_httpStatus,
)
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 DescribeDestinations = DescribeDestinations'
{
DescribeDestinations -> Maybe Text
destinationNamePrefix :: Prelude.Maybe Prelude.Text,
DescribeDestinations -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
DescribeDestinations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (DescribeDestinations -> DescribeDestinations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDestinations -> DescribeDestinations -> Bool
$c/= :: DescribeDestinations -> DescribeDestinations -> Bool
== :: DescribeDestinations -> DescribeDestinations -> Bool
$c== :: DescribeDestinations -> DescribeDestinations -> Bool
Prelude.Eq, ReadPrec [DescribeDestinations]
ReadPrec DescribeDestinations
Int -> ReadS DescribeDestinations
ReadS [DescribeDestinations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDestinations]
$creadListPrec :: ReadPrec [DescribeDestinations]
readPrec :: ReadPrec DescribeDestinations
$creadPrec :: ReadPrec DescribeDestinations
readList :: ReadS [DescribeDestinations]
$creadList :: ReadS [DescribeDestinations]
readsPrec :: Int -> ReadS DescribeDestinations
$creadsPrec :: Int -> ReadS DescribeDestinations
Prelude.Read, Int -> DescribeDestinations -> ShowS
[DescribeDestinations] -> ShowS
DescribeDestinations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDestinations] -> ShowS
$cshowList :: [DescribeDestinations] -> ShowS
show :: DescribeDestinations -> String
$cshow :: DescribeDestinations -> String
showsPrec :: Int -> DescribeDestinations -> ShowS
$cshowsPrec :: Int -> DescribeDestinations -> ShowS
Prelude.Show, forall x. Rep DescribeDestinations x -> DescribeDestinations
forall x. DescribeDestinations -> Rep DescribeDestinations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDestinations x -> DescribeDestinations
$cfrom :: forall x. DescribeDestinations -> Rep DescribeDestinations x
Prelude.Generic)
newDescribeDestinations ::
DescribeDestinations
newDescribeDestinations :: DescribeDestinations
newDescribeDestinations =
DescribeDestinations'
{ $sel:destinationNamePrefix:DescribeDestinations' :: Maybe Text
destinationNamePrefix =
forall a. Maybe a
Prelude.Nothing,
$sel:limit:DescribeDestinations' :: Maybe Natural
limit = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:DescribeDestinations' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
describeDestinations_destinationNamePrefix :: Lens.Lens' DescribeDestinations (Prelude.Maybe Prelude.Text)
describeDestinations_destinationNamePrefix :: Lens' DescribeDestinations (Maybe Text)
describeDestinations_destinationNamePrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDestinations' {Maybe Text
destinationNamePrefix :: Maybe Text
$sel:destinationNamePrefix:DescribeDestinations' :: DescribeDestinations -> Maybe Text
destinationNamePrefix} -> Maybe Text
destinationNamePrefix) (\s :: DescribeDestinations
s@DescribeDestinations' {} Maybe Text
a -> DescribeDestinations
s {$sel:destinationNamePrefix:DescribeDestinations' :: Maybe Text
destinationNamePrefix = Maybe Text
a} :: DescribeDestinations)
describeDestinations_limit :: Lens.Lens' DescribeDestinations (Prelude.Maybe Prelude.Natural)
describeDestinations_limit :: Lens' DescribeDestinations (Maybe Natural)
describeDestinations_limit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDestinations' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeDestinations' :: DescribeDestinations -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeDestinations
s@DescribeDestinations' {} Maybe Natural
a -> DescribeDestinations
s {$sel:limit:DescribeDestinations' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeDestinations)
describeDestinations_nextToken :: Lens.Lens' DescribeDestinations (Prelude.Maybe Prelude.Text)
describeDestinations_nextToken :: Lens' DescribeDestinations (Maybe Text)
describeDestinations_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDestinations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeDestinations' :: DescribeDestinations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeDestinations
s@DescribeDestinations' {} Maybe Text
a -> DescribeDestinations
s {$sel:nextToken:DescribeDestinations' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeDestinations)
instance Core.AWSPager DescribeDestinations where
page :: DescribeDestinations
-> AWSResponse DescribeDestinations -> Maybe DescribeDestinations
page DescribeDestinations
rq AWSResponse DescribeDestinations
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse DescribeDestinations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeDestinationsResponse (Maybe Text)
describeDestinationsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse DescribeDestinations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeDestinationsResponse (Maybe [Destination])
describeDestinationsResponse_destinations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ DescribeDestinations
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeDestinations (Maybe Text)
describeDestinations_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeDestinations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeDestinationsResponse (Maybe Text)
describeDestinationsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest DescribeDestinations where
type
AWSResponse DescribeDestinations =
DescribeDestinationsResponse
request :: (Service -> Service)
-> DescribeDestinations -> Request DescribeDestinations
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 DescribeDestinations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeDestinations)))
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 ->
Maybe [Destination]
-> Maybe Text -> Int -> DescribeDestinationsResponse
DescribeDestinationsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"destinations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable DescribeDestinations where
hashWithSalt :: Int -> DescribeDestinations -> Int
hashWithSalt Int
_salt DescribeDestinations' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
limit :: Maybe Natural
destinationNamePrefix :: Maybe Text
$sel:nextToken:DescribeDestinations' :: DescribeDestinations -> Maybe Text
$sel:limit:DescribeDestinations' :: DescribeDestinations -> Maybe Natural
$sel:destinationNamePrefix:DescribeDestinations' :: DescribeDestinations -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationNamePrefix
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
limit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData DescribeDestinations where
rnf :: DescribeDestinations -> ()
rnf DescribeDestinations' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
limit :: Maybe Natural
destinationNamePrefix :: Maybe Text
$sel:nextToken:DescribeDestinations' :: DescribeDestinations -> Maybe Text
$sel:limit:DescribeDestinations' :: DescribeDestinations -> Maybe Natural
$sel:destinationNamePrefix:DescribeDestinations' :: DescribeDestinations -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destinationNamePrefix
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
limit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders DescribeDestinations where
toHeaders :: DescribeDestinations -> ResponseHeaders
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 -> ResponseHeaders
Data.=# ( ByteString
"Logs_20140328.DescribeDestinations" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON DescribeDestinations where
toJSON :: DescribeDestinations -> Value
toJSON DescribeDestinations' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
limit :: Maybe Natural
destinationNamePrefix :: Maybe Text
$sel:nextToken:DescribeDestinations' :: DescribeDestinations -> Maybe Text
$sel:limit:DescribeDestinations' :: DescribeDestinations -> Maybe Natural
$sel:destinationNamePrefix:DescribeDestinations' :: DescribeDestinations -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DestinationNamePrefix" 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
destinationNamePrefix,
(Key
"limit" 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 Natural
limit,
(Key
"nextToken" 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
nextToken
]
)
instance Data.ToPath DescribeDestinations where
toPath :: DescribeDestinations -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery DescribeDestinations where
toQuery :: DescribeDestinations -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data DescribeDestinationsResponse = DescribeDestinationsResponse'
{
DescribeDestinationsResponse -> Maybe [Destination]
destinations :: Prelude.Maybe [Destination],
DescribeDestinationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
DescribeDestinationsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeDestinationsResponse
-> DescribeDestinationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDestinationsResponse
-> DescribeDestinationsResponse -> Bool
$c/= :: DescribeDestinationsResponse
-> DescribeDestinationsResponse -> Bool
== :: DescribeDestinationsResponse
-> DescribeDestinationsResponse -> Bool
$c== :: DescribeDestinationsResponse
-> DescribeDestinationsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDestinationsResponse]
ReadPrec DescribeDestinationsResponse
Int -> ReadS DescribeDestinationsResponse
ReadS [DescribeDestinationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDestinationsResponse]
$creadListPrec :: ReadPrec [DescribeDestinationsResponse]
readPrec :: ReadPrec DescribeDestinationsResponse
$creadPrec :: ReadPrec DescribeDestinationsResponse
readList :: ReadS [DescribeDestinationsResponse]
$creadList :: ReadS [DescribeDestinationsResponse]
readsPrec :: Int -> ReadS DescribeDestinationsResponse
$creadsPrec :: Int -> ReadS DescribeDestinationsResponse
Prelude.Read, Int -> DescribeDestinationsResponse -> ShowS
[DescribeDestinationsResponse] -> ShowS
DescribeDestinationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDestinationsResponse] -> ShowS
$cshowList :: [DescribeDestinationsResponse] -> ShowS
show :: DescribeDestinationsResponse -> String
$cshow :: DescribeDestinationsResponse -> String
showsPrec :: Int -> DescribeDestinationsResponse -> ShowS
$cshowsPrec :: Int -> DescribeDestinationsResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeDestinationsResponse x -> DescribeDestinationsResponse
forall x.
DescribeDestinationsResponse -> Rep DescribeDestinationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDestinationsResponse x -> DescribeDestinationsResponse
$cfrom :: forall x.
DescribeDestinationsResponse -> Rep DescribeDestinationsResponse x
Prelude.Generic)
newDescribeDestinationsResponse ::
Prelude.Int ->
DescribeDestinationsResponse
newDescribeDestinationsResponse :: Int -> DescribeDestinationsResponse
newDescribeDestinationsResponse Int
pHttpStatus_ =
DescribeDestinationsResponse'
{ $sel:destinations:DescribeDestinationsResponse' :: Maybe [Destination]
destinations =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:DescribeDestinationsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeDestinationsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeDestinationsResponse_destinations :: Lens.Lens' DescribeDestinationsResponse (Prelude.Maybe [Destination])
describeDestinationsResponse_destinations :: Lens' DescribeDestinationsResponse (Maybe [Destination])
describeDestinationsResponse_destinations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDestinationsResponse' {Maybe [Destination]
destinations :: Maybe [Destination]
$sel:destinations:DescribeDestinationsResponse' :: DescribeDestinationsResponse -> Maybe [Destination]
destinations} -> Maybe [Destination]
destinations) (\s :: DescribeDestinationsResponse
s@DescribeDestinationsResponse' {} Maybe [Destination]
a -> DescribeDestinationsResponse
s {$sel:destinations:DescribeDestinationsResponse' :: Maybe [Destination]
destinations = Maybe [Destination]
a} :: DescribeDestinationsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeDestinationsResponse_nextToken :: Lens.Lens' DescribeDestinationsResponse (Prelude.Maybe Prelude.Text)
describeDestinationsResponse_nextToken :: Lens' DescribeDestinationsResponse (Maybe Text)
describeDestinationsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDestinationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeDestinationsResponse' :: DescribeDestinationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeDestinationsResponse
s@DescribeDestinationsResponse' {} Maybe Text
a -> DescribeDestinationsResponse
s {$sel:nextToken:DescribeDestinationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeDestinationsResponse)
describeDestinationsResponse_httpStatus :: Lens.Lens' DescribeDestinationsResponse Prelude.Int
describeDestinationsResponse_httpStatus :: Lens' DescribeDestinationsResponse Int
describeDestinationsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDestinationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeDestinationsResponse' :: DescribeDestinationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeDestinationsResponse
s@DescribeDestinationsResponse' {} Int
a -> DescribeDestinationsResponse
s {$sel:httpStatus:DescribeDestinationsResponse' :: Int
httpStatus = Int
a} :: DescribeDestinationsResponse)
instance Prelude.NFData DescribeDestinationsResponse where
rnf :: DescribeDestinationsResponse -> ()
rnf DescribeDestinationsResponse' {Int
Maybe [Destination]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
destinations :: Maybe [Destination]
$sel:httpStatus:DescribeDestinationsResponse' :: DescribeDestinationsResponse -> Int
$sel:nextToken:DescribeDestinationsResponse' :: DescribeDestinationsResponse -> Maybe Text
$sel:destinations:DescribeDestinationsResponse' :: DescribeDestinationsResponse -> Maybe [Destination]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Destination]
destinations
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus