{-# 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.SimSpaceWeaver.StartClock
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Starts the simulation clock.
module Amazonka.SimSpaceWeaver.StartClock
  ( -- * Creating a Request
    StartClock (..),
    newStartClock,

    -- * Request Lenses
    startClock_simulation,

    -- * Destructuring the Response
    StartClockResponse (..),
    newStartClockResponse,

    -- * Response Lenses
    startClockResponse_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.SimSpaceWeaver.Types

-- | /See:/ 'newStartClock' smart constructor.
data StartClock = StartClock'
  { -- | The name of the simulation.
    StartClock -> Text
simulation :: Prelude.Text
  }
  deriving (StartClock -> StartClock -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartClock -> StartClock -> Bool
$c/= :: StartClock -> StartClock -> Bool
== :: StartClock -> StartClock -> Bool
$c== :: StartClock -> StartClock -> Bool
Prelude.Eq, ReadPrec [StartClock]
ReadPrec StartClock
Int -> ReadS StartClock
ReadS [StartClock]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartClock]
$creadListPrec :: ReadPrec [StartClock]
readPrec :: ReadPrec StartClock
$creadPrec :: ReadPrec StartClock
readList :: ReadS [StartClock]
$creadList :: ReadS [StartClock]
readsPrec :: Int -> ReadS StartClock
$creadsPrec :: Int -> ReadS StartClock
Prelude.Read, Int -> StartClock -> ShowS
[StartClock] -> ShowS
StartClock -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartClock] -> ShowS
$cshowList :: [StartClock] -> ShowS
show :: StartClock -> String
$cshow :: StartClock -> String
showsPrec :: Int -> StartClock -> ShowS
$cshowsPrec :: Int -> StartClock -> ShowS
Prelude.Show, forall x. Rep StartClock x -> StartClock
forall x. StartClock -> Rep StartClock x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartClock x -> StartClock
$cfrom :: forall x. StartClock -> Rep StartClock x
Prelude.Generic)

-- |
-- Create a value of 'StartClock' 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:
--
-- 'simulation', 'startClock_simulation' - The name of the simulation.
newStartClock ::
  -- | 'simulation'
  Prelude.Text ->
  StartClock
newStartClock :: Text -> StartClock
newStartClock Text
pSimulation_ =
  StartClock' {$sel:simulation:StartClock' :: Text
simulation = Text
pSimulation_}

-- | The name of the simulation.
startClock_simulation :: Lens.Lens' StartClock Prelude.Text
startClock_simulation :: Lens' StartClock Text
startClock_simulation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartClock' {Text
simulation :: Text
$sel:simulation:StartClock' :: StartClock -> Text
simulation} -> Text
simulation) (\s :: StartClock
s@StartClock' {} Text
a -> StartClock
s {$sel:simulation:StartClock' :: Text
simulation = Text
a} :: StartClock)

instance Core.AWSRequest StartClock where
  type AWSResponse StartClock = StartClockResponse
  request :: (Service -> Service) -> StartClock -> Request StartClock
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 StartClock
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartClock)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> StartClockResponse
StartClockResponse'
            forall (f :: * -> *) a b. Functor 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 StartClock where
  hashWithSalt :: Int -> StartClock -> Int
hashWithSalt Int
_salt StartClock' {Text
simulation :: Text
$sel:simulation:StartClock' :: StartClock -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
simulation

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

instance Data.ToHeaders StartClock where
  toHeaders :: StartClock -> 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 StartClock where
  toJSON :: StartClock -> Value
toJSON StartClock' {Text
simulation :: Text
$sel:simulation:StartClock' :: StartClock -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Simulation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
simulation)]
      )

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

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

-- | /See:/ 'newStartClockResponse' smart constructor.
data StartClockResponse = StartClockResponse'
  { -- | The response's http status code.
    StartClockResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartClockResponse -> StartClockResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartClockResponse -> StartClockResponse -> Bool
$c/= :: StartClockResponse -> StartClockResponse -> Bool
== :: StartClockResponse -> StartClockResponse -> Bool
$c== :: StartClockResponse -> StartClockResponse -> Bool
Prelude.Eq, ReadPrec [StartClockResponse]
ReadPrec StartClockResponse
Int -> ReadS StartClockResponse
ReadS [StartClockResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartClockResponse]
$creadListPrec :: ReadPrec [StartClockResponse]
readPrec :: ReadPrec StartClockResponse
$creadPrec :: ReadPrec StartClockResponse
readList :: ReadS [StartClockResponse]
$creadList :: ReadS [StartClockResponse]
readsPrec :: Int -> ReadS StartClockResponse
$creadsPrec :: Int -> ReadS StartClockResponse
Prelude.Read, Int -> StartClockResponse -> ShowS
[StartClockResponse] -> ShowS
StartClockResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartClockResponse] -> ShowS
$cshowList :: [StartClockResponse] -> ShowS
show :: StartClockResponse -> String
$cshow :: StartClockResponse -> String
showsPrec :: Int -> StartClockResponse -> ShowS
$cshowsPrec :: Int -> StartClockResponse -> ShowS
Prelude.Show, forall x. Rep StartClockResponse x -> StartClockResponse
forall x. StartClockResponse -> Rep StartClockResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartClockResponse x -> StartClockResponse
$cfrom :: forall x. StartClockResponse -> Rep StartClockResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartClockResponse' 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:
--
-- 'httpStatus', 'startClockResponse_httpStatus' - The response's http status code.
newStartClockResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartClockResponse
newStartClockResponse :: Int -> StartClockResponse
newStartClockResponse Int
pHttpStatus_ =
  StartClockResponse' {$sel:httpStatus:StartClockResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData StartClockResponse where
  rnf :: StartClockResponse -> ()
rnf StartClockResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartClockResponse' :: StartClockResponse -> Int
..} = forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus