{-# 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.DirectConnect.Types.AssociatedGateway
-- 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.DirectConnect.Types.AssociatedGateway where

import qualified Amazonka.Core as Core
import Amazonka.DirectConnect.Types.GatewayType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the associated gateway.
--
-- /See:/ 'newAssociatedGateway' smart constructor.
data AssociatedGateway = AssociatedGateway'
  { -- | The ID of the associated gateway.
    AssociatedGateway -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Amazon Web Services account that owns the associated
    -- virtual private gateway or transit gateway.
    AssociatedGateway -> Maybe Text
ownerAccount :: Prelude.Maybe Prelude.Text,
    -- | The Region where the associated gateway is located.
    AssociatedGateway -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
    -- | The type of associated gateway.
    AssociatedGateway -> Maybe GatewayType
type' :: Prelude.Maybe GatewayType
  }
  deriving (AssociatedGateway -> AssociatedGateway -> Bool
(AssociatedGateway -> AssociatedGateway -> Bool)
-> (AssociatedGateway -> AssociatedGateway -> Bool)
-> Eq AssociatedGateway
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociatedGateway -> AssociatedGateway -> Bool
$c/= :: AssociatedGateway -> AssociatedGateway -> Bool
== :: AssociatedGateway -> AssociatedGateway -> Bool
$c== :: AssociatedGateway -> AssociatedGateway -> Bool
Prelude.Eq, ReadPrec [AssociatedGateway]
ReadPrec AssociatedGateway
Int -> ReadS AssociatedGateway
ReadS [AssociatedGateway]
(Int -> ReadS AssociatedGateway)
-> ReadS [AssociatedGateway]
-> ReadPrec AssociatedGateway
-> ReadPrec [AssociatedGateway]
-> Read AssociatedGateway
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociatedGateway]
$creadListPrec :: ReadPrec [AssociatedGateway]
readPrec :: ReadPrec AssociatedGateway
$creadPrec :: ReadPrec AssociatedGateway
readList :: ReadS [AssociatedGateway]
$creadList :: ReadS [AssociatedGateway]
readsPrec :: Int -> ReadS AssociatedGateway
$creadsPrec :: Int -> ReadS AssociatedGateway
Prelude.Read, Int -> AssociatedGateway -> ShowS
[AssociatedGateway] -> ShowS
AssociatedGateway -> String
(Int -> AssociatedGateway -> ShowS)
-> (AssociatedGateway -> String)
-> ([AssociatedGateway] -> ShowS)
-> Show AssociatedGateway
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociatedGateway] -> ShowS
$cshowList :: [AssociatedGateway] -> ShowS
show :: AssociatedGateway -> String
$cshow :: AssociatedGateway -> String
showsPrec :: Int -> AssociatedGateway -> ShowS
$cshowsPrec :: Int -> AssociatedGateway -> ShowS
Prelude.Show, (forall x. AssociatedGateway -> Rep AssociatedGateway x)
-> (forall x. Rep AssociatedGateway x -> AssociatedGateway)
-> Generic AssociatedGateway
forall x. Rep AssociatedGateway x -> AssociatedGateway
forall x. AssociatedGateway -> Rep AssociatedGateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociatedGateway x -> AssociatedGateway
$cfrom :: forall x. AssociatedGateway -> Rep AssociatedGateway x
Prelude.Generic)

-- |
-- Create a value of 'AssociatedGateway' 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:
--
-- 'id', 'associatedGateway_id' - The ID of the associated gateway.
--
-- 'ownerAccount', 'associatedGateway_ownerAccount' - The ID of the Amazon Web Services account that owns the associated
-- virtual private gateway or transit gateway.
--
-- 'region', 'associatedGateway_region' - The Region where the associated gateway is located.
--
-- 'type'', 'associatedGateway_type' - The type of associated gateway.
newAssociatedGateway ::
  AssociatedGateway
newAssociatedGateway :: AssociatedGateway
newAssociatedGateway =
  AssociatedGateway' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe GatewayType
-> AssociatedGateway
AssociatedGateway'
    { $sel:id:AssociatedGateway' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ownerAccount:AssociatedGateway' :: Maybe Text
ownerAccount = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:region:AssociatedGateway' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':AssociatedGateway' :: Maybe GatewayType
type' = Maybe GatewayType
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the associated gateway.
associatedGateway_id :: Lens.Lens' AssociatedGateway (Prelude.Maybe Prelude.Text)
associatedGateway_id :: (Maybe Text -> f (Maybe Text))
-> AssociatedGateway -> f AssociatedGateway
associatedGateway_id = (AssociatedGateway -> Maybe Text)
-> (AssociatedGateway -> Maybe Text -> AssociatedGateway)
-> Lens
     AssociatedGateway AssociatedGateway (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociatedGateway' {Maybe Text
id :: Maybe Text
$sel:id:AssociatedGateway' :: AssociatedGateway -> Maybe Text
id} -> Maybe Text
id) (\s :: AssociatedGateway
s@AssociatedGateway' {} Maybe Text
a -> AssociatedGateway
s {$sel:id:AssociatedGateway' :: Maybe Text
id = Maybe Text
a} :: AssociatedGateway)

