{-# 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.AccountAttribute 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.AccountAttributeValue
import qualified Amazonka.Prelude as Prelude
data AccountAttribute = AccountAttribute'
{
AccountAttribute -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text,
AccountAttribute -> Maybe [AccountAttributeValue]
attributeValues :: Prelude.Maybe [AccountAttributeValue]
}
deriving (AccountAttribute -> AccountAttribute -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountAttribute -> AccountAttribute -> Bool
$c/= :: AccountAttribute -> AccountAttribute -> Bool
== :: AccountAttribute -> AccountAttribute -> Bool
$c== :: AccountAttribute -> AccountAttribute -> Bool
Prelude.Eq, ReadPrec [AccountAttribute]
ReadPrec AccountAttribute
Int -> ReadS AccountAttribute
ReadS [AccountAttribute]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountAttribute]
$creadListPrec :: ReadPrec [AccountAttribute]
readPrec :: ReadPrec AccountAttribute
$creadPrec :: ReadPrec AccountAttribute
readList :: ReadS [AccountAttribute]
$creadList :: ReadS [AccountAttribute]
readsPrec :: Int -> ReadS AccountAttribute
$creadsPrec :: Int -> ReadS AccountAttribute
Prelude.Read, Int -> AccountAttribute -> ShowS
[AccountAttribute] -> ShowS
AccountAttribute -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountAttribute] -> ShowS
$cshowList :: [AccountAttribute] -> ShowS
show :: AccountAttribute -> String
$cshow :: AccountAttribute -> String
showsPrec :: Int -> AccountAttribute -> ShowS
$cshowsPrec :: Int -> AccountAttribute -> ShowS
Prelude.Show, forall x. Rep AccountAttribute x -> AccountAttribute
forall x. AccountAttribute -> Rep AccountAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountAttribute x -> AccountAttribute
$cfrom :: forall x. AccountAttribute -> Rep AccountAttribute x
Prelude.Generic)
newAccountAttribute ::
AccountAttribute
newAccountAttribute :: AccountAttribute
newAccountAttribute =
AccountAttribute'
{ $sel:attributeName:AccountAttribute' :: Maybe Text
attributeName = forall a. Maybe a
Prelude.Nothing,
$sel:attributeValues:AccountAttribute' :: Maybe [AccountAttributeValue]
attributeValues = forall a. Maybe a
Prelude.Nothing
}
accountAttribute_attributeName :: Lens.Lens' AccountAttribute (Prelude.Maybe Prelude.Text)
accountAttribute_attributeName :: Lens' AccountAttribute (Maybe Text)
accountAttribute_attributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountAttribute' {Maybe Text
attributeName :: Maybe Text
$sel:attributeName:AccountAttribute' :: AccountAttribute -> Maybe Text
attributeName} -> Maybe Text
attributeName) (\s :: AccountAttribute
s@AccountAttribute' {} Maybe Text
a -> AccountAttribute
s {$sel:attributeName:AccountAttribute' :: Maybe Text
attributeName = Maybe Text
a} :: AccountAttribute)
accountAttribute_attributeValues :: Lens.Lens' AccountAttribute (Prelude.Maybe [AccountAttributeValue])
accountAttribute_attributeValues :: Lens' AccountAttribute (Maybe [AccountAttributeValue])
accountAttribute_attributeValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountAttribute' {Maybe [AccountAttributeValue]
attributeValues :: Maybe [AccountAttributeValue]
$sel:attributeValues:AccountAttribute' :: AccountAttribute -> Maybe [AccountAttributeValue]
attributeValues} -> Maybe [AccountAttributeValue]
attributeValues) (\s :: AccountAttribute
s@AccountAttribute' {} Maybe [AccountAttributeValue]
a -> AccountAttribute
s {$sel:attributeValues:AccountAttribute' :: Maybe [AccountAttributeValue]
attributeValues = Maybe [AccountAttributeValue]
a} :: AccountAttribute) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromXML AccountAttribute where
parseXML :: [Node] -> Either String AccountAttribute
parseXML [Node]
x =
Maybe Text -> Maybe [AccountAttributeValue] -> AccountAttribute
AccountAttribute'
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
"attributeName")
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
"attributeValueSet"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
)
instance Prelude.Hashable AccountAttribute where
hashWithSalt :: Int -> AccountAttribute -> Int
hashWithSalt Int
_salt AccountAttribute' {Maybe [AccountAttributeValue]
Maybe Text
attributeValues :: Maybe [AccountAttributeValue]
attributeName :: Maybe Text
$sel:attributeValues:AccountAttribute' :: AccountAttribute -> Maybe [AccountAttributeValue]
$sel:attributeName:AccountAttribute' :: AccountAttribute -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
attributeName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AccountAttributeValue]
attributeValues
instance Prelude.NFData AccountAttribute where
rnf :: AccountAttribute -> ()
rnf AccountAttribute' {Maybe [AccountAttributeValue]
Maybe Text
attributeValues :: Maybe [AccountAttributeValue]
attributeName :: Maybe Text
$sel:attributeValues:AccountAttribute' :: AccountAttribute -> Maybe [AccountAttributeValue]
$sel:attributeName:AccountAttribute' :: AccountAttribute -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
attributeName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [AccountAttributeValue]
attributeValues