{-# 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.SymbolicLink
-- 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.SymbolicLink where

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

-- | Returns information about a symbolic link in a repository folder.
--
-- /See:/ 'newSymbolicLink' smart constructor.
data SymbolicLink = SymbolicLink'
  { -- | The fully qualified path to the folder that contains the symbolic link.
    SymbolicLink -> Maybe Text
absolutePath :: Prelude.Maybe Prelude.Text,
    -- | The file mode permissions of the blob that cotains information about the
    -- symbolic link.
    SymbolicLink -> Maybe FileModeTypeEnum
fileMode :: Prelude.Maybe FileModeTypeEnum,
    -- | The blob ID that contains the information about the symbolic link.
    SymbolicLink -> Maybe Text
blobId :: Prelude.Maybe Prelude.Text,
    -- | The relative path of the symbolic link from the folder where the query
    -- originated.
    SymbolicLink -> Maybe Text
relativePath :: Prelude.Maybe Prelude.Text
  }
  deriving (SymbolicLink -> SymbolicLink -> Bool
(SymbolicLink -> SymbolicLink -> Bool)
-> (SymbolicLink -> SymbolicLink -> Bool) -> Eq SymbolicLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SymbolicLink -> SymbolicLink -> Bool
$c/= :: SymbolicLink -> SymbolicLink -> Bool
== :: SymbolicLink -> SymbolicLink -> Bool
$c== :: SymbolicLink -> SymbolicLink -> Bool
Prelude.Eq, ReadPrec [SymbolicLink]
ReadPrec SymbolicLink
Int -> ReadS SymbolicLink
ReadS [SymbolicLink]
(Int -> ReadS SymbolicLink)
-> ReadS [SymbolicLink]
-> ReadPrec SymbolicLink
-> ReadPrec [SymbolicLink]
-> Read SymbolicLink
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SymbolicLink]
$creadListPrec :: ReadPrec [SymbolicLink]
readPrec :: ReadPrec SymbolicLink
$creadPrec :: ReadPrec SymbolicLink
readList :: ReadS [SymbolicLink]
$creadList :: ReadS [SymbolicLink]
readsPrec :: Int -> ReadS SymbolicLink
$creadsPrec :: Int -> ReadS SymbolicLink
Prelude.Read, Int -> SymbolicLink -> ShowS
[SymbolicLink] -> ShowS
SymbolicLink -> String
(Int -> SymbolicLink -> ShowS)
-> (SymbolicLink -> String)
-> ([SymbolicLink] -> ShowS)
-> Show SymbolicLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SymbolicLink] -> ShowS
$cshowList :: [SymbolicLink] -> ShowS
show :: SymbolicLink -> String
$cshow :: SymbolicLink -> String
showsPrec :: Int -> SymbolicLink -> ShowS
$cshowsPrec :: Int -> SymbolicLink -> ShowS
Prelude.Show, (forall x. SymbolicLink -> Rep SymbolicLink x)
-> (forall x. Rep SymbolicLink x -> SymbolicLink)
-> Generic SymbolicLink
forall x. Rep SymbolicLink x -> SymbolicLink
forall x. SymbolicLink -> Rep SymbolicLink x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SymbolicLink x -> SymbolicLink
$cfrom :: forall x. SymbolicLink -> Rep SymbolicLink x
Prelude.Generic)

-- |
-- Create a value of 'SymbolicLink' 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:
--
-- 'absolutePath', 'symbolicLink_absolutePath' - The fully qualified path to the folder that contains the symbolic link.
--
-- 'fileMode', 'symbolicLink_fileMode' - The file mode permissions of the blob that cotains information about the
-- symbolic link.
--
-- 'blobId', 'symbolicLink_blobId' - The blob ID that contains the information about the symbolic link.
--
-- 'relativePath', 'symbolicLink_relativePath' - The relative path of the symbolic link from the folder where the query
-- originated.
newSymbolicLink ::
  SymbolicLink
newSymbolicLink :: SymbolicLink
newSymbolicLink =
  SymbolicLink' :: Maybe Text
-> Maybe FileModeTypeEnum
-> Maybe Text
-> Maybe Text
-> SymbolicLink
SymbolicLink'
    { $sel:absolutePath:SymbolicLink' :: Maybe Text
absolutePath = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fileMode:SymbolicLink' :: Maybe FileModeTypeEnum
fileMode = Maybe FileModeTypeEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:blobId:SymbolicLink' :: Maybe Text
blobId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:relativePath:SymbolicLink' :: Maybe Text
relativePath = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The fully qualified path to the folder that contains the symbolic link.
symbolicLink_absolutePath :: Lens.Lens' SymbolicLink (Prelude.Maybe Prelude.Text)
symbolicLink_absolutePath :: (Maybe Text -> f (Maybe Text)) -> SymbolicLink -> f SymbolicLink
symbolicLink_absolutePath = (SymbolicLink -> Maybe Text)
-> (SymbolicLink -> Maybe Text -> SymbolicLink)
-> Lens SymbolicLink SymbolicLink (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SymbolicLink' {Maybe Text
absolutePath :: Maybe Text
$sel:absolutePath:SymbolicLink' :: SymbolicLink -> Maybe Text
absolutePath} -> Maybe Text
absolutePath) (\s :: SymbolicLink
s@SymbolicLink' {} Maybe Text
a -> SymbolicLink
s {$sel:absolutePath:SymbolicLink' :: Maybe Text
absolutePath = Maybe Text
a} :: SymbolicLink)

-- | The file mode permissions of the blob that cotains information about the
-- symbolic link.
symbolicLink_fileMode :: Lens.Lens' SymbolicLink (Prelude.Maybe FileModeTypeEnum)
symbolicLink_fileMode :: (Maybe FileModeTypeEnum -> f (Maybe FileModeTypeEnum))
-> SymbolicLink -> f SymbolicLink
symbolicLink_fileMode = (SymbolicLink -> Maybe FileModeTypeEnum)
-> (SymbolicLink -> Maybe FileModeTypeEnum -> SymbolicLink)
-> Lens
     SymbolicLink
     SymbolicLink
     (Maybe FileModeTypeEnum)
     (Maybe FileModeTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SymbolicLink' {Maybe FileModeTypeEnum
fileMode :: Maybe FileModeTypeEnum
$sel:fileMode:SymbolicLink' :: SymbolicLink -> Maybe FileModeTypeEnum
fileMode} -> Maybe FileModeTypeEnum
fileMode) (\s :: SymbolicLink
s@SymbolicLink' {} Maybe FileModeTypeEnum
a -> SymbolicLink
s {$sel:fileMode:SymbolicLink' :: Maybe FileModeTypeEnum
fileMode = Maybe FileModeTypeEnum
a} :: SymbolicLink)

-- | The blob ID that contains the information about the symbolic link.
symbolicLink_blobId :: Lens.Lens' SymbolicLink (Prelude.Maybe Prelude.Text)
symbolicLink_blobId :: (Maybe Text -> f (Maybe Text)) -> SymbolicLink -> f SymbolicLink
symbolicLink_blobId = (SymbolicLink -> Maybe Text)
-> (SymbolicLink -> Maybe Text -> SymbolicLink)
-> Lens SymbolicLink SymbolicLink (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SymbolicLink' {Maybe Text
blobId :: Maybe Text
$sel:blobId:SymbolicLink' :: SymbolicLink -> Maybe Text
blobId} -> Maybe Text
blobId) (\s :: SymbolicLink
s@SymbolicLink' {} Maybe Text
a -> SymbolicLink
s {$sel:blobId:SymbolicLink' :: Maybe Text
blobId = Maybe Text
a} :: SymbolicLink)

-- | The relative path of the symbolic link from the folder where the query
-- originated.
symbolicLink_relativePath :: Lens.Lens' SymbolicLink (Prelude.Maybe Prelude.Text)
symbolicLink_relativePath :: (Maybe Text -> f (Maybe Text)) -> SymbolicLink -> f SymbolicLink
symbolicLink_relativePath = (SymbolicLink -> Maybe Text)
-> (SymbolicLink -> Maybe Text -> SymbolicLink)
-> Lens SymbolicLink SymbolicLink (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SymbolicLink' {Maybe Text
relativePath :: Maybe Text
$sel:relativePath:SymbolicLink' :: SymbolicLink -> Maybe Text
relativePath} -> Maybe Text
relativePath) (\s :: SymbolicLink
s@SymbolicLink' {} Maybe Text
a -> SymbolicLink
s {$sel:relativePath:SymbolicLink' :: Maybe Text
relativePath = Maybe Text
a} :: SymbolicLink)

instance Core.FromJSON SymbolicLink where
  parseJSON :: Value -> Parser SymbolicLink
parseJSON =
    String
-> (Object -> Parser SymbolicLink) -> Value -> Parser SymbolicLink
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SymbolicLink"
      ( \Object
x ->
          Maybe Text
-> Maybe FileModeTypeEnum
-> Maybe Text
-> Maybe Text
-> SymbolicLink
SymbolicLink'
            (Maybe Text
 -> Maybe FileModeTypeEnum
 -> Maybe Text
 -> Maybe Text
 -> SymbolicLink)
-> Parser (Maybe Text)
-> Parser
     (Maybe FileModeTypeEnum
      -> Maybe Text -> Maybe Text -> SymbolicLink)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"absolutePath")
            Parser
  (Maybe FileModeTypeEnum
   -> Maybe Text -> Maybe Text -> SymbolicLink)
-> Parser (Maybe FileModeTypeEnum)
-> Parser (Maybe Text -> Maybe Text -> SymbolicLink)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FileModeTypeEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"fileMode")
            Parser (Maybe Text -> Maybe Text -> SymbolicLink)
-> Parser (Maybe Text) -> Parser (Maybe Text -> SymbolicLink)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"blobId")
            Parser (Maybe Text -> SymbolicLink)
-> Parser (Maybe Text) -> Parser SymbolicLink
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"relativePath")
      )

instance Prelude.Hashable SymbolicLink

instance Prelude.NFData SymbolicLink