{-# 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.RepositoryBranch
-- 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.RepositoryBranch 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

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

-- |
-- Create a value of 'RepositoryBranch' 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', 'repositoryBranch_arn' - The Amazon Resource Name (ARN) of the linked repository.
--
-- 'branch', 'repositoryBranch_branch' - The repository branch.
--
-- 'name', 'repositoryBranch_name' - The repository name.
--
-- 'provider', 'repositoryBranch_provider' - The repository provider.
newRepositoryBranch ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'branch'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'provider'
  RepositoryProvider ->
  RepositoryBranch
newRepositoryBranch :: Text -> Text -> Text -> RepositoryProvider -> RepositoryBranch
newRepositoryBranch Text
pArn_ Text
pBranch_ Text
pName_ RepositoryProvider
pProvider_ =
  RepositoryBranch'
    { $sel:arn:RepositoryBranch' :: Text
arn = Text
pArn_,
      $sel:branch:RepositoryBranch' :: Text
branch = Text
pBranch_,
      $sel:name:RepositoryBranch' :: Text
name = Text
pName_,
      $sel:provider:RepositoryBranch' :: RepositoryProvider
provider = RepositoryProvider
pProvider_
    }

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

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

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

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

instance Data.FromJSON RepositoryBranch where
  parseJSON :: Value -> Parser RepositoryBranch
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RepositoryBranch"
      ( \Object
x ->
          Text -> Text -> Text -> RepositoryProvider -> RepositoryBranch
RepositoryBranch'
            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
"branch")
            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 RepositoryBranch where
  hashWithSalt :: Int -> RepositoryBranch -> Int
hashWithSalt Int
_salt RepositoryBranch' {Text
RepositoryProvider
provider :: RepositoryProvider
name :: Text
branch :: Text
arn :: Text
$sel:provider:RepositoryBranch' :: RepositoryBranch -> RepositoryProvider
$sel:name:RepositoryBranch' :: RepositoryBranch -> Text
$sel:branch:RepositoryBranch' :: RepositoryBranch -> Text
$sel:arn:RepositoryBranch' :: RepositoryBranch -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
branch
      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 RepositoryBranch where
  rnf :: RepositoryBranch -> ()
rnf RepositoryBranch' {Text
RepositoryProvider
provider :: RepositoryProvider
name :: Text
branch :: Text
arn :: Text
$sel:provider:RepositoryBranch' :: RepositoryBranch -> RepositoryProvider
$sel:name:RepositoryBranch' :: RepositoryBranch -> Text
$sel:branch:RepositoryBranch' :: RepositoryBranch -> Text
$sel:arn:RepositoryBranch' :: RepositoryBranch -> 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
branch
      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