{-# 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.OpsWorks.Types.EcsCluster
-- 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.OpsWorks.Types.EcsCluster where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes a registered Amazon ECS cluster.
--
-- /See:/ 'newEcsCluster' smart constructor.
data EcsCluster = EcsCluster'
  { -- | The cluster\'s ARN.
    EcsCluster -> Maybe Text
ecsClusterArn :: Prelude.Maybe Prelude.Text,
    -- | The cluster name.
    EcsCluster -> Maybe Text
ecsClusterName :: Prelude.Maybe Prelude.Text,
    -- | The time and date that the cluster was registered with the stack.
    EcsCluster -> Maybe Text
registeredAt :: Prelude.Maybe Prelude.Text,
    -- | The stack ID.
    EcsCluster -> Maybe Text
stackId :: Prelude.Maybe Prelude.Text
  }
  deriving (EcsCluster -> EcsCluster -> Bool
(EcsCluster -> EcsCluster -> Bool)
-> (EcsCluster -> EcsCluster -> Bool) -> Eq EcsCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EcsCluster -> EcsCluster -> Bool
$c/= :: EcsCluster -> EcsCluster -> Bool
== :: EcsCluster -> EcsCluster -> Bool
$c== :: EcsCluster -> EcsCluster -> Bool
Prelude.Eq, ReadPrec [EcsCluster]
ReadPrec EcsCluster
Int -> ReadS EcsCluster
ReadS [EcsCluster]
(Int -> ReadS EcsCluster)
-> ReadS [EcsCluster]
-> ReadPrec EcsCluster
-> ReadPrec [EcsCluster]
-> Read EcsCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EcsCluster]
$creadListPrec :: ReadPrec [EcsCluster]
readPrec :: ReadPrec EcsCluster
$creadPrec :: ReadPrec EcsCluster
readList :: ReadS [EcsCluster]
$creadList :: ReadS [EcsCluster]
readsPrec :: Int -> ReadS EcsCluster
$creadsPrec :: Int -> ReadS EcsCluster
Prelude.Read, Int -> EcsCluster -> ShowS
[EcsCluster] -> ShowS
EcsCluster -> String
(Int -> EcsCluster -> ShowS)
-> (EcsCluster -> String)
-> ([EcsCluster] -> ShowS)
-> Show EcsCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EcsCluster] -> ShowS
$cshowList :: [EcsCluster] -> ShowS
show :: EcsCluster -> String
$cshow :: EcsCluster -> String
showsPrec :: Int -> EcsCluster -> ShowS
$cshowsPrec :: Int -> EcsCluster -> ShowS
Prelude.Show, (forall x. EcsCluster -> Rep EcsCluster x)
-> (forall x. Rep EcsCluster x -> EcsCluster) -> Generic EcsCluster
forall x. Rep EcsCluster x -> EcsCluster
forall x. EcsCluster -> Rep EcsCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EcsCluster x -> EcsCluster
$cfrom :: forall x. EcsCluster -> Rep EcsCluster x
Prelude.Generic)

-- |
-- Create a value of 'EcsCluster' 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:
--
-- 'ecsClusterArn', 'ecsCluster_ecsClusterArn' - The cluster\'s ARN.
--
-- 'ecsClusterName', 'ecsCluster_ecsClusterName' - The cluster name.
--
-- 'registeredAt', 'ecsCluster_registeredAt' - The time and date that the cluster was registered with the stack.
--
-- 'stackId', 'ecsCluster_stackId' - The stack ID.
newEcsCluster ::
  EcsCluster
newEcsCluster :: EcsCluster
newEcsCluster =
  EcsCluster' :: Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> EcsCluster
