{-# 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.ELBV2.Types.SubnetMapping
-- 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.ELBV2.Types.SubnetMapping 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 a subnet mapping.
--
-- /See:/ 'newSubnetMapping' smart constructor.
data SubnetMapping = SubnetMapping'
  { -- | [Network Load Balancers] The allocation ID of the Elastic IP address for
    -- an internet-facing load balancer.
    SubnetMapping -> Maybe Text
allocationId :: Prelude.Maybe Prelude.Text,
    -- | [Network Load Balancers] The IPv6 address.
    SubnetMapping -> Maybe Text
iPv6Address :: Prelude.Maybe Prelude.Text,
    -- | [Network Load Balancers] The private IPv4 address for an internal load
    -- balancer.
    SubnetMapping -> Maybe Text
privateIPv4Address :: Prelude.Maybe Prelude.Text,
    -- | The ID of the subnet.
    SubnetMapping -> Maybe Text
subnetId :: Prelude.Maybe Prelude.Text
  }
  deriving (SubnetMapping -> SubnetMapping -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubnetMapping -> SubnetMapping -> Bool
$c/= :: SubnetMapping -> SubnetMapping -> Bool
== :: SubnetMapping -> SubnetMapping -> Bool
$c== :: SubnetMapping -> SubnetMapping -> Bool
Prelude.Eq, ReadPrec [SubnetMapping]
ReadPrec SubnetMapping
Int -> ReadS SubnetMapping
ReadS [SubnetMapping]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SubnetMapping]
$creadListPrec :: ReadPrec [SubnetMapping]
readPrec :: ReadPrec SubnetMapping
$creadPrec :: ReadPrec SubnetMapping
readList :: ReadS [SubnetMapping]
$creadList :: ReadS [SubnetMapping]
readsPrec :: Int -> ReadS SubnetMapping
$creadsPrec :: Int -> ReadS SubnetMapping
Prelude.Read, Int -> SubnetMapping -> ShowS
[SubnetMapping] -> ShowS
SubnetMapping -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubnetMapping] -> ShowS
$cshowList :: [SubnetMapping] -> ShowS
show :: SubnetMapping -> String
$cshow :: SubnetMapping -> String
showsPrec :: Int -> SubnetMapping -> ShowS
$cshowsPrec :: Int -> SubnetMapping -> ShowS
Prelude.Show, forall x. Rep SubnetMapping x -> SubnetMapping
forall x. SubnetMapping -> Rep SubnetMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SubnetMapping x -> SubnetMapping
$cfrom :: forall x. SubnetMapping -> Rep SubnetMapping x
Prelude.Generic)

-- |
-- Create a value of 'SubnetMapping' 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:
--
-- 'allocationId', 'subnetMapping_allocationId' - [Network Load Balancers] The allocation ID of the Elastic IP address for
-- an internet-facing load balancer.
--
-- 'iPv6Address', 'subnetMapping_iPv6Address' - [Network Load Balancers] The IPv6 address.
--
-- 'privateIPv4Address', 'subnetMapping_privateIPv4Address' - [Network Load Balancers] The private IPv4 address for an internal load
-- balancer.
--
-- 'subnetId', 'subnetMapping_subnetId' - The ID of the subnet.
newSubnetMapping ::
  SubnetMapping
newSubnetMapping :: SubnetMapping
newSubnetMapping =
  SubnetMapping'
    { $sel:allocationId:SubnetMapping' :: Maybe Text
allocationId = forall a. Maybe a
Prelude.Nothing,
      $sel:iPv6Address:SubnetMapping' :: Maybe Text
iPv6Address = forall a. Maybe a
Prelude.Nothing,
      $sel:privateIPv4Address:SubnetMapping' :: Maybe Text
privateIPv4Address = forall a. Maybe a
Prelude.Nothing,
      $sel:subnetId:SubnetMapping' :: Maybe Text
subnetId = forall a. Maybe a
Prelude.Nothing
    }

-- | [Network Load Balancers] The allocation ID of the Elastic IP address for
-- an internet-facing load balancer.
subnetMapping_allocationId :: Lens.Lens' SubnetMapping (Prelude.Maybe Prelude.Text)
subnetMapping_allocationId :: Lens' SubnetMapping (Maybe Text)
subnetMapping_allocationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubnetMapping' {Maybe Text
allocationId :: Maybe Text
$sel:allocationId:SubnetMapping' :: SubnetMapping -> Maybe Text
allocationId} -> Maybe Text
allocationId) (\s :: SubnetMapping
s@SubnetMapping' {} Maybe Text
a -> SubnetMapping
s {$sel:allocationId:SubnetMapping' :: Maybe Text
allocationId = Maybe Text
a} :: SubnetMapping)

-- | [Network Load Balancers] The IPv6 address.
subnetMapping_iPv6Address :: Lens.Lens' SubnetMapping (Prelude.Maybe Prelude.Text)
subnetMapping_iPv6Address :: Lens' SubnetMapping (Maybe Text)
subnetMapping_iPv6Address = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubnetMapping' {Maybe Text
iPv6Address :: Maybe Text
$sel:iPv6Address:SubnetMapping' :: SubnetMapping -> Maybe Text
iPv6Address} -> Maybe Text
iPv6Address) (\s :: SubnetMapping
s@SubnetMapping' {} Maybe Text
a -> SubnetMapping
s {$sel:iPv6Address:SubnetMapping' :: Maybe Text
iPv6Address = Maybe Text
a} :: SubnetMapping)

-- | [Network Load Balancers] The private IPv4 address for an internal load
-- balancer.
subnetMapping_privateIPv4Address :: Lens.Lens' SubnetMapping (Prelude.Maybe Prelude.Text)
subnetMapping_privateIPv4Address :: Lens' SubnetMapping (Maybe Text)
subnetMapping_privateIPv4Address = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubnetMapping' {Maybe Text
privateIPv4Address :: Maybe Text
$sel:privateIPv4Address:SubnetMapping' :: SubnetMapping -> Maybe Text
privateIPv4Address} -> Maybe Text
privateIPv4Address) (\s :: SubnetMapping
s@SubnetMapping' {} Maybe Text
a -> SubnetMapping
s {$sel:privateIPv4Address:SubnetMapping' :: Maybe Text
privateIPv4Address = Maybe Text
a} :: SubnetMapping)

-- | The ID of the subnet.
subnetMapping_subnetId :: Lens.Lens' SubnetMapping (Prelude.Maybe Prelude.Text)
subnetMapping_subnetId :: Lens' SubnetMapping (Maybe Text)
subnetMapping_subnetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubnetMapping' {Maybe Text
subnetId :: Maybe Text
$sel:subnetId:SubnetMapping' :: SubnetMapping -> Maybe Text
subnetId} -> Maybe Text
subnetId) (\s :: SubnetMapping
s@SubnetMapping' {} Maybe Text
a -> SubnetMapping
s {$sel:subnetId:SubnetMapping' :: Maybe Text
subnetId = Maybe Text
a} :: SubnetMapping)

instance Prelude.Hashable SubnetMapping where
  hashWithSalt :: Int -> SubnetMapping -> Int
hashWithSalt Int
_salt SubnetMapping' {Maybe Text
subnetId :: Maybe Text
privateIPv4Address :: Maybe Text
iPv6Address :: Maybe Text
allocationId :: Maybe Text
$sel:subnetId:SubnetMapping' :: SubnetMapping -> Maybe Text
$sel:privateIPv4Address:SubnetMapping' :: SubnetMapping -> Maybe Text
$sel:iPv6Address:SubnetMapping' :: SubnetMapping -> Maybe Text
$sel:allocationId:SubnetMapping' :: SubnetMapping -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
allocationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
iPv6Address
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
privateIPv4Address
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subnetId

instance Prelude.NFData SubnetMapping where
  rnf :: SubnetMapping -> ()
rnf SubnetMapping' {Maybe Text
subnetId :: Maybe Text
privateIPv4Address :: Maybe Text
iPv6Address :: Maybe Text
allocationId :: Maybe Text
$sel:subnetId:SubnetMapping' :: SubnetMapping -> Maybe Text
$sel:privateIPv4Address:SubnetMapping' :: SubnetMapping -> Maybe Text
$sel:iPv6Address:SubnetMapping' :: SubnetMapping -> Maybe Text
$sel:allocationId:SubnetMapping' :: SubnetMapping -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
allocationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
iPv6Address
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
privateIPv4Address
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subnetId

instance Data.ToQuery SubnetMapping where
  toQuery :: SubnetMapping -> QueryString
toQuery SubnetMapping' {Maybe Text
subnetId :: Maybe Text
privateIPv4Address :: Maybe Text
iPv6Address :: Maybe Text
allocationId :: Maybe Text
$sel:subnetId:SubnetMapping' :: SubnetMapping -> Maybe Text
$sel:privateIPv4Address:SubnetMapping' :: SubnetMapping -> Maybe Text
$sel:iPv6Address:SubnetMapping' :: SubnetMapping -> Maybe Text
$sel:allocationId:SubnetMapping' :: SubnetMapping -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"AllocationId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
allocationId,
        ByteString
"IPv6Address" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
iPv6Address,
        ByteString
"PrivateIPv4Address" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
privateIPv4Address,
        ByteString
"SubnetId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
subnetId
      ]