{-# 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.Detective.Types.Graph
-- 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.Detective.Types.Graph 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

-- | A behavior graph in Detective.
--
-- /See:/ 'newGraph' smart constructor.
data Graph = Graph'
  { -- | The ARN of the behavior graph.
    Graph -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the behavior graph was created. The value is an
    -- ISO8601 formatted string. For example, @2021-08-18T16:35:56.284Z@.
    Graph -> Maybe ISO8601
createdTime :: Prelude.Maybe Data.ISO8601
  }
  deriving (Graph -> Graph -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Graph -> Graph -> Bool
$c/= :: Graph -> Graph -> Bool
== :: Graph -> Graph -> Bool
$c== :: Graph -> Graph -> Bool
Prelude.Eq, ReadPrec [Graph]
ReadPrec Graph
Int -> ReadS Graph
ReadS [Graph]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Graph]
$creadListPrec :: ReadPrec [Graph]
readPrec :: ReadPrec Graph
$creadPrec :: ReadPrec Graph
readList :: ReadS [Graph]
$creadList :: ReadS [Graph]
readsPrec :: Int -> ReadS Graph
$creadsPrec :: Int -> ReadS Graph
Prelude.Read, Int -> Graph -> ShowS
[Graph] -> ShowS
Graph -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Graph] -> ShowS
$cshowList :: [Graph] -> ShowS
show :: Graph -> String
$cshow :: Graph -> String
showsPrec :: Int -> Graph -> ShowS
$cshowsPrec :: Int -> Graph -> ShowS
Prelude.Show, forall x. Rep Graph x -> Graph
forall x. Graph -> Rep Graph x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Graph x -> Graph
$cfrom :: forall x. Graph -> Rep Graph x
Prelude.Generic)

-- |
-- Create a value of 'Graph' 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:
--
-- 'arn', 'graph_arn' - The ARN of the behavior graph.
--
-- 'createdTime', 'graph_createdTime' - The date and time that the behavior graph was created. The value is an
-- ISO8601 formatted string. For example, @2021-08-18T16:35:56.284Z@.
newGraph ::
  Graph
newGraph :: Graph
newGraph =
  Graph'
    { $sel:arn:Graph' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:Graph' :: Maybe ISO8601
createdTime = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the behavior graph.
graph_arn :: Lens.Lens' Graph (Prelude.Maybe Prelude.Text)
graph_arn :: Lens' Graph (Maybe Text)
graph_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Graph' {Maybe Text
arn :: Maybe Text
$sel:arn:Graph' :: Graph -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Graph
s@Graph' {} Maybe Text
a -> Graph
s {$sel:arn:Graph' :: Maybe Text
arn = Maybe Text
a} :: Graph)

-- | The date and time that the behavior graph was created. The value is an
-- ISO8601 formatted string. For example, @2021-08-18T16:35:56.284Z@.
graph_createdTime :: Lens.Lens' Graph (Prelude.Maybe Prelude.UTCTime)
graph_createdTime :: Lens' Graph (Maybe UTCTime)
graph_createdTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Graph' {Maybe ISO8601
createdTime :: Maybe ISO8601
$sel:createdTime:Graph' :: Graph -> Maybe ISO8601
createdTime} -> Maybe ISO8601
createdTime) (\s :: Graph
s@Graph' {} Maybe ISO8601
a -> Graph
s {$sel:createdTime:Graph' :: Maybe ISO8601
createdTime = Maybe ISO8601
a} :: Graph) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON Graph where
  parseJSON :: Value -> Parser Graph
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Graph"
      ( \Object
x ->
          Maybe Text -> Maybe ISO8601 -> Graph
Graph'
            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
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CreatedTime")
      )

instance Prelude.Hashable Graph where
  hashWithSalt :: Int -> Graph -> Int
hashWithSalt Int
_salt Graph' {Maybe Text
Maybe ISO8601
createdTime :: Maybe ISO8601
arn :: Maybe Text
$sel:createdTime:Graph' :: Graph -> Maybe ISO8601
$sel:arn:Graph' :: Graph -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
createdTime

instance Prelude.NFData Graph where
  rnf :: Graph -> ()
rnf Graph' {Maybe Text
Maybe ISO8601
createdTime :: Maybe ISO8601
arn :: Maybe Text
$sel:createdTime:Graph' :: Graph -> Maybe ISO8601
$sel:arn:Graph' :: Graph -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
createdTime