{-# 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.CodeCommit.Types.SetFileModeEntry
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CodeCommit.Types.SetFileModeEntry where

import Amazonka.CodeCommit.Types.FileModeTypeEnum
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the file mode changes.
--
-- /See:/ 'newSetFileModeEntry' smart constructor.
data SetFileModeEntry = SetFileModeEntry'
  { -- | The full path to the file, including the name of the file.
    SetFileModeEntry -> Text
filePath :: Prelude.Text,
    -- | The file mode for the file.
    SetFileModeEntry -> FileModeTypeEnum
fileMode :: FileModeTypeEnum
  }
  deriving (SetFileModeEntry -> SetFileModeEntry -> Bool
(SetFileModeEntry -> SetFileModeEntry -> Bool)
-> (SetFileModeEntry -> SetFileModeEntry -> Bool)
-> Eq SetFileModeEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetFileModeEntry -> SetFileModeEntry -> Bool
$c/= :: SetFileModeEntry -> SetFileModeEntry -> Bool
== :: SetFileModeEntry -> SetFileModeEntry -> Bool
$c== :: SetFileModeEntry -> SetFileModeEntry -> Bool
Prelude.Eq, ReadPrec [SetFileModeEntry]
ReadPrec SetFileModeEntry
Int -> ReadS SetFileModeEntry
ReadS [SetFileModeEntry]
(Int -> ReadS SetFileModeEntry)
-> ReadS [SetFileModeEntry]
-> ReadPrec SetFileModeEntry
-> ReadPrec [SetFileModeEntry]
-> Read SetFileModeEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetFileModeEntry]
$creadListPrec :: ReadPrec [SetFileModeEntry]
readPrec :: ReadPrec SetFileModeEntry
$creadPrec :: ReadPrec SetFileModeEntry
readList :: ReadS [SetFileModeEntry]
$creadList :: ReadS [SetFileModeEntry]
readsPrec :: Int -> ReadS SetFileModeEntry
$creadsPrec :: Int -> ReadS SetFileModeEntry
Prelude.Read, Int -> SetFileModeEntry -> ShowS
[SetFileModeEntry] -> ShowS
SetFileModeEntry -> String
(Int -> SetFileModeEntry -> ShowS)
-> (SetFileModeEntry -> String)
-> ([SetFileModeEntry] -> ShowS)
-> Show SetFileModeEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetFileModeEntry] -> ShowS
$cshowList :: [SetFileModeEntry] -> ShowS
show :: SetFileModeEntry -> String
$cshow :: SetFileModeEntry -> String
showsPrec :: Int -> SetFileModeEntry -> ShowS
$cshowsPrec :: Int -> SetFileModeEntry -> ShowS
Prelude.Show, (forall x. SetFileModeEntry -> Rep SetFileModeEntry x)
-> (forall x. Rep SetFileModeEntry x -> SetFileModeEntry)
-> Generic SetFileModeEntry
forall x. Rep SetFileModeEntry x -> SetFileModeEntry
forall x. SetFileModeEntry -> Rep SetFileModeEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetFileModeEntry x -> SetFileModeEntry
$cfrom :: forall x. SetFileModeEntry -> Rep SetFileModeEntry x
Prelude.Generic)

-- |
-- Create a value of 'SetFileModeEntry' 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:
--
-- 'filePath', 'setFileModeEntry_filePath' - The full path to the file, including the name of the file.
--
-- 'fileMode', 'setFileModeEntry_fileMode' - The file mode for the file.
newSetFileModeEntry ::
  -- | 'filePath'
  Prelude.Text ->
  -- | 'fileMode'
  FileModeTypeEnum ->
  SetFileModeEntry
newSetFileModeEntry :: Text -> FileModeTypeEnum -> SetFileModeEntry
newSetFileModeEntry Text
pFilePath_ FileModeTypeEnum
pFileMode_ =
  SetFileModeEntry' :: Text -> FileModeTypeEnum -> SetFileModeEntry
SetFileModeEntry'
    { $sel:filePath:SetFileModeEntry' :: Text
filePath = Text
pFilePath_,
      $sel:fileMode:SetFileModeEntry' :: FileModeTypeEnum
fileMode = FileModeTypeEnum
pFileMode_
    }

-- | The full path to the file, including the name of the file.
setFileModeEntry_filePath :: Lens.Lens' SetFileModeEntry Prelude.Text
setFileModeEntry_filePath :: (Text -> f Text) -> SetFileModeEntry -> f SetFileModeEntry
setFileModeEntry_filePath = (SetFileModeEntry -> Text)
-> (SetFileModeEntry -> Text -> SetFileModeEntry)
-> Lens SetFileModeEntry SetFileModeEntry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetFileModeEntry' {Text
filePath :: Text
$sel:filePath:SetFileModeEntry' :: SetFileModeEntry -> Text
filePath} -> Text
filePath) (\s :: SetFileModeEntry
s@SetFileModeEntry' {} Text
a -> SetFileModeEntry
s {$sel:filePath:SetFileModeEntry' :: Text
filePath = Text
a} :: SetFileModeEntry)

-- | The file mode for the file.
setFileModeEntry_fileMode :: Lens.Lens' SetFileModeEntry FileModeTypeEnum
setFileModeEntry_fileMode :: (FileModeTypeEnum -> f FileModeTypeEnum)
-> SetFileModeEntry -> f SetFileModeEntry
setFileModeEntry_fileMode = (SetFileModeEntry -> FileModeTypeEnum)
-> (SetFileModeEntry -> FileModeTypeEnum -> SetFileModeEntry)
-> Lens
     SetFileModeEntry SetFileModeEntry FileModeTypeEnum FileModeTypeEnum
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetFileModeEntry' {FileModeTypeEnum
fileMode :: FileModeTypeEnum
$sel:fileMode:SetFileModeEntry' :: SetFileModeEntry -> FileModeTypeEnum
fileMode} -> FileModeTypeEnum
fileMode) (\s :: SetFileModeEntry
s@SetFileModeEntry' {} FileModeTypeEnum
a -> SetFileModeEntry
s {$sel:fileMode:SetFileModeEntry' :: FileModeTypeEnum
fileMode = FileModeTypeEnum
a} :: SetFileModeEntry)

instance Prelude.Hashable SetFileModeEntry

instance Prelude.NFData SetFileModeEntry

instance Core.ToJSON SetFileModeEntry where
  toJSON :: SetFileModeEntry -> Value
toJSON SetFileModeEntry' {Text
FileModeTypeEnum
fileMode :: FileModeTypeEnum
filePath :: Text
$sel:fileMode:SetFileModeEntry' :: SetFileModeEntry -> FileModeTypeEnum
$sel:filePath:SetFileModeEntry' :: SetFileModeEntry -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"filePath" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
filePath),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"fileMode" Text -> FileModeTypeEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FileModeTypeEnum
fileMode)
          ]
      )