{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CodeCommit.Types.BlobMetadata 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

-- | Returns information about a specific Git blob object.
--
-- /See:/ 'newBlobMetadata' smart constructor.
data BlobMetadata = BlobMetadata'
  { -- | The full ID of the blob.
    BlobMetadata -> Maybe Text
blobId :: 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 path to the blob and associated file name, if any.
    BlobMetadata -> Maybe Text
path :: Prelude.Maybe Prelude.Text
  }
  deriving (BlobMetadata -> BlobMetadata -> Bool
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]
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
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. 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:
--
-- 'blobId', 'blobMetadata_blobId' - The full ID of the blob.
--
-- '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
--
-- 'path', 'blobMetadata_path' - The path to the blob and associated file name, if any.
newBlobMetadata ::
  BlobMetadata
newBlobMetadata :: BlobMetadata
newBlobMetadata =
  BlobMetadata'
    { $sel:blobId:BlobMetadata' :: Maybe Text
blobId = forall a. Maybe a
Prelude.Nothing,
      $sel:mode:BlobMetadata' :: Maybe Text
mode = forall a. Maybe a
Prelude.Nothing,
      $sel:path:BlobMetadata' :: Maybe Text
path = forall a. Maybe a
Prelude.Nothing
    }

-- | The full ID of the blob.
blobMetadata_blobId :: Lens.Lens' BlobMetadata (Prelude.Maybe Prelude.Text)
blobMetadata_blobId :: Lens' BlobMetadata (Maybe Text)
blobMetadata_blobId = 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)

-- | 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 :: Lens' BlobMetadata (Maybe Text)
blobMetadata_mode = 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 path to the blob and associated file name, if any.
blobMetadata_path :: Lens.Lens' BlobMetadata (Prelude.Maybe Prelude.Text)
blobMetadata_path :: Lens' BlobMetadata (Maybe Text)
blobMetadata_path = 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)

instance Data.FromJSON BlobMetadata where
  parseJSON :: Value -> Parser BlobMetadata
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BlobMetadata"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> BlobMetadata
BlobMetadata'
            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
"blobId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"mode")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"path")
      )

instance Prelude.Hashable BlobMetadata where
  hashWithSalt :: Int -> BlobMetadata -> Int
hashWithSalt Int
_salt BlobMetadata' {Maybe Text
path :: Maybe Text
mode :: Maybe Text
blobId :: Maybe Text
$sel:path:BlobMetadata' :: BlobMetadata -> Maybe Text
$sel:mode:BlobMetadata' :: BlobMetadata -> Maybe Text
$sel:blobId:BlobMetadata' :: BlobMetadata -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
blobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
mode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
path

instance Prelude.NFData BlobMetadata where
  rnf :: BlobMetadata -> ()
rnf BlobMetadata' {Maybe Text
path :: Maybe Text
mode :: Maybe Text
blobId :: Maybe Text
$sel:path:BlobMetadata' :: BlobMetadata -> Maybe Text
$sel:mode:BlobMetadata' :: BlobMetadata -> Maybe Text
$sel:blobId:BlobMetadata' :: BlobMetadata -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
blobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
mode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
path