{-# 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.EnableAddOn
(
EnableAddOn (..),
newEnableAddOn,
enableAddOn_resourceName,
enableAddOn_addOnRequest,
EnableAddOnResponse (..),
newEnableAddOnResponse,
enableAddOnResponse_operations,
enableAddOnResponse_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 EnableAddOn = EnableAddOn'
{
EnableAddOn -> Text
resourceName :: Prelude.Text,
EnableAddOn -> AddOnRequest
addOnRequest :: AddOnRequest
}
deriving (EnableAddOn -> EnableAddOn -> Bool
(EnableAddOn -> EnableAddOn -> Bool)
-> (EnableAddOn -> EnableAddOn -> Bool) -> Eq EnableAddOn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableAddOn -> EnableAddOn -> Bool
$c/= :: EnableAddOn -> EnableAddOn -> Bool
== :: EnableAddOn -> EnableAddOn -> Bool
$c== :: EnableAddOn -> EnableAddOn -> Bool
Prelude.Eq, ReadPrec [EnableAddOn]
ReadPrec EnableAddOn
Int -> ReadS EnableAddOn
ReadS [EnableAddOn]
(Int -> ReadS EnableAddOn)
-> ReadS [EnableAddOn]
-> ReadPrec EnableAddOn
-> ReadPrec [EnableAddOn]
-> Read EnableAddOn
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableAddOn]
$creadListPrec :: ReadPrec [EnableAddOn]
readPrec :: ReadPrec EnableAddOn
$creadPrec :: ReadPrec EnableAddOn
readList :: ReadS [EnableAddOn]
$creadList :: ReadS [EnableAddOn]
readsPrec :: Int -> ReadS EnableAddOn
$creadsPrec :: Int -> ReadS EnableAddOn
Prelude.Read, Int -> EnableAddOn -> ShowS
[EnableAddOn] -> ShowS
EnableAddOn -> String
(Int -> EnableAddOn -> ShowS)
-> (EnableAddOn -> String)
-> ([EnableAddOn] -> ShowS)
-> Show EnableAddOn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableAddOn] -> ShowS
$cshowList :: [EnableAddOn] -> ShowS
show :: EnableAddOn -> String
$cshow :: EnableAddOn -> String
showsPrec :: Int -> EnableAddOn -> ShowS
$cshowsPrec :: Int -> EnableAddOn -> ShowS
Prelude.Show, (forall x. EnableAddOn -> Rep EnableAddOn x)
-> (forall x. Rep EnableAddOn x -> EnableAddOn)
-> Generic EnableAddOn
forall x. Rep EnableAddOn x -> EnableAddOn
forall x. EnableAddOn -> Rep EnableAddOn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnableAddOn x -> EnableAddOn
$cfrom :: forall x. EnableAddOn -> Rep EnableAddOn x
Prelude.Generic)
newEnableAddOn ::
Prelude.Text ->
AddOnRequest ->
EnableAddOn
newEnableAddOn :: Text -> AddOnRequest -> EnableAddOn
newEnableAddOn Text
pResourceName_ AddOnRequest
pAddOnRequest_ =
EnableAddOn' :: Text -> AddOnRequest -> EnableAddOn
EnableAddOn'
{ $sel:resourceName:EnableAddOn' :: Text
resourceName = Text
pResourceName_,
$sel:addOnRequest:EnableAddOn' :: AddOnRequest
addOnRequest = AddOnRequest
pAddOnRequest_
}
enableAddOn_resourceName :: Lens.Lens' EnableAddOn Prelude.Text
enableAddOn_resourceName :: (Text -> f Text) -> EnableAddOn -> f EnableAddOn
enableAddOn_resourceName = (EnableAddOn -> Text)
-> (EnableAddOn -> Text -> EnableAddOn)
-> Lens EnableAddOn EnableAddOn Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableAddOn' {Text
resourceName :: Text
$sel:resourceName:EnableAddOn' :: EnableAddOn -> Text
resourceName} -> Text
resourceName) (\s :: EnableAddOn
s@EnableAddOn' {} Text
a -> EnableAddOn
s {$sel:resourceName:EnableAddOn' :: Text
resourceName = Text
a} :: EnableAddOn)
enableAddOn_addOnRequest :: Lens.Lens' EnableAddOn AddOnRequest
enableAddOn_addOnRequest :: (AddOnRequest -> f AddOnRequest) -> EnableAddOn -> f EnableAddOn
enableAddOn_addOnRequest = (EnableAddOn -> AddOnRequest)
-> (EnableAddOn -> AddOnRequest -> EnableAddOn)
-> Lens EnableAddOn EnableAddOn AddOnRequest AddOnRequest
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableAddOn' {AddOnRequest
addOnRequest :: AddOnRequest
$sel:addOnRequest:EnableAddOn' :: EnableAddOn -> AddOnRequest
addOnRequest} -> AddOnRequest
addOnRequest) (\s :: EnableAddOn
s@EnableAddOn' {} AddOnRequest
a -> EnableAddOn
s {$sel:addOnRequest:EnableAddOn' :: AddOnRequest
addOnRequest = AddOnRequest
a} :: EnableAddOn)
instance Core.AWSRequest EnableAddOn where
type AWSResponse EnableAddOn = EnableAddOnResponse
request :: EnableAddOn -> Request EnableAddOn
request = Service -> EnableAddOn -> Request EnableAddOn
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy EnableAddOn
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse EnableAddOn)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse EnableAddOn))
-> Logger
-> Service
-> Proxy EnableAddOn
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse EnableAddOn)))
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 -> EnableAddOnResponse
EnableAddOnResponse'
(Maybe [Operation] -> Int -> EnableAddOnResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> EnableAddOnResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Operation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operations" Either String (Maybe (Maybe [Operation]))
-> Maybe [Operation] -> Either String (Maybe [Operation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Operation]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> EnableAddOnResponse)
-> Either String Int -> Either String EnableAddOnResponse
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 EnableAddOn
instance Prelude.NFData EnableAddOn
instance Core.ToHeaders EnableAddOn where
toHeaders :: EnableAddOn -> ResponseHeaders
toHeaders =
ResponseHeaders -> EnableAddOn -> 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.EnableAddOn" ::
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 EnableAddOn where
toJSON :: EnableAddOn -> Value
toJSON EnableAddOn' {Text
AddOnRequest
addOnRequest :: AddOnRequest
resourceName :: Text
$sel:addOnRequest:EnableAddOn' :: EnableAddOn -> AddOnRequest
$sel:resourceName:EnableAddOn' :: EnableAddOn -> Text
..} =
[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
"resourceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"addOnRequest" Text -> AddOnRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AddOnRequest
addOnRequest)
]
)
instance Core.ToPath EnableAddOn where
toPath :: EnableAddOn -> ByteString
toPath = ByteString -> EnableAddOn -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery EnableAddOn where
toQuery :: EnableAddOn -> QueryString
toQuery = QueryString -> EnableAddOn -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data EnableAddOnResponse = EnableAddOnResponse'
{
EnableAddOnResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
EnableAddOnResponse -> Int
httpStatus :: Prelude.Int
}
deriving (EnableAddOnResponse -> EnableAddOnResponse -> Bool
(EnableAddOnResponse -> EnableAddOnResponse -> Bool)
-> (EnableAddOnResponse -> EnableAddOnResponse -> Bool)
-> Eq EnableAddOnResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableAddOnResponse -> EnableAddOnResponse -> Bool
$c/= :: EnableAddOnResponse -> EnableAddOnResponse -> Bool
== :: EnableAddOnResponse -> EnableAddOnResponse -> Bool
$c== :: EnableAddOnResponse -> EnableAddOnResponse -> Bool
Prelude.Eq, ReadPrec [EnableAddOnResponse]
ReadPrec EnableAddOnResponse
Int -> ReadS EnableAddOnResponse
ReadS [EnableAddOnResponse]
(Int -> ReadS EnableAddOnResponse)
-> ReadS [EnableAddOnResponse]
-> ReadPrec EnableAddOnResponse
-> ReadPrec [EnableAddOnResponse]
-> Read EnableAddOnResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableAddOnResponse]
$creadListPrec :: ReadPrec [EnableAddOnResponse]
readPrec :: ReadPrec EnableAddOnResponse
$creadPrec :: ReadPrec EnableAddOnResponse
readList :: ReadS [EnableAddOnResponse]
$creadList :: ReadS [EnableAddOnResponse]
readsPrec :: Int -> ReadS EnableAddOnResponse
$creadsPrec :: Int -> ReadS EnableAddOnResponse
Prelude.Read, Int -> EnableAddOnResponse -> ShowS
[EnableAddOnResponse] -> ShowS
EnableAddOnResponse -> String
(Int -> EnableAddOnResponse -> ShowS)
-> (EnableAddOnResponse -> String)
-> ([EnableAddOnResponse] -> ShowS)
-> Show EnableAddOnResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableAddOnResponse] -> ShowS
$cshowList :: [EnableAddOnResponse] -> ShowS
show :: EnableAddOnResponse -> String
$cshow :: EnableAddOnResponse -> String
showsPrec :: Int -> EnableAddOnResponse -> ShowS
$cshowsPrec :: Int -> EnableAddOnResponse -> ShowS
Prelude.Show, (forall x. EnableAddOnResponse -> Rep EnableAddOnResponse x)
-> (forall x. Rep EnableAddOnResponse x -> EnableAddOnResponse)
-> Generic EnableAddOnResponse
forall x. Rep EnableAddOnResponse x -> EnableAddOnResponse
forall x. EnableAddOnResponse -> Rep EnableAddOnResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnableAddOnResponse x -> EnableAddOnResponse
$cfrom :: forall x. EnableAddOnResponse -> Rep EnableAddOnResponse x
Prelude.Generic)
newEnableAddOnResponse ::
Prelude.Int ->
EnableAddOnResponse
newEnableAddOnResponse :: Int -> EnableAddOnResponse
newEnableAddOnResponse Int
pHttpStatus_ =
EnableAddOnResponse' :: Maybe [Operation] -> Int -> EnableAddOnResponse
EnableAddOnResponse'
{ $sel:operations:EnableAddOnResponse' :: Maybe [Operation]
operations = Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:EnableAddOnResponse' :: Int
httpStatus = Int
pHttpStatus_
}
enableAddOnResponse_operations :: Lens.Lens' EnableAddOnResponse (Prelude.Maybe [Operation])
enableAddOnResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> EnableAddOnResponse -> f EnableAddOnResponse
enableAddOnResponse_operations = (EnableAddOnResponse -> Maybe [Operation])
-> (EnableAddOnResponse
-> Maybe [Operation] -> EnableAddOnResponse)
-> Lens
EnableAddOnResponse
EnableAddOnResponse
(Maybe [Operation])
(Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableAddOnResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:EnableAddOnResponse' :: EnableAddOnResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: EnableAddOnResponse
s@EnableAddOnResponse' {} Maybe [Operation]
a -> EnableAddOnResponse
s {$sel:operations:EnableAddOnResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: EnableAddOnResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
-> EnableAddOnResponse -> f EnableAddOnResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
-> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> EnableAddOnResponse
-> f EnableAddOnResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Operation] [Operation] [Operation] [Operation]
-> Iso
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
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 AnIso [Operation] [Operation] [Operation] [Operation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
enableAddOnResponse_httpStatus :: Lens.Lens' EnableAddOnResponse Prelude.Int
enableAddOnResponse_httpStatus :: (Int -> f Int) -> EnableAddOnResponse -> f EnableAddOnResponse
enableAddOnResponse_httpStatus = (EnableAddOnResponse -> Int)
-> (EnableAddOnResponse -> Int -> EnableAddOnResponse)
-> Lens EnableAddOnResponse EnableAddOnResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableAddOnResponse' {Int
httpStatus :: Int
$sel:httpStatus:EnableAddOnResponse' :: EnableAddOnResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: EnableAddOnResponse
s@EnableAddOnResponse' {} Int
a -> EnableAddOnResponse
s {$sel:httpStatus:EnableAddOnResponse' :: Int
httpStatus = Int
a} :: EnableAddOnResponse)
instance Prelude.NFData EnableAddOnResponse