{-# 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 #-}
module Amazonka.EC2.Types.CapacityAllocation where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.AllocationType
import qualified Amazonka.Prelude as Prelude
data CapacityAllocation = CapacityAllocation'
{
CapacityAllocation -> Maybe AllocationType
allocationType :: Prelude.Maybe AllocationType,
CapacityAllocation -> Maybe Int
count :: Prelude.Maybe Prelude.Int
}
deriving (CapacityAllocation -> CapacityAllocation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CapacityAllocation -> CapacityAllocation -> Bool
$c/= :: CapacityAllocation -> CapacityAllocation -> Bool
== :: CapacityAllocation -> CapacityAllocation -> Bool
$c== :: CapacityAllocation -> CapacityAllocation -> Bool
Prelude.Eq, ReadPrec [CapacityAllocation]
ReadPrec CapacityAllocation
Int -> ReadS CapacityAllocation
ReadS [CapacityAllocation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CapacityAllocation]
$creadListPrec :: ReadPrec [CapacityAllocation]
readPrec :: ReadPrec CapacityAllocation
$creadPrec :: ReadPrec CapacityAllocation
readList :: ReadS [CapacityAllocation]
$creadList :: ReadS [CapacityAllocation]
readsPrec :: Int -> ReadS CapacityAllocation
$creadsPrec :: Int -> ReadS CapacityAllocation
Prelude.Read, Int -> CapacityAllocation -> ShowS
[CapacityAllocation] -> ShowS
CapacityAllocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CapacityAllocation] -> ShowS
$cshowList :: [CapacityAllocation] -> ShowS
show :: CapacityAllocation -> String
$cshow :: CapacityAllocation -> String
showsPrec :: Int -> CapacityAllocation -> ShowS
$cshowsPrec :: Int -> CapacityAllocation -> ShowS
Prelude.Show, forall x. Rep CapacityAllocation x -> CapacityAllocation
forall x. CapacityAllocation -> Rep CapacityAllocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CapacityAllocation x -> CapacityAllocation
$cfrom :: forall x. CapacityAllocation -> Rep CapacityAllocation x
Prelude.Generic)
newCapacityAllocation ::
CapacityAllocation
newCapacityAllocation :: CapacityAllocation
newCapacityAllocation =
CapacityAllocation'
{ $sel:allocationType:CapacityAllocation' :: Maybe AllocationType
allocationType =
forall a. Maybe a
Prelude.Nothing,
$sel:count:CapacityAllocation' :: Maybe Int
count = forall a. Maybe a
Prelude.Nothing
}
capacityAllocation_allocationType :: Lens.Lens' CapacityAllocation (Prelude.Maybe AllocationType)
capacityAllocation_allocationType :: Lens' CapacityAllocation (Maybe AllocationType)
capacityAllocation_allocationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CapacityAllocation' {Maybe AllocationType
allocationType :: Maybe AllocationType
$sel:allocationType:CapacityAllocation' :: CapacityAllocation -> Maybe AllocationType
allocationType} -> Maybe AllocationType
allocationType) (\s :: CapacityAllocation
s@CapacityAllocation' {} Maybe AllocationType
a -> CapacityAllocation
s {$sel:allocationType:CapacityAllocation' :: Maybe AllocationType
allocationType = Maybe AllocationType
a} :: CapacityAllocation)
capacityAllocation_count :: Lens.Lens' CapacityAllocation (Prelude.Maybe Prelude.Int)
capacityAllocation_count :: Lens' CapacityAllocation (Maybe Int)
capacityAllocation_count = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CapacityAllocation' {Maybe Int
count :: Maybe Int
$sel:count:CapacityAllocation' :: CapacityAllocation -> Maybe Int
count} -> Maybe Int
count) (\s :: CapacityAllocation
s@CapacityAllocation' {} Maybe Int
a -> CapacityAllocation
s {$sel:count:CapacityAllocation' :: Maybe Int
count = Maybe Int
a} :: CapacityAllocation)
instance Data.FromXML CapacityAllocation where
parseXML :: [Node] -> Either String CapacityAllocation
parseXML [Node]
x =
Maybe AllocationType -> Maybe Int -> CapacityAllocation
CapacityAllocation'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"allocationType")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"count")
instance Prelude.Hashable CapacityAllocation where
hashWithSalt :: Int -> CapacityAllocation -> Int
hashWithSalt Int
_salt CapacityAllocation' {Maybe Int
Maybe AllocationType
count :: Maybe Int
allocationType :: Maybe AllocationType
$sel:count:CapacityAllocation' :: CapacityAllocation -> Maybe Int
$sel:allocationType:CapacityAllocation' :: CapacityAllocation -> Maybe AllocationType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AllocationType
allocationType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
count
instance Prelude.NFData CapacityAllocation where
rnf :: CapacityAllocation -> ()
rnf CapacityAllocation' {Maybe Int
Maybe AllocationType
count :: Maybe Int
allocationType :: Maybe AllocationType
$sel:count:CapacityAllocation' :: CapacityAllocation -> Maybe Int
$sel:allocationType:CapacityAllocation' :: CapacityAllocation -> Maybe AllocationType
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe AllocationType
allocationType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
count