{-# 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.ProductInformation
-- 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.ProductInformation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LicenseManager.Types.ProductInformationFilter
import qualified Amazonka.Prelude as Prelude

-- | Describes product information for a license configuration.
--
-- /See:/ 'newProductInformation' smart constructor.
data ProductInformation = ProductInformation'
  { -- | Resource type. The possible values are @SSM_MANAGED@ | @RDS@.
    ProductInformation -> Text
resourceType :: Prelude.Text,
    -- | A Product information filter consists of a
    -- @ProductInformationFilterComparator@ which is a logical operator, a
    -- @ProductInformationFilterName@ which specifies the type of filter being
    -- declared, and a @ProductInformationFilterValue@ that specifies the value
    -- to filter on.
    --
    -- Accepted values for @ProductInformationFilterName@ are listed here along
    -- with descriptions and valid options for
    -- @ProductInformationFilterComparator@.
    --
    -- The following filters and are supported when the resource type is
    -- @SSM_MANAGED@:
    --
    -- -   @Application Name@ - The name of the application. Logical operator
    --     is @EQUALS@.
    --
    -- -   @Application Publisher@ - The publisher of the application. Logical
    --     operator is @EQUALS@.
    --
    -- -   @Application Version@ - The version of the application. Logical
    --     operator is @EQUALS@.
    --
    -- -   @Platform Name@ - The name of the platform. Logical operator is
    --     @EQUALS@.
    --
    -- -   @Platform Type@ - The platform type. Logical operator is @EQUALS@.
    --
    -- -   @Tag:key@ - The key of a tag attached to an Amazon Web Services
    --     resource you wish to exclude from automated discovery. Logical
    --     operator is @NOT_EQUALS@. The key for your tag must be appended to
    --     @Tag:@ following the example: @Tag:name-of-your-key@.
    --     @ProductInformationFilterValue@ is optional if you are not using
    --     values for the key.
    --
    -- -   @AccountId@ - The 12-digit ID of an Amazon Web Services account you
    --     wish to exclude from automated discovery. Logical operator is
    --     @NOT_EQUALS@.
    --
    -- -   @License Included@ - The type of license included. Logical operators
    --     are @EQUALS@ and @NOT_EQUALS@. Possible values are:
    --     @sql-server-enterprise@ | @sql-server-standard@ | @sql-server-web@ |
    --     @windows-server-datacenter@.
    --
    -- The following filters and logical operators are supported when the
    -- resource type is @RDS@:
    --
    -- -   @Engine Edition@ - The edition of the database engine. Logical
    --     operator is @EQUALS@. Possible values are: @oracle-ee@ | @oracle-se@
    --     | @oracle-se1@ | @oracle-se2@.
    --
    -- -   @License Pack@ - The license pack. Logical operator is @EQUALS@.
    --     Possible values are: @data guard@ | @diagnostic pack sqlt@ |
    --     @tuning pack sqlt@ | @ols@ | @olap@.
    ProductInformation -> [ProductInformationFilter]
productInformationFilterList :: [ProductInformationFilter]
  }
  deriving (ProductInformation -> ProductInformation -> Bool
(ProductInformation -> ProductInformation -> Bool)
-> (ProductInformation -> ProductInformation -> Bool)
-> Eq ProductInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProductInformation -> ProductInformation -> Bool
$c/= :: ProductInformation -> ProductInformation -> Bool
== :: ProductInformation -> ProductInformation -> Bool
$c== :: ProductInformation -> ProductInformation -> Bool
Prelude.Eq, ReadPrec [ProductInformation]
ReadPrec ProductInformation
Int -> ReadS ProductInformation
ReadS [ProductInformation]
(Int -> ReadS ProductInformation)
-> ReadS [ProductInformation]
-> ReadPrec ProductInformation
-> ReadPrec [ProductInformation]
-> Read ProductInformation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProductInformation]
$creadListPrec :: ReadPrec [ProductInformation]
readPrec :: ReadPrec ProductInformation
$creadPrec :: ReadPrec ProductInformation
readList :: ReadS [ProductInformation]
$creadList :: ReadS [ProductInformation]
readsPrec :: Int -> ReadS ProductInformation
$creadsPrec :: Int -> ReadS ProductInformation
Prelude.Read, Int -> ProductInformation -> ShowS
[ProductInformation] -> ShowS
ProductInformation -> String
(Int -> ProductInformation -> ShowS)
-> (ProductInformation -> String)
-> ([ProductInformation] -> ShowS)
-> Show ProductInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProductInformation] -> ShowS
$cshowList :: [ProductInformation] -> ShowS
show :: ProductInformation -> String
$cshow :: ProductInformation -> String
showsPrec :: Int -> ProductInformation -> ShowS
$cshowsPrec :: Int -> ProductInformation -> ShowS
Prelude.Show, (forall x. ProductInformation -> Rep ProductInformation x)
-> (forall x. Rep ProductInformation x -> ProductInformation)
-> Generic ProductInformation
forall x. Rep ProductInformation x -> ProductInformation
forall x. ProductInformation -> Rep ProductInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProductInformation x -> ProductInformation
$cfrom :: forall x. ProductInformation -> Rep ProductInformation x
Prelude.Generic)

-- |
-- Create a value of 'ProductInformation' 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:
--
-- 'resourceType', 'productInformation_resourceType' - Resource type. The possible values are @SSM_MANAGED@ | @RDS@.
--
-- 'productInformationFilterList', 'productInformation_productInformationFilterList' - A Product information filter consists of a
-- @ProductInformationFilterComparator@ which is a logical operator, a
-- @ProductInformationFilterName@ which specifies the type of filter being
-- declared, and a @ProductInformationFilterValue@ that specifies the value
-- to filter on.
--
-- Accepted values for @ProductInformationFilterName@ are listed here along
-- with descriptions and valid options for
-- @ProductInformationFilterComparator@.
--
-- The following filters and are supported when the resource type is
-- @SSM_MANAGED@:
--
-- -   @Application Name@ - The name of the application. Logical operator
--     is @EQUALS@.
--
-- -   @Application Publisher@ - The publisher of the application. Logical
--     operator is @EQUALS@.
--
-- -   @Application Version@ - The version of the application. Logical
--     operator is @EQUALS@.
--
-- -   @Platform Name@ - The name of the platform. Logical operator is
--     @EQUALS@.
--
-- -   @Platform Type@ - The platform type. Logical operator is @EQUALS@.
--
-- -   @Tag:key@ - The key of a tag attached to an Amazon Web Services
--     resource you wish to exclude from automated discovery. Logical
--     operator is @NOT_EQUALS@. The key for your tag must be appended to
--     @Tag:@ following the example: @Tag:name-of-your-key@.
--     @ProductInformationFilterValue@ is optional if you are not using
--     values for the key.
--
-- -   @AccountId@ - The 12-digit ID of an Amazon Web Services account you
--     wish to exclude from automated discovery. Logical operator is
--     @NOT_EQUALS@.
--
-- -   @License Included@ - The type of license included. Logical operators
--     are @EQUALS@ and @NOT_EQUALS@. Possible values are:
--     @sql-server-enterprise@ | @sql-server-standard@ | @sql-server-web@ |
--     @windows-server-datacenter@.
--
-- The following filters and logical operators are supported when the
-- resource type is @RDS@:
--
-- -   @Engine Edition@ - The edition of the database engine. Logical
--     operator is @EQUALS@. Possible values are: @oracle-ee@ | @oracle-se@
--     | @oracle-se1@ | @oracle-se2@.
--
-- -   @License Pack@ - The license pack. Logical operator is @EQUALS@.
--     Possible values are: @data guard@ | @diagnostic pack sqlt@ |
--     @tuning pack sqlt@ | @ols@ | @olap@.
newProductInformation ::
  -- | 'resourceType'
  Prelude.Text ->
  ProductInformation
newProductInformation :: Text -> ProductInformation
newProductInformation Text
pResourceType_ =
  ProductInformation' :: Text -> [ProductInformationFilter] -> ProductInformation
ProductInformation'
    { $sel:resourceType:ProductInformation' :: Text
resourceType = Text
pResourceType_,
      $sel:productInformationFilterList:ProductInformation' :: [ProductInformationFilter]
productInformationFilterList = [ProductInformationFilter]
forall a. Monoid a => a
Prelude.mempty
    }

-- | Resource type. The possible values are @SSM_MANAGED@ | @RDS@.
productInformation_resourceType :: Lens.Lens' ProductInformation Prelude.Text
productInformation_resourceType :: (Text -> f Text) -> ProductInformation -> f ProductInformation
productInformation_resourceType = (ProductInformation -> Text)
-> (ProductInformation -> Text -> ProductInformation)
-> Lens ProductInformation ProductInformation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductInformation' {Text
resourceType :: Text
$sel:resourceType:ProductInformation' :: ProductInformation -> Text
resourceType} -> Text
resourceType) (\s :: ProductInformation
s@ProductInformation' {} Text
a -> ProductInformation
s {$sel:resourceType:ProductInformation' :: Text
resourceType = Text
a} :: ProductInformation)

-- | A Product information filter consists of a
-- @ProductInformationFilterComparator@ which is a logical operator, a
-- @ProductInformationFilterName@ which specifies the type of filter being
-- declared, and a @ProductInformationFilterValue@ that specifies the value
-- to filter on.
--
-- Accepted values for @ProductInformationFilterName@ are listed here along
-- with descriptions and valid options for
-- @ProductInformationFilterComparator@.
--
-- The following filters and are supported when the resource type is
-- @SSM_MANAGED@:
--
-- -   @Application Name@ - The name of the application. Logical operator
--     is @EQUALS@.
--
-- -   @Application Publisher@ - The publisher of the application. Logical
--     operator is @EQUALS@.
--
-- -   @Application Version@ - The version of the application. Logical
--     operator is @EQUALS@.
--
-- -   @Platform Name@ - The name of the platform. Logical operator is
--     @EQUALS@.
--
-- -   @Platform Type@ - The platform type. Logical operator is @EQUALS@.
--
-- -   @Tag:key@ - The key of a tag attached to an Amazon Web Services
--     resource you wish to exclude from automated discovery. Logical
--     operator is @NOT_EQUALS@. The key for your tag must be appended to
--     @Tag:@ following the example: @Tag:name-of-your-key@.
--     @ProductInformationFilterValue@ is optional if you are not using
--     values for the key.
--
-- -   @AccountId@ - The 12-digit ID of an Amazon Web Services account you
--     wish to exclude from automated discovery. Logical operator is
--     @NOT_EQUALS@.
--
-- -   @License Included@ - The type of license included. Logical operators
--     are @EQUALS@ and @NOT_EQUALS@. Possible values are:
--     @sql-server-enterprise@ | @sql-server-standard@ | @sql-server-web@ |
--     @windows-server-datacenter@.
--
-- The following filters and logical operators are supported when the
-- resource type is @RDS@:
--
-- -   @Engine Edition@ - The edition of the database engine. Logical
--     operator is @EQUALS@. Possible values are: @oracle-ee@ | @oracle-se@
--     | @oracle-se1@ | @oracle-se2@.
--
-- -   @License Pack@ - The license pack. Logical operator is @EQUALS@.
--     Possible values are: @data guard@ | @diagnostic pack sqlt@ |
--     @tuning pack sqlt@ | @ols@ | @olap@.
productInformation_productInformationFilterList :: Lens.Lens' ProductInformation [ProductInformationFilter]
productInformation_productInformationFilterList :: ([ProductInformationFilter] -> f [ProductInformationFilter])
-> ProductInformation -> f ProductInformation
productInformation_productInformationFilterList = (ProductInformation -> [ProductInformationFilter])
-> (ProductInformation
    -> [ProductInformationFilter] -> ProductInformation)
-> Lens
     ProductInformation
     ProductInformation
     [ProductInformationFilter]
     [ProductInformationFilter]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductInformation' {[ProductInformationFilter]
productInformationFilterList :: [ProductInformationFilter]
$sel:productInformationFilterList:ProductInformation' :: ProductInformation -> [ProductInformationFilter]
productInformationFilterList} -> [ProductInformationFilter]
productInformationFilterList) (\s :: ProductInformation
s@ProductInformation' {} [ProductInformationFilter]
a -> ProductInformation
s {$sel:productInformationFilterList:ProductInformation' :: [ProductInformationFilter]
productInformationFilterList = [ProductInformationFilter]
a} :: ProductInformation) (([ProductInformationFilter] -> f [ProductInformationFilter])
 -> ProductInformation -> f ProductInformation)
-> (([ProductInformationFilter] -> f [ProductInformationFilter])
    -> [ProductInformationFilter] -> f [ProductInformationFilter])
-> ([ProductInformationFilter] -> f [ProductInformationFilter])
-> ProductInformation
-> f ProductInformation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ProductInformationFilter] -> f [ProductInformationFilter])
-> [ProductInformationFilter] -> f [ProductInformationFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable ProductInformation

instance Prelude.NFData ProductInformation

instance Core.ToJSON ProductInformation where
  toJSON :: ProductInformation -> Value
toJSON ProductInformation' {[ProductInformationFilter]
Text
productInformationFilterList :: [ProductInformationFilter]
resourceType :: Text
$sel:productInformationFilterList:ProductInformation' :: ProductInformation -> [ProductInformationFilter]
$sel:resourceType:ProductInformation' :: ProductInformation -> 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
"ResourceType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ProductInformationFilterList"
                  Text -> [ProductInformationFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [ProductInformationFilter]
productInformationFilterList
              )
          ]
      )