{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.LicenseManager.GetLicenseManagerReportGenerator
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets information about the specified report generator.
module Amazonka.LicenseManager.GetLicenseManagerReportGenerator
  ( -- * Creating a Request
    GetLicenseManagerReportGenerator (..),
    newGetLicenseManagerReportGenerator,

    -- * Request Lenses
    getLicenseManagerReportGenerator_licenseManagerReportGeneratorArn,

    -- * Destructuring the Response
    GetLicenseManagerReportGeneratorResponse (..),
    newGetLicenseManagerReportGeneratorResponse,

    -- * Response Lenses
    getLicenseManagerReportGeneratorResponse_reportGenerator,
    getLicenseManagerReportGeneratorResponse_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

-- | /See:/ 'newGetLicenseManagerReportGenerator' smart constructor.
data GetLicenseManagerReportGenerator = GetLicenseManagerReportGenerator'
  { -- | Amazon Resource Name (ARN) of the report generator.
    GetLicenseManagerReportGenerator -> Text
licenseManagerReportGeneratorArn :: Prelude.Text
  }
  deriving (GetLicenseManagerReportGenerator
-> GetLicenseManagerReportGenerator -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLicenseManagerReportGenerator
-> GetLicenseManagerReportGenerator -> Bool
$c/= :: GetLicenseManagerReportGenerator
-> GetLicenseManagerReportGenerator -> Bool
== :: GetLicenseManagerReportGenerator
-> GetLicenseManagerReportGenerator -> Bool
$c== :: GetLicenseManagerReportGenerator
-> GetLicenseManagerReportGenerator -> Bool
Prelude.Eq, ReadPrec [GetLicenseManagerReportGenerator]
ReadPrec GetLicenseManagerReportGenerator
Int -> ReadS GetLicenseManagerReportGenerator
ReadS [GetLicenseManagerReportGenerator]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLicenseManagerReportGenerator]
$creadListPrec :: ReadPrec [GetLicenseManagerReportGenerator]
readPrec :: ReadPrec GetLicenseManagerReportGenerator
$creadPrec :: ReadPrec GetLicenseManagerReportGenerator
readList :: ReadS [GetLicenseManagerReportGenerator]
$creadList :: ReadS [GetLicenseManagerReportGenerator]
readsPrec :: Int -> ReadS GetLicenseManagerReportGenerator
$creadsPrec :: Int -> ReadS GetLicenseManagerReportGenerator
Prelude.Read, Int -> GetLicenseManagerReportGenerator -> ShowS
[GetLicenseManagerReportGenerator] -> ShowS
GetLicenseManagerReportGenerator -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLicenseManagerReportGenerator] -> ShowS
$cshowList :: [GetLicenseManagerReportGenerator] -> ShowS
show :: GetLicenseManagerReportGenerator -> String
$cshow :: GetLicenseManagerReportGenerator -> String
showsPrec :: Int -> GetLicenseManagerReportGenerator -> ShowS
$cshowsPrec :: Int -> GetLicenseManagerReportGenerator -> ShowS
Prelude.Show, forall x.
Rep GetLicenseManagerReportGenerator x
-> GetLicenseManagerReportGenerator
forall x.
GetLicenseManagerReportGenerator
-> Rep GetLicenseManagerReportGenerator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetLicenseManagerReportGenerator x
-> GetLicenseManagerReportGenerator
$cfrom :: forall x.
GetLicenseManagerReportGenerator
-> Rep GetLicenseManagerReportGenerator x
Prelude.Generic)

-- |
-- Create a value of 'GetLicenseManagerReportGenerator' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'licenseManagerReportGeneratorArn', 'getLicenseManagerReportGenerator_licenseManagerReportGeneratorArn' - Amazon Resource Name (ARN) of the report generator.
newGetLicenseManagerReportGenerator ::
  -- | 'licenseManagerReportGeneratorArn'
  Prelude.Text ->
  GetLicenseManagerReportGenerator
newGetLicenseManagerReportGenerator :: Text -> GetLicenseManagerReportGenerator
newGetLicenseManagerReportGenerator
  Text
pLicenseManagerReportGeneratorArn_ =
    GetLicenseManagerReportGenerator'
      { $sel:licenseManagerReportGeneratorArn:GetLicenseManagerReportGenerator' :: Text
licenseManagerReportGeneratorArn =
          Text
pLicenseManagerReportGeneratorArn_
      }

-- | Amazon Resource Name (ARN) of the report generator.
getLicenseManagerReportGenerator_licenseManagerReportGeneratorArn :: Lens.Lens' GetLicenseManagerReportGenerator Prelude.Text
getLicenseManagerReportGenerator_licenseManagerReportGeneratorArn :: Lens' GetLicenseManagerReportGenerator Text
getLicenseManagerReportGenerator_licenseManagerReportGeneratorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLicenseManagerReportGenerator' {Text
licenseManagerReportGeneratorArn :: Text
$sel:licenseManagerReportGeneratorArn:GetLicenseManagerReportGenerator' :: GetLicenseManagerReportGenerator -> Text
licenseManagerReportGeneratorArn} -> Text
licenseManagerReportGeneratorArn) (\s :: GetLicenseManagerReportGenerator
s@GetLicenseManagerReportGenerator' {} Text
a -> GetLicenseManagerReportGenerator
s {$sel:licenseManagerReportGeneratorArn:GetLicenseManagerReportGenerator' :: Text
licenseManagerReportGeneratorArn = Text
a} :: GetLicenseManagerReportGenerator)

instance
  Core.AWSRequest
    GetLicenseManagerReportGenerator
  where
  type
    AWSResponse GetLicenseManagerReportGenerator =
      GetLicenseManagerReportGeneratorResponse
  request :: (Service -> Service)
-> GetLicenseManagerReportGenerator
-> Request GetLicenseManagerReportGenerator
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 GetLicenseManagerReportGenerator
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetLicenseManagerReportGenerator)))
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 ReportGenerator
-> Int -> GetLicenseManagerReportGeneratorResponse
GetLicenseManagerReportGeneratorResponse'
            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
"ReportGenerator")
            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
    GetLicenseManagerReportGenerator
  where
  hashWithSalt :: Int -> GetLicenseManagerReportGenerator -> Int
hashWithSalt
    Int
_salt
    GetLicenseManagerReportGenerator' {Text
licenseManagerReportGeneratorArn :: Text
$sel:licenseManagerReportGeneratorArn:GetLicenseManagerReportGenerator' :: GetLicenseManagerReportGenerator -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
licenseManagerReportGeneratorArn

instance
  Prelude.NFData
    GetLicenseManagerReportGenerator
  where
  rnf :: GetLicenseManagerReportGenerator -> ()
rnf GetLicenseManagerReportGenerator' {Text
licenseManagerReportGeneratorArn :: Text
$sel:licenseManagerReportGeneratorArn:GetLicenseManagerReportGenerator' :: GetLicenseManagerReportGenerator -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
licenseManagerReportGeneratorArn

instance
  Data.ToHeaders
    GetLicenseManagerReportGenerator
  where
  toHeaders :: GetLicenseManagerReportGenerator -> 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.GetLicenseManagerReportGenerator" ::
                          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 GetLicenseManagerReportGenerator where
  toJSON :: GetLicenseManagerReportGenerator -> Value
toJSON GetLicenseManagerReportGenerator' {Text
licenseManagerReportGeneratorArn :: Text
$sel:licenseManagerReportGeneratorArn:GetLicenseManagerReportGenerator' :: GetLicenseManagerReportGenerator -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"LicenseManagerReportGeneratorArn"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
licenseManagerReportGeneratorArn
              )
          ]
      )

instance Data.ToPath GetLicenseManagerReportGenerator where
  toPath :: GetLicenseManagerReportGenerator -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance
  Data.ToQuery
    GetLicenseManagerReportGenerator
  where
  toQuery :: GetLicenseManagerReportGenerator -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetLicenseManagerReportGeneratorResponse' smart constructor.
data GetLicenseManagerReportGeneratorResponse = GetLicenseManagerReportGeneratorResponse'
  { -- | A report generator that creates periodic reports about your license
    -- configurations.
    GetLicenseManagerReportGeneratorResponse -> Maybe ReportGenerator
reportGenerator :: Prelude.Maybe ReportGenerator,
    -- | The response's http status code.
    GetLicenseManagerReportGeneratorResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetLicenseManagerReportGeneratorResponse
-> GetLicenseManagerReportGeneratorResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLicenseManagerReportGeneratorResponse
-> GetLicenseManagerReportGeneratorResponse -> Bool
$c/= :: GetLicenseManagerReportGeneratorResponse
-> GetLicenseManagerReportGeneratorResponse -> Bool
== :: GetLicenseManagerReportGeneratorResponse
-> GetLicenseManagerReportGeneratorResponse -> Bool
$c== :: GetLicenseManagerReportGeneratorResponse
-> GetLicenseManagerReportGeneratorResponse -> Bool
Prelude.Eq, ReadPrec [GetLicenseManagerReportGeneratorResponse]
ReadPrec GetLicenseManagerReportGeneratorResponse
Int -> ReadS GetLicenseManagerReportGeneratorResponse
ReadS [GetLicenseManagerReportGeneratorResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLicenseManagerReportGeneratorResponse]
$creadListPrec :: ReadPrec [GetLicenseManagerReportGeneratorResponse]
readPrec :: ReadPrec GetLicenseManagerReportGeneratorResponse
$creadPrec :: ReadPrec GetLicenseManagerReportGeneratorResponse
readList :: ReadS [GetLicenseManagerReportGeneratorResponse]
$creadList :: ReadS [GetLicenseManagerReportGeneratorResponse]
readsPrec :: Int -> ReadS GetLicenseManagerReportGeneratorResponse
$creadsPrec :: Int -> ReadS GetLicenseManagerReportGeneratorResponse
Prelude.Read, Int -> GetLicenseManagerReportGeneratorResponse -> ShowS
[GetLicenseManagerReportGeneratorResponse] -> ShowS
GetLicenseManagerReportGeneratorResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLicenseManagerReportGeneratorResponse] -> ShowS
$cshowList :: [GetLicenseManagerReportGeneratorResponse] -> ShowS
show :: GetLicenseManagerReportGeneratorResponse -> String
$cshow :: GetLicenseManagerReportGeneratorResponse -> String
showsPrec :: Int -> GetLicenseManagerReportGeneratorResponse -> ShowS
$cshowsPrec :: Int -> GetLicenseManagerReportGeneratorResponse -> ShowS
Prelude.Show, forall x.
Rep GetLicenseManagerReportGeneratorResponse x
-> GetLicenseManagerReportGeneratorResponse
forall x.
GetLicenseManagerReportGeneratorResponse
-> Rep GetLicenseManagerReportGeneratorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetLicenseManagerReportGeneratorResponse x
-> GetLicenseManagerReportGeneratorResponse
$cfrom :: forall x.
GetLicenseManagerReportGeneratorResponse
-> Rep GetLicenseManagerReportGeneratorResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetLicenseManagerReportGeneratorResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'reportGenerator', 'getLicenseManagerReportGeneratorResponse_reportGenerator' - A report generator that creates periodic reports about your license
-- configurations.
--
-- 'httpStatus', 'getLicenseManagerReportGeneratorResponse_httpStatus' - The response's http status code.
newGetLicenseManagerReportGeneratorResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetLicenseManagerReportGeneratorResponse
newGetLicenseManagerReportGeneratorResponse :: Int -> GetLicenseManagerReportGeneratorResponse
newGetLicenseManagerReportGeneratorResponse
  Int
