{-# 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.SecurityHub.Types.VulnerabilityVendor
-- 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.SecurityHub.Types.VulnerabilityVendor where

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

-- | A vendor that generates a vulnerability report.
--
-- /See:/ 'newVulnerabilityVendor' smart constructor.
data VulnerabilityVendor = VulnerabilityVendor'
  { -- | The severity that the vendor assigned to the vulnerability.
    VulnerabilityVendor -> Maybe Text
vendorSeverity :: Prelude.Maybe Prelude.Text,
    -- | The URL of the vulnerability advisory.
    VulnerabilityVendor -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | Indicates when the vulnerability advisory was created.
    --
    -- Uses the @date-time@ format specified in
    -- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
    -- The value cannot contain spaces. For example,
    -- @2020-03-22T13:22:13.933Z@.
    VulnerabilityVendor -> Maybe Text
vendorCreatedAt :: Prelude.Maybe Prelude.Text,
    -- | Indicates when the vulnerability advisory was last updated.
    --
    -- Uses the @date-time@ format specified in
    -- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
    -- The value cannot contain spaces. For example,
    -- @2020-03-22T13:22:13.933Z@.
    VulnerabilityVendor -> Maybe Text
vendorUpdatedAt :: Prelude.Maybe Prelude.Text,
    -- | The name of the vendor.
    VulnerabilityVendor -> Text
name :: Prelude.Text
  }
  deriving (VulnerabilityVendor -> VulnerabilityVendor -> Bool
(VulnerabilityVendor -> VulnerabilityVendor -> Bool)
-> (VulnerabilityVendor -> VulnerabilityVendor -> Bool)
-> Eq VulnerabilityVendor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VulnerabilityVendor -> VulnerabilityVendor -> Bool
$c/= :: VulnerabilityVendor -> VulnerabilityVendor -> Bool
== :: VulnerabilityVendor -> VulnerabilityVendor -> Bool
$c== :: VulnerabilityVendor -> VulnerabilityVendor -> Bool
Prelude.Eq, ReadPrec [VulnerabilityVendor]
ReadPrec VulnerabilityVendor
Int -> ReadS VulnerabilityVendor
ReadS [VulnerabilityVendor]
(Int -> ReadS VulnerabilityVendor)
-> ReadS [VulnerabilityVendor]
-> ReadPrec VulnerabilityVendor
-> ReadPrec [VulnerabilityVendor]
-> Read VulnerabilityVendor
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VulnerabilityVendor]
$creadListPrec :: ReadPrec [VulnerabilityVendor]
readPrec :: ReadPrec VulnerabilityVendor
$creadPrec :: ReadPrec VulnerabilityVendor
readList :: ReadS [VulnerabilityVendor]
$creadList :: ReadS [VulnerabilityVendor]
readsPrec :: Int -> ReadS VulnerabilityVendor
$creadsPrec :: Int -> ReadS VulnerabilityVendor
Prelude.Read, Int -> VulnerabilityVendor -> ShowS
[VulnerabilityVendor] -> ShowS
VulnerabilityVendor -> String
(Int -> VulnerabilityVendor -> ShowS)
-> (VulnerabilityVendor -> String)
-> ([VulnerabilityVendor] -> ShowS)
-> Show VulnerabilityVendor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VulnerabilityVendor] -> ShowS
$cshowList :: [VulnerabilityVendor] -> ShowS
show :: VulnerabilityVendor -> String
$cshow :: VulnerabilityVendor -> String
showsPrec :: Int -> VulnerabilityVendor -> ShowS
$cshowsPrec :: Int -> VulnerabilityVendor -> ShowS
Prelude.Show, (forall x. VulnerabilityVendor -> Rep VulnerabilityVendor x)
-> (forall x. Rep VulnerabilityVendor x -> VulnerabilityVendor)
-> Generic VulnerabilityVendor
forall x. Rep VulnerabilityVendor x -> VulnerabilityVendor
forall x. VulnerabilityVendor -> Rep VulnerabilityVendor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VulnerabilityVendor x -> VulnerabilityVendor
$cfrom :: forall x. VulnerabilityVendor -> Rep VulnerabilityVendor x
Prelude.Generic)

