{-# 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.NetworkManager.Types.VpcAttachment
-- 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.NetworkManager.Types.VpcAttachment where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.NetworkManager.Types.Attachment
import Amazonka.NetworkManager.Types.VpcOptions
import qualified Amazonka.Prelude as Prelude

-- | Describes a VPC attachment.
--
-- /See:/ 'newVpcAttachment' smart constructor.
data VpcAttachment = VpcAttachment'
  { -- | Provides details about the VPC attachment.
    VpcAttachment -> Maybe Attachment
attachment :: Prelude.Maybe Attachment,
    -- | Provides details about the VPC attachment.
    VpcAttachment -> Maybe VpcOptions
options :: Prelude.Maybe VpcOptions,
    -- | The subnet ARNs.
    VpcAttachment -> Maybe [Text]
subnetArns :: Prelude.Maybe [Prelude.Text]
  }
  deriving (VpcAttachment -> VpcAttachment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcAttachment -> VpcAttachment -> Bool
$c/= :: VpcAttachment -> VpcAttachment -> Bool
== :: VpcAttachment -> VpcAttachment -> Bool
$c== :: VpcAttachment -> VpcAttachment -> Bool
Prelude.Eq, ReadPrec [VpcAttachment]
ReadPrec VpcAttachment
Int -> ReadS VpcAttachment
ReadS [VpcAttachment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcAttachment]
$creadListPrec :: ReadPrec [VpcAttachment]
readPrec :: ReadPrec VpcAttachment
$creadPrec :: ReadPrec VpcAttachment
readList :: ReadS [VpcAttachment]
$creadList :: ReadS [VpcAttachment]
readsPrec :: Int -> ReadS VpcAttachment
$creadsPrec :: Int -> ReadS VpcAttachment
Prelude.Read, Int -> VpcAttachment -> ShowS
[VpcAttachment] -> ShowS
VpcAttachment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcAttachment] -> ShowS
$cshowList :: [VpcAttachment] -> ShowS
show :: VpcAttachment -> String
$cshow :: VpcAttachment -> String
showsPrec :: Int -> VpcAttachment -> ShowS
$cshowsPrec :: Int -> VpcAttachment -> ShowS
Prelude.Show, forall x. Rep VpcAttachment x -> VpcAttachment
forall x. VpcAttachment -> Rep VpcAttachment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcAttachment x -> VpcAttachment
$cfrom :: forall x. VpcAttachment -> Rep VpcAttachment x
Prelude.Generic)

-- |
-- Create a value of 'VpcAttachment' 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:
--
-- 'attachment', 'vpcAttachment_attachment' - Provides details about the VPC attachment.
--
-- 'options', 'vpcAttachment_options' - Provides details about the VPC attachment.
--
-- 'subnetArns', 'vpcAttachment_subnetArns' - The subnet ARNs.
newVpcAttachment ::
  VpcAttachment
newVpcAttachment :: VpcAttachment
newVpcAttachment =
  VpcAttachment'
    { $sel:attachment:VpcAttachment' :: Maybe Attachment
attachment = forall a. Maybe a
Prelude.Nothing,
      $sel:options:VpcAttachment' :: Maybe VpcOptions
options = forall a. Maybe a
Prelude.Nothing,
      $sel:subnetArns:VpcAttachment' :: Maybe [Text]
subnetArns = forall a. Maybe a
Prelude.Nothing
    }

-- | Provides details about the VPC attachment.
vpcAttachment_attachment :: Lens.Lens' VpcAttachment (Prelude.Maybe Attachment)
vpcAttachment_attachment :: Lens' VpcAttachment (Maybe Attachment)
vpcAttachment_attachment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcAttachment' {Maybe Attachment
attachment :: Maybe Attachment
$sel:attachment:VpcAttachment' :: VpcAttachment -> Maybe Attachment
attachment} -> Maybe Attachment
attachment) (\s :: VpcAttachment
s@VpcAttachment' {} Maybe Attachment
a -> VpcAttachment
s {$sel:attachment:VpcAttachment' :: Maybe Attachment
attachment = Maybe Attachment
a} :: VpcAttachment)

-- | Provides details about the VPC attachment.
vpcAttachment_options :: Lens.Lens' VpcAttachment (Prelude.Maybe VpcOptions)
vpcAttachment_options :: Lens' VpcAttachment (Maybe VpcOptions)
vpcAttachment_options = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcAttachment' {Maybe VpcOptions
options :: Maybe VpcOptions
$sel:options:VpcAttachment' :: VpcAttachment -> Maybe VpcOptions
options} -> Maybe VpcOptions
options) (\s :: VpcAttachment
s@VpcAttachment' {} Maybe VpcOptions
a -> VpcAttachment
s {$sel:options:VpcAttachment' :: Maybe VpcOptions
options = Maybe VpcOptions
a} :: VpcAttachment)

-- | The subnet ARNs.
vpcAttachment_subnetArns :: Lens.Lens' VpcAttachment (Prelude.Maybe [Prelude.Text])
vpcAttachment_subnetArns :: Lens' VpcAttachment (Maybe [Text])
vpcAttachment_subnetArns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcAttachment' {Maybe [Text]
subnetArns :: Maybe [Text]
$sel:subnetArns:VpcAttachment' :: VpcAttachment -> Maybe [Text]
subnetArns} -> Maybe [Text]
subnetArns) (\s :: VpcAttachment
s@VpcAttachment' {} Maybe [Text]
a -> VpcAttachment
s {$sel:subnetArns:VpcAttachment' :: Maybe [Text]
subnetArns = Maybe [Text]
a} :: VpcAttachment) 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.FromJSON VpcAttachment where
  parseJSON :: Value -> Parser VpcAttachment
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VpcAttachment"
      ( \Object
x ->
          Maybe Attachment
-> Maybe VpcOptions -> Maybe [Text] -> VpcAttachment
VpcAttachment'
            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
"Attachment")
            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
"Options")
            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
"SubnetArns" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable VpcAttachment where
  hashWithSalt :: Int -> VpcAttachment -> Int
hashWithSalt Int
_salt VpcAttachment' {Maybe [Text]
Maybe Attachment
Maybe VpcOptions
subnetArns :: Maybe [Text]
options :: Maybe VpcOptions
attachment :: Maybe Attachment
$sel:subnetArns:VpcAttachment' :: VpcAttachment -> Maybe [Text]
$sel:options:VpcAttachment' :: VpcAttachment -> Maybe VpcOptions
$sel:attachment:VpcAttachment' :: VpcAttachment -> Maybe Attachment
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Attachment
attachment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpcOptions
options
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
subnetArns

instance Prelude.NFData VpcAttachment where
  rnf :: VpcAttachment -> ()
rnf VpcAttachment' {Maybe [Text]
Maybe Attachment
Maybe VpcOptions
subnetArns :: Maybe [Text]
options :: Maybe VpcOptions
attachment :: Maybe Attachment
$sel:subnetArns:VpcAttachment' :: VpcAttachment -> Maybe [Text]
$sel:options:VpcAttachment' :: VpcAttachment -> Maybe VpcOptions
$sel:attachment:VpcAttachment' :: VpcAttachment -> Maybe Attachment
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Attachment
attachment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpcOptions
options
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
subnetArns