{-# 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.DataPipeline.Types.PipelineDescription
-- 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)
module Amazonka.DataPipeline.Types.PipelineDescription where

import qualified Amazonka.Core as Core
import Amazonka.DataPipeline.Types.Field
import Amazonka.DataPipeline.Types.Tag
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains pipeline metadata.
--
-- /See:/ 'newPipelineDescription' smart constructor.
data PipelineDescription = PipelineDescription'
  { -- | Description of the pipeline.
    PipelineDescription -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A list of tags to associated with a pipeline. Tags let you control
    -- access to pipelines. For more information, see
    -- <http://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-control-access.html Controlling User Access to Pipelines>
    -- in the /AWS Data Pipeline Developer Guide/.
    PipelineDescription -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The pipeline identifier that was assigned by AWS Data Pipeline. This is
    -- a string of the form @df-297EG78HU43EEXAMPLE@.
    PipelineDescription -> Text
pipelineId :: Prelude.Text,
    -- | The name of the pipeline.
    PipelineDescription -> Text
name :: Prelude.Text,
    -- | A list of read-only fields that contain metadata about the pipeline:
    -- \@userId, \@accountId, and \@pipelineState.
    PipelineDescription -> [Field]
fields :: [Field]
  }
  deriving (PipelineDescription -> PipelineDescription -> Bool
(PipelineDescription -> PipelineDescription -> Bool)
-> (PipelineDescription -> PipelineDescription -> Bool)
-> Eq PipelineDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipelineDescription -> PipelineDescription -> Bool
$c/= :: PipelineDescription -> PipelineDescription -> Bool
== :: PipelineDescription -> PipelineDescription -> Bool
$c== :: PipelineDescription -> PipelineDescription -> Bool
Prelude.Eq, ReadPrec [PipelineDescription]
ReadPrec PipelineDescription
Int -> ReadS PipelineDescription
ReadS [PipelineDescription]
(Int -> ReadS PipelineDescription)
-> ReadS [PipelineDescription]
-> ReadPrec PipelineDescription
-> ReadPrec [PipelineDescription]
-> Read PipelineDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PipelineDescription]
$creadListPrec :: ReadPrec [PipelineDescription]
readPrec :: ReadPrec PipelineDescription
$creadPrec :: ReadPrec PipelineDescription
readList :: ReadS [PipelineDescription]
$creadList :: ReadS [PipelineDescription]
readsPrec :: Int -> ReadS PipelineDescription
$creadsPrec :: Int -> ReadS PipelineDescription
Prelude.Read, Int -> PipelineDescription -> ShowS
[PipelineDescription] -> ShowS
PipelineDescription -> String
(Int -> PipelineDescription -> ShowS)
-> (PipelineDescription -> String)
-> ([PipelineDescription] -> ShowS)
-> Show PipelineDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PipelineDescription] -> ShowS
$cshowList :: [PipelineDescription] -> ShowS
show :: PipelineDescription -> String
$cshow :: PipelineDescription -> String
showsPrec :: Int -> PipelineDescription -> ShowS
$cshowsPrec :: Int -> PipelineDescription -> ShowS
Prelude.Show, (forall x. PipelineDescription -> Rep PipelineDescription x)
-> (forall x. Rep PipelineDescription x -> PipelineDescription)
-> Generic PipelineDescription
forall x. Rep PipelineDescription x -> PipelineDescription
forall x. PipelineDescription -> Rep PipelineDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PipelineDescription x -> PipelineDescription
$cfrom :: forall x. PipelineDescription -> Rep PipelineDescription x
Prelude.Generic)

-- |
-- Create a value of 'PipelineDescription' 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', 'pipelineDescription_description' - Description of the pipeline.
--
-- 'tags', 'pipelineDescription_tags' - A list of tags to associated with a pipeline. Tags let you control
-- access to pipelines. For more information, see
-- <http://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-control-access.html Controlling User Access to Pipelines>
-- in the /AWS Data Pipeline Developer Guide/.
--
-- 'pipelineId', 'pipelineDescription_pipelineId' - The pipeline identifier that was assigned by AWS Data Pipeline. This is
-- a string of the form @df-297EG78HU43EEXAMPLE@.
--
-- 'name', 'pipelineDescription_name' - The name of the pipeline.
--
-- 'fields', 'pipelineDescription_fields' - A list of read-only fields that contain metadata about the pipeline:
-- \@userId, \@accountId, and \@pipelineState.
newPipelineDescription ::
  -- | 'pipelineId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  PipelineDescription
newPipelineDescription :: Text -> Text -> PipelineDescription
newPipelineDescription Text
pPipelineId_ Text
pName_ =
  PipelineDescription' :: Maybe Text
-> Maybe [Tag] -> Text -> Text -> [Field] -> PipelineDescription
PipelineDescription'
    { $sel:description:PipelineDescription' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:PipelineDescription' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineId:PipelineDescription' :: Text
pipelineId = Text
pPipelineId_,
      $sel:name:PipelineDescription' :: Text
name = Text
pName_,
      $sel:fields:PipelineDescription' :: [Field]
fields = [Field]
forall a. Monoid a => a
Prelude.mempty
    }