-- |
-- Create a value of 'VulnerabilityVendor' 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:
--
-- 'vendorSeverity', 'vulnerabilityVendor_vendorSeverity' - The severity that the vendor assigned to the vulnerability.
--
-- 'url', 'vulnerabilityVendor_url' - The URL of the vulnerability advisory.
--
-- 'vendorCreatedAt', 'vulnerabilityVendor_vendorCreatedAt' - Indicates when the vulnerability advisory was created.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
--
-- 'vendorUpdatedAt', 'vulnerabilityVendor_vendorUpdatedAt' - Indicates when the vulnerability advisory was last updated.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
--
-- 'name', 'vulnerabilityVendor_name' - The name of the vendor.
newVulnerabilityVendor ::
  -- | 'name'
  Prelude.Text ->
  VulnerabilityVendor
newVulnerabilityVendor :: Text -> VulnerabilityVendor
newVulnerabilityVendor Text
pName_ =
  VulnerabilityVendor' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> VulnerabilityVendor
VulnerabilityVendor'
    { $sel:vendorSeverity:VulnerabilityVendor' :: Maybe Text
vendorSeverity =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:url:VulnerabilityVendor' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:vendorCreatedAt:VulnerabilityVendor' :: Maybe Text
vendorCreatedAt = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:vendorUpdatedAt:VulnerabilityVendor' :: Maybe Text
vendorUpdatedAt = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:VulnerabilityVendor' :: Text
name = Text
pName_
    }

-- | The severity that the vendor assigned to the vulnerability.
vulnerabilityVendor_vendorSeverity :: Lens.Lens' VulnerabilityVendor (Prelude.Maybe Prelude.Text)
vulnerabilityVendor_vendorSeverity :: (Maybe Text -> f (Maybe Text))
-> VulnerabilityVendor -> f VulnerabilityVendor
vulnerabilityVendor_vendorSeverity = (VulnerabilityVendor -> Maybe Text)
-> (VulnerabilityVendor -> Maybe Text -> VulnerabilityVendor)
-> Lens
     VulnerabilityVendor VulnerabilityVendor (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VulnerabilityVendor' {Maybe Text
vendorSeverity :: Maybe Text
$sel:vendorSeverity:VulnerabilityVendor' :: VulnerabilityVendor -> Maybe Text
vendorSeverity} -> Maybe Text
vendorSeverity) (\s :: VulnerabilityVendor
s@VulnerabilityVendor' {} Maybe Text
a -> VulnerabilityVendor
s {$sel:vendorSeverity:VulnerabilityVendor' :: Maybe Text
vendorSeverity = Maybe Text
a} :: VulnerabilityVendor)

-- | The URL of the vulnerability advisory.
vulnerabilityVendor_url :: Lens.Lens' VulnerabilityVendor (Prelude.Maybe Prelude.Text)
vulnerabilityVendor_url :: (Maybe Text -> f (Maybe Text))
-> VulnerabilityVendor -> f VulnerabilityVendor
vulnerabilityVendor_url = (VulnerabilityVendor -> Maybe Text)
-> (VulnerabilityVendor -> Maybe Text -> VulnerabilityVendor)
-> Lens
     VulnerabilityVendor VulnerabilityVendor (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VulnerabilityVendor' {Maybe Text
url :: Maybe Text
$sel:url:VulnerabilityVendor' :: VulnerabilityVendor -> Maybe Text
url} -> Maybe Text
url) (\s :: VulnerabilityVendor
s@VulnerabilityVendor' {} Maybe Text
a -> VulnerabilityVendor
s {$sel:url:VulnerabilityVendor' :: Maybe Text
url = Maybe Text
a} :: VulnerabilityVendor)

-- | Indicates when the vulnerability advisory was created.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
vulnerabilityVendor_vendorCreatedAt :: Lens.Lens' VulnerabilityVendor (Prelude.Maybe Prelude.Text)
vulnerabilityVendor_vendorCreatedAt :: (Maybe Text -> f (Maybe Text))
-> VulnerabilityVendor -> f VulnerabilityVendor
vulnerabilityVendor_vendorCreatedAt = (VulnerabilityVendor -> Maybe Text)
-> (VulnerabilityVendor -> Maybe Text -> VulnerabilityVendor)
-> Lens
     VulnerabilityVendor VulnerabilityVendor (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VulnerabilityVendor' {Maybe Text
vendorCreatedAt :: Maybe Text
$sel:vendorCreatedAt:VulnerabilityVendor' :: VulnerabilityVendor -> Maybe Text
vendorCreatedAt} -> Maybe Text
vendorCreatedAt) (\s :: VulnerabilityVendor
s@VulnerabilityVendor' {} Maybe Text
a -> VulnerabilityVendor
s {$sel:vendorCreatedAt:VulnerabilityVendor' :: Maybe Text
vendorCreatedAt = Maybe Text
a} :: VulnerabilityVendor)

