{-# 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.SWF.Types.DomainInfo
-- 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.SWF.Types.DomainInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SWF.Types.RegistrationStatus

-- | Contains general information about a domain.
--
-- /See:/ 'newDomainInfo' smart constructor.
data DomainInfo = DomainInfo'
  { -- | The ARN of the domain.
    DomainInfo -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The description of the domain provided through RegisterDomain.
    DomainInfo -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the domain. This name is unique within the account.
    DomainInfo -> Text
name :: Prelude.Text,
    -- | The status of the domain:
    --
    -- -   @REGISTERED@ – The domain is properly registered and available. You
    --     can use this domain for registering types and creating new workflow
    --     executions.
    --
    -- -   @DEPRECATED@ – The domain was deprecated using DeprecateDomain, but
    --     is still in use. You should not create new workflow executions in
    --     this domain.
    DomainInfo -> RegistrationStatus
status :: RegistrationStatus
  }
  deriving (DomainInfo -> DomainInfo -> Bool
(DomainInfo -> DomainInfo -> Bool)
-> (DomainInfo -> DomainInfo -> Bool) -> Eq DomainInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainInfo -> DomainInfo -> Bool
$c/= :: DomainInfo -> DomainInfo -> Bool
== :: DomainInfo -> DomainInfo -> Bool
$c== :: DomainInfo -> DomainInfo -> Bool
Prelude.Eq, ReadPrec [DomainInfo]
ReadPrec DomainInfo
Int -> ReadS DomainInfo
ReadS [DomainInfo]
(Int -> ReadS DomainInfo)
-> ReadS [DomainInfo]
-> ReadPrec DomainInfo
-> ReadPrec [DomainInfo]
-> Read DomainInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainInfo]
$creadListPrec :: ReadPrec [DomainInfo]
readPrec :: ReadPrec DomainInfo
$creadPrec :: ReadPrec DomainInfo
readList :: ReadS [DomainInfo]
$creadList :: ReadS [DomainInfo]
readsPrec :: Int -> ReadS DomainInfo
$creadsPrec :: Int -> ReadS DomainInfo
Prelude.Read, Int -> DomainInfo -> ShowS
[DomainInfo] -> ShowS
DomainInfo -> String
(Int -> DomainInfo -> ShowS)
-> (DomainInfo -> String)
-> ([DomainInfo] -> ShowS)
-> Show DomainInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainInfo] -> ShowS
$cshowList :: [DomainInfo] -> ShowS
show :: DomainInfo -> String
$cshow :: DomainInfo -> String
showsPrec :: Int -> DomainInfo -> ShowS
$cshowsPrec :: Int -> DomainInfo -> ShowS
Prelude.Show, (forall x. DomainInfo -> Rep DomainInfo x)
-> (forall x. Rep DomainInfo x -> DomainInfo) -> Generic DomainInfo
forall x. Rep DomainInfo x -> DomainInfo
forall x. DomainInfo -> Rep DomainInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainInfo x -> DomainInfo
$cfrom :: forall x. DomainInfo -> Rep DomainInfo x
Prelude.Generic)

-- |
-- Create a value of 'DomainInfo' 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', 'domainInfo_arn' - The ARN of the domain.
--
-- 'description', 'domainInfo_description' - The description of the domain provided through RegisterDomain.
--
-- 'name', 'domainInfo_name' - The name of the domain. This name is unique within the account.
--
-- 'status', 'domainInfo_status' - The status of the domain:
--
-- -   @REGISTERED@ – The domain is properly registered and available. You
--     can use this domain for registering types and creating new workflow
--     executions.
--
-- -   @DEPRECATED@ – The domain was deprecated using DeprecateDomain, but
--     is still in use. You should not create new workflow executions in
--     this domain.
newDomainInfo ::
  -- | 'name'
  Prelude.Text ->
  -- | 'status'
  RegistrationStatus ->
  DomainInfo
newDomainInfo :: Text -> RegistrationStatus -> DomainInfo
newDomainInfo Text
pName_ RegistrationStatus
pStatus_ =
  DomainInfo' :: Maybe Text
-> Maybe Text -> Text -> RegistrationStatus -> DomainInfo
DomainInfo'
    { $sel:arn:DomainInfo' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:DomainInfo' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DomainInfo' :: Text
name = Text
pName_,
      $sel:status:DomainInfo' :: RegistrationStatus
status = RegistrationStatus
pStatus_
    }

-- | The ARN of the domain.
domainInfo_arn :: Lens.Lens' DomainInfo (Prelude.Maybe Prelude.Text)
domainInfo_arn :: (Maybe Text -> f (Maybe Text)) -> DomainInfo -> f DomainInfo
domainInfo_arn = (DomainInfo -> Maybe Text)
-> (DomainInfo -> Maybe Text -> DomainInfo)
-> Lens DomainInfo DomainInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainInfo' {Maybe Text
arn :: Maybe Text
$sel:arn:DomainInfo' :: DomainInfo -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DomainInfo
s@DomainInfo' {} Maybe Text
a -> DomainInfo
s {$sel:arn:DomainInfo' :: Maybe Text
arn = Maybe Text
a} :: DomainInfo)

-- | The description of the domain provided through RegisterDomain.
domainInfo_description :: Lens.Lens' DomainInfo (Prelude.Maybe Prelude.Text)
domainInfo_description :: (Maybe Text -> f (Maybe Text)) -> DomainInfo -> f DomainInfo
domainInfo_description = (DomainInfo -> Maybe Text)
-> (DomainInfo -> Maybe Text -> DomainInfo)
-> Lens DomainInfo DomainInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainInfo' {Maybe Text
description :: Maybe Text
$sel:description:DomainInfo' :: DomainInfo -> Maybe Text
description} -> Maybe Text
description) (\s :: DomainInfo
s@DomainInfo' {} Maybe Text
a -> DomainInfo
s {$sel:description:DomainInfo' :: Maybe Text
description = Maybe Text
a} :: DomainInfo)

-- | The name of the domain. This name is unique within the account.
domainInfo_name :: Lens.Lens' DomainInfo Prelude.Text
domainInfo_name :: (Text -> f Text) -> DomainInfo -> f DomainInfo
domainInfo_name = (DomainInfo -> Text)
-> (DomainInfo -> Text -> DomainInfo)
-> Lens DomainInfo DomainInfo Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainInfo' {Text
name :: Text
$sel:name:DomainInfo' :: DomainInfo -> Text
name} -> Text
name) (\s :: DomainInfo
s@DomainInfo' {} Text
a -> DomainInfo
s {$sel:name:DomainInfo' :: Text
name = Text
a} :: DomainInfo)

-- | The status of the domain:
--
-- -   @REGISTERED@ – The domain is properly registered and available. You
--     can use this domain for registering types and creating new workflow
--     executions.
--
-- -   @DEPRECATED@ – The domain was deprecated using DeprecateDomain, but
--     is still in use. You should not create new workflow executions in
--     this domain.
domainInfo_status :: Lens.Lens' DomainInfo RegistrationStatus
domainInfo_status :: (RegistrationStatus -> f RegistrationStatus)
-> DomainInfo -> f DomainInfo
domainInfo_status = (DomainInfo -> RegistrationStatus)
-> (DomainInfo -> RegistrationStatus -> DomainInfo)
-> Lens DomainInfo DomainInfo RegistrationStatus RegistrationStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainInfo' {RegistrationStatus
status :: RegistrationStatus
$sel:status:DomainInfo' :: DomainInfo -> RegistrationStatus
status} -> RegistrationStatus
status) (\s :: DomainInfo
s@DomainInfo' {} RegistrationStatus
a -> DomainInfo
s {$sel:status:DomainInfo' :: RegistrationStatus
status = RegistrationStatus
a} :: DomainInfo)

instance Core.FromJSON DomainInfo where
  parseJSON :: Value -> Parser DomainInfo
parseJSON =
    String
-> (Object -> Parser DomainInfo) -> Value -> Parser DomainInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DomainInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Text -> RegistrationStatus -> DomainInfo
DomainInfo'
            (Maybe Text
 -> Maybe Text -> Text -> RegistrationStatus -> DomainInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> RegistrationStatus -> DomainInfo)
forall (f :: * -> *) a b. Functor 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
"arn")
            Parser (Maybe Text -> Text -> RegistrationStatus -> DomainInfo)
-> Parser (Maybe Text)
-> Parser (Text -> RegistrationStatus -> DomainInfo)
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")
            Parser (Text -> RegistrationStatus -> DomainInfo)
-> Parser Text -> Parser (RegistrationStatus -> DomainInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
            Parser (RegistrationStatus -> DomainInfo)
-> Parser RegistrationStatus -> Parser DomainInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RegistrationStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
      )

instance Prelude.Hashable DomainInfo

instance Prelude.NFData DomainInfo