{-# 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.DMS.Types.CollectorHealthCheck
-- 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.DMS.Types.CollectorHealthCheck where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.DMS.Types.CollectorStatus
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Describes the last Fleet Advisor collector health check.
--
-- /See:/ 'newCollectorHealthCheck' smart constructor.
data CollectorHealthCheck = CollectorHealthCheck'
  { -- | The status of the Fleet Advisor collector.
    CollectorHealthCheck -> Maybe CollectorStatus
collectorStatus :: Prelude.Maybe CollectorStatus,
    -- | Whether the local collector can access its Amazon S3 bucket.
    CollectorHealthCheck -> Maybe Bool
localCollectorS3Access :: Prelude.Maybe Prelude.Bool,
    -- | Whether the role that you provided when creating the Fleet Advisor
    -- collector has sufficient permissions to access the Fleet Advisor web
    -- collector.
    CollectorHealthCheck -> Maybe Bool
webCollectorGrantedRoleBasedAccess :: Prelude.Maybe Prelude.Bool,
    -- | Whether the web collector can access its Amazon S3 bucket.
    CollectorHealthCheck -> Maybe Bool
webCollectorS3Access :: Prelude.Maybe Prelude.Bool
  }
  deriving (CollectorHealthCheck -> CollectorHealthCheck -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CollectorHealthCheck -> CollectorHealthCheck -> Bool
$c/= :: CollectorHealthCheck -> CollectorHealthCheck -> Bool
== :: CollectorHealthCheck -> CollectorHealthCheck -> Bool
$c== :: CollectorHealthCheck -> CollectorHealthCheck -> Bool
Prelude.Eq, ReadPrec [CollectorHealthCheck]
ReadPrec CollectorHealthCheck
Int -> ReadS CollectorHealthCheck
ReadS [CollectorHealthCheck]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CollectorHealthCheck]
$creadListPrec :: ReadPrec [CollectorHealthCheck]
readPrec :: ReadPrec CollectorHealthCheck
$creadPrec :: ReadPrec CollectorHealthCheck
readList :: ReadS [CollectorHealthCheck]
$creadList :: ReadS [CollectorHealthCheck]
readsPrec :: Int -> ReadS CollectorHealthCheck
$creadsPrec :: Int -> ReadS CollectorHealthCheck
Prelude.Read, Int -> CollectorHealthCheck -> ShowS
[CollectorHealthCheck] -> ShowS
CollectorHealthCheck -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CollectorHealthCheck] -> ShowS
$cshowList :: [CollectorHealthCheck] -> ShowS
show :: CollectorHealthCheck -> String
$cshow :: CollectorHealthCheck -> String
showsPrec :: Int -> CollectorHealthCheck -> ShowS
$cshowsPrec :: Int -> CollectorHealthCheck -> ShowS
Prelude.Show, forall x. Rep CollectorHealthCheck x -> CollectorHealthCheck
forall x. CollectorHealthCheck -> Rep CollectorHealthCheck x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CollectorHealthCheck x -> CollectorHealthCheck
$cfrom :: forall x. CollectorHealthCheck -> Rep CollectorHealthCheck x
Prelude.Generic)

-- |
-- Create a value of 'CollectorHealthCheck' 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:
--
-- 'collectorStatus', 'collectorHealthCheck_collectorStatus' - The status of the Fleet Advisor collector.
--
-- 'localCollectorS3Access', 'collectorHealthCheck_localCollectorS3Access' - Whether the local collector can access its Amazon S3 bucket.
--
-- 'webCollectorGrantedRoleBasedAccess', 'collectorHealthCheck_webCollectorGrantedRoleBasedAccess' - Whether the role that you provided when creating the Fleet Advisor
-- collector has sufficient permissions to access the Fleet Advisor web
-- collector.
--
-- 'webCollectorS3Access', 'collectorHealthCheck_webCollectorS3Access' - Whether the web collector can access its Amazon S3 bucket.
newCollectorHealthCheck ::
  CollectorHealthCheck
