{-# 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.CodeCommit.Types.RepositoryNameIdPair
-- 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.CodeCommit.Types.RepositoryNameIdPair where

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

-- | Information about a repository name and ID.
--
-- /See:/ 'newRepositoryNameIdPair' smart constructor.
data RepositoryNameIdPair = RepositoryNameIdPair'
  { -- | The ID associated with the repository.
    RepositoryNameIdPair -> Maybe Text
repositoryId :: Prelude.Maybe Prelude.Text,
    -- | The name associated with the repository.
    RepositoryNameIdPair -> Maybe Text
repositoryName :: Prelude.Maybe Prelude.Text
  }
  deriving (RepositoryNameIdPair -> RepositoryNameIdPair -> Bool
(RepositoryNameIdPair -> RepositoryNameIdPair -> Bool)
-> (RepositoryNameIdPair -> RepositoryNameIdPair -> Bool)
-> Eq RepositoryNameIdPair
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RepositoryNameIdPair -> RepositoryNameIdPair -> Bool
$c/= :: RepositoryNameIdPair -> RepositoryNameIdPair -> Bool
== :: RepositoryNameIdPair -> RepositoryNameIdPair -> Bool
$c== :: RepositoryNameIdPair -> RepositoryNameIdPair -> Bool
Prelude.Eq, ReadPrec [RepositoryNameIdPair]
ReadPrec RepositoryNameIdPair
Int -> ReadS RepositoryNameIdPair
ReadS [RepositoryNameIdPair]
(Int -> ReadS RepositoryNameIdPair)
-> ReadS [RepositoryNameIdPair]
-> ReadPrec RepositoryNameIdPair
-> ReadPrec [RepositoryNameIdPair]
-> Read RepositoryNameIdPair
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RepositoryNameIdPair]
$creadListPrec :: ReadPrec [RepositoryNameIdPair]
readPrec :: ReadPrec RepositoryNameIdPair
$creadPrec :: ReadPrec RepositoryNameIdPair
readList :: ReadS [RepositoryNameIdPair]
$creadList :: ReadS [RepositoryNameIdPair]
readsPrec :: Int -> ReadS RepositoryNameIdPair
$creadsPrec :: Int -> ReadS RepositoryNameIdPair
Prelude.Read, Int -> RepositoryNameIdPair -> ShowS
[RepositoryNameIdPair] -> ShowS
RepositoryNameIdPair -> String
(Int -> RepositoryNameIdPair -> ShowS)
-> (RepositoryNameIdPair -> String)
-> ([RepositoryNameIdPair] -> ShowS)
-> Show RepositoryNameIdPair
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RepositoryNameIdPair] -> ShowS
$cshowList :: [RepositoryNameIdPair] -> ShowS
show :: RepositoryNameIdPair -> String
$cshow :: RepositoryNameIdPair -> String
showsPrec :: Int -> RepositoryNameIdPair -> ShowS
$cshowsPrec :: Int -> RepositoryNameIdPair -> ShowS
Prelude.Show, (forall x. RepositoryNameIdPair -> Rep RepositoryNameIdPair x)
-> (forall x. Rep RepositoryNameIdPair x -> RepositoryNameIdPair)
-> Generic RepositoryNameIdPair
forall x. Rep RepositoryNameIdPair x -> RepositoryNameIdPair
forall x. RepositoryNameIdPair -> Rep RepositoryNameIdPair x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RepositoryNameIdPair x -> RepositoryNameIdPair
$cfrom :: forall x. RepositoryNameIdPair -> Rep RepositoryNameIdPair x
Prelude.Generic)

-- |
-- Create a value of 'RepositoryNameIdPair' 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:
--
-- 'repositoryId', 'repositoryNameIdPair_repositoryId' - The ID associated with the repository.
--
-- 'repositoryName', 'repositoryNameIdPair_repositoryName' - The name associated with the repository.
newRepositoryNameIdPair ::
  RepositoryNameIdPair
newRepositoryNameIdPair :: RepositoryNameIdPair
newRepositoryNameIdPair =
  RepositoryNameIdPair' :: Maybe Text -> Maybe Text -> RepositoryNameIdPair
RepositoryNameIdPair'
    { $sel:repositoryId:RepositoryNameIdPair' :: Maybe Text
repositoryId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:RepositoryNameIdPair' :: Maybe Text
repositoryName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID associated with the repository.
repositoryNameIdPair_repositoryId :: Lens.Lens' RepositoryNameIdPair (Prelude.Maybe Prelude.Text)
repositoryNameIdPair_repositoryId :: (Maybe Text -> f (Maybe Text))
-> RepositoryNameIdPair -> f RepositoryNameIdPair
repositoryNameIdPair_repositoryId = (RepositoryNameIdPair -> Maybe Text)
-> (RepositoryNameIdPair -> Maybe Text -> RepositoryNameIdPair)
-> Lens
     RepositoryNameIdPair RepositoryNameIdPair (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryNameIdPair' {Maybe Text
repositoryId :: Maybe Text
$sel:repositoryId:RepositoryNameIdPair' :: RepositoryNameIdPair -> Maybe Text
repositoryId} -> Maybe Text
repositoryId) (\s :: RepositoryNameIdPair
s@RepositoryNameIdPair' {} Maybe Text
a -> RepositoryNameIdPair
s {$sel:repositoryId:RepositoryNameIdPair' :: Maybe Text
repositoryId = Maybe Text
a} :: RepositoryNameIdPair)

-- | The name associated with the repository.
repositoryNameIdPair_repositoryName :: Lens.Lens' RepositoryNameIdPair (Prelude.Maybe Prelude.Text)
repositoryNameIdPair_repositoryName :: (Maybe Text -> f (Maybe Text))
-> RepositoryNameIdPair -> f RepositoryNameIdPair
repositoryNameIdPair_repositoryName = (RepositoryNameIdPair -> Maybe Text)
-> (RepositoryNameIdPair -> Maybe Text -> RepositoryNameIdPair)
-> Lens
     RepositoryNameIdPair RepositoryNameIdPair (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositoryNameIdPair' {Maybe Text
repositoryName :: Maybe Text
$sel:repositoryName:RepositoryNameIdPair' :: RepositoryNameIdPair -> Maybe Text
repositoryName} -> Maybe Text
repositoryName) (\s :: RepositoryNameIdPair
s@RepositoryNameIdPair' {} Maybe Text
a -> RepositoryNameIdPair
s {$sel:repositoryName:RepositoryNameIdPair' :: Maybe Text
repositoryName = Maybe Text
a} :: RepositoryNameIdPair)

instance Core.FromJSON RepositoryNameIdPair where
  parseJSON :: Value -> Parser RepositoryNameIdPair
parseJSON =
    String
-> (Object -> Parser RepositoryNameIdPair)
-> Value
-> Parser RepositoryNameIdPair
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RepositoryNameIdPair"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> RepositoryNameIdPair
RepositoryNameIdPair'
            (Maybe Text -> Maybe Text -> RepositoryNameIdPair)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> RepositoryNameIdPair)
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
"repositoryId")
            Parser (Maybe Text -> RepositoryNameIdPair)
-> Parser (Maybe Text) -> Parser RepositoryNameIdPair
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
"repositoryName")
      )

instance Prelude.Hashable RepositoryNameIdPair

instance Prelude.NFData RepositoryNameIdPair