{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreatePipe
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Create a pipe. Amazon EventBridge Pipes connect event sources to targets
-- and reduces the need for specialized knowledge and integration code.
module Amazonka.Pipes.CreatePipe
  ( -- * Creating a Request
    CreatePipe (..),
    newCreatePipe,

    -- * Request Lenses
    createPipe_description,
    createPipe_desiredState,
    createPipe_enrichment,
    createPipe_enrichmentParameters,
    createPipe_sourceParameters,
    createPipe_tags,
    createPipe_targetParameters,
    createPipe_name,
    createPipe_roleArn,
    createPipe_source,
    createPipe_target,

    -- * Destructuring the Response
    CreatePipeResponse (..),
    newCreatePipeResponse,

    -- * Response Lenses
    createPipeResponse_arn,
    createPipeResponse_creationTime,
    createPipeResponse_currentState,
    createPipeResponse_desiredState,
    createPipeResponse_lastModifiedTime,
    createPipeResponse_name,
    createPipeResponse_httpStatus,
  )
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
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreatePipe' smart constructor.
data CreatePipe = CreatePipe'
  { -- | A description of the pipe.
    CreatePipe -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The state the pipe should be in.
    CreatePipe -> Maybe RequestedPipeState
desiredState :: Prelude.Maybe RequestedPipeState,
    -- | The ARN of the enrichment resource.
    CreatePipe -> Maybe Text
enrichment :: Prelude.Maybe Prelude.Text,
    -- | The parameters required to set up enrichment on your pipe.
    CreatePipe -> Maybe PipeEnrichmentParameters
enrichmentParameters :: Prelude.Maybe PipeEnrichmentParameters,
    -- | The parameters required to set up a source for your pipe.
    CreatePipe -> Maybe PipeSourceParameters
sourceParameters :: Prelude.Maybe PipeSourceParameters,
    -- | The list of key-value pairs to associate with the pipe.
    CreatePipe -> Maybe (HashMap Text (Sensitive Text))
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text (Data.Sensitive Prelude.Text)),
    -- | The parameters required to set up a target for your pipe.
    CreatePipe -> Maybe PipeTargetParameters
targetParameters :: Prelude.Maybe PipeTargetParameters,
    -- | The name of the pipe.
    CreatePipe -> Text
name :: Prelude.Text,
    -- | The ARN of the role that allows the pipe to send data to the target.
    CreatePipe -> Text
roleArn :: Prelude.Text,
    -- | The ARN of the source resource.
    CreatePipe -> Text
source :: Prelude.Text,
    -- | The ARN of the target resource.
    CreatePipe -> Text
target :: Prelude.Text
  }
  deriving (CreatePipe -> CreatePipe -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePipe -> CreatePipe -> Bool
$c/= :: CreatePipe -> CreatePipe -> Bool
== :: CreatePipe -> CreatePipe -> Bool
$c== :: CreatePipe -> CreatePipe -> Bool
Prelude.Eq, Int -> CreatePipe -> ShowS
[CreatePipe] -> ShowS
CreatePipe -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePipe] -> ShowS
$cshowList :: [CreatePipe] -> ShowS
show :: CreatePipe -> String
$cshow :: CreatePipe -> String
showsPrec :: Int -> CreatePipe -> ShowS
$cshowsPrec :: Int -> CreatePipe -> ShowS
Prelude.Show, forall x. Rep CreatePipe x -> CreatePipe
forall x. CreatePipe -> Rep CreatePipe x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePipe x -> CreatePipe
$cfrom :: forall x. CreatePipe -> Rep CreatePipe x
Prelude.Generic)

