{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.ReportContext
-- 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)
module Amazonka.LicenseManager.Types.ReportContext where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'ReportContext' 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:
--
-- 'licenseConfigurationArns', 'reportContext_licenseConfigurationArns' - Amazon Resource Name (ARN) of the license configuration that this
-- generator reports on.
newReportContext ::
  ReportContext
newReportContext :: ReportContext
newReportContext =
  ReportContext' :: [Text] -> ReportContext
ReportContext'
    { $sel:licenseConfigurationArns:ReportContext' :: [Text]
licenseConfigurationArns =
        [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | Amazon Resource Name (ARN) of the license configuration that this
-- generator reports on.
reportContext_licenseConfigurationArns :: Lens.Lens' ReportContext [Prelude.Text]
reportContext_licenseConfigurationArns :: ([Text] -> f [Text]) -> ReportContext -> f ReportContext
reportContext_licenseConfigurationArns = (ReportContext -> [Text])
-> (ReportContext -> [Text] -> ReportContext)
-> Lens ReportContext ReportContext [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportContext' {[Text]
licenseConfigurationArns :: [Text]
$sel:licenseConfigurationArns:ReportContext' :: ReportContext -> [Text]
licenseConfigurationArns} -> [Text]
licenseConfigurationArns) (\s :: ReportContext
s@ReportContext' {} [Text]
a -> ReportContext
s {$sel:licenseConfigurationArns:ReportContext' :: [Text]
licenseConfigurationArns = [Text]
a} :: ReportContext) (([Text] -> f [Text]) -> ReportContext -> f ReportContext)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ReportContext
-> f ReportContext
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ReportContext where
  parseJSON :: Value -> Parser ReportContext
parseJSON =
    String
-> (Object -> Parser ReportContext)
-> Value
-> Parser ReportContext
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReportContext"
      ( \Object
x ->
          [Text] -> ReportContext
ReportContext'
            ([Text] -> ReportContext) -> Parser [Text] -> Parser ReportContext
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"licenseConfigurationArns"
                            Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ReportContext

instance Prelude.NFData ReportContext

instance Core.ToJSON ReportContext where
  toJSON :: ReportContext -> Value
toJSON ReportContext' {[Text]
licenseConfigurationArns :: [Text]
$sel:licenseConfigurationArns:ReportContext' :: ReportContext -> [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
"licenseConfigurationArns"
                  Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
licenseConfigurationArns
              )
          ]
      )