{-# 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.DeviceFarm.ScheduleRun
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Schedules a run.
module Amazonka.DeviceFarm.ScheduleRun
  ( -- * Creating a Request
    ScheduleRun (..),
    newScheduleRun,

    -- * Request Lenses
    scheduleRun_appArn,
    scheduleRun_configuration,
    scheduleRun_devicePoolArn,
    scheduleRun_deviceSelectionConfiguration,
    scheduleRun_executionConfiguration,
    scheduleRun_name,
    scheduleRun_projectArn,
    scheduleRun_test,

    -- * Destructuring the Response
    ScheduleRunResponse (..),
    newScheduleRunResponse,

    -- * Response Lenses
    scheduleRunResponse_run,
    scheduleRunResponse_httpStatus,
  )
where

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

-- | Represents a request to the schedule run operation.
--
-- /See:/ 'newScheduleRun' smart constructor.
data ScheduleRun = ScheduleRun'
  { -- | The ARN of an application package to run tests against, created with
    -- CreateUpload. See ListUploads.
    ScheduleRun -> Maybe Text
appArn :: Prelude.Maybe Prelude.Text,
    -- | Information about the settings for the run to be scheduled.
    ScheduleRun -> Maybe ScheduleRunConfiguration
configuration :: Prelude.Maybe ScheduleRunConfiguration,
    -- | The ARN of the device pool for the run to be scheduled.
    ScheduleRun -> Maybe Text
devicePoolArn :: Prelude.Maybe Prelude.Text,
    -- | The filter criteria used to dynamically select a set of devices for a
    -- test run and the maximum number of devices to be included in the run.
    --
    -- Either __@devicePoolArn@__ or __@deviceSelectionConfiguration@__ is
    -- required in a request.
    ScheduleRun -> Maybe DeviceSelectionConfiguration
deviceSelectionConfiguration :: Prelude.Maybe DeviceSelectionConfiguration,
    -- | Specifies configuration information about a test run, such as the
    -- execution timeout (in minutes).
    ScheduleRun -> Maybe ExecutionConfiguration
executionConfiguration :: Prelude.Maybe ExecutionConfiguration,
    -- | The name for the run to be scheduled.
    ScheduleRun -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the project for the run to be scheduled.
    ScheduleRun -> Text
projectArn :: Prelude.Text,
    -- | Information about the test for the run to be scheduled.
    ScheduleRun -> ScheduleRunTest
test :: ScheduleRunTest
  }
  deriving (ScheduleRun -> ScheduleRun -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduleRun -> ScheduleRun -> Bool
$c/= :: ScheduleRun -> ScheduleRun -> Bool
== :: ScheduleRun -> ScheduleRun -> Bool
$c== :: ScheduleRun -> ScheduleRun -> Bool
Prelude.Eq, ReadPrec [ScheduleRun]
ReadPrec ScheduleRun
Int -> ReadS ScheduleRun
ReadS [ScheduleRun]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduleRun]
$creadListPrec :: ReadPrec [ScheduleRun]
readPrec :: ReadPrec ScheduleRun
$creadPrec :: ReadPrec ScheduleRun
readList :: ReadS [ScheduleRun]
$creadList :: ReadS [ScheduleRun]
readsPrec :: Int -> ReadS ScheduleRun
$creadsPrec :: Int -> ReadS ScheduleRun
Prelude.Read, Int -> ScheduleRun -> ShowS
[ScheduleRun] -> ShowS
ScheduleRun -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduleRun] -> ShowS
$cshowList :: [ScheduleRun] -> ShowS
show :: ScheduleRun -> String
$cshow :: ScheduleRun -> String
showsPrec :: Int -> ScheduleRun -> ShowS
$cshowsPrec :: Int -> ScheduleRun -> ShowS
Prelude.Show, forall x. Rep ScheduleRun x -> ScheduleRun
forall x. ScheduleRun -> Rep ScheduleRun x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScheduleRun x -> ScheduleRun
$cfrom :: forall x. ScheduleRun -> Rep ScheduleRun x
Prelude.Generic)

-- |
-- Create a value of 'ScheduleRun' 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:
--
-- 'appArn', 'scheduleRun_appArn' - The ARN of an application package to run tests against, created with
-- CreateUpload. See ListUploads.
--
-- 'configuration', 'scheduleRun_configuration' - Information about the settings for the run to be scheduled.
--
-- 'devicePoolArn', 'scheduleRun_devicePoolArn' - The ARN of the device pool for the run to be scheduled.
--
-- 'deviceSelectionConfiguration', 'scheduleRun_deviceSelectionConfiguration' - The filter criteria used to dynamically select a set of devices for a
-- test run and the maximum number of devices to be included in the run.
--
-- Either __@devicePoolArn@__ or __@deviceSelectionConfiguration@__ is
-- required in a request.
--
-- 'executionConfiguration', 'scheduleRun_executionConfiguration' - Specifies configuration information about a test run, such as the
-- execution timeout (in minutes).
--
-- 'name', 'scheduleRun_name' - The name for the run to be scheduled.
--
-- 'projectArn', 'scheduleRun_projectArn' - The ARN of the project for the run to be scheduled.
--
-- 'test', 'scheduleRun_test' - Information about the test for the run to be scheduled.
newScheduleRun ::
  -- | 'projectArn'
  Prelude.Text ->
  -- | 'test'
  ScheduleRunTest ->
  ScheduleRun
newScheduleRun :: Text -> ScheduleRunTest -> ScheduleRun
newScheduleRun Text
pProjectArn_ ScheduleRunTest
pTest_ =
  ScheduleRun'
    { $sel:appArn:ScheduleRun' :: Maybe Text
appArn = forall a. Maybe a
Prelude.Nothing,
      $sel:configuration:ScheduleRun' :: Maybe ScheduleRunConfiguration
configuration = forall a. Maybe a
Prelude.Nothing,
      $sel:devicePoolArn:ScheduleRun' :: Maybe Text
devicePoolArn = forall a. Maybe a
Prelude.Nothing,
      $sel:deviceSelectionConfiguration:ScheduleRun' :: Maybe DeviceSelectionConfiguration
deviceSelectionConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:executionConfiguration:ScheduleRun' :: Maybe ExecutionConfiguration
executionConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ScheduleRun' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:projectArn:ScheduleRun' :: Text
projectArn = Text
pProjectArn_,
      $sel:test:ScheduleRun' :: ScheduleRunTest
test = ScheduleRunTest
pTest_
    }

-- | The ARN of an application package to run tests against, created with
-- CreateUpload. See ListUploads.
scheduleRun_appArn :: Lens.Lens' ScheduleRun (Prelude.Maybe Prelude.Text)
scheduleRun_appArn :: Lens' ScheduleRun (Maybe Text)
scheduleRun_appArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleRun' {Maybe Text
appArn :: Maybe Text
$sel:appArn:ScheduleRun' :: ScheduleRun -> Maybe Text
appArn} -> Maybe Text
appArn) (\s :: ScheduleRun
s@ScheduleRun' {} Maybe Text
a -> ScheduleRun
s {$sel:appArn:ScheduleRun' :: Maybe Text
appArn = Maybe Text
a} :: ScheduleRun)

-- | Information about the settings for the run to be scheduled.
scheduleRun_configuration :: Lens.Lens' ScheduleRun (Prelude.Maybe ScheduleRunConfiguration)
scheduleRun_configuration :: Lens' ScheduleRun (Maybe ScheduleRunConfiguration)
scheduleRun_configuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleRun' {Maybe ScheduleRunConfiguration
configuration :: Maybe ScheduleRunConfiguration
$sel:configuration:ScheduleRun' :: ScheduleRun -> Maybe ScheduleRunConfiguration
configuration} -> Maybe ScheduleRunConfiguration
configuration) (\s :: ScheduleRun
s@ScheduleRun' {} Maybe ScheduleRunConfiguration
a -> ScheduleRun
s {$sel:configuration:ScheduleRun' :: Maybe ScheduleRunConfiguration
configuration = Maybe ScheduleRunConfiguration
a} :: ScheduleRun)

-- | The ARN of the device pool for the run to be scheduled.
scheduleRun_devicePoolArn :: Lens.Lens' ScheduleRun (Prelude.Maybe Prelude.Text)
scheduleRun_devicePoolArn :: Lens' ScheduleRun (Maybe Text)
scheduleRun_devicePoolArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleRun' {Maybe Text
devicePoolArn :: Maybe Text
$sel:devicePoolArn:ScheduleRun' :: ScheduleRun -> Maybe Text
devicePoolArn} -> Maybe Text
devicePoolArn) (\s :: ScheduleRun
s@ScheduleRun' {} Maybe Text
a -> ScheduleRun
s {$sel:devicePoolArn:ScheduleRun' :: Maybe Text
devicePoolArn = Maybe Text
a} :: ScheduleRun)

