{-# 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.DeviceFarm.Types.DevicePool where
import qualified Amazonka.Core as Core
import Amazonka.DeviceFarm.Types.DevicePoolType
import Amazonka.DeviceFarm.Types.Rule
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DevicePool = DevicePool'
{
DevicePool -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
DevicePool -> Maybe [Rule]
rules :: Prelude.Maybe [Rule],
DevicePool -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
DevicePool -> Maybe Int
maxDevices :: Prelude.Maybe Prelude.Int,
DevicePool -> Maybe DevicePoolType
type' :: Prelude.Maybe DevicePoolType,
DevicePool -> Maybe Text
description :: Prelude.Maybe Prelude.Text
}
deriving (DevicePool -> DevicePool -> Bool
(DevicePool -> DevicePool -> Bool)
-> (DevicePool -> DevicePool -> Bool) -> Eq DevicePool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DevicePool -> DevicePool -> Bool
$c/= :: DevicePool -> DevicePool -> Bool
== :: DevicePool -> DevicePool -> Bool
$c== :: DevicePool -> DevicePool -> Bool
Prelude.Eq, ReadPrec [DevicePool]
ReadPrec DevicePool
Int -> ReadS DevicePool
ReadS [DevicePool]
(Int -> ReadS DevicePool)
-> ReadS [DevicePool]
-> ReadPrec DevicePool
-> ReadPrec [DevicePool]
-> Read DevicePool
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DevicePool]
$creadListPrec :: ReadPrec [DevicePool]
readPrec :: ReadPrec DevicePool
$creadPrec :: ReadPrec DevicePool
readList :: ReadS [DevicePool]
$creadList :: ReadS [DevicePool]
readsPrec :: Int -> ReadS DevicePool
$creadsPrec :: Int -> ReadS DevicePool
Prelude.Read, Int -> DevicePool -> ShowS
[DevicePool] -> ShowS
DevicePool -> String
(Int -> DevicePool -> ShowS)
-> (DevicePool -> String)
-> ([DevicePool] -> ShowS)
-> Show DevicePool
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DevicePool] -> ShowS
$cshowList :: [DevicePool] -> ShowS
show :: DevicePool -> String
$cshow :: DevicePool -> String
showsPrec :: Int -> DevicePool -> ShowS
$cshowsPrec :: Int -> DevicePool -> ShowS
Prelude.Show, (forall x. DevicePool -> Rep DevicePool x)
-> (forall x. Rep DevicePool x -> DevicePool) -> Generic DevicePool
forall x. Rep DevicePool x -> DevicePool
forall x. DevicePool -> Rep DevicePool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DevicePool x -> DevicePool
$cfrom :: forall x. DevicePool -> Rep DevicePool x
Prelude.Generic)
newDevicePool ::
DevicePool
newDevicePool :: DevicePool
newDevicePool =
DevicePool' :: Maybe Text
-> Maybe [Rule]
-> Maybe Text
-> Maybe Int
-> Maybe DevicePoolType
-> Maybe Text
-> DevicePool
DevicePool'
{ $sel:arn:DevicePool' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:rules:DevicePool' :: Maybe [Rule]
rules = Maybe [Rule]
forall a. Maybe a
Prelude.Nothing,
$sel:name:DevicePool' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxDevices:DevicePool' :: Maybe Int
maxDevices = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:type':DevicePool' :: Maybe DevicePoolType
type' = Maybe DevicePoolType
forall a. Maybe a
Prelude.Nothing,
$sel:description:DevicePool' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
devicePool_arn :: Lens.Lens' DevicePool (Prelude.Maybe Prelude.Text)
devicePool_arn :: (Maybe Text -> f (Maybe Text)) -> DevicePool -> f DevicePool
devicePool_arn = (DevicePool -> Maybe Text)
-> (DevicePool -> Maybe Text -> DevicePool)
-> Lens DevicePool DevicePool (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePool' {Maybe Text
arn :: Maybe Text
$sel:arn:DevicePool' :: DevicePool -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DevicePool
s@DevicePool' {} Maybe Text
a -> DevicePool
s {$sel:arn:DevicePool' :: Maybe Text
arn = Maybe Text
a} :: DevicePool)
devicePool_rules :: Lens.Lens' DevicePool (Prelude.Maybe [Rule])
devicePool_rules :: (Maybe [Rule] -> f (Maybe [Rule])) -> DevicePool -> f DevicePool
devicePool_rules = (DevicePool -> Maybe [Rule])
-> (DevicePool -> Maybe [Rule] -> DevicePool)
-> Lens DevicePool DevicePool (Maybe [Rule]) (Maybe [Rule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePool' {Maybe [Rule]
rules :: Maybe [Rule]
$sel:rules:DevicePool' :: DevicePool -> Maybe [Rule]
rules} -> Maybe [Rule]
rules) (\s :: DevicePool
s@DevicePool' {} Maybe [Rule]
a -> DevicePool
s {$sel:rules:DevicePool' :: Maybe [Rule]
rules = Maybe [Rule]
a} :: DevicePool) ((Maybe [Rule] -> f (Maybe [Rule])) -> DevicePool -> f DevicePool)
-> ((Maybe [Rule] -> f (Maybe [Rule]))
-> Maybe [Rule] -> f (Maybe [Rule]))
-> (Maybe [Rule] -> f (Maybe [Rule]))
-> DevicePool
-> f DevicePool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Rule] [Rule] [Rule] [Rule]
-> Iso (Maybe [Rule]) (Maybe [Rule]) (Maybe [Rule]) (Maybe [Rule])
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 [Rule] [Rule] [Rule] [Rule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
devicePool_name :: Lens.Lens' DevicePool (Prelude.Maybe Prelude.Text)
devicePool_name :: (Maybe Text -> f (Maybe Text)) -> DevicePool -> f DevicePool
devicePool_name = (DevicePool -> Maybe Text)
-> (DevicePool -> Maybe Text -> DevicePool)
-> Lens DevicePool DevicePool (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePool' {Maybe Text
name :: Maybe Text
$sel:name:DevicePool' :: DevicePool -> Maybe Text
name} -> Maybe Text
name) (\s :: DevicePool
s@DevicePool' {} Maybe Text
a -> DevicePool
s {$sel:name:DevicePool' :: Maybe Text
name = Maybe Text
a} :: DevicePool)
devicePool_maxDevices :: Lens.Lens' DevicePool (Prelude.Maybe Prelude.Int)
devicePool_maxDevices :: (Maybe Int -> f (Maybe Int)) -> DevicePool -> f DevicePool
devicePool_maxDevices = (DevicePool -> Maybe Int)
-> (DevicePool -> Maybe Int -> DevicePool)
-> Lens DevicePool DevicePool (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePool' {Maybe Int
maxDevices :: Maybe Int
$sel:maxDevices:DevicePool' :: DevicePool -> Maybe Int
maxDevices} -> Maybe Int
maxDevices) (\s :: DevicePool
s@DevicePool' {} Maybe Int
a -> DevicePool
s {$sel:maxDevices:DevicePool' :: Maybe Int
maxDevices = Maybe Int
a} :: DevicePool)
devicePool_type :: Lens.Lens' DevicePool (Prelude.Maybe DevicePoolType)
devicePool_type :: (Maybe DevicePoolType -> f (Maybe DevicePoolType))
-> DevicePool -> f DevicePool
devicePool_type = (DevicePool -> Maybe DevicePoolType)
-> (DevicePool -> Maybe DevicePoolType -> DevicePool)
-> Lens
DevicePool DevicePool (Maybe DevicePoolType) (Maybe DevicePoolType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePool' {Maybe DevicePoolType
type' :: Maybe DevicePoolType
$sel:type':DevicePool' :: DevicePool -> Maybe DevicePoolType
type'} -> Maybe DevicePoolType
type') (\s :: DevicePool
s@DevicePool' {} Maybe DevicePoolType
a -> DevicePool
s {$sel:type':DevicePool' :: Maybe DevicePoolType
type' = Maybe DevicePoolType
a} :: DevicePool)
devicePool_description :: Lens.Lens' DevicePool (Prelude.Maybe Prelude.Text)
devicePool_description :: (Maybe Text -> f (Maybe Text)) -> DevicePool -> f DevicePool
devicePool_description = (DevicePool -> Maybe Text)
-> (DevicePool -> Maybe Text -> DevicePool)
-> Lens DevicePool DevicePool (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePool' {Maybe Text
description :: Maybe Text
$sel:description:DevicePool' :: DevicePool -> Maybe Text
description} -> Maybe Text
description) (\s :: DevicePool
s@DevicePool' {} Maybe Text
a -> DevicePool
s {$sel:description:DevicePool' :: Maybe Text
description = Maybe Text
a} :: DevicePool)
instance Core.FromJSON DevicePool where
parseJSON :: Value -> Parser DevicePool
parseJSON =
String
-> (Object -> Parser DevicePool) -> Value -> Parser DevicePool
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DevicePool"
( \Object
x ->
Maybe Text
-> Maybe [Rule]
-> Maybe Text
-> Maybe Int
-> Maybe DevicePoolType
-> Maybe Text
-> DevicePool
DevicePool'
(Maybe Text
-> Maybe [Rule]
-> Maybe Text
-> Maybe Int
-> Maybe DevicePoolType
-> Maybe Text
-> DevicePool)
-> Parser (Maybe Text)
-> Parser
(Maybe [Rule]
-> Maybe Text
-> Maybe Int
-> Maybe DevicePoolType
-> Maybe Text
-> DevicePool)
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
"arn")
Parser
(Maybe [Rule]
-> Maybe Text
-> Maybe Int
-> Maybe DevicePoolType
-> Maybe Text
-> DevicePool)
-> Parser (Maybe [Rule])
-> Parser
(Maybe Text
-> Maybe Int -> Maybe DevicePoolType -> Maybe Text -> DevicePool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Rule]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"rules" Parser (Maybe (Maybe [Rule]))
-> Maybe [Rule] -> Parser (Maybe [Rule])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Rule]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Text
-> Maybe Int -> Maybe DevicePoolType -> Maybe Text -> DevicePool)
-> Parser (Maybe Text)
-> Parser
(Maybe Int -> Maybe DevicePoolType -> Maybe Text -> DevicePool)
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
"name")
Parser
(Maybe Int -> Maybe DevicePoolType -> Maybe Text -> DevicePool)
-> Parser (Maybe Int)
-> Parser (Maybe DevicePoolType -> Maybe Text -> DevicePool)
forall (f :: * -> *) a b. Applicative f => 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
"maxDevices")
Parser (Maybe DevicePoolType -> Maybe Text -> DevicePool)
-> Parser (Maybe DevicePoolType)
-> Parser (Maybe Text -> DevicePool)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DevicePoolType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
Parser (Maybe Text -> DevicePool)
-> Parser (Maybe Text) -> Parser DevicePool
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
"description")
)
instance Prelude.Hashable DevicePool
instance Prelude.NFData DevicePool