{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.Alarm
-- 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)
module Amazonka.SageMaker.Types.Alarm where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'Alarm' 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:
--
-- 'alarmName', 'alarm_alarmName' -
newAlarm ::
  Alarm
newAlarm :: Alarm
newAlarm = Alarm' :: Maybe Text -> Alarm
Alarm' {$sel:alarmName:Alarm' :: Maybe Text
alarmName = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- |
alarm_alarmName :: Lens.Lens' Alarm (Prelude.Maybe Prelude.Text)
alarm_alarmName :: (Maybe Text -> f (Maybe Text)) -> Alarm -> f Alarm
alarm_alarmName = (Alarm -> Maybe Text)
-> (Alarm -> Maybe Text -> Alarm)
-> Lens Alarm Alarm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Alarm' {Maybe Text
alarmName :: Maybe Text
$sel:alarmName:Alarm' :: Alarm -> Maybe Text
alarmName} -> Maybe Text
alarmName) (\s :: Alarm
s@Alarm' {} Maybe Text
a -> Alarm
s {$sel:alarmName:Alarm' :: Maybe Text
alarmName = Maybe Text
a} :: Alarm)

instance Core.FromJSON Alarm where
  parseJSON :: Value -> Parser Alarm
parseJSON =
    String -> (Object -> Parser Alarm) -> Value -> Parser Alarm
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Alarm"
      (\Object
x -> Maybe Text -> Alarm
Alarm' (Maybe Text -> Alarm) -> Parser (Maybe Text) -> Parser Alarm
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AlarmName"))

instance Prelude.Hashable Alarm

instance Prelude.NFData Alarm

instance Core.ToJSON Alarm where
  toJSON :: Alarm -> Value
toJSON Alarm' {Maybe Text
alarmName :: Maybe Text
$sel:alarmName:Alarm' :: Alarm -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"AlarmName" 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
alarmName]
      )