-- | The filter criteria used to dynamically select a set of devices for a
-- test run and the maximum number of devices to be included in the run.
--
-- Either __@devicePoolArn@__ or __@deviceSelectionConfiguration@__ is
-- required in a request.
scheduleRun_deviceSelectionConfiguration :: Lens.Lens' ScheduleRun (Prelude.Maybe DeviceSelectionConfiguration)
scheduleRun_deviceSelectionConfiguration :: Lens' ScheduleRun (Maybe DeviceSelectionConfiguration)
scheduleRun_deviceSelectionConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleRun' {Maybe DeviceSelectionConfiguration
deviceSelectionConfiguration :: Maybe DeviceSelectionConfiguration
$sel:deviceSelectionConfiguration:ScheduleRun' :: ScheduleRun -> Maybe DeviceSelectionConfiguration
deviceSelectionConfiguration} -> Maybe DeviceSelectionConfiguration
deviceSelectionConfiguration) (\s :: ScheduleRun
s@ScheduleRun' {} Maybe DeviceSelectionConfiguration
a -> ScheduleRun
s {$sel:deviceSelectionConfiguration:ScheduleRun' :: Maybe DeviceSelectionConfiguration
deviceSelectionConfiguration = Maybe DeviceSelectionConfiguration
a} :: ScheduleRun)

-- | Specifies configuration information about a test run, such as the
-- execution timeout (in minutes).
scheduleRun_executionConfiguration :: Lens.Lens' ScheduleRun (Prelude.Maybe ExecutionConfiguration)
scheduleRun_executionConfiguration :: Lens' ScheduleRun (Maybe ExecutionConfiguration)
scheduleRun_executionConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleRun' {Maybe ExecutionConfiguration
executionConfiguration :: Maybe ExecutionConfiguration
$sel:executionConfiguration:ScheduleRun' :: ScheduleRun -> Maybe ExecutionConfiguration
executionConfiguration} -> Maybe ExecutionConfiguration
executionConfiguration) (\s :: ScheduleRun
s@ScheduleRun' {} Maybe ExecutionConfiguration
a -> ScheduleRun
s {$sel:executionConfiguration:ScheduleRun' :: Maybe ExecutionConfiguration
executionConfiguration = Maybe ExecutionConfiguration
a} :: ScheduleRun)

-- | The name for the run to be scheduled.
scheduleRun_name :: Lens.Lens' ScheduleRun (Prelude.Maybe Prelude.Text)
scheduleRun_name :: Lens' ScheduleRun (Maybe Text)
scheduleRun_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleRun' {Maybe Text
name :: Maybe Text
$sel:name:ScheduleRun' :: ScheduleRun -> Maybe Text
name} -> Maybe Text
name) (\s :: ScheduleRun
s@ScheduleRun' {} Maybe Text
a -> ScheduleRun
s {$sel:name:ScheduleRun' :: Maybe Text
name = Maybe Text
a} :: ScheduleRun)

-- | The ARN of the project for the run to be scheduled.
scheduleRun_projectArn :: Lens.Lens' ScheduleRun Prelude.Text
scheduleRun_projectArn :: Lens' ScheduleRun Text
scheduleRun_projectArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleRun' {Text
projectArn :: Text
$sel:projectArn:ScheduleRun' :: ScheduleRun -> Text
projectArn} -> Text
projectArn) (\s :: ScheduleRun
s@ScheduleRun' {} Text
a -> ScheduleRun
s {$sel:projectArn:ScheduleRun' :: Text
projectArn = Text
a} :: ScheduleRun)

-- | Information about the test for the run to be scheduled.
scheduleRun_test :: Lens.Lens' ScheduleRun ScheduleRunTest
scheduleRun_test :: Lens' ScheduleRun ScheduleRunTest
scheduleRun_test = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleRun' {ScheduleRunTest
test :: ScheduleRunTest
$sel:test:ScheduleRun' :: ScheduleRun -> ScheduleRunTest
test} -> ScheduleRunTest
test) (\s :: ScheduleRun
s@ScheduleRun' {} ScheduleRunTest
a -> ScheduleRun
s {$sel:test:ScheduleRun' :: ScheduleRunTest
test = ScheduleRunTest
a} :: ScheduleRun)

instance Core.AWSRequest ScheduleRun where
  type AWSResponse ScheduleRun = ScheduleRunResponse
  request :: (Service -> Service) -> ScheduleRun -> Request ScheduleRun
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 ScheduleRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ScheduleRun)))
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 Run -> Int -> ScheduleRunResponse
ScheduleRunResponse'
            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
"run")
            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 ScheduleRun where
  hashWithSalt :: Int -> ScheduleRun -> Int
