{-# 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-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.Inspector.Types.RulesPackage where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(RulesPackage -> RulesPackage -> Bool)
-> (RulesPackage -> RulesPackage -> Bool) -> Eq RulesPackage
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]
(Int -> ReadS RulesPackage)
-> ReadS [RulesPackage]
-> ReadPrec RulesPackage
-> ReadPrec [RulesPackage]
-> Read 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
(Int -> RulesPackage -> ShowS)
-> (RulesPackage -> String)
-> ([RulesPackage] -> ShowS)
-> Show RulesPackage
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. RulesPackage -> Rep RulesPackage x)
-> (forall x. Rep RulesPackage x -> RulesPackage)
-> Generic RulesPackage
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' :: Maybe Text -> Text -> Text -> Text -> Text -> RulesPackage
RulesPackage'
    { $sel:description:RulesPackage' :: Maybe Text
description = Maybe Text
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 :: (Maybe Text -> f (Maybe Text)) -> RulesPackage -> f RulesPackage
rulesPackage_description = (RulesPackage -> Maybe Text)
-> (RulesPackage -> Maybe Text -> RulesPackage)
-> Lens RulesPackage RulesPackage (Maybe Text) (Maybe Text)
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 :: (Text -> f Text) -> RulesPackage -> f RulesPackage
rulesPackage_arn = (RulesPackage -> Text)
-> (RulesPackage -> Text -> RulesPackage)
-> Lens RulesPackage RulesPackage Text Text
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 :: (Text -> f Text) -> RulesPackage -> f RulesPackage
rulesPackage_name = (RulesPackage -> Text)
-> (RulesPackage -> Text -> RulesPackage)
-> Lens RulesPackage RulesPackage Text Text
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 :: (Text -> f Text) -> RulesPackage -> f RulesPackage
rulesPackage_version = (RulesPackage -> Text)
-> (RulesPackage -> Text -> RulesPackage)
-> Lens RulesPackage RulesPackage Text Text
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 :: (Text -> f Text) -> RulesPackage -> f RulesPackage
rulesPackage_provider = (RulesPackage -> Text)
-> (RulesPackage -> Text -> RulesPackage)
-> Lens RulesPackage RulesPackage Text Text
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 Core.FromJSON RulesPackage where
  parseJSON :: Value -> Parser RulesPackage
parseJSON =
    String
-> (Object -> Parser RulesPackage) -> Value -> Parser RulesPackage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RulesPackage"
      ( \Object
x ->
          Maybe Text -> Text -> Text -> Text -> Text -> RulesPackage
RulesPackage'
            (Maybe Text -> Text -> Text -> Text -> Text -> RulesPackage)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> Text -> Text -> RulesPackage)
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
"description")
            Parser (Text -> Text -> Text -> Text -> RulesPackage)
-> Parser Text -> Parser (Text -> Text -> Text -> RulesPackage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"arn")
            Parser (Text -> Text -> Text -> RulesPackage)
-> Parser Text -> Parser (Text -> Text -> RulesPackage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
            Parser (Text -> Text -> RulesPackage)
-> Parser Text -> Parser (Text -> RulesPackage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"version")
            Parser (Text -> RulesPackage) -> Parser Text -> Parser RulesPackage
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"provider")
      )

instance Prelude.Hashable RulesPackage

instance Prelude.NFData RulesPackage