{-# 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.Pipes.Types.Pipe
-- 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.Pipes.Types.Pipe where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pipes.Types.PipeState
import Amazonka.Pipes.Types.RequestedPipeState
import qualified Amazonka.Prelude as Prelude

-- | An object that represents a pipe. Amazon EventBridgePipes connect event
-- sources to targets and reduces the need for specialized knowledge and
-- integration code.
--
-- /See:/ 'newPipe' smart constructor.
data Pipe = Pipe'
  { -- | The ARN of the pipe.
    Pipe -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The time the pipe was created.
    Pipe -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | The state the pipe is in.
    Pipe -> Maybe PipeState
currentState :: Prelude.Maybe PipeState,
    -- | The state the pipe should be in.
    Pipe -> Maybe RequestedPipeState
desiredState :: Prelude.Maybe RequestedPipeState,
    -- | The ARN of the enrichment resource.
    Pipe -> Maybe Text
enrichment :: Prelude.Maybe Prelude.Text,
    -- | When the pipe was last updated, in
    -- <https://www.w3.org/TR/NOTE-datetime ISO-8601 format>
    -- (YYYY-MM-DDThh:mm:ss.sTZD).
    Pipe -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Data.POSIX,
    -- | The name of the pipe.
    Pipe -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the source resource.
    Pipe -> Maybe Text
source :: Prelude.Maybe Prelude.Text,
    -- | The reason the pipe is in its current state.
    Pipe -> Maybe Text
stateReason :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the target resource.
    Pipe -> Maybe Text
target :: Prelude.Maybe Prelude.Text
  }
  deriving (Pipe -> Pipe -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Pipe -> Pipe -> Bool
$c/= :: Pipe -> Pipe -> Bool
== :: Pipe -> Pipe -> Bool
$c== :: Pipe -> Pipe -> Bool
Prelude.Eq, ReadPrec [Pipe]
ReadPrec Pipe
Int -> ReadS Pipe
ReadS [Pipe]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Pipe]
$creadListPrec :: ReadPrec [Pipe]
readPrec :: ReadPrec Pipe
$creadPrec :: ReadPrec Pipe
readList :: ReadS [Pipe]
$creadList :: ReadS [Pipe]
readsPrec :: Int -> ReadS Pipe
$creadsPrec :: Int -> ReadS Pipe
Prelude.Read, Int -> Pipe -> ShowS
[Pipe] -> ShowS
Pipe -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Pipe] -> ShowS
$cshowList :: [Pipe] -> ShowS
show :: Pipe -> String
$cshow :: Pipe -> String
showsPrec :: Int -> Pipe -> ShowS
$cshowsPrec :: Int -> Pipe -> ShowS
Prelude.Show, forall x. Rep Pipe x -> Pipe
forall x. Pipe -> Rep Pipe x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Pipe x -> Pipe
$cfrom :: forall x. Pipe -> Rep Pipe x
Prelude.Generic)

-- |
-- Create a value of 'Pipe' 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', 'pipe_arn' - The ARN of the pipe.
--
-- 'creationTime', 'pipe_creationTime' - The time the pipe was created.
--
-- 'currentState', 'pipe_currentState' - The state the pipe is in.
--
-- 'desiredState', 'pipe_desiredState' - The state the pipe should be in.
--
-- 'enrichment', 'pipe_enrichment' - The ARN of the enrichment resource.
--
-- 'lastModifiedTime', 'pipe_lastModifiedTime' - When the pipe was last updated, in
-- <https://www.w3.org/TR/NOTE-datetime ISO-8601 format>
-- (YYYY-MM-DDThh:mm:ss.sTZD).
--
-- 'name', 'pipe_name' - The name of the pipe.
--
-- 'source', 'pipe_source' - The ARN of the source resource.
--
-- 'stateReason', 'pipe_stateReason' - The reason the pipe is in its current state.
--
-- 'target', 'pipe_target' - The ARN of the target resource.
newPipe ::
  Pipe
