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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Returns information about a specific Git blob object.
--
-- /See:/ 'newBlobMetadata' smart constructor.
data BlobMetadata = BlobMetadata'
  { -- | The path to the blob and associated file name, if any.
    BlobMetadata -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
    -- | The file mode permissions of the blob. File mode permission codes
    -- include:
    --
    -- -   @100644@ indicates read\/write
    --
    -- -   @100755@ indicates read\/write\/execute
    --
    -- -   @160000@ indicates a submodule
    --
    -- -   @120000@ indicates a symlink
    BlobMetadata -> Maybe Text
mode :: Prelude.Maybe Prelude.Text,
    -- | The full ID of the blob.
    BlobMetadata -> Maybe Text
blobId :: Prelude.Maybe Prelude.Text
  }
  deriving (BlobMetadata -> BlobMetadata -> Bool
(BlobMetadata -> BlobMetadata -> Bool)
-> (BlobMetadata -> BlobMetadata -> Bool) -> Eq BlobMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BlobMetadata -> BlobMetadata -> Bool
$c/= :: BlobMetadata -> BlobMetadata -> Bool
== :: BlobMetadata -> BlobMetadata -> Bool
$c== :: BlobMetadata -> BlobMetadata -> Bool
Prelude.Eq, ReadPrec [BlobMetadata]
ReadPrec BlobMetadata
Int -> ReadS BlobMetadata
ReadS [BlobMetadata]
(Int -> ReadS BlobMetadata)
-> ReadS [BlobMetadata]
-> ReadPrec BlobMetadata
-> ReadPrec [BlobMetadata]
-> Read BlobMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BlobMetadata]
$creadListPrec :: ReadPrec [BlobMetadata]
readPrec :: ReadPrec BlobMetadata
$creadPrec :: ReadPrec BlobMetadata
readList :: ReadS [BlobMetadata]
$creadList :: ReadS [BlobMetadata]
readsPrec :: Int -> ReadS BlobMetadata
$creadsPrec :: Int -> ReadS BlobMetadata
Prelude.Read, Int -> BlobMetadata -> ShowS
[BlobMetadata] -> ShowS
BlobMetadata -> String
(Int -> BlobMetadata -> ShowS)
-> (BlobMetadata -> String)
-> ([BlobMetadata] -> ShowS)
-> Show BlobMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BlobMetadata] -> ShowS
$cshowList :: [BlobMetadata] -> ShowS
show :: BlobMetadata -> String
$cshow :: BlobMetadata -> String
showsPrec :: Int -> BlobMetadata -> ShowS
$cshowsPrec :: Int -> BlobMetadata -> ShowS
Prelude.Show, (forall x. BlobMetadata -> Rep BlobMetadata x)
-> (forall x. Rep BlobMetadata x -> BlobMetadata)
-> Generic BlobMetadata
forall x. Rep BlobMetadata x -> BlobMetadata
forall x. BlobMetadata -> Rep BlobMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BlobMetadata x -> BlobMetadata
$cfrom :: forall x. BlobMetadata -> Rep BlobMetadata x
Prelude.Generic)

-- |
-- Create a value of 'BlobMetadata' 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:
--
-- 'path', 'blobMetadata_path' - The path to the blob and associated file name, if any.
--
-- 'mode', 'blobMetadata_mode' - The file mode permissions of the blob. File mode permission codes
-- include:
--
-- -   @100644@ indicates read\/write
--
-- -   @100755@ indicates read\/write\/execute
--
-- -   @160000@ indicates a submodule
--
-- -   @120000@ indicates a symlink
--
-- 'blobId', 'blobMetadata_blobId' - The full ID of the blob.
newBlobMetadata ::
  BlobMetadata
newBlobMetadata :: BlobMetadata
newBlobMetadata =
  BlobMetadata' :: Maybe Text -> Maybe Text -> Maybe Text -> BlobMetadata
BlobMetadata'
    { $sel:path:BlobMetadata' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:mode:BlobMetadata' :: Maybe Text
mode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:blobId:BlobMetadata' :: Maybe Text
blobId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The path to the blob and associated file name, if any.
blobMetadata_path :: Lens.Lens' BlobMetadata (Prelude.Maybe Prelude.Text)
blobMetadata_path :: (Maybe Text -> f (Maybe Text)) -> BlobMetadata -> f BlobMetadata
blobMetadata_path = (BlobMetadata -> Maybe Text)
-> (BlobMetadata -> Maybe Text -> BlobMetadata)
-> Lens BlobMetadata BlobMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlobMetadata' {Maybe Text
path :: Maybe Text
$sel:path:BlobMetadata' :: BlobMetadata -> Maybe Text
path} -> Maybe Text
path) (\s :: BlobMetadata
s@BlobMetadata' {} Maybe Text
a -> BlobMetadata
s {$sel:path:BlobMetadata' :: Maybe Text
path = Maybe Text
a} :: BlobMetadata)

-- | The file mode permissions of the blob. File mode permission codes
-- include:
--
-- -   @100644@ indicates read\/write
--
-- -   @100755@ indicates read\/write\/execute
--
-- -   @160000@ indicates a submodule
--
-- -   @120000@ indicates a symlink
blobMetadata_mode :: Lens.Lens' BlobMetadata (Prelude.Maybe Prelude.Text)
blobMetadata_mode :: (Maybe Text -> f (Maybe Text)) -> BlobMetadata -> f BlobMetadata
blobMetadata_mode = (BlobMetadata -> Maybe Text)
-> (BlobMetadata -> Maybe Text -> BlobMetadata)
-> Lens BlobMetadata BlobMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlobMetadata' {Maybe Text
mode :: Maybe Text
$sel:mode:BlobMetadata' :: BlobMetadata -> Maybe Text
mode} -> Maybe Text
mode) (\s :: BlobMetadata
s@BlobMetadata' {} Maybe Text
a -> BlobMetadata
s {$sel:mode:BlobMetadata' :: Maybe Text
mode = Maybe Text
a} :: BlobMetadata)

-- | The full ID of the blob.
blobMetadata_blobId :: Lens.Lens' BlobMetadata (Prelude.Maybe Prelude.Text)
blobMetadata_blobId :: (Maybe Text -> f (Maybe Text)) -> BlobMetadata -> f BlobMetadata
blobMetadata_blobId = (BlobMetadata -> Maybe Text)
-> (BlobMetadata -> Maybe Text -> BlobMetadata)
-> Lens BlobMetadata BlobMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlobMetadata' {Maybe Text
blobId :: Maybe Text
$sel:blobId:BlobMetadata' :: BlobMetadata -> Maybe Text
blobId} -> Maybe Text
blobId) (\s :: BlobMetadata
s@BlobMetadata' {} Maybe Text
a -> BlobMetadata
s {$sel:blobId:BlobMetadata' :: Maybe Text
blobId = Maybe Text
a} :: BlobMetadata)

instance Core.FromJSON BlobMetadata where
  parseJSON :: Value -> Parser BlobMetadata
parseJSON =
    String
-> (Object -> Parser BlobMetadata) -> Value -> Parser BlobMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BlobMetadata"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> BlobMetadata
BlobMetadata'
            (Maybe Text -> Maybe Text -> Maybe Text -> BlobMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> BlobMetadata)
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
"path")
            Parser (Maybe Text -> Maybe Text -> BlobMetadata)
-> Parser (Maybe Text) -> Parser (Maybe Text -> BlobMetadata)
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
"mode")
            Parser (Maybe Text -> BlobMetadata)
-> Parser (Maybe Text) -> Parser BlobMetadata
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")
      )

instance Prelude.Hashable BlobMetadata

instance Prelude.NFData BlobMetadata