{-# 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.Domain
-- 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.Domain 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.DomainEntry
import Amazonka.Lightsail.Types.RegisteredDomainDelegationInfo
import Amazonka.Lightsail.Types.ResourceLocation
import Amazonka.Lightsail.Types.ResourceType
import Amazonka.Lightsail.Types.Tag
import qualified Amazonka.Prelude as Prelude

-- | Describes a domain where you are storing recordsets.
--
-- /See:/ 'newDomain' smart constructor.
data Domain = Domain'
  { -- | The Amazon Resource Name (ARN) of the domain recordset (e.g.,
    -- @arn:aws:lightsail:global:123456789101:Domain\/824cede0-abc7-4f84-8dbc-12345EXAMPLE@).
    Domain -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The date when the domain recordset was created.
    Domain -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | An array of key-value pairs containing information about the domain
    -- entries.
    Domain -> Maybe [DomainEntry]
domainEntries :: Prelude.Maybe [DomainEntry],
    -- | The AWS Region and Availability Zones where the domain recordset was
    -- created.
    Domain -> Maybe ResourceLocation
location :: Prelude.Maybe ResourceLocation,
    -- | The name of the domain.
    Domain -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | An object that describes the state of the Route 53 domain delegation to
    -- a Lightsail DNS zone.
    Domain -> Maybe RegisteredDomainDelegationInfo
registeredDomainDelegationInfo :: Prelude.Maybe RegisteredDomainDelegationInfo,
    -- | The resource type.
    Domain -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | The support code. Include this code in your email to support when you
    -- have questions about an instance or another resource in Lightsail. This
    -- code enables our support team to look up your Lightsail information more
    -- easily.
    Domain -> Maybe Text
supportCode :: Prelude.Maybe Prelude.Text,
    -- | The tag keys and optional values for the resource. For more information
    -- about tags in Lightsail, see the
    -- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-tags Amazon Lightsail Developer Guide>.
    Domain -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (Domain -> Domain -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Domain -> Domain -> Bool
$c/= :: Domain -> Domain -> Bool
== :: Domain -> Domain -> Bool
$c== :: Domain -> Domain -> Bool
Prelude.Eq, ReadPrec [Domain]
ReadPrec Domain
Int -> ReadS Domain
ReadS [Domain]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Domain]
$creadListPrec :: ReadPrec [Domain]
readPrec :: ReadPrec Domain
$creadPrec :: ReadPrec Domain
readList :: ReadS [Domain]
$creadList :: ReadS [Domain]
readsPrec :: Int -> ReadS Domain
$creadsPrec :: Int -> ReadS Domain
Prelude.Read, Int -> Domain -> ShowS
[Domain] -> ShowS
Domain -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Domain] -> ShowS
$cshowList :: [Domain] -> ShowS
show :: Domain -> String
$cshow :: Domain -> String
showsPrec :: Int -> Domain -> ShowS
$cshowsPrec :: Int -> Domain -> ShowS
Prelude.Show, forall x. Rep Domain x -> Domain
forall x. Domain -> Rep Domain x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Domain x -> Domain
$cfrom :: forall x. Domain -> Rep Domain x
Prelude.Generic)

-- |
-- Create a value of 'Domain' 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:
--
-- 'arn', 'domain_arn' - The Amazon Resource Name (ARN) of the domain recordset (e.g.,
-- @arn:aws:lightsail:global:123456789101:Domain\/824cede0-abc7-4f84-8dbc-12345EXAMPLE@).
--
-- 'createdAt', 'domain_createdAt' - The date when the domain recordset was created.
--
-- 'domainEntries', 'domain_domainEntries' - An array of key-value pairs containing information about the domain
-- entries.
--
-- 'location', 'domain_location' - The AWS Region and Availability Zones where the domain recordset was
-- created.
--
-- 'name', 'domain_name' - The name of the domain.
--
-- 'registeredDomainDelegationInfo', 'domain_registeredDomainDelegationInfo' - An object that describes the state of the Route 53 domain delegation to
-- a Lightsail DNS zone.
--
-- 'resourceType', 'domain_resourceType' - The resource type.
--
-- 'supportCode', 'domain_supportCode' - The support code. Include this code in your email to support when you
-- have questions about an instance or another resource in Lightsail. This
-- code enables our support team to look up your Lightsail information more
-- easily.
--
-- 'tags', 'domain_tags' - The tag keys and optional values for the resource. For more information
-- about tags in Lightsail, see the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-tags Amazon Lightsail Developer Guide>.
newDomain ::
  Domain
newDomain :: Domain
newDomain =
  Domain'
    { $sel:arn:Domain' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:Domain' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:domainEntries:Domain' :: Maybe [DomainEntry]
domainEntries = forall a. Maybe a
Prelude.Nothing,
      $sel:location:Domain' :: Maybe ResourceLocation
location = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Domain' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:registeredDomainDelegationInfo:Domain' :: Maybe RegisteredDomainDelegationInfo
registeredDomainDelegationInfo = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:Domain' :: Maybe ResourceType
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:supportCode:Domain' :: Maybe Text
supportCode = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:Domain' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the domain recordset (e.g.,
-- @arn:aws:lightsail:global:123456789101:Domain\/824cede0-abc7-4f84-8dbc-12345EXAMPLE@).
domain_arn :: Lens.Lens' Domain (Prelude.Maybe Prelude.Text)
domain_arn :: Lens' Domain (Maybe Text)
domain_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Domain' {Maybe Text
arn :: Maybe Text
$sel:arn:Domain' :: Domain -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Domain
s@Domain' {} Maybe Text
a -> Domain
s {$sel:arn:Domain' :: Maybe Text
arn = Maybe Text
a} :: Domain)

-- | The date when the domain recordset was created.
domain_createdAt :: Lens.Lens' Domain (Prelude.Maybe Prelude.UTCTime)
domain_createdAt :: Lens' Domain (Maybe UTCTime)
domain_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Domain' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:Domain' :: Domain -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: Domain
s@Domain' {} Maybe POSIX
a -> Domain
s {$sel:createdAt:Domain' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: Domain) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | An array of key-value pairs containing information about the domain
-- entries.
domain_domainEntries :: Lens.Lens' Domain (Prelude.Maybe [DomainEntry])
domain_domainEntries :: Lens' Domain (Maybe [DomainEntry])
domain_domainEntries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Domain' {Maybe [DomainEntry]
domainEntries :: Maybe [DomainEntry]
$sel:domainEntries:Domain' :: Domain -> Maybe [DomainEntry]
domainEntries} -> Maybe [DomainEntry]
domainEntries) (\s :: Domain
s@Domain' {} Maybe [DomainEntry]
a -> Domain
s {$sel:domainEntries:Domain' :: Maybe [DomainEntry]
domainEntries = Maybe [DomainEntry]
a} :: Domain) 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 AWS Region and Availability Zones where the domain recordset was
-- created.
domain_location :: Lens.Lens' Domain (Prelude.Maybe ResourceLocation)
domain_location :: Lens' Domain (Maybe ResourceLocation)
domain_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Domain' {Maybe ResourceLocation
location :: Maybe ResourceLocation
$sel:location:Domain' :: Domain -> Maybe ResourceLocation
location} -> Maybe ResourceLocation
location) (\s :: Domain
s@Domain' {} Maybe ResourceLocation
a -> Domain
s {$sel:location:Domain' :: Maybe ResourceLocation
location = Maybe ResourceLocation
a} :: Domain)

-- | The name of the domain.
domain_name :: Lens.Lens' Domain (Prelude.Maybe Prelude.Text)
domain_name :: Lens' Domain (Maybe Text)
domain_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Domain' {Maybe Text
name :: Maybe Text
$sel:name:Domain' :: Domain -> Maybe Text
name} -> Maybe Text
name) (\s :: Domain
s@Domain' {} Maybe Text
a -> Domain
s {$sel:name:Domain' :: Maybe Text
name = Maybe Text
a} :: Domain)

-- | An object that describes the state of the Route 53 domain delegation to
-- a Lightsail DNS zone.
domain_registeredDomainDelegationInfo :: Lens.Lens' Domain (Prelude.Maybe RegisteredDomainDelegationInfo)
domain_registeredDomainDelegationInfo :: Lens' Domain (Maybe RegisteredDomainDelegationInfo)
domain_registeredDomainDelegationInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Domain' {Maybe RegisteredDomainDelegationInfo
registeredDomainDelegationInfo :: Maybe RegisteredDomainDelegationInfo
$sel:registeredDomainDelegationInfo:Domain' :: Domain -> Maybe RegisteredDomainDelegationInfo
registeredDomainDelegationInfo} -> Maybe RegisteredDomainDelegationInfo
registeredDomainDelegationInfo) (\s :: Domain
s@Domain' {} Maybe RegisteredDomainDelegationInfo
a -> Domain
s {$sel:registeredDomainDelegationInfo:Domain' :: Maybe RegisteredDomainDelegationInfo
registeredDomainDelegationInfo = Maybe RegisteredDomainDelegationInfo
a} :: Domain)

