{-# 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.SageMaker.StartMonitoringSchedule
-- 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 a previously stopped monitoring schedule.
--
-- By default, when you successfully create a new schedule, the status of a
-- monitoring schedule is @scheduled@.
module Amazonka.SageMaker.StartMonitoringSchedule
  ( -- * Creating a Request
    StartMonitoringSchedule (..),
    newStartMonitoringSchedule,

    -- * Request Lenses
    startMonitoringSchedule_monitoringScheduleName,

    -- * Destructuring the Response
    StartMonitoringScheduleResponse (..),
    newStartMonitoringScheduleResponse,
  )
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.SageMaker.Types

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

-- |
-- Create a value of 'StartMonitoringSchedule' 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:
--
-- 'monitoringScheduleName', 'startMonitoringSchedule_monitoringScheduleName' - The name of the schedule to start.
newStartMonitoringSchedule ::
  -- | 'monitoringScheduleName'
  Prelude.Text ->
  StartMonitoringSchedule
newStartMonitoringSchedule :: Text -> StartMonitoringSchedule
newStartMonitoringSchedule Text
pMonitoringScheduleName_ =
  StartMonitoringSchedule'
    { $sel:monitoringScheduleName:StartMonitoringSchedule' :: Text
monitoringScheduleName =
        Text
pMonitoringScheduleName_
    }

-- | The name of the schedule to start.
startMonitoringSchedule_monitoringScheduleName :: Lens.Lens' StartMonitoringSchedule Prelude.Text
startMonitoringSchedule_monitoringScheduleName :: Lens' StartMonitoringSchedule Text
startMonitoringSchedule_monitoringScheduleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMonitoringSchedule' {Text
monitoringScheduleName :: Text
$sel:monitoringScheduleName:StartMonitoringSchedule' :: StartMonitoringSchedule -> Text
monitoringScheduleName} -> Text
monitoringScheduleName) (\s :: StartMonitoringSchedule
s@StartMonitoringSchedule' {} Text
a -> StartMonitoringSchedule
s {$sel:monitoringScheduleName:StartMonitoringSchedule' :: Text
monitoringScheduleName = Text
a} :: StartMonitoringSchedule)

instance Core.AWSRequest StartMonitoringSchedule where
  type
    AWSResponse StartMonitoringSchedule =
      StartMonitoringScheduleResponse
  request :: (Service -> Service)
-> StartMonitoringSchedule -> Request StartMonitoringSchedule
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 StartMonitoringSchedule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartMonitoringSchedule)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      StartMonitoringScheduleResponse
StartMonitoringScheduleResponse'

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

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

instance Data.ToHeaders StartMonitoringSchedule where
  toHeaders :: StartMonitoringSchedule -> [Header]
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 -> [Header]
Data.=# ( ByteString
"SageMaker.StartMonitoringSchedule" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

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

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

-- |
-- Create a value of 'StartMonitoringScheduleResponse' 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.
newStartMonitoringScheduleResponse ::
  StartMonitoringScheduleResponse
newStartMonitoringScheduleResponse :: StartMonitoringScheduleResponse
newStartMonitoringScheduleResponse =
  StartMonitoringScheduleResponse
StartMonitoringScheduleResponse'

instance
  Prelude.NFData
    StartMonitoringScheduleResponse
  where
  rnf :: StartMonitoringScheduleResponse -> ()
rnf StartMonitoringScheduleResponse
_ = ()