{-# 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.Lightsail.Types.RegionInfo
-- 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.Lightsail.Types.RegionInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types.AvailabilityZone
import Amazonka.Lightsail.Types.RegionName
import qualified Amazonka.Prelude as Prelude

-- | Describes the AWS Region.
--
-- /See:/ 'newRegionInfo' smart constructor.
data RegionInfo = RegionInfo'
  { -- | The Availability Zones. Follows the format @us-east-2a@
    -- (case-sensitive).
    RegionInfo -> Maybe [AvailabilityZone]
availabilityZones :: Prelude.Maybe [AvailabilityZone],
    -- | The region name (e.g., @us-east-2@).
    RegionInfo -> Maybe RegionName
name :: Prelude.Maybe RegionName,
    -- | The Availability Zones for databases. Follows the format @us-east-2a@
    -- (case-sensitive).
    RegionInfo -> Maybe [AvailabilityZone]
relationalDatabaseAvailabilityZones :: Prelude.Maybe [AvailabilityZone],
    -- | The display name (e.g., @Ohio@).
    RegionInfo -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | The continent code (e.g., @NA@, meaning North America).
    RegionInfo -> Maybe Text
continentCode :: Prelude.Maybe Prelude.Text,
    -- | The description of the AWS Region (e.g.,
    -- @This region is recommended to serve users in the eastern United States and eastern Canada@).
    RegionInfo -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (RegionInfo -> RegionInfo -> Bool
(RegionInfo -> RegionInfo -> Bool)
-> (RegionInfo -> RegionInfo -> Bool) -> Eq RegionInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegionInfo -> RegionInfo -> Bool
$c/= :: RegionInfo -> RegionInfo -> Bool
== :: RegionInfo -> RegionInfo -> Bool
$c== :: RegionInfo -> RegionInfo -> Bool
Prelude.Eq, ReadPrec [RegionInfo]
ReadPrec RegionInfo
Int -> ReadS RegionInfo
ReadS [RegionInfo]
(Int -> ReadS RegionInfo)
-> ReadS [RegionInfo]
-> ReadPrec RegionInfo
-> ReadPrec [RegionInfo]
-> Read RegionInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegionInfo]
$creadListPrec :: ReadPrec [RegionInfo]
readPrec :: ReadPrec RegionInfo
$creadPrec :: ReadPrec RegionInfo
readList :: ReadS [RegionInfo]
$creadList :: ReadS [RegionInfo]
readsPrec :: Int -> ReadS RegionInfo
$creadsPrec :: Int -> ReadS RegionInfo
Prelude.Read, Int -> RegionInfo -> ShowS
[RegionInfo] -> ShowS
RegionInfo -> String
(Int -> RegionInfo -> ShowS)
-> (RegionInfo -> String)
-> ([RegionInfo] -> ShowS)
-> Show RegionInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegionInfo] -> ShowS
$cshowList :: [RegionInfo] -> ShowS
show :: RegionInfo -> String
$cshow :: RegionInfo -> String
showsPrec :: Int -> RegionInfo -> ShowS
$cshowsPrec :: Int -> RegionInfo -> ShowS
Prelude.Show, (forall x. RegionInfo -> Rep RegionInfo x)
-> (forall x. Rep RegionInfo x -> RegionInfo) -> Generic RegionInfo
forall x. Rep RegionInfo x -> RegionInfo
forall x. RegionInfo -> Rep RegionInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegionInfo x -> RegionInfo
$cfrom :: forall x. RegionInfo -> Rep RegionInfo x
Prelude.Generic)

-- |
-- Create a value of 'RegionInfo' 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:
--
-- 'availabilityZones', 'regionInfo_availabilityZones' - The Availability Zones. Follows the format @us-east-2a@
-- (case-sensitive).
--
-- 'name', 'regionInfo_name' - The region name (e.g., @us-east-2@).
--
-- 'relationalDatabaseAvailabilityZones', 'regionInfo_relationalDatabaseAvailabilityZones' - The Availability Zones for databases. Follows the format @us-east-2a@
-- (case-sensitive).
--
-- 'displayName', 'regionInfo_displayName' - The display name (e.g., @Ohio@).
--
-- 'continentCode', 'regionInfo_continentCode' - The continent code (e.g., @NA@, meaning North America).
--
-- 'description', 'regionInfo_description' - The description of the AWS Region (e.g.,
-- @This region is recommended to serve users in the eastern United States and eastern Canada@).
newRegionInfo ::
  RegionInfo
newRegionInfo :: RegionInfo
newRegionInfo =
  RegionInfo' :: Maybe [AvailabilityZone]
-> Maybe RegionName
-> Maybe [AvailabilityZone]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> RegionInfo
RegionInfo'
    { $sel:availabilityZones:RegionInfo' :: Maybe [AvailabilityZone]
availabilityZones = Maybe [AvailabilityZone]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:RegionInfo' :: Maybe RegionName
name = Maybe RegionName
forall a. Maybe a
Prelude.Nothing,
      $sel:relationalDatabaseAvailabilityZones:RegionInfo' :: Maybe [AvailabilityZone]
relationalDatabaseAvailabilityZones =
        Maybe [AvailabilityZone]
forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:RegionInfo' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:continentCode:RegionInfo' :: Maybe Text
continentCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:RegionInfo' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Availability Zones. Follows the format @us-east-2a@
-- (case-sensitive).
regionInfo_availabilityZones :: Lens.Lens' RegionInfo (Prelude.Maybe [AvailabilityZone])
regionInfo_availabilityZones :: (Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
-> RegionInfo -> f RegionInfo
regionInfo_availabilityZones = (RegionInfo -> Maybe [AvailabilityZone])
-> (RegionInfo -> Maybe [AvailabilityZone] -> RegionInfo)
-> Lens
     RegionInfo
     RegionInfo
     (Maybe [AvailabilityZone])
     (Maybe [AvailabilityZone])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegionInfo' {Maybe [AvailabilityZone]
availabilityZones :: Maybe [AvailabilityZone]
$sel:availabilityZones:RegionInfo' :: RegionInfo -> Maybe [AvailabilityZone]
availabilityZones} -> Maybe [AvailabilityZone]
availabilityZones) (\s :: RegionInfo
s@RegionInfo' {} Maybe [AvailabilityZone]
a -> RegionInfo
s {$sel:availabilityZones:RegionInfo' :: Maybe [AvailabilityZone]
availabilityZones = Maybe [AvailabilityZone]
a} :: RegionInfo) ((Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
 -> RegionInfo -> f RegionInfo)
-> ((Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
    -> Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
-> (Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
-> RegionInfo
-> f RegionInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AvailabilityZone]
  [AvailabilityZone]
  [AvailabilityZone]
  [AvailabilityZone]
-> Iso
     (Maybe [AvailabilityZone])
     (Maybe [AvailabilityZone])
     (Maybe [AvailabilityZone])
     (Maybe [AvailabilityZone])
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
  [AvailabilityZone]
  [AvailabilityZone]
  [AvailabilityZone]
  [AvailabilityZone]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The region name (e.g., @us-east-2@).
regionInfo_name :: Lens.Lens' RegionInfo (Prelude.Maybe RegionName)
regionInfo_name :: (Maybe RegionName -> f (Maybe RegionName))
-> RegionInfo -> f RegionInfo
regionInfo_name = (RegionInfo -> Maybe RegionName)
-> (RegionInfo -> Maybe RegionName -> RegionInfo)
-> Lens RegionInfo RegionInfo (Maybe RegionName) (Maybe RegionName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegionInfo' {Maybe RegionName
name :: Maybe RegionName
$sel:name:RegionInfo' :: RegionInfo -> Maybe RegionName
name} -> Maybe RegionName
name) (\s :: RegionInfo
s@RegionInfo' {} Maybe RegionName
a -> RegionInfo
s {$sel:name:RegionInfo' :: Maybe RegionName
name = Maybe RegionName
a} :: RegionInfo)

-- | The Availability Zones for databases. Follows the format @us-east-2a@
-- (case-sensitive).
regionInfo_relationalDatabaseAvailabilityZones :: Lens.Lens' RegionInfo (Prelude.Maybe [AvailabilityZone])
regionInfo_relationalDatabaseAvailabilityZones :: (Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
-> RegionInfo -> f RegionInfo
regionInfo_relationalDatabaseAvailabilityZones = (RegionInfo -> Maybe [AvailabilityZone])
-> (RegionInfo -> Maybe [AvailabilityZone] -> RegionInfo)
-> Lens
     RegionInfo
     RegionInfo
     (Maybe [AvailabilityZone])
     (Maybe [AvailabilityZone])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegionInfo' {Maybe [AvailabilityZone]
relationalDatabaseAvailabilityZones :: Maybe [AvailabilityZone]
$sel:relationalDatabaseAvailabilityZones:RegionInfo' :: RegionInfo -> Maybe [AvailabilityZone]
relationalDatabaseAvailabilityZones} -> Maybe [AvailabilityZone]
relationalDatabaseAvailabilityZones) (\s :: RegionInfo
s@RegionInfo' {} Maybe [AvailabilityZone]
a -> RegionInfo
s {$sel:relationalDatabaseAvailabilityZones:RegionInfo' :: Maybe [AvailabilityZone]
relationalDatabaseAvailabilityZones = Maybe [AvailabilityZone]
a} :: RegionInfo) ((Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
 -> RegionInfo -> f RegionInfo)
-> ((Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
    -> Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
-> (Maybe [AvailabilityZone] -> f (Maybe [AvailabilityZone]))
-> RegionInfo
-> f RegionInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AvailabilityZone]
  [AvailabilityZone]
  [AvailabilityZone]
  [AvailabilityZone]
-> Iso
     (Maybe [AvailabilityZone])
     (Maybe [AvailabilityZone])
     (Maybe [AvailabilityZone])
     (Maybe [AvailabilityZone])
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
  [AvailabilityZone]
  [AvailabilityZone]
  [AvailabilityZone]
  [AvailabilityZone]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The display name (e.g., @Ohio@).
regionInfo_displayName :: Lens.Lens' RegionInfo (Prelude.Maybe Prelude.Text)
regionInfo_displayName :: (Maybe Text -> f (Maybe Text)) -> RegionInfo -> f RegionInfo
regionInfo_displayName = (RegionInfo -> Maybe Text)
-> (RegionInfo -> Maybe Text -> RegionInfo)
-> Lens RegionInfo RegionInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegionInfo' {Maybe Text
displayName :: Maybe Text
$sel:displayName:RegionInfo' :: RegionInfo -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: RegionInfo
s@RegionInfo' {} Maybe Text
a -> RegionInfo
s {$sel:displayName:RegionInfo' :: Maybe Text
displayName = Maybe Text
a} :: RegionInfo)

-- | The continent code (e.g., @NA@, meaning North America).
regionInfo_continentCode :: Lens.Lens' RegionInfo (Prelude.Maybe Prelude.Text)
regionInfo_continentCode :: (Maybe Text -> f (Maybe Text)) -> RegionInfo -> f RegionInfo
regionInfo_continentCode = (RegionInfo -> Maybe Text)
-> (RegionInfo -> Maybe Text -> RegionInfo)
-> Lens RegionInfo RegionInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegionInfo' {Maybe Text
continentCode :: Maybe Text
$sel:continentCode:RegionInfo' :: RegionInfo -> Maybe Text
continentCode} -> Maybe Text
continentCode) (\s :: RegionInfo
s@RegionInfo' {} Maybe Text
a -> RegionInfo
s {$sel:continentCode:RegionInfo' :: Maybe Text
continentCode = Maybe Text
a} :: RegionInfo)

