{-# 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.ManagedBlockChain.ListNetworks
(
ListNetworks (..),
newListNetworks,
listNetworks_status,
listNetworks_framework,
listNetworks_nextToken,
listNetworks_name,
listNetworks_maxResults,
ListNetworksResponse (..),
newListNetworksResponse,
listNetworksResponse_networks,
listNetworksResponse_nextToken,
listNetworksResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.ManagedBlockChain.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListNetworks = ListNetworks'
{
ListNetworks -> Maybe NetworkStatus
status :: Prelude.Maybe NetworkStatus,
ListNetworks -> Maybe Framework
framework :: Prelude.Maybe Framework,
ListNetworks -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListNetworks -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
ListNetworks -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListNetworks -> ListNetworks -> Bool
(ListNetworks -> ListNetworks -> Bool)
-> (ListNetworks -> ListNetworks -> Bool) -> Eq ListNetworks
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNetworks -> ListNetworks -> Bool
$c/= :: ListNetworks -> ListNetworks -> Bool
== :: ListNetworks -> ListNetworks -> Bool
$c== :: ListNetworks -> ListNetworks -> Bool
Prelude.Eq, ReadPrec [ListNetworks]
ReadPrec ListNetworks
Int -> ReadS ListNetworks
ReadS [ListNetworks]
(Int -> ReadS ListNetworks)
-> ReadS [ListNetworks]
-> ReadPrec ListNetworks
-> ReadPrec [ListNetworks]
-> Read ListNetworks
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNetworks]
$creadListPrec :: ReadPrec [ListNetworks]
readPrec :: ReadPrec ListNetworks
$creadPrec :: ReadPrec ListNetworks
readList :: ReadS [ListNetworks]
$creadList :: ReadS [ListNetworks]
readsPrec :: Int -> ReadS ListNetworks
$creadsPrec :: Int -> ReadS ListNetworks
Prelude.Read, Int -> ListNetworks -> ShowS
[ListNetworks] -> ShowS
ListNetworks -> String
(Int -> ListNetworks -> ShowS)
-> (ListNetworks -> String)
-> ([ListNetworks] -> ShowS)
-> Show ListNetworks
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNetworks] -> ShowS
$cshowList :: [ListNetworks] -> ShowS
show :: ListNetworks -> String
$cshow :: ListNetworks -> String
showsPrec :: Int -> ListNetworks -> ShowS
$cshowsPrec :: Int -> ListNetworks -> ShowS
Prelude.Show, (forall x. ListNetworks -> Rep ListNetworks x)
-> (forall x. Rep ListNetworks x -> ListNetworks)
-> Generic ListNetworks
forall x. Rep ListNetworks x -> ListNetworks
forall x. ListNetworks -> Rep ListNetworks x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListNetworks x -> ListNetworks
$cfrom :: forall x. ListNetworks -> Rep ListNetworks x
Prelude.Generic)
newListNetworks ::
ListNetworks
newListNetworks :: ListNetworks
newListNetworks =
ListNetworks' :: Maybe NetworkStatus
-> Maybe Framework
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> ListNetworks
ListNetworks'
{ $sel:status:ListNetworks' :: Maybe NetworkStatus
status = Maybe NetworkStatus
forall a. Maybe a
Prelude.Nothing,
$sel:framework:ListNetworks' :: Maybe Framework
framework = Maybe Framework
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListNetworks' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:ListNetworks' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListNetworks' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listNetworks_status :: Lens.Lens' ListNetworks (Prelude.Maybe NetworkStatus)
listNetworks_status :: (Maybe NetworkStatus -> f (Maybe NetworkStatus))
-> ListNetworks -> f ListNetworks
listNetworks_status = (ListNetworks -> Maybe NetworkStatus)
-> (ListNetworks -> Maybe NetworkStatus -> ListNetworks)
-> Lens
ListNetworks
ListNetworks
(Maybe NetworkStatus)
(Maybe NetworkStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNetworks' {Maybe NetworkStatus
status :: Maybe NetworkStatus
$sel:status:ListNetworks' :: ListNetworks -> Maybe NetworkStatus
status} -> Maybe NetworkStatus
status) (\s :: ListNetworks
s@ListNetworks' {} Maybe NetworkStatus
a -> ListNetworks
s {$sel:status:ListNetworks' :: Maybe NetworkStatus
status = Maybe NetworkStatus
a} :: ListNetworks)
listNetworks_framework :: Lens.Lens' ListNetworks (Prelude.Maybe Framework)
listNetworks_framework :: (Maybe Framework -> f (Maybe Framework))
-> ListNetworks -> f ListNetworks
listNetworks_framework = (ListNetworks -> Maybe Framework)
-> (ListNetworks -> Maybe Framework -> ListNetworks)
-> Lens
ListNetworks ListNetworks (Maybe Framework) (Maybe Framework)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNetworks' {Maybe Framework
framework :: Maybe Framework
$sel:framework:ListNetworks' :: ListNetworks -> Maybe Framework
framework} -> Maybe Framework
framework) (\s :: ListNetworks
s@ListNetworks' {} Maybe Framework
a -> ListNetworks
s {$sel:framework:ListNetworks' :: Maybe Framework
framework = Maybe Framework
a} :: ListNetworks)
listNetworks_nextToken :: Lens.Lens' ListNetworks (Prelude.Maybe Prelude.Text)
listNetworks_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListNetworks -> f ListNetworks
listNetworks_nextToken = (ListNetworks -> Maybe Text)
-> (ListNetworks -> Maybe Text -> ListNetworks)
-> Lens ListNetworks ListNetworks (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNetworks' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNetworks' :: ListNetworks -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListNetworks
s@ListNetworks' {} Maybe Text
a -> ListNetworks
s {$sel:nextToken:ListNetworks' :: Maybe Text
nextToken = Maybe Text
a} :: ListNetworks)
listNetworks_name :: Lens.Lens' ListNetworks (Prelude.Maybe Prelude.Text)
listNetworks_name :: (Maybe Text -> f (Maybe Text)) -> ListNetworks -> f ListNetworks
listNetworks_name = (ListNetworks -> Maybe Text)
-> (ListNetworks -> Maybe Text -> ListNetworks)
-> Lens ListNetworks ListNetworks (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNetworks' {Maybe Text
name :: Maybe Text
$sel:name:ListNetworks' :: ListNetworks -> Maybe Text
name} -> Maybe Text
name) (\s :: ListNetworks
s@ListNetworks' {} Maybe Text
a -> ListNetworks
s {$sel:name:ListNetworks' :: Maybe Text
name = Maybe Text
a} :: ListNetworks)
listNetworks_maxResults :: Lens.Lens' ListNetworks (Prelude.Maybe Prelude.Natural)
listNetworks_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListNetworks -> f ListNetworks
listNetworks_maxResults = (ListNetworks -> Maybe Natural)
-> (ListNetworks -> Maybe Natural -> ListNetworks)
-> Lens ListNetworks ListNetworks (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNetworks' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListNetworks' :: ListNetworks -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListNetworks
s@ListNetworks' {} Maybe Natural
a -> ListNetworks
s {$sel:maxResults:ListNetworks' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListNetworks)
instance Core.AWSRequest ListNetworks where
type AWSResponse ListNetworks = ListNetworksResponse
request :: ListNetworks -> Request ListNetworks
request = Service -> ListNetworks -> Request ListNetworks
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListNetworks
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListNetworks)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListNetworks))
-> Logger
-> Service
-> Proxy ListNetworks
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListNetworks)))
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 [NetworkSummary] -> Maybe Text -> Int -> ListNetworksResponse
ListNetworksResponse'
(Maybe [NetworkSummary]
-> Maybe Text -> Int -> ListNetworksResponse)
-> Either String (Maybe [NetworkSummary])
-> Either String (Maybe Text -> Int -> ListNetworksResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [NetworkSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Networks" Either String (Maybe (Maybe [NetworkSummary]))
-> Maybe [NetworkSummary] -> Either String (Maybe [NetworkSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [NetworkSummary]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListNetworksResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListNetworksResponse)
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 -> ListNetworksResponse)
-> Either String Int -> Either String ListNetworksResponse
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 ListNetworks
instance Prelude.NFData ListNetworks
instance Core.ToHeaders ListNetworks where
toHeaders :: ListNetworks -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListNetworks -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath ListNetworks where
toPath :: ListNetworks -> ByteString
toPath = ByteString -> ListNetworks -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/networks"
instance Core.ToQuery ListNetworks where
toQuery :: ListNetworks -> QueryString
toQuery ListNetworks' {Maybe Natural
Maybe Text
Maybe Framework
Maybe NetworkStatus
maxResults :: Maybe Natural
name :: Maybe Text
nextToken :: Maybe Text
framework :: Maybe Framework
status :: Maybe NetworkStatus
$sel:maxResults:ListNetworks' :: ListNetworks -> Maybe Natural
$sel:name:ListNetworks' :: ListNetworks -> Maybe Text
$sel:nextToken:ListNetworks' :: ListNetworks -> Maybe Text
$sel:framework:ListNetworks' :: ListNetworks -> Maybe Framework
$sel:status:ListNetworks' :: ListNetworks -> Maybe NetworkStatus
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"status" ByteString -> Maybe NetworkStatus -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe NetworkStatus
status,
ByteString
"framework" ByteString -> Maybe Framework -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Framework
framework,
ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"name" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
name,
ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListNetworksResponse = ListNetworksResponse'
{
ListNetworksResponse -> Maybe [NetworkSummary]
networks :: Prelude.Maybe [NetworkSummary],
ListNetworksResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListNetworksResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListNetworksResponse -> ListNetworksResponse -> Bool
(ListNetworksResponse -> ListNetworksResponse -> Bool)
-> (ListNetworksResponse -> ListNetworksResponse -> Bool)
-> Eq ListNetworksResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListNetworksResponse -> ListNetworksResponse -> Bool
$c/= :: ListNetworksResponse -> ListNetworksResponse -> Bool
== :: ListNetworksResponse -> ListNetworksResponse -> Bool
$c== :: ListNetworksResponse -> ListNetworksResponse -> Bool
Prelude.Eq, ReadPrec [ListNetworksResponse]
ReadPrec ListNetworksResponse
Int -> ReadS ListNetworksResponse
ReadS [ListNetworksResponse]
(Int -> ReadS ListNetworksResponse)
-> ReadS [ListNetworksResponse]
-> ReadPrec ListNetworksResponse
-> ReadPrec [ListNetworksResponse]
-> Read ListNetworksResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListNetworksResponse]
$creadListPrec :: ReadPrec [ListNetworksResponse]
readPrec :: ReadPrec ListNetworksResponse
$creadPrec :: ReadPrec ListNetworksResponse
readList :: ReadS [ListNetworksResponse]
$creadList :: ReadS [ListNetworksResponse]
readsPrec :: Int -> ReadS ListNetworksResponse
$creadsPrec :: Int -> ReadS ListNetworksResponse
Prelude.Read, Int -> ListNetworksResponse -> ShowS
[ListNetworksResponse] -> ShowS
ListNetworksResponse -> String
(Int -> ListNetworksResponse -> ShowS)
-> (ListNetworksResponse -> String)
-> ([ListNetworksResponse] -> ShowS)
-> Show ListNetworksResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListNetworksResponse] -> ShowS
$cshowList :: [ListNetworksResponse] -> ShowS
show :: ListNetworksResponse -> String
$cshow :: ListNetworksResponse -> String
showsPrec :: Int -> ListNetworksResponse -> ShowS
$cshowsPrec :: Int -> ListNetworksResponse -> ShowS
Prelude.Show, (forall x. ListNetworksResponse -> Rep ListNetworksResponse x)
-> (forall x. Rep ListNetworksResponse x -> ListNetworksResponse)
-> Generic ListNetworksResponse
forall x. Rep ListNetworksResponse x -> ListNetworksResponse
forall x. ListNetworksResponse -> Rep ListNetworksResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListNetworksResponse x -> ListNetworksResponse
$cfrom :: forall x. ListNetworksResponse -> Rep ListNetworksResponse x
Prelude.Generic)
newListNetworksResponse ::
Prelude.Int ->
ListNetworksResponse
newListNetworksResponse :: Int -> ListNetworksResponse
newListNetworksResponse Int
pHttpStatus_ =
ListNetworksResponse' :: Maybe [NetworkSummary] -> Maybe Text -> Int -> ListNetworksResponse
ListNetworksResponse'
{ $sel:networks:ListNetworksResponse' :: Maybe [NetworkSummary]
networks = Maybe [NetworkSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListNetworksResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListNetworksResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listNetworksResponse_networks :: Lens.Lens' ListNetworksResponse (Prelude.Maybe [NetworkSummary])
listNetworksResponse_networks :: (Maybe [NetworkSummary] -> f (Maybe [NetworkSummary]))
-> ListNetworksResponse -> f ListNetworksResponse
listNetworksResponse_networks = (ListNetworksResponse -> Maybe [NetworkSummary])
-> (ListNetworksResponse
-> Maybe [NetworkSummary] -> ListNetworksResponse)
-> Lens
ListNetworksResponse
ListNetworksResponse
(Maybe [NetworkSummary])
(Maybe [NetworkSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNetworksResponse' {Maybe [NetworkSummary]
networks :: Maybe [NetworkSummary]
$sel:networks:ListNetworksResponse' :: ListNetworksResponse -> Maybe [NetworkSummary]
networks} -> Maybe [NetworkSummary]
networks) (\s :: ListNetworksResponse
s@ListNetworksResponse' {} Maybe [NetworkSummary]
a -> ListNetworksResponse
s {$sel:networks:ListNetworksResponse' :: Maybe [NetworkSummary]
networks = Maybe [NetworkSummary]
a} :: ListNetworksResponse) ((Maybe [NetworkSummary] -> f (Maybe [NetworkSummary]))
-> ListNetworksResponse -> f ListNetworksResponse)
-> ((Maybe [NetworkSummary] -> f (Maybe [NetworkSummary]))
-> Maybe [NetworkSummary] -> f (Maybe [NetworkSummary]))
-> (Maybe [NetworkSummary] -> f (Maybe [NetworkSummary]))
-> ListNetworksResponse
-> f ListNetworksResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[NetworkSummary] [NetworkSummary] [NetworkSummary] [NetworkSummary]
-> Iso
(Maybe [NetworkSummary])
(Maybe [NetworkSummary])
(Maybe [NetworkSummary])
(Maybe [NetworkSummary])
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
[NetworkSummary] [NetworkSummary] [NetworkSummary] [NetworkSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listNetworksResponse_nextToken :: Lens.Lens' ListNetworksResponse (Prelude.Maybe Prelude.Text)
listNetworksResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListNetworksResponse -> f ListNetworksResponse
listNetworksResponse_nextToken = (ListNetworksResponse -> Maybe Text)
-> (ListNetworksResponse -> Maybe Text -> ListNetworksResponse)
-> Lens
ListNetworksResponse ListNetworksResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNetworksResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListNetworksResponse' :: ListNetworksResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListNetworksResponse
s@ListNetworksResponse' {} Maybe Text
a -> ListNetworksResponse
s {$sel:nextToken:ListNetworksResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListNetworksResponse)
listNetworksResponse_httpStatus :: Lens.Lens' ListNetworksResponse Prelude.Int
listNetworksResponse_httpStatus :: (Int -> f Int) -> ListNetworksResponse -> f ListNetworksResponse
listNetworksResponse_httpStatus = (ListNetworksResponse -> Int)
-> (ListNetworksResponse -> Int -> ListNetworksResponse)
-> Lens ListNetworksResponse ListNetworksResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListNetworksResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListNetworksResponse' :: ListNetworksResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListNetworksResponse
s@ListNetworksResponse' {} Int
a -> ListNetworksResponse
s {$sel:httpStatus:ListNetworksResponse' :: Int
httpStatus = Int
a} :: ListNetworksResponse)
instance Prelude.NFData ListNetworksResponse