{-# 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.GuardDuty.Types.EcsClusterDetails
-- 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.GuardDuty.Types.EcsClusterDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GuardDuty.Types.EcsTaskDetails
import Amazonka.GuardDuty.Types.Tag
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the details of the ECS Cluster.
--
-- /See:/ 'newEcsClusterDetails' smart constructor.
data EcsClusterDetails = EcsClusterDetails'
  { -- | The number of services that are running on the cluster in an ACTIVE
    -- state.
    EcsClusterDetails -> Maybe Int
activeServicesCount :: Prelude.Maybe Prelude.Int,
    -- | The Amazon Resource Name (ARN) that identifies the cluster.
    EcsClusterDetails -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the ECS Cluster.
    EcsClusterDetails -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The number of container instances registered into the cluster.
    EcsClusterDetails -> Maybe Int
registeredContainerInstancesCount :: Prelude.Maybe Prelude.Int,
    -- | The number of tasks in the cluster that are in the RUNNING state.
    EcsClusterDetails -> Maybe Int
runningTasksCount :: Prelude.Maybe Prelude.Int,
    -- | The status of the ECS cluster.
    EcsClusterDetails -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The tags of the ECS Cluster.
    EcsClusterDetails -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | Contains information about the details of the ECS Task.
    EcsClusterDetails -> Maybe EcsTaskDetails
taskDetails :: Prelude.Maybe EcsTaskDetails
  }
  deriving (EcsClusterDetails -> EcsClusterDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EcsClusterDetails -> EcsClusterDetails -> Bool
$c/= :: EcsClusterDetails -> EcsClusterDetails -> Bool
== :: EcsClusterDetails -> EcsClusterDetails -> Bool
$c== :: EcsClusterDetails -> EcsClusterDetails -> Bool
Prelude.Eq, ReadPrec [EcsClusterDetails]
ReadPrec EcsClusterDetails
Int -> ReadS EcsClusterDetails
ReadS [EcsClusterDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EcsClusterDetails]
$creadListPrec :: ReadPrec [EcsClusterDetails]
readPrec :: ReadPrec EcsClusterDetails
$creadPrec :: ReadPrec EcsClusterDetails
readList :: ReadS [EcsClusterDetails]
$creadList :: ReadS [EcsClusterDetails]
readsPrec :: Int -> ReadS EcsClusterDetails
$creadsPrec :: Int -> ReadS EcsClusterDetails
Prelude.Read, Int -> EcsClusterDetails -> ShowS
[EcsClusterDetails] -> ShowS
EcsClusterDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EcsClusterDetails] -> ShowS
$cshowList :: [EcsClusterDetails] -> ShowS
show :: EcsClusterDetails -> String
$cshow :: EcsClusterDetails -> String
showsPrec :: Int -> EcsClusterDetails -> ShowS
$cshowsPrec :: Int -> EcsClusterDetails -> ShowS
Prelude.Show, forall x. Rep EcsClusterDetails x -> EcsClusterDetails
forall x. EcsClusterDetails -> Rep EcsClusterDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EcsClusterDetails x -> EcsClusterDetails
$cfrom :: forall x. EcsClusterDetails -> Rep EcsClusterDetails x
Prelude.Generic)

-- |
-- Create a value of 'EcsClusterDetails' 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:
--
-- 'activeServicesCount', 'ecsClusterDetails_activeServicesCount' - The number of services that are running on the cluster in an ACTIVE
-- state.
--
-- 'arn', 'ecsClusterDetails_arn' - The Amazon Resource Name (ARN) that identifies the cluster.
--
-- 'name', 'ecsClusterDetails_name' - The name of the ECS Cluster.
--
-- 'registeredContainerInstancesCount', 'ecsClusterDetails_registeredContainerInstancesCount' - The number of container instances registered into the cluster.
--
-- 'runningTasksCount', 'ecsClusterDetails_runningTasksCount' - The number of tasks in the cluster that are in the RUNNING state.
--
-- 'status', 'ecsClusterDetails_status' - The status of the ECS cluster.
--
-- 'tags', 'ecsClusterDetails_tags' - The tags of the ECS Cluster.
--
-- 'taskDetails', 'ecsClusterDetails_taskDetails' - Contains information about the details of the ECS Task.
newEcsClusterDetails ::
  EcsClusterDetails
newEcsClusterDetails :: EcsClusterDetails
newEcsClusterDetails =
  EcsClusterDetails'
    { $sel:activeServicesCount:EcsClusterDetails' :: Maybe Int
activeServicesCount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:arn:EcsClusterDetails' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:name:EcsClusterDetails' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:registeredContainerInstancesCount:EcsClusterDetails' :: Maybe Int
registeredContainerInstancesCount = forall a. Maybe a
Prelude.Nothing,
      $sel:runningTasksCount:EcsClusterDetails' :: Maybe Int
runningTasksCount = forall a. Maybe a
Prelude.Nothing,
      $sel:status:EcsClusterDetails' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:EcsClusterDetails' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:taskDetails:EcsClusterDetails' :: Maybe EcsTaskDetails
taskDetails = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of services that are running on the cluster in an ACTIVE
-- state.
ecsClusterDetails_activeServicesCount :: Lens.Lens' EcsClusterDetails (Prelude.Maybe Prelude.Int)
ecsClusterDetails_activeServicesCount :: Lens' EcsClusterDetails (Maybe Int)
ecsClusterDetails_activeServicesCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcsClusterDetails' {Maybe Int
activeServicesCount :: Maybe Int
$sel:activeServicesCount:EcsClusterDetails' :: EcsClusterDetails -> Maybe Int
activeServicesCount} -> Maybe Int
activeServicesCount) (\s :: EcsClusterDetails
s@EcsClusterDetails' {} Maybe Int
a -> EcsClusterDetails
s {$sel:activeServicesCount:EcsClusterDetails' :: Maybe Int
activeServicesCount = Maybe Int
a} :: EcsClusterDetails)

-- | The Amazon Resource Name (ARN) that identifies the cluster.
ecsClusterDetails_arn :: Lens.Lens' EcsClusterDetails (Prelude.Maybe Prelude.Text)
ecsClusterDetails_arn :: Lens' EcsClusterDetails (Maybe Text)
ecsClusterDetails_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcsClusterDetails' {Maybe Text
arn :: Maybe Text
$sel:arn:EcsClusterDetails' :: EcsClusterDetails -> Maybe Text
arn} -> Maybe Text
arn) (\s :: EcsClusterDetails
s@EcsClusterDetails' {} Maybe Text
a -> EcsClusterDetails
s {$sel:arn:EcsClusterDetails' :: Maybe Text
arn = Maybe Text
a} :: EcsClusterDetails)

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

-- | The number of container instances registered into the cluster.
ecsClusterDetails_registeredContainerInstancesCount :: Lens.Lens' EcsClusterDetails (Prelude.Maybe Prelude.Int)
ecsClusterDetails_registeredContainerInstancesCount :: Lens' EcsClusterDetails (Maybe Int)
ecsClusterDetails_registeredContainerInstancesCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcsClusterDetails' {Maybe Int
registeredContainerInstancesCount :: Maybe Int
$sel:registeredContainerInstancesCount:EcsClusterDetails' :: EcsClusterDetails -> Maybe Int
registeredContainerInstancesCount} -> Maybe Int
registeredContainerInstancesCount) (\s :: EcsClusterDetails
s@EcsClusterDetails' {} Maybe Int
a -> EcsClusterDetails
s {$sel:registeredContainerInstancesCount:EcsClusterDetails' :: Maybe Int
registeredContainerInstancesCount = Maybe Int
a} :: EcsClusterDetails)

-- | The number of tasks in the cluster that are in the RUNNING state.
ecsClusterDetails_runningTasksCount :: Lens.Lens' EcsClusterDetails (Prelude.Maybe Prelude.Int)
ecsClusterDetails_runningTasksCount :: Lens' EcsClusterDetails (Maybe Int)
ecsClusterDetails_runningTasksCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcsClusterDetails' {Maybe Int
runningTasksCount :: Maybe Int
$sel:runningTasksCount:EcsClusterDetails' :: EcsClusterDetails -> Maybe Int
runningTasksCount} -> Maybe Int
runningTasksCount) (\s :: EcsClusterDetails
s@EcsClusterDetails' {} Maybe Int
a -> EcsClusterDetails
s {$sel:runningTasksCount:EcsClusterDetails' :: Maybe Int
runningTasksCount = Maybe Int
a} :: EcsClusterDetails)

-- | The status of the ECS cluster.
ecsClusterDetails_status :: Lens.Lens' EcsClusterDetails (Prelude.Maybe Prelude.Text)
ecsClusterDetails_status :: Lens' EcsClusterDetails (Maybe Text)
ecsClusterDetails_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcsClusterDetails' {Maybe Text
status :: Maybe Text
$sel:status:EcsClusterDetails' :: EcsClusterDetails -> Maybe Text
status} -> Maybe Text
status) (\s :: EcsClusterDetails
s@EcsClusterDetails' {} Maybe Text
a -> EcsClusterDetails
s {$sel:status:EcsClusterDetails' :: Maybe Text
status = Maybe Text
a} :: EcsClusterDetails)

