{-# 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.DMS.Types.ReplicationSubnetGroup
-- 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.DMS.Types.ReplicationSubnetGroup where

import qualified Amazonka.Core as Core
import Amazonka.DMS.Types.Subnet
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes a subnet group in response to a request by the
-- @DescribeReplicationSubnetGroups@ operation.
--
-- /See:/ 'newReplicationSubnetGroup' smart constructor.
data ReplicationSubnetGroup = ReplicationSubnetGroup'
  { -- | The ID of the VPC.
    ReplicationSubnetGroup -> Maybe Text
vpcId :: Prelude.Maybe Prelude.Text,
    -- | The subnets that are in the subnet group.
    ReplicationSubnetGroup -> Maybe [Subnet]
subnets :: Prelude.Maybe [Subnet],
    -- | The identifier of the replication instance subnet group.
    ReplicationSubnetGroup -> Maybe Text
replicationSubnetGroupIdentifier :: Prelude.Maybe Prelude.Text,
    -- | The status of the subnet group.
    ReplicationSubnetGroup -> Maybe Text
subnetGroupStatus :: Prelude.Maybe Prelude.Text,
    -- | A description for the replication subnet group.
    ReplicationSubnetGroup -> Maybe Text
replicationSubnetGroupDescription :: Prelude.Maybe Prelude.Text
  }
  deriving (ReplicationSubnetGroup -> ReplicationSubnetGroup -> Bool
(ReplicationSubnetGroup -> ReplicationSubnetGroup -> Bool)
-> (ReplicationSubnetGroup -> ReplicationSubnetGroup -> Bool)
-> Eq ReplicationSubnetGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicationSubnetGroup -> ReplicationSubnetGroup -> Bool
$c/= :: ReplicationSubnetGroup -> ReplicationSubnetGroup -> Bool
== :: ReplicationSubnetGroup -> ReplicationSubnetGroup -> Bool
$c== :: ReplicationSubnetGroup -> ReplicationSubnetGroup -> Bool
Prelude.Eq, ReadPrec [ReplicationSubnetGroup]
ReadPrec ReplicationSubnetGroup
Int -> ReadS ReplicationSubnetGroup
ReadS [ReplicationSubnetGroup]
(Int -> ReadS ReplicationSubnetGroup)
-> ReadS [ReplicationSubnetGroup]
-> ReadPrec ReplicationSubnetGroup
-> ReadPrec [ReplicationSubnetGroup]
-> Read ReplicationSubnetGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicationSubnetGroup]
$creadListPrec :: ReadPrec [ReplicationSubnetGroup]
readPrec :: ReadPrec ReplicationSubnetGroup
$creadPrec :: ReadPrec ReplicationSubnetGroup
readList :: ReadS [ReplicationSubnetGroup]
$creadList :: ReadS [ReplicationSubnetGroup]
readsPrec :: Int -> ReadS ReplicationSubnetGroup
$creadsPrec :: Int -> ReadS ReplicationSubnetGroup
Prelude.Read, Int -> ReplicationSubnetGroup -> ShowS
[ReplicationSubnetGroup] -> ShowS
ReplicationSubnetGroup -> String
(Int -> ReplicationSubnetGroup -> ShowS)
-> (ReplicationSubnetGroup -> String)
-> ([ReplicationSubnetGroup] -> ShowS)
-> Show ReplicationSubnetGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicationSubnetGroup] -> ShowS
$cshowList :: [ReplicationSubnetGroup] -> ShowS
show :: ReplicationSubnetGroup -> String
$cshow :: ReplicationSubnetGroup -> String
showsPrec :: Int -> ReplicationSubnetGroup -> ShowS
$cshowsPrec :: Int -> ReplicationSubnetGroup -> ShowS
Prelude.Show, (forall x. ReplicationSubnetGroup -> Rep ReplicationSubnetGroup x)
-> (forall x.
    Rep ReplicationSubnetGroup x -> ReplicationSubnetGroup)
-> Generic ReplicationSubnetGroup
forall x. Rep ReplicationSubnetGroup x -> ReplicationSubnetGroup
forall x. ReplicationSubnetGroup -> Rep ReplicationSubnetGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReplicationSubnetGroup x -> ReplicationSubnetGroup
$cfrom :: forall x. ReplicationSubnetGroup -> Rep ReplicationSubnetGroup x
Prelude.Generic)

-- |
-- Create a value of 'ReplicationSubnetGroup' 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:
--
-- 'vpcId', 'replicationSubnetGroup_vpcId' - The ID of the VPC.
--
-- 'subnets', 'replicationSubnetGroup_subnets' - The subnets that are in the subnet group.
--
-- 'replicationSubnetGroupIdentifier', 'replicationSubnetGroup_replicationSubnetGroupIdentifier' - The identifier of the replication instance subnet group.
--
-- 'subnetGroupStatus', 'replicationSubnetGroup_subnetGroupStatus' - The status of the subnet group.
--
-- 'replicationSubnetGroupDescription', 'replicationSubnetGroup_replicationSubnetGroupDescription' - A description for the replication subnet group.
newReplicationSubnetGroup ::
  ReplicationSubnetGroup
newReplicationSubnetGroup :: ReplicationSubnetGroup
newReplicationSubnetGroup =
  ReplicationSubnetGroup' :: Maybe Text
-> Maybe [Subnet]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ReplicationSubnetGroup
ReplicationSubnetGroup'
    { $sel:vpcId:ReplicationSubnetGroup' :: Maybe Text
vpcId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subnets:ReplicationSubnetGroup' :: Maybe [Subnet]
subnets = Maybe [Subnet]
forall a. Maybe a
Prelude.Nothing,
      $sel:replicationSubnetGroupIdentifier:ReplicationSubnetGroup' :: Maybe Text
replicationSubnetGroupIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetGroupStatus:ReplicationSubnetGroup' :: Maybe Text
subnetGroupStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:replicationSubnetGroupDescription:ReplicationSubnetGroup' :: Maybe Text
replicationSubnetGroupDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the VPC.
replicationSubnetGroup_vpcId :: Lens.Lens' ReplicationSubnetGroup (Prelude.Maybe Prelude.Text)
replicationSubnetGroup_vpcId :: (Maybe Text -> f (Maybe Text))
-> ReplicationSubnetGroup -> f ReplicationSubnetGroup
replicationSubnetGroup_vpcId = (ReplicationSubnetGroup -> Maybe Text)
-> (ReplicationSubnetGroup -> Maybe Text -> ReplicationSubnetGroup)
-> Lens
     ReplicationSubnetGroup
     ReplicationSubnetGroup
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationSubnetGroup' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:ReplicationSubnetGroup' :: ReplicationSubnetGroup -> Maybe Text
vpcId} -> Maybe Text
vpcId) (\s :: ReplicationSubnetGroup
s@ReplicationSubnetGroup' {} Maybe Text
a -> ReplicationSubnetGroup
s {$sel:vpcId:ReplicationSubnetGroup' :: Maybe Text
vpcId = Maybe Text
a} :: ReplicationSubnetGroup)

-- | The subnets that are in the subnet group.
replicationSubnetGroup_subnets :: Lens.Lens' ReplicationSubnetGroup (Prelude.Maybe [Subnet])
replicationSubnetGroup_subnets :: (Maybe [Subnet] -> f (Maybe [Subnet]))
-> ReplicationSubnetGroup -> f ReplicationSubnetGroup
replicationSubnetGroup_subnets = (ReplicationSubnetGroup -> Maybe [Subnet])
-> (ReplicationSubnetGroup
    -> Maybe [Subnet] -> ReplicationSubnetGroup)
-> Lens
     ReplicationSubnetGroup
     ReplicationSubnetGroup
     (Maybe [Subnet])
     (Maybe [Subnet])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationSubnetGroup' {Maybe [Subnet]
subnets :: Maybe [Subnet]
$sel:subnets:ReplicationSubnetGroup' :: ReplicationSubnetGroup -> Maybe [Subnet]
subnets} -> Maybe [Subnet]
subnets) (\s :: ReplicationSubnetGroup
s@ReplicationSubnetGroup' {} Maybe [Subnet]
a -> ReplicationSubnetGroup
s {$sel:subnets:ReplicationSubnetGroup' :: Maybe [Subnet]
subnets = Maybe [Subnet]
a} :: ReplicationSubnetGroup) ((Maybe [Subnet] -> f (Maybe [Subnet]))
 -> ReplicationSubnetGroup -> f ReplicationSubnetGroup)
-> ((Maybe [Subnet] -> f (Maybe [Subnet]))
    -> Maybe [Subnet] -> f (Maybe [Subnet]))
-> (Maybe [Subnet] -> f (Maybe [Subnet]))
-> ReplicationSubnetGroup
-> f ReplicationSubnetGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Subnet] [Subnet] [Subnet] [Subnet]
-> Iso
     (Maybe [Subnet]) (Maybe [Subnet]) (Maybe [Subnet]) (Maybe [Subnet])
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 [Subnet] [Subnet] [Subnet] [Subnet]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier of the replication instance subnet group.
replicationSubnetGroup_replicationSubnetGroupIdentifier :: Lens.Lens' ReplicationSubnetGroup (Prelude.Maybe Prelude.Text)
replicationSubnetGroup_replicationSubnetGroupIdentifier :: (Maybe Text -> f (Maybe Text))
-> ReplicationSubnetGroup -> f ReplicationSubnetGroup
replicationSubnetGroup_replicationSubnetGroupIdentifier = (ReplicationSubnetGroup -> Maybe Text)
-> (ReplicationSubnetGroup -> Maybe Text -> ReplicationSubnetGroup)
-> Lens
     ReplicationSubnetGroup
     ReplicationSubnetGroup
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationSubnetGroup' {Maybe Text
replicationSubnetGroupIdentifier :: Maybe Text
$sel:replicationSubnetGroupIdentifier:ReplicationSubnetGroup' :: ReplicationSubnetGroup -> Maybe Text
replicationSubnetGroupIdentifier} -> Maybe Text
replicationSubnetGroupIdentifier) (\s :: ReplicationSubnetGroup
s@ReplicationSubnetGroup' {} Maybe Text
a -> ReplicationSubnetGroup
s {$sel:replicationSubnetGroupIdentifier:ReplicationSubnetGroup' :: Maybe Text
replicationSubnetGroupIdentifier = Maybe Text
a} :: ReplicationSubnetGroup)

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

-- | A description for the replication subnet group.
replicationSubnetGroup_replicationSubnetGroupDescription :: Lens.Lens' ReplicationSubnetGroup (Prelude.Maybe Prelude.Text)
replicationSubnetGroup_replicationSubnetGroupDescription :: (Maybe Text -> f (Maybe Text))
-> ReplicationSubnetGroup -> f ReplicationSubnetGroup
replicationSubnetGroup_replicationSubnetGroupDescription = (ReplicationSubnetGroup -> Maybe Text)
-> (ReplicationSubnetGroup -> Maybe Text -> ReplicationSubnetGroup)
-> Lens
     ReplicationSubnetGroup
     ReplicationSubnetGroup
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicationSubnetGroup' {Maybe Text
replicationSubnetGroupDescription :: Maybe Text
$sel:replicationSubnetGroupDescription:ReplicationSubnetGroup' :: ReplicationSubnetGroup -> Maybe Text
replicationSubnetGroupDescription} -> Maybe Text
replicationSubnetGroupDescription) (\s :: ReplicationSubnetGroup
s@ReplicationSubnetGroup' {} Maybe Text
a -> ReplicationSubnetGroup
s {$sel:replicationSubnetGroupDescription:ReplicationSubnetGroup' :: Maybe Text
replicationSubnetGroupDescription = Maybe Text
a} :: ReplicationSubnetGroup)

instance Core.FromJSON ReplicationSubnetGroup where
  parseJSON :: Value -> Parser ReplicationSubnetGroup
parseJSON =
    String
-> (Object -> Parser ReplicationSubnetGroup)
-> Value
-> Parser ReplicationSubnetGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReplicationSubnetGroup"
      ( \Object
x ->
          Maybe Text
-> Maybe [Subnet]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ReplicationSubnetGroup
ReplicationSubnetGroup'
            (Maybe Text
 -> Maybe [Subnet]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ReplicationSubnetGroup)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Subnet]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ReplicationSubnetGroup)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VpcId")
            Parser
  (Maybe [Subnet]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ReplicationSubnetGroup)
-> Parser (Maybe [Subnet])
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> ReplicationSubnetGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Subnet]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Subnets" Parser (Maybe (Maybe [Subnet]))
-> Maybe [Subnet] -> Parser (Maybe [Subnet])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Subnet]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> ReplicationSubnetGroup)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ReplicationSubnetGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReplicationSubnetGroupIdentifier")
            Parser (Maybe Text -> Maybe Text -> ReplicationSubnetGroup)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ReplicationSubnetGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubnetGroupStatus")
            Parser (Maybe Text -> ReplicationSubnetGroup)
-> Parser (Maybe Text) -> Parser ReplicationSubnetGroup
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReplicationSubnetGroupDescription")
      )

instance Prelude.Hashable ReplicationSubnetGroup

instance Prelude.NFData ReplicationSubnetGroup