-- | The ID of the Amazon Web Services account that owns the associated
-- virtual private gateway or transit gateway.
associatedGateway_ownerAccount :: Lens.Lens' AssociatedGateway (Prelude.Maybe Prelude.Text)
associatedGateway_ownerAccount :: (Maybe Text -> f (Maybe Text))
-> AssociatedGateway -> f AssociatedGateway
associatedGateway_ownerAccount = (AssociatedGateway -> Maybe Text)
-> (AssociatedGateway -> Maybe Text -> AssociatedGateway)
-> Lens
     AssociatedGateway AssociatedGateway (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociatedGateway' {Maybe Text
ownerAccount :: Maybe Text
$sel:ownerAccount:AssociatedGateway' :: AssociatedGateway -> Maybe Text
ownerAccount} -> Maybe Text
ownerAccount) (\s :: AssociatedGateway
s@AssociatedGateway' {} Maybe Text
a -> AssociatedGateway
s {$sel:ownerAccount:AssociatedGateway' :: Maybe Text
ownerAccount = Maybe Text
a} :: AssociatedGateway)

-- | The Region where the associated gateway is located.
associatedGateway_region :: Lens.Lens' AssociatedGateway (Prelude.Maybe Prelude.Text)
associatedGateway_region :: (Maybe Text -> f (Maybe Text))
-> AssociatedGateway -> f AssociatedGateway
associatedGateway_region = (AssociatedGateway -> Maybe Text)
-> (AssociatedGateway -> Maybe Text -> AssociatedGateway)
-> Lens
     AssociatedGateway AssociatedGateway (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociatedGateway' {Maybe Text
region :: Maybe Text
$sel:region:AssociatedGateway' :: AssociatedGateway -> Maybe Text
region} -> Maybe Text
region) (\s :: AssociatedGateway
s@AssociatedGateway' {} Maybe Text
a -> AssociatedGateway
s {$sel:region:AssociatedGateway' :: Maybe Text
region = Maybe Text
a} :: AssociatedGateway)

-- | The type of associated gateway.
associatedGateway_type :: Lens.Lens' AssociatedGateway (Prelude.Maybe GatewayType)
associatedGateway_type :: (Maybe GatewayType -> f (Maybe GatewayType))
-> AssociatedGateway -> f AssociatedGateway
associatedGateway_type = (AssociatedGateway -> Maybe GatewayType)
-> (AssociatedGateway -> Maybe GatewayType -> AssociatedGateway)
-> Lens
     AssociatedGateway
     AssociatedGateway
     (Maybe GatewayType)
     (Maybe GatewayType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociatedGateway' {Maybe GatewayType
type' :: Maybe GatewayType
$sel:type':AssociatedGateway' :: AssociatedGateway -> Maybe GatewayType
type'} -> Maybe GatewayType
type') (\s :: AssociatedGateway
s@AssociatedGateway' {} Maybe GatewayType
a -> AssociatedGateway
s {$sel:type':AssociatedGateway' :: Maybe GatewayType
type' = Maybe GatewayType
a} :: AssociatedGateway)

instance Core.FromJSON AssociatedGateway where
  parseJSON :: Value -> Parser AssociatedGateway
parseJSON =
    String
-> (Object -> Parser AssociatedGateway)
-> Value
-> Parser AssociatedGateway
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AssociatedGateway"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe GatewayType
-> AssociatedGateway
AssociatedGateway'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe GatewayType
 -> AssociatedGateway)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe GatewayType -> AssociatedGateway)
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
"id")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe GatewayType -> AssociatedGateway)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe GatewayType -> AssociatedGateway)
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
"ownerAccount")
            Parser (Maybe Text -> Maybe GatewayType -> AssociatedGateway)
-> Parser (Maybe Text)
-> Parser (Maybe GatewayType -> AssociatedGateway)
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
"region")
            Parser (Maybe GatewayType -> AssociatedGateway)
-> Parser (Maybe GatewayType) -> Parser AssociatedGateway
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe GatewayType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
      )

instance Prelude.Hashable AssociatedGateway

instance Prelude.NFData AssociatedGateway