-- | Description of the pipeline.
pipelineDescription_description :: Lens.Lens' PipelineDescription (Prelude.Maybe Prelude.Text)
pipelineDescription_description :: (Maybe Text -> f (Maybe Text))
-> PipelineDescription -> f PipelineDescription
pipelineDescription_description = (PipelineDescription -> Maybe Text)
-> (PipelineDescription -> Maybe Text -> PipelineDescription)
-> Lens
     PipelineDescription PipelineDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineDescription' {Maybe Text
description :: Maybe Text
$sel:description:PipelineDescription' :: PipelineDescription -> Maybe Text
description} -> Maybe Text
description) (\s :: PipelineDescription
s@PipelineDescription' {} Maybe Text
a -> PipelineDescription
s {$sel:description:PipelineDescription' :: Maybe Text
description = Maybe Text
a} :: PipelineDescription)

-- | A list of tags to associated with a pipeline. Tags let you control
-- access to pipelines. For more information, see
-- <http://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-control-access.html Controlling User Access to Pipelines>
-- in the /AWS Data Pipeline Developer Guide/.
pipelineDescription_tags :: Lens.Lens' PipelineDescription (Prelude.Maybe [Tag])
pipelineDescription_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> PipelineDescription -> f PipelineDescription
pipelineDescription_tags = (PipelineDescription -> Maybe [Tag])
-> (PipelineDescription -> Maybe [Tag] -> PipelineDescription)
-> Lens
     PipelineDescription PipelineDescription (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineDescription' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:PipelineDescription' :: PipelineDescription -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: PipelineDescription
s@PipelineDescription' {} Maybe [Tag]
a -> PipelineDescription
s {$sel:tags:PipelineDescription' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: PipelineDescription) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> PipelineDescription -> f PipelineDescription)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> PipelineDescription
-> f PipelineDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The pipeline identifier that was assigned by AWS Data Pipeline. This is
-- a string of the form @df-297EG78HU43EEXAMPLE@.
pipelineDescription_pipelineId :: Lens.Lens' PipelineDescription Prelude.Text
pipelineDescription_pipelineId :: (Text -> f Text) -> PipelineDescription -> f PipelineDescription
pipelineDescription_pipelineId = (PipelineDescription -> Text)
-> (PipelineDescription -> Text -> PipelineDescription)
-> Lens PipelineDescription PipelineDescription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineDescription' {Text
pipelineId :: Text
$sel:pipelineId:PipelineDescription' :: PipelineDescription -> Text
pipelineId} -> Text
pipelineId) (\s :: PipelineDescription
s@PipelineDescription' {} Text
a -> PipelineDescription
s {$sel:pipelineId:PipelineDescription' :: Text
pipelineId = Text
a} :: PipelineDescription)

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

-- | A list of read-only fields that contain metadata about the pipeline:
-- \@userId, \@accountId, and \@pipelineState.
pipelineDescription_fields :: Lens.Lens' PipelineDescription [Field]
pipelineDescription_fields :: ([Field] -> f [Field])
-> PipelineDescription -> f PipelineDescription
pipelineDescription_fields = (PipelineDescription -> [Field])
-> (PipelineDescription -> [Field] -> PipelineDescription)
-> Lens PipelineDescription PipelineDescription [Field] [Field]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineDescription' {[Field]
fields :: [Field]
$sel:fields:PipelineDescription' :: PipelineDescription -> [Field]
fields} -> [Field]
fields) (\s :: PipelineDescription
s@PipelineDescription' {} [Field]
a -> PipelineDescription
s {$sel:fields:PipelineDescription' :: [Field]
fields = [Field]
a} :: PipelineDescription) (([Field] -> f [Field])
 -> PipelineDescription -> f PipelineDescription)
-> (([Field] -> f [Field]) -> [Field] -> f [Field])
-> ([Field] -> f [Field])
-> PipelineDescription
-> f PipelineDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Field] -> f [Field]) -> [Field] -> f [Field]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON PipelineDescription where
  parseJSON :: Value -> Parser PipelineDescription
parseJSON =
    String
-> (Object -> Parser PipelineDescription)
-> Value
-> Parser PipelineDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PipelineDescription"
      ( \Object
x ->
          Maybe Text
-> Maybe [Tag] -> Text -> Text -> [Field] -> PipelineDescription
PipelineDescription'
            (Maybe Text
 -> Maybe [Tag] -> Text -> Text -> [Field] -> PipelineDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Tag] -> Text -> Text -> [Field] -> PipelineDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"description")
            Parser
  (Maybe [Tag] -> Text -> Text -> [Field] -> PipelineDescription)
-> Parser (Maybe [Tag])
-> Parser (Text -> Text -> [Field] -> PipelineDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Tag]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe [Tag])) -> Maybe [Tag] -> Parser (Maybe [Tag])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Tag]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Text -> Text -> [Field] -> PipelineDescription)
-> Parser Text -> Parser (Text -> [Field] -> PipelineDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"pipelineId")
            Parser (Text -> [Field] -> PipelineDescription)
-> Parser Text -> Parser ([Field] -> PipelineDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
            Parser ([Field] -> PipelineDescription)
-> Parser [Field] -> Parser PipelineDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [Field])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"fields" Parser (Maybe [Field]) -> [Field] -> Parser [Field]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Field]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable PipelineDescription

instance Prelude.NFData PipelineDescription