{-# 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.LicenseManager.DeleteLicense
(
DeleteLicense (..),
newDeleteLicense,
deleteLicense_licenseArn,
deleteLicense_sourceVersion,
DeleteLicenseResponse (..),
newDeleteLicenseResponse,
deleteLicenseResponse_status,
deleteLicenseResponse_deletionDate,
deleteLicenseResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LicenseManager.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeleteLicense = DeleteLicense'
{
DeleteLicense -> Text
licenseArn :: Prelude.Text,
DeleteLicense -> Text
sourceVersion :: Prelude.Text
}
deriving (DeleteLicense -> DeleteLicense -> Bool
(DeleteLicense -> DeleteLicense -> Bool)
-> (DeleteLicense -> DeleteLicense -> Bool) -> Eq DeleteLicense
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteLicense -> DeleteLicense -> Bool
$c/= :: DeleteLicense -> DeleteLicense -> Bool
== :: DeleteLicense -> DeleteLicense -> Bool
$c== :: DeleteLicense -> DeleteLicense -> Bool
Prelude.Eq, ReadPrec [DeleteLicense]
ReadPrec DeleteLicense
Int -> ReadS DeleteLicense
ReadS [DeleteLicense]
(Int -> ReadS DeleteLicense)
-> ReadS [DeleteLicense]
-> ReadPrec DeleteLicense
-> ReadPrec [DeleteLicense]
-> Read DeleteLicense
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteLicense]
$creadListPrec :: ReadPrec [DeleteLicense]
readPrec :: ReadPrec DeleteLicense
$creadPrec :: ReadPrec DeleteLicense
readList :: ReadS [DeleteLicense]
$creadList :: ReadS [DeleteLicense]
readsPrec :: Int -> ReadS DeleteLicense
$creadsPrec :: Int -> ReadS DeleteLicense
Prelude.Read, Int -> DeleteLicense -> ShowS
[DeleteLicense] -> ShowS
DeleteLicense -> String
(Int -> DeleteLicense -> ShowS)
-> (DeleteLicense -> String)
-> ([DeleteLicense] -> ShowS)
-> Show DeleteLicense
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteLicense] -> ShowS
$cshowList :: [DeleteLicense] -> ShowS
show :: DeleteLicense -> String
$cshow :: DeleteLicense -> String
showsPrec :: Int -> DeleteLicense -> ShowS
$cshowsPrec :: Int -> DeleteLicense -> ShowS
Prelude.Show, (forall x. DeleteLicense -> Rep DeleteLicense x)
-> (forall x. Rep DeleteLicense x -> DeleteLicense)
-> Generic DeleteLicense
forall x. Rep DeleteLicense x -> DeleteLicense
forall x. DeleteLicense -> Rep DeleteLicense x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteLicense x -> DeleteLicense
$cfrom :: forall x. DeleteLicense -> Rep DeleteLicense x
Prelude.Generic)
newDeleteLicense ::
Prelude.Text ->
Prelude.Text ->
DeleteLicense
newDeleteLicense :: Text -> Text -> DeleteLicense
newDeleteLicense Text
pLicenseArn_ Text
pSourceVersion_ =
DeleteLicense' :: Text -> Text -> DeleteLicense
DeleteLicense'
{ $sel:licenseArn:DeleteLicense' :: Text
licenseArn = Text
pLicenseArn_,
$sel:sourceVersion:DeleteLicense' :: Text
sourceVersion = Text
pSourceVersion_
}
deleteLicense_licenseArn :: Lens.Lens' DeleteLicense Prelude.Text
deleteLicense_licenseArn :: (Text -> f Text) -> DeleteLicense -> f DeleteLicense
deleteLicense_licenseArn = (DeleteLicense -> Text)
-> (DeleteLicense -> Text -> DeleteLicense)
-> Lens DeleteLicense DeleteLicense Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLicense' {Text
licenseArn :: Text
$sel:licenseArn:DeleteLicense' :: DeleteLicense -> Text
licenseArn} -> Text
licenseArn) (\s :: DeleteLicense
s@DeleteLicense' {} Text
a -> DeleteLicense
s {$sel:licenseArn:DeleteLicense' :: Text
licenseArn = Text
a} :: DeleteLicense)
deleteLicense_sourceVersion :: Lens.Lens' DeleteLicense Prelude.Text
deleteLicense_sourceVersion :: (Text -> f Text) -> DeleteLicense -> f DeleteLicense
deleteLicense_sourceVersion = (DeleteLicense -> Text)
-> (DeleteLicense -> Text -> DeleteLicense)
-> Lens DeleteLicense DeleteLicense Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLicense' {Text
sourceVersion :: Text
$sel:sourceVersion:DeleteLicense' :: DeleteLicense -> Text
sourceVersion} -> Text
sourceVersion) (\s :: DeleteLicense
s@DeleteLicense' {} Text
a -> DeleteLicense
s {$sel:sourceVersion:DeleteLicense' :: Text
sourceVersion = Text
a} :: DeleteLicense)
instance Core.AWSRequest DeleteLicense where
type
AWSResponse DeleteLicense =
DeleteLicenseResponse
request :: DeleteLicense -> Request DeleteLicense
request = Service -> DeleteLicense -> Request DeleteLicense
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteLicense
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteLicense)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteLicense))
-> Logger
-> Service
-> Proxy DeleteLicense
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteLicense)))
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 LicenseDeletionStatus
-> Maybe Text -> Int -> DeleteLicenseResponse
DeleteLicenseResponse'
(Maybe LicenseDeletionStatus
-> Maybe Text -> Int -> DeleteLicenseResponse)
-> Either String (Maybe LicenseDeletionStatus)
-> Either String (Maybe Text -> Int -> DeleteLicenseResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe LicenseDeletionStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
Either String (Maybe Text -> Int -> DeleteLicenseResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteLicenseResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DeletionDate")
Either String (Int -> DeleteLicenseResponse)
-> Either String Int -> Either String DeleteLicenseResponse
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 DeleteLicense
instance Prelude.NFData DeleteLicense
instance Core.ToHeaders DeleteLicense where
toHeaders :: DeleteLicense -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteLicense -> 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
"AWSLicenseManager.DeleteLicense" ::
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 DeleteLicense where
toJSON :: DeleteLicense -> Value
toJSON DeleteLicense' {Text
sourceVersion :: Text
licenseArn :: Text
$sel:sourceVersion:DeleteLicense' :: DeleteLicense -> Text
$sel:licenseArn:DeleteLicense' :: DeleteLicense -> 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
"LicenseArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
licenseArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"SourceVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceVersion)
]
)
instance Core.ToPath DeleteLicense where
toPath :: DeleteLicense -> ByteString
toPath = ByteString -> DeleteLicense -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteLicense where
toQuery :: DeleteLicense -> QueryString
toQuery = QueryString -> DeleteLicense -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteLicenseResponse = DeleteLicenseResponse'
{
DeleteLicenseResponse -> Maybe LicenseDeletionStatus
status :: Prelude.Maybe LicenseDeletionStatus,
DeleteLicenseResponse -> Maybe Text
deletionDate :: Prelude.Maybe Prelude.Text,
DeleteLicenseResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteLicenseResponse -> DeleteLicenseResponse -> Bool
(DeleteLicenseResponse -> DeleteLicenseResponse -> Bool)
-> (DeleteLicenseResponse -> DeleteLicenseResponse -> Bool)
-> Eq DeleteLicenseResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteLicenseResponse -> DeleteLicenseResponse -> Bool
$c/= :: DeleteLicenseResponse -> DeleteLicenseResponse -> Bool
== :: DeleteLicenseResponse -> DeleteLicenseResponse -> Bool
$c== :: DeleteLicenseResponse -> DeleteLicenseResponse -> Bool
Prelude.Eq, ReadPrec [DeleteLicenseResponse]
ReadPrec DeleteLicenseResponse
Int -> ReadS DeleteLicenseResponse
ReadS [DeleteLicenseResponse]
(Int -> ReadS DeleteLicenseResponse)
-> ReadS [DeleteLicenseResponse]
-> ReadPrec DeleteLicenseResponse
-> ReadPrec [DeleteLicenseResponse]
-> Read DeleteLicenseResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteLicenseResponse]
$creadListPrec :: ReadPrec [DeleteLicenseResponse]
readPrec :: ReadPrec DeleteLicenseResponse
$creadPrec :: ReadPrec DeleteLicenseResponse
readList :: ReadS [DeleteLicenseResponse]
$creadList :: ReadS [DeleteLicenseResponse]
readsPrec :: Int -> ReadS DeleteLicenseResponse
$creadsPrec :: Int -> ReadS DeleteLicenseResponse
Prelude.Read, Int -> DeleteLicenseResponse -> ShowS
[DeleteLicenseResponse] -> ShowS
DeleteLicenseResponse -> String
(Int -> DeleteLicenseResponse -> ShowS)
-> (DeleteLicenseResponse -> String)
-> ([DeleteLicenseResponse] -> ShowS)
-> Show DeleteLicenseResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteLicenseResponse] -> ShowS
$cshowList :: [DeleteLicenseResponse] -> ShowS
show :: DeleteLicenseResponse -> String
$cshow :: DeleteLicenseResponse -> String
showsPrec :: Int -> DeleteLicenseResponse -> ShowS
$cshowsPrec :: Int -> DeleteLicenseResponse -> ShowS
Prelude.Show, (forall x. DeleteLicenseResponse -> Rep DeleteLicenseResponse x)
-> (forall x. Rep DeleteLicenseResponse x -> DeleteLicenseResponse)
-> Generic DeleteLicenseResponse
forall x. Rep DeleteLicenseResponse x -> DeleteLicenseResponse
forall x. DeleteLicenseResponse -> Rep DeleteLicenseResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteLicenseResponse x -> DeleteLicenseResponse
$cfrom :: forall x. DeleteLicenseResponse -> Rep DeleteLicenseResponse x
Prelude.Generic)
newDeleteLicenseResponse ::
Prelude.Int ->
DeleteLicenseResponse
newDeleteLicenseResponse :: Int -> DeleteLicenseResponse
newDeleteLicenseResponse Int
pHttpStatus_ =
DeleteLicenseResponse' :: Maybe LicenseDeletionStatus
-> Maybe Text -> Int -> DeleteLicenseResponse
DeleteLicenseResponse'
{ $sel:status:DeleteLicenseResponse' :: Maybe LicenseDeletionStatus
status = Maybe LicenseDeletionStatus
forall a. Maybe a
Prelude.Nothing,
$sel:deletionDate:DeleteLicenseResponse' :: Maybe Text
deletionDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteLicenseResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteLicenseResponse_status :: Lens.Lens' DeleteLicenseResponse (Prelude.Maybe LicenseDeletionStatus)
deleteLicenseResponse_status :: (Maybe LicenseDeletionStatus -> f (Maybe LicenseDeletionStatus))
-> DeleteLicenseResponse -> f DeleteLicenseResponse
deleteLicenseResponse_status = (DeleteLicenseResponse -> Maybe LicenseDeletionStatus)
-> (DeleteLicenseResponse
-> Maybe LicenseDeletionStatus -> DeleteLicenseResponse)
-> Lens
DeleteLicenseResponse
DeleteLicenseResponse
(Maybe LicenseDeletionStatus)
(Maybe LicenseDeletionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLicenseResponse' {Maybe LicenseDeletionStatus
status :: Maybe LicenseDeletionStatus
$sel:status:DeleteLicenseResponse' :: DeleteLicenseResponse -> Maybe LicenseDeletionStatus
status} -> Maybe LicenseDeletionStatus
status) (\s :: DeleteLicenseResponse
s@DeleteLicenseResponse' {} Maybe LicenseDeletionStatus
a -> DeleteLicenseResponse
s {$sel:status:DeleteLicenseResponse' :: Maybe LicenseDeletionStatus
status = Maybe LicenseDeletionStatus
a} :: DeleteLicenseResponse)
deleteLicenseResponse_deletionDate :: Lens.Lens' DeleteLicenseResponse (Prelude.Maybe Prelude.Text)
deleteLicenseResponse_deletionDate :: (Maybe Text -> f (Maybe Text))
-> DeleteLicenseResponse -> f DeleteLicenseResponse
deleteLicenseResponse_deletionDate = (DeleteLicenseResponse -> Maybe Text)
-> (DeleteLicenseResponse -> Maybe Text -> DeleteLicenseResponse)
-> Lens
DeleteLicenseResponse
DeleteLicenseResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLicenseResponse' {Maybe Text
deletionDate :: Maybe Text
$sel:deletionDate:DeleteLicenseResponse' :: DeleteLicenseResponse -> Maybe Text
deletionDate} -> Maybe Text
deletionDate) (\s :: DeleteLicenseResponse
s@DeleteLicenseResponse' {} Maybe Text
a -> DeleteLicenseResponse
s {$sel:deletionDate:DeleteLicenseResponse' :: Maybe Text
deletionDate = Maybe Text
a} :: DeleteLicenseResponse)
deleteLicenseResponse_httpStatus :: Lens.Lens' DeleteLicenseResponse Prelude.Int
deleteLicenseResponse_httpStatus :: (Int -> f Int) -> DeleteLicenseResponse -> f DeleteLicenseResponse
deleteLicenseResponse_httpStatus = (DeleteLicenseResponse -> Int)
-> (DeleteLicenseResponse -> Int -> DeleteLicenseResponse)
-> Lens DeleteLicenseResponse DeleteLicenseResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLicenseResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteLicenseResponse' :: DeleteLicenseResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteLicenseResponse
s@DeleteLicenseResponse' {} Int
a -> DeleteLicenseResponse
s {$sel:httpStatus:DeleteLicenseResponse' :: Int
httpStatus = Int
a} :: DeleteLicenseResponse)
instance Prelude.NFData DeleteLicenseResponse