-- | The tags of the ECS Cluster.
ecsClusterDetails_tags :: Lens.Lens' EcsClusterDetails (Prelude.Maybe [Tag])
ecsClusterDetails_tags :: Lens' EcsClusterDetails (Maybe [Tag])
ecsClusterDetails_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcsClusterDetails' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:EcsClusterDetails' :: EcsClusterDetails -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: EcsClusterDetails
s@EcsClusterDetails' {} Maybe [Tag]
a -> EcsClusterDetails
s {$sel:tags:EcsClusterDetails' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: EcsClusterDetails) 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

-- | Contains information about the details of the ECS Task.
ecsClusterDetails_taskDetails :: Lens.Lens' EcsClusterDetails (Prelude.Maybe EcsTaskDetails)
ecsClusterDetails_taskDetails :: Lens' EcsClusterDetails (Maybe EcsTaskDetails)
ecsClusterDetails_taskDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcsClusterDetails' {Maybe EcsTaskDetails
taskDetails :: Maybe EcsTaskDetails
$sel:taskDetails:EcsClusterDetails' :: EcsClusterDetails -> Maybe EcsTaskDetails
taskDetails} -> Maybe EcsTaskDetails
taskDetails) (\s :: EcsClusterDetails
s@EcsClusterDetails' {} Maybe EcsTaskDetails
a -> EcsClusterDetails
s {$sel:taskDetails:EcsClusterDetails' :: Maybe EcsTaskDetails
taskDetails = Maybe EcsTaskDetails
a} :: EcsClusterDetails)

instance Data.FromJSON EcsClusterDetails where
  parseJSON :: Value -> Parser EcsClusterDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EcsClusterDetails"
      ( \Object
x ->
          Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe [Tag]
-> Maybe EcsTaskDetails
-> EcsClusterDetails
EcsClusterDetails'
            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
"activeServicesCount")
            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
"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
"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
"registeredContainerInstancesCount")
            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
"runningTasksCount")
            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
"status")
            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)
            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
"taskDetails")
      )

instance Prelude.Hashable EcsClusterDetails where
  hashWithSalt :: Int -> EcsClusterDetails -> Int
hashWithSalt Int
_salt EcsClusterDetails' {Maybe Int
Maybe [Tag]
Maybe Text
Maybe EcsTaskDetails
taskDetails :: Maybe EcsTaskDetails
tags :: Maybe [Tag]
status :: Maybe Text
runningTasksCount :: Maybe Int
registeredContainerInstancesCount :: Maybe Int
name :: Maybe Text
arn :: Maybe Text
activeServicesCount :: Maybe Int
$sel:taskDetails:EcsClusterDetails' :: EcsClusterDetails -> Maybe EcsTaskDetails
$sel:tags:EcsClusterDetails' :: EcsClusterDetails -> Maybe [Tag]
$sel:status:EcsClusterDetails' :: EcsClusterDetails -> Maybe Text
$sel:runningTasksCount:EcsClusterDetails' :: EcsClusterDetails -> Maybe Int
$sel:registeredContainerInstancesCount:EcsClusterDetails' :: EcsClusterDetails -> Maybe Int
$sel:name:EcsClusterDetails' :: EcsClusterDetails -> Maybe Text
$sel:arn:EcsClusterDetails' :: EcsClusterDetails -> Maybe Text
$sel:activeServicesCount:EcsClusterDetails' :: EcsClusterDetails -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
activeServicesCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
registeredContainerInstancesCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
runningTasksCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EcsTaskDetails
taskDetails

instance Prelude.NFData EcsClusterDetails where
  rnf :: EcsClusterDetails -> ()
rnf EcsClusterDetails' {Maybe Int
Maybe [Tag]
Maybe Text
Maybe EcsTaskDetails
taskDetails :: Maybe EcsTaskDetails
tags :: Maybe [Tag]
status :: Maybe Text
runningTasksCount :: Maybe Int
registeredContainerInstancesCount :: Maybe Int
name :: Maybe Text
arn :: Maybe Text
activeServicesCount :: Maybe Int
$sel:taskDetails:EcsClusterDetails' :: EcsClusterDetails -> Maybe EcsTaskDetails
$sel:tags:EcsClusterDetails' :: EcsClusterDetails -> Maybe [Tag]
$sel:status:EcsClusterDetails' :: EcsClusterDetails -> Maybe Text
$sel:runningTasksCount:EcsClusterDetails' :: EcsClusterDetails -> Maybe Int
$sel:registeredContainerInstancesCount:EcsClusterDetails' :: EcsClusterDetails -> Maybe Int
$sel:name:EcsClusterDetails' :: EcsClusterDetails -> Maybe Text
$sel:arn:EcsClusterDetails' :: EcsClusterDetails -> Maybe Text
$sel:activeServicesCount:EcsClusterDetails' :: EcsClusterDetails -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
activeServicesCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
registeredContainerInstancesCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
runningTasksCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EcsTaskDetails
taskDetails