{-# 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.SSMSAP.Types.Host
-- 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.SSMSAP.Types.Host 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.SSMSAP.Types.HostRole

-- |
--
-- /See:/ 'newHost' smart constructor.
data Host = Host'
  { Host -> Maybe Text
hostIp :: Prelude.Maybe Prelude.Text,
    Host -> Maybe Text
hostName :: Prelude.Maybe Prelude.Text,
    Host -> Maybe HostRole
hostRole :: Prelude.Maybe HostRole,
    Host -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text
  }
  deriving (Host -> Host -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Host -> Host -> Bool
$c/= :: Host -> Host -> Bool
== :: Host -> Host -> Bool
$c== :: Host -> Host -> Bool
Prelude.Eq, ReadPrec [Host]
ReadPrec Host
Int -> ReadS Host
ReadS [Host]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Host]
$creadListPrec :: ReadPrec [Host]
readPrec :: ReadPrec Host
$creadPrec :: ReadPrec Host
readList :: ReadS [Host]
$creadList :: ReadS [Host]
readsPrec :: Int -> ReadS Host
$creadsPrec :: Int -> ReadS Host
Prelude.Read, Int -> Host -> ShowS
[Host] -> ShowS
Host -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Host] -> ShowS
$cshowList :: [Host] -> ShowS
show :: Host -> String
$cshow :: Host -> String
showsPrec :: Int -> Host -> ShowS
$cshowsPrec :: Int -> Host -> ShowS
Prelude.Show, forall x. Rep Host x -> Host
forall x. Host -> Rep Host x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Host x -> Host
$cfrom :: forall x. Host -> Rep Host x
Prelude.Generic)

-- |
-- Create a value of 'Host' 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:
--
-- 'hostIp', 'host_hostIp' -
--
-- 'hostName', 'host_hostName' -
--
-- 'hostRole', 'host_hostRole' -
--
-- 'instanceId', 'host_instanceId' -
newHost ::
  Host
newHost :: Host
newHost =
  Host'
    { $sel:hostIp:Host' :: Maybe Text
hostIp = forall a. Maybe a
Prelude.Nothing,
      $sel:hostName:Host' :: Maybe Text
hostName = forall a. Maybe a
Prelude.Nothing,
      $sel:hostRole:Host' :: Maybe HostRole
hostRole = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceId:Host' :: Maybe Text
instanceId = forall a. Maybe a
Prelude.Nothing
    }

host_hostIp :: Lens.Lens' Host (Prelude.Maybe Prelude.Text)
host_hostIp :: Lens' Host (Maybe Text)
host_hostIp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Host' {Maybe Text
hostIp :: Maybe Text
$sel:hostIp:Host' :: Host -> Maybe Text
hostIp} -> Maybe Text
hostIp) (\s :: Host
s@Host' {} Maybe Text
a -> Host
s {$sel:hostIp:Host' :: Maybe Text
hostIp = Maybe Text
a} :: Host)

host_hostName :: Lens.Lens' Host (Prelude.Maybe Prelude.Text)
host_hostName :: Lens' Host (Maybe Text)
host_hostName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Host' {Maybe Text
hostName :: Maybe Text
$sel:hostName:Host' :: Host -> Maybe Text
hostName} -> Maybe Text
hostName) (\s :: Host
s@Host' {} Maybe Text
a -> Host
s {$sel:hostName:Host' :: Maybe Text
hostName = Maybe Text
a} :: Host)

host_hostRole :: Lens.Lens' Host (Prelude.Maybe HostRole)
host_hostRole :: Lens' Host (Maybe HostRole)
host_hostRole = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Host' {Maybe HostRole
hostRole :: Maybe HostRole
$sel:hostRole:Host' :: Host -> Maybe HostRole
hostRole} -> Maybe HostRole
hostRole) (\s :: Host
s@Host' {} Maybe HostRole
a -> Host
s {$sel:hostRole:Host' :: Maybe HostRole
hostRole = Maybe HostRole
a} :: Host)

host_instanceId :: Lens.Lens' Host (Prelude.Maybe Prelude.Text)
host_instanceId :: Lens' Host (Maybe Text)
host_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Host' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:Host' :: Host -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: Host
s@Host' {} Maybe Text
a -> Host
s {$sel:instanceId:Host' :: Maybe Text
instanceId = Maybe Text
a} :: Host)

instance Data.FromJSON Host where
  parseJSON :: Value -> Parser Host
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Host"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe HostRole -> Maybe Text -> Host
Host'
            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
"HostIp")
            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
"HostName")
            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
"HostRole")
            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
"InstanceId")
      )

instance Prelude.Hashable Host where
  hashWithSalt :: Int -> Host -> Int
hashWithSalt Int
_salt Host' {Maybe Text
Maybe HostRole
instanceId :: Maybe Text
hostRole :: Maybe HostRole
hostName :: Maybe Text
hostIp :: Maybe Text
$sel:instanceId:Host' :: Host -> Maybe Text
$sel:hostRole:Host' :: Host -> Maybe HostRole
$sel:hostName:Host' :: Host -> Maybe Text
$sel:hostIp:Host' :: Host -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hostIp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hostName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HostRole
hostRole
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceId

instance Prelude.NFData Host where
  rnf :: Host -> ()
rnf Host' {Maybe Text
Maybe HostRole
instanceId :: Maybe Text
hostRole :: Maybe HostRole
hostName :: Maybe Text
hostIp :: Maybe Text
$sel:instanceId:Host' :: Host -> Maybe Text
$sel:hostRole:Host' :: Host -> Maybe HostRole
$sel:hostName:Host' :: Host -> Maybe Text
$sel:hostIp:Host' :: Host -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hostIp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hostName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe HostRole
hostRole
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
instanceId