pHttpStatus_ =
    GetLicenseManagerReportGeneratorResponse'
      { $sel:reportGenerator:GetLicenseManagerReportGeneratorResponse' :: Maybe ReportGenerator
reportGenerator =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetLicenseManagerReportGeneratorResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | A report generator that creates periodic reports about your license
-- configurations.
getLicenseManagerReportGeneratorResponse_reportGenerator :: Lens.Lens' GetLicenseManagerReportGeneratorResponse (Prelude.Maybe ReportGenerator)
getLicenseManagerReportGeneratorResponse_reportGenerator :: Lens'
  GetLicenseManagerReportGeneratorResponse (Maybe ReportGenerator)
getLicenseManagerReportGeneratorResponse_reportGenerator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLicenseManagerReportGeneratorResponse' {Maybe ReportGenerator
reportGenerator :: Maybe ReportGenerator
$sel:reportGenerator:GetLicenseManagerReportGeneratorResponse' :: GetLicenseManagerReportGeneratorResponse -> Maybe ReportGenerator
reportGenerator} -> Maybe ReportGenerator
reportGenerator) (\s :: GetLicenseManagerReportGeneratorResponse
s@GetLicenseManagerReportGeneratorResponse' {} Maybe ReportGenerator
a -> GetLicenseManagerReportGeneratorResponse
s {$sel:reportGenerator:GetLicenseManagerReportGeneratorResponse' :: Maybe ReportGenerator
reportGenerator = Maybe ReportGenerator
a} :: GetLicenseManagerReportGeneratorResponse)

-- | The response's http status code.
getLicenseManagerReportGeneratorResponse_httpStatus :: Lens.Lens' GetLicenseManagerReportGeneratorResponse Prelude.Int
getLicenseManagerReportGeneratorResponse_httpStatus :: Lens' GetLicenseManagerReportGeneratorResponse Int
getLicenseManagerReportGeneratorResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLicenseManagerReportGeneratorResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetLicenseManagerReportGeneratorResponse' :: GetLicenseManagerReportGeneratorResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetLicenseManagerReportGeneratorResponse
s@GetLicenseManagerReportGeneratorResponse' {} Int
a -> GetLicenseManagerReportGeneratorResponse
s {$sel:httpStatus:GetLicenseManagerReportGeneratorResponse' :: Int
httpStatus = Int
a} :: GetLicenseManagerReportGeneratorResponse)

instance
  Prelude.NFData
    GetLicenseManagerReportGeneratorResponse
  where
  rnf :: GetLicenseManagerReportGeneratorResponse -> ()
rnf GetLicenseManagerReportGeneratorResponse' {Int
Maybe ReportGenerator
httpStatus :: Int
reportGenerator :: Maybe ReportGenerator
$sel:httpStatus:GetLicenseManagerReportGeneratorResponse' :: GetLicenseManagerReportGeneratorResponse -> Int
$sel:reportGenerator:GetLicenseManagerReportGeneratorResponse' :: GetLicenseManagerReportGeneratorResponse -> Maybe ReportGenerator
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ReportGenerator
reportGenerator
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus