{-# 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.ListProposals
(
ListProposals (..),
newListProposals,
listProposals_nextToken,
listProposals_maxResults,
listProposals_networkId,
ListProposalsResponse (..),
newListProposalsResponse,
listProposalsResponse_proposals,
listProposalsResponse_nextToken,
listProposalsResponse_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 ListProposals = ListProposals'
{
ListProposals -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProposals -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListProposals -> Text
networkId :: Prelude.Text
}
deriving (ListProposals -> ListProposals -> Bool
(ListProposals -> ListProposals -> Bool)
-> (ListProposals -> ListProposals -> Bool) -> Eq ListProposals
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProposals -> ListProposals -> Bool
$c/= :: ListProposals -> ListProposals -> Bool
== :: ListProposals -> ListProposals -> Bool
$c== :: ListProposals -> ListProposals -> Bool
Prelude.Eq, ReadPrec [ListProposals]
ReadPrec ListProposals
Int -> ReadS ListProposals
ReadS [ListProposals]
(Int -> ReadS ListProposals)
-> ReadS [ListProposals]
-> ReadPrec ListProposals
-> ReadPrec [ListProposals]
-> Read ListProposals
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProposals]
$creadListPrec :: ReadPrec [ListProposals]
readPrec :: ReadPrec ListProposals
$creadPrec :: ReadPrec ListProposals
readList :: ReadS [ListProposals]
$creadList :: ReadS [ListProposals]
readsPrec :: Int -> ReadS ListProposals
$creadsPrec :: Int -> ReadS ListProposals
Prelude.Read, Int -> ListProposals -> ShowS
[ListProposals] -> ShowS
ListProposals -> String
(Int -> ListProposals -> ShowS)
-> (ListProposals -> String)
-> ([ListProposals] -> ShowS)
-> Show ListProposals
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProposals] -> ShowS
$cshowList :: [ListProposals] -> ShowS
show :: ListProposals -> String
$cshow :: ListProposals -> String
showsPrec :: Int -> ListProposals -> ShowS
$cshowsPrec :: Int -> ListProposals -> ShowS
Prelude.Show, (forall x. ListProposals -> Rep ListProposals x)
-> (forall x. Rep ListProposals x -> ListProposals)
-> Generic ListProposals
forall x. Rep ListProposals x -> ListProposals
forall x. ListProposals -> Rep ListProposals x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProposals x -> ListProposals
$cfrom :: forall x. ListProposals -> Rep ListProposals x
Prelude.Generic)
newListProposals ::
Prelude.Text ->
ListProposals
newListProposals :: Text -> ListProposals
newListProposals Text
pNetworkId_ =
ListProposals' :: Maybe Text -> Maybe Natural -> Text -> ListProposals
ListProposals'
{ $sel:nextToken:ListProposals' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListProposals' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:networkId:ListProposals' :: Text
networkId = Text
pNetworkId_
}
listProposals_nextToken :: Lens.Lens' ListProposals (Prelude.Maybe Prelude.Text)
listProposals_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListProposals -> f ListProposals
listProposals_nextToken = (ListProposals -> Maybe Text)
-> (ListProposals -> Maybe Text -> ListProposals)
-> Lens ListProposals ListProposals (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProposals' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProposals' :: ListProposals -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProposals
s@ListProposals' {} Maybe Text
a -> ListProposals
s {$sel:nextToken:ListProposals' :: Maybe Text
nextToken = Maybe Text
a} :: ListProposals)
listProposals_maxResults :: Lens.Lens' ListProposals (Prelude.Maybe Prelude.Natural)
listProposals_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListProposals -> f ListProposals
listProposals_maxResults = (ListProposals -> Maybe Natural)
-> (ListProposals -> Maybe Natural -> ListProposals)
-> Lens ListProposals ListProposals (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProposals' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListProposals' :: ListProposals -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListProposals
s@ListProposals' {} Maybe Natural
a -> ListProposals
s {$sel:maxResults:ListProposals' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListProposals)
listProposals_networkId :: Lens.Lens' ListProposals Prelude.Text
listProposals_networkId :: (Text -> f Text) -> ListProposals -> f ListProposals
listProposals_networkId = (ListProposals -> Text)
-> (ListProposals -> Text -> ListProposals)
-> Lens ListProposals ListProposals Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProposals' {Text
networkId :: Text
$sel:networkId:ListProposals' :: ListProposals -> Text
networkId} -> Text
networkId) (\s :: ListProposals
s@ListProposals' {} Text
a -> ListProposals
s {$sel:networkId:ListProposals' :: Text
networkId = Text
a} :: ListProposals)
instance Core.AWSRequest ListProposals where
type
AWSResponse ListProposals =
ListProposalsResponse
request :: ListProposals -> Request ListProposals
request = Service -> ListProposals -> Request ListProposals
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListProposals
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListProposals)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListProposals))
-> Logger
-> Service
-> Proxy ListProposals
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListProposals)))
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 [ProposalSummary]
-> Maybe Text -> Int -> ListProposalsResponse
ListProposalsResponse'
(Maybe [ProposalSummary]
-> Maybe Text -> Int -> ListProposalsResponse)
-> Either String (Maybe [ProposalSummary])
-> Either String (Maybe Text -> Int -> ListProposalsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [ProposalSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Proposals" Either String (Maybe (Maybe [ProposalSummary]))
-> Maybe [ProposalSummary]
-> Either String (Maybe [ProposalSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ProposalSummary]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListProposalsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListProposalsResponse)
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 -> ListProposalsResponse)
-> Either String Int -> Either String ListProposalsResponse
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 ListProposals
instance Prelude.NFData ListProposals
instance Core.ToHeaders ListProposals where
toHeaders :: ListProposals -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListProposals -> 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 ListProposals where
toPath :: ListProposals -> ByteString
toPath ListProposals' {Maybe Natural
Maybe Text
Text
networkId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:networkId:ListProposals' :: ListProposals -> Text
$sel:maxResults:ListProposals' :: ListProposals -> Maybe Natural
$sel:nextToken:ListProposals' :: ListProposals -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/networks/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
networkId, ByteString
"/proposals"]
instance Core.ToQuery ListProposals where
toQuery :: ListProposals -> QueryString
toQuery ListProposals' {Maybe Natural
Maybe Text
Text
networkId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:networkId:ListProposals' :: ListProposals -> Text
$sel:maxResults:ListProposals' :: ListProposals -> Maybe Natural
$sel:nextToken:ListProposals' :: ListProposals -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListProposalsResponse = ListProposalsResponse'
{
ListProposalsResponse -> Maybe [ProposalSummary]
proposals :: Prelude.Maybe [ProposalSummary],
ListProposalsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProposalsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListProposalsResponse -> ListProposalsResponse -> Bool
(ListProposalsResponse -> ListProposalsResponse -> Bool)
-> (ListProposalsResponse -> ListProposalsResponse -> Bool)
-> Eq ListProposalsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProposalsResponse -> ListProposalsResponse -> Bool
$c/= :: ListProposalsResponse -> ListProposalsResponse -> Bool
== :: ListProposalsResponse -> ListProposalsResponse -> Bool
$c== :: ListProposalsResponse -> ListProposalsResponse -> Bool
Prelude.Eq, ReadPrec [ListProposalsResponse]
ReadPrec ListProposalsResponse
Int -> ReadS ListProposalsResponse
ReadS [ListProposalsResponse]
(Int -> ReadS ListProposalsResponse)
-> ReadS [ListProposalsResponse]
-> ReadPrec ListProposalsResponse
-> ReadPrec [ListProposalsResponse]
-> Read ListProposalsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProposalsResponse]
$creadListPrec :: ReadPrec [ListProposalsResponse]
readPrec :: ReadPrec ListProposalsResponse
$creadPrec :: ReadPrec ListProposalsResponse
readList :: ReadS [ListProposalsResponse]
$creadList :: ReadS [ListProposalsResponse]
readsPrec :: Int -> ReadS ListProposalsResponse
$creadsPrec :: Int -> ReadS ListProposalsResponse
Prelude.Read, Int -> ListProposalsResponse -> ShowS
[ListProposalsResponse] -> ShowS
ListProposalsResponse -> String
(Int -> ListProposalsResponse -> ShowS)
-> (ListProposalsResponse -> String)
-> ([ListProposalsResponse] -> ShowS)
-> Show ListProposalsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProposalsResponse] -> ShowS
$cshowList :: [ListProposalsResponse] -> ShowS
show :: ListProposalsResponse -> String
$cshow :: ListProposalsResponse -> String
showsPrec :: Int -> ListProposalsResponse -> ShowS
$cshowsPrec :: Int -> ListProposalsResponse -> ShowS
Prelude.Show, (forall x. ListProposalsResponse -> Rep ListProposalsResponse x)
-> (forall x. Rep ListProposalsResponse x -> ListProposalsResponse)
-> Generic ListProposalsResponse
forall x. Rep ListProposalsResponse x -> ListProposalsResponse
forall x. ListProposalsResponse -> Rep ListProposalsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProposalsResponse x -> ListProposalsResponse
$cfrom :: forall x. ListProposalsResponse -> Rep ListProposalsResponse x
Prelude.Generic)
newListProposalsResponse ::
Prelude.Int ->
ListProposalsResponse
newListProposalsResponse :: Int -> ListProposalsResponse
newListProposalsResponse Int
pHttpStatus_ =
ListProposalsResponse' :: Maybe [ProposalSummary]
-> Maybe Text -> Int -> ListProposalsResponse
ListProposalsResponse'
{ $sel:proposals:ListProposalsResponse' :: Maybe [ProposalSummary]
proposals = Maybe [ProposalSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListProposalsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListProposalsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listProposalsResponse_proposals :: Lens.Lens' ListProposalsResponse (Prelude.Maybe [ProposalSummary])
listProposalsResponse_proposals :: (Maybe [ProposalSummary] -> f (Maybe [ProposalSummary]))
-> ListProposalsResponse -> f ListProposalsResponse
listProposalsResponse_proposals = (ListProposalsResponse -> Maybe [ProposalSummary])
-> (ListProposalsResponse
-> Maybe [ProposalSummary] -> ListProposalsResponse)
-> Lens
ListProposalsResponse
ListProposalsResponse
(Maybe [ProposalSummary])
(Maybe [ProposalSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProposalsResponse' {Maybe [ProposalSummary]
proposals :: Maybe [ProposalSummary]
$sel:proposals:ListProposalsResponse' :: ListProposalsResponse -> Maybe [ProposalSummary]
proposals} -> Maybe [ProposalSummary]
proposals) (\s :: ListProposalsResponse
s@ListProposalsResponse' {} Maybe [ProposalSummary]
a -> ListProposalsResponse
s {$sel:proposals:ListProposalsResponse' :: Maybe [ProposalSummary]
proposals = Maybe [ProposalSummary]
a} :: ListProposalsResponse) ((Maybe [ProposalSummary] -> f (Maybe [ProposalSummary]))
-> ListProposalsResponse -> f ListProposalsResponse)
-> ((Maybe [ProposalSummary] -> f (Maybe [ProposalSummary]))
-> Maybe [ProposalSummary] -> f (Maybe [ProposalSummary]))
-> (Maybe [ProposalSummary] -> f (Maybe [ProposalSummary]))
-> ListProposalsResponse
-> f ListProposalsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ProposalSummary]
[ProposalSummary]
[ProposalSummary]
[ProposalSummary]
-> Iso
(Maybe [ProposalSummary])
(Maybe [ProposalSummary])
(Maybe [ProposalSummary])
(Maybe [ProposalSummary])
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
[ProposalSummary]
[ProposalSummary]
[ProposalSummary]
[ProposalSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listProposalsResponse_nextToken :: Lens.Lens' ListProposalsResponse (Prelude.Maybe Prelude.Text)
listProposalsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListProposalsResponse -> f ListProposalsResponse
listProposalsResponse_nextToken = (ListProposalsResponse -> Maybe Text)
-> (ListProposalsResponse -> Maybe Text -> ListProposalsResponse)
-> Lens
ListProposalsResponse
ListProposalsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProposalsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProposalsResponse' :: ListProposalsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProposalsResponse
s@ListProposalsResponse' {} Maybe Text
a -> ListProposalsResponse
s {$sel:nextToken:ListProposalsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListProposalsResponse)
listProposalsResponse_httpStatus :: Lens.Lens' ListProposalsResponse Prelude.Int
listProposalsResponse_httpStatus :: (Int -> f Int) -> ListProposalsResponse -> f ListProposalsResponse
listProposalsResponse_httpStatus = (ListProposalsResponse -> Int)
-> (ListProposalsResponse -> Int -> ListProposalsResponse)
-> Lens ListProposalsResponse ListProposalsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProposalsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListProposalsResponse' :: ListProposalsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListProposalsResponse
s@ListProposalsResponse' {} Int
a -> ListProposalsResponse
s {$sel:httpStatus:ListProposalsResponse' :: Int
httpStatus = Int
a} :: ListProposalsResponse)
instance Prelude.NFData ListProposalsResponse