{-# 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.DataPipeline.PutPipelineDefinition
-- 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)
--
-- Adds tasks, schedules, and preconditions to the specified pipeline. You
-- can use @PutPipelineDefinition@ to populate a new pipeline.
--
-- @PutPipelineDefinition@ also validates the configuration as it adds it
-- to the pipeline. Changes to the pipeline are saved unless one of the
-- following three validation errors exists in the pipeline.
--
-- 1.  An object is missing a name or identifier field.
-- 2.  A string or reference field is empty.
-- 3.  The number of objects in the pipeline exceeds the maximum allowed
--     objects.
-- 4.  The pipeline is in a FINISHED state.
--
-- Pipeline object definitions are passed to the @PutPipelineDefinition@
-- action and returned by the GetPipelineDefinition action.
module Amazonka.DataPipeline.PutPipelineDefinition
  ( -- * Creating a Request
    PutPipelineDefinition (..),
    newPutPipelineDefinition,

    -- * Request Lenses
    putPipelineDefinition_parameterObjects,
    putPipelineDefinition_parameterValues,
    putPipelineDefinition_pipelineId,
    putPipelineDefinition_pipelineObjects,

    -- * Destructuring the Response
    PutPipelineDefinitionResponse (..),
    newPutPipelineDefinitionResponse,

    -- * Response Lenses
    putPipelineDefinitionResponse_validationErrors,
    putPipelineDefinitionResponse_validationWarnings,
    putPipelineDefinitionResponse_httpStatus,
    putPipelineDefinitionResponse_errored,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DataPipeline.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Contains the parameters for PutPipelineDefinition.
--
-- /See:/ 'newPutPipelineDefinition' smart constructor.
data PutPipelineDefinition = PutPipelineDefinition'
  { -- | The parameter objects used with the pipeline.
    PutPipelineDefinition -> Maybe [ParameterObject]
parameterObjects :: Prelude.Maybe [ParameterObject],
    -- | The parameter values used with the pipeline.
    PutPipelineDefinition -> Maybe [ParameterValue]
parameterValues :: Prelude.Maybe [ParameterValue],
    -- | The ID of the pipeline.
    PutPipelineDefinition -> Text
pipelineId :: Prelude.Text,
    -- | The objects that define the pipeline. These objects overwrite the
    -- existing pipeline definition.
    PutPipelineDefinition -> [PipelineObject]
pipelineObjects :: [PipelineObject]
  }
  deriving (PutPipelineDefinition -> PutPipelineDefinition -> Bool
(PutPipelineDefinition -> PutPipelineDefinition -> Bool)
-> (PutPipelineDefinition -> PutPipelineDefinition -> Bool)
-> Eq PutPipelineDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutPipelineDefinition -> PutPipelineDefinition -> Bool
$c/= :: PutPipelineDefinition -> PutPipelineDefinition -> Bool
== :: PutPipelineDefinition -> PutPipelineDefinition -> Bool
$c== :: PutPipelineDefinition -> PutPipelineDefinition -> Bool
Prelude.Eq, ReadPrec [PutPipelineDefinition]
ReadPrec PutPipelineDefinition
Int -> ReadS PutPipelineDefinition
ReadS [PutPipelineDefinition]
(Int -> ReadS PutPipelineDefinition)
-> ReadS [PutPipelineDefinition]
-> ReadPrec PutPipelineDefinition
-> ReadPrec [PutPipelineDefinition]
-> Read PutPipelineDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutPipelineDefinition]
$creadListPrec :: ReadPrec [PutPipelineDefinition]
readPrec :: ReadPrec PutPipelineDefinition
$creadPrec :: ReadPrec PutPipelineDefinition
readList :: ReadS [PutPipelineDefinition]
$creadList :: ReadS [PutPipelineDefinition]
readsPrec :: Int -> ReadS PutPipelineDefinition
$creadsPrec :: Int -> ReadS PutPipelineDefinition
Prelude.Read, Int -> PutPipelineDefinition -> ShowS
[PutPipelineDefinition] -> ShowS
PutPipelineDefinition -> String
(Int -> PutPipelineDefinition -> ShowS)
-> (PutPipelineDefinition -> String)
-> ([PutPipelineDefinition] -> ShowS)
-> Show PutPipelineDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutPipelineDefinition] -> ShowS
$cshowList :: [PutPipelineDefinition] -> ShowS
show :: PutPipelineDefinition -> String
$cshow :: PutPipelineDefinition -> String
showsPrec :: Int -> PutPipelineDefinition -> ShowS
$cshowsPrec :: Int -> PutPipelineDefinition -> ShowS
Prelude.Show, (forall x. PutPipelineDefinition -> Rep PutPipelineDefinition x)
-> (forall x. Rep PutPipelineDefinition x -> PutPipelineDefinition)
-> Generic PutPipelineDefinition
forall x. Rep PutPipelineDefinition x -> PutPipelineDefinition
forall x. PutPipelineDefinition -> Rep PutPipelineDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutPipelineDefinition x -> PutPipelineDefinition
$cfrom :: forall x. PutPipelineDefinition -> Rep PutPipelineDefinition x
Prelude.Generic)

