{-# 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.GetNetwork
(
GetNetwork (..),
newGetNetwork,
getNetwork_networkId,
GetNetworkResponse (..),
newGetNetworkResponse,
getNetworkResponse_network,
getNetworkResponse_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 GetNetwork = GetNetwork'
{
GetNetwork -> Text
networkId :: Prelude.Text
}
deriving (GetNetwork -> GetNetwork -> Bool
(GetNetwork -> GetNetwork -> Bool)
-> (GetNetwork -> GetNetwork -> Bool) -> Eq GetNetwork
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetNetwork -> GetNetwork -> Bool
$c/= :: GetNetwork -> GetNetwork -> Bool
== :: GetNetwork -> GetNetwork -> Bool
$c== :: GetNetwork -> GetNetwork -> Bool
Prelude.Eq, ReadPrec [GetNetwork]
ReadPrec GetNetwork
Int -> ReadS GetNetwork
ReadS [GetNetwork]
(Int -> ReadS GetNetwork)
-> ReadS [GetNetwork]
-> ReadPrec GetNetwork
-> ReadPrec [GetNetwork]
-> Read GetNetwork
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetNetwork]
$creadListPrec :: ReadPrec [GetNetwork]
readPrec :: ReadPrec GetNetwork
$creadPrec :: ReadPrec GetNetwork
readList :: ReadS [GetNetwork]
$creadList :: ReadS [GetNetwork]
readsPrec :: Int -> ReadS GetNetwork
$creadsPrec :: Int -> ReadS GetNetwork
Prelude.Read, Int -> GetNetwork -> ShowS
[GetNetwork] -> ShowS
GetNetwork -> String
(Int -> GetNetwork -> ShowS)
-> (GetNetwork -> String)
-> ([GetNetwork] -> ShowS)
-> Show GetNetwork
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetNetwork] -> ShowS
$cshowList :: [GetNetwork] -> ShowS
show :: GetNetwork -> String
$cshow :: GetNetwork -> String
showsPrec :: Int -> GetNetwork -> ShowS
$cshowsPrec :: Int -> GetNetwork -> ShowS
Prelude.Show, (forall x. GetNetwork -> Rep GetNetwork x)
-> (forall x. Rep GetNetwork x -> GetNetwork) -> Generic GetNetwork
forall x. Rep GetNetwork x -> GetNetwork
forall x. GetNetwork -> Rep GetNetwork x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetNetwork x -> GetNetwork
$cfrom :: forall x. GetNetwork -> Rep GetNetwork x
Prelude.Generic)
newGetNetwork ::
Prelude.Text ->
GetNetwork
newGetNetwork :: Text -> GetNetwork
newGetNetwork Text
pNetworkId_ =
GetNetwork' :: Text -> GetNetwork
GetNetwork' {$sel:networkId:GetNetwork' :: Text
networkId = Text
pNetworkId_}
getNetwork_networkId :: Lens.Lens' GetNetwork Prelude.Text
getNetwork_networkId :: (Text -> f Text) -> GetNetwork -> f GetNetwork
getNetwork_networkId = (GetNetwork -> Text)
-> (GetNetwork -> Text -> GetNetwork)
-> Lens GetNetwork GetNetwork Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetwork' {Text
networkId :: Text
$sel:networkId:GetNetwork' :: GetNetwork -> Text
networkId} -> Text
networkId) (\s :: GetNetwork
s@GetNetwork' {} Text
a -> GetNetwork
s {$sel:networkId:GetNetwork' :: Text
networkId = Text
a} :: GetNetwork)
instance Core.AWSRequest GetNetwork where
type AWSResponse GetNetwork = GetNetworkResponse
request :: GetNetwork -> Request GetNetwork
request = Service -> GetNetwork -> Request GetNetwork
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetNetwork
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetNetwork)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetNetwork))
-> Logger
-> Service
-> Proxy GetNetwork
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetNetwork)))
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 Network -> Int -> GetNetworkResponse
GetNetworkResponse'
(Maybe Network -> Int -> GetNetworkResponse)
-> Either String (Maybe Network)
-> Either String (Int -> GetNetworkResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Network)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Network")
Either String (Int -> GetNetworkResponse)
-> Either String Int -> Either String GetNetworkResponse
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 GetNetwork
instance Prelude.NFData GetNetwork
instance Core.ToHeaders GetNetwork where
toHeaders :: GetNetwork -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetNetwork -> 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 GetNetwork where
toPath :: GetNetwork -> ByteString
toPath GetNetwork' {Text
networkId :: Text
$sel:networkId:GetNetwork' :: GetNetwork -> 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]
instance Core.ToQuery GetNetwork where
toQuery :: GetNetwork -> QueryString
toQuery = QueryString -> GetNetwork -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetNetworkResponse = GetNetworkResponse'
{
GetNetworkResponse -> Maybe Network
network :: Prelude.Maybe Network,
GetNetworkResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetNetworkResponse -> GetNetworkResponse -> Bool
(GetNetworkResponse -> GetNetworkResponse -> Bool)
-> (GetNetworkResponse -> GetNetworkResponse -> Bool)
-> Eq GetNetworkResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetNetworkResponse -> GetNetworkResponse -> Bool
$c/= :: GetNetworkResponse -> GetNetworkResponse -> Bool
== :: GetNetworkResponse -> GetNetworkResponse -> Bool
$c== :: GetNetworkResponse -> GetNetworkResponse -> Bool
Prelude.Eq, ReadPrec [GetNetworkResponse]
ReadPrec GetNetworkResponse
Int -> ReadS GetNetworkResponse
ReadS [GetNetworkResponse]
(Int -> ReadS GetNetworkResponse)
-> ReadS [GetNetworkResponse]
-> ReadPrec GetNetworkResponse
-> ReadPrec [GetNetworkResponse]
-> Read GetNetworkResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetNetworkResponse]
$creadListPrec :: ReadPrec [GetNetworkResponse]
readPrec :: ReadPrec GetNetworkResponse
$creadPrec :: ReadPrec GetNetworkResponse
readList :: ReadS [GetNetworkResponse]
$creadList :: ReadS [GetNetworkResponse]
readsPrec :: Int -> ReadS GetNetworkResponse
$creadsPrec :: Int -> ReadS GetNetworkResponse
Prelude.Read, Int -> GetNetworkResponse -> ShowS
[GetNetworkResponse] -> ShowS
GetNetworkResponse -> String
(Int -> GetNetworkResponse -> ShowS)
-> (GetNetworkResponse -> String)
-> ([GetNetworkResponse] -> ShowS)
-> Show GetNetworkResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetNetworkResponse] -> ShowS
$cshowList :: [GetNetworkResponse] -> ShowS
show :: GetNetworkResponse -> String
$cshow :: GetNetworkResponse -> String
showsPrec :: Int -> GetNetworkResponse -> ShowS
$cshowsPrec :: Int -> GetNetworkResponse -> ShowS
Prelude.Show, (forall x. GetNetworkResponse -> Rep GetNetworkResponse x)
-> (forall x. Rep GetNetworkResponse x -> GetNetworkResponse)
-> Generic GetNetworkResponse
forall x. Rep GetNetworkResponse x -> GetNetworkResponse
forall x. GetNetworkResponse -> Rep GetNetworkResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetNetworkResponse x -> GetNetworkResponse
$cfrom :: forall x. GetNetworkResponse -> Rep GetNetworkResponse x
Prelude.Generic)
newGetNetworkResponse ::
Prelude.Int ->
GetNetworkResponse
newGetNetworkResponse :: Int -> GetNetworkResponse
newGetNetworkResponse Int
pHttpStatus_ =
GetNetworkResponse' :: Maybe Network -> Int -> GetNetworkResponse
GetNetworkResponse'
{ $sel:network:GetNetworkResponse' :: Maybe Network
network = Maybe Network
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetNetworkResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getNetworkResponse_network :: Lens.Lens' GetNetworkResponse (Prelude.Maybe Network)
getNetworkResponse_network :: (Maybe Network -> f (Maybe Network))
-> GetNetworkResponse -> f GetNetworkResponse
getNetworkResponse_network = (GetNetworkResponse -> Maybe Network)
-> (GetNetworkResponse -> Maybe Network -> GetNetworkResponse)
-> Lens
GetNetworkResponse
GetNetworkResponse
(Maybe Network)
(Maybe Network)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkResponse' {Maybe Network
network :: Maybe Network
$sel:network:GetNetworkResponse' :: GetNetworkResponse -> Maybe Network
network} -> Maybe Network
network) (\s :: GetNetworkResponse
s@GetNetworkResponse' {} Maybe Network
a -> GetNetworkResponse
s {$sel:network:GetNetworkResponse' :: Maybe Network
network = Maybe Network
a} :: GetNetworkResponse)
getNetworkResponse_httpStatus :: Lens.Lens' GetNetworkResponse Prelude.Int
getNetworkResponse_httpStatus :: (Int -> f Int) -> GetNetworkResponse -> f GetNetworkResponse
getNetworkResponse_httpStatus = (GetNetworkResponse -> Int)
-> (GetNetworkResponse -> Int -> GetNetworkResponse)
-> Lens GetNetworkResponse GetNetworkResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetNetworkResponse' :: GetNetworkResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetNetworkResponse
s@GetNetworkResponse' {} Int
a -> GetNetworkResponse
s {$sel:httpStatus:GetNetworkResponse' :: Int
httpStatus = Int
a} :: GetNetworkResponse)
instance Prelude.NFData GetNetworkResponse