{-# 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.SimSpaceWeaver.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.SimSpaceWeaver.Types.Domain where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SimSpaceWeaver.Types.LifecycleManagementStrategy

-- | A collection of app instances that run the same executable app code and
-- have the same launch options and commands.
--
-- For more information about domains, see
-- <https://docs.aws.amazon.com/simspaceweaver/latest/userguide/what-is_key-concepts.html Key concepts>
-- in the /Amazon Web Services SimSpace Weaver User Guide/.
--
-- /See:/ 'newDomain' smart constructor.
data Domain = Domain'
  { -- | The type of lifecycle management for apps in the domain. This value
    -- indicates whether apps in this domain are /managed/ (SimSpace Weaver
    -- starts and stops the apps) or /unmanaged/ (you must start and stop the
    -- apps).
    --
    -- __Lifecycle types__
    --
    -- -   @PerWorker@ – Managed: SimSpace Weaver starts 1 app on each worker
    --
    -- -   @BySpatialSubdivision@ – Managed: SimSpace Weaver starts 1 app for
    --     each spatial partition
    --
    -- -   @ByRequest@ – Unmanaged: You use the __StartApp__ API to start the
    --     apps and use the __StopApp__ API to stop the apps.
    --
    -- The lifecycle types will change when the service is released for general
    -- availability (GA).
    Domain -> Maybe LifecycleManagementStrategy
lifecycle :: Prelude.Maybe LifecycleManagementStrategy,
    -- | The name of the domain.
    Domain -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  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:
--
-- 'lifecycle', 'domain_lifecycle' - The type of lifecycle management for apps in the domain. This value
-- indicates whether apps in this domain are /managed/ (SimSpace Weaver
-- starts and stops the apps) or /unmanaged/ (you must start and stop the
-- apps).
--
-- __Lifecycle types__
--
-- -   @PerWorker@ – Managed: SimSpace Weaver starts 1 app on each worker
--
-- -   @BySpatialSubdivision@ – Managed: SimSpace Weaver starts 1 app for
--     each spatial partition
--
-- -   @ByRequest@ – Unmanaged: You use the __StartApp__ API to start the
--     apps and use the __StopApp__ API to stop the apps.
--
-- The lifecycle types will change when the service is released for general
-- availability (GA).
--
-- 'name', 'domain_name' - The name of the domain.
newDomain ::
  Domain
newDomain :: Domain
newDomain =
  Domain'
    { $sel:lifecycle:Domain' :: Maybe LifecycleManagementStrategy
lifecycle = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Domain' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | The type of lifecycle management for apps in the domain. This value
-- indicates whether apps in this domain are /managed/ (SimSpace Weaver
-- starts and stops the apps) or /unmanaged/ (you must start and stop the
-- apps).
--
-- __Lifecycle types__
--
-- -   @PerWorker@ – Managed: SimSpace Weaver starts 1 app on each worker
--
-- -   @BySpatialSubdivision@ – Managed: SimSpace Weaver starts 1 app for
--     each spatial partition
--
-- -   @ByRequest@ – Unmanaged: You use the __StartApp__ API to start the
--     apps and use the __StopApp__ API to stop the apps.
--
-- The lifecycle types will change when the service is released for general
-- availability (GA).
domain_lifecycle :: Lens.Lens' Domain (Prelude.Maybe LifecycleManagementStrategy)
domain_lifecycle :: Lens' Domain (Maybe LifecycleManagementStrategy)
domain_lifecycle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Domain' {Maybe LifecycleManagementStrategy
lifecycle :: Maybe LifecycleManagementStrategy
$sel:lifecycle:Domain' :: Domain -> Maybe LifecycleManagementStrategy
lifecycle} -> Maybe LifecycleManagementStrategy
lifecycle) (\s :: Domain
s@Domain' {} Maybe LifecycleManagementStrategy
a -> Domain
s {$sel:lifecycle:Domain' :: Maybe LifecycleManagementStrategy
lifecycle = Maybe LifecycleManagementStrategy
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)

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 LifecycleManagementStrategy -> Maybe Text -> 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
"Lifecycle")
            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")
      )

instance Prelude.Hashable Domain where
  hashWithSalt :: Int -> Domain -> Int
hashWithSalt Int
_salt Domain' {Maybe Text
Maybe LifecycleManagementStrategy
name :: Maybe Text
lifecycle :: Maybe LifecycleManagementStrategy
$sel:name:Domain' :: Domain -> Maybe Text
$sel:lifecycle:Domain' :: Domain -> Maybe LifecycleManagementStrategy
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LifecycleManagementStrategy
lifecycle
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name

instance Prelude.NFData Domain where
  rnf :: Domain -> ()
rnf Domain' {Maybe Text
Maybe LifecycleManagementStrategy
name :: Maybe Text
lifecycle :: Maybe LifecycleManagementStrategy
$sel:name:Domain' :: Domain -> Maybe Text
$sel:lifecycle:Domain' :: Domain -> Maybe LifecycleManagementStrategy
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LifecycleManagementStrategy
lifecycle
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name