{-# 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.Redshift.Types.AccountAttribute where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Internal
import Amazonka.Redshift.Types.AttributeValueTarget
data AccountAttribute = AccountAttribute'
{
AccountAttribute -> Maybe [AttributeValueTarget]
attributeValues :: Prelude.Maybe [AttributeValueTarget],
AccountAttribute -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text
}
deriving (AccountAttribute -> AccountAttribute -> Bool
(AccountAttribute -> AccountAttribute -> Bool)
-> (AccountAttribute -> AccountAttribute -> Bool)
-> Eq AccountAttribute
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]
(Int -> ReadS AccountAttribute)
-> ReadS [AccountAttribute]
-> ReadPrec AccountAttribute
-> ReadPrec [AccountAttribute]
-> Read 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
(Int -> AccountAttribute -> ShowS)
-> (AccountAttribute -> String)
-> ([AccountAttribute] -> ShowS)
-> Show AccountAttribute
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. AccountAttribute -> Rep AccountAttribute x)
-> (forall x. Rep AccountAttribute x -> AccountAttribute)
-> Generic AccountAttribute
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' :: Maybe [AttributeValueTarget] -> Maybe Text -> AccountAttribute
AccountAttribute'
{ $sel:attributeValues:AccountAttribute' :: Maybe [AttributeValueTarget]
attributeValues =
Maybe [AttributeValueTarget]
forall a. Maybe a
Prelude.Nothing,
$sel:attributeName:AccountAttribute' :: Maybe Text
attributeName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
accountAttribute_attributeValues :: Lens.Lens' AccountAttribute (Prelude.Maybe [AttributeValueTarget])
accountAttribute_attributeValues :: (Maybe [AttributeValueTarget] -> f (Maybe [AttributeValueTarget]))
-> AccountAttribute -> f AccountAttribute
accountAttribute_attributeValues = (AccountAttribute -> Maybe [AttributeValueTarget])
-> (AccountAttribute
-> Maybe [AttributeValueTarget] -> AccountAttribute)
-> Lens
AccountAttribute
AccountAttribute
(Maybe [AttributeValueTarget])
(Maybe [AttributeValueTarget])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountAttribute' {Maybe [AttributeValueTarget]
attributeValues :: Maybe [AttributeValueTarget]
$sel:attributeValues:AccountAttribute' :: AccountAttribute -> Maybe [AttributeValueTarget]
attributeValues} -> Maybe [AttributeValueTarget]
attributeValues) (\s :: AccountAttribute
s@AccountAttribute' {} Maybe [AttributeValueTarget]
a -> AccountAttribute
s {$sel:attributeValues:AccountAttribute' :: Maybe [AttributeValueTarget]
attributeValues = Maybe [AttributeValueTarget]
a} :: AccountAttribute) ((Maybe [AttributeValueTarget] -> f (Maybe [AttributeValueTarget]))
-> AccountAttribute -> f AccountAttribute)
-> ((Maybe [AttributeValueTarget]
-> f (Maybe [AttributeValueTarget]))
-> Maybe [AttributeValueTarget]
-> f (Maybe [AttributeValueTarget]))
-> (Maybe [AttributeValueTarget]
-> f (Maybe [AttributeValueTarget]))
-> AccountAttribute
-> f AccountAttribute
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[AttributeValueTarget]
[AttributeValueTarget]
[AttributeValueTarget]
[AttributeValueTarget]
-> Iso
(Maybe [AttributeValueTarget])
(Maybe [AttributeValueTarget])
(Maybe [AttributeValueTarget])
(Maybe [AttributeValueTarget])
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 AnIso
[AttributeValueTarget]
[AttributeValueTarget]
[AttributeValueTarget]
[AttributeValueTarget]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
accountAttribute_attributeName :: Lens.Lens' AccountAttribute (Prelude.Maybe Prelude.Text)
accountAttribute_attributeName :: (Maybe Text -> f (Maybe Text))
-> AccountAttribute -> f AccountAttribute
accountAttribute_attributeName = (AccountAttribute -> Maybe Text)
-> (AccountAttribute -> Maybe Text -> AccountAttribute)
-> Lens AccountAttribute AccountAttribute (Maybe Text) (Maybe Text)
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)
instance Core.FromXML AccountAttribute where
parseXML :: [Node] -> Either String AccountAttribute
parseXML [Node]
x =
Maybe [AttributeValueTarget] -> Maybe Text -> AccountAttribute
AccountAttribute'
(Maybe [AttributeValueTarget] -> Maybe Text -> AccountAttribute)
-> Either String (Maybe [AttributeValueTarget])
-> Either String (Maybe Text -> AccountAttribute)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AttributeValues" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [AttributeValueTarget]))
-> Either String (Maybe [AttributeValueTarget])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [AttributeValueTarget])
-> [Node] -> Either String (Maybe [AttributeValueTarget])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [AttributeValueTarget]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"AttributeValueTarget")
)
Either String (Maybe Text -> AccountAttribute)
-> Either String (Maybe Text) -> Either String AccountAttribute
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AttributeName")
instance Prelude.Hashable AccountAttribute
instance Prelude.NFData AccountAttribute