{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.RobOMaker.BatchDescribeSimulationJob
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes one or more simulation jobs.
module Amazonka.RobOMaker.BatchDescribeSimulationJob
  ( -- * Creating a Request
    BatchDescribeSimulationJob (..),
    newBatchDescribeSimulationJob,

    -- * Request Lenses
    batchDescribeSimulationJob_jobs,

    -- * Destructuring the Response
    BatchDescribeSimulationJobResponse (..),
    newBatchDescribeSimulationJobResponse,

    -- * Response Lenses
    batchDescribeSimulationJobResponse_jobs,
    batchDescribeSimulationJobResponse_unprocessedJobs,
    batchDescribeSimulationJobResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.RobOMaker.Types

-- | /See:/ 'newBatchDescribeSimulationJob' smart constructor.
data BatchDescribeSimulationJob = BatchDescribeSimulationJob'
  { -- | A list of Amazon Resource Names (ARNs) of simulation jobs to describe.
    BatchDescribeSimulationJob -> NonEmpty Text
jobs :: Prelude.NonEmpty Prelude.Text
  }
  deriving (BatchDescribeSimulationJob -> BatchDescribeSimulationJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDescribeSimulationJob -> BatchDescribeSimulationJob -> Bool
$c/= :: BatchDescribeSimulationJob -> BatchDescribeSimulationJob -> Bool
== :: BatchDescribeSimulationJob -> BatchDescribeSimulationJob -> Bool
$c== :: BatchDescribeSimulationJob -> BatchDescribeSimulationJob -> Bool
Prelude.Eq, ReadPrec [BatchDescribeSimulationJob]
ReadPrec BatchDescribeSimulationJob
Int -> ReadS BatchDescribeSimulationJob
ReadS [BatchDescribeSimulationJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDescribeSimulationJob]
$creadListPrec :: ReadPrec [BatchDescribeSimulationJob]
readPrec :: ReadPrec BatchDescribeSimulationJob
$creadPrec :: ReadPrec BatchDescribeSimulationJob
readList :: ReadS [BatchDescribeSimulationJob]
$creadList :: ReadS [BatchDescribeSimulationJob]
readsPrec :: Int -> ReadS BatchDescribeSimulationJob
$creadsPrec :: Int -> ReadS BatchDescribeSimulationJob
Prelude.Read, Int -> BatchDescribeSimulationJob -> ShowS
[BatchDescribeSimulationJob] -> ShowS
BatchDescribeSimulationJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDescribeSimulationJob] -> ShowS
$cshowList :: [BatchDescribeSimulationJob] -> ShowS
show :: BatchDescribeSimulationJob -> String
$cshow :: BatchDescribeSimulationJob -> String
showsPrec :: Int -> BatchDescribeSimulationJob -> ShowS
$cshowsPrec :: Int -> BatchDescribeSimulationJob -> ShowS
Prelude.Show, forall x.
Rep BatchDescribeSimulationJob x -> BatchDescribeSimulationJob
forall x.
BatchDescribeSimulationJob -> Rep BatchDescribeSimulationJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDescribeSimulationJob x -> BatchDescribeSimulationJob
$cfrom :: forall x.
BatchDescribeSimulationJob -> Rep BatchDescribeSimulationJob x
Prelude.Generic)

-- |
-- Create a value of 'BatchDescribeSimulationJob' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'jobs', 'batchDescribeSimulationJob_jobs' - A list of Amazon Resource Names (ARNs) of simulation jobs to describe.
newBatchDescribeSimulationJob ::
  -- | 'jobs'
  Prelude.NonEmpty Prelude.Text ->
  BatchDescribeSimulationJob
newBatchDescribeSimulationJob :: NonEmpty Text -> BatchDescribeSimulationJob
newBatchDescribeSimulationJob NonEmpty Text
pJobs_ =
  BatchDescribeSimulationJob'
    { $sel:jobs:BatchDescribeSimulationJob' :: NonEmpty Text
jobs =
        forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pJobs_
    }

-- | A list of Amazon Resource Names (ARNs) of simulation jobs to describe.
batchDescribeSimulationJob_jobs :: Lens.Lens' BatchDescribeSimulationJob (Prelude.NonEmpty Prelude.Text)
batchDescribeSimulationJob_jobs :: Lens' BatchDescribeSimulationJob (NonEmpty Text)
batchDescribeSimulationJob_jobs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDescribeSimulationJob' {NonEmpty Text
jobs :: NonEmpty Text
$sel:jobs:BatchDescribeSimulationJob' :: BatchDescribeSimulationJob -> NonEmpty Text
jobs} -> NonEmpty Text
jobs) (\s :: BatchDescribeSimulationJob
s@BatchDescribeSimulationJob' {} NonEmpty Text
a -> BatchDescribeSimulationJob
s {$sel:jobs:BatchDescribeSimulationJob' :: NonEmpty Text
jobs = NonEmpty Text
a} :: BatchDescribeSimulationJob) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest BatchDescribeSimulationJob where
  type
    AWSResponse BatchDescribeSimulationJob =
      BatchDescribeSimulationJobResponse
  request :: (Service -> Service)
-> BatchDescribeSimulationJob -> Request BatchDescribeSimulationJob
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy BatchDescribeSimulationJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse BatchDescribeSimulationJob)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [SimulationJob]
-> Maybe (NonEmpty Text)
-> Int
-> BatchDescribeSimulationJobResponse
BatchDescribeSimulationJobResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"jobs" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"unprocessedJobs")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable BatchDescribeSimulationJob where
  hashWithSalt :: Int -> BatchDescribeSimulationJob -> Int
hashWithSalt Int
_salt BatchDescribeSimulationJob' {NonEmpty Text
jobs :: NonEmpty Text
$sel:jobs:BatchDescribeSimulationJob' :: BatchDescribeSimulationJob -> NonEmpty Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
jobs

instance Prelude.NFData BatchDescribeSimulationJob where
  rnf :: BatchDescribeSimulationJob -> ()
rnf BatchDescribeSimulationJob' {NonEmpty Text
jobs :: NonEmpty Text
$sel:jobs:BatchDescribeSimulationJob' :: BatchDescribeSimulationJob -> NonEmpty Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
jobs

instance Data.ToHeaders BatchDescribeSimulationJob where
  toHeaders :: BatchDescribeSimulationJob -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON BatchDescribeSimulationJob where
  toJSON :: BatchDescribeSimulationJob -> Value
toJSON BatchDescribeSimulationJob' {NonEmpty Text
jobs :: NonEmpty Text
$sel:jobs:BatchDescribeSimulationJob' :: BatchDescribeSimulationJob -> NonEmpty Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"jobs" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
jobs)]
      )

instance Data.ToPath BatchDescribeSimulationJob where
  toPath :: BatchDescribeSimulationJob -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/batchDescribeSimulationJob"

instance Data.ToQuery BatchDescribeSimulationJob where
  toQuery :: BatchDescribeSimulationJob -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newBatchDescribeSimulationJobResponse' smart constructor.
