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

-- | A repository sync definition.
--
-- /See:/ 'newRepositorySyncDefinition' smart constructor.
data RepositorySyncDefinition = RepositorySyncDefinition'
  { -- | The repository branch.
    RepositorySyncDefinition -> Text
branch :: Prelude.Text,
    -- | The directory in the repository.
    RepositorySyncDefinition -> Text
directory :: Prelude.Text,
    -- | The resource that is synced from.
    RepositorySyncDefinition -> Text
parent :: Prelude.Text,
    -- | The resource that is synced to.
    RepositorySyncDefinition -> Text
target :: Prelude.Text
  }
  deriving (RepositorySyncDefinition -> RepositorySyncDefinition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RepositorySyncDefinition -> RepositorySyncDefinition -> Bool
$c/= :: RepositorySyncDefinition -> RepositorySyncDefinition -> Bool
== :: RepositorySyncDefinition -> RepositorySyncDefinition -> Bool
$c== :: RepositorySyncDefinition -> RepositorySyncDefinition -> Bool
Prelude.Eq, ReadPrec [RepositorySyncDefinition]
ReadPrec RepositorySyncDefinition
Int -> ReadS RepositorySyncDefinition
ReadS [RepositorySyncDefinition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RepositorySyncDefinition]
$creadListPrec :: ReadPrec [RepositorySyncDefinition]
readPrec :: ReadPrec RepositorySyncDefinition
$creadPrec :: ReadPrec RepositorySyncDefinition
readList :: ReadS [RepositorySyncDefinition]
$creadList :: ReadS [RepositorySyncDefinition]
readsPrec :: Int -> ReadS RepositorySyncDefinition
$creadsPrec :: Int -> ReadS RepositorySyncDefinition
Prelude.Read, Int -> RepositorySyncDefinition -> ShowS
[RepositorySyncDefinition] -> ShowS
RepositorySyncDefinition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RepositorySyncDefinition] -> ShowS
$cshowList :: [RepositorySyncDefinition] -> ShowS
show :: RepositorySyncDefinition -> String
$cshow :: RepositorySyncDefinition -> String
showsPrec :: Int -> RepositorySyncDefinition -> ShowS
$cshowsPrec :: Int -> RepositorySyncDefinition -> ShowS
Prelude.Show, forall x.
Rep RepositorySyncDefinition x -> RepositorySyncDefinition
forall x.
RepositorySyncDefinition -> Rep RepositorySyncDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RepositorySyncDefinition x -> RepositorySyncDefinition
$cfrom :: forall x.
RepositorySyncDefinition -> Rep RepositorySyncDefinition x
Prelude.Generic)

-- |
-- Create a value of 'RepositorySyncDefinition' 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:
--
-- 'branch', 'repositorySyncDefinition_branch' - The repository branch.
--
-- 'directory', 'repositorySyncDefinition_directory' - The directory in the repository.
--
-- 'parent', 'repositorySyncDefinition_parent' - The resource that is synced from.
--
-- 'target', 'repositorySyncDefinition_target' - The resource that is synced to.
newRepositorySyncDefinition ::
  -- | 'branch'
  Prelude.Text ->
  -- | 'directory'
  Prelude.Text ->
  -- | 'parent'
  Prelude.Text ->
  -- | 'target'
  Prelude.Text ->
  RepositorySyncDefinition
newRepositorySyncDefinition :: Text -> Text -> Text -> Text -> RepositorySyncDefinition
newRepositorySyncDefinition
  Text
pBranch_
  Text
pDirectory_
  Text
pParent_
  Text
pTarget_ =
    RepositorySyncDefinition'
      { $sel:branch:RepositorySyncDefinition' :: Text
branch = Text
pBranch_,
        $sel:directory:RepositorySyncDefinition' :: Text
directory = Text
pDirectory_,
        $sel:parent:RepositorySyncDefinition' :: Text
parent = Text
pParent_,
        $sel:target:RepositorySyncDefinition' :: Text
target = Text
pTarget_
      }

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

-- | The directory in the repository.
repositorySyncDefinition_directory :: Lens.Lens' RepositorySyncDefinition Prelude.Text
repositorySyncDefinition_directory :: Lens' RepositorySyncDefinition Text
repositorySyncDefinition_directory = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositorySyncDefinition' {Text
directory :: Text
$sel:directory:RepositorySyncDefinition' :: RepositorySyncDefinition -> Text
directory} -> Text
directory) (\s :: RepositorySyncDefinition
s@RepositorySyncDefinition' {} Text
a -> RepositorySyncDefinition
s {$sel:directory:RepositorySyncDefinition' :: Text
directory = Text
a} :: RepositorySyncDefinition)

-- | The resource that is synced from.
repositorySyncDefinition_parent :: Lens.Lens' RepositorySyncDefinition Prelude.Text
repositorySyncDefinition_parent :: Lens' RepositorySyncDefinition Text
repositorySyncDefinition_parent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositorySyncDefinition' {Text
parent :: Text
$sel:parent:RepositorySyncDefinition' :: RepositorySyncDefinition -> Text
parent} -> Text
parent) (\s :: RepositorySyncDefinition
s@RepositorySyncDefinition' {} Text
a -> RepositorySyncDefinition
s {$sel:parent:RepositorySyncDefinition' :: Text
parent = Text
a} :: RepositorySyncDefinition)

-- | The resource that is synced to.
repositorySyncDefinition_target :: Lens.Lens' RepositorySyncDefinition Prelude.Text
repositorySyncDefinition_target :: Lens' RepositorySyncDefinition Text
repositorySyncDefinition_target = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RepositorySyncDefinition' {Text
target :: Text
$sel:target:RepositorySyncDefinition' :: RepositorySyncDefinition -> Text
target} -> Text
target) (\s :: RepositorySyncDefinition
s@RepositorySyncDefinition' {} Text
a -> RepositorySyncDefinition
s {$sel:target:RepositorySyncDefinition' :: Text
target = Text
a} :: RepositorySyncDefinition)

instance Data.FromJSON RepositorySyncDefinition where
  parseJSON :: Value -> Parser RepositorySyncDefinition
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RepositorySyncDefinition"
      ( \Object
x ->
          Text -> Text -> Text -> Text -> RepositorySyncDefinition
RepositorySyncDefinition'
            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
"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
"directory")
            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
"parent")
            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
"target")
      )

instance Prelude.Hashable RepositorySyncDefinition where
  hashWithSalt :: Int -> RepositorySyncDefinition -> Int
hashWithSalt Int
_salt RepositorySyncDefinition' {Text
target :: Text
parent :: Text
directory :: Text
branch :: Text
$sel:target:RepositorySyncDefinition' :: RepositorySyncDefinition -> Text
$sel:parent:RepositorySyncDefinition' :: RepositorySyncDefinition -> Text
$sel:directory:RepositorySyncDefinition' :: RepositorySyncDefinition -> Text
$sel:branch:RepositorySyncDefinition' :: RepositorySyncDefinition -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
branch
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
directory
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
parent
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
target

instance Prelude.NFData RepositorySyncDefinition where
  rnf :: RepositorySyncDefinition -> ()
rnf RepositorySyncDefinition' {Text
target :: Text
parent :: Text
directory :: Text
branch :: Text
$sel:target:RepositorySyncDefinition' :: RepositorySyncDefinition -> Text
$sel:parent:RepositorySyncDefinition' :: RepositorySyncDefinition -> Text
$sel:directory:RepositorySyncDefinition' :: RepositorySyncDefinition -> Text
$sel:branch:RepositorySyncDefinition' :: RepositorySyncDefinition -> Text
..} =
    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
directory
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
parent
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
target