{-# 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.CodeArtifact.Types.UpstreamRepositoryInfo
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CodeArtifact.Types.UpstreamRepositoryInfo where

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

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

-- |
-- Create a value of 'UpstreamRepositoryInfo' 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:
--
-- 'repositoryName', 'upstreamRepositoryInfo_repositoryName' - The name of an upstream repository.
newUpstreamRepositoryInfo ::
  UpstreamRepositoryInfo
newUpstreamRepositoryInfo :: UpstreamRepositoryInfo
newUpstreamRepositoryInfo =
  UpstreamRepositoryInfo'
    { $sel:repositoryName:UpstreamRepositoryInfo' :: Maybe Text
repositoryName =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The name of an upstream repository.
upstreamRepositoryInfo_repositoryName :: Lens.Lens' UpstreamRepositoryInfo (Prelude.Maybe Prelude.Text)
upstreamRepositoryInfo_repositoryName :: Lens' UpstreamRepositoryInfo (Maybe Text)
upstreamRepositoryInfo_repositoryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpstreamRepositoryInfo' {Maybe Text
repositoryName :: Maybe Text
$sel:repositoryName:UpstreamRepositoryInfo' :: UpstreamRepositoryInfo -> Maybe Text
repositoryName} -> Maybe Text
repositoryName) (\s :: UpstreamRepositoryInfo
s@UpstreamRepositoryInfo' {} Maybe Text
a -> UpstreamRepositoryInfo
s {$sel:repositoryName:UpstreamRepositoryInfo' :: Maybe Text
repositoryName = Maybe Text
a} :: UpstreamRepositoryInfo)

instance Data.FromJSON UpstreamRepositoryInfo where
  parseJSON :: Value -> Parser UpstreamRepositoryInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UpstreamRepositoryInfo"
      ( \Object
x ->
          Maybe Text -> UpstreamRepositoryInfo
UpstreamRepositoryInfo'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"repositoryName")
      )

instance Prelude.Hashable UpstreamRepositoryInfo where
  hashWithSalt :: Int -> UpstreamRepositoryInfo -> Int
hashWithSalt Int
_salt UpstreamRepositoryInfo' {Maybe Text
repositoryName :: Maybe Text
$sel:repositoryName:UpstreamRepositoryInfo' :: UpstreamRepositoryInfo -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
repositoryName

instance Prelude.NFData UpstreamRepositoryInfo where
  rnf :: UpstreamRepositoryInfo -> ()
rnf UpstreamRepositoryInfo' {Maybe Text
repositoryName :: Maybe Text
$sel:repositoryName:UpstreamRepositoryInfo' :: UpstreamRepositoryInfo -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
repositoryName