-- |
-- Create a value of 'CreatePipe' 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', 'createPipe_description' - A description of the pipe.
--
-- 'desiredState', 'createPipe_desiredState' - The state the pipe should be in.
--
-- 'enrichment', 'createPipe_enrichment' - The ARN of the enrichment resource.
--
-- 'enrichmentParameters', 'createPipe_enrichmentParameters' - The parameters required to set up enrichment on your pipe.
--
-- 'sourceParameters', 'createPipe_sourceParameters' - The parameters required to set up a source for your pipe.
--
-- 'tags', 'createPipe_tags' - The list of key-value pairs to associate with the pipe.
--
-- 'targetParameters', 'createPipe_targetParameters' - The parameters required to set up a target for your pipe.
--
-- 'name', 'createPipe_name' - The name of the pipe.
--
-- 'roleArn', 'createPipe_roleArn' - The ARN of the role that allows the pipe to send data to the target.
--
-- 'source', 'createPipe_source' - The ARN of the source resource.
--
-- 'target', 'createPipe_target' - The ARN of the target resource.
newCreatePipe ::
  -- | 'name'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  -- | 'source'
  Prelude.Text ->
  -- | 'target'
  Prelude.Text ->
  CreatePipe
newCreatePipe :: Text -> Text -> Text -> Text -> CreatePipe
newCreatePipe Text
pName_ Text
pRoleArn_ Text
pSource_ Text
pTarget_ =
  CreatePipe'
    { $sel:description:CreatePipe' :: Maybe (Sensitive Text)
description = forall a. Maybe a
Prelude.Nothing,
      $sel:desiredState:CreatePipe' :: Maybe RequestedPipeState
desiredState = forall a. Maybe a
Prelude.Nothing,
      $sel:enrichment:CreatePipe' :: Maybe Text
enrichment = forall a. Maybe a
Prelude.Nothing,
      $sel:enrichmentParameters:CreatePipe' :: Maybe PipeEnrichmentParameters
enrichmentParameters = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceParameters:CreatePipe' :: Maybe PipeSourceParameters
sourceParameters = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreatePipe' :: Maybe (HashMap Text (Sensitive Text))
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:targetParameters:CreatePipe' :: Maybe PipeTargetParameters
targetParameters = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreatePipe' :: Text
name = Text
pName_,
      $sel:roleArn:CreatePipe' :: Text
roleArn = Text
pRoleArn_,
      $sel:source:CreatePipe' :: Text
source = Text
pSource_,
      $sel:target:CreatePipe' :: Text
target = Text
pTarget_
    }

-- | A description of the pipe.
createPipe_description :: Lens.Lens' CreatePipe (Prelude.Maybe Prelude.Text)
createPipe_description :: Lens' CreatePipe (Maybe Text)
createPipe_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePipe' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:CreatePipe' :: CreatePipe -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: CreatePipe
s@CreatePipe' {} Maybe (Sensitive Text)
a -> CreatePipe
s {$sel:description:CreatePipe' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: CreatePipe) 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. Iso' (Sensitive a) a
Data._Sensitive

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

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

-- | The parameters required to set up enrichment on your pipe.
createPipe_enrichmentParameters :: Lens.Lens' CreatePipe (Prelude.Maybe PipeEnrichmentParameters)
createPipe_enrichmentParameters :: Lens' CreatePipe (Maybe PipeEnrichmentParameters)
createPipe_enrichmentParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePipe' {Maybe PipeEnrichmentParameters
enrichmentParameters :: Maybe PipeEnrichmentParameters
$sel:enrichmentParameters:CreatePipe' :: CreatePipe -> Maybe PipeEnrichmentParameters
enrichmentParameters} -> Maybe PipeEnrichmentParameters
enrichmentParameters) (\s :: CreatePipe
s@CreatePipe' {} Maybe PipeEnrichmentParameters
a -> CreatePipe
s {$sel:enrichmentParameters:CreatePipe' :: Maybe PipeEnrichmentParameters
enrichmentParameters = Maybe PipeEnrichmentParameters
a} :: CreatePipe)

-- | The parameters required to set up a source for your pipe.
createPipe_sourceParameters :: Lens.Lens' CreatePipe (Prelude.Maybe PipeSourceParameters)
createPipe_sourceParameters :: Lens' CreatePipe (Maybe PipeSourceParameters)
createPipe_sourceParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePipe' {Maybe PipeSourceParameters
sourceParameters :: Maybe PipeSourceParameters
$sel:sourceParameters:CreatePipe' :: CreatePipe -> Maybe PipeSourceParameters
sourceParameters} -> Maybe PipeSourceParameters
sourceParameters) (\s :: CreatePipe
s@CreatePipe' {} Maybe PipeSourceParameters
a -> CreatePipe
s {$sel:sourceParameters:CreatePipe' :: Maybe PipeSourceParameters
sourceParameters = Maybe PipeSourceParameters
a} :: CreatePipe)

