{-# 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.Panorama.CreateJobForDevices
(
CreateJobForDevices (..),
newCreateJobForDevices,
createJobForDevices_deviceIds,
createJobForDevices_deviceJobConfig,
createJobForDevices_jobType,
CreateJobForDevicesResponse (..),
newCreateJobForDevicesResponse,
createJobForDevicesResponse_httpStatus,
createJobForDevicesResponse_jobs,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Panorama.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateJobForDevices = CreateJobForDevices'
{
CreateJobForDevices -> NonEmpty Text
deviceIds :: Prelude.NonEmpty Prelude.Text,
CreateJobForDevices -> DeviceJobConfig
deviceJobConfig :: DeviceJobConfig,
CreateJobForDevices -> JobType
jobType :: JobType
}
deriving (CreateJobForDevices -> CreateJobForDevices -> Bool
(CreateJobForDevices -> CreateJobForDevices -> Bool)
-> (CreateJobForDevices -> CreateJobForDevices -> Bool)
-> Eq CreateJobForDevices
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateJobForDevices -> CreateJobForDevices -> Bool
$c/= :: CreateJobForDevices -> CreateJobForDevices -> Bool
== :: CreateJobForDevices -> CreateJobForDevices -> Bool
$c== :: CreateJobForDevices -> CreateJobForDevices -> Bool
Prelude.Eq, ReadPrec [CreateJobForDevices]
ReadPrec CreateJobForDevices
Int -> ReadS CreateJobForDevices
ReadS [CreateJobForDevices]
(Int -> ReadS CreateJobForDevices)
-> ReadS [CreateJobForDevices]
-> ReadPrec CreateJobForDevices
-> ReadPrec [CreateJobForDevices]
-> Read CreateJobForDevices
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateJobForDevices]
$creadListPrec :: ReadPrec [CreateJobForDevices]
readPrec :: ReadPrec CreateJobForDevices
$creadPrec :: ReadPrec CreateJobForDevices
readList :: ReadS [CreateJobForDevices]
$creadList :: ReadS [CreateJobForDevices]
readsPrec :: Int -> ReadS CreateJobForDevices
$creadsPrec :: Int -> ReadS CreateJobForDevices
Prelude.Read, Int -> CreateJobForDevices -> ShowS
[CreateJobForDevices] -> ShowS
CreateJobForDevices -> String
(Int -> CreateJobForDevices -> ShowS)
-> (CreateJobForDevices -> String)
-> ([CreateJobForDevices] -> ShowS)
-> Show CreateJobForDevices
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateJobForDevices] -> ShowS
$cshowList :: [CreateJobForDevices] -> ShowS
show :: CreateJobForDevices -> String
$cshow :: CreateJobForDevices -> String
showsPrec :: Int -> CreateJobForDevices -> ShowS
$cshowsPrec :: Int -> CreateJobForDevices -> ShowS
Prelude.Show, (forall x. CreateJobForDevices -> Rep CreateJobForDevices x)
-> (forall x. Rep CreateJobForDevices x -> CreateJobForDevices)
-> Generic CreateJobForDevices
forall x. Rep CreateJobForDevices x -> CreateJobForDevices
forall x. CreateJobForDevices -> Rep CreateJobForDevices x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateJobForDevices x -> CreateJobForDevices
$cfrom :: forall x. CreateJobForDevices -> Rep CreateJobForDevices x
Prelude.Generic)
newCreateJobForDevices ::
Prelude.NonEmpty Prelude.Text ->
DeviceJobConfig ->
JobType ->
CreateJobForDevices
newCreateJobForDevices :: NonEmpty Text -> DeviceJobConfig -> JobType -> CreateJobForDevices
newCreateJobForDevices
NonEmpty Text
pDeviceIds_
DeviceJobConfig
pDeviceJobConfig_
JobType
pJobType_ =
CreateJobForDevices' :: NonEmpty Text -> DeviceJobConfig -> JobType -> CreateJobForDevices
CreateJobForDevices'
{ $sel:deviceIds:CreateJobForDevices' :: NonEmpty Text
deviceIds =
Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pDeviceIds_,
$sel:deviceJobConfig:CreateJobForDevices' :: DeviceJobConfig
deviceJobConfig = DeviceJobConfig
pDeviceJobConfig_,
$sel:jobType:CreateJobForDevices' :: JobType
jobType = JobType
pJobType_
}
createJobForDevices_deviceIds :: Lens.Lens' CreateJobForDevices (Prelude.NonEmpty Prelude.Text)
createJobForDevices_deviceIds :: (NonEmpty Text -> f (NonEmpty Text))
-> CreateJobForDevices -> f CreateJobForDevices
createJobForDevices_deviceIds = (CreateJobForDevices -> NonEmpty Text)
-> (CreateJobForDevices -> NonEmpty Text -> CreateJobForDevices)
-> Lens
CreateJobForDevices
CreateJobForDevices
(NonEmpty Text)
(NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJobForDevices' {NonEmpty Text
deviceIds :: NonEmpty Text
$sel:deviceIds:CreateJobForDevices' :: CreateJobForDevices -> NonEmpty Text
deviceIds} -> NonEmpty Text
deviceIds) (\s :: CreateJobForDevices
s@CreateJobForDevices' {} NonEmpty Text
a -> CreateJobForDevices
s {$sel:deviceIds:CreateJobForDevices' :: NonEmpty Text
deviceIds = NonEmpty Text
a} :: CreateJobForDevices) ((NonEmpty Text -> f (NonEmpty Text))
-> CreateJobForDevices -> f CreateJobForDevices)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> CreateJobForDevices
-> f CreateJobForDevices
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createJobForDevices_deviceJobConfig :: Lens.Lens' CreateJobForDevices DeviceJobConfig
createJobForDevices_deviceJobConfig :: (DeviceJobConfig -> f DeviceJobConfig)
-> CreateJobForDevices -> f CreateJobForDevices
createJobForDevices_deviceJobConfig = (CreateJobForDevices -> DeviceJobConfig)
-> (CreateJobForDevices -> DeviceJobConfig -> CreateJobForDevices)
-> Lens
CreateJobForDevices
CreateJobForDevices
DeviceJobConfig
DeviceJobConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJobForDevices' {DeviceJobConfig
deviceJobConfig :: DeviceJobConfig
$sel:deviceJobConfig:CreateJobForDevices' :: CreateJobForDevices -> DeviceJobConfig
deviceJobConfig} -> DeviceJobConfig
deviceJobConfig) (\s :: CreateJobForDevices
s@CreateJobForDevices' {} DeviceJobConfig
a -> CreateJobForDevices
s {$sel:deviceJobConfig:CreateJobForDevices' :: DeviceJobConfig
deviceJobConfig = DeviceJobConfig
a} :: CreateJobForDevices)
createJobForDevices_jobType :: Lens.Lens' CreateJobForDevices JobType
createJobForDevices_jobType :: (JobType -> f JobType)
-> CreateJobForDevices -> f CreateJobForDevices
createJobForDevices_jobType = (CreateJobForDevices -> JobType)
-> (CreateJobForDevices -> JobType -> CreateJobForDevices)
-> Lens CreateJobForDevices CreateJobForDevices JobType JobType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJobForDevices' {JobType
jobType :: JobType
$sel:jobType:CreateJobForDevices' :: CreateJobForDevices -> JobType
jobType} -> JobType
jobType) (\s :: CreateJobForDevices
s@CreateJobForDevices' {} JobType
a -> CreateJobForDevices
s {$sel:jobType:CreateJobForDevices' :: JobType
jobType = JobType
a} :: CreateJobForDevices)
instance Core.AWSRequest CreateJobForDevices where
type
AWSResponse CreateJobForDevices =
CreateJobForDevicesResponse
request :: CreateJobForDevices -> Request CreateJobForDevices
request = Service -> CreateJobForDevices -> Request CreateJobForDevices
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateJobForDevices
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateJobForDevices)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateJobForDevices))
-> Logger
-> Service
-> Proxy CreateJobForDevices
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateJobForDevices)))
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 ->
Int -> [Job] -> CreateJobForDevicesResponse
CreateJobForDevicesResponse'
(Int -> [Job] -> CreateJobForDevicesResponse)
-> Either String Int
-> Either String ([Job] -> CreateJobForDevicesResponse)
forall (f :: * -> *) a b. Functor 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))
Either String ([Job] -> CreateJobForDevicesResponse)
-> Either String [Job] -> Either String CreateJobForDevicesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [Job])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Jobs" Either String (Maybe [Job]) -> [Job] -> Either String [Job]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Job]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable CreateJobForDevices
instance Prelude.NFData CreateJobForDevices
instance Core.ToHeaders CreateJobForDevices where
toHeaders :: CreateJobForDevices -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateJobForDevices -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 CreateJobForDevices where
toJSON :: CreateJobForDevices -> Value
toJSON CreateJobForDevices' {NonEmpty Text
JobType
DeviceJobConfig
jobType :: JobType
deviceJobConfig :: DeviceJobConfig
deviceIds :: NonEmpty Text
$sel:jobType:CreateJobForDevices' :: CreateJobForDevices -> JobType
$sel:deviceJobConfig:CreateJobForDevices' :: CreateJobForDevices -> DeviceJobConfig
$sel:deviceIds:CreateJobForDevices' :: CreateJobForDevices -> NonEmpty Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DeviceIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
deviceIds),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"DeviceJobConfig" Text -> DeviceJobConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DeviceJobConfig
deviceJobConfig),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"JobType" Text -> JobType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= JobType
jobType)
]
)
instance Core.ToPath CreateJobForDevices where
toPath :: CreateJobForDevices -> ByteString
toPath = ByteString -> CreateJobForDevices -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/jobs"
instance Core.ToQuery CreateJobForDevices where
toQuery :: CreateJobForDevices -> QueryString
toQuery = QueryString -> CreateJobForDevices -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateJobForDevicesResponse = CreateJobForDevicesResponse'
{
CreateJobForDevicesResponse -> Int
httpStatus :: Prelude.Int,
CreateJobForDevicesResponse -> [Job]
jobs :: [Job]
}
deriving (CreateJobForDevicesResponse -> CreateJobForDevicesResponse -> Bool
(CreateJobForDevicesResponse
-> CreateJobForDevicesResponse -> Bool)
-> (CreateJobForDevicesResponse
-> CreateJobForDevicesResponse -> Bool)
-> Eq CreateJobForDevicesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateJobForDevicesResponse -> CreateJobForDevicesResponse -> Bool
$c/= :: CreateJobForDevicesResponse -> CreateJobForDevicesResponse -> Bool
== :: CreateJobForDevicesResponse -> CreateJobForDevicesResponse -> Bool
$c== :: CreateJobForDevicesResponse -> CreateJobForDevicesResponse -> Bool
Prelude.Eq, ReadPrec [CreateJobForDevicesResponse]
ReadPrec CreateJobForDevicesResponse
Int -> ReadS CreateJobForDevicesResponse
ReadS [CreateJobForDevicesResponse]
(Int -> ReadS CreateJobForDevicesResponse)
-> ReadS [CreateJobForDevicesResponse]
-> ReadPrec CreateJobForDevicesResponse
-> ReadPrec [CreateJobForDevicesResponse]
-> Read CreateJobForDevicesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateJobForDevicesResponse]
$creadListPrec :: ReadPrec [CreateJobForDevicesResponse]
readPrec :: ReadPrec CreateJobForDevicesResponse
$creadPrec :: ReadPrec CreateJobForDevicesResponse
readList :: ReadS [CreateJobForDevicesResponse]
$creadList :: ReadS [CreateJobForDevicesResponse]
readsPrec :: Int -> ReadS CreateJobForDevicesResponse
$creadsPrec :: Int -> ReadS CreateJobForDevicesResponse
Prelude.Read, Int -> CreateJobForDevicesResponse -> ShowS
[CreateJobForDevicesResponse] -> ShowS
CreateJobForDevicesResponse -> String
(Int -> CreateJobForDevicesResponse -> ShowS)
-> (CreateJobForDevicesResponse -> String)
-> ([CreateJobForDevicesResponse] -> ShowS)
-> Show CreateJobForDevicesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateJobForDevicesResponse] -> ShowS
$cshowList :: [CreateJobForDevicesResponse] -> ShowS
show :: CreateJobForDevicesResponse -> String
$cshow :: CreateJobForDevicesResponse -> String
showsPrec :: Int -> CreateJobForDevicesResponse -> ShowS
$cshowsPrec :: Int -> CreateJobForDevicesResponse -> ShowS
Prelude.Show, (forall x.
CreateJobForDevicesResponse -> Rep CreateJobForDevicesResponse x)
-> (forall x.
Rep CreateJobForDevicesResponse x -> CreateJobForDevicesResponse)
-> Generic CreateJobForDevicesResponse
forall x.
Rep CreateJobForDevicesResponse x -> CreateJobForDevicesResponse
forall x.
CreateJobForDevicesResponse -> Rep CreateJobForDevicesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateJobForDevicesResponse x -> CreateJobForDevicesResponse
$cfrom :: forall x.
CreateJobForDevicesResponse -> Rep CreateJobForDevicesResponse x
Prelude.Generic)
newCreateJobForDevicesResponse ::
Prelude.Int ->
CreateJobForDevicesResponse
newCreateJobForDevicesResponse :: Int -> CreateJobForDevicesResponse
newCreateJobForDevicesResponse Int
pHttpStatus_ =
CreateJobForDevicesResponse' :: Int -> [Job] -> CreateJobForDevicesResponse
CreateJobForDevicesResponse'
{ $sel:httpStatus:CreateJobForDevicesResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:jobs:CreateJobForDevicesResponse' :: [Job]
jobs = [Job]
forall a. Monoid a => a
Prelude.mempty
}
createJobForDevicesResponse_httpStatus :: Lens.Lens' CreateJobForDevicesResponse Prelude.Int
createJobForDevicesResponse_httpStatus :: (Int -> f Int)
-> CreateJobForDevicesResponse -> f CreateJobForDevicesResponse
createJobForDevicesResponse_httpStatus = (CreateJobForDevicesResponse -> Int)
-> (CreateJobForDevicesResponse
-> Int -> CreateJobForDevicesResponse)
-> Lens
CreateJobForDevicesResponse CreateJobForDevicesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJobForDevicesResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateJobForDevicesResponse' :: CreateJobForDevicesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateJobForDevicesResponse
s@CreateJobForDevicesResponse' {} Int
a -> CreateJobForDevicesResponse
s {$sel:httpStatus:CreateJobForDevicesResponse' :: Int
httpStatus = Int
a} :: CreateJobForDevicesResponse)
createJobForDevicesResponse_jobs :: Lens.Lens' CreateJobForDevicesResponse [Job]
createJobForDevicesResponse_jobs :: ([Job] -> f [Job])
-> CreateJobForDevicesResponse -> f CreateJobForDevicesResponse
createJobForDevicesResponse_jobs = (CreateJobForDevicesResponse -> [Job])
-> (CreateJobForDevicesResponse
-> [Job] -> CreateJobForDevicesResponse)
-> Lens
CreateJobForDevicesResponse CreateJobForDevicesResponse [Job] [Job]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateJobForDevicesResponse' {[Job]
jobs :: [Job]
$sel:jobs:CreateJobForDevicesResponse' :: CreateJobForDevicesResponse -> [Job]
jobs} -> [Job]
jobs) (\s :: CreateJobForDevicesResponse
s@CreateJobForDevicesResponse' {} [Job]
a -> CreateJobForDevicesResponse
s {$sel:jobs:CreateJobForDevicesResponse' :: [Job]
jobs = [Job]
a} :: CreateJobForDevicesResponse) (([Job] -> f [Job])
-> CreateJobForDevicesResponse -> f CreateJobForDevicesResponse)
-> (([Job] -> f [Job]) -> [Job] -> f [Job])
-> ([Job] -> f [Job])
-> CreateJobForDevicesResponse
-> f CreateJobForDevicesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Job] -> f [Job]) -> [Job] -> f [Job]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData CreateJobForDevicesResponse