{-# 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.ListProposalVotes
(
ListProposalVotes (..),
newListProposalVotes,
listProposalVotes_nextToken,
listProposalVotes_maxResults,
listProposalVotes_networkId,
listProposalVotes_proposalId,
ListProposalVotesResponse (..),
newListProposalVotesResponse,
listProposalVotesResponse_nextToken,
listProposalVotesResponse_proposalVotes,
listProposalVotesResponse_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 ListProposalVotes = ListProposalVotes'
{
ListProposalVotes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProposalVotes -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListProposalVotes -> Text
networkId :: Prelude.Text,
ListProposalVotes -> Text
proposalId :: Prelude.Text
}
deriving (ListProposalVotes -> ListProposalVotes -> Bool
(ListProposalVotes -> ListProposalVotes -> Bool)
-> (ListProposalVotes -> ListProposalVotes -> Bool)
-> Eq ListProposalVotes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProposalVotes -> ListProposalVotes -> Bool
$c/= :: ListProposalVotes -> ListProposalVotes -> Bool
== :: ListProposalVotes -> ListProposalVotes -> Bool
$c== :: ListProposalVotes -> ListProposalVotes -> Bool
Prelude.Eq, ReadPrec [ListProposalVotes]
ReadPrec ListProposalVotes
Int -> ReadS ListProposalVotes
ReadS [ListProposalVotes]
(Int -> ReadS ListProposalVotes)
-> ReadS [ListProposalVotes]
-> ReadPrec ListProposalVotes
-> ReadPrec [ListProposalVotes]
-> Read ListProposalVotes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProposalVotes]
$creadListPrec :: ReadPrec [ListProposalVotes]
readPrec :: ReadPrec ListProposalVotes
$creadPrec :: ReadPrec ListProposalVotes
readList :: ReadS [ListProposalVotes]
$creadList :: ReadS [ListProposalVotes]
readsPrec :: Int -> ReadS ListProposalVotes
$creadsPrec :: Int -> ReadS ListProposalVotes
Prelude.Read, Int -> ListProposalVotes -> ShowS
[ListProposalVotes] -> ShowS
ListProposalVotes -> String
(Int -> ListProposalVotes -> ShowS)
-> (ListProposalVotes -> String)
-> ([ListProposalVotes] -> ShowS)
-> Show ListProposalVotes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProposalVotes] -> ShowS
$cshowList :: [ListProposalVotes] -> ShowS
show :: ListProposalVotes -> String
$cshow :: ListProposalVotes -> String
showsPrec :: Int -> ListProposalVotes -> ShowS
$cshowsPrec :: Int -> ListProposalVotes -> ShowS
Prelude.Show, (forall x. ListProposalVotes -> Rep ListProposalVotes x)
-> (forall x. Rep ListProposalVotes x -> ListProposalVotes)
-> Generic ListProposalVotes
forall x. Rep ListProposalVotes x -> ListProposalVotes
forall x. ListProposalVotes -> Rep ListProposalVotes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProposalVotes x -> ListProposalVotes
$cfrom :: forall x. ListProposalVotes -> Rep ListProposalVotes x
Prelude.Generic)
newListProposalVotes ::
Prelude.Text ->
Prelude.Text ->
ListProposalVotes
newListProposalVotes :: Text -> Text -> ListProposalVotes
newListProposalVotes Text
pNetworkId_ Text
pProposalId_ =
ListProposalVotes' :: Maybe Text -> Maybe Natural -> Text -> Text -> ListProposalVotes
ListProposalVotes'
{ $sel:nextToken:ListProposalVotes' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListProposalVotes' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:networkId:ListProposalVotes' :: Text
networkId = Text
pNetworkId_,
$sel:proposalId:ListProposalVotes' :: Text
proposalId = Text
pProposalId_
}
listProposalVotes_nextToken :: Lens.Lens' ListProposalVotes (Prelude.Maybe Prelude.Text)
listProposalVotes_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListProposalVotes -> f ListProposalVotes
listProposalVotes_nextToken = (ListProposalVotes -> Maybe Text)
-> (ListProposalVotes -> Maybe Text -> ListProposalVotes)
-> Lens
ListProposalVotes ListProposalVotes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProposalVotes' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProposalVotes' :: ListProposalVotes -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProposalVotes
s@ListProposalVotes' {} Maybe Text
a -> ListProposalVotes
s {$sel:nextToken:ListProposalVotes' :: Maybe Text
nextToken = Maybe Text
a} :: ListProposalVotes)
listProposalVotes_maxResults :: Lens.Lens' ListProposalVotes (Prelude.Maybe Prelude.Natural)
listProposalVotes_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListProposalVotes -> f ListProposalVotes
listProposalVotes_maxResults = (ListProposalVotes -> Maybe Natural)
-> (ListProposalVotes -> Maybe Natural -> ListProposalVotes)
-> Lens
ListProposalVotes ListProposalVotes (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProposalVotes' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListProposalVotes' :: ListProposalVotes -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListProposalVotes
s@ListProposalVotes' {} Maybe Natural
a -> ListProposalVotes
s {$sel:maxResults:ListProposalVotes' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListProposalVotes)
listProposalVotes_networkId :: Lens.Lens' ListProposalVotes Prelude.Text
listProposalVotes_networkId :: (Text -> f Text) -> ListProposalVotes -> f ListProposalVotes
listProposalVotes_networkId = (ListProposalVotes -> Text)
-> (ListProposalVotes -> Text -> ListProposalVotes)
-> Lens ListProposalVotes ListProposalVotes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProposalVotes' {Text
networkId :: Text
$sel:networkId:ListProposalVotes' :: ListProposalVotes -> Text
networkId} -> Text
networkId) (\s :: ListProposalVotes
s@ListProposalVotes' {} Text
a -> ListProposalVotes
s {$sel:networkId:ListProposalVotes' :: Text
networkId = Text
a} :: ListProposalVotes)
listProposalVotes_proposalId :: Lens.Lens' ListProposalVotes Prelude.Text
listProposalVotes_proposalId :: (Text -> f Text) -> ListProposalVotes -> f ListProposalVotes
listProposalVotes_proposalId = (ListProposalVotes -> Text)
-> (ListProposalVotes -> Text -> ListProposalVotes)
-> Lens ListProposalVotes ListProposalVotes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProposalVotes' {Text
proposalId :: Text
$sel:proposalId:ListProposalVotes' :: ListProposalVotes -> Text
proposalId} -> Text
proposalId) (\s :: ListProposalVotes
s@ListProposalVotes' {} Text
a -> ListProposalVotes
s {$sel:proposalId:ListProposalVotes' :: Text
proposalId = Text
a} :: ListProposalVotes)
instance Core.AWSRequest ListProposalVotes where
type
AWSResponse ListProposalVotes =
ListProposalVotesResponse
request :: ListProposalVotes -> Request ListProposalVotes
request = Service -> ListProposalVotes -> Request ListProposalVotes
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListProposalVotes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListProposalVotes)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListProposalVotes))
-> Logger
-> Service
-> Proxy ListProposalVotes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListProposalVotes)))
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 Text
-> Maybe [VoteSummary] -> Int -> ListProposalVotesResponse
ListProposalVotesResponse'
(Maybe Text
-> Maybe [VoteSummary] -> Int -> ListProposalVotesResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [VoteSummary] -> Int -> ListProposalVotesResponse)
forall (f :: * -> *) a b. Functor 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 (Maybe [VoteSummary] -> Int -> ListProposalVotesResponse)
-> Either String (Maybe [VoteSummary])
-> Either String (Int -> ListProposalVotesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [VoteSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProposalVotes" Either String (Maybe (Maybe [VoteSummary]))
-> Maybe [VoteSummary] -> Either String (Maybe [VoteSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [VoteSummary]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListProposalVotesResponse)
-> Either String Int -> Either String ListProposalVotesResponse
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 ListProposalVotes
instance Prelude.NFData ListProposalVotes
instance Core.ToHeaders ListProposalVotes where
toHeaders :: ListProposalVotes -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListProposalVotes -> 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 ListProposalVotes where
toPath :: ListProposalVotes -> ByteString
toPath ListProposalVotes' {Maybe Natural
Maybe Text
Text
proposalId :: Text
networkId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:proposalId:ListProposalVotes' :: ListProposalVotes -> Text
$sel:networkId:ListProposalVotes' :: ListProposalVotes -> Text
$sel:maxResults:ListProposalVotes' :: ListProposalVotes -> Maybe Natural
$sel:nextToken:ListProposalVotes' :: ListProposalVotes -> 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/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
proposalId,
ByteString
"/votes"
]
instance Core.ToQuery ListProposalVotes where
toQuery :: ListProposalVotes -> QueryString
toQuery ListProposalVotes' {Maybe Natural
Maybe Text
Text
proposalId :: Text
networkId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:proposalId:ListProposalVotes' :: ListProposalVotes -> Text
$sel:networkId:ListProposalVotes' :: ListProposalVotes -> Text
$sel:maxResults:ListProposalVotes' :: ListProposalVotes -> Maybe Natural
$sel:nextToken:ListProposalVotes' :: ListProposalVotes -> 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 ListProposalVotesResponse = ListProposalVotesResponse'
{
ListProposalVotesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProposalVotesResponse -> Maybe [VoteSummary]
proposalVotes :: Prelude.Maybe [VoteSummary],
ListProposalVotesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListProposalVotesResponse -> ListProposalVotesResponse -> Bool
(ListProposalVotesResponse -> ListProposalVotesResponse -> Bool)
-> (ListProposalVotesResponse -> ListProposalVotesResponse -> Bool)
-> Eq ListProposalVotesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProposalVotesResponse -> ListProposalVotesResponse -> Bool
$c/= :: ListProposalVotesResponse -> ListProposalVotesResponse -> Bool
== :: ListProposalVotesResponse -> ListProposalVotesResponse -> Bool
$c== :: ListProposalVotesResponse -> ListProposalVotesResponse -> Bool
Prelude.Eq, ReadPrec [ListProposalVotesResponse]
ReadPrec ListProposalVotesResponse
Int -> ReadS ListProposalVotesResponse
ReadS [ListProposalVotesResponse]
(Int -> ReadS ListProposalVotesResponse)
-> ReadS [ListProposalVotesResponse]
-> ReadPrec ListProposalVotesResponse
-> ReadPrec [ListProposalVotesResponse]
-> Read ListProposalVotesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProposalVotesResponse]
$creadListPrec :: ReadPrec [ListProposalVotesResponse]
readPrec :: ReadPrec ListProposalVotesResponse
$creadPrec :: ReadPrec ListProposalVotesResponse
readList :: ReadS [ListProposalVotesResponse]
$creadList :: ReadS [ListProposalVotesResponse]
readsPrec :: Int -> ReadS ListProposalVotesResponse
$creadsPrec :: Int -> ReadS ListProposalVotesResponse
Prelude.Read, Int -> ListProposalVotesResponse -> ShowS
[ListProposalVotesResponse] -> ShowS
ListProposalVotesResponse -> String
(Int -> ListProposalVotesResponse -> ShowS)
-> (ListProposalVotesResponse -> String)
-> ([ListProposalVotesResponse] -> ShowS)
-> Show ListProposalVotesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProposalVotesResponse] -> ShowS
$cshowList :: [ListProposalVotesResponse] -> ShowS
show :: ListProposalVotesResponse -> String
$cshow :: ListProposalVotesResponse -> String
showsPrec :: Int -> ListProposalVotesResponse -> ShowS
$cshowsPrec :: Int -> ListProposalVotesResponse -> ShowS
Prelude.Show, (forall x.
ListProposalVotesResponse -> Rep ListProposalVotesResponse x)
-> (forall x.
Rep ListProposalVotesResponse x -> ListProposalVotesResponse)
-> Generic ListProposalVotesResponse
forall x.
Rep ListProposalVotesResponse x -> ListProposalVotesResponse
forall x.
ListProposalVotesResponse -> Rep ListProposalVotesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListProposalVotesResponse x -> ListProposalVotesResponse
$cfrom :: forall x.
ListProposalVotesResponse -> Rep ListProposalVotesResponse x
Prelude.Generic)
newListProposalVotesResponse ::
Prelude.Int ->
ListProposalVotesResponse
newListProposalVotesResponse :: Int -> ListProposalVotesResponse
newListProposalVotesResponse Int
pHttpStatus_ =
ListProposalVotesResponse' :: Maybe Text
-> Maybe [VoteSummary] -> Int -> ListProposalVotesResponse
ListProposalVotesResponse'
{ $sel:nextToken:ListProposalVotesResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:proposalVotes:ListProposalVotesResponse' :: Maybe [VoteSummary]
proposalVotes = Maybe [VoteSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListProposalVotesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listProposalVotesResponse_nextToken :: Lens.Lens' ListProposalVotesResponse (Prelude.Maybe Prelude.Text)
listProposalVotesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListProposalVotesResponse -> f ListProposalVotesResponse
listProposalVotesResponse_nextToken = (ListProposalVotesResponse -> Maybe Text)
-> (ListProposalVotesResponse
-> Maybe Text -> ListProposalVotesResponse)
-> Lens
ListProposalVotesResponse
ListProposalVotesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProposalVotesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProposalVotesResponse' :: ListProposalVotesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProposalVotesResponse
s@ListProposalVotesResponse' {} Maybe Text
a -> ListProposalVotesResponse
s {$sel:nextToken:ListProposalVotesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListProposalVotesResponse)
listProposalVotesResponse_proposalVotes :: Lens.Lens' ListProposalVotesResponse (Prelude.Maybe [VoteSummary])
listProposalVotesResponse_proposalVotes :: (Maybe [VoteSummary] -> f (Maybe [VoteSummary]))
-> ListProposalVotesResponse -> f ListProposalVotesResponse
listProposalVotesResponse_proposalVotes = (ListProposalVotesResponse -> Maybe [VoteSummary])
-> (ListProposalVotesResponse
-> Maybe [VoteSummary] -> ListProposalVotesResponse)
-> Lens
ListProposalVotesResponse
ListProposalVotesResponse
(Maybe [VoteSummary])
(Maybe [VoteSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProposalVotesResponse' {Maybe [VoteSummary]
proposalVotes :: Maybe [VoteSummary]
$sel:proposalVotes:ListProposalVotesResponse' :: ListProposalVotesResponse -> Maybe [VoteSummary]
proposalVotes} -> Maybe [VoteSummary]
proposalVotes) (\s :: ListProposalVotesResponse
s@ListProposalVotesResponse' {} Maybe [VoteSummary]
a -> ListProposalVotesResponse
s {$sel:proposalVotes:ListProposalVotesResponse' :: Maybe [VoteSummary]
proposalVotes = Maybe [VoteSummary]
a} :: ListProposalVotesResponse) ((Maybe [VoteSummary] -> f (Maybe [VoteSummary]))
-> ListProposalVotesResponse -> f ListProposalVotesResponse)
-> ((Maybe [VoteSummary] -> f (Maybe [VoteSummary]))
-> Maybe [VoteSummary] -> f (Maybe [VoteSummary]))
-> (Maybe [VoteSummary] -> f (Maybe [VoteSummary]))
-> ListProposalVotesResponse
-> f ListProposalVotesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [VoteSummary] [VoteSummary] [VoteSummary] [VoteSummary]
-> Iso
(Maybe [VoteSummary])
(Maybe [VoteSummary])
(Maybe [VoteSummary])
(Maybe [VoteSummary])
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 [VoteSummary] [VoteSummary] [VoteSummary] [VoteSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listProposalVotesResponse_httpStatus :: Lens.Lens' ListProposalVotesResponse Prelude.Int
listProposalVotesResponse_httpStatus :: (Int -> f Int)
-> ListProposalVotesResponse -> f ListProposalVotesResponse
listProposalVotesResponse_httpStatus = (ListProposalVotesResponse -> Int)
-> (ListProposalVotesResponse -> Int -> ListProposalVotesResponse)
-> Lens ListProposalVotesResponse ListProposalVotesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProposalVotesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListProposalVotesResponse' :: ListProposalVotesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListProposalVotesResponse
s@ListProposalVotesResponse' {} Int
a -> ListProposalVotesResponse
s {$sel:httpStatus:ListProposalVotesResponse' :: Int
httpStatus = Int
a} :: ListProposalVotesResponse)
instance Prelude.NFData ListProposalVotesResponse