-- |
-- Create a value of 'PutPipelineDefinition' 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:
--
-- 'parameterObjects', 'putPipelineDefinition_parameterObjects' - The parameter objects used with the pipeline.
--
-- 'parameterValues', 'putPipelineDefinition_parameterValues' - The parameter values used with the pipeline.
--
-- 'pipelineId', 'putPipelineDefinition_pipelineId' - The ID of the pipeline.
--
-- 'pipelineObjects', 'putPipelineDefinition_pipelineObjects' - The objects that define the pipeline. These objects overwrite the
-- existing pipeline definition.
newPutPipelineDefinition ::
  -- | 'pipelineId'
  Prelude.Text ->
  PutPipelineDefinition
newPutPipelineDefinition :: Text -> PutPipelineDefinition
newPutPipelineDefinition Text
pPipelineId_ =
  PutPipelineDefinition' :: Maybe [ParameterObject]
-> Maybe [ParameterValue]
-> Text
-> [PipelineObject]
-> PutPipelineDefinition
PutPipelineDefinition'
    { $sel:parameterObjects:PutPipelineDefinition' :: Maybe [ParameterObject]
parameterObjects =
        Maybe [ParameterObject]
forall a. Maybe a
Prelude.Nothing,
      $sel:parameterValues:PutPipelineDefinition' :: Maybe [ParameterValue]
parameterValues = Maybe [ParameterValue]
forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineId:PutPipelineDefinition' :: Text
pipelineId = Text
pPipelineId_,
      $sel:pipelineObjects:PutPipelineDefinition' :: [PipelineObject]
pipelineObjects = [PipelineObject]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The parameter objects used with the pipeline.
putPipelineDefinition_parameterObjects :: Lens.Lens' PutPipelineDefinition (Prelude.Maybe [ParameterObject])
putPipelineDefinition_parameterObjects :: (Maybe [ParameterObject] -> f (Maybe [ParameterObject]))
-> PutPipelineDefinition -> f PutPipelineDefinition
putPipelineDefinition_parameterObjects = (PutPipelineDefinition -> Maybe [ParameterObject])
-> (PutPipelineDefinition
    -> Maybe [ParameterObject] -> PutPipelineDefinition)
-> Lens
     PutPipelineDefinition
     PutPipelineDefinition
     (Maybe [ParameterObject])
     (Maybe [ParameterObject])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPipelineDefinition' {Maybe [ParameterObject]
parameterObjects :: Maybe [ParameterObject]
$sel:parameterObjects:PutPipelineDefinition' :: PutPipelineDefinition -> Maybe [ParameterObject]
parameterObjects} -> Maybe [ParameterObject]
parameterObjects) (\s :: PutPipelineDefinition
s@PutPipelineDefinition' {} Maybe [ParameterObject]
a -> PutPipelineDefinition
s {$sel:parameterObjects:PutPipelineDefinition' :: Maybe [ParameterObject]
parameterObjects = Maybe [ParameterObject]
a} :: PutPipelineDefinition) ((Maybe [ParameterObject] -> f (Maybe [ParameterObject]))
 -> PutPipelineDefinition -> f PutPipelineDefinition)
-> ((Maybe [ParameterObject] -> f (Maybe [ParameterObject]))
    -> Maybe [ParameterObject] -> f (Maybe [ParameterObject]))
