{-# 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.SageMaker.Types.Edge
-- 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.SageMaker.Types.Edge 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
import Amazonka.SageMaker.Types.AssociationEdgeType

-- | A directed edge connecting two lineage entities.
--
-- /See:/ 'newEdge' smart constructor.
data Edge = Edge'
  { -- | The type of the Association(Edge) between the source and destination.
    -- For example @ContributedTo@, @Produced@, or @DerivedFrom@.
    Edge -> Maybe AssociationEdgeType
associationType :: Prelude.Maybe AssociationEdgeType,
    -- | The Amazon Resource Name (ARN) of the destination lineage entity of the
    -- directed edge.
    Edge -> Maybe Text
destinationArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the source lineage entity of the
    -- directed edge.
    Edge -> Maybe Text
sourceArn :: Prelude.Maybe Prelude.Text
  }
  deriving (Edge -> Edge -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Edge -> Edge -> Bool
$c/= :: Edge -> Edge -> Bool
== :: Edge -> Edge -> Bool
$c== :: Edge -> Edge -> Bool
Prelude.Eq, ReadPrec [Edge]
ReadPrec Edge
Int -> ReadS Edge
ReadS [Edge]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Edge]
$creadListPrec :: ReadPrec [Edge]
readPrec :: ReadPrec Edge
$creadPrec :: ReadPrec Edge
readList :: ReadS [Edge]
$creadList :: ReadS [Edge]
readsPrec :: Int -> ReadS Edge
$creadsPrec :: Int -> ReadS Edge
Prelude.Read, Int -> Edge -> ShowS
[Edge] -> ShowS
Edge -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Edge] -> ShowS
$cshowList :: [Edge] -> ShowS
show :: Edge -> String
$cshow :: Edge -> String
showsPrec :: Int -> Edge -> ShowS
$cshowsPrec :: Int -> Edge -> ShowS
Prelude.Show, forall x. Rep Edge x -> Edge
forall x. Edge -> Rep Edge x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Edge x -> Edge
$cfrom :: forall x. Edge -> Rep Edge x
Prelude.Generic)

-- |
-- Create a value of 'Edge' 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:
--
-- 'associationType', 'edge_associationType' - The type of the Association(Edge) between the source and destination.
-- For example @ContributedTo@, @Produced@, or @DerivedFrom@.
--
-- 'destinationArn', 'edge_destinationArn' - The Amazon Resource Name (ARN) of the destination lineage entity of the
-- directed edge.
--
-- 'sourceArn', 'edge_sourceArn' - The Amazon Resource Name (ARN) of the source lineage entity of the
-- directed edge.
newEdge ::
  Edge
newEdge :: Edge
newEdge =
  Edge'
    { $sel:associationType:Edge' :: Maybe AssociationEdgeType
associationType = forall a. Maybe a
Prelude.Nothing,
      $sel:destinationArn:Edge' :: Maybe Text
destinationArn = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceArn:Edge' :: Maybe Text
sourceArn = forall a. Maybe a
Prelude.Nothing
    }

-- | The type of the Association(Edge) between the source and destination.
-- For example @ContributedTo@, @Produced@, or @DerivedFrom@.
edge_associationType :: Lens.Lens' Edge (Prelude.Maybe AssociationEdgeType)
edge_associationType :: Lens' Edge (Maybe AssociationEdgeType)
edge_associationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Edge' {Maybe AssociationEdgeType
associationType :: Maybe AssociationEdgeType
$sel:associationType:Edge' :: Edge -> Maybe AssociationEdgeType
associationType} -> Maybe AssociationEdgeType
associationType) (\s :: Edge
s@Edge' {} Maybe AssociationEdgeType
a -> Edge
s {$sel:associationType:Edge' :: Maybe AssociationEdgeType
associationType = Maybe AssociationEdgeType
a} :: Edge)

-- | The Amazon Resource Name (ARN) of the destination lineage entity of the
-- directed edge.
edge_destinationArn :: Lens.Lens' Edge (Prelude.Maybe Prelude.Text)
edge_destinationArn :: Lens' Edge (Maybe Text)
edge_destinationArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Edge' {Maybe Text
destinationArn :: Maybe Text
$sel:destinationArn:Edge' :: Edge -> Maybe Text
destinationArn} -> Maybe Text
destinationArn) (\s :: Edge
s@Edge' {} Maybe Text
a -> Edge
s {$sel:destinationArn:Edge' :: Maybe Text
destinationArn = Maybe Text
a} :: Edge)

-- | The Amazon Resource Name (ARN) of the source lineage entity of the
-- directed edge.
edge_sourceArn :: Lens.Lens' Edge (Prelude.Maybe Prelude.Text)
edge_sourceArn :: Lens' Edge (Maybe Text)
edge_sourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Edge' {Maybe Text
sourceArn :: Maybe Text
$sel:sourceArn:Edge' :: Edge -> Maybe Text
sourceArn} -> Maybe Text
sourceArn) (\s :: Edge
s@Edge' {} Maybe Text
a -> Edge
s {$sel:sourceArn:Edge' :: Maybe Text
sourceArn = Maybe Text
a} :: Edge)

instance Data.FromJSON Edge where
  parseJSON :: Value -> Parser Edge
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Edge"
      ( \Object
x ->
          Maybe AssociationEdgeType -> Maybe Text -> Maybe Text -> Edge
Edge'
            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
"AssociationType")
            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
"DestinationArn")
            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
"SourceArn")
      )

instance Prelude.Hashable Edge where
  hashWithSalt :: Int -> Edge -> Int
hashWithSalt Int
_salt Edge' {Maybe Text
Maybe AssociationEdgeType
sourceArn :: Maybe Text
destinationArn :: Maybe Text
associationType :: Maybe AssociationEdgeType
$sel:sourceArn:Edge' :: Edge -> Maybe Text
$sel:destinationArn:Edge' :: Edge -> Maybe Text
$sel:associationType:Edge' :: Edge -> Maybe AssociationEdgeType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AssociationEdgeType
associationType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceArn

instance Prelude.NFData Edge where
  rnf :: Edge -> ()
rnf Edge' {Maybe Text
Maybe AssociationEdgeType
sourceArn :: Maybe Text
destinationArn :: Maybe Text
associationType :: Maybe AssociationEdgeType
$sel:sourceArn:Edge' :: Edge -> Maybe Text
$sel:destinationArn:Edge' :: Edge -> Maybe Text
$sel:associationType:Edge' :: Edge -> Maybe AssociationEdgeType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AssociationEdgeType
associationType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destinationArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceArn