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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 IPv4 CIDR block.
    ExpectedRoute -> Maybe Text
ipV4Cidr :: Prelude.Maybe Prelude.Text,
    -- | Information about the route table ID.
    ExpectedRoute -> Maybe Text
routeTableId :: Prelude.Maybe Prelude.Text,
    -- | Information about the allowed targets.
    ExpectedRoute -> Maybe [Text]
allowedTargets :: 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 IPv6 CIDR block.
    ExpectedRoute -> Maybe Text
ipV6Cidr :: Prelude.Maybe Prelude.Text,
    -- | Information about the contributing subnets.
    ExpectedRoute -> Maybe [Text]
contributingSubnets :: Prelude.Maybe [Prelude.Text]
  }
  deriving (ExpectedRoute -> ExpectedRoute -> Bool
(ExpectedRoute -> ExpectedRoute -> Bool)
-> (ExpectedRoute -> ExpectedRoute -> Bool) -> Eq ExpectedRoute
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]
(Int -> ReadS ExpectedRoute)
-> ReadS [ExpectedRoute]
-> ReadPrec ExpectedRoute
-> ReadPrec [ExpectedRoute]
-> Read 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
(Int -> ExpectedRoute -> ShowS)
-> (ExpectedRoute -> String)
-> ([ExpectedRoute] -> ShowS)
-> Show ExpectedRoute
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. ExpectedRoute -> Rep ExpectedRoute x)
-> (forall x. Rep ExpectedRoute x -> ExpectedRoute)
-> Generic ExpectedRoute
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:
--
-- 'ipV4Cidr', 'expectedRoute_ipV4Cidr' - Information about the IPv4 CIDR block.
--
-- 'routeTableId', 'expectedRoute_routeTableId' - Information about the route table ID.
--
-- 'allowedTargets', 'expectedRoute_allowedTargets' - Information about the allowed targets.
--
-- 'prefixListId', 'expectedRoute_prefixListId' - Information about the ID of the prefix list for the route.
--
-- 'ipV6Cidr', 'expectedRoute_ipV6Cidr' - Information about the IPv6 CIDR block.
--
-- 'contributingSubnets', 'expectedRoute_contributingSubnets' - Information about the contributing subnets.
newExpectedRoute ::
  ExpectedRoute
newExpectedRoute :: ExpectedRoute
newExpectedRoute =
  ExpectedRoute' :: Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> ExpectedRoute
ExpectedRoute'
    { $sel:ipV4Cidr:ExpectedRoute' :: Maybe Text
ipV4Cidr = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:routeTableId:ExpectedRoute' :: Maybe Text
routeTableId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:allowedTargets:ExpectedRoute' :: Maybe [Text]
allowedTargets = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:prefixListId:ExpectedRoute' :: Maybe Text
prefixListId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ipV6Cidr:ExpectedRoute' :: Maybe Text
ipV6Cidr = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:contributingSubnets:ExpectedRoute' :: Maybe [Text]
contributingSubnets = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the IPv4 CIDR block.
expectedRoute_ipV4Cidr :: Lens.Lens' ExpectedRoute (Prelude.Maybe Prelude.Text)
expectedRoute_ipV4Cidr :: (Maybe Text -> f (Maybe Text)) -> ExpectedRoute -> f ExpectedRoute
expectedRoute_ipV4Cidr = (ExpectedRoute -> Maybe Text)
-> (ExpectedRoute -> Maybe Text -> ExpectedRoute)
-> Lens ExpectedRoute ExpectedRoute (Maybe Text) (Maybe Text)
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 route table ID.
expectedRoute_routeTableId :: Lens.Lens' ExpectedRoute (Prelude.Maybe Prelude.Text)
expectedRoute_routeTableId :: (Maybe Text -> f (Maybe Text)) -> ExpectedRoute -> f ExpectedRoute
expectedRoute_routeTableId = (ExpectedRoute -> Maybe Text)
-> (ExpectedRoute -> Maybe Text -> ExpectedRoute)
-> Lens ExpectedRoute ExpectedRoute (Maybe Text) (Maybe Text)
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)

-- | Information about the allowed targets.
expectedRoute_allowedTargets :: Lens.Lens' ExpectedRoute (Prelude.Maybe [Prelude.Text])
expectedRoute_allowedTargets :: (Maybe [Text] -> f (Maybe [Text]))
-> ExpectedRoute -> f ExpectedRoute
expectedRoute_allowedTargets = (ExpectedRoute -> Maybe [Text])
-> (ExpectedRoute -> Maybe [Text] -> ExpectedRoute)
-> Lens ExpectedRoute ExpectedRoute (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> ExpectedRoute -> f ExpectedRoute)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ExpectedRoute
-> f ExpectedRoute
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Information about the ID of the prefix list for the route.
expectedRoute_prefixListId :: Lens.Lens' ExpectedRoute (Prelude.Maybe Prelude.Text)
expectedRoute_prefixListId :: (Maybe Text -> f (Maybe Text)) -> ExpectedRoute -> f ExpectedRoute
expectedRoute_prefixListId = (ExpectedRoute -> Maybe Text)
-> (ExpectedRoute -> Maybe Text -> ExpectedRoute)
-> Lens ExpectedRoute ExpectedRoute (Maybe Text) (Maybe Text)
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 IPv6 CIDR block.
expectedRoute_ipV6Cidr :: Lens.Lens' ExpectedRoute (Prelude.Maybe Prelude.Text)
expectedRoute_ipV6Cidr :: (Maybe Text -> f (Maybe Text)) -> ExpectedRoute -> f ExpectedRoute
expectedRoute_ipV6Cidr = (ExpectedRoute -> Maybe Text)
-> (ExpectedRoute -> Maybe Text -> ExpectedRoute)
-> Lens ExpectedRoute ExpectedRoute (Maybe Text) (Maybe Text)
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 contributing subnets.
expectedRoute_contributingSubnets :: Lens.Lens' ExpectedRoute (Prelude.Maybe [Prelude.Text])
expectedRoute_contributingSubnets :: (Maybe [Text] -> f (Maybe [Text]))
-> ExpectedRoute -> f ExpectedRoute
expectedRoute_contributingSubnets = (ExpectedRoute -> Maybe [Text])
-> (ExpectedRoute -> Maybe [Text] -> ExpectedRoute)
-> Lens ExpectedRoute ExpectedRoute (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> ExpectedRoute -> f ExpectedRoute)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ExpectedRoute
-> f ExpectedRoute
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable ExpectedRoute

instance Prelude.NFData ExpectedRoute