-- | The list of key-value pairs to associate with the pipe.
createPipe_tags :: Lens.Lens' CreatePipe (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createPipe_tags :: Lens' CreatePipe (Maybe (HashMap Text Text))
createPipe_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePipe' {Maybe (HashMap Text (Sensitive Text))
tags :: Maybe (HashMap Text (Sensitive Text))
$sel:tags:CreatePipe' :: CreatePipe -> Maybe (HashMap Text (Sensitive Text))
tags} -> Maybe (HashMap Text (Sensitive Text))
tags) (\s :: CreatePipe
s@CreatePipe' {} Maybe (HashMap Text (Sensitive Text))
a -> CreatePipe
s {$sel:tags:CreatePipe' :: Maybe (HashMap Text (Sensitive Text))
tags = Maybe (HashMap Text (Sensitive Text))
a} :: CreatePipe) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The parameters required to set up a target for your pipe.
createPipe_targetParameters :: Lens.Lens' CreatePipe (Prelude.Maybe PipeTargetParameters)
createPipe_targetParameters :: Lens' CreatePipe (Maybe PipeTargetParameters)
createPipe_targetParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePipe' {Maybe PipeTargetParameters
targetParameters :: Maybe PipeTargetParameters
$sel:targetParameters:CreatePipe' :: CreatePipe -> Maybe PipeTargetParameters
targetParameters} -> Maybe PipeTargetParameters
targetParameters) (\s :: CreatePipe
s@CreatePipe' {} Maybe PipeTargetParameters
a -> CreatePipe
s {$sel:targetParameters:CreatePipe' :: Maybe PipeTargetParameters
targetParameters = Maybe PipeTargetParameters
a} :: CreatePipe)

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

-- | The ARN of the role that allows the pipe to send data to the target.
createPipe_roleArn :: Lens.Lens' CreatePipe Prelude.Text
createPipe_roleArn :: Lens' CreatePipe Text
createPipe_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePipe' {Text
roleArn :: Text
$sel:roleArn:CreatePipe' :: CreatePipe -> Text
roleArn} -> Text
roleArn) (\s :: CreatePipe
s@CreatePipe' {} Text
a -> CreatePipe
s {$sel:roleArn:CreatePipe' :: Text
roleArn = Text
a} :: CreatePipe)

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

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