data BatchDescribeSimulationJobResponse = BatchDescribeSimulationJobResponse'
  { -- | A list of simulation jobs.
    BatchDescribeSimulationJobResponse -> Maybe [SimulationJob]
jobs :: Prelude.Maybe [SimulationJob],
    -- | A list of unprocessed simulation job Amazon Resource Names (ARNs).
    BatchDescribeSimulationJobResponse -> Maybe (NonEmpty Text)
unprocessedJobs :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The response's http status code.
    BatchDescribeSimulationJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (BatchDescribeSimulationJobResponse
-> BatchDescribeSimulationJobResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDescribeSimulationJobResponse
-> BatchDescribeSimulationJobResponse -> Bool
$c/= :: BatchDescribeSimulationJobResponse
-> BatchDescribeSimulationJobResponse -> Bool
== :: BatchDescribeSimulationJobResponse
-> BatchDescribeSimulationJobResponse -> Bool
$c== :: BatchDescribeSimulationJobResponse
-> BatchDescribeSimulationJobResponse -> Bool
Prelude.Eq, ReadPrec [BatchDescribeSimulationJobResponse]
ReadPrec BatchDescribeSimulationJobResponse
Int -> ReadS BatchDescribeSimulationJobResponse
ReadS [BatchDescribeSimulationJobResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDescribeSimulationJobResponse]
$creadListPrec :: ReadPrec [BatchDescribeSimulationJobResponse]
readPrec :: ReadPrec BatchDescribeSimulationJobResponse
$creadPrec :: ReadPrec BatchDescribeSimulationJobResponse
readList :: ReadS [BatchDescribeSimulationJobResponse]
$creadList :: ReadS [BatchDescribeSimulationJobResponse]
readsPrec :: Int -> ReadS BatchDescribeSimulationJobResponse
$creadsPrec :: Int -> ReadS BatchDescribeSimulationJobResponse
Prelude.Read, Int -> BatchDescribeSimulationJobResponse -> ShowS
[BatchDescribeSimulationJobResponse] -> ShowS
BatchDescribeSimulationJobResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDescribeSimulationJobResponse] -> ShowS
$cshowList :: [BatchDescribeSimulationJobResponse] -> ShowS
show :: BatchDescribeSimulationJobResponse -> String
$cshow :: BatchDescribeSimulationJobResponse -> String
showsPrec :: Int -> BatchDescribeSimulationJobResponse -> ShowS
$cshowsPrec :: Int -> BatchDescribeSimulationJobResponse -> ShowS
Prelude.Show, forall x.
Rep BatchDescribeSimulationJobResponse x
-> BatchDescribeSimulationJobResponse
forall x.
BatchDescribeSimulationJobResponse
-> Rep BatchDescribeSimulationJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDescribeSimulationJobResponse x
-> BatchDescribeSimulationJobResponse
$cfrom :: forall x.
BatchDescribeSimulationJobResponse
-> Rep BatchDescribeSimulationJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'BatchDescribeSimulationJobResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'jobs', 'batchDescribeSimulationJobResponse_jobs' - A list of simulation jobs.
--
-- 'unprocessedJobs', 'batchDescribeSimulationJobResponse_unprocessedJobs' - A list of unprocessed simulation job Amazon Resource Names (ARNs).
--
-- 'httpStatus', 'batchDescribeSimulationJobResponse_httpStatus' - The response's http status code.
newBatchDescribeSimulationJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  BatchDescribeSimulationJobResponse
newBatchDescribeSimulationJobResponse :: Int -> BatchDescribeSimulationJobResponse
newBatchDescribeSimulationJobResponse Int
pHttpStatus_ =
  BatchDescribeSimulationJobResponse'
    { $sel:jobs:BatchDescribeSimulationJobResponse' :: Maybe [SimulationJob]
jobs =
        forall a. Maybe a
Prelude.Nothing,
      $sel:unprocessedJobs:BatchDescribeSimulationJobResponse' :: Maybe (NonEmpty Text)
unprocessedJobs = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:BatchDescribeSimulationJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of simulation jobs.
batchDescribeSimulationJobResponse_jobs :: Lens.Lens' BatchDescribeSimulationJobResponse (Prelude.Maybe [SimulationJob])
batchDescribeSimulationJobResponse_jobs :: Lens' BatchDescribeSimulationJobResponse (Maybe [SimulationJob])
batchDescribeSimulationJobResponse_jobs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDescribeSimulationJobResponse' {Maybe [SimulationJob]
jobs :: Maybe [SimulationJob]
$sel:jobs:BatchDescribeSimulationJobResponse' :: BatchDescribeSimulationJobResponse -> Maybe [SimulationJob]
jobs} -> Maybe [SimulationJob]
jobs) (\s :: BatchDescribeSimulationJobResponse
s@BatchDescribeSimulationJobResponse' {} Maybe [SimulationJob]
a -> BatchDescribeSimulationJobResponse
s {$sel:jobs:BatchDescribeSimulationJobResponse' :: Maybe [SimulationJob]
jobs = Maybe [SimulationJob]
a} :: BatchDescribeSimulationJobResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of unprocessed simulation job Amazon Resource Names (ARNs).
batchDescribeSimulationJobResponse_unprocessedJobs :: Lens.Lens' BatchDescribeSimulationJobResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
batchDescribeSimulationJobResponse_unprocessedJobs :: Lens' BatchDescribeSimulationJobResponse (Maybe (NonEmpty Text))
batchDescribeSimulationJobResponse_unprocessedJobs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDescribeSimulationJobResponse' {Maybe (NonEmpty Text)
unprocessedJobs :: Maybe (NonEmpty Text)
$sel:unprocessedJobs:BatchDescribeSimulationJobResponse' :: BatchDescribeSimulationJobResponse -> Maybe (NonEmpty Text)
unprocessedJobs} -> Maybe (NonEmpty Text)
unprocessedJobs) (\s :: BatchDescribeSimulationJobResponse
s@BatchDescribeSimulationJobResponse' {} Maybe (NonEmpty Text)
a -> BatchDescribeSimulationJobResponse
s {$sel:unprocessedJobs:BatchDescribeSimulationJobResponse' :: Maybe (NonEmpty Text)
unprocessedJobs = Maybe (NonEmpty Text)
a} :: BatchDescribeSimulationJobResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
batchDescribeSimulationJobResponse_httpStatus :: Lens.Lens' BatchDescribeSimulationJobResponse Prelude.Int
batchDescribeSimulationJobResponse_httpStatus :: Lens' BatchDescribeSimulationJobResponse Int
batchDescribeSimulationJobResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDescribeSimulationJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchDescribeSimulationJobResponse' :: BatchDescribeSimulationJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchDescribeSimulationJobResponse
s@BatchDescribeSimulationJobResponse' {} Int
a -> BatchDescribeSimulationJobResponse
s {$sel:httpStatus:BatchDescribeSimulationJobResponse' :: Int
httpStatus = Int
a} :: BatchDescribeSimulationJobResponse)

instance
  Prelude.NFData
    BatchDescribeSimulationJobResponse
  where
  rnf :: BatchDescribeSimulationJobResponse -> ()
rnf BatchDescribeSimulationJobResponse' {Int
Maybe [SimulationJob]
Maybe (NonEmpty Text)
httpStatus :: Int
unprocessedJobs :: Maybe (NonEmpty Text)
jobs :: Maybe [SimulationJob]
$sel:httpStatus:BatchDescribeSimulationJobResponse' :: BatchDescribeSimulationJobResponse -> Int
$sel:unprocessedJobs:BatchDescribeSimulationJobResponse' :: BatchDescribeSimulationJobResponse -> Maybe (NonEmpty Text)
$sel:jobs:BatchDescribeSimulationJobResponse' :: BatchDescribeSimulationJobResponse -> Maybe [SimulationJob]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [SimulationJob]
jobs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
unprocessedJobs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus