{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Lightsail.Types.RegionInfo where

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

-- | Describes the Amazon Web Services 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 continent code (e.g., @NA@, meaning North America).
    RegionInfo -> Maybe Text
continentCode :: Prelude.Maybe Prelude.Text,
    -- | The description of the Amazon Web Services 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,
    -- | The display name (e.g., @Ohio@).
    RegionInfo -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | 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]
  }
  deriving (RegionInfo -> RegionInfo -> Bool
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]
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
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. 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).
--
-- 'continentCode', 'regionInfo_continentCode' - The continent code (e.g., @NA@, meaning North America).
--
-- 'description', 'regionInfo_description' - The description of the Amazon Web Services Region (e.g.,
-- @This region is recommended to serve users in the eastern United States and eastern Canada@).
--
-- 'displayName', 'regionInfo_displayName' - The display name (e.g., @Ohio@).
--
-- '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).
newRegionInfo ::
  RegionInfo
newRegionInfo :: RegionInfo
newRegionInfo =
  RegionInfo'
    { $sel:availabilityZones:RegionInfo' :: Maybe [AvailabilityZone]
availabilityZones = forall a. Maybe a
Prelude.Nothing,
      $sel:continentCode:RegionInfo' :: Maybe Text
continentCode = forall a. Maybe a
Prelude.Nothing,
      $sel:description:RegionInfo' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:RegionInfo' :: Maybe Text
displayName = forall a. Maybe a
Prelude.Nothing,
      $sel:name:RegionInfo' :: Maybe RegionName
name = forall a. Maybe a
Prelude.Nothing,
      $sel:relationalDatabaseAvailabilityZones:RegionInfo' :: Maybe [AvailabilityZone]
relationalDatabaseAvailabilityZones =
        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 :: Lens' RegionInfo (Maybe [AvailabilityZone])
regionInfo_availabilityZones = 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) 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 continent code (e.g., @NA@, meaning North America).
regionInfo_continentCode :: Lens.Lens' RegionInfo (Prelude.Maybe Prelude.Text)
regionInfo_continentCode :: Lens' RegionInfo (Maybe Text)
regionInfo_continentCode = 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 Amazon Web Services 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 :: Lens' RegionInfo (Maybe Text)
regionInfo_description = 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)

-- | The display name (e.g., @Ohio@).
regionInfo_displayName :: Lens.Lens' RegionInfo (Prelude.Maybe Prelude.Text)
regionInfo_displayName :: Lens' RegionInfo (Maybe Text)
regionInfo_displayName = 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 region name (e.g., @us-east-2@).
regionInfo_name :: Lens.Lens' RegionInfo (Prelude.Maybe RegionName)
regionInfo_name :: Lens' RegionInfo (Maybe RegionName)
regionInfo_name = 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 :: Lens' RegionInfo (Maybe [AvailabilityZone])
regionInfo_relationalDatabaseAvailabilityZones = 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) 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 RegionInfo where
  parseJSON :: Value -> Parser RegionInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RegionInfo"
      ( \Object
x ->
          Maybe [AvailabilityZone]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe RegionName
-> Maybe [AvailabilityZone]
-> RegionInfo
RegionInfo'
            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
"availabilityZones"
                            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
"continentCode")
            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
"description")
            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
"displayName")
            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
"name")
            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
"relationalDatabaseAvailabilityZones"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable RegionInfo where
  hashWithSalt :: Int -> RegionInfo -> Int
hashWithSalt Int
_salt RegionInfo' {Maybe [AvailabilityZone]
Maybe Text
Maybe RegionName
relationalDatabaseAvailabilityZones :: Maybe [AvailabilityZone]
name :: Maybe RegionName
displayName :: Maybe Text
description :: Maybe Text
continentCode :: Maybe Text
availabilityZones :: Maybe [AvailabilityZone]
$sel:relationalDatabaseAvailabilityZones:RegionInfo' :: RegionInfo -> Maybe [AvailabilityZone]
$sel:name:RegionInfo' :: RegionInfo -> Maybe RegionName
$sel:displayName:RegionInfo' :: RegionInfo -> Maybe Text
$sel:description:RegionInfo' :: RegionInfo -> Maybe Text
$sel:continentCode:RegionInfo' :: RegionInfo -> Maybe Text
$sel:availabilityZones:RegionInfo' :: RegionInfo -> Maybe [AvailabilityZone]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AvailabilityZone]
availabilityZones
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
continentCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
displayName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RegionName
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AvailabilityZone]
relationalDatabaseAvailabilityZones

instance Prelude.NFData RegionInfo where
  rnf :: RegionInfo -> ()
rnf RegionInfo' {Maybe [AvailabilityZone]
Maybe Text
Maybe RegionName
relationalDatabaseAvailabilityZones :: Maybe [AvailabilityZone]
name :: Maybe RegionName
displayName :: Maybe Text
description :: Maybe Text
continentCode :: Maybe Text
availabilityZones :: Maybe [AvailabilityZone]
$sel:relationalDatabaseAvailabilityZones:RegionInfo' :: RegionInfo -> Maybe [AvailabilityZone]
$sel:name:RegionInfo' :: RegionInfo -> Maybe RegionName
$sel:displayName:RegionInfo' :: RegionInfo -> Maybe Text
$sel:description:RegionInfo' :: RegionInfo -> Maybe Text
$sel:continentCode:RegionInfo' :: RegionInfo -> Maybe Text
$sel:availabilityZones:RegionInfo' :: RegionInfo -> Maybe [AvailabilityZone]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AvailabilityZone]
availabilityZones
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
continentCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
displayName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RegionName
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [AvailabilityZone]
relationalDatabaseAvailabilityZones