{-# 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.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 GetLicenseUsage = GetLicenseUsage'
{
GetLicenseUsage -> Text
licenseArn :: Prelude.Text
}
deriving (GetLicenseUsage -> GetLicenseUsage -> Bool
(GetLicenseUsage -> GetLicenseUsage -> Bool)
-> (GetLicenseUsage -> GetLicenseUsage -> Bool)
-> Eq GetLicenseUsage
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]
(Int -> ReadS GetLicenseUsage)
-> ReadS [GetLicenseUsage]
-> ReadPrec GetLicenseUsage
-> ReadPrec [GetLicenseUsage]
-> Read 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
(Int -> GetLicenseUsage -> ShowS)
-> (GetLicenseUsage -> String)
-> ([GetLicenseUsage] -> ShowS)
-> Show GetLicenseUsage
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. GetLicenseUsage -> Rep GetLicenseUsage x)
-> (forall x. Rep GetLicenseUsage x -> GetLicenseUsage)
-> Generic GetLicenseUsage
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' :: Text -> GetLicenseUsage
GetLicenseUsage' {$sel:licenseArn:GetLicenseUsage' :: Text
licenseArn = Text
pLicenseArn_}
getLicenseUsage_licenseArn :: Lens.Lens' GetLicenseUsage Prelude.Text
getLicenseUsage_licenseArn :: (Text -> f Text) -> GetLicenseUsage -> f GetLicenseUsage
getLicenseUsage_licenseArn = (GetLicenseUsage -> Text)
-> (GetLicenseUsage -> Text -> GetLicenseUsage)
-> Lens GetLicenseUsage GetLicenseUsage Text Text
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 :: GetLicenseUsage -> Request GetLicenseUsage
request = Service -> GetLicenseUsage -> Request GetLicenseUsage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetLicenseUsage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetLicenseUsage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetLicenseUsage))
-> Logger
-> Service
-> Proxy GetLicenseUsage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetLicenseUsage)))
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 LicenseUsage -> Int -> GetLicenseUsageResponse
GetLicenseUsageResponse'
(Maybe LicenseUsage -> Int -> GetLicenseUsageResponse)
-> Either String (Maybe LicenseUsage)
-> Either String (Int -> GetLicenseUsageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe LicenseUsage)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LicenseUsage")
Either String (Int -> GetLicenseUsageResponse)
-> Either String Int -> Either String GetLicenseUsageResponse
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 GetLicenseUsage
instance Prelude.NFData GetLicenseUsage
instance Core.ToHeaders GetLicenseUsage where
toHeaders :: GetLicenseUsage -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetLicenseUsage -> 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.GetLicenseUsage" ::
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 GetLicenseUsage where
toJSON :: GetLicenseUsage -> Value
toJSON GetLicenseUsage' {Text
licenseArn :: Text
$sel:licenseArn:GetLicenseUsage' :: GetLicenseUsage -> 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)]
)
instance Core.ToPath GetLicenseUsage where
toPath :: GetLicenseUsage -> ByteString
toPath = ByteString -> GetLicenseUsage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetLicenseUsage where
toQuery :: GetLicenseUsage -> QueryString
toQuery = QueryString -> GetLicenseUsage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetLicenseUsageResponse -> GetLicenseUsageResponse -> Bool)
-> (GetLicenseUsageResponse -> GetLicenseUsageResponse -> Bool)
-> Eq GetLicenseUsageResponse
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]
(Int -> ReadS GetLicenseUsageResponse)
-> ReadS [GetLicenseUsageResponse]
-> ReadPrec GetLicenseUsageResponse
-> ReadPrec [GetLicenseUsageResponse]
-> Read 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
(Int -> GetLicenseUsageResponse -> ShowS)
-> (GetLicenseUsageResponse -> String)
-> ([GetLicenseUsageResponse] -> ShowS)
-> Show GetLicenseUsageResponse
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.
GetLicenseUsageResponse -> Rep GetLicenseUsageResponse x)
-> (forall x.
Rep GetLicenseUsageResponse x -> GetLicenseUsageResponse)
-> Generic GetLicenseUsageResponse
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' :: Maybe LicenseUsage -> Int -> GetLicenseUsageResponse
GetLicenseUsageResponse'
{ $sel:licenseUsage:GetLicenseUsageResponse' :: Maybe LicenseUsage
licenseUsage =
Maybe LicenseUsage
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetLicenseUsageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getLicenseUsageResponse_licenseUsage :: Lens.Lens' GetLicenseUsageResponse (Prelude.Maybe LicenseUsage)
getLicenseUsageResponse_licenseUsage :: (Maybe LicenseUsage -> f (Maybe LicenseUsage))
-> GetLicenseUsageResponse -> f GetLicenseUsageResponse
getLicenseUsageResponse_licenseUsage = (GetLicenseUsageResponse -> Maybe LicenseUsage)
-> (GetLicenseUsageResponse
-> Maybe LicenseUsage -> GetLicenseUsageResponse)
-> Lens
GetLicenseUsageResponse
GetLicenseUsageResponse
(Maybe LicenseUsage)
(Maybe 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 :: (Int -> f Int)
-> GetLicenseUsageResponse -> f GetLicenseUsageResponse
getLicenseUsageResponse_httpStatus = (GetLicenseUsageResponse -> Int)
-> (GetLicenseUsageResponse -> Int -> GetLicenseUsageResponse)
-> Lens GetLicenseUsageResponse GetLicenseUsageResponse Int Int
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