EcsCluster'
    { $sel:ecsClusterArn:EcsCluster' :: Maybe Text
ecsClusterArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ecsClusterName:EcsCluster' :: Maybe Text
ecsClusterName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:registeredAt:EcsCluster' :: Maybe Text
registeredAt = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stackId:EcsCluster' :: Maybe Text
stackId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The cluster\'s ARN.
ecsCluster_ecsClusterArn :: Lens.Lens' EcsCluster (Prelude.Maybe Prelude.Text)
ecsCluster_ecsClusterArn :: (Maybe Text -> f (Maybe Text)) -> EcsCluster -> f EcsCluster
ecsCluster_ecsClusterArn = (EcsCluster -> Maybe Text)
-> (EcsCluster -> Maybe Text -> EcsCluster)
-> Lens EcsCluster EcsCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcsCluster' {Maybe Text
ecsClusterArn :: Maybe Text
$sel:ecsClusterArn:EcsCluster' :: EcsCluster -> Maybe Text
ecsClusterArn} -> Maybe Text
ecsClusterArn) (\s :: EcsCluster
s@EcsCluster' {} Maybe Text
a -> EcsCluster
s {$sel:ecsClusterArn:EcsCluster' :: Maybe Text
ecsClusterArn = Maybe Text
a} :: EcsCluster)

-- | The cluster name.
ecsCluster_ecsClusterName :: Lens.Lens' EcsCluster (Prelude.Maybe Prelude.Text)
ecsCluster_ecsClusterName :: (Maybe Text -> f (Maybe Text)) -> EcsCluster -> f EcsCluster
ecsCluster_ecsClusterName = (EcsCluster -> Maybe Text)
-> (EcsCluster -> Maybe Text -> EcsCluster)
-> Lens EcsCluster EcsCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcsCluster' {Maybe Text
ecsClusterName :: Maybe Text
$sel:ecsClusterName:EcsCluster' :: EcsCluster -> Maybe Text
ecsClusterName} -> Maybe Text
ecsClusterName) (\s :: EcsCluster
s@EcsCluster' {} Maybe Text
a -> EcsCluster
s {$sel:ecsClusterName:EcsCluster' :: Maybe Text
ecsClusterName = Maybe Text
a} :: EcsCluster)

-- | The time and date that the cluster was registered with the stack.
ecsCluster_registeredAt :: Lens.Lens' EcsCluster (Prelude.Maybe Prelude.Text)
ecsCluster_registeredAt :: (Maybe Text -> f (Maybe Text)) -> EcsCluster -> f EcsCluster
ecsCluster_registeredAt = (EcsCluster -> Maybe Text)
-> (EcsCluster -> Maybe Text -> EcsCluster)
-> Lens EcsCluster EcsCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcsCluster' {Maybe Text
registeredAt :: Maybe Text
$sel:registeredAt:EcsCluster' :: EcsCluster -> Maybe Text
registeredAt} -> Maybe Text
registeredAt) (\s :: EcsCluster
s@EcsCluster' {} Maybe Text
a -> EcsCluster
s {$sel:registeredAt:EcsCluster' :: Maybe Text
registeredAt = Maybe Text
a} :: EcsCluster)

-- | The stack ID.
ecsCluster_stackId :: Lens.Lens' EcsCluster (Prelude.Maybe Prelude.Text)
ecsCluster_stackId :: (Maybe Text -> f (Maybe Text)) -> EcsCluster -> f EcsCluster
ecsCluster_stackId = (EcsCluster -> Maybe Text)
-> (EcsCluster -> Maybe Text -> EcsCluster)
-> Lens EcsCluster EcsCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcsCluster' {Maybe Text
stackId :: Maybe Text
$sel:stackId:EcsCluster' :: EcsCluster -> Maybe Text
stackId} -> Maybe Text
stackId) (\s :: EcsCluster
s@EcsCluster' {} Maybe Text
a -> EcsCluster
s {$sel:stackId:EcsCluster' :: Maybe Text
stackId = Maybe Text
a} :: EcsCluster)

instance Core.FromJSON EcsCluster where
  parseJSON :: Value -> Parser EcsCluster
parseJSON =
    String
-> (Object -> Parser EcsCluster) -> Value -> Parser EcsCluster
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EcsCluster"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> EcsCluster
EcsCluster'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> EcsCluster)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> EcsCluster)
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
"EcsClusterArn")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> EcsCluster)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> EcsCluster)
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
"EcsClusterName")
            Parser (Maybe Text -> Maybe Text -> EcsCluster)
-> Parser (Maybe Text) -> Parser (Maybe Text -> EcsCluster)
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
"RegisteredAt")
            Parser (Maybe Text -> EcsCluster)
-> Parser (Maybe Text) -> Parser EcsCluster
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
"StackId")
      )

instance Prelude.Hashable EcsCluster

instance Prelude.NFData EcsCluster