{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Schedules a run.
module Amazonka.DeviceFarm.ScheduleRun
  ( -- * Creating a Request
    ScheduleRun (..),
    newScheduleRun,

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

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

    -- * Response Lenses
    scheduleRunResponse_run,
    scheduleRunResponse_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

-- | Represents a request to the schedule run operation.
--
-- /See:/ 'newScheduleRun' smart constructor.
data ScheduleRun = ScheduleRun'
  { -- | Specifies configuration information about a test run, such as the
    -- execution timeout (in minutes).
    ScheduleRun -> Maybe ExecutionConfiguration
executionConfiguration :: Prelude.Maybe ExecutionConfiguration,
    -- | 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,
    -- | The ARN of an application package to run tests against, created with
    -- CreateUpload. See ListUploads.
    ScheduleRun -> Maybe Text
appArn :: Prelude.Maybe Prelude.Text,
    -- | The name for the run to be scheduled.
    ScheduleRun -> Maybe Text
name :: 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 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
(ScheduleRun -> ScheduleRun -> Bool)
-> (ScheduleRun -> ScheduleRun -> Bool) -> Eq ScheduleRun
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]
(Int -> ReadS ScheduleRun)
-> ReadS [ScheduleRun]
-> ReadPrec ScheduleRun
-> ReadPrec [ScheduleRun]
-> Read 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
(Int -> ScheduleRun -> ShowS)
-> (ScheduleRun -> String)
-> ([ScheduleRun] -> ShowS)
-> Show ScheduleRun
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. ScheduleRun -> Rep ScheduleRun x)
-> (forall x. Rep ScheduleRun x -> ScheduleRun)
-> Generic ScheduleRun
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:
--
-- 'executionConfiguration', 'scheduleRun_executionConfiguration' - Specifies configuration information about a test run, such as the
-- execution timeout (in minutes).
--
-- '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.
--
-- 'appArn', 'scheduleRun_appArn' - The ARN of an application package to run tests against, created with
-- CreateUpload. See ListUploads.
--
-- 'name', 'scheduleRun_name' - The name for the run to be scheduled.
--
-- '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.
--
-- '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' :: Maybe ExecutionConfiguration
-> Maybe DeviceSelectionConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe ScheduleRunConfiguration
-> Maybe Text
-> Text
-> ScheduleRunTest
-> ScheduleRun
ScheduleRun'
    { $sel:executionConfiguration:ScheduleRun' :: Maybe ExecutionConfiguration
executionConfiguration =
        Maybe ExecutionConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceSelectionConfiguration:ScheduleRun' :: Maybe DeviceSelectionConfiguration
deviceSelectionConfiguration = Maybe DeviceSelectionConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:appArn:ScheduleRun' :: Maybe Text
appArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ScheduleRun' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:configuration:ScheduleRun' :: Maybe ScheduleRunConfiguration
configuration = Maybe ScheduleRunConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:devicePoolArn:ScheduleRun' :: Maybe Text
devicePoolArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:projectArn:ScheduleRun' :: Text
projectArn = Text
pProjectArn_,
      $sel:test:ScheduleRun' :: ScheduleRunTest
test = ScheduleRunTest
pTest_
    }

-- | Specifies configuration information about a test run, such as the
-- execution timeout (in minutes).
scheduleRun_executionConfiguration :: Lens.Lens' ScheduleRun (Prelude.Maybe ExecutionConfiguration)
scheduleRun_executionConfiguration :: (Maybe ExecutionConfiguration -> f (Maybe ExecutionConfiguration))
-> ScheduleRun -> f ScheduleRun
scheduleRun_executionConfiguration = (ScheduleRun -> Maybe ExecutionConfiguration)
-> (ScheduleRun -> Maybe ExecutionConfiguration -> ScheduleRun)
-> Lens
     ScheduleRun
     ScheduleRun
     (Maybe ExecutionConfiguration)
     (Maybe 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 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 :: (Maybe DeviceSelectionConfiguration
 -> f (Maybe DeviceSelectionConfiguration))
-> ScheduleRun -> f ScheduleRun
scheduleRun_deviceSelectionConfiguration = (ScheduleRun -> Maybe DeviceSelectionConfiguration)
-> (ScheduleRun
    -> Maybe DeviceSelectionConfiguration -> ScheduleRun)
-> Lens
     ScheduleRun
     ScheduleRun
     (Maybe DeviceSelectionConfiguration)
     (Maybe 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)

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> ScheduleRun -> f ScheduleRun
scheduleRun_appArn = (ScheduleRun -> Maybe Text)
-> (ScheduleRun -> Maybe Text -> ScheduleRun)
-> Lens ScheduleRun ScheduleRun (Maybe Text) (Maybe Text)
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)

-- | The name for the run to be scheduled.
scheduleRun_name :: Lens.Lens' ScheduleRun (Prelude.Maybe Prelude.Text)
scheduleRun_name :: (Maybe Text -> f (Maybe Text)) -> ScheduleRun -> f ScheduleRun
scheduleRun_name = (ScheduleRun -> Maybe Text)
-> (ScheduleRun -> Maybe Text -> ScheduleRun)
-> Lens ScheduleRun ScheduleRun (Maybe Text) (Maybe Text)
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)

-- | Information about the settings for the run to be scheduled.
scheduleRun_configuration :: Lens.Lens' ScheduleRun (Prelude.Maybe ScheduleRunConfiguration)
scheduleRun_configuration :: (Maybe ScheduleRunConfiguration
 -> f (Maybe ScheduleRunConfiguration))
-> ScheduleRun -> f ScheduleRun
scheduleRun_configuration = (ScheduleRun -> Maybe ScheduleRunConfiguration)
-> (ScheduleRun -> Maybe ScheduleRunConfiguration -> ScheduleRun)
-> Lens
     ScheduleRun
     ScheduleRun
     (Maybe ScheduleRunConfiguration)
     (Maybe ScheduleRunConfiguration)
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 :: (Maybe Text -> f (Maybe Text)) -> ScheduleRun -> f ScheduleRun
scheduleRun_devicePoolArn = (ScheduleRun -> Maybe Text)
-> (ScheduleRun -> Maybe Text -> ScheduleRun)
-> Lens ScheduleRun ScheduleRun (Maybe Text) (Maybe Text)
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 ARN of the project for the run to be scheduled.
scheduleRun_projectArn :: Lens.Lens' ScheduleRun Prelude.Text
scheduleRun_projectArn :: (Text -> f Text) -> ScheduleRun -> f ScheduleRun
scheduleRun_projectArn = (ScheduleRun -> Text)
-> (ScheduleRun -> Text -> ScheduleRun)
-> Lens ScheduleRun ScheduleRun Text Text
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 :: (ScheduleRunTest -> f ScheduleRunTest)
-> ScheduleRun -> f ScheduleRun
scheduleRun_test = (ScheduleRun -> ScheduleRunTest)
-> (ScheduleRun -> ScheduleRunTest -> ScheduleRun)
-> Lens ScheduleRun ScheduleRun ScheduleRunTest ScheduleRunTest
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 :: ScheduleRun -> Request ScheduleRun
request = Service -> ScheduleRun -> Request ScheduleRun
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ScheduleRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ScheduleRun)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ScheduleRun))
-> Logger
-> Service
-> Proxy ScheduleRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ScheduleRun)))
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 Run -> Int -> ScheduleRunResponse
ScheduleRunResponse'
            (Maybe Run -> Int -> ScheduleRunResponse)
-> Either String (Maybe Run)
-> Either String (Int -> ScheduleRunResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Run)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"run")
            Either String (Int -> ScheduleRunResponse)
-> Either String Int -> Either String ScheduleRunResponse
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 ScheduleRun

instance Prelude.NFData ScheduleRun

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

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

instance Core.ToQuery ScheduleRun where
  toQuery :: ScheduleRun -> QueryString
toQuery = QueryString -> ScheduleRun -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(ScheduleRunResponse -> ScheduleRunResponse -> Bool)
-> (ScheduleRunResponse -> ScheduleRunResponse -> Bool)
-> Eq ScheduleRunResponse
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]
(Int -> ReadS ScheduleRunResponse)
-> ReadS [ScheduleRunResponse]
-> ReadPrec ScheduleRunResponse
-> ReadPrec [ScheduleRunResponse]
-> Read 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
(Int -> ScheduleRunResponse -> ShowS)
-> (ScheduleRunResponse -> String)
-> ([ScheduleRunResponse] -> ShowS)
-> Show ScheduleRunResponse
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. ScheduleRunResponse -> Rep ScheduleRunResponse x)
-> (forall x. Rep ScheduleRunResponse x -> ScheduleRunResponse)
-> Generic ScheduleRunResponse
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' :: Maybe Run -> Int -> ScheduleRunResponse
ScheduleRunResponse'
    { $sel:run:ScheduleRunResponse' :: Maybe Run
run = Maybe 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 :: (Maybe Run -> f (Maybe Run))
-> ScheduleRunResponse -> f ScheduleRunResponse
scheduleRunResponse_run = (ScheduleRunResponse -> Maybe Run)
-> (ScheduleRunResponse -> Maybe Run -> ScheduleRunResponse)
-> Lens
     ScheduleRunResponse ScheduleRunResponse (Maybe Run) (Maybe 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 :: (Int -> f Int) -> ScheduleRunResponse -> f ScheduleRunResponse
scheduleRunResponse_httpStatus = (ScheduleRunResponse -> Int)
-> (ScheduleRunResponse -> Int -> ScheduleRunResponse)
-> Lens ScheduleRunResponse ScheduleRunResponse Int Int
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