{-# 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.TemplateSyncConfig
-- 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.TemplateSyncConfig 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
import Amazonka.Proton.Types.TemplateType

-- | The detail data for a template sync configuration.
--
-- /See:/ 'newTemplateSyncConfig' smart constructor.
data TemplateSyncConfig = TemplateSyncConfig'
  { -- | A subdirectory path to your template bundle version.
    TemplateSyncConfig -> Maybe Text
subdirectory :: Prelude.Maybe Prelude.Text,
    -- | The repository branch.
    TemplateSyncConfig -> Text
branch :: Prelude.Text,
    -- | The repository name (for example, @myrepos\/myrepo@).
    TemplateSyncConfig -> Text
repositoryName :: Prelude.Text,
    -- | The repository provider.
    TemplateSyncConfig -> RepositoryProvider
repositoryProvider :: RepositoryProvider,
    -- | The template name.
    TemplateSyncConfig -> Text
templateName :: Prelude.Text,
    -- | The template type.
    TemplateSyncConfig -> TemplateType
templateType :: TemplateType
  }
  deriving (TemplateSyncConfig -> TemplateSyncConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateSyncConfig -> TemplateSyncConfig -> Bool
$c/= :: TemplateSyncConfig -> TemplateSyncConfig -> Bool
== :: TemplateSyncConfig -> TemplateSyncConfig -> Bool
$c== :: TemplateSyncConfig -> TemplateSyncConfig -> Bool
Prelude.Eq, ReadPrec [TemplateSyncConfig]
ReadPrec TemplateSyncConfig
Int -> ReadS TemplateSyncConfig
ReadS [TemplateSyncConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemplateSyncConfig]
$creadListPrec :: ReadPrec [TemplateSyncConfig]
readPrec :: ReadPrec TemplateSyncConfig
$creadPrec :: ReadPrec TemplateSyncConfig
readList :: ReadS [TemplateSyncConfig]
$creadList :: ReadS [TemplateSyncConfig]
readsPrec :: Int -> ReadS TemplateSyncConfig
$creadsPrec :: Int -> ReadS TemplateSyncConfig
Prelude.Read, Int -> TemplateSyncConfig -> ShowS
[TemplateSyncConfig] -> ShowS
TemplateSyncConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateSyncConfig] -> ShowS
$cshowList :: [TemplateSyncConfig] -> ShowS
show :: TemplateSyncConfig -> String
$cshow :: TemplateSyncConfig -> String
showsPrec :: Int -> TemplateSyncConfig -> ShowS
$cshowsPrec :: Int -> TemplateSyncConfig -> ShowS
Prelude.Show, forall x. Rep TemplateSyncConfig x -> TemplateSyncConfig
forall x. TemplateSyncConfig -> Rep TemplateSyncConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TemplateSyncConfig x -> TemplateSyncConfig
$cfrom :: forall x. TemplateSyncConfig -> Rep TemplateSyncConfig x
Prelude.Generic)

-- |
-- Create a value of 'TemplateSyncConfig' 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:
--
-- 'subdirectory', 'templateSyncConfig_subdirectory' - A subdirectory path to your template bundle version.
--
-- 'branch', 'templateSyncConfig_branch' - The repository branch.
--
-- 'repositoryName', 'templateSyncConfig_repositoryName' - The repository name (for example, @myrepos\/myrepo@).
--
-- 'repositoryProvider', 'templateSyncConfig_repositoryProvider' - The repository provider.
--
-- 'templateName', 'templateSyncConfig_templateName' - The template name.
--
-- 'templateType', 'templateSyncConfig_templateType' - The template type.
newTemplateSyncConfig ::
  -- | 'branch'
  Prelude.Text ->
  -- | 'repositoryName'
  Prelude.Text ->
  -- | 'repositoryProvider'
  RepositoryProvider ->
  -- | 'templateName'
  Prelude.Text ->
  -- | 'templateType'
  TemplateType ->
  TemplateSyncConfig
newTemplateSyncConfig :: Text
-> Text
-> RepositoryProvider
-> Text
-> TemplateType
-> TemplateSyncConfig
newTemplateSyncConfig
  Text
pBranch_
  Text
pRepositoryName_
  RepositoryProvider
pRepositoryProvider_
  Text
pTemplateName_
  TemplateType
pTemplateType_ =
    TemplateSyncConfig'
      { $sel:subdirectory:TemplateSyncConfig' :: Maybe Text
subdirectory = forall a. Maybe a
Prelude.Nothing,
        $sel:branch:TemplateSyncConfig' :: Text
branch = Text
pBranch_,
        $sel:repositoryName:TemplateSyncConfig' :: Text
repositoryName = Text
pRepositoryName_,
        $sel:repositoryProvider:TemplateSyncConfig' :: RepositoryProvider
repositoryProvider = RepositoryProvider
pRepositoryProvider_,
        $sel:templateName:TemplateSyncConfig' :: Text
templateName = Text
pTemplateName_,
        $sel:templateType:TemplateSyncConfig' :: TemplateType
templateType = TemplateType
pTemplateType_
      }

-- | A subdirectory path to your template bundle version.
templateSyncConfig_subdirectory :: Lens.Lens' TemplateSyncConfig (Prelude.Maybe Prelude.Text)
templateSyncConfig_subdirectory :: Lens' TemplateSyncConfig (Maybe Text)
templateSyncConfig_subdirectory = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSyncConfig' {Maybe Text
subdirectory :: Maybe Text
$sel:subdirectory:TemplateSyncConfig' :: TemplateSyncConfig -> Maybe Text
subdirectory} -> Maybe Text
subdirectory) (\s :: TemplateSyncConfig
s@TemplateSyncConfig' {} Maybe Text
a -> TemplateSyncConfig
s {$sel:subdirectory:TemplateSyncConfig' :: Maybe Text
subdirectory = Maybe Text
a} :: TemplateSyncConfig)

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

-- | The repository name (for example, @myrepos\/myrepo@).
templateSyncConfig_repositoryName :: Lens.Lens' TemplateSyncConfig Prelude.Text
templateSyncConfig_repositoryName :: Lens' TemplateSyncConfig Text
templateSyncConfig_repositoryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSyncConfig' {Text
repositoryName :: Text
$sel:repositoryName:TemplateSyncConfig' :: TemplateSyncConfig -> Text
repositoryName} -> Text
repositoryName) (\s :: TemplateSyncConfig
s@TemplateSyncConfig' {} Text
a -> TemplateSyncConfig
s {$sel:repositoryName:TemplateSyncConfig' :: Text
repositoryName = Text
a} :: TemplateSyncConfig)

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

-- | The template name.
templateSyncConfig_templateName :: Lens.Lens' TemplateSyncConfig Prelude.Text
templateSyncConfig_templateName :: Lens' TemplateSyncConfig Text
templateSyncConfig_templateName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSyncConfig' {Text
templateName :: Text
$sel:templateName:TemplateSyncConfig' :: TemplateSyncConfig -> Text
templateName} -> Text
templateName) (\s :: TemplateSyncConfig
s@TemplateSyncConfig' {} Text
a -> TemplateSyncConfig
s {$sel:templateName:TemplateSyncConfig' :: Text
templateName = Text
a} :: TemplateSyncConfig)

-- | The template type.
templateSyncConfig_templateType :: Lens.Lens' TemplateSyncConfig TemplateType
templateSyncConfig_templateType :: Lens' TemplateSyncConfig TemplateType
templateSyncConfig_templateType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateSyncConfig' {TemplateType
templateType :: TemplateType
$sel:templateType:TemplateSyncConfig' :: TemplateSyncConfig -> TemplateType
templateType} -> TemplateType
templateType) (\s :: TemplateSyncConfig
s@TemplateSyncConfig' {} TemplateType
a -> TemplateSyncConfig
s {$sel:templateType:TemplateSyncConfig' :: TemplateType
templateType = TemplateType
a} :: TemplateSyncConfig)

instance Data.FromJSON TemplateSyncConfig where
  parseJSON :: Value -> Parser TemplateSyncConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TemplateSyncConfig"
      ( \Object
x ->
          Maybe Text
-> Text
-> Text
-> RepositoryProvider
-> Text
-> TemplateType
-> TemplateSyncConfig
TemplateSyncConfig'
            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
"subdirectory")
            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
"repositoryName")
            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
"repositoryProvider")
            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
"templateName")
            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
"templateType")
      )

instance Prelude.Hashable TemplateSyncConfig where
  hashWithSalt :: Int -> TemplateSyncConfig -> Int
hashWithSalt Int
_salt TemplateSyncConfig' {Maybe Text
Text
RepositoryProvider
TemplateType
templateType :: TemplateType
templateName :: Text
repositoryProvider :: RepositoryProvider
repositoryName :: Text
branch :: Text
subdirectory :: Maybe Text
$sel:templateType:TemplateSyncConfig' :: TemplateSyncConfig -> TemplateType
$sel:templateName:TemplateSyncConfig' :: TemplateSyncConfig -> Text
$sel:repositoryProvider:TemplateSyncConfig' :: TemplateSyncConfig -> RepositoryProvider
$sel:repositoryName:TemplateSyncConfig' :: TemplateSyncConfig -> Text
$sel:branch:TemplateSyncConfig' :: TemplateSyncConfig -> Text
$sel:subdirectory:TemplateSyncConfig' :: TemplateSyncConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subdirectory
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
branch
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
repositoryName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RepositoryProvider
repositoryProvider
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
templateName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TemplateType
templateType

instance Prelude.NFData TemplateSyncConfig where
  rnf :: TemplateSyncConfig -> ()
rnf TemplateSyncConfig' {Maybe Text
Text
RepositoryProvider
TemplateType
templateType :: TemplateType
templateName :: Text
repositoryProvider :: RepositoryProvider
repositoryName :: Text
branch :: Text
subdirectory :: Maybe Text
$sel:templateType:TemplateSyncConfig' :: TemplateSyncConfig -> TemplateType
$sel:templateName:TemplateSyncConfig' :: TemplateSyncConfig -> Text
$sel:repositoryProvider:TemplateSyncConfig' :: TemplateSyncConfig -> RepositoryProvider
$sel:repositoryName:TemplateSyncConfig' :: TemplateSyncConfig -> Text
$sel:branch:TemplateSyncConfig' :: TemplateSyncConfig -> Text
$sel:subdirectory:TemplateSyncConfig' :: TemplateSyncConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subdirectory
      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
repositoryName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RepositoryProvider
repositoryProvider
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
templateName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TemplateType
templateType