{-# 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.DocumentDB.Types.DBSubnetGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DocumentDB.Types.DBSubnetGroup where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DocumentDB.Types.Subnet
import qualified Amazonka.Prelude as Prelude

-- | Detailed information about a subnet group.
--
-- /See:/ 'newDBSubnetGroup' smart constructor.
data DBSubnetGroup = DBSubnetGroup'
  { -- | The Amazon Resource Name (ARN) for the DB subnet group.
    DBSubnetGroup -> Maybe Text
dbSubnetGroupArn :: Prelude.Maybe Prelude.Text,
    -- | Provides the description of the subnet group.
    DBSubnetGroup -> Maybe Text
dbSubnetGroupDescription :: Prelude.Maybe Prelude.Text,
    -- | The name of the subnet group.
    DBSubnetGroup -> Maybe Text
dbSubnetGroupName :: Prelude.Maybe Prelude.Text,
    -- | Provides the status of the subnet group.
    DBSubnetGroup -> Maybe Text
subnetGroupStatus :: Prelude.Maybe Prelude.Text,
    -- | Detailed information about one or more subnets within a subnet group.
    DBSubnetGroup -> Maybe [Subnet]
subnets :: Prelude.Maybe [Subnet],
    -- | Provides the virtual private cloud (VPC) ID of the subnet group.
    DBSubnetGroup -> Maybe Text
vpcId :: Prelude.Maybe Prelude.Text
  }
  deriving (DBSubnetGroup -> DBSubnetGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DBSubnetGroup -> DBSubnetGroup -> Bool
$c/= :: DBSubnetGroup -> DBSubnetGroup -> Bool
== :: DBSubnetGroup -> DBSubnetGroup -> Bool
$c== :: DBSubnetGroup -> DBSubnetGroup -> Bool
Prelude.Eq, ReadPrec [DBSubnetGroup]
ReadPrec DBSubnetGroup
Int -> ReadS DBSubnetGroup
ReadS [DBSubnetGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DBSubnetGroup]
$creadListPrec :: ReadPrec [DBSubnetGroup]
readPrec :: ReadPrec DBSubnetGroup
$creadPrec :: ReadPrec DBSubnetGroup
readList :: ReadS [DBSubnetGroup]
$creadList :: ReadS [DBSubnetGroup]
readsPrec :: Int -> ReadS DBSubnetGroup
$creadsPrec :: Int -> ReadS DBSubnetGroup
Prelude.Read, Int -> DBSubnetGroup -> ShowS
[DBSubnetGroup] -> ShowS
DBSubnetGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DBSubnetGroup] -> ShowS
$cshowList :: [DBSubnetGroup] -> ShowS
show :: DBSubnetGroup -> String
$cshow :: DBSubnetGroup -> String
showsPrec :: Int -> DBSubnetGroup -> ShowS
$cshowsPrec :: Int -> DBSubnetGroup -> ShowS
Prelude.Show, forall x. Rep DBSubnetGroup x -> DBSubnetGroup
forall x. DBSubnetGroup -> Rep DBSubnetGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DBSubnetGroup x -> DBSubnetGroup
$cfrom :: forall x. DBSubnetGroup -> Rep DBSubnetGroup x
Prelude.Generic)

-- |
-- Create a value of 'DBSubnetGroup' 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:
--
-- 'dbSubnetGroupArn', 'dbSubnetGroup_dbSubnetGroupArn' - The Amazon Resource Name (ARN) for the DB subnet group.
--
-- 'dbSubnetGroupDescription', 'dbSubnetGroup_dbSubnetGroupDescription' - Provides the description of the subnet group.
--
-- 'dbSubnetGroupName', 'dbSubnetGroup_dbSubnetGroupName' - The name of the subnet group.
--
-- 'subnetGroupStatus', 'dbSubnetGroup_subnetGroupStatus' - Provides the status of the subnet group.
--
-- 'subnets', 'dbSubnetGroup_subnets' - Detailed information about one or more subnets within a subnet group.
--
-- 'vpcId', 'dbSubnetGroup_vpcId' - Provides the virtual private cloud (VPC) ID of the subnet group.
newDBSubnetGroup ::
  DBSubnetGroup
newDBSubnetGroup :: DBSubnetGroup
newDBSubnetGroup =
  DBSubnetGroup'
    { $sel:dbSubnetGroupArn:DBSubnetGroup' :: Maybe Text
dbSubnetGroupArn = forall a. Maybe a
Prelude.Nothing,
      $sel:dbSubnetGroupDescription:DBSubnetGroup' :: Maybe Text
dbSubnetGroupDescription = forall a. Maybe a
Prelude.Nothing,
      $sel:dbSubnetGroupName:DBSubnetGroup' :: Maybe Text
dbSubnetGroupName = forall a. Maybe a
Prelude.Nothing,
      $sel:subnetGroupStatus:DBSubnetGroup' :: Maybe Text
subnetGroupStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:subnets:DBSubnetGroup' :: Maybe [Subnet]
subnets = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:DBSubnetGroup' :: Maybe Text
vpcId = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) for the DB subnet group.
dbSubnetGroup_dbSubnetGroupArn :: Lens.Lens' DBSubnetGroup (Prelude.Maybe Prelude.Text)
dbSubnetGroup_dbSubnetGroupArn :: Lens' DBSubnetGroup (Maybe Text)
dbSubnetGroup_dbSubnetGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBSubnetGroup' {Maybe Text
dbSubnetGroupArn :: Maybe Text
$sel:dbSubnetGroupArn:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
dbSubnetGroupArn} -> Maybe Text
dbSubnetGroupArn) (\s :: DBSubnetGroup
s@DBSubnetGroup' {} Maybe Text
a -> DBSubnetGroup
s {$sel:dbSubnetGroupArn:DBSubnetGroup' :: Maybe Text
dbSubnetGroupArn = Maybe Text
a} :: DBSubnetGroup)

-- | Provides the description of the subnet group.
dbSubnetGroup_dbSubnetGroupDescription :: Lens.Lens' DBSubnetGroup (Prelude.Maybe Prelude.Text)
dbSubnetGroup_dbSubnetGroupDescription :: Lens' DBSubnetGroup (Maybe Text)
dbSubnetGroup_dbSubnetGroupDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBSubnetGroup' {Maybe Text
dbSubnetGroupDescription :: Maybe Text
$sel:dbSubnetGroupDescription:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
dbSubnetGroupDescription} -> Maybe Text
dbSubnetGroupDescription) (\s :: DBSubnetGroup
s@DBSubnetGroup' {} Maybe Text
a -> DBSubnetGroup
s {$sel:dbSubnetGroupDescription:DBSubnetGroup' :: Maybe Text
dbSubnetGroupDescription = Maybe Text
a} :: DBSubnetGroup)

-- | The name of the subnet group.
dbSubnetGroup_dbSubnetGroupName :: Lens.Lens' DBSubnetGroup (Prelude.Maybe Prelude.Text)
dbSubnetGroup_dbSubnetGroupName :: Lens' DBSubnetGroup (Maybe Text)
dbSubnetGroup_dbSubnetGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBSubnetGroup' {Maybe Text
dbSubnetGroupName :: Maybe Text
$sel:dbSubnetGroupName:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
dbSubnetGroupName} -> Maybe Text
dbSubnetGroupName) (\s :: DBSubnetGroup
s@DBSubnetGroup' {} Maybe Text
a -> DBSubnetGroup
s {$sel:dbSubnetGroupName:DBSubnetGroup' :: Maybe Text
dbSubnetGroupName = Maybe Text
a} :: DBSubnetGroup)

-- | Provides the status of the subnet group.
dbSubnetGroup_subnetGroupStatus :: Lens.Lens' DBSubnetGroup (Prelude.Maybe Prelude.Text)
dbSubnetGroup_subnetGroupStatus :: Lens' DBSubnetGroup (Maybe Text)
dbSubnetGroup_subnetGroupStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBSubnetGroup' {Maybe Text
subnetGroupStatus :: Maybe Text
$sel:subnetGroupStatus:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
subnetGroupStatus} -> Maybe Text
subnetGroupStatus) (\s :: DBSubnetGroup
s@DBSubnetGroup' {} Maybe Text
a -> DBSubnetGroup
s {$sel:subnetGroupStatus:DBSubnetGroup' :: Maybe Text
subnetGroupStatus = Maybe Text
a} :: DBSubnetGroup)

-- | Detailed information about one or more subnets within a subnet group.
dbSubnetGroup_subnets :: Lens.Lens' DBSubnetGroup (Prelude.Maybe [Subnet])
dbSubnetGroup_subnets :: Lens' DBSubnetGroup (Maybe [Subnet])
dbSubnetGroup_subnets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBSubnetGroup' {Maybe [Subnet]
subnets :: Maybe [Subnet]
$sel:subnets:DBSubnetGroup' :: DBSubnetGroup -> Maybe [Subnet]
subnets} -> Maybe [Subnet]
subnets) (\s :: DBSubnetGroup
s@DBSubnetGroup' {} Maybe [Subnet]
a -> DBSubnetGroup
s {$sel:subnets:DBSubnetGroup' :: Maybe [Subnet]
subnets = Maybe [Subnet]
a} :: DBSubnetGroup) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Provides the virtual private cloud (VPC) ID of the subnet group.
dbSubnetGroup_vpcId :: Lens.Lens' DBSubnetGroup (Prelude.Maybe Prelude.Text)
dbSubnetGroup_vpcId :: Lens' DBSubnetGroup (Maybe Text)
dbSubnetGroup_vpcId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBSubnetGroup' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
vpcId} -> Maybe Text
vpcId) (\s :: DBSubnetGroup
s@DBSubnetGroup' {} Maybe Text
a -> DBSubnetGroup
s {$sel:vpcId:DBSubnetGroup' :: Maybe Text
vpcId = Maybe Text
a} :: DBSubnetGroup)

instance Data.FromXML DBSubnetGroup where
  parseXML :: [Node] -> Either String DBSubnetGroup
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Subnet]
-> Maybe Text
-> DBSubnetGroup
DBSubnetGroup'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DBSubnetGroupArn")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DBSubnetGroupDescription")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DBSubnetGroupName")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SubnetGroupStatus")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Subnets"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"Subnet")
                  )
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"VpcId")

instance Prelude.Hashable DBSubnetGroup where
  hashWithSalt :: Int -> DBSubnetGroup -> Int
hashWithSalt Int
_salt DBSubnetGroup' {Maybe [Subnet]
Maybe Text
vpcId :: Maybe Text
subnets :: Maybe [Subnet]
subnetGroupStatus :: Maybe Text
dbSubnetGroupName :: Maybe Text
dbSubnetGroupDescription :: Maybe Text
dbSubnetGroupArn :: Maybe Text
$sel:vpcId:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
$sel:subnets:DBSubnetGroup' :: DBSubnetGroup -> Maybe [Subnet]
$sel:subnetGroupStatus:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
$sel:dbSubnetGroupName:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
$sel:dbSubnetGroupDescription:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
$sel:dbSubnetGroupArn:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dbSubnetGroupArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dbSubnetGroupDescription
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dbSubnetGroupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subnetGroupStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Subnet]
subnets
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcId

instance Prelude.NFData DBSubnetGroup where
  rnf :: DBSubnetGroup -> ()
rnf DBSubnetGroup' {Maybe [Subnet]
Maybe Text
vpcId :: Maybe Text
subnets :: Maybe [Subnet]
subnetGroupStatus :: Maybe Text
dbSubnetGroupName :: Maybe Text
dbSubnetGroupDescription :: Maybe Text
dbSubnetGroupArn :: Maybe Text
$sel:vpcId:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
$sel:subnets:DBSubnetGroup' :: DBSubnetGroup -> Maybe [Subnet]
$sel:subnetGroupStatus:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
$sel:dbSubnetGroupName:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
$sel:dbSubnetGroupDescription:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
$sel:dbSubnetGroupArn:DBSubnetGroup' :: DBSubnetGroup -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dbSubnetGroupArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dbSubnetGroupDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dbSubnetGroupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subnetGroupStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Subnet]
subnets
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpcId