{-# 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.S3.Types.Condition where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
data Condition = Condition'
{
Condition -> Maybe Text
keyPrefixEquals :: Prelude.Maybe Prelude.Text,
Condition -> Maybe Text
httpErrorCodeReturnedEquals :: Prelude.Maybe Prelude.Text
}
deriving (Condition -> Condition -> Bool
(Condition -> Condition -> Bool)
-> (Condition -> Condition -> Bool) -> Eq Condition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Condition -> Condition -> Bool
$c/= :: Condition -> Condition -> Bool
== :: Condition -> Condition -> Bool
$c== :: Condition -> Condition -> Bool
Prelude.Eq, ReadPrec [Condition]
ReadPrec Condition
Int -> ReadS Condition
ReadS [Condition]
(Int -> ReadS Condition)
-> ReadS [Condition]
-> ReadPrec Condition
-> ReadPrec [Condition]
-> Read Condition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Condition]
$creadListPrec :: ReadPrec [Condition]
readPrec :: ReadPrec Condition
$creadPrec :: ReadPrec Condition
readList :: ReadS [Condition]
$creadList :: ReadS [Condition]
readsPrec :: Int -> ReadS Condition
$creadsPrec :: Int -> ReadS Condition
Prelude.Read, Int -> Condition -> ShowS
[Condition] -> ShowS
Condition -> String
(Int -> Condition -> ShowS)
-> (Condition -> String)
-> ([Condition] -> ShowS)
-> Show Condition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Condition] -> ShowS
$cshowList :: [Condition] -> ShowS
show :: Condition -> String
$cshow :: Condition -> String
showsPrec :: Int -> Condition -> ShowS
$cshowsPrec :: Int -> Condition -> ShowS
Prelude.Show, (forall x. Condition -> Rep Condition x)
-> (forall x. Rep Condition x -> Condition) -> Generic Condition
forall x. Rep Condition x -> Condition
forall x. Condition -> Rep Condition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Condition x -> Condition
$cfrom :: forall x. Condition -> Rep Condition x
Prelude.Generic)
newCondition ::
Condition
newCondition :: Condition
newCondition =
Condition' :: Maybe Text -> Maybe Text -> Condition
Condition'
{ $sel:keyPrefixEquals:Condition' :: Maybe Text
keyPrefixEquals = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpErrorCodeReturnedEquals:Condition' :: Maybe Text
httpErrorCodeReturnedEquals = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
condition_keyPrefixEquals :: Lens.Lens' Condition (Prelude.Maybe Prelude.Text)
condition_keyPrefixEquals :: (Maybe Text -> f (Maybe Text)) -> Condition -> f Condition
condition_keyPrefixEquals = (Condition -> Maybe Text)
-> (Condition -> Maybe Text -> Condition)
-> Lens Condition Condition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe Text
keyPrefixEquals :: Maybe Text
$sel:keyPrefixEquals:Condition' :: Condition -> Maybe Text
keyPrefixEquals} -> Maybe Text
keyPrefixEquals) (\s :: Condition
s@Condition' {} Maybe Text
a -> Condition
s {$sel:keyPrefixEquals:Condition' :: Maybe Text
keyPrefixEquals = Maybe Text
a} :: Condition)
condition_httpErrorCodeReturnedEquals :: Lens.Lens' Condition (Prelude.Maybe Prelude.Text)
condition_httpErrorCodeReturnedEquals :: (Maybe Text -> f (Maybe Text)) -> Condition -> f Condition
condition_httpErrorCodeReturnedEquals = (Condition -> Maybe Text)
-> (Condition -> Maybe Text -> Condition)
-> Lens Condition Condition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Condition' {Maybe Text
httpErrorCodeReturnedEquals :: Maybe Text
$sel:httpErrorCodeReturnedEquals:Condition' :: Condition -> Maybe Text
httpErrorCodeReturnedEquals} -> Maybe Text
httpErrorCodeReturnedEquals) (\s :: Condition
s@Condition' {} Maybe Text
a -> Condition
s {$sel:httpErrorCodeReturnedEquals:Condition' :: Maybe Text
httpErrorCodeReturnedEquals = Maybe Text
a} :: Condition)
instance Core.FromXML Condition where
parseXML :: [Node] -> Either String Condition
parseXML [Node]
x =
Maybe Text -> Maybe Text -> Condition
Condition'
(Maybe Text -> Maybe Text -> Condition)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Condition)
forall (f :: * -> *) a b. Functor 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
"KeyPrefixEquals")
Either String (Maybe Text -> Condition)
-> Either String (Maybe Text) -> Either String Condition
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
"HttpErrorCodeReturnedEquals")
instance Prelude.Hashable Condition
instance Prelude.NFData Condition
instance Core.ToXML Condition where
toXML :: Condition -> XML
toXML Condition' {Maybe Text
httpErrorCodeReturnedEquals :: Maybe Text
keyPrefixEquals :: Maybe Text
$sel:httpErrorCodeReturnedEquals:Condition' :: Condition -> Maybe Text
$sel:keyPrefixEquals:Condition' :: Condition -> Maybe Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"KeyPrefixEquals" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
keyPrefixEquals,
Name
"HttpErrorCodeReturnedEquals"
Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
httpErrorCodeReturnedEquals
]