{-# 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.Inspector.Types.RulesPackage
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Inspector.Types.RulesPackage where

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

-- | Contains information about an Amazon Inspector rules package. This data
-- type is used as the response element in the DescribeRulesPackages
-- action.
--
-- /See:/ 'newRulesPackage' smart constructor.
data RulesPackage = RulesPackage'
  { -- | The description of the rules package.
    RulesPackage -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the rules package.
    RulesPackage -> Text
arn :: Prelude.Text,
    -- | The name of the rules package.
    RulesPackage -> Text
name :: Prelude.Text,
    -- | The version ID of the rules package.
    RulesPackage -> Text
version :: Prelude.Text,
    -- | The provider of the rules package.
    RulesPackage -> Text
provider :: Prelude.Text
  }
  deriving (RulesPackage -> RulesPackage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RulesPackage -> RulesPackage -> Bool
$c/= :: RulesPackage -> RulesPackage -> Bool
== :: RulesPackage -> RulesPackage -> Bool
$c== :: RulesPackage -> RulesPackage -> Bool
Prelude.Eq, ReadPrec [RulesPackage]
ReadPrec RulesPackage
Int -> ReadS RulesPackage
ReadS [RulesPackage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RulesPackage]
$creadListPrec :: ReadPrec [RulesPackage]
readPrec :: ReadPrec RulesPackage
$creadPrec :: ReadPrec RulesPackage
readList :: ReadS [RulesPackage]
$creadList :: ReadS [RulesPackage]
readsPrec :: Int -> ReadS RulesPackage
$creadsPrec :: Int -> ReadS RulesPackage
Prelude.Read, Int -> RulesPackage -> ShowS
[RulesPackage] -> ShowS
RulesPackage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RulesPackage] -> ShowS
$cshowList :: [RulesPackage] -> ShowS
show :: RulesPackage -> String
$cshow :: RulesPackage -> String
showsPrec :: Int -> RulesPackage -> ShowS
$cshowsPrec :: Int -> RulesPackage -> ShowS
Prelude.Show, forall x. Rep RulesPackage x -> RulesPackage
forall x. RulesPackage -> Rep RulesPackage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RulesPackage x -> RulesPackage
$cfrom :: forall x. RulesPackage -> Rep RulesPackage x
Prelude.Generic)

-- |
-- Create a value of 'RulesPackage' 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:
--
-- 'description', 'rulesPackage_description' - The description of the rules package.
--
-- 'arn', 'rulesPackage_arn' - The ARN of the rules package.
--
-- 'name', 'rulesPackage_name' - The name of the rules package.
--
-- 'version', 'rulesPackage_version' - The version ID of the rules package.
--
-- 'provider', 'rulesPackage_provider' - The provider of the rules package.
newRulesPackage ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'version'
  Prelude.Text ->
  -- | 'provider'
  Prelude.Text ->
  RulesPackage
newRulesPackage :: Text -> Text -> Text -> Text -> RulesPackage
newRulesPackage Text
pArn_ Text
pName_ Text
pVersion_ Text
pProvider_ =
  RulesPackage'
    { $sel:description:RulesPackage' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:arn:RulesPackage' :: Text
arn = Text
pArn_,
      $sel:name:RulesPackage' :: Text
name = Text
pName_,
      $sel:version:RulesPackage' :: Text
version = Text
pVersion_,
      $sel:provider:RulesPackage' :: Text
provider = Text
pProvider_
    }

-- | The description of the rules package.
rulesPackage_description :: Lens.Lens' RulesPackage (Prelude.Maybe Prelude.Text)
rulesPackage_description :: Lens' RulesPackage (Maybe Text)
rulesPackage_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulesPackage' {Maybe Text
description :: Maybe Text
$sel:description:RulesPackage' :: RulesPackage -> Maybe Text
description} -> Maybe Text
description) (\s :: RulesPackage
s@RulesPackage' {} Maybe Text
a -> RulesPackage
s {$sel:description:RulesPackage' :: Maybe Text
description = Maybe Text
a} :: RulesPackage)

-- | The ARN of the rules package.
rulesPackage_arn :: Lens.Lens' RulesPackage Prelude.Text
rulesPackage_arn :: Lens' RulesPackage Text
rulesPackage_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulesPackage' {Text
arn :: Text
$sel:arn:RulesPackage' :: RulesPackage -> Text
arn} -> Text
arn) (\s :: RulesPackage
s@RulesPackage' {} Text
a -> RulesPackage
s {$sel:arn:RulesPackage' :: Text
arn = Text
a} :: RulesPackage)

-- | The name of the rules package.
rulesPackage_name :: Lens.Lens' RulesPackage Prelude.Text
rulesPackage_name :: Lens' RulesPackage Text
rulesPackage_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulesPackage' {Text
name :: Text
$sel:name:RulesPackage' :: RulesPackage -> Text
name} -> Text
name) (\s :: RulesPackage
s@RulesPackage' {} Text
a -> RulesPackage
s {$sel:name:RulesPackage' :: Text
name = Text
a} :: RulesPackage)

-- | The version ID of the rules package.
rulesPackage_version :: Lens.Lens' RulesPackage Prelude.Text
rulesPackage_version :: Lens' RulesPackage Text
rulesPackage_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulesPackage' {Text
version :: Text
$sel:version:RulesPackage' :: RulesPackage -> Text
version} -> Text
version) (\s :: RulesPackage
s@RulesPackage' {} Text
a -> RulesPackage
s {$sel:version:RulesPackage' :: Text
version = Text
a} :: RulesPackage)

-- | The provider of the rules package.
rulesPackage_provider :: Lens.Lens' RulesPackage Prelude.Text
rulesPackage_provider :: Lens' RulesPackage Text
rulesPackage_provider = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RulesPackage' {Text
provider :: Text
$sel:provider:RulesPackage' :: RulesPackage -> Text
provider} -> Text
provider) (\s :: RulesPackage
s@RulesPackage' {} Text
a -> RulesPackage
s {$sel:provider:RulesPackage' :: Text
provider = Text
a} :: RulesPackage)

instance Data.FromJSON RulesPackage where
  parseJSON :: Value -> Parser RulesPackage
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RulesPackage"
      ( \Object
x ->
          Maybe Text -> Text -> Text -> Text -> Text -> RulesPackage
RulesPackage'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"version")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"provider")
      )

instance Prelude.Hashable RulesPackage where
  hashWithSalt :: Int -> RulesPackage -> Int
hashWithSalt Int
_salt RulesPackage' {Maybe Text
Text
provider :: Text
version :: Text
name :: Text
arn :: Text
description :: Maybe Text
$sel:provider:RulesPackage' :: RulesPackage -> Text
$sel:version:RulesPackage' :: RulesPackage -> Text
$sel:name:RulesPackage' :: RulesPackage -> Text
$sel:arn:RulesPackage' :: RulesPackage -> Text
$sel:description:RulesPackage' :: RulesPackage -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
version
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
provider

instance Prelude.NFData RulesPackage where
  rnf :: RulesPackage -> ()
rnf RulesPackage' {Maybe Text
Text
provider :: Text
version :: Text
name :: Text
arn :: Text
description :: Maybe Text
$sel:provider:RulesPackage' :: RulesPackage -> Text
$sel:version:RulesPackage' :: RulesPackage -> Text
$sel:name:RulesPackage' :: RulesPackage -> Text
$sel:arn:RulesPackage' :: RulesPackage -> Text
$sel:description:RulesPackage' :: RulesPackage -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
version
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
provider