{-# 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.IPRange 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.Tag
data IPRange = IPRange'
{
IPRange -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
IPRange -> Maybe Text
cidrip :: Prelude.Maybe Prelude.Text,
IPRange -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
}
deriving (IPRange -> IPRange -> Bool
(IPRange -> IPRange -> Bool)
-> (IPRange -> IPRange -> Bool) -> Eq IPRange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IPRange -> IPRange -> Bool
$c/= :: IPRange -> IPRange -> Bool
== :: IPRange -> IPRange -> Bool
$c== :: IPRange -> IPRange -> Bool
Prelude.Eq, ReadPrec [IPRange]
ReadPrec IPRange
Int -> ReadS IPRange
ReadS [IPRange]
(Int -> ReadS IPRange)
-> ReadS [IPRange]
-> ReadPrec IPRange
-> ReadPrec [IPRange]
-> Read IPRange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IPRange]
$creadListPrec :: ReadPrec [IPRange]
readPrec :: ReadPrec IPRange
$creadPrec :: ReadPrec IPRange
readList :: ReadS [IPRange]
$creadList :: ReadS [IPRange]
readsPrec :: Int -> ReadS IPRange
$creadsPrec :: Int -> ReadS IPRange
Prelude.Read, Int -> IPRange -> ShowS
[IPRange] -> ShowS
IPRange -> String
(Int -> IPRange -> ShowS)
-> (IPRange -> String) -> ([IPRange] -> ShowS) -> Show IPRange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IPRange] -> ShowS
$cshowList :: [IPRange] -> ShowS
show :: IPRange -> String
$cshow :: IPRange -> String
showsPrec :: Int -> IPRange -> ShowS
$cshowsPrec :: Int -> IPRange -> ShowS
Prelude.Show, (forall x. IPRange -> Rep IPRange x)
-> (forall x. Rep IPRange x -> IPRange) -> Generic IPRange
forall x. Rep IPRange x -> IPRange
forall x. IPRange -> Rep IPRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IPRange x -> IPRange
$cfrom :: forall x. IPRange -> Rep IPRange x
Prelude.Generic)
newIPRange ::
IPRange
newIPRange :: IPRange
newIPRange =
IPRange' :: Maybe Text -> Maybe Text -> Maybe [Tag] -> IPRange
IPRange'
{ $sel:status:IPRange' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:cidrip:IPRange' :: Maybe Text
cidrip = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:IPRange' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing
}
iPRange_status :: Lens.Lens' IPRange (Prelude.Maybe Prelude.Text)
iPRange_status :: (Maybe Text -> f (Maybe Text)) -> IPRange -> f IPRange
iPRange_status = (IPRange -> Maybe Text)
-> (IPRange -> Maybe Text -> IPRange)
-> Lens IPRange IPRange (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IPRange' {Maybe Text
status :: Maybe Text
$sel:status:IPRange' :: IPRange -> Maybe Text
status} -> Maybe Text
status) (\s :: IPRange
s@IPRange' {} Maybe Text
a -> IPRange
s {$sel:status:IPRange' :: Maybe Text
status = Maybe Text
a} :: IPRange)
iPRange_cidrip :: Lens.Lens' IPRange (Prelude.Maybe Prelude.Text)
iPRange_cidrip :: (Maybe Text -> f (Maybe Text)) -> IPRange -> f IPRange
iPRange_cidrip = (IPRange -> Maybe Text)
-> (IPRange -> Maybe Text -> IPRange)
-> Lens IPRange IPRange (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IPRange' {Maybe Text
cidrip :: Maybe Text
$sel:cidrip:IPRange' :: IPRange -> Maybe Text
cidrip} -> Maybe Text
cidrip) (\s :: IPRange
s@IPRange' {} Maybe Text
a -> IPRange
s {$sel:cidrip:IPRange' :: Maybe Text
cidrip = Maybe Text
a} :: IPRange)
iPRange_tags :: Lens.Lens' IPRange (Prelude.Maybe [Tag])
iPRange_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> IPRange -> f IPRange
iPRange_tags = (IPRange -> Maybe [Tag])
-> (IPRange -> Maybe [Tag] -> IPRange)
-> Lens IPRange IPRange (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IPRange' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:IPRange' :: IPRange -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: IPRange
s@IPRange' {} Maybe [Tag]
a -> IPRange
s {$sel:tags:IPRange' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: IPRange) ((Maybe [Tag] -> f (Maybe [Tag])) -> IPRange -> f IPRange)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> IPRange
-> f IPRange
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromXML IPRange where
parseXML :: [Node] -> Either String IPRange
parseXML [Node]
x =
Maybe Text -> Maybe Text -> Maybe [Tag] -> IPRange
IPRange'
(Maybe Text -> Maybe Text -> Maybe [Tag] -> IPRange)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe [Tag] -> IPRange)
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
"Status")
Either String (Maybe Text -> Maybe [Tag] -> IPRange)
-> Either String (Maybe Text)
-> Either String (Maybe [Tag] -> IPRange)
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
"CIDRIP")
Either String (Maybe [Tag] -> IPRange)
-> Either String (Maybe [Tag]) -> Either String IPRange
forall (f :: * -> *) a b. Applicative f => 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
"Tags" 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 [Tag]))
-> Either String (Maybe [Tag])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Tag])
-> [Node] -> Either String (Maybe [Tag])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Tag]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"Tag")
)
instance Prelude.Hashable IPRange
instance Prelude.NFData IPRange