{-# 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.DisableAddOn
(
DisableAddOn (..),
newDisableAddOn,
disableAddOn_addOnType,
disableAddOn_resourceName,
DisableAddOnResponse (..),
newDisableAddOnResponse,
disableAddOnResponse_operations,
disableAddOnResponse_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 DisableAddOn = DisableAddOn'
{
DisableAddOn -> AddOnType
addOnType :: AddOnType,
DisableAddOn -> Text
resourceName :: Prelude.Text
}
deriving (DisableAddOn -> DisableAddOn -> Bool
(DisableAddOn -> DisableAddOn -> Bool)
-> (DisableAddOn -> DisableAddOn -> Bool) -> Eq DisableAddOn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableAddOn -> DisableAddOn -> Bool
$c/= :: DisableAddOn -> DisableAddOn -> Bool
== :: DisableAddOn -> DisableAddOn -> Bool
$c== :: DisableAddOn -> DisableAddOn -> Bool
Prelude.Eq, ReadPrec [DisableAddOn]
ReadPrec DisableAddOn
Int -> ReadS DisableAddOn
ReadS [DisableAddOn]
(Int -> ReadS DisableAddOn)
-> ReadS [DisableAddOn]
-> ReadPrec DisableAddOn
-> ReadPrec [DisableAddOn]
-> Read DisableAddOn
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableAddOn]
$creadListPrec :: ReadPrec [DisableAddOn]
readPrec :: ReadPrec DisableAddOn
$creadPrec :: ReadPrec DisableAddOn
readList :: ReadS [DisableAddOn]
$creadList :: ReadS [DisableAddOn]
readsPrec :: Int -> ReadS DisableAddOn
$creadsPrec :: Int -> ReadS DisableAddOn
Prelude.Read, Int -> DisableAddOn -> ShowS
[DisableAddOn] -> ShowS
DisableAddOn -> String
(Int -> DisableAddOn -> ShowS)
-> (DisableAddOn -> String)
-> ([DisableAddOn] -> ShowS)
-> Show DisableAddOn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableAddOn] -> ShowS
$cshowList :: [DisableAddOn] -> ShowS
show :: DisableAddOn -> String
$cshow :: DisableAddOn -> String
showsPrec :: Int -> DisableAddOn -> ShowS
$cshowsPrec :: Int -> DisableAddOn -> ShowS
Prelude.Show, (forall x. DisableAddOn -> Rep DisableAddOn x)
-> (forall x. Rep DisableAddOn x -> DisableAddOn)
-> Generic DisableAddOn
forall x. Rep DisableAddOn x -> DisableAddOn
forall x. DisableAddOn -> Rep DisableAddOn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisableAddOn x -> DisableAddOn
$cfrom :: forall x. DisableAddOn -> Rep DisableAddOn x
Prelude.Generic)
newDisableAddOn ::
AddOnType ->
Prelude.Text ->
DisableAddOn
newDisableAddOn :: AddOnType -> Text -> DisableAddOn
newDisableAddOn AddOnType
pAddOnType_ Text
pResourceName_ =
DisableAddOn' :: AddOnType -> Text -> DisableAddOn
DisableAddOn'
{ $sel:addOnType:DisableAddOn' :: AddOnType
addOnType = AddOnType
pAddOnType_,
$sel:resourceName:DisableAddOn' :: Text
resourceName = Text
pResourceName_
}
disableAddOn_addOnType :: Lens.Lens' DisableAddOn AddOnType
disableAddOn_addOnType :: (AddOnType -> f AddOnType) -> DisableAddOn -> f DisableAddOn
disableAddOn_addOnType = (DisableAddOn -> AddOnType)
-> (DisableAddOn -> AddOnType -> DisableAddOn)
-> Lens DisableAddOn DisableAddOn AddOnType AddOnType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableAddOn' {AddOnType
addOnType :: AddOnType
$sel:addOnType:DisableAddOn' :: DisableAddOn -> AddOnType
addOnType} -> AddOnType
addOnType) (\s :: DisableAddOn
s@DisableAddOn' {} AddOnType
a -> DisableAddOn
s {$sel:addOnType:DisableAddOn' :: AddOnType
addOnType = AddOnType
a} :: DisableAddOn)
disableAddOn_resourceName :: Lens.Lens' DisableAddOn Prelude.Text
disableAddOn_resourceName :: (Text -> f Text) -> DisableAddOn -> f DisableAddOn
disableAddOn_resourceName = (DisableAddOn -> Text)
-> (DisableAddOn -> Text -> DisableAddOn)
-> Lens DisableAddOn DisableAddOn Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableAddOn' {Text
resourceName :: Text
$sel:resourceName:DisableAddOn' :: DisableAddOn -> Text
resourceName} -> Text
resourceName) (\s :: DisableAddOn
s@DisableAddOn' {} Text
a -> DisableAddOn
s {$sel:resourceName:DisableAddOn' :: Text
resourceName = Text
a} :: DisableAddOn)
instance Core.AWSRequest DisableAddOn where
type AWSResponse DisableAddOn = DisableAddOnResponse
request :: DisableAddOn -> Request DisableAddOn
request = Service -> DisableAddOn -> Request DisableAddOn
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DisableAddOn
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DisableAddOn)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DisableAddOn))
-> Logger
-> Service
-> Proxy DisableAddOn
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DisableAddOn)))
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 -> DisableAddOnResponse
DisableAddOnResponse'
(Maybe [Operation] -> Int -> DisableAddOnResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> DisableAddOnResponse)
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 -> DisableAddOnResponse)
-> Either String Int -> Either String DisableAddOnResponse
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 DisableAddOn
instance Prelude.NFData DisableAddOn
instance Core.ToHeaders DisableAddOn where
toHeaders :: DisableAddOn -> ResponseHeaders
toHeaders =
ResponseHeaders -> DisableAddOn -> 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.DisableAddOn" ::
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 DisableAddOn where
toJSON :: DisableAddOn -> Value
toJSON DisableAddOn' {Text
AddOnType
resourceName :: Text
addOnType :: AddOnType
$sel:resourceName:DisableAddOn' :: DisableAddOn -> Text
$sel:addOnType:DisableAddOn' :: DisableAddOn -> AddOnType
..} =
[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
"addOnType" Text -> AddOnType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AddOnType
addOnType),
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)
]
)
instance Core.ToPath DisableAddOn where
toPath :: DisableAddOn -> ByteString
toPath = ByteString -> DisableAddOn -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DisableAddOn where
toQuery :: DisableAddOn -> QueryString
toQuery = QueryString -> DisableAddOn -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DisableAddOnResponse = DisableAddOnResponse'
{
DisableAddOnResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
DisableAddOnResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DisableAddOnResponse -> DisableAddOnResponse -> Bool
(DisableAddOnResponse -> DisableAddOnResponse -> Bool)
-> (DisableAddOnResponse -> DisableAddOnResponse -> Bool)
-> Eq DisableAddOnResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableAddOnResponse -> DisableAddOnResponse -> Bool
$c/= :: DisableAddOnResponse -> DisableAddOnResponse -> Bool
== :: DisableAddOnResponse -> DisableAddOnResponse -> Bool
$c== :: DisableAddOnResponse -> DisableAddOnResponse -> Bool
Prelude.Eq, ReadPrec [DisableAddOnResponse]
ReadPrec DisableAddOnResponse
Int -> ReadS DisableAddOnResponse
ReadS [DisableAddOnResponse]
(Int -> ReadS DisableAddOnResponse)
-> ReadS [DisableAddOnResponse]
-> ReadPrec DisableAddOnResponse
-> ReadPrec [DisableAddOnResponse]
-> Read DisableAddOnResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableAddOnResponse]
$creadListPrec :: ReadPrec [DisableAddOnResponse]
readPrec :: ReadPrec DisableAddOnResponse
$creadPrec :: ReadPrec DisableAddOnResponse
readList :: ReadS [DisableAddOnResponse]
$creadList :: ReadS [DisableAddOnResponse]
readsPrec :: Int -> ReadS DisableAddOnResponse
$creadsPrec :: Int -> ReadS DisableAddOnResponse
Prelude.Read, Int -> DisableAddOnResponse -> ShowS
[DisableAddOnResponse] -> ShowS
DisableAddOnResponse -> String
(Int -> DisableAddOnResponse -> ShowS)
-> (DisableAddOnResponse -> String)
-> ([DisableAddOnResponse] -> ShowS)
-> Show DisableAddOnResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableAddOnResponse] -> ShowS
$cshowList :: [DisableAddOnResponse] -> ShowS
show :: DisableAddOnResponse -> String
$cshow :: DisableAddOnResponse -> String
showsPrec :: Int -> DisableAddOnResponse -> ShowS
$cshowsPrec :: Int -> DisableAddOnResponse -> ShowS
Prelude.Show, (forall x. DisableAddOnResponse -> Rep DisableAddOnResponse x)
-> (forall x. Rep DisableAddOnResponse x -> DisableAddOnResponse)
-> Generic DisableAddOnResponse
forall x. Rep DisableAddOnResponse x -> DisableAddOnResponse
forall x. DisableAddOnResponse -> Rep DisableAddOnResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisableAddOnResponse x -> DisableAddOnResponse
$cfrom :: forall x. DisableAddOnResponse -> Rep DisableAddOnResponse x
Prelude.Generic)
newDisableAddOnResponse ::
Prelude.Int ->
DisableAddOnResponse
newDisableAddOnResponse :: Int -> DisableAddOnResponse
newDisableAddOnResponse Int
pHttpStatus_ =
DisableAddOnResponse' :: Maybe [Operation] -> Int -> DisableAddOnResponse
DisableAddOnResponse'
{ $sel:operations:DisableAddOnResponse' :: Maybe [Operation]
operations = Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DisableAddOnResponse' :: Int
httpStatus = Int
pHttpStatus_
}
disableAddOnResponse_operations :: Lens.Lens' DisableAddOnResponse (Prelude.Maybe [Operation])
disableAddOnResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> DisableAddOnResponse -> f DisableAddOnResponse
disableAddOnResponse_operations = (DisableAddOnResponse -> Maybe [Operation])
-> (DisableAddOnResponse
-> Maybe [Operation] -> DisableAddOnResponse)
-> Lens
DisableAddOnResponse
DisableAddOnResponse
(Maybe [Operation])
(Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableAddOnResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:DisableAddOnResponse' :: DisableAddOnResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: DisableAddOnResponse
s@DisableAddOnResponse' {} Maybe [Operation]
a -> DisableAddOnResponse
s {$sel:operations:DisableAddOnResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: DisableAddOnResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
-> DisableAddOnResponse -> f DisableAddOnResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
-> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> DisableAddOnResponse
-> f DisableAddOnResponse
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
disableAddOnResponse_httpStatus :: Lens.Lens' DisableAddOnResponse Prelude.Int
disableAddOnResponse_httpStatus :: (Int -> f Int) -> DisableAddOnResponse -> f DisableAddOnResponse
disableAddOnResponse_httpStatus = (DisableAddOnResponse -> Int)
-> (DisableAddOnResponse -> Int -> DisableAddOnResponse)
-> Lens DisableAddOnResponse DisableAddOnResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableAddOnResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisableAddOnResponse' :: DisableAddOnResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DisableAddOnResponse
s@DisableAddOnResponse' {} Int
a -> DisableAddOnResponse
s {$sel:httpStatus:DisableAddOnResponse' :: Int
httpStatus = Int
a} :: DisableAddOnResponse)
instance Prelude.NFData DisableAddOnResponse