{-# 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.EC2.Types.EgressOnlyInternetGateway
-- 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.EC2.Types.EgressOnlyInternetGateway where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.InternetGatewayAttachment
import Amazonka.EC2.Types.Tag
import qualified Amazonka.Prelude as Prelude

-- | Describes an egress-only internet gateway.
--
-- /See:/ 'newEgressOnlyInternetGateway' smart constructor.
data EgressOnlyInternetGateway = EgressOnlyInternetGateway'
  { -- | Information about the attachment of the egress-only internet gateway.
    EgressOnlyInternetGateway -> Maybe [InternetGatewayAttachment]
attachments :: Prelude.Maybe [InternetGatewayAttachment],
    -- | The ID of the egress-only internet gateway.
    EgressOnlyInternetGateway -> Maybe Text
egressOnlyInternetGatewayId :: Prelude.Maybe Prelude.Text,
    -- | The tags assigned to the egress-only internet gateway.
    EgressOnlyInternetGateway -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (EgressOnlyInternetGateway -> EgressOnlyInternetGateway -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EgressOnlyInternetGateway -> EgressOnlyInternetGateway -> Bool
$c/= :: EgressOnlyInternetGateway -> EgressOnlyInternetGateway -> Bool
== :: EgressOnlyInternetGateway -> EgressOnlyInternetGateway -> Bool
$c== :: EgressOnlyInternetGateway -> EgressOnlyInternetGateway -> Bool
Prelude.Eq, ReadPrec [EgressOnlyInternetGateway]
ReadPrec EgressOnlyInternetGateway
Int -> ReadS EgressOnlyInternetGateway
ReadS [EgressOnlyInternetGateway]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EgressOnlyInternetGateway]
$creadListPrec :: ReadPrec [EgressOnlyInternetGateway]
readPrec :: ReadPrec EgressOnlyInternetGateway
$creadPrec :: ReadPrec EgressOnlyInternetGateway
readList :: ReadS [EgressOnlyInternetGateway]
$creadList :: ReadS [EgressOnlyInternetGateway]
readsPrec :: Int -> ReadS EgressOnlyInternetGateway
$creadsPrec :: Int -> ReadS EgressOnlyInternetGateway
Prelude.Read, Int -> EgressOnlyInternetGateway -> ShowS
[EgressOnlyInternetGateway] -> ShowS
EgressOnlyInternetGateway -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EgressOnlyInternetGateway] -> ShowS
$cshowList :: [EgressOnlyInternetGateway] -> ShowS
show :: EgressOnlyInternetGateway -> String
$cshow :: EgressOnlyInternetGateway -> String
showsPrec :: Int -> EgressOnlyInternetGateway -> ShowS
$cshowsPrec :: Int -> EgressOnlyInternetGateway -> ShowS
Prelude.Show, forall x.
Rep EgressOnlyInternetGateway x -> EgressOnlyInternetGateway
forall x.
EgressOnlyInternetGateway -> Rep EgressOnlyInternetGateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EgressOnlyInternetGateway x -> EgressOnlyInternetGateway
$cfrom :: forall x.
EgressOnlyInternetGateway -> Rep EgressOnlyInternetGateway x
Prelude.Generic)

-- |
-- Create a value of 'EgressOnlyInternetGateway' 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:
--
-- 'attachments', 'egressOnlyInternetGateway_attachments' - Information about the attachment of the egress-only internet gateway.
--
-- 'egressOnlyInternetGatewayId', 'egressOnlyInternetGateway_egressOnlyInternetGatewayId' - The ID of the egress-only internet gateway.
--
-- 'tags', 'egressOnlyInternetGateway_tags' - The tags assigned to the egress-only internet gateway.
newEgressOnlyInternetGateway ::
  EgressOnlyInternetGateway
newEgressOnlyInternetGateway :: EgressOnlyInternetGateway
newEgressOnlyInternetGateway =
  EgressOnlyInternetGateway'
    { $sel:attachments:EgressOnlyInternetGateway' :: Maybe [InternetGatewayAttachment]
attachments =
        forall a. Maybe a
Prelude.Nothing,
      $sel:egressOnlyInternetGatewayId:EgressOnlyInternetGateway' :: Maybe Text
egressOnlyInternetGatewayId = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:EgressOnlyInternetGateway' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the attachment of the egress-only internet gateway.
egressOnlyInternetGateway_attachments :: Lens.Lens' EgressOnlyInternetGateway (Prelude.Maybe [InternetGatewayAttachment])
egressOnlyInternetGateway_attachments :: Lens' EgressOnlyInternetGateway (Maybe [InternetGatewayAttachment])
egressOnlyInternetGateway_attachments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EgressOnlyInternetGateway' {Maybe [InternetGatewayAttachment]
attachments :: Maybe [InternetGatewayAttachment]
$sel:attachments:EgressOnlyInternetGateway' :: EgressOnlyInternetGateway -> Maybe [InternetGatewayAttachment]
attachments} -> Maybe [InternetGatewayAttachment]
attachments) (\s :: EgressOnlyInternetGateway
s@EgressOnlyInternetGateway' {} Maybe [InternetGatewayAttachment]
a -> EgressOnlyInternetGateway
s {$sel:attachments:EgressOnlyInternetGateway' :: Maybe [InternetGatewayAttachment]
attachments = Maybe [InternetGatewayAttachment]
a} :: EgressOnlyInternetGateway) 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

-- | The ID of the egress-only internet gateway.
egressOnlyInternetGateway_egressOnlyInternetGatewayId :: Lens.Lens' EgressOnlyInternetGateway (Prelude.Maybe Prelude.Text)
egressOnlyInternetGateway_egressOnlyInternetGatewayId :: Lens' EgressOnlyInternetGateway (Maybe Text)
egressOnlyInternetGateway_egressOnlyInternetGatewayId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EgressOnlyInternetGateway' {Maybe Text
egressOnlyInternetGatewayId :: Maybe Text
$sel:egressOnlyInternetGatewayId:EgressOnlyInternetGateway' :: EgressOnlyInternetGateway -> Maybe Text
egressOnlyInternetGatewayId} -> Maybe Text
egressOnlyInternetGatewayId) (\s :: EgressOnlyInternetGateway
s@EgressOnlyInternetGateway' {} Maybe Text
a -> EgressOnlyInternetGateway
s {$sel:egressOnlyInternetGatewayId:EgressOnlyInternetGateway' :: Maybe Text
egressOnlyInternetGatewayId = Maybe Text
a} :: EgressOnlyInternetGateway)

-- | The tags assigned to the egress-only internet gateway.
egressOnlyInternetGateway_tags :: Lens.Lens' EgressOnlyInternetGateway (Prelude.Maybe [Tag])
egressOnlyInternetGateway_tags :: Lens' EgressOnlyInternetGateway (Maybe [Tag])
egressOnlyInternetGateway_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EgressOnlyInternetGateway' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:EgressOnlyInternetGateway' :: EgressOnlyInternetGateway -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: EgressOnlyInternetGateway
s@EgressOnlyInternetGateway' {} Maybe [Tag]
a -> EgressOnlyInternetGateway
s {$sel:tags:EgressOnlyInternetGateway' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: EgressOnlyInternetGateway) 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

instance Data.FromXML EgressOnlyInternetGateway where
  parseXML :: [Node] -> Either String EgressOnlyInternetGateway
parseXML [Node]
x =
    Maybe [InternetGatewayAttachment]
-> Maybe Text -> Maybe [Tag] -> EgressOnlyInternetGateway
EgressOnlyInternetGateway'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"attachmentSet"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"egressOnlyInternetGatewayId")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"tagSet"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                  )

instance Prelude.Hashable EgressOnlyInternetGateway where
  hashWithSalt :: Int -> EgressOnlyInternetGateway -> Int
hashWithSalt Int
_salt EgressOnlyInternetGateway' {Maybe [InternetGatewayAttachment]
Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
egressOnlyInternetGatewayId :: Maybe Text
attachments :: Maybe [InternetGatewayAttachment]
$sel:tags:EgressOnlyInternetGateway' :: EgressOnlyInternetGateway -> Maybe [Tag]
$sel:egressOnlyInternetGatewayId:EgressOnlyInternetGateway' :: EgressOnlyInternetGateway -> Maybe Text
$sel:attachments:EgressOnlyInternetGateway' :: EgressOnlyInternetGateway -> Maybe [InternetGatewayAttachment]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [InternetGatewayAttachment]
attachments
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
egressOnlyInternetGatewayId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags

instance Prelude.NFData EgressOnlyInternetGateway where
  rnf :: EgressOnlyInternetGateway -> ()
rnf EgressOnlyInternetGateway' {Maybe [InternetGatewayAttachment]
Maybe [Tag]
Maybe Text
tags :: Maybe [Tag]
egressOnlyInternetGatewayId :: Maybe Text
attachments :: Maybe [InternetGatewayAttachment]
$sel:tags:EgressOnlyInternetGateway' :: EgressOnlyInternetGateway -> Maybe [Tag]
$sel:egressOnlyInternetGatewayId:EgressOnlyInternetGateway' :: EgressOnlyInternetGateway -> Maybe Text
$sel:attachments:EgressOnlyInternetGateway' :: EgressOnlyInternetGateway -> Maybe [InternetGatewayAttachment]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [InternetGatewayAttachment]
attachments
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
egressOnlyInternetGatewayId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags