{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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.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

-- | /See:/ 'newGetLicenseManagerReportGenerator' smart constructor.
data GetLicenseManagerReportGenerator = GetLicenseManagerReportGenerator'
  { -- | Amazon Resource Name (ARN) of the report generator.
    GetLicenseManagerReportGenerator -> Text
licenseManagerReportGeneratorArn :: Prelude.Text
  }
  deriving (GetLicenseManagerReportGenerator
-> GetLicenseManagerReportGenerator -> Bool
(GetLicenseManagerReportGenerator
 -> GetLicenseManagerReportGenerator -> Bool)
-> (GetLicenseManagerReportGenerator
    -> GetLicenseManagerReportGenerator -> Bool)
-> Eq GetLicenseManagerReportGenerator
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]
(Int -> ReadS GetLicenseManagerReportGenerator)
-> ReadS [GetLicenseManagerReportGenerator]
-> ReadPrec GetLicenseManagerReportGenerator
-> ReadPrec [GetLicenseManagerReportGenerator]
-> Read 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
(Int -> GetLicenseManagerReportGenerator -> ShowS)
-> (GetLicenseManagerReportGenerator -> String)
-> ([GetLicenseManagerReportGenerator] -> ShowS)
-> Show GetLicenseManagerReportGenerator
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.
 GetLicenseManagerReportGenerator
 -> Rep GetLicenseManagerReportGenerator x)
-> (forall x.
    Rep GetLicenseManagerReportGenerator x
    -> GetLicenseManagerReportGenerator)
-> Generic GetLicenseManagerReportGenerator
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' :: Text -> GetLicenseManagerReportGenerator
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 :: (Text -> f Text)
-> GetLicenseManagerReportGenerator
-> f GetLicenseManagerReportGenerator
getLicenseManagerReportGenerator_licenseManagerReportGeneratorArn = (GetLicenseManagerReportGenerator -> Text)
-> (GetLicenseManagerReportGenerator
    -> Text -> GetLicenseManagerReportGenerator)
-> Lens
     GetLicenseManagerReportGenerator
     GetLicenseManagerReportGenerator
     Text
     Text
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 :: GetLicenseManagerReportGenerator
-> Request GetLicenseManagerReportGenerator
request = Service
-> GetLicenseManagerReportGenerator
-> Request GetLicenseManagerReportGenerator
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetLicenseManagerReportGenerator
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetLicenseManagerReportGenerator)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetLicenseManagerReportGenerator))
-> Logger
-> Service
-> Proxy GetLicenseManagerReportGenerator
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetLicenseManagerReportGenerator)))
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 ReportGenerator
-> Int -> GetLicenseManagerReportGeneratorResponse
GetLicenseManagerReportGeneratorResponse'
            (Maybe ReportGenerator
 -> Int -> GetLicenseManagerReportGeneratorResponse)
-> Either String (Maybe ReportGenerator)
-> Either String (Int -> GetLicenseManagerReportGeneratorResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ReportGenerator)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ReportGenerator")
            Either String (Int -> GetLicenseManagerReportGeneratorResponse)
-> Either String Int
-> Either String GetLicenseManagerReportGeneratorResponse
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
    GetLicenseManagerReportGenerator

instance
  Prelude.NFData
    GetLicenseManagerReportGenerator

instance
  Core.ToHeaders
    GetLicenseManagerReportGenerator
  where
  toHeaders :: GetLicenseManagerReportGenerator -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> GetLicenseManagerReportGenerator -> 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.GetLicenseManagerReportGenerator" ::
                          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 GetLicenseManagerReportGenerator where
  toJSON :: GetLicenseManagerReportGenerator -> Value
toJSON GetLicenseManagerReportGenerator' {Text
licenseManagerReportGeneratorArn :: Text
$sel:licenseManagerReportGeneratorArn:GetLicenseManagerReportGenerator' :: GetLicenseManagerReportGenerator -> 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
"LicenseManagerReportGeneratorArn"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
licenseManagerReportGeneratorArn
              )
          ]
      )

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

instance
  Core.ToQuery
    GetLicenseManagerReportGenerator
  where
  toQuery :: GetLicenseManagerReportGenerator -> QueryString
toQuery = QueryString -> GetLicenseManagerReportGenerator -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetLicenseManagerReportGeneratorResponse
 -> GetLicenseManagerReportGeneratorResponse -> Bool)
-> (GetLicenseManagerReportGeneratorResponse
    -> GetLicenseManagerReportGeneratorResponse -> Bool)
-> Eq GetLicenseManagerReportGeneratorResponse
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]
(Int -> ReadS GetLicenseManagerReportGeneratorResponse)
-> ReadS [GetLicenseManagerReportGeneratorResponse]
-> ReadPrec GetLicenseManagerReportGeneratorResponse
-> ReadPrec [GetLicenseManagerReportGeneratorResponse]
-> Read 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
(Int -> GetLicenseManagerReportGeneratorResponse -> ShowS)
-> (GetLicenseManagerReportGeneratorResponse -> String)
-> ([GetLicenseManagerReportGeneratorResponse] -> ShowS)
-> Show GetLicenseManagerReportGeneratorResponse
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.
 GetLicenseManagerReportGeneratorResponse
 -> Rep GetLicenseManagerReportGeneratorResponse x)
-> (forall x.
    Rep GetLicenseManagerReportGeneratorResponse x
    -> GetLicenseManagerReportGeneratorResponse)
-> Generic GetLicenseManagerReportGeneratorResponse
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' :: Maybe ReportGenerator
-> Int -> GetLicenseManagerReportGeneratorResponse
GetLicenseManagerReportGeneratorResponse'
      { $sel:reportGenerator:GetLicenseManagerReportGeneratorResponse' :: Maybe ReportGenerator
reportGenerator =
          Maybe 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 :: (Maybe ReportGenerator -> f (Maybe ReportGenerator))
-> GetLicenseManagerReportGeneratorResponse
-> f GetLicenseManagerReportGeneratorResponse
getLicenseManagerReportGeneratorResponse_reportGenerator = (GetLicenseManagerReportGeneratorResponse -> Maybe ReportGenerator)
-> (GetLicenseManagerReportGeneratorResponse
    -> Maybe ReportGenerator
    -> GetLicenseManagerReportGeneratorResponse)
-> Lens
     GetLicenseManagerReportGeneratorResponse
     GetLicenseManagerReportGeneratorResponse
     (Maybe ReportGenerator)
     (Maybe 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 :: (Int -> f Int)
-> GetLicenseManagerReportGeneratorResponse
-> f GetLicenseManagerReportGeneratorResponse
getLicenseManagerReportGeneratorResponse_httpStatus = (GetLicenseManagerReportGeneratorResponse -> Int)
-> (GetLicenseManagerReportGeneratorResponse
    -> Int -> GetLicenseManagerReportGeneratorResponse)
-> Lens
     GetLicenseManagerReportGeneratorResponse
     GetLicenseManagerReportGeneratorResponse
     Int
     Int
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