{-# 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.AWSLocation
-- 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.AWSLocation 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

-- | Specifies a location in Amazon Web Services.
--
-- /See:/ 'newAWSLocation' smart constructor.
data AWSLocation = AWSLocation'
  { -- | The Amazon Resource Name (ARN) of the subnet that the device is located
    -- in.
    AWSLocation -> Maybe Text
subnetArn :: Prelude.Maybe Prelude.Text,
    -- | The Zone that the device is located in. Specify the ID of an
    -- Availability Zone, Local Zone, Wavelength Zone, or an Outpost.
    AWSLocation -> Maybe Text
zone :: Prelude.Maybe Prelude.Text
  }
  deriving (AWSLocation -> AWSLocation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AWSLocation -> AWSLocation -> Bool
$c/= :: AWSLocation -> AWSLocation -> Bool
== :: AWSLocation -> AWSLocation -> Bool
$c== :: AWSLocation -> AWSLocation -> Bool
Prelude.Eq, ReadPrec [AWSLocation]
ReadPrec AWSLocation
Int -> ReadS AWSLocation
ReadS [AWSLocation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AWSLocation]
$creadListPrec :: ReadPrec [AWSLocation]
readPrec :: ReadPrec AWSLocation
$creadPrec :: ReadPrec AWSLocation
readList :: ReadS [AWSLocation]
$creadList :: ReadS [AWSLocation]
readsPrec :: Int -> ReadS AWSLocation
$creadsPrec :: Int -> ReadS AWSLocation
Prelude.Read, Int -> AWSLocation -> ShowS
[AWSLocation] -> ShowS
AWSLocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AWSLocation] -> ShowS
$cshowList :: [AWSLocation] -> ShowS
show :: AWSLocation -> String
$cshow :: AWSLocation -> String
showsPrec :: Int -> AWSLocation -> ShowS
$cshowsPrec :: Int -> AWSLocation -> ShowS
Prelude.Show, forall x. Rep AWSLocation x -> AWSLocation
forall x. AWSLocation -> Rep AWSLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AWSLocation x -> AWSLocation
$cfrom :: forall x. AWSLocation -> Rep AWSLocation x
Prelude.Generic)

-- |
-- Create a value of 'AWSLocation' 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:
--
-- 'subnetArn', 'aWSLocation_subnetArn' - The Amazon Resource Name (ARN) of the subnet that the device is located
-- in.
--
-- 'zone', 'aWSLocation_zone' - The Zone that the device is located in. Specify the ID of an
-- Availability Zone, Local Zone, Wavelength Zone, or an Outpost.
newAWSLocation ::
  AWSLocation
newAWSLocation :: AWSLocation
newAWSLocation =
  AWSLocation'
    { $sel:subnetArn:AWSLocation' :: Maybe Text
subnetArn = forall a. Maybe a
Prelude.Nothing,
      $sel:zone:AWSLocation' :: Maybe Text
zone = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the subnet that the device is located
-- in.
aWSLocation_subnetArn :: Lens.Lens' AWSLocation (Prelude.Maybe Prelude.Text)
aWSLocation_subnetArn :: Lens' AWSLocation (Maybe Text)
aWSLocation_subnetArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AWSLocation' {Maybe Text
subnetArn :: Maybe Text
$sel:subnetArn:AWSLocation' :: AWSLocation -> Maybe Text
subnetArn} -> Maybe Text
subnetArn) (\s :: AWSLocation
s@AWSLocation' {} Maybe Text
a -> AWSLocation
s {$sel:subnetArn:AWSLocation' :: Maybe Text
subnetArn = Maybe Text
a} :: AWSLocation)

-- | The Zone that the device is located in. Specify the ID of an
-- Availability Zone, Local Zone, Wavelength Zone, or an Outpost.
aWSLocation_zone :: Lens.Lens' AWSLocation (Prelude.Maybe Prelude.Text)
aWSLocation_zone :: Lens' AWSLocation (Maybe Text)
aWSLocation_zone = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AWSLocation' {Maybe Text
zone :: Maybe Text
$sel:zone:AWSLocation' :: AWSLocation -> Maybe Text
zone} -> Maybe Text
zone) (\s :: AWSLocation
s@AWSLocation' {} Maybe Text
a -> AWSLocation
s {$sel:zone:AWSLocation' :: Maybe Text
zone = Maybe Text
a} :: AWSLocation)

instance Data.FromJSON AWSLocation where
  parseJSON :: Value -> Parser AWSLocation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AWSLocation"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> AWSLocation
AWSLocation'
            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
"SubnetArn")
            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
"Zone")
      )

instance Prelude.Hashable AWSLocation where
  hashWithSalt :: Int -> AWSLocation -> Int
hashWithSalt Int
_salt AWSLocation' {Maybe Text
zone :: Maybe Text
subnetArn :: Maybe Text
$sel:zone:AWSLocation' :: AWSLocation -> Maybe Text
$sel:subnetArn:AWSLocation' :: AWSLocation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subnetArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
zone

instance Prelude.NFData AWSLocation where
  rnf :: AWSLocation -> ()
rnf AWSLocation' {Maybe Text
zone :: Maybe Text
subnetArn :: Maybe Text
$sel:zone:AWSLocation' :: AWSLocation -> Maybe Text
$sel:subnetArn:AWSLocation' :: AWSLocation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subnetArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
zone

instance Data.ToJSON AWSLocation where
  toJSON :: AWSLocation -> Value
toJSON AWSLocation' {Maybe Text
zone :: Maybe Text
subnetArn :: Maybe Text
$sel:zone:AWSLocation' :: AWSLocation -> Maybe Text
$sel:subnetArn:AWSLocation' :: AWSLocation -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"SubnetArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
subnetArn,
            (Key
"Zone" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
zone
          ]
      )