{-# 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 #-}
module Amazonka.CodeCommit.Types.Location where
import Amazonka.CodeCommit.Types.RelativeFileVersionEnum
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
data Location = Location'
{
Location -> Maybe Text
filePath :: Prelude.Maybe Prelude.Text,
Location -> Maybe Integer
filePosition :: Prelude.Maybe Prelude.Integer,
Location -> Maybe RelativeFileVersionEnum
relativeFileVersion :: Prelude.Maybe RelativeFileVersionEnum
}
deriving (Location -> Location -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Location -> Location -> Bool
$c/= :: Location -> Location -> Bool
== :: Location -> Location -> Bool
$c== :: Location -> Location -> Bool
Prelude.Eq, ReadPrec [Location]
ReadPrec Location
Int -> ReadS Location
ReadS [Location]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Location]
$creadListPrec :: ReadPrec [Location]
readPrec :: ReadPrec Location
$creadPrec :: ReadPrec Location
readList :: ReadS [Location]
$creadList :: ReadS [Location]
readsPrec :: Int -> ReadS Location
$creadsPrec :: Int -> ReadS Location
Prelude.Read, Int -> Location -> ShowS
[Location] -> ShowS
Location -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Location] -> ShowS
$cshowList :: [Location] -> ShowS
show :: Location -> String
$cshow :: Location -> String
showsPrec :: Int -> Location -> ShowS
$cshowsPrec :: Int -> Location -> ShowS
Prelude.Show, forall x. Rep Location x -> Location
forall x. Location -> Rep Location x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Location x -> Location
$cfrom :: forall x. Location -> Rep Location x
Prelude.Generic)
newLocation ::
Location
newLocation :: Location
newLocation =
Location'
{ $sel:filePath:Location' :: Maybe Text
filePath = forall a. Maybe a
Prelude.Nothing,
$sel:filePosition:Location' :: Maybe Integer
filePosition = forall a. Maybe a
Prelude.Nothing,
$sel:relativeFileVersion:Location' :: Maybe RelativeFileVersionEnum
relativeFileVersion = forall a. Maybe a
Prelude.Nothing
}
location_filePath :: Lens.Lens' Location (Prelude.Maybe Prelude.Text)
location_filePath :: Lens' Location (Maybe Text)
location_filePath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe Text
filePath :: Maybe Text
$sel:filePath:Location' :: Location -> Maybe Text
filePath} -> Maybe Text
filePath) (\s :: Location
s@Location' {} Maybe Text
a -> Location
s {$sel:filePath:Location' :: Maybe Text
filePath = Maybe Text
a} :: Location)
location_filePosition :: Lens.Lens' Location (Prelude.Maybe Prelude.Integer)
location_filePosition :: Lens' Location (Maybe Integer)
location_filePosition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe Integer
filePosition :: Maybe Integer
$sel:filePosition:Location' :: Location -> Maybe Integer
filePosition} -> Maybe Integer
filePosition) (\s :: Location
s@Location' {} Maybe Integer
a -> Location
s {$sel:filePosition:Location' :: Maybe Integer
filePosition = Maybe Integer
a} :: Location)
location_relativeFileVersion :: Lens.Lens' Location (Prelude.Maybe RelativeFileVersionEnum)
location_relativeFileVersion :: Lens' Location (Maybe RelativeFileVersionEnum)
location_relativeFileVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe RelativeFileVersionEnum
relativeFileVersion :: Maybe RelativeFileVersionEnum
$sel:relativeFileVersion:Location' :: Location -> Maybe RelativeFileVersionEnum
relativeFileVersion} -> Maybe RelativeFileVersionEnum
relativeFileVersion) (\s :: Location
s@Location' {} Maybe RelativeFileVersionEnum
a -> Location
s {$sel:relativeFileVersion:Location' :: Maybe RelativeFileVersionEnum
relativeFileVersion = Maybe RelativeFileVersionEnum
a} :: Location)
instance Data.FromJSON Location where
parseJSON :: Value -> Parser Location
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Location"
( \Object
x ->
Maybe Text
-> Maybe Integer -> Maybe RelativeFileVersionEnum -> Location
Location'
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
"filePath")
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
"filePosition")
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
"relativeFileVersion")
)
instance Prelude.Hashable Location where
hashWithSalt :: Int -> Location -> Int
hashWithSalt Int
_salt Location' {Maybe Integer
Maybe Text
Maybe RelativeFileVersionEnum
relativeFileVersion :: Maybe RelativeFileVersionEnum
filePosition :: Maybe Integer
filePath :: Maybe Text
$sel:relativeFileVersion:Location' :: Location -> Maybe RelativeFileVersionEnum
$sel:filePosition:Location' :: Location -> Maybe Integer
$sel:filePath:Location' :: Location -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
filePath
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
filePosition
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RelativeFileVersionEnum
relativeFileVersion
instance Prelude.NFData Location where
rnf :: Location -> ()
rnf Location' {Maybe Integer
Maybe Text
Maybe RelativeFileVersionEnum
relativeFileVersion :: Maybe RelativeFileVersionEnum
filePosition :: Maybe Integer
filePath :: Maybe Text
$sel:relativeFileVersion:Location' :: Location -> Maybe RelativeFileVersionEnum
$sel:filePosition:Location' :: Location -> Maybe Integer
$sel:filePath:Location' :: Location -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
filePath
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
filePosition
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RelativeFileVersionEnum
relativeFileVersion
instance Data.ToJSON Location where
toJSON :: Location -> Value
toJSON Location' {Maybe Integer
Maybe Text
Maybe RelativeFileVersionEnum
relativeFileVersion :: Maybe RelativeFileVersionEnum
filePosition :: Maybe Integer
filePath :: Maybe Text
$sel:relativeFileVersion:Location' :: Location -> Maybe RelativeFileVersionEnum
$sel:filePosition:Location' :: Location -> Maybe Integer
$sel:filePath:Location' :: Location -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"filePath" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
filePath,
(Key
"filePosition" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
filePosition,
(Key
"relativeFileVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RelativeFileVersionEnum
relativeFileVersion
]
)