-- | The resource type.
domain_resourceType :: Lens.Lens' Domain (Prelude.Maybe ResourceType)
domain_resourceType :: Lens' Domain (Maybe ResourceType)
domain_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Domain' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:Domain' :: Domain -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: Domain
s@Domain' {} Maybe ResourceType
a -> Domain
s {$sel:resourceType:Domain' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: Domain)

-- | The support code. Include this code in your email to support when you
-- have questions about an instance or another resource in Lightsail. This
-- code enables our support team to look up your Lightsail information more
-- easily.
domain_supportCode :: Lens.Lens' Domain (Prelude.Maybe Prelude.Text)
domain_supportCode :: Lens' Domain (Maybe Text)
domain_supportCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Domain' {Maybe Text
supportCode :: Maybe Text
$sel:supportCode:Domain' :: Domain -> Maybe Text
supportCode} -> Maybe Text
supportCode) (\s :: Domain
s@Domain' {} Maybe Text
a -> Domain
s {$sel:supportCode:Domain' :: Maybe Text
supportCode = Maybe Text
a} :: Domain)

-- | The tag keys and optional values for the resource. For more information
-- about tags in Lightsail, see the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-tags Amazon Lightsail Developer Guide>.
domain_tags :: Lens.Lens' Domain (Prelude.Maybe [Tag])
domain_tags :: Lens' Domain (Maybe [Tag])
domain_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Domain' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:Domain' :: Domain -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: Domain
s@Domain' {} Maybe [Tag]
a -> Domain
s {$sel:tags:Domain' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: Domain) 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 Domain where
  parseJSON :: Value -> Parser Domain
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Domain"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe [DomainEntry]
-> Maybe ResourceLocation
-> Maybe Text
-> Maybe RegisteredDomainDelegationInfo
-> Maybe ResourceType
-> Maybe Text
-> Maybe [Tag]
-> Domain
Domain'
            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
"arn")
            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
"createdAt")
            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
"domainEntries" 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
"location")
            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
"registeredDomainDelegationInfo")
            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
"resourceType")
            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
"supportCode")
            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
"tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Domain where
  hashWithSalt :: Int -> Domain -> Int
hashWithSalt Int
_salt Domain' {Maybe [DomainEntry]
Maybe [Tag]
Maybe Text
Maybe POSIX
Maybe RegisteredDomainDelegationInfo
Maybe ResourceLocation
Maybe ResourceType
tags :: Maybe [Tag]
supportCode :: Maybe Text
resourceType :: Maybe ResourceType
registeredDomainDelegationInfo :: Maybe RegisteredDomainDelegationInfo
name :: Maybe Text
location :: Maybe ResourceLocation
domainEntries :: Maybe [DomainEntry]
createdAt :: Maybe POSIX
arn :: Maybe Text
$sel:tags:Domain' :: Domain -> Maybe [Tag]
$sel:supportCode:Domain' :: Domain -> Maybe Text
$sel:resourceType:Domain' :: Domain -> Maybe ResourceType
$sel:registeredDomainDelegationInfo:Domain' :: Domain -> Maybe RegisteredDomainDelegationInfo
$sel:name:Domain' :: Domain -> Maybe Text
$sel:location:Domain' :: Domain -> Maybe ResourceLocation
$sel:domainEntries:Domain' :: Domain -> Maybe [DomainEntry]
$sel:createdAt:Domain' :: Domain -> Maybe POSIX
$sel:arn:Domain' :: Domain -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DomainEntry]
domainEntries
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceLocation
location
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RegisteredDomainDelegationInfo
registeredDomainDelegationInfo
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceType
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
supportCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags

instance Prelude.NFData Domain where
  rnf :: Domain -> ()
rnf Domain' {Maybe [DomainEntry]
Maybe [Tag]
Maybe Text
Maybe POSIX
Maybe RegisteredDomainDelegationInfo
Maybe ResourceLocation
Maybe ResourceType
tags :: Maybe [Tag]
supportCode :: Maybe Text
resourceType :: Maybe ResourceType
registeredDomainDelegationInfo :: Maybe RegisteredDomainDelegationInfo
name :: Maybe Text
location :: Maybe ResourceLocation
domainEntries :: Maybe [DomainEntry]
createdAt :: Maybe POSIX
arn :: Maybe Text
$sel:tags:Domain' :: Domain -> Maybe [Tag]
$sel:supportCode:Domain' :: Domain -> Maybe Text
$sel:resourceType:Domain' :: Domain -> Maybe ResourceType
$sel:registeredDomainDelegationInfo:Domain' :: Domain -> Maybe RegisteredDomainDelegationInfo
$sel:name:Domain' :: Domain -> Maybe Text
$sel:location:Domain' :: Domain -> Maybe ResourceLocation
$sel:domainEntries:Domain' :: Domain -> Maybe [DomainEntry]
$sel:createdAt:Domain' :: Domain -> Maybe POSIX
$sel:arn:Domain' :: Domain -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [DomainEntry]
domainEntries
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceLocation
location
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RegisteredDomainDelegationInfo
registeredDomainDelegationInfo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceType
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
supportCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags