{-# 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.Lightsail.CloseInstancePublicPorts
(
CloseInstancePublicPorts (..),
newCloseInstancePublicPorts,
closeInstancePublicPorts_portInfo,
closeInstancePublicPorts_instanceName,
CloseInstancePublicPortsResponse (..),
newCloseInstancePublicPortsResponse,
closeInstancePublicPortsResponse_operation,
closeInstancePublicPortsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CloseInstancePublicPorts = CloseInstancePublicPorts'
{
CloseInstancePublicPorts -> PortInfo
portInfo :: PortInfo,
CloseInstancePublicPorts -> Text
instanceName :: Prelude.Text
}
deriving (CloseInstancePublicPorts -> CloseInstancePublicPorts -> Bool
(CloseInstancePublicPorts -> CloseInstancePublicPorts -> Bool)
-> (CloseInstancePublicPorts -> CloseInstancePublicPorts -> Bool)
-> Eq CloseInstancePublicPorts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloseInstancePublicPorts -> CloseInstancePublicPorts -> Bool
$c/= :: CloseInstancePublicPorts -> CloseInstancePublicPorts -> Bool
== :: CloseInstancePublicPorts -> CloseInstancePublicPorts -> Bool
$c== :: CloseInstancePublicPorts -> CloseInstancePublicPorts -> Bool
Prelude.Eq, ReadPrec [CloseInstancePublicPorts]
ReadPrec CloseInstancePublicPorts
Int -> ReadS CloseInstancePublicPorts
ReadS [CloseInstancePublicPorts]
(Int -> ReadS CloseInstancePublicPorts)
-> ReadS [CloseInstancePublicPorts]
-> ReadPrec CloseInstancePublicPorts
-> ReadPrec [CloseInstancePublicPorts]
-> Read CloseInstancePublicPorts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloseInstancePublicPorts]
$creadListPrec :: ReadPrec [CloseInstancePublicPorts]
readPrec :: ReadPrec CloseInstancePublicPorts
$creadPrec :: ReadPrec CloseInstancePublicPorts
readList :: ReadS [CloseInstancePublicPorts]
$creadList :: ReadS [CloseInstancePublicPorts]
readsPrec :: Int -> ReadS CloseInstancePublicPorts
$creadsPrec :: Int -> ReadS CloseInstancePublicPorts
Prelude.Read, Int -> CloseInstancePublicPorts -> ShowS
[CloseInstancePublicPorts] -> ShowS
CloseInstancePublicPorts -> String
(Int -> CloseInstancePublicPorts -> ShowS)
-> (CloseInstancePublicPorts -> String)
-> ([CloseInstancePublicPorts] -> ShowS)
-> Show CloseInstancePublicPorts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloseInstancePublicPorts] -> ShowS
$cshowList :: [CloseInstancePublicPorts] -> ShowS
show :: CloseInstancePublicPorts -> String
$cshow :: CloseInstancePublicPorts -> String
showsPrec :: Int -> CloseInstancePublicPorts -> ShowS
$cshowsPrec :: Int -> CloseInstancePublicPorts -> ShowS
Prelude.Show, (forall x.
CloseInstancePublicPorts -> Rep CloseInstancePublicPorts x)
-> (forall x.
Rep CloseInstancePublicPorts x -> CloseInstancePublicPorts)
-> Generic CloseInstancePublicPorts
forall x.
Rep CloseInstancePublicPorts x -> CloseInstancePublicPorts
forall x.
CloseInstancePublicPorts -> Rep CloseInstancePublicPorts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloseInstancePublicPorts x -> CloseInstancePublicPorts
$cfrom :: forall x.
CloseInstancePublicPorts -> Rep CloseInstancePublicPorts x
Prelude.Generic)
newCloseInstancePublicPorts ::
PortInfo ->
Prelude.Text ->
CloseInstancePublicPorts
newCloseInstancePublicPorts :: PortInfo -> Text -> CloseInstancePublicPorts
newCloseInstancePublicPorts PortInfo
pPortInfo_ Text
pInstanceName_ =
CloseInstancePublicPorts' :: PortInfo -> Text -> CloseInstancePublicPorts
CloseInstancePublicPorts'
{ $sel:portInfo:CloseInstancePublicPorts' :: PortInfo
portInfo = PortInfo
pPortInfo_,
$sel:instanceName:CloseInstancePublicPorts' :: Text
instanceName = Text
pInstanceName_
}
closeInstancePublicPorts_portInfo :: Lens.Lens' CloseInstancePublicPorts PortInfo
closeInstancePublicPorts_portInfo :: (PortInfo -> f PortInfo)
-> CloseInstancePublicPorts -> f CloseInstancePublicPorts
closeInstancePublicPorts_portInfo = (CloseInstancePublicPorts -> PortInfo)
-> (CloseInstancePublicPorts
-> PortInfo -> CloseInstancePublicPorts)
-> Lens
CloseInstancePublicPorts CloseInstancePublicPorts PortInfo PortInfo
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloseInstancePublicPorts' {PortInfo
portInfo :: PortInfo
$sel:portInfo:CloseInstancePublicPorts' :: CloseInstancePublicPorts -> PortInfo
portInfo} -> PortInfo
portInfo) (\s :: CloseInstancePublicPorts
s@CloseInstancePublicPorts' {} PortInfo
a -> CloseInstancePublicPorts
s {$sel:portInfo:CloseInstancePublicPorts' :: PortInfo
portInfo = PortInfo
a} :: CloseInstancePublicPorts)
closeInstancePublicPorts_instanceName :: Lens.Lens' CloseInstancePublicPorts Prelude.Text
closeInstancePublicPorts_instanceName :: (Text -> f Text)
-> CloseInstancePublicPorts -> f CloseInstancePublicPorts
closeInstancePublicPorts_instanceName = (CloseInstancePublicPorts -> Text)
-> (CloseInstancePublicPorts -> Text -> CloseInstancePublicPorts)
-> Lens CloseInstancePublicPorts CloseInstancePublicPorts Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloseInstancePublicPorts' {Text
instanceName :: Text
$sel:instanceName:CloseInstancePublicPorts' :: CloseInstancePublicPorts -> Text
instanceName} -> Text
instanceName) (\s :: CloseInstancePublicPorts
s@CloseInstancePublicPorts' {} Text
a -> CloseInstancePublicPorts
s {$sel:instanceName:CloseInstancePublicPorts' :: Text
instanceName = Text
a} :: CloseInstancePublicPorts)
instance Core.AWSRequest CloseInstancePublicPorts where
type
AWSResponse CloseInstancePublicPorts =
CloseInstancePublicPortsResponse
request :: CloseInstancePublicPorts -> Request CloseInstancePublicPorts
request = Service
-> CloseInstancePublicPorts -> Request CloseInstancePublicPorts
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CloseInstancePublicPorts
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CloseInstancePublicPorts)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CloseInstancePublicPorts))
-> Logger
-> Service
-> Proxy CloseInstancePublicPorts
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CloseInstancePublicPorts)))
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 Operation -> Int -> CloseInstancePublicPortsResponse
CloseInstancePublicPortsResponse'
(Maybe Operation -> Int -> CloseInstancePublicPortsResponse)
-> Either String (Maybe Operation)
-> Either String (Int -> CloseInstancePublicPortsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Operation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operation")
Either String (Int -> CloseInstancePublicPortsResponse)
-> Either String Int
-> Either String CloseInstancePublicPortsResponse
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 CloseInstancePublicPorts
instance Prelude.NFData CloseInstancePublicPorts
instance Core.ToHeaders CloseInstancePublicPorts where
toHeaders :: CloseInstancePublicPorts -> ResponseHeaders
toHeaders =
ResponseHeaders -> CloseInstancePublicPorts -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Lightsail_20161128.CloseInstancePublicPorts" ::
Prelude.ByteString
),
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.ToJSON CloseInstancePublicPorts where
toJSON :: CloseInstancePublicPorts -> Value
toJSON CloseInstancePublicPorts' {Text
PortInfo
instanceName :: Text
portInfo :: PortInfo
$sel:instanceName:CloseInstancePublicPorts' :: CloseInstancePublicPorts -> Text
$sel:portInfo:CloseInstancePublicPorts' :: CloseInstancePublicPorts -> PortInfo
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"portInfo" Text -> PortInfo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PortInfo
portInfo),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"instanceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceName)
]
)
instance Core.ToPath CloseInstancePublicPorts where
toPath :: CloseInstancePublicPorts -> ByteString
toPath = ByteString -> CloseInstancePublicPorts -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CloseInstancePublicPorts where
toQuery :: CloseInstancePublicPorts -> QueryString
toQuery = QueryString -> CloseInstancePublicPorts -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CloseInstancePublicPortsResponse = CloseInstancePublicPortsResponse'
{
CloseInstancePublicPortsResponse -> Maybe Operation
operation :: Prelude.Maybe Operation,
CloseInstancePublicPortsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CloseInstancePublicPortsResponse
-> CloseInstancePublicPortsResponse -> Bool
(CloseInstancePublicPortsResponse
-> CloseInstancePublicPortsResponse -> Bool)
-> (CloseInstancePublicPortsResponse
-> CloseInstancePublicPortsResponse -> Bool)
-> Eq CloseInstancePublicPortsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloseInstancePublicPortsResponse
-> CloseInstancePublicPortsResponse -> Bool
$c/= :: CloseInstancePublicPortsResponse
-> CloseInstancePublicPortsResponse -> Bool
== :: CloseInstancePublicPortsResponse
-> CloseInstancePublicPortsResponse -> Bool
$c== :: CloseInstancePublicPortsResponse
-> CloseInstancePublicPortsResponse -> Bool
Prelude.Eq, ReadPrec [CloseInstancePublicPortsResponse]
ReadPrec CloseInstancePublicPortsResponse
Int -> ReadS CloseInstancePublicPortsResponse
ReadS [CloseInstancePublicPortsResponse]
(Int -> ReadS CloseInstancePublicPortsResponse)
-> ReadS [CloseInstancePublicPortsResponse]
-> ReadPrec CloseInstancePublicPortsResponse
-> ReadPrec [CloseInstancePublicPortsResponse]
-> Read CloseInstancePublicPortsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloseInstancePublicPortsResponse]
$creadListPrec :: ReadPrec [CloseInstancePublicPortsResponse]
readPrec :: ReadPrec CloseInstancePublicPortsResponse
$creadPrec :: ReadPrec CloseInstancePublicPortsResponse
readList :: ReadS [CloseInstancePublicPortsResponse]
$creadList :: ReadS [CloseInstancePublicPortsResponse]
readsPrec :: Int -> ReadS CloseInstancePublicPortsResponse
$creadsPrec :: Int -> ReadS CloseInstancePublicPortsResponse
Prelude.Read, Int -> CloseInstancePublicPortsResponse -> ShowS
[CloseInstancePublicPortsResponse] -> ShowS
CloseInstancePublicPortsResponse -> String
(Int -> CloseInstancePublicPortsResponse -> ShowS)
-> (CloseInstancePublicPortsResponse -> String)
-> ([CloseInstancePublicPortsResponse] -> ShowS)
-> Show CloseInstancePublicPortsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloseInstancePublicPortsResponse] -> ShowS
$cshowList :: [CloseInstancePublicPortsResponse] -> ShowS
show :: CloseInstancePublicPortsResponse -> String
$cshow :: CloseInstancePublicPortsResponse -> String
showsPrec :: Int -> CloseInstancePublicPortsResponse -> ShowS
$cshowsPrec :: Int -> CloseInstancePublicPortsResponse -> ShowS
Prelude.Show, (forall x.
CloseInstancePublicPortsResponse
-> Rep CloseInstancePublicPortsResponse x)
-> (forall x.
Rep CloseInstancePublicPortsResponse x
-> CloseInstancePublicPortsResponse)
-> Generic CloseInstancePublicPortsResponse
forall x.
Rep CloseInstancePublicPortsResponse x
-> CloseInstancePublicPortsResponse
forall x.
CloseInstancePublicPortsResponse
-> Rep CloseInstancePublicPortsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloseInstancePublicPortsResponse x
-> CloseInstancePublicPortsResponse
$cfrom :: forall x.
CloseInstancePublicPortsResponse
-> Rep CloseInstancePublicPortsResponse x
Prelude.Generic)
newCloseInstancePublicPortsResponse ::
Prelude.Int ->
CloseInstancePublicPortsResponse
newCloseInstancePublicPortsResponse :: Int -> CloseInstancePublicPortsResponse
newCloseInstancePublicPortsResponse Int
pHttpStatus_ =
CloseInstancePublicPortsResponse' :: Maybe Operation -> Int -> CloseInstancePublicPortsResponse
CloseInstancePublicPortsResponse'
{ $sel:operation:CloseInstancePublicPortsResponse' :: Maybe Operation
operation =
Maybe Operation
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CloseInstancePublicPortsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
closeInstancePublicPortsResponse_operation :: Lens.Lens' CloseInstancePublicPortsResponse (Prelude.Maybe Operation)
closeInstancePublicPortsResponse_operation :: (Maybe Operation -> f (Maybe Operation))
-> CloseInstancePublicPortsResponse
-> f CloseInstancePublicPortsResponse
closeInstancePublicPortsResponse_operation = (CloseInstancePublicPortsResponse -> Maybe Operation)
-> (CloseInstancePublicPortsResponse
-> Maybe Operation -> CloseInstancePublicPortsResponse)
-> Lens
CloseInstancePublicPortsResponse
CloseInstancePublicPortsResponse
(Maybe Operation)
(Maybe Operation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloseInstancePublicPortsResponse' {Maybe Operation
operation :: Maybe Operation
$sel:operation:CloseInstancePublicPortsResponse' :: CloseInstancePublicPortsResponse -> Maybe Operation
operation} -> Maybe Operation
operation) (\s :: CloseInstancePublicPortsResponse
s@CloseInstancePublicPortsResponse' {} Maybe Operation
a -> CloseInstancePublicPortsResponse
s {$sel:operation:CloseInstancePublicPortsResponse' :: Maybe Operation
operation = Maybe Operation
a} :: CloseInstancePublicPortsResponse)
closeInstancePublicPortsResponse_httpStatus :: Lens.Lens' CloseInstancePublicPortsResponse Prelude.Int
closeInstancePublicPortsResponse_httpStatus :: (Int -> f Int)
-> CloseInstancePublicPortsResponse
-> f CloseInstancePublicPortsResponse
closeInstancePublicPortsResponse_httpStatus = (CloseInstancePublicPortsResponse -> Int)
-> (CloseInstancePublicPortsResponse
-> Int -> CloseInstancePublicPortsResponse)
-> Lens
CloseInstancePublicPortsResponse
CloseInstancePublicPortsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloseInstancePublicPortsResponse' {Int
httpStatus :: Int
$sel:httpStatus:CloseInstancePublicPortsResponse' :: CloseInstancePublicPortsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CloseInstancePublicPortsResponse
s@CloseInstancePublicPortsResponse' {} Int
a -> CloseInstancePublicPortsResponse
s {$sel:httpStatus:CloseInstancePublicPortsResponse' :: Int
httpStatus = Int
a} :: CloseInstancePublicPortsResponse)
instance
Prelude.NFData
CloseInstancePublicPortsResponse