-> (Maybe [ParameterObject] -> f (Maybe [ParameterObject]))
-> PutPipelineDefinition
-> f PutPipelineDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ParameterObject]
  [ParameterObject]
  [ParameterObject]
  [ParameterObject]
-> Iso
     (Maybe [ParameterObject])
     (Maybe [ParameterObject])
     (Maybe [ParameterObject])
     (Maybe [ParameterObject])
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 AnIso
  [ParameterObject]
  [ParameterObject]
  [ParameterObject]
  [ParameterObject]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The parameter values used with the pipeline.
putPipelineDefinition_parameterValues :: Lens.Lens' PutPipelineDefinition (Prelude.Maybe [ParameterValue])
putPipelineDefinition_parameterValues :: (Maybe [ParameterValue] -> f (Maybe [ParameterValue]))
-> PutPipelineDefinition -> f PutPipelineDefinition
putPipelineDefinition_parameterValues = (PutPipelineDefinition -> Maybe [ParameterValue])
-> (PutPipelineDefinition
    -> Maybe [ParameterValue] -> PutPipelineDefinition)
-> Lens
     PutPipelineDefinition
     PutPipelineDefinition
     (Maybe [ParameterValue])
     (Maybe [ParameterValue])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPipelineDefinition' {Maybe [ParameterValue]
parameterValues :: Maybe [ParameterValue]
$sel:parameterValues:PutPipelineDefinition' :: PutPipelineDefinition -> Maybe [ParameterValue]
parameterValues} -> Maybe [ParameterValue]
parameterValues) (\s :: PutPipelineDefinition
s@PutPipelineDefinition' {} Maybe [ParameterValue]
a -> PutPipelineDefinition
s {$sel:parameterValues:PutPipelineDefinition' :: Maybe [ParameterValue]
parameterValues = Maybe [ParameterValue]
a} :: PutPipelineDefinition) ((Maybe [ParameterValue] -> f (Maybe [ParameterValue]))
 -> PutPipelineDefinition -> f PutPipelineDefinition)
-> ((Maybe [ParameterValue] -> f (Maybe [ParameterValue]))
    -> Maybe [ParameterValue] -> f (Maybe [ParameterValue]))
-> (Maybe [ParameterValue] -> f (Maybe [ParameterValue]))
-> PutPipelineDefinition
-> f PutPipelineDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ParameterValue] [ParameterValue] [ParameterValue] [ParameterValue]
-> Iso
     (Maybe [ParameterValue])
     (Maybe [ParameterValue])
     (Maybe [ParameterValue])
     (Maybe [ParameterValue])
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 AnIso
  [ParameterValue] [ParameterValue] [ParameterValue] [ParameterValue]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the pipeline.
putPipelineDefinition_pipelineId :: Lens.Lens' PutPipelineDefinition Prelude.Text
putPipelineDefinition_pipelineId :: (Text -> f Text)
-> PutPipelineDefinition -> f PutPipelineDefinition
putPipelineDefinition_pipelineId = (PutPipelineDefinition -> Text)
-> (PutPipelineDefinition -> Text -> PutPipelineDefinition)
-> Lens PutPipelineDefinition PutPipelineDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPipelineDefinition' {Text
pipelineId :: Text
$sel:pipelineId:PutPipelineDefinition' :: PutPipelineDefinition -> Text
pipelineId} -> Text
pipelineId) (\s :: PutPipelineDefinition
s@PutPipelineDefinition' {} Text
a -> PutPipelineDefinition
s {$sel:pipelineId:PutPipelineDefinition' :: Text
pipelineId = Text
a} :: PutPipelineDefinition)

-- | The objects that define the pipeline. These objects overwrite the
-- existing pipeline definition.
putPipelineDefinition_pipelineObjects :: Lens.Lens' PutPipelineDefinition [PipelineObject]
putPipelineDefinition_pipelineObjects :: ([PipelineObject] -> f [PipelineObject])
-> PutPipelineDefinition -> f PutPipelineDefinition
putPipelineDefinition_pipelineObjects = (PutPipelineDefinition -> [PipelineObject])
-> (PutPipelineDefinition
    -> [PipelineObject] -> PutPipelineDefinition)
-> Lens
     PutPipelineDefinition
     PutPipelineDefinition
     [PipelineObject]
     [PipelineObject]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPipelineDefinition' {[PipelineObject]
