{-# 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.WarmPoolStatus
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.WarmPoolStatus 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 Amazonka.SageMaker.Types.WarmPoolResourceStatus

-- | Status and billing information about the warm pool.
--
-- /See:/ 'newWarmPoolStatus' smart constructor.
data WarmPoolStatus = WarmPoolStatus'
  { -- | The billable time in seconds used by the warm pool. Billable time refers
    -- to the absolute wall-clock time.
    --
    -- Multiply @ResourceRetainedBillableTimeInSeconds@ by the number of
    -- instances (@InstanceCount@) in your training cluster to get the total
    -- compute time SageMaker bills you if you run warm pool training. The
    -- formula is as follows:
    -- @ResourceRetainedBillableTimeInSeconds * InstanceCount@.
    WarmPoolStatus -> Maybe Natural
resourceRetainedBillableTimeInSeconds :: Prelude.Maybe Prelude.Natural,
    -- | The name of the matching training job that reused the warm pool.
    WarmPoolStatus -> Maybe Text
reusedByJob :: Prelude.Maybe Prelude.Text,
    -- | The status of the warm pool.
    --
    -- -   @InUse@: The warm pool is in use for the training job.
    --
    -- -   @Available@: The warm pool is available to reuse for a matching
    --     training job.
    --
    -- -   @Reused@: The warm pool moved to a matching training job for reuse.
    --
    -- -   @Terminated@: The warm pool is no longer available. Warm pools are
    --     unavailable if they are terminated by a user, terminated for a patch
    --     update, or terminated for exceeding the specified
    --     @KeepAlivePeriodInSeconds@.
    WarmPoolStatus -> WarmPoolResourceStatus
status :: WarmPoolResourceStatus
  }
  deriving (WarmPoolStatus -> WarmPoolStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WarmPoolStatus -> WarmPoolStatus -> Bool
$c/= :: WarmPoolStatus -> WarmPoolStatus -> Bool
== :: WarmPoolStatus -> WarmPoolStatus -> Bool
$c== :: WarmPoolStatus -> WarmPoolStatus -> Bool
Prelude.Eq, ReadPrec [WarmPoolStatus]
ReadPrec WarmPoolStatus
Int -> ReadS WarmPoolStatus
ReadS [WarmPoolStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WarmPoolStatus]
$creadListPrec :: ReadPrec [WarmPoolStatus]
readPrec :: ReadPrec WarmPoolStatus
$creadPrec :: ReadPrec WarmPoolStatus
readList :: ReadS [WarmPoolStatus]
$creadList :: ReadS [WarmPoolStatus]
readsPrec :: Int -> ReadS WarmPoolStatus
$creadsPrec :: Int -> ReadS WarmPoolStatus
Prelude.Read, Int -> WarmPoolStatus -> ShowS
[WarmPoolStatus] -> ShowS
WarmPoolStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WarmPoolStatus] -> ShowS
$cshowList :: [WarmPoolStatus] -> ShowS
show :: WarmPoolStatus -> String
$cshow :: WarmPoolStatus -> String
showsPrec :: Int -> WarmPoolStatus -> ShowS
$cshowsPrec :: Int -> WarmPoolStatus -> ShowS
Prelude.Show, forall x. Rep WarmPoolStatus x -> WarmPoolStatus
forall x. WarmPoolStatus -> Rep WarmPoolStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WarmPoolStatus x -> WarmPoolStatus
$cfrom :: forall x. WarmPoolStatus -> Rep WarmPoolStatus x
Prelude.Generic)

-- |
-- Create a value of 'WarmPoolStatus' 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:
--
-- 'resourceRetainedBillableTimeInSeconds', 'warmPoolStatus_resourceRetainedBillableTimeInSeconds' - The billable time in seconds used by the warm pool. Billable time refers
-- to the absolute wall-clock time.
--
-- Multiply @ResourceRetainedBillableTimeInSeconds@ by the number of
-- instances (@InstanceCount@) in your training cluster to get the total
-- compute time SageMaker bills you if you run warm pool training. The
-- formula is as follows:
-- @ResourceRetainedBillableTimeInSeconds * InstanceCount@.
--
-- 'reusedByJob', 'warmPoolStatus_reusedByJob' - The name of the matching training job that reused the warm pool.
--
-- 'status', 'warmPoolStatus_status' - The status of the warm pool.
--
-- -   @InUse@: The warm pool is in use for the training job.
--
-- -   @Available@: The warm pool is available to reuse for a matching
--     training job.
--
-- -   @Reused@: The warm pool moved to a matching training job for reuse.
--
-- -   @Terminated@: The warm pool is no longer available. Warm pools are
--     unavailable if they are terminated by a user, terminated for a patch
--     update, or terminated for exceeding the specified
--     @KeepAlivePeriodInSeconds@.
newWarmPoolStatus ::
  -- | 'status'
  WarmPoolResourceStatus ->
  WarmPoolStatus
newWarmPoolStatus :: WarmPoolResourceStatus -> WarmPoolStatus
newWarmPoolStatus WarmPoolResourceStatus
pStatus_ =
  WarmPoolStatus'
    { $sel:resourceRetainedBillableTimeInSeconds:WarmPoolStatus' :: Maybe Natural
resourceRetainedBillableTimeInSeconds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:reusedByJob:WarmPoolStatus' :: Maybe Text
reusedByJob = forall a. Maybe a
Prelude.Nothing,
      $sel:status:WarmPoolStatus' :: WarmPoolResourceStatus
status = WarmPoolResourceStatus
pStatus_
    }

-- | The billable time in seconds used by the warm pool. Billable time refers
-- to the absolute wall-clock time.
--
-- Multiply @ResourceRetainedBillableTimeInSeconds@ by the number of
-- instances (@InstanceCount@) in your training cluster to get the total
-- compute time SageMaker bills you if you run warm pool training. The
-- formula is as follows:
-- @ResourceRetainedBillableTimeInSeconds * InstanceCount@.
warmPoolStatus_resourceRetainedBillableTimeInSeconds :: Lens.Lens' WarmPoolStatus (Prelude.Maybe Prelude.Natural)
warmPoolStatus_resourceRetainedBillableTimeInSeconds :: Lens' WarmPoolStatus (Maybe Natural)
warmPoolStatus_resourceRetainedBillableTimeInSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WarmPoolStatus' {Maybe Natural
resourceRetainedBillableTimeInSeconds :: Maybe Natural
$sel:resourceRetainedBillableTimeInSeconds:WarmPoolStatus' :: WarmPoolStatus -> Maybe Natural
resourceRetainedBillableTimeInSeconds} -> Maybe Natural
resourceRetainedBillableTimeInSeconds) (\s :: WarmPoolStatus
s@WarmPoolStatus' {} Maybe Natural
a -> WarmPoolStatus
s {$sel:resourceRetainedBillableTimeInSeconds:WarmPoolStatus' :: Maybe Natural
resourceRetainedBillableTimeInSeconds = Maybe Natural
a} :: WarmPoolStatus)

-- | The name of the matching training job that reused the warm pool.
warmPoolStatus_reusedByJob :: Lens.Lens' WarmPoolStatus (Prelude.Maybe Prelude.Text)
warmPoolStatus_reusedByJob :: Lens' WarmPoolStatus (Maybe Text)
warmPoolStatus_reusedByJob = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WarmPoolStatus' {Maybe Text
reusedByJob :: Maybe Text
$sel:reusedByJob:WarmPoolStatus' :: WarmPoolStatus -> Maybe Text
reusedByJob} -> Maybe Text
reusedByJob) (\s :: WarmPoolStatus
s@WarmPoolStatus' {} Maybe Text
a -> WarmPoolStatus
s {$sel:reusedByJob:WarmPoolStatus' :: Maybe Text
reusedByJob = Maybe Text
a} :: WarmPoolStatus)

-- | The status of the warm pool.
--
-- -   @InUse@: The warm pool is in use for the training job.
--
-- -   @Available@: The warm pool is available to reuse for a matching
--     training job.
--
-- -   @Reused@: The warm pool moved to a matching training job for reuse.
--
-- -   @Terminated@: The warm pool is no longer available. Warm pools are
--     unavailable if they are terminated by a user, terminated for a patch
--     update, or terminated for exceeding the specified
--     @KeepAlivePeriodInSeconds@.
warmPoolStatus_status :: Lens.Lens' WarmPoolStatus WarmPoolResourceStatus
warmPoolStatus_status :: Lens' WarmPoolStatus WarmPoolResourceStatus
warmPoolStatus_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WarmPoolStatus' {WarmPoolResourceStatus
status :: WarmPoolResourceStatus
$sel:status:WarmPoolStatus' :: WarmPoolStatus -> WarmPoolResourceStatus
status} -> WarmPoolResourceStatus
status) (\s :: WarmPoolStatus
s@WarmPoolStatus' {} WarmPoolResourceStatus
a -> WarmPoolStatus
s {$sel:status:WarmPoolStatus' :: WarmPoolResourceStatus
status = WarmPoolResourceStatus
a} :: WarmPoolStatus)

instance Data.FromJSON WarmPoolStatus where
  parseJSON :: Value -> Parser WarmPoolStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WarmPoolStatus"
      ( \Object
x ->
          Maybe Natural
-> Maybe Text -> WarmPoolResourceStatus -> WarmPoolStatus
WarmPoolStatus'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ResourceRetainedBillableTimeInSeconds")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ReusedByJob")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Status")
      )

instance Prelude.Hashable WarmPoolStatus where
  hashWithSalt :: Int -> WarmPoolStatus -> Int
hashWithSalt Int
_salt WarmPoolStatus' {Maybe Natural
Maybe Text
WarmPoolResourceStatus
status :: WarmPoolResourceStatus
reusedByJob :: Maybe Text
resourceRetainedBillableTimeInSeconds :: Maybe Natural
$sel:status:WarmPoolStatus' :: WarmPoolStatus -> WarmPoolResourceStatus
$sel:reusedByJob:WarmPoolStatus' :: WarmPoolStatus -> Maybe Text
$sel:resourceRetainedBillableTimeInSeconds:WarmPoolStatus' :: WarmPoolStatus -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
resourceRetainedBillableTimeInSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
reusedByJob
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WarmPoolResourceStatus
status

instance Prelude.NFData WarmPoolStatus where
  rnf :: WarmPoolStatus -> ()
rnf WarmPoolStatus' {Maybe Natural
Maybe Text
WarmPoolResourceStatus
status :: WarmPoolResourceStatus
reusedByJob :: Maybe Text
resourceRetainedBillableTimeInSeconds :: Maybe Natural
$sel:status:WarmPoolStatus' :: WarmPoolStatus -> WarmPoolResourceStatus
$sel:reusedByJob:WarmPoolStatus' :: WarmPoolStatus -> Maybe Text
$sel:resourceRetainedBillableTimeInSeconds:WarmPoolStatus' :: WarmPoolStatus -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
resourceRetainedBillableTimeInSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
reusedByJob
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf WarmPoolResourceStatus
status