-- | The description of the AWS Region (e.g.,
-- @This region is recommended to serve users in the eastern United States and eastern Canada@).
regionInfo_description :: Lens.Lens' RegionInfo (Prelude.Maybe Prelude.Text)
regionInfo_description :: (Maybe Text -> f (Maybe Text)) -> RegionInfo -> f RegionInfo
regionInfo_description = (RegionInfo -> Maybe Text)
-> (RegionInfo -> Maybe Text -> RegionInfo)
-> Lens RegionInfo RegionInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegionInfo' {Maybe Text
description :: Maybe Text
$sel:description:RegionInfo' :: RegionInfo -> Maybe Text
description} -> Maybe Text
description) (\s :: RegionInfo
s@RegionInfo' {} Maybe Text
a -> RegionInfo
s {$sel:description:RegionInfo' :: Maybe Text
description = Maybe Text
a} :: RegionInfo)

instance Core.FromJSON RegionInfo where
  parseJSON :: Value -> Parser RegionInfo
parseJSON =
    String
-> (Object -> Parser RegionInfo) -> Value -> Parser RegionInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RegionInfo"
      ( \Object
x ->
          Maybe [AvailabilityZone]
-> Maybe RegionName
-> Maybe [AvailabilityZone]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> RegionInfo
RegionInfo'
            (Maybe [AvailabilityZone]
 -> Maybe RegionName
 -> Maybe [AvailabilityZone]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> RegionInfo)
-> Parser (Maybe [AvailabilityZone])
-> Parser
     (Maybe RegionName
      -> Maybe [AvailabilityZone]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> RegionInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [AvailabilityZone]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"availabilityZones"
                            Parser (Maybe (Maybe [AvailabilityZone]))
-> Maybe [AvailabilityZone] -> Parser (Maybe [AvailabilityZone])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AvailabilityZone]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe RegionName
   -> Maybe [AvailabilityZone]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> RegionInfo)
-> Parser (Maybe RegionName)
-> Parser
     (Maybe [AvailabilityZone]
      -> Maybe Text -> Maybe Text -> Maybe Text -> RegionInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RegionName)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
            Parser
  (Maybe [AvailabilityZone]
   -> Maybe Text -> Maybe Text -> Maybe Text -> RegionInfo)
-> Parser (Maybe [AvailabilityZone])
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> RegionInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [AvailabilityZone]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"relationalDatabaseAvailabilityZones"
                            Parser (Maybe (Maybe [AvailabilityZone]))
-> Maybe [AvailabilityZone] -> Parser (Maybe [AvailabilityZone])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AvailabilityZone]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> RegionInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> RegionInfo)
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
"displayName")
            Parser (Maybe Text -> Maybe Text -> RegionInfo)
-> Parser (Maybe Text) -> Parser (Maybe Text -> RegionInfo)
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
"continentCode")
            Parser (Maybe Text -> RegionInfo)
-> Parser (Maybe Text) -> Parser RegionInfo
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
"description")
      )

instance Prelude.Hashable RegionInfo

instance Prelude.NFData RegionInfo