pipelineObjects :: [PipelineObject]
$sel:pipelineObjects:PutPipelineDefinition' :: PutPipelineDefinition -> [PipelineObject]
pipelineObjects} -> [PipelineObject]
pipelineObjects) (\s :: PutPipelineDefinition
s@PutPipelineDefinition' {} [PipelineObject]
a -> PutPipelineDefinition
s {$sel:pipelineObjects:PutPipelineDefinition' :: [PipelineObject]
pipelineObjects = [PipelineObject]
a} :: PutPipelineDefinition) (([PipelineObject] -> f [PipelineObject])
 -> PutPipelineDefinition -> f PutPipelineDefinition)
-> (([PipelineObject] -> f [PipelineObject])
    -> [PipelineObject] -> f [PipelineObject])
-> ([PipelineObject] -> f [PipelineObject])
-> PutPipelineDefinition
-> f PutPipelineDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([PipelineObject] -> f [PipelineObject])
-> [PipelineObject] -> f [PipelineObject]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest PutPipelineDefinition where
  type
    AWSResponse PutPipelineDefinition =
      PutPipelineDefinitionResponse
  request :: PutPipelineDefinition -> Request PutPipelineDefinition
request = Service -> PutPipelineDefinition -> Request PutPipelineDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutPipelineDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutPipelineDefinition)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse PutPipelineDefinition))
-> Logger
-> Service
-> Proxy PutPipelineDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutPipelineDefinition)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [ValidationError]
-> Maybe [ValidationWarning]
-> Int
-> Bool
-> PutPipelineDefinitionResponse
PutPipelineDefinitionResponse'
            (Maybe [ValidationError]
 -> Maybe [ValidationWarning]
 -> Int
 -> Bool
 -> PutPipelineDefinitionResponse)
-> Either String (Maybe [ValidationError])
-> Either
     String
     (Maybe [ValidationWarning]
      -> Int -> Bool -> PutPipelineDefinitionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [ValidationError]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"validationErrors"
                            Either String (Maybe (Maybe [ValidationError]))
-> Maybe [ValidationError]
-> Either String (Maybe [ValidationError])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ValidationError]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String
  (Maybe [ValidationWarning]
   -> Int -> Bool -> PutPipelineDefinitionResponse)
-> Either String (Maybe [ValidationWarning])
-> Either String (Int -> Bool -> PutPipelineDefinitionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [ValidationWarning]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"validationWarnings"
                            Either String (Maybe (Maybe [ValidationWarning]))
-> Maybe [ValidationWarning]
-> Either String (Maybe [ValidationWarning])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ValidationWarning]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> Bool -> PutPipelineDefinitionResponse)
-> Either String Int
-> Either String (Bool -> PutPipelineDefinitionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String (Bool -> PutPipelineDefinitionResponse)
-> Either String Bool
-> Either String PutPipelineDefinitionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Bool
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"errored")
      )

instance Prelude.Hashable PutPipelineDefinition

instance Prelude.NFData PutPipelineDefinition

instance Core.ToHeaders PutPipelineDefinition where
  toHeaders :: PutPipelineDefinition -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PutPipelineDefinition -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"DataPipeline.PutPipelineDefinition" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON PutPipelineDefinition where
  toJSON :: PutPipelineDefinition -> Value
toJSON PutPipelineDefinition' {[PipelineObject]
Maybe [ParameterObject]
Maybe [ParameterValue]
Text
pipelineObjects :: [PipelineObject]
pipelineId :: Text
parameterValues :: Maybe [ParameterValue]
parameterObjects :: Maybe [ParameterObject]
$sel:pipelineObjects:PutPipelineDefinition' :: PutPipelineDefinition -> [PipelineObject]
$sel:pipelineId:PutPipelineDefinition' :: PutPipelineDefinition -> Text
$sel:parameterValues:PutPipelineDefinition' :: PutPipelineDefinition -> Maybe [ParameterValue]
$sel:parameterObjects:PutPipelineDefinition' :: PutPipelineDefinition -> Maybe [ParameterObject]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"parameterObjects" Text -> [ParameterObject] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([ParameterObject] -> Pair)
-> Maybe [ParameterObject] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ParameterObject]
parameterObjects,
            (Text
"parameterValues" Text -> [ParameterValue] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([ParameterValue] -> Pair) -> Maybe [ParameterValue] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ParameterValue]
parameterValues,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"pipelineId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
pipelineId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"pipelineObjects" Text -> [PipelineObject] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [PipelineObject]
pipelineObjects)
          ]
      )

instance Core.ToPath PutPipelineDefinition where
  toPath :: PutPipelineDefinition -> ByteString
toPath = ByteString -> PutPipelineDefinition -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | Contains the output of PutPipelineDefinition.
--
-- /See:/ 'newPutPipelineDefinitionResponse' smart constructor.
data PutPipelineDefinitionResponse = PutPipelineDefinitionResponse'
  { -- | The validation errors that are associated with the objects defined in
    -- @pipelineObjects@.
    PutPipelineDefinitionResponse -> Maybe [ValidationError]
validationErrors :: Prelude.Maybe [ValidationError],
    -- | The validation warnings that are associated with the objects defined in
    -- @pipelineObjects@.
    PutPipelineDefinitionResponse -> Maybe [ValidationWarning]
validationWarnings :: Prelude.Maybe [ValidationWarning],
    -- | The response's http status code.
    PutPipelineDefinitionResponse -> Int
httpStatus :: Prelude.Int,
    -- | Indicates whether there were validation errors, and the pipeline
    -- definition is stored but cannot be activated until you correct the
    -- pipeline and call @PutPipelineDefinition@ to commit the corrected
    -- pipeline.
    PutPipelineDefinitionResponse -> Bool
errored :: Prelude.Bool
  }
  deriving (PutPipelineDefinitionResponse
-> PutPipelineDefinitionResponse -> Bool
(PutPipelineDefinitionResponse
 -> PutPipelineDefinitionResponse -> Bool)
-> (PutPipelineDefinitionResponse
    -> PutPipelineDefinitionResponse -> Bool)
-> Eq PutPipelineDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutPipelineDefinitionResponse
-> PutPipelineDefinitionResponse -> Bool
$c/= :: PutPipelineDefinitionResponse
-> PutPipelineDefinitionResponse -> Bool
== :: PutPipelineDefinitionResponse
-> PutPipelineDefinitionResponse -> Bool
$c== :: PutPipelineDefinitionResponse
-> PutPipelineDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [PutPipelineDefinitionResponse]
ReadPrec PutPipelineDefinitionResponse
Int -> ReadS PutPipelineDefinitionResponse
ReadS [PutPipelineDefinitionResponse]
(Int -> ReadS PutPipelineDefinitionResponse)
-> ReadS [PutPipelineDefinitionResponse]
-> ReadPrec PutPipelineDefinitionResponse
-> ReadPrec [PutPipelineDefinitionResponse]
-> Read PutPipelineDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutPipelineDefinitionResponse]
$creadListPrec :: ReadPrec [PutPipelineDefinitionResponse]
readPrec :: ReadPrec PutPipelineDefinitionResponse
$creadPrec :: ReadPrec PutPipelineDefinitionResponse
readList :: ReadS [PutPipelineDefinitionResponse]
$creadList :: ReadS [PutPipelineDefinitionResponse]
readsPrec :: Int -> ReadS PutPipelineDefinitionResponse
$creadsPrec :: Int -> ReadS PutPipelineDefinitionResponse
Prelude.Read, Int -> PutPipelineDefinitionResponse -> ShowS
[PutPipelineDefinitionResponse] -> ShowS
PutPipelineDefinitionResponse -> String
(Int -> PutPipelineDefinitionResponse -> ShowS)
-> (PutPipelineDefinitionResponse -> String)
-> ([PutPipelineDefinitionResponse] -> ShowS)
-> Show PutPipelineDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutPipelineDefinitionResponse] -> ShowS
$cshowList :: [PutPipelineDefinitionResponse] -> ShowS
show :: PutPipelineDefinitionResponse -> String
$cshow :: PutPipelineDefinitionResponse -> String
showsPrec :: Int -> PutPipelineDefinitionResponse -> ShowS
$cshowsPrec :: Int -> PutPipelineDefinitionResponse -> ShowS
Prelude.Show, (forall x.
 PutPipelineDefinitionResponse
 -> Rep PutPipelineDefinitionResponse x)
-> (forall x.
    Rep PutPipelineDefinitionResponse x
    -> PutPipelineDefinitionResponse)
