{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.RDS.Types.IPRange
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.RDS.Types.IPRange where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | This data type is used as a response element in the
-- @DescribeDBSecurityGroups@ action.
--
-- /See:/ 'newIPRange' smart constructor.
data IPRange = IPRange'
  { -- | Specifies the status of the IP range. Status can be \"authorizing\",
    -- \"authorized\", \"revoking\", and \"revoked\".
    IPRange -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | Specifies the IP range.
    IPRange -> Maybe Text
cidrip :: Prelude.Maybe Prelude.Text
  }
  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)

-- |
-- Create a value of 'IPRange' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'status', 'iPRange_status' - Specifies the status of the IP range. Status can be \"authorizing\",
-- \"authorized\", \"revoking\", and \"revoked\".
--
-- 'cidrip', 'iPRange_cidrip' - Specifies the IP range.
newIPRange ::
  IPRange
newIPRange :: IPRange
newIPRange =
  IPRange' :: Maybe Text -> Maybe Text -> 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
    }

-- | Specifies the status of the IP range. Status can be \"authorizing\",
-- \"authorized\", \"revoking\", and \"revoked\".
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)

-- | Specifies the IP range.
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)

instance Core.FromXML IPRange where
  parseXML :: [Node] -> Either String IPRange
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> IPRange
IPRange'
      (Maybe Text -> Maybe Text -> IPRange)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> 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 -> IPRange)
-> Either String (Maybe Text) -> Either String 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")

instance Prelude.Hashable IPRange

instance Prelude.NFData IPRange