instance Core.AWSRequest CreatePipe where
  type AWSResponse CreatePipe = CreatePipeResponse
  request :: (Service -> Service) -> CreatePipe -> Request CreatePipe
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreatePipe
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreatePipe)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe PipeState
-> Maybe RequestedPipeState
-> Maybe POSIX
-> Maybe Text
-> Int
-> CreatePipeResponse
CreatePipeResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (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 -> Either String (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 -> Either String (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 -> Either String (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 -> Either String (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 -> Either String (Maybe a)
Data..?> Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreatePipe where
  hashWithSalt :: Int -> CreatePipe -> Int
hashWithSalt Int
_salt CreatePipe' {Maybe Text
Maybe (HashMap Text (Sensitive Text))
Maybe (Sensitive Text)
Maybe PipeEnrichmentParameters
Maybe RequestedPipeState
Maybe PipeSourceParameters
Maybe PipeTargetParameters
Text
target :: Text
source :: Text
roleArn :: Text
name :: Text
targetParameters :: Maybe PipeTargetParameters
tags :: Maybe (HashMap Text (Sensitive Text))
sourceParameters :: Maybe PipeSourceParameters
enrichmentParameters :: Maybe PipeEnrichmentParameters
enrichment :: Maybe Text
desiredState :: Maybe RequestedPipeState
description :: Maybe (Sensitive Text)
$sel:target:CreatePipe' :: CreatePipe -> Text
$sel:source:CreatePipe' :: CreatePipe -> Text
$sel:roleArn:CreatePipe' :: CreatePipe -> Text
$sel:name:CreatePipe' :: CreatePipe -> Text
$sel:targetParameters:CreatePipe' :: CreatePipe -> Maybe PipeTargetParameters
$sel:tags:CreatePipe' :: CreatePipe -> Maybe (HashMap Text (Sensitive Text))
$sel:sourceParameters:CreatePipe' :: CreatePipe -> Maybe PipeSourceParameters
$sel:enrichmentParameters:CreatePipe' :: CreatePipe -> Maybe PipeEnrichmentParameters
$sel:enrichment:CreatePipe' :: CreatePipe -> Maybe Text
$sel:desiredState:CreatePipe' :: CreatePipe -> Maybe RequestedPipeState
$sel:description:CreatePipe' :: CreatePipe -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
description
      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 PipeEnrichmentParameters
enrichmentParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PipeSourceParameters
sourceParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text (Sensitive Text))
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PipeTargetParameters
targetParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
source
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
target

instance Prelude.NFData CreatePipe where
  rnf :: CreatePipe -> ()
rnf CreatePipe' {Maybe Text
Maybe (HashMap Text (Sensitive Text))
Maybe (Sensitive Text)
Maybe PipeEnrichmentParameters
Maybe RequestedPipeState
Maybe PipeSourceParameters
Maybe PipeTargetParameters
Text
target :: Text
source :: Text
roleArn :: Text
name :: Text
targetParameters :: Maybe PipeTargetParameters
tags :: Maybe (HashMap Text (Sensitive Text))
sourceParameters :: Maybe PipeSourceParameters
enrichmentParameters :: Maybe PipeEnrichmentParameters
enrichment :: Maybe Text
desiredState :: Maybe RequestedPipeState
description :: Maybe (Sensitive Text)
$sel:target:CreatePipe' :: CreatePipe -> Text
$sel:source:CreatePipe' :: CreatePipe -> Text
$sel:roleArn:CreatePipe' :: CreatePipe -> Text
$sel:name:CreatePipe' :: CreatePipe -> Text
$sel:targetParameters:CreatePipe' :: CreatePipe -> Maybe PipeTargetParameters
$sel:tags:CreatePipe' :: CreatePipe -> Maybe (HashMap Text (Sensitive Text))
$sel:sourceParameters:CreatePipe' :: CreatePipe -> Maybe PipeSourceParameters
$sel:enrichmentParameters:CreatePipe' :: CreatePipe -> Maybe PipeEnrichmentParameters
$sel:enrichment:CreatePipe' :: CreatePipe -> Maybe Text
$sel:desiredState:CreatePipe' :: CreatePipe -> Maybe RequestedPipeState
$sel:description:CreatePipe' :: CreatePipe -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
description
      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 PipeEnrichmentParameters
enrichmentParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PipeSourceParameters
sourceParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text (Sensitive Text))
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PipeTargetParameters
targetParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
source
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
target

instance Data.ToHeaders CreatePipe where
  toHeaders :: CreatePipe -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreatePipe where
  toJSON :: CreatePipe -> Value
toJSON CreatePipe' {Maybe Text
Maybe (HashMap Text (Sensitive Text))
Maybe (Sensitive Text)
Maybe PipeEnrichmentParameters
Maybe RequestedPipeState
Maybe PipeSourceParameters
Maybe PipeTargetParameters
Text
target :: Text
source :: Text
roleArn :: Text
name :: Text
targetParameters :: Maybe PipeTargetParameters
tags :: Maybe (HashMap Text (Sensitive Text))
sourceParameters :: Maybe PipeSourceParameters
enrichmentParameters :: Maybe PipeEnrichmentParameters
enrichment :: Maybe Text
desiredState :: Maybe RequestedPipeState
description :: Maybe (Sensitive Text)
$sel:target:CreatePipe' :: CreatePipe -> Text
$sel:source:CreatePipe' :: CreatePipe -> Text
$sel:roleArn:CreatePipe' :: CreatePipe -> Text
$sel:name:CreatePipe' :: CreatePipe -> Text
$sel:targetParameters:CreatePipe' :: CreatePipe -> Maybe PipeTargetParameters
$sel:tags:CreatePipe' :: CreatePipe -> Maybe (HashMap Text (Sensitive Text))
$sel:sourceParameters:CreatePipe' :: CreatePipe -> Maybe PipeSourceParameters
$sel:enrichmentParameters:CreatePipe' :: CreatePipe -> Maybe PipeEnrichmentParameters
$sel:enrichment:CreatePipe' :: CreatePipe -> Maybe Text
$sel:desiredState:CreatePipe' :: CreatePipe -> Maybe RequestedPipeState
$sel:description:CreatePipe' :: CreatePipe -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
description,
            (Key
"DesiredState" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RequestedPipeState
desiredState,
            (Key
"Enrichment" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
enrichment,
            (Key
"EnrichmentParameters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PipeEnrichmentParameters
enrichmentParameters,
            (Key
"SourceParameters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PipeSourceParameters
sourceParameters,
            (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text (Sensitive Text))
tags,
            (Key
"TargetParameters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PipeTargetParameters
targetParameters,
            forall a. a -> Maybe a
Prelude.Just (Key
"RoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleArn),
            forall a. a -> Maybe a
Prelude.Just (Key
"Source" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
source),
            forall a. a -> Maybe a
Prelude.Just (Key
"Target" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
target)
          ]
      )

instance Data.ToPath CreatePipe where
  toPath :: CreatePipe -> ByteString
toPath CreatePipe' {Maybe Text
Maybe (HashMap Text (Sensitive Text))
Maybe (Sensitive Text)
Maybe PipeEnrichmentParameters
Maybe RequestedPipeState
Maybe PipeSourceParameters
Maybe PipeTargetParameters
Text
target :: Text
source :: Text
roleArn :: Text
name :: Text
targetParameters :: Maybe PipeTargetParameters
tags :: Maybe (HashMap Text (Sensitive Text))
sourceParameters :: Maybe PipeSourceParameters
enrichmentParameters :: Maybe PipeEnrichmentParameters
enrichment :: Maybe Text
desiredState :: Maybe RequestedPipeState
description :: Maybe (Sensitive Text)
$sel:target:CreatePipe' :: CreatePipe -> Text
$sel:source:CreatePipe' :: CreatePipe -> Text
$sel:roleArn:CreatePipe' :: CreatePipe -> Text
$sel:name:CreatePipe' :: CreatePipe -> Text
$sel:targetParameters:CreatePipe' :: CreatePipe -> Maybe PipeTargetParameters
$sel:tags:CreatePipe' :: CreatePipe -> Maybe (HashMap Text (Sensitive Text))
$sel:sourceParameters:CreatePipe' :: CreatePipe -> Maybe PipeSourceParameters
$sel:enrichmentParameters:CreatePipe' :: CreatePipe -> Maybe PipeEnrichmentParameters
$sel:enrichment:CreatePipe' :: CreatePipe -> Maybe Text
$sel:desiredState:CreatePipe' :: CreatePipe -> Maybe RequestedPipeState
$sel:description:CreatePipe' :: CreatePipe -> Maybe (Sensitive Text)
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/v1/pipes/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
name]

instance Data.ToQuery CreatePipe where
  toQuery :: CreatePipe -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreatePipeResponse' smart constructor.
data CreatePipeResponse = CreatePipeResponse'
  { -- | The ARN of the pipe.
    CreatePipeResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The time the pipe was created.
    CreatePipeResponse -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | The state the pipe is in.
    CreatePipeResponse -> Maybe PipeState
currentState :: Prelude.Maybe PipeState,
    -- | The state the pipe should be in.
    CreatePipeResponse -> Maybe RequestedPipeState
desiredState :: Prelude.Maybe RequestedPipeState,
    -- | When the pipe was last updated, in
    -- <https://www.w3.org/TR/NOTE-datetime ISO-8601 format>
    -- (YYYY-MM-DDThh:mm:ss.sTZD).
    CreatePipeResponse -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Data.POSIX,
    -- | The name of the pipe.
    CreatePipeResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreatePipeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreatePipeResponse -> CreatePipeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePipeResponse -> CreatePipeResponse -> Bool
$c/= :: CreatePipeResponse -> CreatePipeResponse -> Bool
== :: CreatePipeResponse -> CreatePipeResponse -> Bool
$c== :: CreatePipeResponse -> CreatePipeResponse -> Bool
Prelude.Eq, ReadPrec [CreatePipeResponse]
ReadPrec CreatePipeResponse
Int -> ReadS CreatePipeResponse
ReadS [CreatePipeResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePipeResponse]
$creadListPrec :: ReadPrec [CreatePipeResponse]
readPrec :: ReadPrec CreatePipeResponse
$creadPrec :: ReadPrec CreatePipeResponse
readList :: ReadS [CreatePipeResponse]
$creadList :: ReadS [CreatePipeResponse]
readsPrec :: Int -> ReadS CreatePipeResponse
$creadsPrec :: Int -> ReadS CreatePipeResponse
Prelude.Read, Int -> CreatePipeResponse -> ShowS
[CreatePipeResponse] -> ShowS
CreatePipeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePipeResponse] -> ShowS
$cshowList :: [CreatePipeResponse] -> ShowS
show :: CreatePipeResponse -> String
$cshow :: CreatePipeResponse -> String
showsPrec :: Int -> CreatePipeResponse -> ShowS
$cshowsPrec :: Int -> CreatePipeResponse -> ShowS
Prelude.Show, forall x. Rep CreatePipeResponse x -> CreatePipeResponse
forall x. CreatePipeResponse -> Rep CreatePipeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePipeResponse x -> CreatePipeResponse
$cfrom :: forall x. CreatePipeResponse -> Rep CreatePipeResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreatePipeResponse' 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', 'createPipeResponse_arn' - The ARN of the pipe.
--
-- 'creationTime', 'createPipeResponse_creationTime' - The time the pipe was created.
--
-- 'currentState', 'createPipeResponse_currentState' - The state the pipe is in.
--
-- 'desiredState', 'createPipeResponse_desiredState' - The state the pipe should be in.
--
-- 'lastModifiedTime', 'createPipeResponse_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', 'createPipeResponse_name' - The name of the pipe.
--
-- 'httpStatus', 'createPipeResponse_httpStatus' - The response's http status code.
newCreatePipeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreatePipeResponse
newCreatePipeResponse :: Int -> CreatePipeResponse
newCreatePipeResponse Int
pHttpStatus_ =
  CreatePipeResponse'
    { $sel:arn:CreatePipeResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:creationTime:CreatePipeResponse' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:currentState:CreatePipeResponse' :: Maybe PipeState
currentState = forall a. Maybe a
Prelude.Nothing,
      $sel:desiredState:CreatePipeResponse' :: Maybe RequestedPipeState
desiredState = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedTime:CreatePipeResponse' :: Maybe POSIX
lastModifiedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreatePipeResponse' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreatePipeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

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

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

-- | The response's http status code.
createPipeResponse_httpStatus :: Lens.Lens' CreatePipeResponse Prelude.Int
createPipeResponse_httpStatus :: Lens' CreatePipeResponse Int
createPipeResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePipeResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreatePipeResponse' :: CreatePipeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreatePipeResponse
s@CreatePipeResponse' {} Int
a -> CreatePipeResponse
s {$sel:httpStatus:CreatePipeResponse' :: Int
httpStatus = Int
a} :: CreatePipeResponse)

instance Prelude.NFData CreatePipeResponse where
  rnf :: CreatePipeResponse -> ()
rnf CreatePipeResponse' {Int
Maybe Text
Maybe POSIX
Maybe PipeState
Maybe RequestedPipeState
httpStatus :: Int
name :: Maybe Text
lastModifiedTime :: Maybe POSIX
desiredState :: Maybe RequestedPipeState
currentState :: Maybe PipeState
creationTime :: Maybe POSIX
arn :: Maybe Text
$sel:httpStatus:CreatePipeResponse' :: CreatePipeResponse -> Int
$sel:name:CreatePipeResponse' :: CreatePipeResponse -> Maybe Text
$sel:lastModifiedTime:CreatePipeResponse' :: CreatePipeResponse -> Maybe POSIX
$sel:desiredState:CreatePipeResponse' :: CreatePipeResponse -> Maybe RequestedPipeState
$sel:currentState:CreatePipeResponse' :: CreatePipeResponse -> Maybe PipeState
$sel:creationTime:CreatePipeResponse' :: CreatePipeResponse -> Maybe POSIX
$sel:arn:CreatePipeResponse' :: CreatePipeResponse -> 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 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 Int
httpStatus