newCollectorHealthCheck :: CollectorHealthCheck
newCollectorHealthCheck =
  CollectorHealthCheck'
    { $sel:collectorStatus:CollectorHealthCheck' :: Maybe CollectorStatus
collectorStatus =
        forall a. Maybe a
Prelude.Nothing,
      $sel:localCollectorS3Access:CollectorHealthCheck' :: Maybe Bool
localCollectorS3Access = forall a. Maybe a
Prelude.Nothing,
      $sel:webCollectorGrantedRoleBasedAccess:CollectorHealthCheck' :: Maybe Bool
webCollectorGrantedRoleBasedAccess = forall a. Maybe a
Prelude.Nothing,
      $sel:webCollectorS3Access:CollectorHealthCheck' :: Maybe Bool
webCollectorS3Access = forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the Fleet Advisor collector.
collectorHealthCheck_collectorStatus :: Lens.Lens' CollectorHealthCheck (Prelude.Maybe CollectorStatus)
collectorHealthCheck_collectorStatus :: Lens' CollectorHealthCheck (Maybe CollectorStatus)
collectorHealthCheck_collectorStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CollectorHealthCheck' {Maybe CollectorStatus
collectorStatus :: Maybe CollectorStatus
$sel:collectorStatus:CollectorHealthCheck' :: CollectorHealthCheck -> Maybe CollectorStatus
collectorStatus} -> Maybe CollectorStatus
collectorStatus) (\s :: CollectorHealthCheck
s@CollectorHealthCheck' {} Maybe CollectorStatus
a -> CollectorHealthCheck
s {$sel:collectorStatus:CollectorHealthCheck' :: Maybe CollectorStatus
collectorStatus = Maybe CollectorStatus
a} :: CollectorHealthCheck)

-- | Whether the local collector can access its Amazon S3 bucket.
collectorHealthCheck_localCollectorS3Access :: Lens.Lens' CollectorHealthCheck (Prelude.Maybe Prelude.Bool)
collectorHealthCheck_localCollectorS3Access :: Lens' CollectorHealthCheck (Maybe Bool)
collectorHealthCheck_localCollectorS3Access = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CollectorHealthCheck' {Maybe Bool
localCollectorS3Access :: Maybe Bool
$sel:localCollectorS3Access:CollectorHealthCheck' :: CollectorHealthCheck -> Maybe Bool
localCollectorS3Access} -> Maybe Bool
localCollectorS3Access) (\s :: CollectorHealthCheck
s@CollectorHealthCheck' {} Maybe Bool
a -> CollectorHealthCheck
s {$sel:localCollectorS3Access:CollectorHealthCheck' :: Maybe Bool
localCollectorS3Access = Maybe Bool
a} :: CollectorHealthCheck)

-- | Whether the role that you provided when creating the Fleet Advisor
-- collector has sufficient permissions to access the Fleet Advisor web
-- collector.
collectorHealthCheck_webCollectorGrantedRoleBasedAccess :: Lens.Lens' CollectorHealthCheck (Prelude.Maybe Prelude.Bool)
collectorHealthCheck_webCollectorGrantedRoleBasedAccess :: Lens' CollectorHealthCheck (Maybe Bool)
collectorHealthCheck_webCollectorGrantedRoleBasedAccess = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CollectorHealthCheck' {Maybe Bool
webCollectorGrantedRoleBasedAccess :: Maybe Bool
$sel:webCollectorGrantedRoleBasedAccess:CollectorHealthCheck' :: CollectorHealthCheck -> Maybe Bool
webCollectorGrantedRoleBasedAccess} -> Maybe Bool
webCollectorGrantedRoleBasedAccess) (\s :: CollectorHealthCheck
s@CollectorHealthCheck' {} Maybe Bool
a -> CollectorHealthCheck
s {$sel:webCollectorGrantedRoleBasedAccess:CollectorHealthCheck' :: Maybe Bool
webCollectorGrantedRoleBasedAccess = Maybe Bool
a} :: CollectorHealthCheck)

-- | Whether the web collector can access its Amazon S3 bucket.
collectorHealthCheck_webCollectorS3Access :: Lens.Lens' CollectorHealthCheck (Prelude.Maybe Prelude.Bool)
collectorHealthCheck_webCollectorS3Access :: Lens' CollectorHealthCheck (Maybe Bool)
collectorHealthCheck_webCollectorS3Access = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CollectorHealthCheck' {Maybe Bool
webCollectorS3Access :: Maybe Bool
$sel:webCollectorS3Access:CollectorHealthCheck' :: CollectorHealthCheck -> Maybe Bool
webCollectorS3Access} -> Maybe Bool
webCollectorS3Access) (\s :: CollectorHealthCheck
s@CollectorHealthCheck' {} Maybe Bool
a -> CollectorHealthCheck
s {$sel:webCollectorS3Access:CollectorHealthCheck' :: Maybe Bool
webCollectorS3Access = Maybe Bool
a} :: CollectorHealthCheck)

instance Data.FromJSON CollectorHealthCheck where
  parseJSON :: Value -> Parser CollectorHealthCheck
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CollectorHealthCheck"
      ( \Object
x ->
          Maybe CollectorStatus
-> Maybe Bool -> Maybe Bool -> Maybe Bool -> CollectorHealthCheck
CollectorHealthCheck'
            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
"CollectorStatus")
            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
"LocalCollectorS3Access")
            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
"WebCollectorGrantedRoleBasedAccess")
            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
"WebCollectorS3Access")
      )

instance Prelude.Hashable CollectorHealthCheck where
  hashWithSalt :: Int -> CollectorHealthCheck -> Int
hashWithSalt Int
_salt CollectorHealthCheck' {Maybe Bool
Maybe CollectorStatus
webCollectorS3Access :: Maybe Bool
webCollectorGrantedRoleBasedAccess :: Maybe Bool
localCollectorS3Access :: Maybe Bool
collectorStatus :: Maybe CollectorStatus
$sel:webCollectorS3Access:CollectorHealthCheck' :: CollectorHealthCheck -> Maybe Bool
$sel:webCollectorGrantedRoleBasedAccess:CollectorHealthCheck' :: CollectorHealthCheck -> Maybe Bool
$sel:localCollectorS3Access:CollectorHealthCheck' :: CollectorHealthCheck -> Maybe Bool
$sel:collectorStatus:CollectorHealthCheck' :: CollectorHealthCheck -> Maybe CollectorStatus
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CollectorStatus
collectorStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
localCollectorS3Access
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
webCollectorGrantedRoleBasedAccess
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
webCollectorS3Access

instance Prelude.NFData CollectorHealthCheck where
  rnf :: CollectorHealthCheck -> ()
rnf CollectorHealthCheck' {Maybe Bool
Maybe CollectorStatus
webCollectorS3Access :: Maybe Bool
webCollectorGrantedRoleBasedAccess :: Maybe Bool
localCollectorS3Access :: Maybe Bool
collectorStatus :: Maybe CollectorStatus
$sel:webCollectorS3Access:CollectorHealthCheck' :: CollectorHealthCheck -> Maybe Bool
$sel:webCollectorGrantedRoleBasedAccess:CollectorHealthCheck' :: CollectorHealthCheck -> Maybe Bool
$sel:localCollectorS3Access:CollectorHealthCheck' :: CollectorHealthCheck -> Maybe Bool
$sel:collectorStatus:CollectorHealthCheck' :: CollectorHealthCheck -> Maybe CollectorStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CollectorStatus
collectorStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
localCollectorS3Access
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
webCollectorGrantedRoleBasedAccess
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
webCollectorS3Access