{-# 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.GetLicenseUsage
(
GetLicenseUsage (..),
newGetLicenseUsage,
getLicenseUsage_licenseArn,
GetLicenseUsageResponse (..),
newGetLicenseUsageResponse,
getLicenseUsageResponse_licenseUsage,
getLicenseUsageResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LicenseManager.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetLicenseUsage = GetLicenseUsage'
{
GetLicenseUsage -> Text
licenseArn :: Prelude.Text
}
deriving (GetLicenseUsage -> GetLicenseUsage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLicenseUsage -> GetLicenseUsage -> Bool
$c/= :: GetLicenseUsage -> GetLicenseUsage -> Bool
== :: GetLicenseUsage -> GetLicenseUsage -> Bool
$c== :: GetLicenseUsage -> GetLicenseUsage -> Bool
Prelude.Eq, ReadPrec [GetLicenseUsage]
ReadPrec GetLicenseUsage
Int -> ReadS GetLicenseUsage
ReadS [GetLicenseUsage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLicenseUsage]
$creadListPrec :: ReadPrec [GetLicenseUsage]
readPrec :: ReadPrec GetLicenseUsage
$creadPrec :: ReadPrec GetLicenseUsage
readList :: ReadS [GetLicenseUsage]
$creadList :: ReadS [GetLicenseUsage]
readsPrec :: Int -> ReadS GetLicenseUsage
$creadsPrec :: Int -> ReadS GetLicenseUsage
Prelude.Read, Int -> GetLicenseUsage -> ShowS
[GetLicenseUsage] -> ShowS
GetLicenseUsage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLicenseUsage] -> ShowS
$cshowList :: [GetLicenseUsage] -> ShowS
show :: GetLicenseUsage -> String
$cshow :: GetLicenseUsage -> String
showsPrec :: Int -> GetLicenseUsage -> ShowS
$cshowsPrec :: Int -> GetLicenseUsage -> ShowS
Prelude.Show, forall x. Rep GetLicenseUsage x -> GetLicenseUsage
forall x. GetLicenseUsage -> Rep GetLicenseUsage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetLicenseUsage x -> GetLicenseUsage
$cfrom :: forall x. GetLicenseUsage -> Rep GetLicenseUsage x
Prelude.Generic)
newGetLicenseUsage ::
Prelude.Text ->
GetLicenseUsage
newGetLicenseUsage :: Text -> GetLicenseUsage
newGetLicenseUsage Text
pLicenseArn_ =
GetLicenseUsage' {$sel:licenseArn:GetLicenseUsage' :: Text
licenseArn = Text
pLicenseArn_}
getLicenseUsage_licenseArn :: Lens.Lens' GetLicenseUsage Prelude.Text
getLicenseUsage_licenseArn :: Lens' GetLicenseUsage Text
getLicenseUsage_licenseArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLicenseUsage' {Text
licenseArn :: Text
$sel:licenseArn:GetLicenseUsage' :: GetLicenseUsage -> Text
licenseArn} -> Text
licenseArn) (\s :: GetLicenseUsage
s@GetLicenseUsage' {} Text
a -> GetLicenseUsage
s {$sel:licenseArn:GetLicenseUsage' :: Text
licenseArn = Text
a} :: GetLicenseUsage)
instance Core.AWSRequest GetLicenseUsage where
type
AWSResponse GetLicenseUsage =
GetLicenseUsageResponse
request :: (Service -> Service) -> GetLicenseUsage -> Request GetLicenseUsage
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetLicenseUsage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetLicenseUsage)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe LicenseUsage -> Int -> GetLicenseUsageResponse
GetLicenseUsageResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"LicenseUsage")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetLicenseUsage where
hashWithSalt :: Int -> GetLicenseUsage -> Int
hashWithSalt Int
_salt GetLicenseUsage' {Text
licenseArn :: Text
$sel:licenseArn:GetLicenseUsage' :: GetLicenseUsage -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
licenseArn
instance Prelude.NFData GetLicenseUsage where
rnf :: GetLicenseUsage -> ()
rnf GetLicenseUsage' {Text
licenseArn :: Text
$sel:licenseArn:GetLicenseUsage' :: GetLicenseUsage -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
licenseArn
instance Data.ToHeaders GetLicenseUsage where
toHeaders :: GetLicenseUsage -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSLicenseManager.GetLicenseUsage" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetLicenseUsage where
toJSON :: GetLicenseUsage -> Value
toJSON GetLicenseUsage' {Text
licenseArn :: Text
$sel:licenseArn:GetLicenseUsage' :: GetLicenseUsage -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"LicenseArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
licenseArn)]
)
instance Data.ToPath GetLicenseUsage where
toPath :: GetLicenseUsage -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetLicenseUsage where
toQuery :: GetLicenseUsage -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetLicenseUsageResponse = GetLicenseUsageResponse'
{
GetLicenseUsageResponse -> Maybe LicenseUsage
licenseUsage :: Prelude.Maybe LicenseUsage,
GetLicenseUsageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetLicenseUsageResponse -> GetLicenseUsageResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLicenseUsageResponse -> GetLicenseUsageResponse -> Bool
$c/= :: GetLicenseUsageResponse -> GetLicenseUsageResponse -> Bool
== :: GetLicenseUsageResponse -> GetLicenseUsageResponse -> Bool
$c== :: GetLicenseUsageResponse -> GetLicenseUsageResponse -> Bool
Prelude.Eq, ReadPrec [GetLicenseUsageResponse]
ReadPrec GetLicenseUsageResponse
Int -> ReadS GetLicenseUsageResponse
ReadS [GetLicenseUsageResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLicenseUsageResponse]
$creadListPrec :: ReadPrec [GetLicenseUsageResponse]
readPrec :: ReadPrec GetLicenseUsageResponse
$creadPrec :: ReadPrec GetLicenseUsageResponse
readList :: ReadS [GetLicenseUsageResponse]
$creadList :: ReadS [GetLicenseUsageResponse]
readsPrec :: Int -> ReadS GetLicenseUsageResponse
$creadsPrec :: Int -> ReadS GetLicenseUsageResponse
Prelude.Read, Int -> GetLicenseUsageResponse -> ShowS
[GetLicenseUsageResponse] -> ShowS
GetLicenseUsageResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLicenseUsageResponse] -> ShowS
$cshowList :: [GetLicenseUsageResponse] -> ShowS
show :: GetLicenseUsageResponse -> String
$cshow :: GetLicenseUsageResponse -> String
showsPrec :: Int -> GetLicenseUsageResponse -> ShowS
$cshowsPrec :: Int -> GetLicenseUsageResponse -> ShowS
Prelude.Show, forall x. Rep GetLicenseUsageResponse x -> GetLicenseUsageResponse
forall x. GetLicenseUsageResponse -> Rep GetLicenseUsageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetLicenseUsageResponse x -> GetLicenseUsageResponse
$cfrom :: forall x. GetLicenseUsageResponse -> Rep GetLicenseUsageResponse x
Prelude.Generic)
newGetLicenseUsageResponse ::
Prelude.Int ->
GetLicenseUsageResponse
newGetLicenseUsageResponse :: Int -> GetLicenseUsageResponse
newGetLicenseUsageResponse Int
pHttpStatus_ =
GetLicenseUsageResponse'
{ $sel:licenseUsage:GetLicenseUsageResponse' :: Maybe LicenseUsage
licenseUsage =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetLicenseUsageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getLicenseUsageResponse_licenseUsage :: Lens.Lens' GetLicenseUsageResponse (Prelude.Maybe LicenseUsage)
getLicenseUsageResponse_licenseUsage :: Lens' GetLicenseUsageResponse (Maybe LicenseUsage)
getLicenseUsageResponse_licenseUsage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLicenseUsageResponse' {Maybe LicenseUsage
licenseUsage :: Maybe LicenseUsage
$sel:licenseUsage:GetLicenseUsageResponse' :: GetLicenseUsageResponse -> Maybe LicenseUsage
licenseUsage} -> Maybe LicenseUsage
licenseUsage) (\s :: GetLicenseUsageResponse
s@GetLicenseUsageResponse' {} Maybe LicenseUsage
a -> GetLicenseUsageResponse
s {$sel:licenseUsage:GetLicenseUsageResponse' :: Maybe LicenseUsage
licenseUsage = Maybe LicenseUsage
a} :: GetLicenseUsageResponse)
getLicenseUsageResponse_httpStatus :: Lens.Lens' GetLicenseUsageResponse Prelude.Int
getLicenseUsageResponse_httpStatus :: Lens' GetLicenseUsageResponse Int
getLicenseUsageResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLicenseUsageResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetLicenseUsageResponse' :: GetLicenseUsageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetLicenseUsageResponse
s@GetLicenseUsageResponse' {} Int
a -> GetLicenseUsageResponse
s {$sel:httpStatus:GetLicenseUsageResponse' :: Int
httpStatus = Int
a} :: GetLicenseUsageResponse)
instance Prelude.NFData GetLicenseUsageResponse where
rnf :: GetLicenseUsageResponse -> ()
rnf GetLicenseUsageResponse' {Int
Maybe LicenseUsage
httpStatus :: Int
licenseUsage :: Maybe LicenseUsage
$sel:httpStatus:GetLicenseUsageResponse' :: GetLicenseUsageResponse -> Int
$sel:licenseUsage:GetLicenseUsageResponse' :: GetLicenseUsageResponse -> Maybe LicenseUsage
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe LicenseUsage
licenseUsage
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus