{-# 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.CodeGuruReviewer.Types.S3BucketRepository where
import Amazonka.CodeGuruReviewer.Types.S3RepositoryDetails
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data S3BucketRepository = S3BucketRepository'
{
S3BucketRepository -> Maybe S3RepositoryDetails
details :: Prelude.Maybe S3RepositoryDetails,
S3BucketRepository -> Text
name :: Prelude.Text
}
deriving (S3BucketRepository -> S3BucketRepository -> Bool
(S3BucketRepository -> S3BucketRepository -> Bool)
-> (S3BucketRepository -> S3BucketRepository -> Bool)
-> Eq S3BucketRepository
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3BucketRepository -> S3BucketRepository -> Bool
$c/= :: S3BucketRepository -> S3BucketRepository -> Bool
== :: S3BucketRepository -> S3BucketRepository -> Bool
$c== :: S3BucketRepository -> S3BucketRepository -> Bool
Prelude.Eq, ReadPrec [S3BucketRepository]
ReadPrec S3BucketRepository
Int -> ReadS S3BucketRepository
ReadS [S3BucketRepository]
(Int -> ReadS S3BucketRepository)
-> ReadS [S3BucketRepository]
-> ReadPrec S3BucketRepository
-> ReadPrec [S3BucketRepository]
-> Read S3BucketRepository
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3BucketRepository]
$creadListPrec :: ReadPrec [S3BucketRepository]
readPrec :: ReadPrec S3BucketRepository
$creadPrec :: ReadPrec S3BucketRepository
readList :: ReadS [S3BucketRepository]
$creadList :: ReadS [S3BucketRepository]
readsPrec :: Int -> ReadS S3BucketRepository
$creadsPrec :: Int -> ReadS S3BucketRepository
Prelude.Read, Int -> S3BucketRepository -> ShowS
[S3BucketRepository] -> ShowS
S3BucketRepository -> String
(Int -> S3BucketRepository -> ShowS)
-> (S3BucketRepository -> String)
-> ([S3BucketRepository] -> ShowS)
-> Show S3BucketRepository
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3BucketRepository] -> ShowS
$cshowList :: [S3BucketRepository] -> ShowS
show :: S3BucketRepository -> String
$cshow :: S3BucketRepository -> String
showsPrec :: Int -> S3BucketRepository -> ShowS
$cshowsPrec :: Int -> S3BucketRepository -> ShowS
Prelude.Show, (forall x. S3BucketRepository -> Rep S3BucketRepository x)
-> (forall x. Rep S3BucketRepository x -> S3BucketRepository)
-> Generic S3BucketRepository
forall x. Rep S3BucketRepository x -> S3BucketRepository
forall x. S3BucketRepository -> Rep S3BucketRepository x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3BucketRepository x -> S3BucketRepository
$cfrom :: forall x. S3BucketRepository -> Rep S3BucketRepository x
Prelude.Generic)
newS3BucketRepository ::
Prelude.Text ->
S3BucketRepository
newS3BucketRepository :: Text -> S3BucketRepository
newS3BucketRepository Text
pName_ =
S3BucketRepository' :: Maybe S3RepositoryDetails -> Text -> S3BucketRepository
S3BucketRepository'
{ $sel:details:S3BucketRepository' :: Maybe S3RepositoryDetails
details = Maybe S3RepositoryDetails
forall a. Maybe a
Prelude.Nothing,
$sel:name:S3BucketRepository' :: Text
name = Text
pName_
}
s3BucketRepository_details :: Lens.Lens' S3BucketRepository (Prelude.Maybe S3RepositoryDetails)
s3BucketRepository_details :: (Maybe S3RepositoryDetails -> f (Maybe S3RepositoryDetails))
-> S3BucketRepository -> f S3BucketRepository
s3BucketRepository_details = (S3BucketRepository -> Maybe S3RepositoryDetails)
-> (S3BucketRepository
-> Maybe S3RepositoryDetails -> S3BucketRepository)
-> Lens
S3BucketRepository
S3BucketRepository
(Maybe S3RepositoryDetails)
(Maybe S3RepositoryDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3BucketRepository' {Maybe S3RepositoryDetails
details :: Maybe S3RepositoryDetails
$sel:details:S3BucketRepository' :: S3BucketRepository -> Maybe S3RepositoryDetails
details} -> Maybe S3RepositoryDetails
details) (\s :: S3BucketRepository
s@S3BucketRepository' {} Maybe S3RepositoryDetails
a -> S3BucketRepository
s {$sel:details:S3BucketRepository' :: Maybe S3RepositoryDetails
details = Maybe S3RepositoryDetails
a} :: S3BucketRepository)
s3BucketRepository_name :: Lens.Lens' S3BucketRepository Prelude.Text
s3BucketRepository_name :: (Text -> f Text) -> S3BucketRepository -> f S3BucketRepository
s3BucketRepository_name = (S3BucketRepository -> Text)
-> (S3BucketRepository -> Text -> S3BucketRepository)
-> Lens S3BucketRepository S3BucketRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3BucketRepository' {Text
name :: Text
$sel:name:S3BucketRepository' :: S3BucketRepository -> Text
name} -> Text
name) (\s :: S3BucketRepository
s@S3BucketRepository' {} Text
a -> S3BucketRepository
s {$sel:name:S3BucketRepository' :: Text
name = Text
a} :: S3BucketRepository)
instance Core.FromJSON S3BucketRepository where
parseJSON :: Value -> Parser S3BucketRepository
parseJSON =
String
-> (Object -> Parser S3BucketRepository)
-> Value
-> Parser S3BucketRepository
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"S3BucketRepository"
( \Object
x ->
Maybe S3RepositoryDetails -> Text -> S3BucketRepository
S3BucketRepository'
(Maybe S3RepositoryDetails -> Text -> S3BucketRepository)
-> Parser (Maybe S3RepositoryDetails)
-> Parser (Text -> S3BucketRepository)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe S3RepositoryDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Details")
Parser (Text -> S3BucketRepository)
-> Parser Text -> Parser S3BucketRepository
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Name")
)
instance Prelude.Hashable S3BucketRepository
instance Prelude.NFData S3BucketRepository
instance Core.ToJSON S3BucketRepository where
toJSON :: S3BucketRepository -> Value
toJSON S3BucketRepository' {Maybe S3RepositoryDetails
Text
name :: Text
details :: Maybe S3RepositoryDetails
$sel:name:S3BucketRepository' :: S3BucketRepository -> Text
$sel:details:S3BucketRepository' :: S3BucketRepository -> Maybe S3RepositoryDetails
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Details" Text -> S3RepositoryDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (S3RepositoryDetails -> Pair)
-> Maybe S3RepositoryDetails -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3RepositoryDetails
details,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)