{-# 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_maxResults,
listProposalVotes_nextToken,
listProposalVotes_networkId,
listProposalVotes_proposalId,
ListProposalVotesResponse (..),
newListProposalVotesResponse,
listProposalVotesResponse_nextToken,
listProposalVotesResponse_proposalVotes,
listProposalVotesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListProposalVotes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProposalVotes -> Text
networkId :: Prelude.Text,
ListProposalVotes -> Text
proposalId :: Prelude.Text
}
deriving (ListProposalVotes -> ListProposalVotes -> Bool
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]
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
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. 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'
{ $sel:maxResults:ListProposalVotes' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListProposalVotes' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:networkId:ListProposalVotes' :: Text
networkId = Text
pNetworkId_,
$sel:proposalId:ListProposalVotes' :: Text
proposalId = Text
pProposalId_
}
listProposalVotes_maxResults :: Lens.Lens' ListProposalVotes (Prelude.Maybe Prelude.Natural)
listProposalVotes_maxResults :: Lens' ListProposalVotes (Maybe Natural)
listProposalVotes_maxResults = 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_nextToken :: Lens.Lens' ListProposalVotes (Prelude.Maybe Prelude.Text)
listProposalVotes_nextToken :: Lens' ListProposalVotes (Maybe Text)
listProposalVotes_nextToken = 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_networkId :: Lens.Lens' ListProposalVotes Prelude.Text
listProposalVotes_networkId :: Lens' ListProposalVotes Text
listProposalVotes_networkId = 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 :: Lens' ListProposalVotes Text
listProposalVotes_proposalId = 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 :: (Service -> Service)
-> ListProposalVotes -> Request ListProposalVotes
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListProposalVotes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListProposalVotes)))
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 Text
-> Maybe [VoteSummary] -> Int -> ListProposalVotesResponse
ListProposalVotesResponse'
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
"NextToken")
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
"ProposalVotes" 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListProposalVotes where
hashWithSalt :: Int -> ListProposalVotes -> Int
hashWithSalt Int
_salt ListProposalVotes' {Maybe Natural
Maybe Text
Text
proposalId :: Text
networkId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:proposalId:ListProposalVotes' :: ListProposalVotes -> Text
$sel:networkId:ListProposalVotes' :: ListProposalVotes -> Text
$sel:nextToken:ListProposalVotes' :: ListProposalVotes -> Maybe Text
$sel:maxResults:ListProposalVotes' :: ListProposalVotes -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
networkId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
proposalId
instance Prelude.NFData ListProposalVotes where
rnf :: ListProposalVotes -> ()
rnf ListProposalVotes' {Maybe Natural
Maybe Text
Text
proposalId :: Text
networkId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:proposalId:ListProposalVotes' :: ListProposalVotes -> Text
$sel:networkId:ListProposalVotes' :: ListProposalVotes -> Text
$sel:nextToken:ListProposalVotes' :: ListProposalVotes -> Maybe Text
$sel:maxResults:ListProposalVotes' :: ListProposalVotes -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
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 Text
networkId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
proposalId
instance Data.ToHeaders ListProposalVotes where
toHeaders :: ListProposalVotes -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListProposalVotes where
toPath :: ListProposalVotes -> ByteString
toPath ListProposalVotes' {Maybe Natural
Maybe Text
Text
proposalId :: Text
networkId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:proposalId:ListProposalVotes' :: ListProposalVotes -> Text
$sel:networkId:ListProposalVotes' :: ListProposalVotes -> Text
$sel:nextToken:ListProposalVotes' :: ListProposalVotes -> Maybe Text
$sel:maxResults:ListProposalVotes' :: ListProposalVotes -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/networks/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
networkId,
ByteString
"/proposals/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
proposalId,
ByteString
"/votes"
]
instance Data.ToQuery ListProposalVotes where
toQuery :: ListProposalVotes -> QueryString
toQuery ListProposalVotes' {Maybe Natural
Maybe Text
Text
proposalId :: Text
networkId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:proposalId:ListProposalVotes' :: ListProposalVotes -> Text
$sel:networkId:ListProposalVotes' :: ListProposalVotes -> Text
$sel:nextToken:ListProposalVotes' :: ListProposalVotes -> Maybe Text
$sel:maxResults:ListProposalVotes' :: ListProposalVotes -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
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
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]
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
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.
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'
{ $sel:nextToken:ListProposalVotesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:proposalVotes:ListProposalVotesResponse' :: Maybe [VoteSummary]
proposalVotes = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListProposalVotesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listProposalVotesResponse_nextToken :: Lens.Lens' ListProposalVotesResponse (Prelude.Maybe Prelude.Text)
listProposalVotesResponse_nextToken :: Lens' ListProposalVotesResponse (Maybe Text)
listProposalVotesResponse_nextToken = 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 :: Lens' ListProposalVotesResponse (Maybe [VoteSummary])
listProposalVotesResponse_proposalVotes = 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) 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
listProposalVotesResponse_httpStatus :: Lens.Lens' ListProposalVotesResponse Prelude.Int
listProposalVotesResponse_httpStatus :: Lens' ListProposalVotesResponse Int
listProposalVotesResponse_httpStatus = 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 where
rnf :: ListProposalVotesResponse -> ()
rnf ListProposalVotesResponse' {Int
Maybe [VoteSummary]
Maybe Text
httpStatus :: Int
proposalVotes :: Maybe [VoteSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListProposalVotesResponse' :: ListProposalVotesResponse -> Int
$sel:proposalVotes:ListProposalVotesResponse' :: ListProposalVotesResponse -> Maybe [VoteSummary]
$sel:nextToken:ListProposalVotesResponse' :: ListProposalVotesResponse -> Maybe Text
..} =
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 Maybe [VoteSummary]
proposalVotes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus