{-# 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.FMS.Types.ExpectedRoute
-- 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.FMS.Types.ExpectedRoute where

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

-- | Information about the expected route in the route table.
--
-- /See:/ 'newExpectedRoute' smart constructor.
data ExpectedRoute = ExpectedRoute'
  { -- | Information about the allowed targets.
    ExpectedRoute -> Maybe [Text]
allowedTargets :: Prelude.Maybe [Prelude.Text],
    -- | Information about the contributing subnets.
    ExpectedRoute -> Maybe [Text]
contributingSubnets :: Prelude.Maybe [Prelude.Text],
    -- | Information about the IPv4 CIDR block.
    ExpectedRoute -> Maybe Text
ipV4Cidr :: Prelude.Maybe Prelude.Text,
    -- | Information about the IPv6 CIDR block.
    ExpectedRoute -> Maybe Text
ipV6Cidr :: Prelude.Maybe Prelude.Text,
    -- | Information about the ID of the prefix list for the route.
    ExpectedRoute -> Maybe Text
prefixListId :: Prelude.Maybe Prelude.Text,
    -- | Information about the route table ID.
    ExpectedRoute -> Maybe Text
routeTableId :: Prelude.Maybe Prelude.Text
  }
  deriving (ExpectedRoute -> ExpectedRoute -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExpectedRoute -> ExpectedRoute -> Bool
$c/= :: ExpectedRoute -> ExpectedRoute -> Bool
== :: ExpectedRoute -> ExpectedRoute -> Bool
$c== :: ExpectedRoute -> ExpectedRoute -> Bool
Prelude.Eq, ReadPrec [ExpectedRoute]
ReadPrec ExpectedRoute
Int -> ReadS ExpectedRoute
ReadS [ExpectedRoute]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExpectedRoute]
$creadListPrec :: ReadPrec [ExpectedRoute]
readPrec :: ReadPrec ExpectedRoute
$creadPrec :: ReadPrec ExpectedRoute
readList :: ReadS [ExpectedRoute]
$creadList :: ReadS [ExpectedRoute]
readsPrec :: Int -> ReadS ExpectedRoute
$creadsPrec :: Int -> ReadS ExpectedRoute
Prelude.Read, Int -> ExpectedRoute -> ShowS
[ExpectedRoute] -> ShowS
ExpectedRoute -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExpectedRoute] -> ShowS
$cshowList :: [ExpectedRoute] -> ShowS
show :: ExpectedRoute -> String
$cshow :: ExpectedRoute -> String
showsPrec :: Int -> ExpectedRoute -> ShowS
$cshowsPrec :: Int -> ExpectedRoute -> ShowS
Prelude.Show, forall x. Rep ExpectedRoute x -> ExpectedRoute
forall x. ExpectedRoute -> Rep ExpectedRoute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExpectedRoute x -> ExpectedRoute
$cfrom :: forall x. ExpectedRoute -> Rep ExpectedRoute x
Prelude.Generic)

-- |
-- Create a value of 'ExpectedRoute' 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:
--
-- 'allowedTargets', 'expectedRoute_allowedTargets' - Information about the allowed targets.
--
-- 'contributingSubnets', 'expectedRoute_contributingSubnets' - Information about the contributing subnets.
--
-- 'ipV4Cidr', 'expectedRoute_ipV4Cidr' - Information about the IPv4 CIDR block.
--
-- 'ipV6Cidr', 'expectedRoute_ipV6Cidr' - Information about the IPv6 CIDR block.
--
-- 'prefixListId', 'expectedRoute_prefixListId' - Information about the ID of the prefix list for the route.
--
-- 'routeTableId', 'expectedRoute_routeTableId' - Information about the route table ID.
newExpectedRoute ::
  ExpectedRoute
newExpectedRoute :: ExpectedRoute
newExpectedRoute =
  ExpectedRoute'
    { $sel:allowedTargets:ExpectedRoute' :: Maybe [Text]
allowedTargets = forall a. Maybe a
Prelude.Nothing,
      $sel:contributingSubnets:ExpectedRoute' :: Maybe [Text]
contributingSubnets = forall a. Maybe a
Prelude.Nothing,
      $sel:ipV4Cidr:ExpectedRoute' :: Maybe Text
ipV4Cidr = forall a. Maybe a
Prelude.Nothing,
      $sel:ipV6Cidr:ExpectedRoute' :: Maybe Text
ipV6Cidr = forall a. Maybe a
Prelude.Nothing,
      $sel:prefixListId:ExpectedRoute' :: Maybe Text
prefixListId = forall a. Maybe a
Prelude.Nothing,
      $sel:routeTableId:ExpectedRoute' :: Maybe Text
routeTableId = forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the allowed targets.
expectedRoute_allowedTargets :: Lens.Lens' ExpectedRoute (Prelude.Maybe [Prelude.Text])
expectedRoute_allowedTargets :: Lens' ExpectedRoute (Maybe [Text])
expectedRoute_allowedTargets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpectedRoute' {Maybe [Text]
allowedTargets :: Maybe [Text]
$sel:allowedTargets:ExpectedRoute' :: ExpectedRoute -> Maybe [Text]
allowedTargets} -> Maybe [Text]
allowedTargets) (\s :: ExpectedRoute
s@ExpectedRoute' {} Maybe [Text]
a -> ExpectedRoute
s {$sel:allowedTargets:ExpectedRoute' :: Maybe [Text]
allowedTargets = Maybe [Text]
a} :: ExpectedRoute) 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

-- | Information about the contributing subnets.
expectedRoute_contributingSubnets :: Lens.Lens' ExpectedRoute (Prelude.Maybe [Prelude.Text])
expectedRoute_contributingSubnets :: Lens' ExpectedRoute (Maybe [Text])
expectedRoute_contributingSubnets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpectedRoute' {Maybe [Text]
contributingSubnets :: Maybe [Text]
$sel:contributingSubnets:ExpectedRoute' :: ExpectedRoute -> Maybe [Text]
contributingSubnets} -> Maybe [Text]
contributingSubnets) (\s :: ExpectedRoute
s@ExpectedRoute' {} Maybe [Text]
a -> ExpectedRoute
s {$sel:contributingSubnets:ExpectedRoute' :: Maybe [Text]
contributingSubnets = Maybe [Text]
a} :: ExpectedRoute) 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

-- | Information about the IPv4 CIDR block.
expectedRoute_ipV4Cidr :: Lens.Lens' ExpectedRoute (Prelude.Maybe Prelude.Text)
expectedRoute_ipV4Cidr :: Lens' ExpectedRoute (Maybe Text)
expectedRoute_ipV4Cidr = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpectedRoute' {Maybe Text
ipV4Cidr :: Maybe Text
$sel:ipV4Cidr:ExpectedRoute' :: ExpectedRoute -> Maybe Text
ipV4Cidr} -> Maybe Text
ipV4Cidr) (\s :: ExpectedRoute
s@ExpectedRoute' {} Maybe Text
a -> ExpectedRoute
s {$sel:ipV4Cidr:ExpectedRoute' :: Maybe Text
ipV4Cidr = Maybe Text
a} :: ExpectedRoute)

-- | Information about the IPv6 CIDR block.
expectedRoute_ipV6Cidr :: Lens.Lens' ExpectedRoute (Prelude.Maybe Prelude.Text)
expectedRoute_ipV6Cidr :: Lens' ExpectedRoute (Maybe Text)
expectedRoute_ipV6Cidr = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpectedRoute' {Maybe Text
ipV6Cidr :: Maybe Text
$sel:ipV6Cidr:ExpectedRoute' :: ExpectedRoute -> Maybe Text
ipV6Cidr} -> Maybe Text
ipV6Cidr) (\s :: ExpectedRoute
s@ExpectedRoute' {} Maybe Text
a -> ExpectedRoute
s {$sel:ipV6Cidr:ExpectedRoute' :: Maybe Text
ipV6Cidr = Maybe Text
a} :: ExpectedRoute)

-- | Information about the ID of the prefix list for the route.
expectedRoute_prefixListId :: Lens.Lens' ExpectedRoute (Prelude.Maybe Prelude.Text)
expectedRoute_prefixListId :: Lens' ExpectedRoute (Maybe Text)
expectedRoute_prefixListId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpectedRoute' {Maybe Text
prefixListId :: Maybe Text
$sel:prefixListId:ExpectedRoute' :: ExpectedRoute -> Maybe Text
prefixListId} -> Maybe Text
prefixListId) (\s :: ExpectedRoute
s@ExpectedRoute' {} Maybe Text
a -> ExpectedRoute
s {$sel:prefixListId:ExpectedRoute' :: Maybe Text
prefixListId = Maybe Text
a} :: ExpectedRoute)

-- | Information about the route table ID.
expectedRoute_routeTableId :: Lens.Lens' ExpectedRoute (Prelude.Maybe Prelude.Text)
expectedRoute_routeTableId :: Lens' ExpectedRoute (Maybe Text)
expectedRoute_routeTableId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpectedRoute' {Maybe Text
routeTableId :: Maybe Text
$sel:routeTableId:ExpectedRoute' :: ExpectedRoute -> Maybe Text
routeTableId} -> Maybe Text
routeTableId) (\s :: ExpectedRoute
s@ExpectedRoute' {} Maybe Text
a -> ExpectedRoute
s {$sel:routeTableId:ExpectedRoute' :: Maybe Text
routeTableId = Maybe Text
a} :: ExpectedRoute)

instance Data.FromJSON ExpectedRoute where
  parseJSON :: Value -> Parser ExpectedRoute
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ExpectedRoute"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ExpectedRoute
ExpectedRoute'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AllowedTargets" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ContributingSubnets"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IpV4Cidr")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IpV6Cidr")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PrefixListId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RouteTableId")
      )

instance Prelude.Hashable ExpectedRoute where
  hashWithSalt :: Int -> ExpectedRoute -> Int
hashWithSalt Int
_salt ExpectedRoute' {Maybe [Text]
Maybe Text
routeTableId :: Maybe Text
prefixListId :: Maybe Text
ipV6Cidr :: Maybe Text
ipV4Cidr :: Maybe Text
contributingSubnets :: Maybe [Text]
allowedTargets :: Maybe [Text]
$sel:routeTableId:ExpectedRoute' :: ExpectedRoute -> Maybe Text
$sel:prefixListId:ExpectedRoute' :: ExpectedRoute -> Maybe Text
$sel:ipV6Cidr:ExpectedRoute' :: ExpectedRoute -> Maybe Text
$sel:ipV4Cidr:ExpectedRoute' :: ExpectedRoute -> Maybe Text
$sel:contributingSubnets:ExpectedRoute' :: ExpectedRoute -> Maybe [Text]
$sel:allowedTargets:ExpectedRoute' :: ExpectedRoute -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
allowedTargets
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
contributingSubnets
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ipV4Cidr
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ipV6Cidr
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
prefixListId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
routeTableId

instance Prelude.NFData ExpectedRoute where
  rnf :: ExpectedRoute -> ()
rnf ExpectedRoute' {Maybe [Text]
Maybe Text
routeTableId :: Maybe Text
prefixListId :: Maybe Text
ipV6Cidr :: Maybe Text
ipV4Cidr :: Maybe Text
contributingSubnets :: Maybe [Text]
allowedTargets :: Maybe [Text]
$sel:routeTableId:ExpectedRoute' :: ExpectedRoute -> Maybe Text
$sel:prefixListId:ExpectedRoute' :: ExpectedRoute -> Maybe Text
$sel:ipV6Cidr:ExpectedRoute' :: ExpectedRoute -> Maybe Text
$sel:ipV4Cidr:ExpectedRoute' :: ExpectedRoute -> Maybe Text
$sel:contributingSubnets:ExpectedRoute' :: ExpectedRoute -> Maybe [Text]
$sel:allowedTargets:ExpectedRoute' :: ExpectedRoute -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
allowedTargets
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
contributingSubnets
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ipV4Cidr
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ipV6Cidr
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
prefixListId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
routeTableId