{-# 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.MonitoringResources
-- 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.MonitoringResources where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.MonitoringClusterConfig

-- | Identifies the resources to deploy for a monitoring job.
--
-- /See:/ 'newMonitoringResources' smart constructor.
data MonitoringResources = MonitoringResources'
  { -- | The configuration for the cluster resources used to run the processing
    -- job.
    MonitoringResources -> MonitoringClusterConfig
clusterConfig :: MonitoringClusterConfig
  }
  deriving (MonitoringResources -> MonitoringResources -> Bool
(MonitoringResources -> MonitoringResources -> Bool)
-> (MonitoringResources -> MonitoringResources -> Bool)
-> Eq MonitoringResources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonitoringResources -> MonitoringResources -> Bool
$c/= :: MonitoringResources -> MonitoringResources -> Bool
== :: MonitoringResources -> MonitoringResources -> Bool
$c== :: MonitoringResources -> MonitoringResources -> Bool
Prelude.Eq, ReadPrec [MonitoringResources]
ReadPrec MonitoringResources
Int -> ReadS MonitoringResources
ReadS [MonitoringResources]
(Int -> ReadS MonitoringResources)
-> ReadS [MonitoringResources]
-> ReadPrec MonitoringResources
-> ReadPrec [MonitoringResources]
-> Read MonitoringResources
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonitoringResources]
$creadListPrec :: ReadPrec [MonitoringResources]
readPrec :: ReadPrec MonitoringResources
$creadPrec :: ReadPrec MonitoringResources
readList :: ReadS [MonitoringResources]
$creadList :: ReadS [MonitoringResources]
readsPrec :: Int -> ReadS MonitoringResources
$creadsPrec :: Int -> ReadS MonitoringResources
Prelude.Read, Int -> MonitoringResources -> ShowS
[MonitoringResources] -> ShowS
MonitoringResources -> String
(Int -> MonitoringResources -> ShowS)
-> (MonitoringResources -> String)
-> ([MonitoringResources] -> ShowS)
-> Show MonitoringResources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonitoringResources] -> ShowS
$cshowList :: [MonitoringResources] -> ShowS
show :: MonitoringResources -> String
$cshow :: MonitoringResources -> String
showsPrec :: Int -> MonitoringResources -> ShowS
$cshowsPrec :: Int -> MonitoringResources -> ShowS
Prelude.Show, (forall x. MonitoringResources -> Rep MonitoringResources x)
-> (forall x. Rep MonitoringResources x -> MonitoringResources)
-> Generic MonitoringResources
forall x. Rep MonitoringResources x -> MonitoringResources
forall x. MonitoringResources -> Rep MonitoringResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MonitoringResources x -> MonitoringResources
$cfrom :: forall x. MonitoringResources -> Rep MonitoringResources x
Prelude.Generic)

-- |
-- Create a value of 'MonitoringResources' 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:
--
-- 'clusterConfig', 'monitoringResources_clusterConfig' - The configuration for the cluster resources used to run the processing
-- job.
newMonitoringResources ::
  -- | 'clusterConfig'
  MonitoringClusterConfig ->
  MonitoringResources
newMonitoringResources :: MonitoringClusterConfig -> MonitoringResources
newMonitoringResources MonitoringClusterConfig
pClusterConfig_ =
  MonitoringResources' :: MonitoringClusterConfig -> MonitoringResources
MonitoringResources'
    { $sel:clusterConfig:MonitoringResources' :: MonitoringClusterConfig
clusterConfig =
        MonitoringClusterConfig
pClusterConfig_
    }

-- | The configuration for the cluster resources used to run the processing
-- job.
monitoringResources_clusterConfig :: Lens.Lens' MonitoringResources MonitoringClusterConfig
monitoringResources_clusterConfig :: (MonitoringClusterConfig -> f MonitoringClusterConfig)
-> MonitoringResources -> f MonitoringResources
monitoringResources_clusterConfig = (MonitoringResources -> MonitoringClusterConfig)
-> (MonitoringResources
    -> MonitoringClusterConfig -> MonitoringResources)
-> Lens
     MonitoringResources
     MonitoringResources
     MonitoringClusterConfig
     MonitoringClusterConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringResources' {MonitoringClusterConfig
clusterConfig :: MonitoringClusterConfig
$sel:clusterConfig:MonitoringResources' :: MonitoringResources -> MonitoringClusterConfig
clusterConfig} -> MonitoringClusterConfig
clusterConfig) (\s :: MonitoringResources
s@MonitoringResources' {} MonitoringClusterConfig
a -> MonitoringResources
s {$sel:clusterConfig:MonitoringResources' :: MonitoringClusterConfig
clusterConfig = MonitoringClusterConfig
a} :: MonitoringResources)

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

instance Prelude.Hashable MonitoringResources

instance Prelude.NFData MonitoringResources

instance Core.ToJSON MonitoringResources where
  toJSON :: MonitoringResources -> Value
toJSON MonitoringResources' {MonitoringClusterConfig
clusterConfig :: MonitoringClusterConfig
$sel:clusterConfig:MonitoringResources' :: MonitoringResources -> MonitoringClusterConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ClusterConfig" Text -> MonitoringClusterConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MonitoringClusterConfig
clusterConfig)
          ]
      )