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

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

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

-- |
-- Create a value of 'CapacitySize' 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:
--
-- 'type'', 'capacitySize_type' - This API is not supported.
--
-- 'value', 'capacitySize_value' -
newCapacitySize ::
  -- | 'type''
  CapacitySizeType ->
  -- | 'value'
  Prelude.Natural ->
  CapacitySize
newCapacitySize :: CapacitySizeType -> Natural -> CapacitySize
newCapacitySize CapacitySizeType
pType_ Natural
pValue_ =
  CapacitySize' :: CapacitySizeType -> Natural -> CapacitySize
CapacitySize' {$sel:type':CapacitySize' :: CapacitySizeType
type' = CapacitySizeType
pType_, $sel:value:CapacitySize' :: Natural
value = Natural
pValue_}

-- | This API is not supported.
capacitySize_type :: Lens.Lens' CapacitySize CapacitySizeType
capacitySize_type :: (CapacitySizeType -> f CapacitySizeType)
-> CapacitySize -> f CapacitySize
capacitySize_type = (CapacitySize -> CapacitySizeType)
-> (CapacitySize -> CapacitySizeType -> CapacitySize)
-> Lens CapacitySize CapacitySize CapacitySizeType CapacitySizeType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CapacitySize' {CapacitySizeType
type' :: CapacitySizeType
$sel:type':CapacitySize' :: CapacitySize -> CapacitySizeType
type'} -> CapacitySizeType
type') (\s :: CapacitySize
s@CapacitySize' {} CapacitySizeType
a -> CapacitySize
s {$sel:type':CapacitySize' :: CapacitySizeType
type' = CapacitySizeType
a} :: CapacitySize)

-- |
capacitySize_value :: Lens.Lens' CapacitySize Prelude.Natural
capacitySize_value :: (Natural -> f Natural) -> CapacitySize -> f CapacitySize
capacitySize_value = (CapacitySize -> Natural)
-> (CapacitySize -> Natural -> CapacitySize)
-> Lens CapacitySize CapacitySize Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CapacitySize' {Natural
value :: Natural
$sel:value:CapacitySize' :: CapacitySize -> Natural
value} -> Natural
value) (\s :: CapacitySize
s@CapacitySize' {} Natural
a -> CapacitySize
s {$sel:value:CapacitySize' :: Natural
value = Natural
a} :: CapacitySize)

instance Core.FromJSON CapacitySize where
  parseJSON :: Value -> Parser CapacitySize
parseJSON =
    String
-> (Object -> Parser CapacitySize) -> Value -> Parser CapacitySize
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CapacitySize"
      ( \Object
x ->
          CapacitySizeType -> Natural -> CapacitySize
CapacitySize'
            (CapacitySizeType -> Natural -> CapacitySize)
-> Parser CapacitySizeType -> Parser (Natural -> CapacitySize)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser CapacitySizeType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type") Parser (Natural -> CapacitySize)
-> Parser Natural -> Parser CapacitySize
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Value")
      )

instance Prelude.Hashable CapacitySize

instance Prelude.NFData CapacitySize

instance Core.ToJSON CapacitySize where
  toJSON :: CapacitySize -> Value
toJSON CapacitySize' {Natural
CapacitySizeType
value :: Natural
type' :: CapacitySizeType
$sel:value:CapacitySize' :: CapacitySize -> Natural
$sel:type':CapacitySize' :: CapacitySize -> CapacitySizeType
..} =
    [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
"Type" Text -> CapacitySizeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CapacitySizeType
type'),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Value" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
value)
          ]
      )