-> Generic PutPipelineDefinitionResponse
forall x.
Rep PutPipelineDefinitionResponse x
-> PutPipelineDefinitionResponse
forall x.
PutPipelineDefinitionResponse
-> Rep PutPipelineDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutPipelineDefinitionResponse x
-> PutPipelineDefinitionResponse
$cfrom :: forall x.
PutPipelineDefinitionResponse
-> Rep PutPipelineDefinitionResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutPipelineDefinitionResponse' 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:
--
-- 'validationErrors', 'putPipelineDefinitionResponse_validationErrors' - The validation errors that are associated with the objects defined in
-- @pipelineObjects@.
--
-- 'validationWarnings', 'putPipelineDefinitionResponse_validationWarnings' - The validation warnings that are associated with the objects defined in
-- @pipelineObjects@.
--
-- 'httpStatus', 'putPipelineDefinitionResponse_httpStatus' - The response's http status code.
--
-- 'errored', 'putPipelineDefinitionResponse_errored' - Indicates whether there were validation errors, and the pipeline
-- definition is stored but cannot be activated until you correct the
-- pipeline and call @PutPipelineDefinition@ to commit the corrected
-- pipeline.
newPutPipelineDefinitionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'errored'
  Prelude.Bool ->
  PutPipelineDefinitionResponse
newPutPipelineDefinitionResponse :: Int -> Bool -> PutPipelineDefinitionResponse
newPutPipelineDefinitionResponse
  Int
pHttpStatus_
  Bool
pErrored_ =
    PutPipelineDefinitionResponse' :: Maybe [ValidationError]
-> Maybe [ValidationWarning]
-> Int
-> Bool
-> PutPipelineDefinitionResponse
PutPipelineDefinitionResponse'
      { $sel:validationErrors:PutPipelineDefinitionResponse' :: Maybe [ValidationError]
validationErrors =
          Maybe [ValidationError]
forall a. Maybe a
Prelude.Nothing,
        $sel:validationWarnings:PutPipelineDefinitionResponse' :: Maybe [ValidationWarning]
validationWarnings = Maybe [ValidationWarning]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:PutPipelineDefinitionResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:errored:PutPipelineDefinitionResponse' :: Bool
errored = Bool
pErrored_
      }

-- | The validation errors that are associated with the objects defined in
-- @pipelineObjects@.
putPipelineDefinitionResponse_validationErrors :: Lens.Lens' PutPipelineDefinitionResponse (Prelude.Maybe [ValidationError])
putPipelineDefinitionResponse_validationErrors :: (Maybe [ValidationError] -> f (Maybe [ValidationError]))
-> PutPipelineDefinitionResponse -> f PutPipelineDefinitionResponse
putPipelineDefinitionResponse_validationErrors = (PutPipelineDefinitionResponse -> Maybe [ValidationError])
-> (PutPipelineDefinitionResponse
    -> Maybe [ValidationError] -> PutPipelineDefinitionResponse)
-> Lens
     PutPipelineDefinitionResponse
     PutPipelineDefinitionResponse
     (Maybe [ValidationError])
     (Maybe [ValidationError])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPipelineDefinitionResponse' {Maybe [ValidationError]
validationErrors :: Maybe [ValidationError]
$sel:validationErrors:PutPipelineDefinitionResponse' :: PutPipelineDefinitionResponse -> Maybe [ValidationError]
validationErrors} -> Maybe [ValidationError]
validationErrors) (\s :: PutPipelineDefinitionResponse
s@PutPipelineDefinitionResponse' {} Maybe [ValidationError]
a -> PutPipelineDefinitionResponse
s {$sel:validationErrors:PutPipelineDefinitionResponse' :: Maybe [ValidationError]
validationErrors = Maybe [ValidationError]
a} :: PutPipelineDefinitionResponse) ((Maybe [ValidationError] -> f (Maybe [ValidationError]))
 -> PutPipelineDefinitionResponse
 -> f PutPipelineDefinitionResponse)
-> ((Maybe [ValidationError] -> f (Maybe [ValidationError]))
    -> Maybe [ValidationError] -> f (Maybe [ValidationError]))
-> (Maybe [ValidationError] -> f (Maybe [ValidationError]))
-> PutPipelineDefinitionResponse
-> f PutPipelineDefinitionResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ValidationError]
  [ValidationError]
  [ValidationError]
  [ValidationError]
-> Iso
     (Maybe [ValidationError])
     (Maybe [ValidationError])
     (Maybe [ValidationError])
     (Maybe [ValidationError])
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 AnIso
  [ValidationError]
  [ValidationError]
  [ValidationError]
  [ValidationError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The validation warnings that are associated with the objects defined in
-- @pipelineObjects@.
putPipelineDefinitionResponse_validationWarnings :: Lens.Lens' PutPipelineDefinitionResponse (Prelude.Maybe [ValidationWarning])
putPipelineDefinitionResponse_validationWarnings :: (Maybe [ValidationWarning] -> f (Maybe [ValidationWarning]))
-> PutPipelineDefinitionResponse -> f PutPipelineDefinitionResponse
putPipelineDefinitionResponse_validationWarnings = (PutPipelineDefinitionResponse -> Maybe [ValidationWarning])
-> (PutPipelineDefinitionResponse
    -> Maybe [ValidationWarning] -> PutPipelineDefinitionResponse)
-> Lens
     PutPipelineDefinitionResponse
     PutPipelineDefinitionResponse
     (Maybe [ValidationWarning])
     (Maybe [ValidationWarning])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPipelineDefinitionResponse' {Maybe [ValidationWarning]
validationWarnings :: Maybe [ValidationWarning]
$sel:validationWarnings:PutPipelineDefinitionResponse' :: PutPipelineDefinitionResponse -> Maybe [ValidationWarning]
validationWarnings} -> Maybe [ValidationWarning]
validationWarnings) (\s :: PutPipelineDefinitionResponse
s@PutPipelineDefinitionResponse' {} Maybe [ValidationWarning]
a -> PutPipelineDefinitionResponse
s {$sel:validationWarnings:PutPipelineDefinitionResponse' :: Maybe [ValidationWarning]
validationWarnings = Maybe [ValidationWarning]
a} :: PutPipelineDefinitionResponse) ((Maybe [ValidationWarning] -> f (Maybe [ValidationWarning]))
 -> PutPipelineDefinitionResponse
 -> f PutPipelineDefinitionResponse)
-> ((Maybe [ValidationWarning] -> f (Maybe [ValidationWarning]))
    -> Maybe [ValidationWarning] -> f (Maybe [ValidationWarning]))
-> (Maybe [ValidationWarning] -> f (Maybe [ValidationWarning]))
-> PutPipelineDefinitionResponse
-> f PutPipelineDefinitionResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ValidationWarning]
  [ValidationWarning]
  [ValidationWarning]
  [ValidationWarning]
-> Iso
     (Maybe [ValidationWarning])
     (Maybe [ValidationWarning])
     (Maybe [ValidationWarning])
     (Maybe [ValidationWarning])
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 AnIso
  [ValidationWarning]
  [ValidationWarning]
  [ValidationWarning]
  [ValidationWarning]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | Indicates whether there were validation errors, and the pipeline
-- definition is stored but cannot be activated until you correct the
-- pipeline and call @PutPipelineDefinition@ to commit the corrected
-- pipeline.
putPipelineDefinitionResponse_errored :: Lens.Lens' PutPipelineDefinitionResponse Prelude.Bool
putPipelineDefinitionResponse_errored :: (Bool -> f Bool)
-> PutPipelineDefinitionResponse -> f PutPipelineDefinitionResponse
putPipelineDefinitionResponse_errored = (PutPipelineDefinitionResponse -> Bool)
-> (PutPipelineDefinitionResponse
    -> Bool -> PutPipelineDefinitionResponse)
-> Lens
     PutPipelineDefinitionResponse
     PutPipelineDefinitionResponse
     Bool
     Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPipelineDefinitionResponse' {Bool
errored :: Bool
$sel:errored:PutPipelineDefinitionResponse' :: PutPipelineDefinitionResponse -> Bool
errored} -> Bool
errored) (\s :: PutPipelineDefinitionResponse
s@PutPipelineDefinitionResponse' {} Bool
a -> PutPipelineDefinitionResponse
s {$sel:errored:PutPipelineDefinitionResponse' :: Bool
errored = Bool
a} :: PutPipelineDefinitionResponse)

instance Prelude.NFData PutPipelineDefinitionResponse