hashWithSalt Int
_salt ScheduleRun' {Maybe Text
Maybe ExecutionConfiguration
Maybe DeviceSelectionConfiguration
Maybe ScheduleRunConfiguration
Text
ScheduleRunTest
test :: ScheduleRunTest
projectArn :: Text
name :: Maybe Text
executionConfiguration :: Maybe ExecutionConfiguration
deviceSelectionConfiguration :: Maybe DeviceSelectionConfiguration
devicePoolArn :: Maybe Text
configuration :: Maybe ScheduleRunConfiguration
appArn :: Maybe Text
$sel:test:ScheduleRun' :: ScheduleRun -> ScheduleRunTest
$sel:projectArn:ScheduleRun' :: ScheduleRun -> Text
$sel:name:ScheduleRun' :: ScheduleRun -> Maybe Text
$sel:executionConfiguration:ScheduleRun' :: ScheduleRun -> Maybe ExecutionConfiguration
$sel:deviceSelectionConfiguration:ScheduleRun' :: ScheduleRun -> Maybe DeviceSelectionConfiguration
$sel:devicePoolArn:ScheduleRun' :: ScheduleRun -> Maybe Text
$sel:configuration:ScheduleRun' :: ScheduleRun -> Maybe ScheduleRunConfiguration
$sel:appArn:ScheduleRun' :: ScheduleRun -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
appArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScheduleRunConfiguration
configuration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
devicePoolArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DeviceSelectionConfiguration
deviceSelectionConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExecutionConfiguration
executionConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
projectArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ScheduleRunTest
test

instance Prelude.NFData ScheduleRun where
  rnf :: ScheduleRun -> ()
rnf ScheduleRun' {Maybe Text
Maybe ExecutionConfiguration
Maybe DeviceSelectionConfiguration
Maybe ScheduleRunConfiguration
Text
ScheduleRunTest
test :: ScheduleRunTest
projectArn :: Text
name :: Maybe Text
executionConfiguration :: Maybe ExecutionConfiguration
deviceSelectionConfiguration :: Maybe DeviceSelectionConfiguration
devicePoolArn :: Maybe Text
configuration :: Maybe ScheduleRunConfiguration
appArn :: Maybe Text
$sel:test:ScheduleRun' :: ScheduleRun -> ScheduleRunTest
$sel:projectArn:ScheduleRun' :: ScheduleRun -> Text
$sel:name:ScheduleRun' :: ScheduleRun -> Maybe Text
$sel:executionConfiguration:ScheduleRun' :: ScheduleRun -> Maybe ExecutionConfiguration
$sel:deviceSelectionConfiguration:ScheduleRun' :: ScheduleRun -> Maybe DeviceSelectionConfiguration
$sel:devicePoolArn:ScheduleRun' :: ScheduleRun -> Maybe Text
$sel:configuration:ScheduleRun' :: ScheduleRun -> Maybe ScheduleRunConfiguration
$sel:appArn:ScheduleRun' :: ScheduleRun -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
appArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ScheduleRunConfiguration
configuration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
devicePoolArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DeviceSelectionConfiguration
deviceSelectionConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExecutionConfiguration
executionConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
projectArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ScheduleRunTest
test

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

instance Data.ToJSON ScheduleRun where
  toJSON :: ScheduleRun -> Value
toJSON ScheduleRun' {Maybe Text
Maybe ExecutionConfiguration
Maybe DeviceSelectionConfiguration
Maybe ScheduleRunConfiguration
Text
ScheduleRunTest
test :: ScheduleRunTest
projectArn :: Text
name :: Maybe Text
executionConfiguration :: Maybe ExecutionConfiguration
deviceSelectionConfiguration :: Maybe DeviceSelectionConfiguration
devicePoolArn :: Maybe Text
configuration :: Maybe ScheduleRunConfiguration
appArn :: Maybe Text
$sel:test:ScheduleRun' :: ScheduleRun -> ScheduleRunTest
$sel:projectArn:ScheduleRun' :: ScheduleRun -> Text
$sel:name:ScheduleRun' :: ScheduleRun -> Maybe Text
$sel:executionConfiguration:ScheduleRun' :: ScheduleRun -> Maybe ExecutionConfiguration
$sel:deviceSelectionConfiguration:ScheduleRun' :: ScheduleRun -> Maybe DeviceSelectionConfiguration
$sel:devicePoolArn:ScheduleRun' :: ScheduleRun -> Maybe Text
$sel:configuration:ScheduleRun' :: ScheduleRun -> Maybe ScheduleRunConfiguration
$sel:appArn:ScheduleRun' :: ScheduleRun -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"appArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
appArn,
            (Key
"configuration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ScheduleRunConfiguration
configuration,
            (Key
"devicePoolArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
devicePoolArn,
            (Key
"deviceSelectionConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeviceSelectionConfiguration
deviceSelectionConfiguration,
            (Key
"executionConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ExecutionConfiguration
executionConfiguration,
            (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
            forall a. a -> Maybe a
Prelude.Just (Key
"projectArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
projectArn),
            forall a. a -> Maybe a
Prelude.Just (Key
"test" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ScheduleRunTest
test)
          ]
      )

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

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

-- | Represents the result of a schedule run request.
--
-- /See:/ 'newScheduleRunResponse' smart constructor.
data ScheduleRunResponse = ScheduleRunResponse'
  { -- | Information about the scheduled run.
    ScheduleRunResponse -> Maybe Run
run :: Prelude.Maybe Run,
    -- | The response's http status code.
    ScheduleRunResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ScheduleRunResponse -> ScheduleRunResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScheduleRunResponse -> ScheduleRunResponse -> Bool
$c/= :: ScheduleRunResponse -> ScheduleRunResponse -> Bool
== :: ScheduleRunResponse -> ScheduleRunResponse -> Bool
$c== :: ScheduleRunResponse -> ScheduleRunResponse -> Bool
Prelude.Eq, ReadPrec [ScheduleRunResponse]
ReadPrec ScheduleRunResponse
Int -> ReadS ScheduleRunResponse
ReadS [ScheduleRunResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScheduleRunResponse]
$creadListPrec :: ReadPrec [ScheduleRunResponse]
readPrec :: ReadPrec ScheduleRunResponse
$creadPrec :: ReadPrec ScheduleRunResponse
readList :: ReadS [ScheduleRunResponse]
$creadList :: ReadS [ScheduleRunResponse]
readsPrec :: Int -> ReadS ScheduleRunResponse
$creadsPrec :: Int -> ReadS ScheduleRunResponse
Prelude.Read, Int -> ScheduleRunResponse -> ShowS
[ScheduleRunResponse] -> ShowS
ScheduleRunResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScheduleRunResponse] -> ShowS
$cshowList :: [ScheduleRunResponse] -> ShowS
show :: ScheduleRunResponse -> String
$cshow :: ScheduleRunResponse -> String
showsPrec :: Int -> ScheduleRunResponse -> ShowS
$cshowsPrec :: Int -> ScheduleRunResponse -> ShowS
Prelude.Show, forall x. Rep ScheduleRunResponse x -> ScheduleRunResponse
forall x. ScheduleRunResponse -> Rep ScheduleRunResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScheduleRunResponse x -> ScheduleRunResponse
$cfrom :: forall x. ScheduleRunResponse -> Rep ScheduleRunResponse x
Prelude.Generic)

-- |
-- Create a value of 'ScheduleRunResponse' 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:
--
-- 'run', 'scheduleRunResponse_run' - Information about the scheduled run.
--
-- 'httpStatus', 'scheduleRunResponse_httpStatus' - The response's http status code.
newScheduleRunResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ScheduleRunResponse
newScheduleRunResponse :: Int -> ScheduleRunResponse
newScheduleRunResponse Int
pHttpStatus_ =
  ScheduleRunResponse'
    { $sel:run:ScheduleRunResponse' :: Maybe Run
run = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ScheduleRunResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the scheduled run.
scheduleRunResponse_run :: Lens.Lens' ScheduleRunResponse (Prelude.Maybe Run)
scheduleRunResponse_run :: Lens' ScheduleRunResponse (Maybe Run)
scheduleRunResponse_run = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScheduleRunResponse' {Maybe Run
run :: Maybe Run
$sel:run:ScheduleRunResponse' :: ScheduleRunResponse -> Maybe Run
run} -> Maybe Run
run) (\s :: ScheduleRunResponse
s@ScheduleRunResponse' {} Maybe Run
a -> ScheduleRunResponse
s {$sel:run:ScheduleRunResponse' :: Maybe Run
run = Maybe Run
a} :: ScheduleRunResponse)

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

instance Prelude.NFData ScheduleRunResponse where
  rnf :: ScheduleRunResponse -> ()
rnf ScheduleRunResponse' {Int
Maybe Run
httpStatus :: Int
run :: Maybe Run
$sel:httpStatus:ScheduleRunResponse' :: ScheduleRunResponse -> Int
$sel:run:ScheduleRunResponse' :: ScheduleRunResponse -> Maybe Run
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Run
run
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus