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