newPipe :: Pipe
newPipe =
  Pipe'
    { $sel:arn:Pipe' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:creationTime:Pipe' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:currentState:Pipe' :: Maybe PipeState
currentState = forall a. Maybe a
Prelude.Nothing,
      $sel:desiredState:Pipe' :: Maybe RequestedPipeState
desiredState = forall a. Maybe a
Prelude.Nothing,
      $sel:enrichment:Pipe' :: Maybe Text
enrichment = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:Pipe' :: Maybe POSIX
lastModifiedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Pipe' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:source:Pipe' :: Maybe Text
source = forall a. Maybe a
Prelude.Nothing,
      $sel:stateReason:Pipe' :: Maybe Text
stateReason = forall a. Maybe a
Prelude.Nothing,
      $sel:target:Pipe' :: Maybe Text
target = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The time the pipe was created.
pipe_creationTime :: Lens.Lens' Pipe (Prelude.Maybe Prelude.UTCTime)
pipe_creationTime :: Lens' Pipe (Maybe UTCTime)
pipe_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pipe' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:Pipe' :: Pipe -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: Pipe
s@Pipe' {} Maybe POSIX
a -> Pipe
s {$sel:creationTime:Pipe' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: Pipe) 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

-- | The state the pipe is in.
pipe_currentState :: Lens.Lens' Pipe (Prelude.Maybe PipeState)
pipe_currentState :: Lens' Pipe (Maybe PipeState)
pipe_currentState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pipe' {Maybe PipeState
currentState :: Maybe PipeState
$sel:currentState:Pipe' :: Pipe -> Maybe PipeState
currentState} -> Maybe PipeState
currentState) (\s :: Pipe
s@Pipe' {} Maybe PipeState
a -> Pipe
s {$sel:currentState:Pipe' :: Maybe PipeState
currentState = Maybe PipeState
a} :: Pipe)

-- | The state the pipe should be in.
pipe_desiredState :: Lens.Lens' Pipe (Prelude.Maybe RequestedPipeState)
pipe_desiredState :: Lens' Pipe (Maybe RequestedPipeState)
pipe_desiredState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pipe' {Maybe RequestedPipeState
desiredState :: Maybe RequestedPipeState
$sel:desiredState:Pipe' :: Pipe -> Maybe RequestedPipeState
desiredState} -> Maybe RequestedPipeState
desiredState) (\s :: Pipe
s@Pipe' {} Maybe RequestedPipeState
a -> Pipe
s {$sel:desiredState:Pipe' :: Maybe RequestedPipeState
desiredState = Maybe RequestedPipeState
a} :: Pipe)

-- | The ARN of the enrichment resource.
pipe_enrichment :: Lens.Lens' Pipe (Prelude.Maybe Prelude.Text)
pipe_enrichment :: Lens' Pipe (Maybe Text)
pipe_enrichment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pipe' {Maybe Text
enrichment :: Maybe Text
$sel:enrichment:Pipe' :: Pipe -> Maybe Text
enrichment} -> Maybe Text
enrichment) (\s :: Pipe
s@Pipe' {} Maybe Text
a -> Pipe
s {$sel:enrichment:Pipe' :: Maybe Text
enrichment = Maybe Text
a} :: Pipe)

-- | When the pipe was last updated, in
-- <https://www.w3.org/TR/NOTE-datetime ISO-8601 format>
-- (YYYY-MM-DDThh:mm:ss.sTZD).
pipe_lastModifiedTime :: Lens.Lens' Pipe (Prelude.Maybe Prelude.UTCTime)
pipe_lastModifiedTime :: Lens' Pipe (Maybe UTCTime)
pipe_lastModifiedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pipe' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:Pipe' :: Pipe -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: Pipe
s@Pipe' {} Maybe POSIX
a -> Pipe
s {$sel:lastModifiedTime:Pipe' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: Pipe) 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

-- | The name of the pipe.
pipe_name :: Lens.Lens' Pipe (Prelude.Maybe Prelude.Text)
pipe_name :: Lens' Pipe (Maybe Text)
pipe_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pipe' {Maybe Text
name :: Maybe Text
$sel:name:Pipe' :: Pipe -> Maybe Text
name} -> Maybe Text
name) (\s :: Pipe
s@Pipe' {} Maybe Text
a -> Pipe
s {$sel:name:Pipe' :: Maybe Text
name = Maybe Text
a} :: Pipe)

-- | The ARN of the source resource.
pipe_source :: Lens.Lens' Pipe (Prelude.Maybe Prelude.Text)
pipe_source :: Lens' Pipe (Maybe Text)
pipe_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pipe' {Maybe Text
source :: Maybe Text
$sel:source:Pipe' :: Pipe -> Maybe Text
source} -> Maybe Text
source) (\s :: Pipe
s@Pipe' {} Maybe Text
a -> Pipe
s {$sel:source:Pipe' :: Maybe Text
source = Maybe Text
a} :: Pipe)

-- | The reason the pipe is in its current state.
pipe_stateReason :: Lens.Lens' Pipe (Prelude.Maybe Prelude.Text)
pipe_stateReason :: Lens' Pipe (Maybe Text)
pipe_stateReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pipe' {Maybe Text
stateReason :: Maybe Text
$sel:stateReason:Pipe' :: Pipe -> Maybe Text
stateReason} -> Maybe Text
stateReason) (\s :: Pipe
s@Pipe' {} Maybe Text
a -> Pipe
s {$sel:stateReason:Pipe' :: Maybe Text
stateReason = Maybe Text
a} :: Pipe)

-- | The ARN of the target resource.
pipe_target :: Lens.Lens' Pipe (Prelude.Maybe Prelude.Text)
pipe_target :: Lens' Pipe (Maybe Text)
pipe_target = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pipe' {Maybe Text
target :: Maybe Text
$sel:target:Pipe' :: Pipe -> Maybe Text
target} -> Maybe Text
target) (\s :: Pipe
s@Pipe' {} Maybe Text
a -> Pipe
s {$sel:target:Pipe' :: Maybe Text
target = Maybe Text
a} :: Pipe)

instance Data.FromJSON Pipe where
  parseJSON :: Value -> Parser Pipe
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Pipe"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe PipeState
-> Maybe RequestedPipeState
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Pipe
Pipe'
            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
"CreationTime")
            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
"CurrentState")
            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
"DesiredState")
            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
"Enrichment")
            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
"LastModifiedTime")
            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
"Name")
            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
"Source")
            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
"StateReason")
            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
"Target")
      )

instance Prelude.Hashable Pipe where
  hashWithSalt :: Int -> Pipe -> Int
hashWithSalt Int
_salt Pipe' {Maybe Text
Maybe POSIX
Maybe PipeState
Maybe RequestedPipeState
target :: Maybe Text
stateReason :: Maybe Text
source :: Maybe Text
name :: Maybe Text
lastModifiedTime :: Maybe POSIX
enrichment :: Maybe Text
desiredState :: Maybe RequestedPipeState
currentState :: Maybe PipeState
creationTime :: Maybe POSIX
arn :: Maybe Text
$sel:target:Pipe' :: Pipe -> Maybe Text
$sel:stateReason:Pipe' :: Pipe -> Maybe Text
$sel:source:Pipe' :: Pipe -> Maybe Text
$sel:name:Pipe' :: Pipe -> Maybe Text
$sel:lastModifiedTime:Pipe' :: Pipe -> Maybe POSIX
$sel:enrichment:Pipe' :: Pipe -> Maybe Text
$sel:desiredState:Pipe' :: Pipe -> Maybe RequestedPipeState
$sel:currentState:Pipe' :: Pipe -> Maybe PipeState
$sel:creationTime:Pipe' :: Pipe -> Maybe POSIX
$sel:arn:Pipe' :: Pipe -> 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 POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PipeState
currentState
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RequestedPipeState
desiredState
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
enrichment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModifiedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
source
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stateReason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
target

instance Prelude.NFData Pipe where
  rnf :: Pipe -> ()
rnf Pipe' {Maybe Text
Maybe POSIX
Maybe PipeState
Maybe RequestedPipeState
target :: Maybe Text
stateReason :: Maybe Text
source :: Maybe Text
name :: Maybe Text
lastModifiedTime :: Maybe POSIX
enrichment :: Maybe Text
desiredState :: Maybe RequestedPipeState
currentState :: Maybe PipeState
creationTime :: Maybe POSIX
arn :: Maybe Text
$sel:target:Pipe' :: Pipe -> Maybe Text
$sel:stateReason:Pipe' :: Pipe -> Maybe Text
$sel:source:Pipe' :: Pipe -> Maybe Text
$sel:name:Pipe' :: Pipe -> Maybe Text
$sel:lastModifiedTime:Pipe' :: Pipe -> Maybe POSIX
$sel:enrichment:Pipe' :: Pipe -> Maybe Text
$sel:desiredState:Pipe' :: Pipe -> Maybe RequestedPipeState
$sel:currentState:Pipe' :: Pipe -> Maybe PipeState
$sel:creationTime:Pipe' :: Pipe -> Maybe POSIX
$sel:arn:Pipe' :: Pipe -> 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 POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PipeState
currentState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RequestedPipeState
desiredState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
enrichment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
source
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stateReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
target