-- | Indicates when the vulnerability advisory was last updated.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
vulnerabilityVendor_vendorUpdatedAt :: Lens.Lens' VulnerabilityVendor (Prelude.Maybe Prelude.Text)
vulnerabilityVendor_vendorUpdatedAt :: (Maybe Text -> f (Maybe Text))
-> VulnerabilityVendor -> f VulnerabilityVendor
vulnerabilityVendor_vendorUpdatedAt = (VulnerabilityVendor -> Maybe Text)
-> (VulnerabilityVendor -> Maybe Text -> VulnerabilityVendor)
-> Lens
     VulnerabilityVendor VulnerabilityVendor (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VulnerabilityVendor' {Maybe Text
vendorUpdatedAt :: Maybe Text
$sel:vendorUpdatedAt:VulnerabilityVendor' :: VulnerabilityVendor -> Maybe Text
vendorUpdatedAt} -> Maybe Text
vendorUpdatedAt) (\s :: VulnerabilityVendor
s@VulnerabilityVendor' {} Maybe Text
a -> VulnerabilityVendor
s {$sel:vendorUpdatedAt:VulnerabilityVendor' :: Maybe Text
vendorUpdatedAt = Maybe Text
a} :: VulnerabilityVendor)

-- | The name of the vendor.
vulnerabilityVendor_name :: Lens.Lens' VulnerabilityVendor Prelude.Text
vulnerabilityVendor_name :: (Text -> f Text) -> VulnerabilityVendor -> f VulnerabilityVendor
vulnerabilityVendor_name = (VulnerabilityVendor -> Text)
-> (VulnerabilityVendor -> Text -> VulnerabilityVendor)
-> Lens VulnerabilityVendor VulnerabilityVendor Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VulnerabilityVendor' {Text
name :: Text
$sel:name:VulnerabilityVendor' :: VulnerabilityVendor -> Text
name} -> Text
name) (\s :: VulnerabilityVendor
s@VulnerabilityVendor' {} Text
a -> VulnerabilityVendor
s {$sel:name:VulnerabilityVendor' :: Text
name = Text
a} :: VulnerabilityVendor)

instance Core.FromJSON VulnerabilityVendor where
  parseJSON :: Value -> Parser VulnerabilityVendor
parseJSON =
    String
-> (Object -> Parser VulnerabilityVendor)
-> Value
-> Parser VulnerabilityVendor
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VulnerabilityVendor"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> VulnerabilityVendor
VulnerabilityVendor'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Text
 -> VulnerabilityVendor)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Text -> VulnerabilityVendor)
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
"VendorSeverity")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Text -> VulnerabilityVendor)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Text -> VulnerabilityVendor)
forall (f :: * -> *) a b. Applicative f => 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
"Url")
            Parser (Maybe Text -> Maybe Text -> Text -> VulnerabilityVendor)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> VulnerabilityVendor)
forall (f :: * -> *) a b. Applicative f => 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
"VendorCreatedAt")
            Parser (Maybe Text -> Text -> VulnerabilityVendor)
-> Parser (Maybe Text) -> Parser (Text -> VulnerabilityVendor)
forall (f :: * -> *) a b. Applicative f => 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
"VendorUpdatedAt")
            Parser (Text -> VulnerabilityVendor)
-> Parser Text -> Parser VulnerabilityVendor
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")
      )

instance Prelude.Hashable VulnerabilityVendor

instance Prelude.NFData VulnerabilityVendor

instance Core.ToJSON VulnerabilityVendor where
  toJSON :: VulnerabilityVendor -> Value
toJSON VulnerabilityVendor' {Maybe Text
Text
name :: Text
vendorUpdatedAt :: Maybe Text
vendorCreatedAt :: Maybe Text
url :: Maybe Text
vendorSeverity :: Maybe Text
$sel:name:VulnerabilityVendor' :: VulnerabilityVendor -> Text
$sel:vendorUpdatedAt:VulnerabilityVendor' :: VulnerabilityVendor -> Maybe Text
$sel:vendorCreatedAt:VulnerabilityVendor' :: VulnerabilityVendor -> Maybe Text
$sel:url:VulnerabilityVendor' :: VulnerabilityVendor -> Maybe Text
$sel:vendorSeverity:VulnerabilityVendor' :: VulnerabilityVendor -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"VendorSeverity" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
vendorSeverity,
            (Text
"Url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
url,
            (Text
"VendorCreatedAt" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
vendorCreatedAt,
            (Text
"VendorUpdatedAt" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
vendorUpdatedAt,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )