{-# 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.Proton.Types.RepositorySummary
-- 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.Proton.Types.RepositorySummary 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
import Amazonka.Proton.Types.RepositoryProvider

-- | Summary data of a linked repository—a repository that has been
-- registered with Proton.
--
-- /See:/ 'newRepositorySummary' smart constructor.
data RepositorySummary = RepositorySummary'
  { -- | The Amazon Resource Name (ARN) of the linked repository.
    RepositorySummary -> Text
arn :: Prelude.Text,
    -- | The repository name.
    RepositorySummary -> Text
name :: Prelude.Text,
    -- | The repository provider.
    RepositorySummary -> RepositoryProvider
provider :: RepositoryProvider
  }
  deriving (RepositorySummary -> RepositorySummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RepositorySummary -> RepositorySummary -> Bool
$c/= :: RepositorySummary -> RepositorySummary -> Bool
== :: RepositorySummary -> RepositorySummary -> Bool
$c== :: RepositorySummary -> RepositorySummary -> Bool
Prelude.Eq, ReadPrec [RepositorySummary]
ReadPrec RepositorySummary
Int -> ReadS RepositorySummary
ReadS [RepositorySummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RepositorySummary]
$creadListPrec :: ReadPrec [RepositorySummary]
readPrec :: ReadPrec RepositorySummary
$creadPrec :: ReadPrec RepositorySummary
readList :: ReadS [RepositorySummary]
$creadList :: ReadS [RepositorySummary]
readsPrec :: Int -> ReadS RepositorySummary
$creadsPrec :: Int -> ReadS RepositorySummary
Prelude.Read, Int -> RepositorySummary -> ShowS
[RepositorySummary] -> ShowS
RepositorySummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RepositorySummary] -> ShowS
$cshowList :: [RepositorySummary] -> ShowS
show :: RepositorySummary -> String
$cshow :: RepositorySummary -> String
showsPrec :: Int -> RepositorySummary -> ShowS
$cshowsPrec :: Int -> RepositorySummary -> ShowS
Prelude.Show, forall x. Rep RepositorySummary x -> RepositorySummary
forall x. RepositorySummary -> Rep RepositorySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RepositorySummary x -> RepositorySummary
$cfrom :: forall x. RepositorySummary -> Rep RepositorySummary x
Prelude.Generic)

-- |
-- Create a value of 'RepositorySummary' 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:
--
-- 'arn', 'repositorySummary_arn' - The Amazon Resource Name (ARN) of the linked repository.
--
-- 'name', 'repositorySummary_name' - The repository name.
--
-- 'provider', 'repositorySummary_provider' - The repository provider.
newRepositorySummary ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'provider'
  RepositoryProvider ->
  RepositorySummary
newRepositorySummary :: Text -> Text -> RepositoryProvider -> RepositorySummary
newRepositorySummary Text
pArn_ Text
pName_ RepositoryProvider
pProvider_ =
  RepositorySummary'
    { $sel:arn:RepositorySummary' :: Text
arn = Text
pArn_,
      $sel:name:RepositorySummary' :: Text
name = Text
pName_,
      $sel:provider:RepositorySummary' :: RepositoryProvider
provider = RepositoryProvider
pProvider_
    }

-- | The Amazon Resource Name (ARN) of the linked repository.
repositorySummary_arn :: Lens.Lens' RepositorySummary Prelude.Text
repositorySummary_arn :: Lens' RepositorySummary Text
repositorySummary_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositorySummary' {Text
arn :: Text
$sel:arn:RepositorySummary' :: RepositorySummary -> Text
arn} -> Text
arn) (\s :: RepositorySummary
s@RepositorySummary' {} Text
a -> RepositorySummary
s {$sel:arn:RepositorySummary' :: Text
arn = Text
a} :: RepositorySummary)

-- | The repository name.
repositorySummary_name :: Lens.Lens' RepositorySummary Prelude.Text
repositorySummary_name :: Lens' RepositorySummary Text
repositorySummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositorySummary' {Text
name :: Text
$sel:name:RepositorySummary' :: RepositorySummary -> Text
name} -> Text
name) (\s :: RepositorySummary
s@RepositorySummary' {} Text
a -> RepositorySummary
s {$sel:name:RepositorySummary' :: Text
name = Text
a} :: RepositorySummary)

-- | The repository provider.
repositorySummary_provider :: Lens.Lens' RepositorySummary RepositoryProvider
repositorySummary_provider :: Lens' RepositorySummary RepositoryProvider
repositorySummary_provider = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositorySummary' {RepositoryProvider
provider :: RepositoryProvider
$sel:provider:RepositorySummary' :: RepositorySummary -> RepositoryProvider
provider} -> RepositoryProvider
provider) (\s :: RepositorySummary
s@RepositorySummary' {} RepositoryProvider
a -> RepositorySummary
s {$sel:provider:RepositorySummary' :: RepositoryProvider
provider = RepositoryProvider
a} :: RepositorySummary)

instance Data.FromJSON RepositorySummary where
  parseJSON :: Value -> Parser RepositorySummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RepositorySummary"
      ( \Object
x ->
          Text -> Text -> RepositoryProvider -> RepositorySummary
RepositorySummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"provider")
      )

instance Prelude.Hashable RepositorySummary where
  hashWithSalt :: Int -> RepositorySummary -> Int
hashWithSalt Int
_salt RepositorySummary' {Text
RepositoryProvider
provider :: RepositoryProvider
name :: Text
arn :: Text
$sel:provider:RepositorySummary' :: RepositorySummary -> RepositoryProvider
$sel:name:RepositorySummary' :: RepositorySummary -> Text
$sel:arn:RepositorySummary' :: RepositorySummary -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RepositoryProvider
provider

instance Prelude.NFData RepositorySummary where
  rnf :: RepositorySummary -> ()
rnf RepositorySummary' {Text
RepositoryProvider
provider :: RepositoryProvider
name :: Text
arn :: Text
$sel:provider:RepositorySummary' :: RepositorySummary -> RepositoryProvider
$sel:name:RepositorySummary' :: RepositorySummary -> Text
$sel:arn:RepositorySummary' :: RepositorySummary -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RepositoryProvider
provider