{-# 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.Subnet
-- 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.Subnet where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RDS.Types.AvailabilityZone
import Amazonka.RDS.Types.Outpost

-- | This data type is used as a response element for the
-- @DescribeDBSubnetGroups@ operation.
--
-- /See:/ 'newSubnet' smart constructor.
data Subnet = Subnet'
  { -- | The status of the subnet.
    Subnet -> Maybe Text
subnetStatus :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the subnet.
    Subnet -> Maybe Text
subnetIdentifier :: Prelude.Maybe Prelude.Text,
    Subnet -> Maybe AvailabilityZone
subnetAvailabilityZone :: Prelude.Maybe AvailabilityZone,
    -- | If the subnet is associated with an Outpost, this value specifies the
    -- Outpost.
    --
    -- For more information about RDS on Outposts, see
    -- <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-on-outposts.html Amazon RDS on Amazon Web Services Outposts>
    -- in the /Amazon RDS User Guide./
    Subnet -> Maybe Outpost
subnetOutpost :: Prelude.Maybe Outpost
  }
  deriving (Subnet -> Subnet -> Bool
(Subnet -> Subnet -> Bool)
-> (Subnet -> Subnet -> Bool) -> Eq Subnet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Subnet -> Subnet -> Bool
$c/= :: Subnet -> Subnet -> Bool
== :: Subnet -> Subnet -> Bool
$c== :: Subnet -> Subnet -> Bool
Prelude.Eq, ReadPrec [Subnet]
ReadPrec Subnet
Int -> ReadS Subnet
ReadS [Subnet]
(Int -> ReadS Subnet)
-> ReadS [Subnet]
-> ReadPrec Subnet
-> ReadPrec [Subnet]
-> Read Subnet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Subnet]
$creadListPrec :: ReadPrec [Subnet]
readPrec :: ReadPrec Subnet
$creadPrec :: ReadPrec Subnet
readList :: ReadS [Subnet]
$creadList :: ReadS [Subnet]
readsPrec :: Int -> ReadS Subnet
$creadsPrec :: Int -> ReadS Subnet
Prelude.Read, Int -> Subnet -> ShowS
[Subnet] -> ShowS
Subnet -> String
(Int -> Subnet -> ShowS)
-> (Subnet -> String) -> ([Subnet] -> ShowS) -> Show Subnet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Subnet] -> ShowS
$cshowList :: [Subnet] -> ShowS
show :: Subnet -> String
$cshow :: Subnet -> String
showsPrec :: Int -> Subnet -> ShowS
$cshowsPrec :: Int -> Subnet -> ShowS
Prelude.Show, (forall x. Subnet -> Rep Subnet x)
-> (forall x. Rep Subnet x -> Subnet) -> Generic Subnet
forall x. Rep Subnet x -> Subnet
forall x. Subnet -> Rep Subnet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Subnet x -> Subnet
$cfrom :: forall x. Subnet -> Rep Subnet x
Prelude.Generic)

-- |
-- Create a value of 'Subnet' 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:
--
-- 'subnetStatus', 'subnet_subnetStatus' - The status of the subnet.
--
-- 'subnetIdentifier', 'subnet_subnetIdentifier' - The identifier of the subnet.
--
-- 'subnetAvailabilityZone', 'subnet_subnetAvailabilityZone' - Undocumented member.
--
-- 'subnetOutpost', 'subnet_subnetOutpost' - If the subnet is associated with an Outpost, this value specifies the
-- Outpost.
--
-- For more information about RDS on Outposts, see
-- <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-on-outposts.html Amazon RDS on Amazon Web Services Outposts>
-- in the /Amazon RDS User Guide./
newSubnet ::
  Subnet
newSubnet :: Subnet
newSubnet =
  Subnet' :: Maybe Text
-> Maybe Text -> Maybe AvailabilityZone -> Maybe Outpost -> Subnet
Subnet'
    { $sel:subnetStatus:Subnet' :: Maybe Text
subnetStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIdentifier:Subnet' :: Maybe Text
subnetIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetAvailabilityZone:Subnet' :: Maybe AvailabilityZone
subnetAvailabilityZone = Maybe AvailabilityZone
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetOutpost:Subnet' :: Maybe Outpost
subnetOutpost = Maybe Outpost
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the subnet.
subnet_subnetStatus :: Lens.Lens' Subnet (Prelude.Maybe Prelude.Text)
subnet_subnetStatus :: (Maybe Text -> f (Maybe Text)) -> Subnet -> f Subnet
subnet_subnetStatus = (Subnet -> Maybe Text)
-> (Subnet -> Maybe Text -> Subnet)
-> Lens Subnet Subnet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subnet' {Maybe Text
subnetStatus :: Maybe Text
$sel:subnetStatus:Subnet' :: Subnet -> Maybe Text
subnetStatus} -> Maybe Text
subnetStatus) (\s :: Subnet
s@Subnet' {} Maybe Text
a -> Subnet
s {$sel:subnetStatus:Subnet' :: Maybe Text
subnetStatus = Maybe Text
a} :: Subnet)

-- | The identifier of the subnet.
subnet_subnetIdentifier :: Lens.Lens' Subnet (Prelude.Maybe Prelude.Text)
subnet_subnetIdentifier :: (Maybe Text -> f (Maybe Text)) -> Subnet -> f Subnet
subnet_subnetIdentifier = (Subnet -> Maybe Text)
-> (Subnet -> Maybe Text -> Subnet)
-> Lens Subnet Subnet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subnet' {Maybe Text
subnetIdentifier :: Maybe Text
$sel:subnetIdentifier:Subnet' :: Subnet -> Maybe Text
subnetIdentifier} -> Maybe Text
subnetIdentifier) (\s :: Subnet
s@Subnet' {} Maybe Text
a -> Subnet
s {$sel:subnetIdentifier:Subnet' :: Maybe Text
subnetIdentifier = Maybe Text
a} :: Subnet)

-- | Undocumented member.
subnet_subnetAvailabilityZone :: Lens.Lens' Subnet (Prelude.Maybe AvailabilityZone)
subnet_subnetAvailabilityZone :: (Maybe AvailabilityZone -> f (Maybe AvailabilityZone))
-> Subnet -> f Subnet
subnet_subnetAvailabilityZone = (Subnet -> Maybe AvailabilityZone)
-> (Subnet -> Maybe AvailabilityZone -> Subnet)
-> Lens
     Subnet Subnet (Maybe AvailabilityZone) (Maybe AvailabilityZone)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subnet' {Maybe AvailabilityZone
subnetAvailabilityZone :: Maybe AvailabilityZone
$sel:subnetAvailabilityZone:Subnet' :: Subnet -> Maybe AvailabilityZone
subnetAvailabilityZone} -> Maybe AvailabilityZone
subnetAvailabilityZone) (\s :: Subnet
s@Subnet' {} Maybe AvailabilityZone
a -> Subnet
s {$sel:subnetAvailabilityZone:Subnet' :: Maybe AvailabilityZone
subnetAvailabilityZone = Maybe AvailabilityZone
a} :: Subnet)

-- | If the subnet is associated with an Outpost, this value specifies the
-- Outpost.
--
-- For more information about RDS on Outposts, see
-- <https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-on-outposts.html Amazon RDS on Amazon Web Services Outposts>
-- in the /Amazon RDS User Guide./
subnet_subnetOutpost :: Lens.Lens' Subnet (Prelude.Maybe Outpost)
subnet_subnetOutpost :: (Maybe Outpost -> f (Maybe Outpost)) -> Subnet -> f Subnet
subnet_subnetOutpost = (Subnet -> Maybe Outpost)
-> (Subnet -> Maybe Outpost -> Subnet)
-> Lens Subnet Subnet (Maybe Outpost) (Maybe Outpost)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subnet' {Maybe Outpost
subnetOutpost :: Maybe Outpost
$sel:subnetOutpost:Subnet' :: Subnet -> Maybe Outpost
subnetOutpost} -> Maybe Outpost
subnetOutpost) (\s :: Subnet
s@Subnet' {} Maybe Outpost
a -> Subnet
s {$sel:subnetOutpost:Subnet' :: Maybe Outpost
subnetOutpost = Maybe Outpost
a} :: Subnet)

instance Core.FromXML Subnet where
  parseXML :: [Node] -> Either String Subnet
parseXML [Node]
x =
    Maybe Text
-> Maybe Text -> Maybe AvailabilityZone -> Maybe Outpost -> Subnet
Subnet'
      (Maybe Text
 -> Maybe Text -> Maybe AvailabilityZone -> Maybe Outpost -> Subnet)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Maybe AvailabilityZone -> Maybe Outpost -> Subnet)
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
"SubnetStatus")
      Either
  String
  (Maybe Text -> Maybe AvailabilityZone -> Maybe Outpost -> Subnet)
-> Either String (Maybe Text)
-> Either
     String (Maybe AvailabilityZone -> Maybe Outpost -> Subnet)
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
"SubnetIdentifier")
      Either String (Maybe AvailabilityZone -> Maybe Outpost -> Subnet)
-> Either String (Maybe AvailabilityZone)
-> Either String (Maybe Outpost -> Subnet)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe AvailabilityZone)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SubnetAvailabilityZone")
      Either String (Maybe Outpost -> Subnet)
-> Either String (Maybe Outpost) -> Either String Subnet
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Outpost)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SubnetOutpost")

instance Prelude.Hashable Subnet

instance Prelude.NFData Subnet