{-# 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.PutInstancePublicPorts
(
PutInstancePublicPorts (..),
newPutInstancePublicPorts,
putInstancePublicPorts_portInfos,
putInstancePublicPorts_instanceName,
PutInstancePublicPortsResponse (..),
newPutInstancePublicPortsResponse,
putInstancePublicPortsResponse_operation,
putInstancePublicPortsResponse_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 PutInstancePublicPorts = PutInstancePublicPorts'
{
PutInstancePublicPorts -> [PortInfo]
portInfos :: [PortInfo],
PutInstancePublicPorts -> Text
instanceName :: Prelude.Text
}
deriving (PutInstancePublicPorts -> PutInstancePublicPorts -> Bool
(PutInstancePublicPorts -> PutInstancePublicPorts -> Bool)
-> (PutInstancePublicPorts -> PutInstancePublicPorts -> Bool)
-> Eq PutInstancePublicPorts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutInstancePublicPorts -> PutInstancePublicPorts -> Bool
$c/= :: PutInstancePublicPorts -> PutInstancePublicPorts -> Bool
== :: PutInstancePublicPorts -> PutInstancePublicPorts -> Bool
$c== :: PutInstancePublicPorts -> PutInstancePublicPorts -> Bool
Prelude.Eq, ReadPrec [PutInstancePublicPorts]
ReadPrec PutInstancePublicPorts
Int -> ReadS PutInstancePublicPorts
ReadS [PutInstancePublicPorts]
(Int -> ReadS PutInstancePublicPorts)
-> ReadS [PutInstancePublicPorts]
-> ReadPrec PutInstancePublicPorts
-> ReadPrec [PutInstancePublicPorts]
-> Read PutInstancePublicPorts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutInstancePublicPorts]
$creadListPrec :: ReadPrec [PutInstancePublicPorts]
readPrec :: ReadPrec PutInstancePublicPorts
$creadPrec :: ReadPrec PutInstancePublicPorts
readList :: ReadS [PutInstancePublicPorts]
$creadList :: ReadS [PutInstancePublicPorts]
readsPrec :: Int -> ReadS PutInstancePublicPorts
$creadsPrec :: Int -> ReadS PutInstancePublicPorts
Prelude.Read, Int -> PutInstancePublicPorts -> ShowS
[PutInstancePublicPorts] -> ShowS
PutInstancePublicPorts -> String
(Int -> PutInstancePublicPorts -> ShowS)
-> (PutInstancePublicPorts -> String)
-> ([PutInstancePublicPorts] -> ShowS)
-> Show PutInstancePublicPorts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutInstancePublicPorts] -> ShowS
$cshowList :: [PutInstancePublicPorts] -> ShowS
show :: PutInstancePublicPorts -> String
$cshow :: PutInstancePublicPorts -> String
showsPrec :: Int -> PutInstancePublicPorts -> ShowS
$cshowsPrec :: Int -> PutInstancePublicPorts -> ShowS
Prelude.Show, (forall x. PutInstancePublicPorts -> Rep PutInstancePublicPorts x)
-> (forall x.
Rep PutInstancePublicPorts x -> PutInstancePublicPorts)
-> Generic PutInstancePublicPorts
forall x. Rep PutInstancePublicPorts x -> PutInstancePublicPorts
forall x. PutInstancePublicPorts -> Rep PutInstancePublicPorts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutInstancePublicPorts x -> PutInstancePublicPorts
$cfrom :: forall x. PutInstancePublicPorts -> Rep PutInstancePublicPorts x
Prelude.Generic)
newPutInstancePublicPorts ::
Prelude.Text ->
PutInstancePublicPorts
newPutInstancePublicPorts :: Text -> PutInstancePublicPorts
newPutInstancePublicPorts Text
pInstanceName_ =
PutInstancePublicPorts' :: [PortInfo] -> Text -> PutInstancePublicPorts
PutInstancePublicPorts'
{ $sel:portInfos:PutInstancePublicPorts' :: [PortInfo]
portInfos = [PortInfo]
forall a. Monoid a => a
Prelude.mempty,
$sel:instanceName:PutInstancePublicPorts' :: Text
instanceName = Text
pInstanceName_
}
putInstancePublicPorts_portInfos :: Lens.Lens' PutInstancePublicPorts [PortInfo]
putInstancePublicPorts_portInfos :: ([PortInfo] -> f [PortInfo])
-> PutInstancePublicPorts -> f PutInstancePublicPorts
putInstancePublicPorts_portInfos = (PutInstancePublicPorts -> [PortInfo])
-> (PutInstancePublicPorts -> [PortInfo] -> PutInstancePublicPorts)
-> Lens
PutInstancePublicPorts PutInstancePublicPorts [PortInfo] [PortInfo]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInstancePublicPorts' {[PortInfo]
portInfos :: [PortInfo]
$sel:portInfos:PutInstancePublicPorts' :: PutInstancePublicPorts -> [PortInfo]
portInfos} -> [PortInfo]
portInfos) (\s :: PutInstancePublicPorts
s@PutInstancePublicPorts' {} [PortInfo]
a -> PutInstancePublicPorts
s {$sel:portInfos:PutInstancePublicPorts' :: [PortInfo]
portInfos = [PortInfo]
a} :: PutInstancePublicPorts) (([PortInfo] -> f [PortInfo])
-> PutInstancePublicPorts -> f PutInstancePublicPorts)
-> (([PortInfo] -> f [PortInfo]) -> [PortInfo] -> f [PortInfo])
-> ([PortInfo] -> f [PortInfo])
-> PutInstancePublicPorts
-> f PutInstancePublicPorts
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([PortInfo] -> f [PortInfo]) -> [PortInfo] -> f [PortInfo]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putInstancePublicPorts_instanceName :: Lens.Lens' PutInstancePublicPorts Prelude.Text
putInstancePublicPorts_instanceName :: (Text -> f Text)
-> PutInstancePublicPorts -> f PutInstancePublicPorts
putInstancePublicPorts_instanceName = (PutInstancePublicPorts -> Text)
-> (PutInstancePublicPorts -> Text -> PutInstancePublicPorts)
-> Lens PutInstancePublicPorts PutInstancePublicPorts Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInstancePublicPorts' {Text
instanceName :: Text
$sel:instanceName:PutInstancePublicPorts' :: PutInstancePublicPorts -> Text
instanceName} -> Text
instanceName) (\s :: PutInstancePublicPorts
s@PutInstancePublicPorts' {} Text
a -> PutInstancePublicPorts
s {$sel:instanceName:PutInstancePublicPorts' :: Text
instanceName = Text
a} :: PutInstancePublicPorts)
instance Core.AWSRequest PutInstancePublicPorts where
type
AWSResponse PutInstancePublicPorts =
PutInstancePublicPortsResponse
request :: PutInstancePublicPorts -> Request PutInstancePublicPorts
request = Service -> PutInstancePublicPorts -> Request PutInstancePublicPorts
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutInstancePublicPorts
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutInstancePublicPorts)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutInstancePublicPorts))
-> Logger
-> Service
-> Proxy PutInstancePublicPorts
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutInstancePublicPorts)))
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 -> PutInstancePublicPortsResponse
PutInstancePublicPortsResponse'
(Maybe Operation -> Int -> PutInstancePublicPortsResponse)
-> Either String (Maybe Operation)
-> Either String (Int -> PutInstancePublicPortsResponse)
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 -> PutInstancePublicPortsResponse)
-> Either String Int
-> Either String PutInstancePublicPortsResponse
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 PutInstancePublicPorts
instance Prelude.NFData PutInstancePublicPorts
instance Core.ToHeaders PutInstancePublicPorts where
toHeaders :: PutInstancePublicPorts -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutInstancePublicPorts -> 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.PutInstancePublicPorts" ::
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 PutInstancePublicPorts where
toJSON :: PutInstancePublicPorts -> Value
toJSON PutInstancePublicPorts' {[PortInfo]
Text
instanceName :: Text
portInfos :: [PortInfo]
$sel:instanceName:PutInstancePublicPorts' :: PutInstancePublicPorts -> Text
$sel:portInfos:PutInstancePublicPorts' :: PutInstancePublicPorts -> [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
"portInfos" Text -> [PortInfo] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [PortInfo]
portInfos),
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 PutInstancePublicPorts where
toPath :: PutInstancePublicPorts -> ByteString
toPath = ByteString -> PutInstancePublicPorts -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutInstancePublicPorts where
toQuery :: PutInstancePublicPorts -> QueryString
toQuery = QueryString -> PutInstancePublicPorts -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutInstancePublicPortsResponse = PutInstancePublicPortsResponse'
{
PutInstancePublicPortsResponse -> Maybe Operation
operation :: Prelude.Maybe Operation,
PutInstancePublicPortsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutInstancePublicPortsResponse
-> PutInstancePublicPortsResponse -> Bool
(PutInstancePublicPortsResponse
-> PutInstancePublicPortsResponse -> Bool)
-> (PutInstancePublicPortsResponse
-> PutInstancePublicPortsResponse -> Bool)
-> Eq PutInstancePublicPortsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutInstancePublicPortsResponse
-> PutInstancePublicPortsResponse -> Bool
$c/= :: PutInstancePublicPortsResponse
-> PutInstancePublicPortsResponse -> Bool
== :: PutInstancePublicPortsResponse
-> PutInstancePublicPortsResponse -> Bool
$c== :: PutInstancePublicPortsResponse
-> PutInstancePublicPortsResponse -> Bool
Prelude.Eq, ReadPrec [PutInstancePublicPortsResponse]
ReadPrec PutInstancePublicPortsResponse
Int -> ReadS PutInstancePublicPortsResponse
ReadS [PutInstancePublicPortsResponse]
(Int -> ReadS PutInstancePublicPortsResponse)
-> ReadS [PutInstancePublicPortsResponse]
-> ReadPrec PutInstancePublicPortsResponse
-> ReadPrec [PutInstancePublicPortsResponse]
-> Read PutInstancePublicPortsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutInstancePublicPortsResponse]
$creadListPrec :: ReadPrec [PutInstancePublicPortsResponse]
readPrec :: ReadPrec PutInstancePublicPortsResponse
$creadPrec :: ReadPrec PutInstancePublicPortsResponse
readList :: ReadS [PutInstancePublicPortsResponse]
$creadList :: ReadS [PutInstancePublicPortsResponse]
readsPrec :: Int -> ReadS PutInstancePublicPortsResponse
$creadsPrec :: Int -> ReadS PutInstancePublicPortsResponse
Prelude.Read, Int -> PutInstancePublicPortsResponse -> ShowS
[PutInstancePublicPortsResponse] -> ShowS
PutInstancePublicPortsResponse -> String
(Int -> PutInstancePublicPortsResponse -> ShowS)
-> (PutInstancePublicPortsResponse -> String)
-> ([PutInstancePublicPortsResponse] -> ShowS)
-> Show PutInstancePublicPortsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutInstancePublicPortsResponse] -> ShowS
$cshowList :: [PutInstancePublicPortsResponse] -> ShowS
show :: PutInstancePublicPortsResponse -> String
$cshow :: PutInstancePublicPortsResponse -> String
showsPrec :: Int -> PutInstancePublicPortsResponse -> ShowS
$cshowsPrec :: Int -> PutInstancePublicPortsResponse -> ShowS
Prelude.Show, (forall x.
PutInstancePublicPortsResponse
-> Rep PutInstancePublicPortsResponse x)
-> (forall x.
Rep PutInstancePublicPortsResponse x
-> PutInstancePublicPortsResponse)
-> Generic PutInstancePublicPortsResponse
forall x.
Rep PutInstancePublicPortsResponse x
-> PutInstancePublicPortsResponse
forall x.
PutInstancePublicPortsResponse
-> Rep PutInstancePublicPortsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutInstancePublicPortsResponse x
-> PutInstancePublicPortsResponse
$cfrom :: forall x.
PutInstancePublicPortsResponse
-> Rep PutInstancePublicPortsResponse x
Prelude.Generic)
newPutInstancePublicPortsResponse ::
Prelude.Int ->
PutInstancePublicPortsResponse
newPutInstancePublicPortsResponse :: Int -> PutInstancePublicPortsResponse
newPutInstancePublicPortsResponse Int
pHttpStatus_ =
PutInstancePublicPortsResponse' :: Maybe Operation -> Int -> PutInstancePublicPortsResponse
PutInstancePublicPortsResponse'
{ $sel:operation:PutInstancePublicPortsResponse' :: Maybe Operation
operation =
Maybe Operation
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PutInstancePublicPortsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
putInstancePublicPortsResponse_operation :: Lens.Lens' PutInstancePublicPortsResponse (Prelude.Maybe Operation)
putInstancePublicPortsResponse_operation :: (Maybe Operation -> f (Maybe Operation))
-> PutInstancePublicPortsResponse
-> f PutInstancePublicPortsResponse
putInstancePublicPortsResponse_operation = (PutInstancePublicPortsResponse -> Maybe Operation)
-> (PutInstancePublicPortsResponse
-> Maybe Operation -> PutInstancePublicPortsResponse)
-> Lens
PutInstancePublicPortsResponse
PutInstancePublicPortsResponse
(Maybe Operation)
(Maybe Operation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInstancePublicPortsResponse' {Maybe Operation
operation :: Maybe Operation
$sel:operation:PutInstancePublicPortsResponse' :: PutInstancePublicPortsResponse -> Maybe Operation
operation} -> Maybe Operation
operation) (\s :: PutInstancePublicPortsResponse
s@PutInstancePublicPortsResponse' {} Maybe Operation
a -> PutInstancePublicPortsResponse
s {$sel:operation:PutInstancePublicPortsResponse' :: Maybe Operation
operation = Maybe Operation
a} :: PutInstancePublicPortsResponse)
putInstancePublicPortsResponse_httpStatus :: Lens.Lens' PutInstancePublicPortsResponse Prelude.Int
putInstancePublicPortsResponse_httpStatus :: (Int -> f Int)
-> PutInstancePublicPortsResponse
-> f PutInstancePublicPortsResponse
putInstancePublicPortsResponse_httpStatus = (PutInstancePublicPortsResponse -> Int)
-> (PutInstancePublicPortsResponse
-> Int -> PutInstancePublicPortsResponse)
-> Lens
PutInstancePublicPortsResponse
PutInstancePublicPortsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInstancePublicPortsResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutInstancePublicPortsResponse' :: PutInstancePublicPortsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutInstancePublicPortsResponse
s@PutInstancePublicPortsResponse' {} Int
a -> PutInstancePublicPortsResponse
s {$sel:httpStatus:PutInstancePublicPortsResponse' :: Int
httpStatus = Int
a} :: PutInstancePublicPortsResponse)
instance
Prelude.NFData
PutInstancePublicPortsResponse