{-# 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_maxResults,
listProposals_nextToken,
listProposals_networkId,
ListProposalsResponse (..),
newListProposalsResponse,
listProposalsResponse_nextToken,
listProposalsResponse_proposals,
listProposalsResponse_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 ListProposals = ListProposals'
{
ListProposals -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListProposals -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProposals -> Text
networkId :: Prelude.Text
}
deriving (ListProposals -> ListProposals -> Bool
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]
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
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. 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'
{ $sel:maxResults:ListProposals' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListProposals' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:networkId:ListProposals' :: Text
networkId = Text
pNetworkId_
}
listProposals_maxResults :: Lens.Lens' ListProposals (Prelude.Maybe Prelude.Natural)
listProposals_maxResults :: Lens' ListProposals (Maybe Natural)
listProposals_maxResults = 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_nextToken :: Lens.Lens' ListProposals (Prelude.Maybe Prelude.Text)
listProposals_nextToken :: Lens' ListProposals (Maybe Text)
listProposals_nextToken = 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_networkId :: Lens.Lens' ListProposals Prelude.Text
listProposals_networkId :: Lens' ListProposals Text
listProposals_networkId = 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 :: (Service -> Service) -> ListProposals -> Request ListProposals
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 ListProposals
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListProposals)))
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 [ProposalSummary] -> Int -> ListProposalsResponse
ListProposalsResponse'
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
"Proposals" 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 ListProposals where
hashWithSalt :: Int -> ListProposals -> Int
hashWithSalt Int
_salt ListProposals' {Maybe Natural
Maybe Text
Text
networkId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:networkId:ListProposals' :: ListProposals -> Text
$sel:nextToken:ListProposals' :: ListProposals -> Maybe Text
$sel:maxResults:ListProposals' :: ListProposals -> 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
instance Prelude.NFData ListProposals where
rnf :: ListProposals -> ()
rnf ListProposals' {Maybe Natural
Maybe Text
Text
networkId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:networkId:ListProposals' :: ListProposals -> Text
$sel:nextToken:ListProposals' :: ListProposals -> Maybe Text
$sel:maxResults:ListProposals' :: ListProposals -> 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
instance Data.ToHeaders ListProposals where
toHeaders :: ListProposals -> 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 ListProposals where
toPath :: ListProposals -> ByteString
toPath ListProposals' {Maybe Natural
Maybe Text
Text
networkId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:networkId:ListProposals' :: ListProposals -> Text
$sel:nextToken:ListProposals' :: ListProposals -> Maybe Text
$sel:maxResults:ListProposals' :: ListProposals -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/networks/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
networkId, ByteString
"/proposals"]
instance Data.ToQuery ListProposals where
toQuery :: ListProposals -> QueryString
toQuery ListProposals' {Maybe Natural
Maybe Text
Text
networkId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:networkId:ListProposals' :: ListProposals -> Text
$sel:nextToken:ListProposals' :: ListProposals -> Maybe Text
$sel:maxResults:ListProposals' :: ListProposals -> 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 ListProposalsResponse = ListProposalsResponse'
{
ListProposalsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListProposalsResponse -> Maybe [ProposalSummary]
proposals :: Prelude.Maybe [ProposalSummary],
ListProposalsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListProposalsResponse -> ListProposalsResponse -> Bool
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]
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
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. 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'
{ $sel:nextToken:ListProposalsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:proposals:ListProposalsResponse' :: Maybe [ProposalSummary]
proposals = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListProposalsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listProposalsResponse_nextToken :: Lens.Lens' ListProposalsResponse (Prelude.Maybe Prelude.Text)
listProposalsResponse_nextToken :: Lens' ListProposalsResponse (Maybe Text)
listProposalsResponse_nextToken = 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_proposals :: Lens.Lens' ListProposalsResponse (Prelude.Maybe [ProposalSummary])
listProposalsResponse_proposals :: Lens' ListProposalsResponse (Maybe [ProposalSummary])
listProposalsResponse_proposals = 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) 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
listProposalsResponse_httpStatus :: Lens.Lens' ListProposalsResponse Prelude.Int
listProposalsResponse_httpStatus :: Lens' ListProposalsResponse Int
listProposalsResponse_httpStatus = 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 where
rnf :: ListProposalsResponse -> ()
rnf ListProposalsResponse' {Int
Maybe [ProposalSummary]
Maybe Text
httpStatus :: Int
proposals :: Maybe [ProposalSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListProposalsResponse' :: ListProposalsResponse -> Int
$sel:proposals:ListProposalsResponse' :: ListProposalsResponse -> Maybe [ProposalSummary]
$sel:nextToken:ListProposalsResponse' :: ListProposalsResponse -> 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 [ProposalSummary]
proposals
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus