{-# 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.CodeBuild.Types.BatchRestrictions where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data BatchRestrictions = BatchRestrictions'
{
BatchRestrictions -> Maybe Int
maximumBuildsAllowed :: Prelude.Maybe Prelude.Int,
BatchRestrictions -> Maybe [Text]
computeTypesAllowed :: Prelude.Maybe [Prelude.Text]
}
deriving (BatchRestrictions -> BatchRestrictions -> Bool
(BatchRestrictions -> BatchRestrictions -> Bool)
-> (BatchRestrictions -> BatchRestrictions -> Bool)
-> Eq BatchRestrictions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchRestrictions -> BatchRestrictions -> Bool
$c/= :: BatchRestrictions -> BatchRestrictions -> Bool
== :: BatchRestrictions -> BatchRestrictions -> Bool
$c== :: BatchRestrictions -> BatchRestrictions -> Bool
Prelude.Eq, ReadPrec [BatchRestrictions]
ReadPrec BatchRestrictions
Int -> ReadS BatchRestrictions
ReadS [BatchRestrictions]
(Int -> ReadS BatchRestrictions)
-> ReadS [BatchRestrictions]
-> ReadPrec BatchRestrictions
-> ReadPrec [BatchRestrictions]
-> Read BatchRestrictions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchRestrictions]
$creadListPrec :: ReadPrec [BatchRestrictions]
readPrec :: ReadPrec BatchRestrictions
$creadPrec :: ReadPrec BatchRestrictions
readList :: ReadS [BatchRestrictions]
$creadList :: ReadS [BatchRestrictions]
readsPrec :: Int -> ReadS BatchRestrictions
$creadsPrec :: Int -> ReadS BatchRestrictions
Prelude.Read, Int -> BatchRestrictions -> ShowS
[BatchRestrictions] -> ShowS
BatchRestrictions -> String
(Int -> BatchRestrictions -> ShowS)
-> (BatchRestrictions -> String)
-> ([BatchRestrictions] -> ShowS)
-> Show BatchRestrictions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchRestrictions] -> ShowS
$cshowList :: [BatchRestrictions] -> ShowS
show :: BatchRestrictions -> String
$cshow :: BatchRestrictions -> String
showsPrec :: Int -> BatchRestrictions -> ShowS
$cshowsPrec :: Int -> BatchRestrictions -> ShowS
Prelude.Show, (forall x. BatchRestrictions -> Rep BatchRestrictions x)
-> (forall x. Rep BatchRestrictions x -> BatchRestrictions)
-> Generic BatchRestrictions
forall x. Rep BatchRestrictions x -> BatchRestrictions
forall x. BatchRestrictions -> Rep BatchRestrictions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchRestrictions x -> BatchRestrictions
$cfrom :: forall x. BatchRestrictions -> Rep BatchRestrictions x
Prelude.Generic)
newBatchRestrictions ::
BatchRestrictions
newBatchRestrictions :: BatchRestrictions
newBatchRestrictions =
BatchRestrictions' :: Maybe Int -> Maybe [Text] -> BatchRestrictions
BatchRestrictions'
{ $sel:maximumBuildsAllowed:BatchRestrictions' :: Maybe Int
maximumBuildsAllowed =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:computeTypesAllowed:BatchRestrictions' :: Maybe [Text]
computeTypesAllowed = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
}
batchRestrictions_maximumBuildsAllowed :: Lens.Lens' BatchRestrictions (Prelude.Maybe Prelude.Int)
batchRestrictions_maximumBuildsAllowed :: (Maybe Int -> f (Maybe Int))
-> BatchRestrictions -> f BatchRestrictions
batchRestrictions_maximumBuildsAllowed = (BatchRestrictions -> Maybe Int)
-> (BatchRestrictions -> Maybe Int -> BatchRestrictions)
-> Lens BatchRestrictions BatchRestrictions (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchRestrictions' {Maybe Int
maximumBuildsAllowed :: Maybe Int
$sel:maximumBuildsAllowed:BatchRestrictions' :: BatchRestrictions -> Maybe Int
maximumBuildsAllowed} -> Maybe Int
maximumBuildsAllowed) (\s :: BatchRestrictions
s@BatchRestrictions' {} Maybe Int
a -> BatchRestrictions
s {$sel:maximumBuildsAllowed:BatchRestrictions' :: Maybe Int
maximumBuildsAllowed = Maybe Int
a} :: BatchRestrictions)
batchRestrictions_computeTypesAllowed :: Lens.Lens' BatchRestrictions (Prelude.Maybe [Prelude.Text])
batchRestrictions_computeTypesAllowed :: (Maybe [Text] -> f (Maybe [Text]))
-> BatchRestrictions -> f BatchRestrictions
batchRestrictions_computeTypesAllowed = (BatchRestrictions -> Maybe [Text])
-> (BatchRestrictions -> Maybe [Text] -> BatchRestrictions)
-> Lens
BatchRestrictions BatchRestrictions (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchRestrictions' {Maybe [Text]
computeTypesAllowed :: Maybe [Text]
$sel:computeTypesAllowed:BatchRestrictions' :: BatchRestrictions -> Maybe [Text]
computeTypesAllowed} -> Maybe [Text]
computeTypesAllowed) (\s :: BatchRestrictions
s@BatchRestrictions' {} Maybe [Text]
a -> BatchRestrictions
s {$sel:computeTypesAllowed:BatchRestrictions' :: Maybe [Text]
computeTypesAllowed = Maybe [Text]
a} :: BatchRestrictions) ((Maybe [Text] -> f (Maybe [Text]))
-> BatchRestrictions -> f BatchRestrictions)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> BatchRestrictions
-> f BatchRestrictions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON BatchRestrictions where
parseJSON :: Value -> Parser BatchRestrictions
parseJSON =
String
-> (Object -> Parser BatchRestrictions)
-> Value
-> Parser BatchRestrictions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"BatchRestrictions"
( \Object
x ->
Maybe Int -> Maybe [Text] -> BatchRestrictions
BatchRestrictions'
(Maybe Int -> Maybe [Text] -> BatchRestrictions)
-> Parser (Maybe Int) -> Parser (Maybe [Text] -> BatchRestrictions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"maximumBuildsAllowed")
Parser (Maybe [Text] -> BatchRestrictions)
-> Parser (Maybe [Text]) -> Parser BatchRestrictions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"computeTypesAllowed"
Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable BatchRestrictions
instance Prelude.NFData BatchRestrictions
instance Core.ToJSON BatchRestrictions where
toJSON :: BatchRestrictions -> Value
toJSON BatchRestrictions' {Maybe Int
Maybe [Text]
computeTypesAllowed :: Maybe [Text]
maximumBuildsAllowed :: Maybe Int
$sel:computeTypesAllowed:BatchRestrictions' :: BatchRestrictions -> Maybe [Text]
$sel:maximumBuildsAllowed:BatchRestrictions' :: BatchRestrictions -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"maximumBuildsAllowed" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maximumBuildsAllowed,
(Text
"computeTypesAllowed" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
computeTypesAllowed
]
)