{-# 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.Location
-- 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.Location 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 an Direct Connect location.
--
-- /See:/ 'newLocation' smart constructor.
data Location = Location'
  { -- | The available MAC Security (MACsec) port speeds for the location.
    Location -> Maybe [Text]
availableMacSecPortSpeeds :: Prelude.Maybe [Prelude.Text],
    -- | The available port speeds for the location.
    Location -> Maybe [Text]
availablePortSpeeds :: Prelude.Maybe [Prelude.Text],
    -- | The name of the service provider for the location.
    Location -> Maybe [Text]
availableProviders :: Prelude.Maybe [Prelude.Text],
    -- | The code for the location.
    Location -> Maybe Text
locationCode :: Prelude.Maybe Prelude.Text,
    -- | The name of the location. This includes the name of the colocation
    -- partner and the physical site of the building.
    Location -> Maybe Text
locationName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services Region for the location.
    Location -> Maybe Text
region :: Prelude.Maybe Prelude.Text
  }
  deriving (Location -> Location -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Location -> Location -> Bool
$c/= :: Location -> Location -> Bool
== :: Location -> Location -> Bool
$c== :: Location -> Location -> Bool
Prelude.Eq, ReadPrec [Location]
ReadPrec Location
Int -> ReadS Location
ReadS [Location]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Location]
$creadListPrec :: ReadPrec [Location]
readPrec :: ReadPrec Location
$creadPrec :: ReadPrec Location
readList :: ReadS [Location]
$creadList :: ReadS [Location]
readsPrec :: Int -> ReadS Location
$creadsPrec :: Int -> ReadS Location
Prelude.Read, Int -> Location -> ShowS
[Location] -> ShowS
Location -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Location] -> ShowS
$cshowList :: [Location] -> ShowS
show :: Location -> String
$cshow :: Location -> String
showsPrec :: Int -> Location -> ShowS
$cshowsPrec :: Int -> Location -> ShowS
Prelude.Show, forall x. Rep Location x -> Location
forall x. Location -> Rep Location x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Location x -> Location
$cfrom :: forall x. Location -> Rep Location x
Prelude.Generic)

-- |
-- Create a value of 'Location' 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:
--
-- 'availableMacSecPortSpeeds', 'location_availableMacSecPortSpeeds' - The available MAC Security (MACsec) port speeds for the location.
--
-- 'availablePortSpeeds', 'location_availablePortSpeeds' - The available port speeds for the location.
--
-- 'availableProviders', 'location_availableProviders' - The name of the service provider for the location.
--
-- 'locationCode', 'location_locationCode' - The code for the location.
--
-- 'locationName', 'location_locationName' - The name of the location. This includes the name of the colocation
-- partner and the physical site of the building.
--
-- 'region', 'location_region' - The Amazon Web Services Region for the location.
newLocation ::
  Location
newLocation :: Location
newLocation =
  Location'
    { $sel:availableMacSecPortSpeeds:Location' :: Maybe [Text]
availableMacSecPortSpeeds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:availablePortSpeeds:Location' :: Maybe [Text]
availablePortSpeeds = forall a. Maybe a
Prelude.Nothing,
      $sel:availableProviders:Location' :: Maybe [Text]
availableProviders = forall a. Maybe a
Prelude.Nothing,
      $sel:locationCode:Location' :: Maybe Text
locationCode = forall a. Maybe a
Prelude.Nothing,
      $sel:locationName:Location' :: Maybe Text
locationName = forall a. Maybe a
Prelude.Nothing,
      $sel:region:Location' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing
    }

-- | The available MAC Security (MACsec) port speeds for the location.
location_availableMacSecPortSpeeds :: Lens.Lens' Location (Prelude.Maybe [Prelude.Text])
location_availableMacSecPortSpeeds :: Lens' Location (Maybe [Text])
location_availableMacSecPortSpeeds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe [Text]
availableMacSecPortSpeeds :: Maybe [Text]
$sel:availableMacSecPortSpeeds:Location' :: Location -> Maybe [Text]
availableMacSecPortSpeeds} -> Maybe [Text]
availableMacSecPortSpeeds) (\s :: Location
s@Location' {} Maybe [Text]
a -> Location
s {$sel:availableMacSecPortSpeeds:Location' :: Maybe [Text]
availableMacSecPortSpeeds = Maybe [Text]
a} :: Location) 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 available port speeds for the location.
location_availablePortSpeeds :: Lens.Lens' Location (Prelude.Maybe [Prelude.Text])
location_availablePortSpeeds :: Lens' Location (Maybe [Text])
location_availablePortSpeeds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe [Text]
availablePortSpeeds :: Maybe [Text]
$sel:availablePortSpeeds:Location' :: Location -> Maybe [Text]
availablePortSpeeds} -> Maybe [Text]
availablePortSpeeds) (\s :: Location
s@Location' {} Maybe [Text]
a -> Location
s {$sel:availablePortSpeeds:Location' :: Maybe [Text]
availablePortSpeeds = Maybe [Text]
a} :: Location) 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 name of the service provider for the location.
location_availableProviders :: Lens.Lens' Location (Prelude.Maybe [Prelude.Text])
location_availableProviders :: Lens' Location (Maybe [Text])
location_availableProviders = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe [Text]
availableProviders :: Maybe [Text]
$sel:availableProviders:Location' :: Location -> Maybe [Text]
availableProviders} -> Maybe [Text]
availableProviders) (\s :: Location
s@Location' {} Maybe [Text]
a -> Location
s {$sel:availableProviders:Location' :: Maybe [Text]
availableProviders = Maybe [Text]
a} :: Location) 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 code for the location.
location_locationCode :: Lens.Lens' Location (Prelude.Maybe Prelude.Text)
location_locationCode :: Lens' Location (Maybe Text)
location_locationCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe Text
locationCode :: Maybe Text
$sel:locationCode:Location' :: Location -> Maybe Text
locationCode} -> Maybe Text
locationCode) (\s :: Location
s@Location' {} Maybe Text
a -> Location
s {$sel:locationCode:Location' :: Maybe Text
locationCode = Maybe Text
a} :: Location)

-- | The name of the location. This includes the name of the colocation
-- partner and the physical site of the building.
location_locationName :: Lens.Lens' Location (Prelude.Maybe Prelude.Text)
location_locationName :: Lens' Location (Maybe Text)
location_locationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe Text
locationName :: Maybe Text
$sel:locationName:Location' :: Location -> Maybe Text
locationName} -> Maybe Text
locationName) (\s :: Location
s@Location' {} Maybe Text
a -> Location
s {$sel:locationName:Location' :: Maybe Text
locationName = Maybe Text
a} :: Location)

-- | The Amazon Web Services Region for the location.
location_region :: Lens.Lens' Location (Prelude.Maybe Prelude.Text)
location_region :: Lens' Location (Maybe Text)
location_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe Text
region :: Maybe Text
$sel:region:Location' :: Location -> Maybe Text
region} -> Maybe Text
region) (\s :: Location
s@Location' {} Maybe Text
a -> Location
s {$sel:region:Location' :: Maybe Text
region = Maybe Text
a} :: Location)

instance Data.FromJSON Location where
  parseJSON :: Value -> Parser Location
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Location"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Location
Location'
            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
"availableMacSecPortSpeeds"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"availablePortSpeeds"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"availableProviders"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"locationCode")
            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
"locationName")
            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")
      )

instance Prelude.Hashable Location where
  hashWithSalt :: Int -> Location -> Int
hashWithSalt Int
_salt Location' {Maybe [Text]
Maybe Text
region :: Maybe Text
locationName :: Maybe Text
locationCode :: Maybe Text
availableProviders :: Maybe [Text]
availablePortSpeeds :: Maybe [Text]
availableMacSecPortSpeeds :: Maybe [Text]
$sel:region:Location' :: Location -> Maybe Text
$sel:locationName:Location' :: Location -> Maybe Text
$sel:locationCode:Location' :: Location -> Maybe Text
$sel:availableProviders:Location' :: Location -> Maybe [Text]
$sel:availablePortSpeeds:Location' :: Location -> Maybe [Text]
$sel:availableMacSecPortSpeeds:Location' :: Location -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
availableMacSecPortSpeeds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
availablePortSpeeds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
availableProviders
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
locationCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
locationName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region

instance Prelude.NFData Location where
  rnf :: Location -> ()
rnf Location' {Maybe [Text]
Maybe Text
region :: Maybe Text
locationName :: Maybe Text
locationCode :: Maybe Text
availableProviders :: Maybe [Text]
availablePortSpeeds :: Maybe [Text]
availableMacSecPortSpeeds :: Maybe [Text]
$sel:region:Location' :: Location -> Maybe Text
$sel:locationName:Location' :: Location -> Maybe Text
$sel:locationCode:Location' :: Location -> Maybe Text
$sel:availableProviders:Location' :: Location -> Maybe [Text]
$sel:availablePortSpeeds:Location' :: Location -> Maybe [Text]
$sel:availableMacSecPortSpeeds:Location' :: Location -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
availableMacSecPortSpeeds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
availablePortSpeeds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
availableProviders
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
locationCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
locationName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region