{-# 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.ECS.Types.EphemeralStorage
-- 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.ECS.Types.EphemeralStorage 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

-- | The amount of ephemeral storage to allocate for the task. This parameter
-- is used to expand the total amount of ephemeral storage available,
-- beyond the default amount, for tasks hosted on Fargate. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonECS/latest/userguide/using_data_volumes.html Fargate task storage>
-- in the /Amazon ECS User Guide for Fargate/.
--
-- This parameter is only supported for tasks hosted on Fargate using Linux
-- platform version @1.4.0@ or later. This parameter is not supported for
-- Windows containers on Fargate.
--
-- /See:/ 'newEphemeralStorage' smart constructor.
data EphemeralStorage = EphemeralStorage'
  { -- | The total amount, in GiB, of ephemeral storage to set for the task. The
    -- minimum supported value is @21@ GiB and the maximum supported value is
    -- @200@ GiB.
    EphemeralStorage -> Int
sizeInGiB :: Prelude.Int
  }
  deriving (EphemeralStorage -> EphemeralStorage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EphemeralStorage -> EphemeralStorage -> Bool
$c/= :: EphemeralStorage -> EphemeralStorage -> Bool
== :: EphemeralStorage -> EphemeralStorage -> Bool
$c== :: EphemeralStorage -> EphemeralStorage -> Bool
Prelude.Eq, ReadPrec [EphemeralStorage]
ReadPrec EphemeralStorage
Int -> ReadS EphemeralStorage
ReadS [EphemeralStorage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EphemeralStorage]
$creadListPrec :: ReadPrec [EphemeralStorage]
readPrec :: ReadPrec EphemeralStorage
$creadPrec :: ReadPrec EphemeralStorage
readList :: ReadS [EphemeralStorage]
$creadList :: ReadS [EphemeralStorage]
readsPrec :: Int -> ReadS EphemeralStorage
$creadsPrec :: Int -> ReadS EphemeralStorage
Prelude.Read, Int -> EphemeralStorage -> ShowS
[EphemeralStorage] -> ShowS
EphemeralStorage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EphemeralStorage] -> ShowS
$cshowList :: [EphemeralStorage] -> ShowS
show :: EphemeralStorage -> String
$cshow :: EphemeralStorage -> String
showsPrec :: Int -> EphemeralStorage -> ShowS
$cshowsPrec :: Int -> EphemeralStorage -> ShowS
Prelude.Show, forall x. Rep EphemeralStorage x -> EphemeralStorage
forall x. EphemeralStorage -> Rep EphemeralStorage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EphemeralStorage x -> EphemeralStorage
$cfrom :: forall x. EphemeralStorage -> Rep EphemeralStorage x
Prelude.Generic)

-- |
-- Create a value of 'EphemeralStorage' 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:
--
-- 'sizeInGiB', 'ephemeralStorage_sizeInGiB' - The total amount, in GiB, of ephemeral storage to set for the task. The
-- minimum supported value is @21@ GiB and the maximum supported value is
-- @200@ GiB.
newEphemeralStorage ::
  -- | 'sizeInGiB'
  Prelude.Int ->
  EphemeralStorage
newEphemeralStorage :: Int -> EphemeralStorage
newEphemeralStorage Int
pSizeInGiB_ =
  EphemeralStorage' {$sel:sizeInGiB:EphemeralStorage' :: Int
sizeInGiB = Int
pSizeInGiB_}

-- | The total amount, in GiB, of ephemeral storage to set for the task. The
-- minimum supported value is @21@ GiB and the maximum supported value is
-- @200@ GiB.
ephemeralStorage_sizeInGiB :: Lens.Lens' EphemeralStorage Prelude.Int
ephemeralStorage_sizeInGiB :: Lens' EphemeralStorage Int
ephemeralStorage_sizeInGiB = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EphemeralStorage' {Int
sizeInGiB :: Int
$sel:sizeInGiB:EphemeralStorage' :: EphemeralStorage -> Int
sizeInGiB} -> Int
sizeInGiB) (\s :: EphemeralStorage
s@EphemeralStorage' {} Int
a -> EphemeralStorage
s {$sel:sizeInGiB:EphemeralStorage' :: Int
sizeInGiB = Int
a} :: EphemeralStorage)

instance Data.FromJSON EphemeralStorage where
  parseJSON :: Value -> Parser EphemeralStorage
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EphemeralStorage"
      ( \Object
x ->
          Int -> EphemeralStorage
EphemeralStorage'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"sizeInGiB")
      )

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

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

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