{-# 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.IoTAnalytics.Types.ResourceConfiguration
-- 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.IoTAnalytics.Types.ResourceConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTAnalytics.Types.ComputeType
import qualified Amazonka.Prelude as Prelude

-- | The configuration of the resource used to execute the @containerAction@.
--
-- /See:/ 'newResourceConfiguration' smart constructor.
data ResourceConfiguration = ResourceConfiguration'
  { -- | The type of the compute resource used to execute the @containerAction@.
    -- Possible values are: @ACU_1@ (vCPU=4, memory=16 GiB) or @ACU_2@ (vCPU=8,
    -- memory=32 GiB).
    ResourceConfiguration -> ComputeType
computeType :: ComputeType,
    -- | The size, in GB, of the persistent storage available to the resource
    -- instance used to execute the @containerAction@ (min: 1, max: 50).
    ResourceConfiguration -> Natural
volumeSizeInGB :: Prelude.Natural
  }
  deriving (ResourceConfiguration -> ResourceConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceConfiguration -> ResourceConfiguration -> Bool
$c/= :: ResourceConfiguration -> ResourceConfiguration -> Bool
== :: ResourceConfiguration -> ResourceConfiguration -> Bool
$c== :: ResourceConfiguration -> ResourceConfiguration -> Bool
Prelude.Eq, ReadPrec [ResourceConfiguration]
ReadPrec ResourceConfiguration
Int -> ReadS ResourceConfiguration
ReadS [ResourceConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceConfiguration]
$creadListPrec :: ReadPrec [ResourceConfiguration]
readPrec :: ReadPrec ResourceConfiguration
$creadPrec :: ReadPrec ResourceConfiguration
readList :: ReadS [ResourceConfiguration]
$creadList :: ReadS [ResourceConfiguration]
readsPrec :: Int -> ReadS ResourceConfiguration
$creadsPrec :: Int -> ReadS ResourceConfiguration
Prelude.Read, Int -> ResourceConfiguration -> ShowS
[ResourceConfiguration] -> ShowS
ResourceConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceConfiguration] -> ShowS
$cshowList :: [ResourceConfiguration] -> ShowS
show :: ResourceConfiguration -> String
$cshow :: ResourceConfiguration -> String
showsPrec :: Int -> ResourceConfiguration -> ShowS
$cshowsPrec :: Int -> ResourceConfiguration -> ShowS
Prelude.Show, forall x. Rep ResourceConfiguration x -> ResourceConfiguration
forall x. ResourceConfiguration -> Rep ResourceConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceConfiguration x -> ResourceConfiguration
$cfrom :: forall x. ResourceConfiguration -> Rep ResourceConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ResourceConfiguration' 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:
--
-- 'computeType', 'resourceConfiguration_computeType' - The type of the compute resource used to execute the @containerAction@.
-- Possible values are: @ACU_1@ (vCPU=4, memory=16 GiB) or @ACU_2@ (vCPU=8,
-- memory=32 GiB).
--
-- 'volumeSizeInGB', 'resourceConfiguration_volumeSizeInGB' - The size, in GB, of the persistent storage available to the resource
-- instance used to execute the @containerAction@ (min: 1, max: 50).
newResourceConfiguration ::
  -- | 'computeType'
  ComputeType ->
  -- | 'volumeSizeInGB'
  Prelude.Natural ->
  ResourceConfiguration
newResourceConfiguration :: ComputeType -> Natural -> ResourceConfiguration
newResourceConfiguration
  ComputeType
pComputeType_
  Natural
pVolumeSizeInGB_ =
    ResourceConfiguration'
      { $sel:computeType:ResourceConfiguration' :: ComputeType
computeType = ComputeType
pComputeType_,
        $sel:volumeSizeInGB:ResourceConfiguration' :: Natural
volumeSizeInGB = Natural
pVolumeSizeInGB_
      }

-- | The type of the compute resource used to execute the @containerAction@.
-- Possible values are: @ACU_1@ (vCPU=4, memory=16 GiB) or @ACU_2@ (vCPU=8,
-- memory=32 GiB).
resourceConfiguration_computeType :: Lens.Lens' ResourceConfiguration ComputeType
resourceConfiguration_computeType :: Lens' ResourceConfiguration ComputeType
resourceConfiguration_computeType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceConfiguration' {ComputeType
computeType :: ComputeType
$sel:computeType:ResourceConfiguration' :: ResourceConfiguration -> ComputeType
computeType} -> ComputeType
computeType) (\s :: ResourceConfiguration
s@ResourceConfiguration' {} ComputeType
a -> ResourceConfiguration
s {$sel:computeType:ResourceConfiguration' :: ComputeType
computeType = ComputeType
a} :: ResourceConfiguration)

-- | The size, in GB, of the persistent storage available to the resource
-- instance used to execute the @containerAction@ (min: 1, max: 50).
resourceConfiguration_volumeSizeInGB :: Lens.Lens' ResourceConfiguration Prelude.Natural
resourceConfiguration_volumeSizeInGB :: Lens' ResourceConfiguration Natural
resourceConfiguration_volumeSizeInGB = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceConfiguration' {Natural
volumeSizeInGB :: Natural
$sel:volumeSizeInGB:ResourceConfiguration' :: ResourceConfiguration -> Natural
volumeSizeInGB} -> Natural
volumeSizeInGB) (\s :: ResourceConfiguration
s@ResourceConfiguration' {} Natural
a -> ResourceConfiguration
s {$sel:volumeSizeInGB:ResourceConfiguration' :: Natural
volumeSizeInGB = Natural
a} :: ResourceConfiguration)

instance Data.FromJSON ResourceConfiguration where
  parseJSON :: Value -> Parser ResourceConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResourceConfiguration"
      ( \Object
x ->
          ComputeType -> Natural -> ResourceConfiguration
ResourceConfiguration'
            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
"computeType")
            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
"volumeSizeInGB")
      )

instance Prelude.Hashable ResourceConfiguration where
  hashWithSalt :: Int -> ResourceConfiguration -> Int
hashWithSalt Int
_salt ResourceConfiguration' {Natural
ComputeType
volumeSizeInGB :: Natural
computeType :: ComputeType
$sel:volumeSizeInGB:ResourceConfiguration' :: ResourceConfiguration -> Natural
$sel:computeType:ResourceConfiguration' :: ResourceConfiguration -> ComputeType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ComputeType
computeType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
volumeSizeInGB

instance Prelude.NFData ResourceConfiguration where
  rnf :: ResourceConfiguration -> ()
rnf ResourceConfiguration' {Natural
ComputeType
volumeSizeInGB :: Natural
computeType :: ComputeType
$sel:volumeSizeInGB:ResourceConfiguration' :: ResourceConfiguration -> Natural
$sel:computeType:ResourceConfiguration' :: ResourceConfiguration -> ComputeType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf ComputeType
computeType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
volumeSizeInGB

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