{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.DeviceFarm.CreateDevicePool
(
CreateDevicePool (..),
newCreateDevicePool,
createDevicePool_maxDevices,
createDevicePool_description,
createDevicePool_projectArn,
createDevicePool_name,
createDevicePool_rules,
CreateDevicePoolResponse (..),
newCreateDevicePoolResponse,
createDevicePoolResponse_devicePool,
createDevicePoolResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DeviceFarm.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateDevicePool = CreateDevicePool'
{
CreateDevicePool -> Maybe Int
maxDevices :: Prelude.Maybe Prelude.Int,
CreateDevicePool -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateDevicePool -> Text
projectArn :: Prelude.Text,
CreateDevicePool -> Text
name :: Prelude.Text,
CreateDevicePool -> [Rule]
rules :: [Rule]
}
deriving (CreateDevicePool -> CreateDevicePool -> Bool
(CreateDevicePool -> CreateDevicePool -> Bool)
-> (CreateDevicePool -> CreateDevicePool -> Bool)
-> Eq CreateDevicePool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDevicePool -> CreateDevicePool -> Bool
$c/= :: CreateDevicePool -> CreateDevicePool -> Bool
== :: CreateDevicePool -> CreateDevicePool -> Bool
$c== :: CreateDevicePool -> CreateDevicePool -> Bool
Prelude.Eq, ReadPrec [CreateDevicePool]
ReadPrec CreateDevicePool
Int -> ReadS CreateDevicePool
ReadS [CreateDevicePool]
(Int -> ReadS CreateDevicePool)
-> ReadS [CreateDevicePool]
-> ReadPrec CreateDevicePool
-> ReadPrec [CreateDevicePool]
-> Read CreateDevicePool
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDevicePool]
$creadListPrec :: ReadPrec [CreateDevicePool]
readPrec :: ReadPrec CreateDevicePool
$creadPrec :: ReadPrec CreateDevicePool
readList :: ReadS [CreateDevicePool]
$creadList :: ReadS [CreateDevicePool]
readsPrec :: Int -> ReadS CreateDevicePool
$creadsPrec :: Int -> ReadS CreateDevicePool
Prelude.Read, Int -> CreateDevicePool -> ShowS
[CreateDevicePool] -> ShowS
CreateDevicePool -> String
(Int -> CreateDevicePool -> ShowS)
-> (CreateDevicePool -> String)
-> ([CreateDevicePool] -> ShowS)
-> Show CreateDevicePool
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDevicePool] -> ShowS
$cshowList :: [CreateDevicePool] -> ShowS
show :: CreateDevicePool -> String
$cshow :: CreateDevicePool -> String
showsPrec :: Int -> CreateDevicePool -> ShowS
$cshowsPrec :: Int -> CreateDevicePool -> ShowS
Prelude.Show, (forall x. CreateDevicePool -> Rep CreateDevicePool x)
-> (forall x. Rep CreateDevicePool x -> CreateDevicePool)
-> Generic CreateDevicePool
forall x. Rep CreateDevicePool x -> CreateDevicePool
forall x. CreateDevicePool -> Rep CreateDevicePool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDevicePool x -> CreateDevicePool
$cfrom :: forall x. CreateDevicePool -> Rep CreateDevicePool x
Prelude.Generic)
newCreateDevicePool ::
Prelude.Text ->
Prelude.Text ->
CreateDevicePool
newCreateDevicePool :: Text -> Text -> CreateDevicePool
newCreateDevicePool Text
pProjectArn_ Text
pName_ =
CreateDevicePool' :: Maybe Int
-> Maybe Text -> Text -> Text -> [Rule] -> CreateDevicePool
CreateDevicePool'
{ $sel:maxDevices:CreateDevicePool' :: Maybe Int
maxDevices = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateDevicePool' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:projectArn:CreateDevicePool' :: Text
projectArn = Text
pProjectArn_,
$sel:name:CreateDevicePool' :: Text
name = Text
pName_,
$sel:rules:CreateDevicePool' :: [Rule]
rules = [Rule]
forall a. Monoid a => a
Prelude.mempty
}
createDevicePool_maxDevices :: Lens.Lens' CreateDevicePool (Prelude.Maybe Prelude.Int)
createDevicePool_maxDevices :: (Maybe Int -> f (Maybe Int))
-> CreateDevicePool -> f CreateDevicePool
createDevicePool_maxDevices = (CreateDevicePool -> Maybe Int)
-> (CreateDevicePool -> Maybe Int -> CreateDevicePool)
-> Lens CreateDevicePool CreateDevicePool (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevicePool' {Maybe Int
maxDevices :: Maybe Int
$sel:maxDevices:CreateDevicePool' :: CreateDevicePool -> Maybe Int
maxDevices} -> Maybe Int
maxDevices) (\s :: CreateDevicePool
s@CreateDevicePool' {} Maybe Int
a -> CreateDevicePool
s {$sel:maxDevices:CreateDevicePool' :: Maybe Int
maxDevices = Maybe Int
a} :: CreateDevicePool)
createDevicePool_description :: Lens.Lens' CreateDevicePool (Prelude.Maybe Prelude.Text)
createDevicePool_description :: (Maybe Text -> f (Maybe Text))
-> CreateDevicePool -> f CreateDevicePool
createDevicePool_description = (CreateDevicePool -> Maybe Text)
-> (CreateDevicePool -> Maybe Text -> CreateDevicePool)
-> Lens CreateDevicePool CreateDevicePool (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevicePool' {Maybe Text
description :: Maybe Text
$sel:description:CreateDevicePool' :: CreateDevicePool -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateDevicePool
s@CreateDevicePool' {} Maybe Text
a -> CreateDevicePool
s {$sel:description:CreateDevicePool' :: Maybe Text
description = Maybe Text
a} :: CreateDevicePool)
createDevicePool_projectArn :: Lens.Lens' CreateDevicePool Prelude.Text
createDevicePool_projectArn :: (Text -> f Text) -> CreateDevicePool -> f CreateDevicePool
createDevicePool_projectArn = (CreateDevicePool -> Text)
-> (CreateDevicePool -> Text -> CreateDevicePool)
-> Lens CreateDevicePool CreateDevicePool Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevicePool' {Text
projectArn :: Text
$sel:projectArn:CreateDevicePool' :: CreateDevicePool -> Text
projectArn} -> Text
projectArn) (\s :: CreateDevicePool
s@CreateDevicePool' {} Text
a -> CreateDevicePool
s {$sel:projectArn:CreateDevicePool' :: Text
projectArn = Text
a} :: CreateDevicePool)
createDevicePool_name :: Lens.Lens' CreateDevicePool Prelude.Text
createDevicePool_name :: (Text -> f Text) -> CreateDevicePool -> f CreateDevicePool
createDevicePool_name = (CreateDevicePool -> Text)
-> (CreateDevicePool -> Text -> CreateDevicePool)
-> Lens CreateDevicePool CreateDevicePool Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevicePool' {Text
name :: Text
$sel:name:CreateDevicePool' :: CreateDevicePool -> Text
name} -> Text
name) (\s :: CreateDevicePool
s@CreateDevicePool' {} Text
a -> CreateDevicePool
s {$sel:name:CreateDevicePool' :: Text
name = Text
a} :: CreateDevicePool)
createDevicePool_rules :: Lens.Lens' CreateDevicePool [Rule]
createDevicePool_rules :: ([Rule] -> f [Rule]) -> CreateDevicePool -> f CreateDevicePool
createDevicePool_rules = (CreateDevicePool -> [Rule])
-> (CreateDevicePool -> [Rule] -> CreateDevicePool)
-> Lens CreateDevicePool CreateDevicePool [Rule] [Rule]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevicePool' {[Rule]
rules :: [Rule]
$sel:rules:CreateDevicePool' :: CreateDevicePool -> [Rule]
rules} -> [Rule]
rules) (\s :: CreateDevicePool
s@CreateDevicePool' {} [Rule]
a -> CreateDevicePool
s {$sel:rules:CreateDevicePool' :: [Rule]
rules = [Rule]
a} :: CreateDevicePool) (([Rule] -> f [Rule]) -> CreateDevicePool -> f CreateDevicePool)
-> (([Rule] -> f [Rule]) -> [Rule] -> f [Rule])
-> ([Rule] -> f [Rule])
-> CreateDevicePool
-> f CreateDevicePool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Rule] -> f [Rule]) -> [Rule] -> f [Rule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateDevicePool where
type
AWSResponse CreateDevicePool =
CreateDevicePoolResponse
request :: CreateDevicePool -> Request CreateDevicePool
request = Service -> CreateDevicePool -> Request CreateDevicePool
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDevicePool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDevicePool)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateDevicePool))
-> Logger
-> Service
-> Proxy CreateDevicePool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDevicePool)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe DevicePool -> Int -> CreateDevicePoolResponse
CreateDevicePoolResponse'
(Maybe DevicePool -> Int -> CreateDevicePoolResponse)
-> Either String (Maybe DevicePool)
-> Either String (Int -> CreateDevicePoolResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DevicePool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"devicePool")
Either String (Int -> CreateDevicePoolResponse)
-> Either String Int -> Either String CreateDevicePoolResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateDevicePool
instance Prelude.NFData CreateDevicePool
instance Core.ToHeaders CreateDevicePool where
toHeaders :: CreateDevicePool -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateDevicePool -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"DeviceFarm_20150623.CreateDevicePool" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreateDevicePool where
toJSON :: CreateDevicePool -> Value
toJSON CreateDevicePool' {[Rule]
Maybe Int
Maybe Text
Text
rules :: [Rule]
name :: Text
projectArn :: Text
description :: Maybe Text
maxDevices :: Maybe Int
$sel:rules:CreateDevicePool' :: CreateDevicePool -> [Rule]
$sel:name:CreateDevicePool' :: CreateDevicePool -> Text
$sel:projectArn:CreateDevicePool' :: CreateDevicePool -> Text
$sel:description:CreateDevicePool' :: CreateDevicePool -> Maybe Text
$sel:maxDevices:CreateDevicePool' :: CreateDevicePool -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"maxDevices" 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
maxDevices,
(Text
"description" 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
description,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"projectArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
projectArn),
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),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"rules" Text -> [Rule] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Rule]
rules)
]
)
instance Core.ToPath CreateDevicePool where
toPath :: CreateDevicePool -> ByteString
toPath = ByteString -> CreateDevicePool -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateDevicePool where
toQuery :: CreateDevicePool -> QueryString
toQuery = QueryString -> CreateDevicePool -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateDevicePoolResponse = CreateDevicePoolResponse'
{
CreateDevicePoolResponse -> Maybe DevicePool
devicePool :: Prelude.Maybe DevicePool,
CreateDevicePoolResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDevicePoolResponse -> CreateDevicePoolResponse -> Bool
(CreateDevicePoolResponse -> CreateDevicePoolResponse -> Bool)
-> (CreateDevicePoolResponse -> CreateDevicePoolResponse -> Bool)
-> Eq CreateDevicePoolResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDevicePoolResponse -> CreateDevicePoolResponse -> Bool
$c/= :: CreateDevicePoolResponse -> CreateDevicePoolResponse -> Bool
== :: CreateDevicePoolResponse -> CreateDevicePoolResponse -> Bool
$c== :: CreateDevicePoolResponse -> CreateDevicePoolResponse -> Bool
Prelude.Eq, ReadPrec [CreateDevicePoolResponse]
ReadPrec CreateDevicePoolResponse
Int -> ReadS CreateDevicePoolResponse
ReadS [CreateDevicePoolResponse]
(Int -> ReadS CreateDevicePoolResponse)
-> ReadS [CreateDevicePoolResponse]
-> ReadPrec CreateDevicePoolResponse
-> ReadPrec [CreateDevicePoolResponse]
-> Read CreateDevicePoolResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDevicePoolResponse]
$creadListPrec :: ReadPrec [CreateDevicePoolResponse]
readPrec :: ReadPrec CreateDevicePoolResponse
$creadPrec :: ReadPrec CreateDevicePoolResponse
readList :: ReadS [CreateDevicePoolResponse]
$creadList :: ReadS [CreateDevicePoolResponse]
readsPrec :: Int -> ReadS CreateDevicePoolResponse
$creadsPrec :: Int -> ReadS CreateDevicePoolResponse
Prelude.Read, Int -> CreateDevicePoolResponse -> ShowS
[CreateDevicePoolResponse] -> ShowS
CreateDevicePoolResponse -> String
(Int -> CreateDevicePoolResponse -> ShowS)
-> (CreateDevicePoolResponse -> String)
-> ([CreateDevicePoolResponse] -> ShowS)
-> Show CreateDevicePoolResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDevicePoolResponse] -> ShowS
$cshowList :: [CreateDevicePoolResponse] -> ShowS
show :: CreateDevicePoolResponse -> String
$cshow :: CreateDevicePoolResponse -> String
showsPrec :: Int -> CreateDevicePoolResponse -> ShowS
$cshowsPrec :: Int -> CreateDevicePoolResponse -> ShowS
Prelude.Show, (forall x.
CreateDevicePoolResponse -> Rep CreateDevicePoolResponse x)
-> (forall x.
Rep CreateDevicePoolResponse x -> CreateDevicePoolResponse)
-> Generic CreateDevicePoolResponse
forall x.
Rep CreateDevicePoolResponse x -> CreateDevicePoolResponse
forall x.
CreateDevicePoolResponse -> Rep CreateDevicePoolResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDevicePoolResponse x -> CreateDevicePoolResponse
$cfrom :: forall x.
CreateDevicePoolResponse -> Rep CreateDevicePoolResponse x
Prelude.Generic)
newCreateDevicePoolResponse ::
Prelude.Int ->
CreateDevicePoolResponse
newCreateDevicePoolResponse :: Int -> CreateDevicePoolResponse
newCreateDevicePoolResponse Int
pHttpStatus_ =
CreateDevicePoolResponse' :: Maybe DevicePool -> Int -> CreateDevicePoolResponse
CreateDevicePoolResponse'
{ $sel:devicePool:CreateDevicePoolResponse' :: Maybe DevicePool
devicePool =
Maybe DevicePool
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDevicePoolResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDevicePoolResponse_devicePool :: Lens.Lens' CreateDevicePoolResponse (Prelude.Maybe DevicePool)
createDevicePoolResponse_devicePool :: (Maybe DevicePool -> f (Maybe DevicePool))
-> CreateDevicePoolResponse -> f CreateDevicePoolResponse
createDevicePoolResponse_devicePool = (CreateDevicePoolResponse -> Maybe DevicePool)
-> (CreateDevicePoolResponse
-> Maybe DevicePool -> CreateDevicePoolResponse)
-> Lens
CreateDevicePoolResponse
CreateDevicePoolResponse
(Maybe DevicePool)
(Maybe DevicePool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevicePoolResponse' {Maybe DevicePool
devicePool :: Maybe DevicePool
$sel:devicePool:CreateDevicePoolResponse' :: CreateDevicePoolResponse -> Maybe DevicePool
devicePool} -> Maybe DevicePool
devicePool) (\s :: CreateDevicePoolResponse
s@CreateDevicePoolResponse' {} Maybe DevicePool
a -> CreateDevicePoolResponse
s {$sel:devicePool:CreateDevicePoolResponse' :: Maybe DevicePool
devicePool = Maybe DevicePool
a} :: CreateDevicePoolResponse)
createDevicePoolResponse_httpStatus :: Lens.Lens' CreateDevicePoolResponse Prelude.Int
createDevicePoolResponse_httpStatus :: (Int -> f Int)
-> CreateDevicePoolResponse -> f CreateDevicePoolResponse
createDevicePoolResponse_httpStatus = (CreateDevicePoolResponse -> Int)
-> (CreateDevicePoolResponse -> Int -> CreateDevicePoolResponse)
-> Lens CreateDevicePoolResponse CreateDevicePoolResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDevicePoolResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDevicePoolResponse' :: CreateDevicePoolResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDevicePoolResponse
s@CreateDevicePoolResponse' {} Int
a -> CreateDevicePoolResponse
s {$sel:httpStatus:CreateDevicePoolResponse' :: Int
httpStatus = Int
a} :: CreateDevicePoolResponse)
instance Prelude.NFData CreateDevicePoolResponse