{-# 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.PipelineIdName
-- 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.PipelineIdName where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains the name and identifier of a pipeline.
--
-- /See:/ 'newPipelineIdName' smart constructor.
data PipelineIdName = PipelineIdName'
  { -- | The name of the pipeline.
    PipelineIdName -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ID of the pipeline that was assigned by AWS Data Pipeline. This is a
    -- string of the form @df-297EG78HU43EEXAMPLE@.
    PipelineIdName -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (PipelineIdName -> PipelineIdName -> Bool
(PipelineIdName -> PipelineIdName -> Bool)
-> (PipelineIdName -> PipelineIdName -> Bool) -> Eq PipelineIdName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipelineIdName -> PipelineIdName -> Bool
$c/= :: PipelineIdName -> PipelineIdName -> Bool
== :: PipelineIdName -> PipelineIdName -> Bool
$c== :: PipelineIdName -> PipelineIdName -> Bool
Prelude.Eq, ReadPrec [PipelineIdName]
ReadPrec PipelineIdName
Int -> ReadS PipelineIdName
ReadS [PipelineIdName]
(Int -> ReadS PipelineIdName)
-> ReadS [PipelineIdName]
-> ReadPrec PipelineIdName
-> ReadPrec [PipelineIdName]
-> Read PipelineIdName
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PipelineIdName]
$creadListPrec :: ReadPrec [PipelineIdName]
readPrec :: ReadPrec PipelineIdName
$creadPrec :: ReadPrec PipelineIdName
readList :: ReadS [PipelineIdName]
$creadList :: ReadS [PipelineIdName]
readsPrec :: Int -> ReadS PipelineIdName
$creadsPrec :: Int -> ReadS PipelineIdName
Prelude.Read, Int -> PipelineIdName -> ShowS
[PipelineIdName] -> ShowS
PipelineIdName -> String
(Int -> PipelineIdName -> ShowS)
-> (PipelineIdName -> String)
-> ([PipelineIdName] -> ShowS)
-> Show PipelineIdName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PipelineIdName] -> ShowS
$cshowList :: [PipelineIdName] -> ShowS
show :: PipelineIdName -> String
$cshow :: PipelineIdName -> String
showsPrec :: Int -> PipelineIdName -> ShowS
$cshowsPrec :: Int -> PipelineIdName -> ShowS
Prelude.Show, (forall x. PipelineIdName -> Rep PipelineIdName x)
-> (forall x. Rep PipelineIdName x -> PipelineIdName)
-> Generic PipelineIdName
forall x. Rep PipelineIdName x -> PipelineIdName
forall x. PipelineIdName -> Rep PipelineIdName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PipelineIdName x -> PipelineIdName
$cfrom :: forall x. PipelineIdName -> Rep PipelineIdName x
Prelude.Generic)

-- |
-- Create a value of 'PipelineIdName' 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:
--
-- 'name', 'pipelineIdName_name' - The name of the pipeline.
--
-- 'id', 'pipelineIdName_id' - The ID of the pipeline that was assigned by AWS Data Pipeline. This is a
-- string of the form @df-297EG78HU43EEXAMPLE@.
newPipelineIdName ::
  PipelineIdName
newPipelineIdName :: PipelineIdName
newPipelineIdName =
  PipelineIdName' :: Maybe Text -> Maybe Text -> PipelineIdName
PipelineIdName'
    { $sel:name:PipelineIdName' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:PipelineIdName' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

instance Core.FromJSON PipelineIdName where
  parseJSON :: Value -> Parser PipelineIdName
parseJSON =
    String
-> (Object -> Parser PipelineIdName)
-> Value
-> Parser PipelineIdName
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PipelineIdName"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> PipelineIdName
PipelineIdName'
            (Maybe Text -> Maybe Text -> PipelineIdName)
-> Parser (Maybe Text) -> Parser (Maybe Text -> PipelineIdName)
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
"name") Parser (Maybe Text -> PipelineIdName)
-> Parser (Maybe Text) -> Parser PipelineIdName
forall (f :: * -> *) a b. Applicative f => 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
"id")
      )

instance Prelude.Hashable PipelineIdName

instance Prelude.NFData PipelineIdName