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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DirectConnect.Types.GatewayType
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
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]
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
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. 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'
    { $sel:id:AssociatedGateway' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:ownerAccount:AssociatedGateway' :: Maybe Text
ownerAccount = forall a. Maybe a
Prelude.Nothing,
      $sel:region:AssociatedGateway' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing,
      $sel:type':AssociatedGateway' :: Maybe GatewayType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the associated gateway.
associatedGateway_id :: Lens.Lens' AssociatedGateway (Prelude.Maybe Prelude.Text)
associatedGateway_id :: Lens' AssociatedGateway (Maybe Text)
associatedGateway_id = 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 :: Lens' AssociatedGateway (Maybe Text)
associatedGateway_ownerAccount = 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 :: Lens' AssociatedGateway (Maybe Text)
associatedGateway_region = 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 :: Lens' AssociatedGateway (Maybe GatewayType)
associatedGateway_type = 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 Data.FromJSON AssociatedGateway where
  parseJSON :: Value -> Parser AssociatedGateway
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AssociatedGateway"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe GatewayType
-> AssociatedGateway
AssociatedGateway'
            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
"id")
            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
"ownerAccount")
            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
"region")
            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
"type")
      )

instance Prelude.Hashable AssociatedGateway where
  hashWithSalt :: Int -> AssociatedGateway -> Int
hashWithSalt Int
_salt AssociatedGateway' {Maybe Text
Maybe GatewayType
type' :: Maybe GatewayType
region :: Maybe Text
ownerAccount :: Maybe Text
id :: Maybe Text
$sel:type':AssociatedGateway' :: AssociatedGateway -> Maybe GatewayType
$sel:region:AssociatedGateway' :: AssociatedGateway -> Maybe Text
$sel:ownerAccount:AssociatedGateway' :: AssociatedGateway -> Maybe Text
$sel:id:AssociatedGateway' :: AssociatedGateway -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ownerAccount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GatewayType
type'

instance Prelude.NFData AssociatedGateway where
  rnf :: AssociatedGateway -> ()
rnf AssociatedGateway' {Maybe Text
Maybe GatewayType
type' :: Maybe GatewayType
region :: Maybe Text
ownerAccount :: Maybe Text
id :: Maybe Text
$sel:type':AssociatedGateway' :: AssociatedGateway -> Maybe GatewayType
$sel:region:AssociatedGateway' :: AssociatedGateway -> Maybe Text
$sel:ownerAccount:AssociatedGateway' :: AssociatedGateway -> Maybe Text
$sel:id:AssociatedGateway' :: AssociatedGateway -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ownerAccount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe GatewayType
type'