{-# 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.DeleteDistribution
(
DeleteDistribution (..),
newDeleteDistribution,
deleteDistribution_distributionName,
DeleteDistributionResponse (..),
newDeleteDistributionResponse,
deleteDistributionResponse_operation,
deleteDistributionResponse_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 DeleteDistribution = DeleteDistribution'
{
DeleteDistribution -> Maybe Text
distributionName :: Prelude.Maybe Prelude.Text
}
deriving (DeleteDistribution -> DeleteDistribution -> Bool
(DeleteDistribution -> DeleteDistribution -> Bool)
-> (DeleteDistribution -> DeleteDistribution -> Bool)
-> Eq DeleteDistribution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDistribution -> DeleteDistribution -> Bool
$c/= :: DeleteDistribution -> DeleteDistribution -> Bool
== :: DeleteDistribution -> DeleteDistribution -> Bool
$c== :: DeleteDistribution -> DeleteDistribution -> Bool
Prelude.Eq, ReadPrec [DeleteDistribution]
ReadPrec DeleteDistribution
Int -> ReadS DeleteDistribution
ReadS [DeleteDistribution]
(Int -> ReadS DeleteDistribution)
-> ReadS [DeleteDistribution]
-> ReadPrec DeleteDistribution
-> ReadPrec [DeleteDistribution]
-> Read DeleteDistribution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDistribution]
$creadListPrec :: ReadPrec [DeleteDistribution]
readPrec :: ReadPrec DeleteDistribution
$creadPrec :: ReadPrec DeleteDistribution
readList :: ReadS [DeleteDistribution]
$creadList :: ReadS [DeleteDistribution]
readsPrec :: Int -> ReadS DeleteDistribution
$creadsPrec :: Int -> ReadS DeleteDistribution
Prelude.Read, Int -> DeleteDistribution -> ShowS
[DeleteDistribution] -> ShowS
DeleteDistribution -> String
(Int -> DeleteDistribution -> ShowS)
-> (DeleteDistribution -> String)
-> ([DeleteDistribution] -> ShowS)
-> Show DeleteDistribution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDistribution] -> ShowS
$cshowList :: [DeleteDistribution] -> ShowS
show :: DeleteDistribution -> String
$cshow :: DeleteDistribution -> String
showsPrec :: Int -> DeleteDistribution -> ShowS
$cshowsPrec :: Int -> DeleteDistribution -> ShowS
Prelude.Show, (forall x. DeleteDistribution -> Rep DeleteDistribution x)
-> (forall x. Rep DeleteDistribution x -> DeleteDistribution)
-> Generic DeleteDistribution
forall x. Rep DeleteDistribution x -> DeleteDistribution
forall x. DeleteDistribution -> Rep DeleteDistribution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDistribution x -> DeleteDistribution
$cfrom :: forall x. DeleteDistribution -> Rep DeleteDistribution x
Prelude.Generic)
newDeleteDistribution ::
DeleteDistribution
newDeleteDistribution :: DeleteDistribution
newDeleteDistribution =
DeleteDistribution' :: Maybe Text -> DeleteDistribution
DeleteDistribution'
{ $sel:distributionName:DeleteDistribution' :: Maybe Text
distributionName =
Maybe Text
forall a. Maybe a
Prelude.Nothing
}
deleteDistribution_distributionName :: Lens.Lens' DeleteDistribution (Prelude.Maybe Prelude.Text)
deleteDistribution_distributionName :: (Maybe Text -> f (Maybe Text))
-> DeleteDistribution -> f DeleteDistribution
deleteDistribution_distributionName = (DeleteDistribution -> Maybe Text)
-> (DeleteDistribution -> Maybe Text -> DeleteDistribution)
-> Lens
DeleteDistribution DeleteDistribution (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDistribution' {Maybe Text
distributionName :: Maybe Text
$sel:distributionName:DeleteDistribution' :: DeleteDistribution -> Maybe Text
distributionName} -> Maybe Text
distributionName) (\s :: DeleteDistribution
s@DeleteDistribution' {} Maybe Text
a -> DeleteDistribution
s {$sel:distributionName:DeleteDistribution' :: Maybe Text
distributionName = Maybe Text
a} :: DeleteDistribution)
instance Core.AWSRequest DeleteDistribution where
type
AWSResponse DeleteDistribution =
DeleteDistributionResponse
request :: DeleteDistribution -> Request DeleteDistribution
request = Service -> DeleteDistribution -> Request DeleteDistribution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteDistribution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteDistribution)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteDistribution))
-> Logger
-> Service
-> Proxy DeleteDistribution
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteDistribution)))
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 -> DeleteDistributionResponse
DeleteDistributionResponse'
(Maybe Operation -> Int -> DeleteDistributionResponse)
-> Either String (Maybe Operation)
-> Either String (Int -> DeleteDistributionResponse)
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 -> DeleteDistributionResponse)
-> Either String Int -> Either String DeleteDistributionResponse
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 DeleteDistribution
instance Prelude.NFData DeleteDistribution
instance Core.ToHeaders DeleteDistribution where
toHeaders :: DeleteDistribution -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteDistribution -> 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.DeleteDistribution" ::
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 DeleteDistribution where
toJSON :: DeleteDistribution -> Value
toJSON DeleteDistribution' {Maybe Text
distributionName :: Maybe Text
$sel:distributionName:DeleteDistribution' :: DeleteDistribution -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"distributionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
distributionName
]
)
instance Core.ToPath DeleteDistribution where
toPath :: DeleteDistribution -> ByteString
toPath = ByteString -> DeleteDistribution -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteDistribution where
toQuery :: DeleteDistribution -> QueryString
toQuery = QueryString -> DeleteDistribution -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteDistributionResponse = DeleteDistributionResponse'
{
DeleteDistributionResponse -> Maybe Operation
operation :: Prelude.Maybe Operation,
DeleteDistributionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteDistributionResponse -> DeleteDistributionResponse -> Bool
(DeleteDistributionResponse -> DeleteDistributionResponse -> Bool)
-> (DeleteDistributionResponse
-> DeleteDistributionResponse -> Bool)
-> Eq DeleteDistributionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDistributionResponse -> DeleteDistributionResponse -> Bool
$c/= :: DeleteDistributionResponse -> DeleteDistributionResponse -> Bool
== :: DeleteDistributionResponse -> DeleteDistributionResponse -> Bool
$c== :: DeleteDistributionResponse -> DeleteDistributionResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDistributionResponse]
ReadPrec DeleteDistributionResponse
Int -> ReadS DeleteDistributionResponse
ReadS [DeleteDistributionResponse]
(Int -> ReadS DeleteDistributionResponse)
-> ReadS [DeleteDistributionResponse]
-> ReadPrec DeleteDistributionResponse
-> ReadPrec [DeleteDistributionResponse]
-> Read DeleteDistributionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDistributionResponse]
$creadListPrec :: ReadPrec [DeleteDistributionResponse]
readPrec :: ReadPrec DeleteDistributionResponse
$creadPrec :: ReadPrec DeleteDistributionResponse
readList :: ReadS [DeleteDistributionResponse]
$creadList :: ReadS [DeleteDistributionResponse]
readsPrec :: Int -> ReadS DeleteDistributionResponse
$creadsPrec :: Int -> ReadS DeleteDistributionResponse
Prelude.Read, Int -> DeleteDistributionResponse -> ShowS
[DeleteDistributionResponse] -> ShowS
DeleteDistributionResponse -> String
(Int -> DeleteDistributionResponse -> ShowS)
-> (DeleteDistributionResponse -> String)
-> ([DeleteDistributionResponse] -> ShowS)
-> Show DeleteDistributionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDistributionResponse] -> ShowS
$cshowList :: [DeleteDistributionResponse] -> ShowS
show :: DeleteDistributionResponse -> String
$cshow :: DeleteDistributionResponse -> String
showsPrec :: Int -> DeleteDistributionResponse -> ShowS
$cshowsPrec :: Int -> DeleteDistributionResponse -> ShowS
Prelude.Show, (forall x.
DeleteDistributionResponse -> Rep DeleteDistributionResponse x)
-> (forall x.
Rep DeleteDistributionResponse x -> DeleteDistributionResponse)
-> Generic DeleteDistributionResponse
forall x.
Rep DeleteDistributionResponse x -> DeleteDistributionResponse
forall x.
DeleteDistributionResponse -> Rep DeleteDistributionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteDistributionResponse x -> DeleteDistributionResponse
$cfrom :: forall x.
DeleteDistributionResponse -> Rep DeleteDistributionResponse x
Prelude.Generic)
newDeleteDistributionResponse ::
Prelude.Int ->
DeleteDistributionResponse
newDeleteDistributionResponse :: Int -> DeleteDistributionResponse
newDeleteDistributionResponse Int
pHttpStatus_ =
DeleteDistributionResponse' :: Maybe Operation -> Int -> DeleteDistributionResponse
DeleteDistributionResponse'
{ $sel:operation:DeleteDistributionResponse' :: Maybe Operation
operation =
Maybe Operation
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteDistributionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteDistributionResponse_operation :: Lens.Lens' DeleteDistributionResponse (Prelude.Maybe Operation)
deleteDistributionResponse_operation :: (Maybe Operation -> f (Maybe Operation))
-> DeleteDistributionResponse -> f DeleteDistributionResponse
deleteDistributionResponse_operation = (DeleteDistributionResponse -> Maybe Operation)
-> (DeleteDistributionResponse
-> Maybe Operation -> DeleteDistributionResponse)
-> Lens
DeleteDistributionResponse
DeleteDistributionResponse
(Maybe Operation)
(Maybe Operation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDistributionResponse' {Maybe Operation
operation :: Maybe Operation
$sel:operation:DeleteDistributionResponse' :: DeleteDistributionResponse -> Maybe Operation
operation} -> Maybe Operation
operation) (\s :: DeleteDistributionResponse
s@DeleteDistributionResponse' {} Maybe Operation
a -> DeleteDistributionResponse
s {$sel:operation:DeleteDistributionResponse' :: Maybe Operation
operation = Maybe Operation
a} :: DeleteDistributionResponse)
deleteDistributionResponse_httpStatus :: Lens.Lens' DeleteDistributionResponse Prelude.Int
deleteDistributionResponse_httpStatus :: (Int -> f Int)
-> DeleteDistributionResponse -> f DeleteDistributionResponse
deleteDistributionResponse_httpStatus = (DeleteDistributionResponse -> Int)
-> (DeleteDistributionResponse
-> Int -> DeleteDistributionResponse)
-> Lens
DeleteDistributionResponse DeleteDistributionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDistributionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteDistributionResponse' :: DeleteDistributionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteDistributionResponse
s@DeleteDistributionResponse' {} Int
a -> DeleteDistributionResponse
s {$sel:httpStatus:DeleteDistributionResponse' :: Int
httpStatus = Int
a} :: DeleteDistributionResponse)
instance Prelude.NFData DeleteDistributionResponse