{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DirectConnect.Types.Location where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about an Direct Connect location.
--
-- /See:/ 'newLocation' smart constructor.
data Location = Location'
  { -- | The available port speeds for the location.
    Location -> Maybe [Text]
availablePortSpeeds :: 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 code for the location.
    Location -> Maybe Text
locationCode :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services Region for the location.
    Location -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
    -- | The name of the service provider for the location.
    Location -> Maybe [Text]
availableProviders :: Prelude.Maybe [Prelude.Text],
    -- | The available MAC Security (MACsec) port speeds for the location.
    Location -> Maybe [Text]
availableMacSecPortSpeeds :: Prelude.Maybe [Prelude.Text]
  }
  deriving (Location -> Location -> Bool
(Location -> Location -> Bool)
-> (Location -> Location -> Bool) -> Eq Location
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]
(Int -> ReadS Location)
-> ReadS [Location]
-> ReadPrec Location
-> ReadPrec [Location]
-> Read 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
(Int -> Location -> ShowS)
-> (Location -> String) -> ([Location] -> ShowS) -> Show Location
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. Location -> Rep Location x)
-> (forall x. Rep Location x -> Location) -> Generic Location
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:
--
-- 'availablePortSpeeds', 'location_availablePortSpeeds' - The available port speeds 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.
--
-- 'locationCode', 'location_locationCode' - The code for the location.
--
-- 'region', 'location_region' - The Amazon Web Services Region for the location.
--
-- 'availableProviders', 'location_availableProviders' - The name of the service provider for the location.
--
-- 'availableMacSecPortSpeeds', 'location_availableMacSecPortSpeeds' - The available MAC Security (MACsec) port speeds for the location.
newLocation ::
  Location
newLocation :: Location
newLocation =
  Location' :: Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe [Text]
-> Location
Location'
    { $sel:availablePortSpeeds:Location' :: Maybe [Text]
availablePortSpeeds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:locationName:Location' :: Maybe Text
locationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:locationCode:Location' :: Maybe Text
locationCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:region:Location' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:availableProviders:Location' :: Maybe [Text]
availableProviders = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:availableMacSecPortSpeeds:Location' :: Maybe [Text]
availableMacSecPortSpeeds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The available port speeds for the location.
location_availablePortSpeeds :: Lens.Lens' Location (Prelude.Maybe [Prelude.Text])
location_availablePortSpeeds :: (Maybe [Text] -> f (Maybe [Text])) -> Location -> f Location
location_availablePortSpeeds = (Location -> Maybe [Text])
-> (Location -> Maybe [Text] -> Location)
-> Lens Location Location (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text])) -> Location -> f Location)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Location
-> f Location
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> Location -> f Location
location_locationName = (Location -> Maybe Text)
-> (Location -> Maybe Text -> Location)
-> Lens Location Location (Maybe Text) (Maybe Text)
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 code for the location.
location_locationCode :: Lens.Lens' Location (Prelude.Maybe Prelude.Text)
location_locationCode :: (Maybe Text -> f (Maybe Text)) -> Location -> f Location
location_locationCode = (Location -> Maybe Text)
-> (Location -> Maybe Text -> Location)
-> Lens Location Location (Maybe Text) (Maybe Text)
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 Amazon Web Services Region for the location.
location_region :: Lens.Lens' Location (Prelude.Maybe Prelude.Text)
location_region :: (Maybe Text -> f (Maybe Text)) -> Location -> f Location
location_region = (Location -> Maybe Text)
-> (Location -> Maybe Text -> Location)
-> Lens Location Location (Maybe Text) (Maybe Text)
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)

-- | The name of the service provider for the location.
location_availableProviders :: Lens.Lens' Location (Prelude.Maybe [Prelude.Text])
location_availableProviders :: (Maybe [Text] -> f (Maybe [Text])) -> Location -> f Location
location_availableProviders = (Location -> Maybe [Text])
-> (Location -> Maybe [Text] -> Location)
-> Lens Location Location (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text])) -> Location -> f Location)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Location
-> f Location
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The available MAC Security (MACsec) port speeds for the location.
location_availableMacSecPortSpeeds :: Lens.Lens' Location (Prelude.Maybe [Prelude.Text])
location_availableMacSecPortSpeeds :: (Maybe [Text] -> f (Maybe [Text])) -> Location -> f Location
location_availableMacSecPortSpeeds = (Location -> Maybe [Text])
-> (Location -> Maybe [Text] -> Location)
-> Lens Location Location (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text])) -> Location -> f Location)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Location
-> f Location
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON Location where
  parseJSON :: Value -> Parser Location
parseJSON =
    String -> (Object -> Parser Location) -> Value -> Parser Location
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Location"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe [Text]
-> Location
Location'
            (Maybe [Text]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe [Text]
 -> Location)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe [Text]
      -> Location)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"availablePortSpeeds"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe [Text]
   -> Location)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe [Text] -> Maybe [Text] -> Location)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"locationName")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe [Text] -> Maybe [Text] -> Location)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe [Text] -> Maybe [Text] -> Location)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"locationCode")
            Parser (Maybe Text -> Maybe [Text] -> Maybe [Text] -> Location)
-> Parser (Maybe Text)
-> Parser (Maybe [Text] -> Maybe [Text] -> Location)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"region")
            Parser (Maybe [Text] -> Maybe [Text] -> Location)
-> Parser (Maybe [Text]) -> Parser (Maybe [Text] -> Location)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"availableProviders"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe [Text] -> Location)
-> Parser (Maybe [Text]) -> Parser Location
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"availableMacSecPortSpeeds"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable Location

instance Prelude.NFData Location