{-# 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.CloudWatchEvents.ListConnections
(
ListConnections (..),
newListConnections,
listConnections_nextToken,
listConnections_namePrefix,
listConnections_limit,
listConnections_connectionState,
ListConnectionsResponse (..),
newListConnectionsResponse,
listConnectionsResponse_connections,
listConnectionsResponse_nextToken,
listConnectionsResponse_httpStatus,
)
where
import Amazonka.CloudWatchEvents.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 ListConnections = ListConnections'
{
ListConnections -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListConnections -> Maybe Text
namePrefix :: Prelude.Maybe Prelude.Text,
ListConnections -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
ListConnections -> Maybe ConnectionState
connectionState :: Prelude.Maybe ConnectionState
}
deriving (ListConnections -> ListConnections -> Bool
(ListConnections -> ListConnections -> Bool)
-> (ListConnections -> ListConnections -> Bool)
-> Eq ListConnections
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListConnections -> ListConnections -> Bool
$c/= :: ListConnections -> ListConnections -> Bool
== :: ListConnections -> ListConnections -> Bool
$c== :: ListConnections -> ListConnections -> Bool
Prelude.Eq, ReadPrec [ListConnections]
ReadPrec ListConnections
Int -> ReadS ListConnections
ReadS [ListConnections]
(Int -> ReadS ListConnections)
-> ReadS [ListConnections]
-> ReadPrec ListConnections
-> ReadPrec [ListConnections]
-> Read ListConnections
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListConnections]
$creadListPrec :: ReadPrec [ListConnections]
readPrec :: ReadPrec ListConnections
$creadPrec :: ReadPrec ListConnections
readList :: ReadS [ListConnections]
$creadList :: ReadS [ListConnections]
readsPrec :: Int -> ReadS ListConnections
$creadsPrec :: Int -> ReadS ListConnections
Prelude.Read, Int -> ListConnections -> ShowS
[ListConnections] -> ShowS
ListConnections -> String
(Int -> ListConnections -> ShowS)
-> (ListConnections -> String)
-> ([ListConnections] -> ShowS)
-> Show ListConnections
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListConnections] -> ShowS
$cshowList :: [ListConnections] -> ShowS
show :: ListConnections -> String
$cshow :: ListConnections -> String
showsPrec :: Int -> ListConnections -> ShowS
$cshowsPrec :: Int -> ListConnections -> ShowS
Prelude.Show, (forall x. ListConnections -> Rep ListConnections x)
-> (forall x. Rep ListConnections x -> ListConnections)
-> Generic ListConnections
forall x. Rep ListConnections x -> ListConnections
forall x. ListConnections -> Rep ListConnections x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListConnections x -> ListConnections
$cfrom :: forall x. ListConnections -> Rep ListConnections x
Prelude.Generic)
newListConnections ::
ListConnections
newListConnections :: ListConnections
newListConnections =
ListConnections' :: Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe ConnectionState
-> ListConnections
ListConnections'
{ $sel:nextToken:ListConnections' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:namePrefix:ListConnections' :: Maybe Text
namePrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:limit:ListConnections' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:connectionState:ListConnections' :: Maybe ConnectionState
connectionState = Maybe ConnectionState
forall a. Maybe a
Prelude.Nothing
}
listConnections_nextToken :: Lens.Lens' ListConnections (Prelude.Maybe Prelude.Text)
listConnections_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListConnections -> f ListConnections
listConnections_nextToken = (ListConnections -> Maybe Text)
-> (ListConnections -> Maybe Text -> ListConnections)
-> Lens ListConnections ListConnections (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConnections' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListConnections' :: ListConnections -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListConnections
s@ListConnections' {} Maybe Text
a -> ListConnections
s {$sel:nextToken:ListConnections' :: Maybe Text
nextToken = Maybe Text
a} :: ListConnections)
listConnections_namePrefix :: Lens.Lens' ListConnections (Prelude.Maybe Prelude.Text)
listConnections_namePrefix :: (Maybe Text -> f (Maybe Text))
-> ListConnections -> f ListConnections
listConnections_namePrefix = (ListConnections -> Maybe Text)
-> (ListConnections -> Maybe Text -> ListConnections)
-> Lens ListConnections ListConnections (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConnections' {Maybe Text
namePrefix :: Maybe Text
$sel:namePrefix:ListConnections' :: ListConnections -> Maybe Text
namePrefix} -> Maybe Text
namePrefix) (\s :: ListConnections
s@ListConnections' {} Maybe Text
a -> ListConnections
s {$sel:namePrefix:ListConnections' :: Maybe Text
namePrefix = Maybe Text
a} :: ListConnections)
listConnections_limit :: Lens.Lens' ListConnections (Prelude.Maybe Prelude.Natural)
listConnections_limit :: (Maybe Natural -> f (Maybe Natural))
-> ListConnections -> f ListConnections
listConnections_limit = (ListConnections -> Maybe Natural)
-> (ListConnections -> Maybe Natural -> ListConnections)
-> Lens
ListConnections ListConnections (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConnections' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListConnections' :: ListConnections -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListConnections
s@ListConnections' {} Maybe Natural
a -> ListConnections
s {$sel:limit:ListConnections' :: Maybe Natural
limit = Maybe Natural
a} :: ListConnections)
listConnections_connectionState :: Lens.Lens' ListConnections (Prelude.Maybe ConnectionState)
listConnections_connectionState :: (Maybe ConnectionState -> f (Maybe ConnectionState))
-> ListConnections -> f ListConnections
listConnections_connectionState = (ListConnections -> Maybe ConnectionState)
-> (ListConnections -> Maybe ConnectionState -> ListConnections)
-> Lens
ListConnections
ListConnections
(Maybe ConnectionState)
(Maybe ConnectionState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConnections' {Maybe ConnectionState
connectionState :: Maybe ConnectionState
$sel:connectionState:ListConnections' :: ListConnections -> Maybe ConnectionState
connectionState} -> Maybe ConnectionState
connectionState) (\s :: ListConnections
s@ListConnections' {} Maybe ConnectionState
a -> ListConnections
s {$sel:connectionState:ListConnections' :: Maybe ConnectionState
connectionState = Maybe ConnectionState
a} :: ListConnections)
instance Core.AWSRequest ListConnections where
type
AWSResponse ListConnections =
ListConnectionsResponse
request :: ListConnections -> Request ListConnections
request = Service -> ListConnections -> Request ListConnections
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListConnections
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListConnections)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListConnections))
-> Logger
-> Service
-> Proxy ListConnections
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListConnections)))
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 [Connection] -> Maybe Text -> Int -> ListConnectionsResponse
ListConnectionsResponse'
(Maybe [Connection]
-> Maybe Text -> Int -> ListConnectionsResponse)
-> Either String (Maybe [Connection])
-> Either String (Maybe Text -> Int -> ListConnectionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Connection]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Connections" Either String (Maybe (Maybe [Connection]))
-> Maybe [Connection] -> Either String (Maybe [Connection])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Connection]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListConnectionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListConnectionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
Either String (Int -> ListConnectionsResponse)
-> Either String Int -> Either String ListConnectionsResponse
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 ListConnections
instance Prelude.NFData ListConnections
instance Core.ToHeaders ListConnections where
toHeaders :: ListConnections -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListConnections -> 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
"AWSEvents.ListConnections" :: 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 ListConnections where
toJSON :: ListConnections -> Value
toJSON ListConnections' {Maybe Natural
Maybe Text
Maybe ConnectionState
connectionState :: Maybe ConnectionState
limit :: Maybe Natural
namePrefix :: Maybe Text
nextToken :: Maybe Text
$sel:connectionState:ListConnections' :: ListConnections -> Maybe ConnectionState
$sel:limit:ListConnections' :: ListConnections -> Maybe Natural
$sel:namePrefix:ListConnections' :: ListConnections -> Maybe Text
$sel:nextToken:ListConnections' :: ListConnections -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NextToken" 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
nextToken,
(Text
"NamePrefix" 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
namePrefix,
(Text
"Limit" 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
limit,
(Text
"ConnectionState" Text -> ConnectionState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ConnectionState -> Pair) -> Maybe ConnectionState -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConnectionState
connectionState
]
)
instance Core.ToPath ListConnections where
toPath :: ListConnections -> ByteString
toPath = ByteString -> ListConnections -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListConnections where
toQuery :: ListConnections -> QueryString
toQuery = QueryString -> ListConnections -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListConnectionsResponse = ListConnectionsResponse'
{
ListConnectionsResponse -> Maybe [Connection]
connections :: Prelude.Maybe [Connection],
ListConnectionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListConnectionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListConnectionsResponse -> ListConnectionsResponse -> Bool
(ListConnectionsResponse -> ListConnectionsResponse -> Bool)
-> (ListConnectionsResponse -> ListConnectionsResponse -> Bool)
-> Eq ListConnectionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListConnectionsResponse -> ListConnectionsResponse -> Bool
$c/= :: ListConnectionsResponse -> ListConnectionsResponse -> Bool
== :: ListConnectionsResponse -> ListConnectionsResponse -> Bool
$c== :: ListConnectionsResponse -> ListConnectionsResponse -> Bool
Prelude.Eq, ReadPrec [ListConnectionsResponse]
ReadPrec ListConnectionsResponse
Int -> ReadS ListConnectionsResponse
ReadS [ListConnectionsResponse]
(Int -> ReadS ListConnectionsResponse)
-> ReadS [ListConnectionsResponse]
-> ReadPrec ListConnectionsResponse
-> ReadPrec [ListConnectionsResponse]
-> Read ListConnectionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListConnectionsResponse]
$creadListPrec :: ReadPrec [ListConnectionsResponse]
readPrec :: ReadPrec ListConnectionsResponse
$creadPrec :: ReadPrec ListConnectionsResponse
readList :: ReadS [ListConnectionsResponse]
$creadList :: ReadS [ListConnectionsResponse]
readsPrec :: Int -> ReadS ListConnectionsResponse
$creadsPrec :: Int -> ReadS ListConnectionsResponse
Prelude.Read, Int -> ListConnectionsResponse -> ShowS
[ListConnectionsResponse] -> ShowS
ListConnectionsResponse -> String
(Int -> ListConnectionsResponse -> ShowS)
-> (ListConnectionsResponse -> String)
-> ([ListConnectionsResponse] -> ShowS)
-> Show ListConnectionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListConnectionsResponse] -> ShowS
$cshowList :: [ListConnectionsResponse] -> ShowS
show :: ListConnectionsResponse -> String
$cshow :: ListConnectionsResponse -> String
showsPrec :: Int -> ListConnectionsResponse -> ShowS
$cshowsPrec :: Int -> ListConnectionsResponse -> ShowS
Prelude.Show, (forall x.
ListConnectionsResponse -> Rep ListConnectionsResponse x)
-> (forall x.
Rep ListConnectionsResponse x -> ListConnectionsResponse)
-> Generic ListConnectionsResponse
forall x. Rep ListConnectionsResponse x -> ListConnectionsResponse
forall x. ListConnectionsResponse -> Rep ListConnectionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListConnectionsResponse x -> ListConnectionsResponse
$cfrom :: forall x. ListConnectionsResponse -> Rep ListConnectionsResponse x
Prelude.Generic)
newListConnectionsResponse ::
Prelude.Int ->
ListConnectionsResponse
newListConnectionsResponse :: Int -> ListConnectionsResponse
newListConnectionsResponse Int
pHttpStatus_ =
ListConnectionsResponse' :: Maybe [Connection] -> Maybe Text -> Int -> ListConnectionsResponse
ListConnectionsResponse'
{ $sel:connections:ListConnectionsResponse' :: Maybe [Connection]
connections =
Maybe [Connection]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListConnectionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListConnectionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listConnectionsResponse_connections :: Lens.Lens' ListConnectionsResponse (Prelude.Maybe [Connection])
listConnectionsResponse_connections :: (Maybe [Connection] -> f (Maybe [Connection]))
-> ListConnectionsResponse -> f ListConnectionsResponse
listConnectionsResponse_connections = (ListConnectionsResponse -> Maybe [Connection])
-> (ListConnectionsResponse
-> Maybe [Connection] -> ListConnectionsResponse)
-> Lens
ListConnectionsResponse
ListConnectionsResponse
(Maybe [Connection])
(Maybe [Connection])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConnectionsResponse' {Maybe [Connection]
connections :: Maybe [Connection]
$sel:connections:ListConnectionsResponse' :: ListConnectionsResponse -> Maybe [Connection]
connections} -> Maybe [Connection]
connections) (\s :: ListConnectionsResponse
s@ListConnectionsResponse' {} Maybe [Connection]
a -> ListConnectionsResponse
s {$sel:connections:ListConnectionsResponse' :: Maybe [Connection]
connections = Maybe [Connection]
a} :: ListConnectionsResponse) ((Maybe [Connection] -> f (Maybe [Connection]))
-> ListConnectionsResponse -> f ListConnectionsResponse)
-> ((Maybe [Connection] -> f (Maybe [Connection]))
-> Maybe [Connection] -> f (Maybe [Connection]))
-> (Maybe [Connection] -> f (Maybe [Connection]))
-> ListConnectionsResponse
-> f ListConnectionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Connection] [Connection] [Connection] [Connection]
-> Iso
(Maybe [Connection])
(Maybe [Connection])
(Maybe [Connection])
(Maybe [Connection])
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 [Connection] [Connection] [Connection] [Connection]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listConnectionsResponse_nextToken :: Lens.Lens' ListConnectionsResponse (Prelude.Maybe Prelude.Text)
listConnectionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListConnectionsResponse -> f ListConnectionsResponse
listConnectionsResponse_nextToken = (ListConnectionsResponse -> Maybe Text)
-> (ListConnectionsResponse
-> Maybe Text -> ListConnectionsResponse)
-> Lens
ListConnectionsResponse
ListConnectionsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConnectionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListConnectionsResponse' :: ListConnectionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListConnectionsResponse
s@ListConnectionsResponse' {} Maybe Text
a -> ListConnectionsResponse
s {$sel:nextToken:ListConnectionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListConnectionsResponse)
listConnectionsResponse_httpStatus :: Lens.Lens' ListConnectionsResponse Prelude.Int
listConnectionsResponse_httpStatus :: (Int -> f Int)
-> ListConnectionsResponse -> f ListConnectionsResponse
listConnectionsResponse_httpStatus = (ListConnectionsResponse -> Int)
-> (ListConnectionsResponse -> Int -> ListConnectionsResponse)
-> Lens ListConnectionsResponse ListConnectionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConnectionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListConnectionsResponse' :: ListConnectionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListConnectionsResponse
s@ListConnectionsResponse' {} Int
a -> ListConnectionsResponse
s {$sel:httpStatus:ListConnectionsResponse' :: Int
httpStatus = Int
a} :: ListConnectionsResponse)
instance Prelude.NFData ListConnectionsResponse