{-# 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.Route53AutoNaming.Types.HttpInstanceSummary
-- 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.Route53AutoNaming.Types.HttpInstanceSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53AutoNaming.Types.HealthStatus

-- | In a response to a
-- <https://docs.aws.amazon.com/cloud-map/latest/api/API_DiscoverInstances.html DiscoverInstances>
-- request, @HttpInstanceSummary@ contains information about one instance
-- that matches the values that you specified in the request.
--
-- /See:/ 'newHttpInstanceSummary' smart constructor.
data HttpInstanceSummary = HttpInstanceSummary'
  { -- | The ID of an instance that matches the values that you specified in the
    -- request.
    HttpInstanceSummary -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text,
    -- | @@ @@ @@
    --
    -- The @HttpName@ name of the namespace. It\'s found in the
    -- @HttpProperties@ member of the @Properties@ member of the namespace.
    HttpInstanceSummary -> Maybe Text
namespaceName :: Prelude.Maybe Prelude.Text,
    -- | If you included any attributes when you registered the instance, the
    -- values of those attributes.
    HttpInstanceSummary -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the service that you specified when you registered the
    -- instance.
    HttpInstanceSummary -> Maybe Text
serviceName :: Prelude.Maybe Prelude.Text,
    -- | If you configured health checking in the service, the current health
    -- status of the service instance.
    HttpInstanceSummary -> Maybe HealthStatus
healthStatus :: Prelude.Maybe HealthStatus
  }
  deriving (HttpInstanceSummary -> HttpInstanceSummary -> Bool
(HttpInstanceSummary -> HttpInstanceSummary -> Bool)
-> (HttpInstanceSummary -> HttpInstanceSummary -> Bool)
-> Eq HttpInstanceSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HttpInstanceSummary -> HttpInstanceSummary -> Bool
$c/= :: HttpInstanceSummary -> HttpInstanceSummary -> Bool
== :: HttpInstanceSummary -> HttpInstanceSummary -> Bool
$c== :: HttpInstanceSummary -> HttpInstanceSummary -> Bool
Prelude.Eq, ReadPrec [HttpInstanceSummary]
ReadPrec HttpInstanceSummary
Int -> ReadS HttpInstanceSummary
ReadS [HttpInstanceSummary]
(Int -> ReadS HttpInstanceSummary)
-> ReadS [HttpInstanceSummary]
-> ReadPrec HttpInstanceSummary
-> ReadPrec [HttpInstanceSummary]
-> Read HttpInstanceSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HttpInstanceSummary]
$creadListPrec :: ReadPrec [HttpInstanceSummary]
readPrec :: ReadPrec HttpInstanceSummary
$creadPrec :: ReadPrec HttpInstanceSummary
readList :: ReadS [HttpInstanceSummary]
$creadList :: ReadS [HttpInstanceSummary]
readsPrec :: Int -> ReadS HttpInstanceSummary
$creadsPrec :: Int -> ReadS HttpInstanceSummary
Prelude.Read, Int -> HttpInstanceSummary -> ShowS
[HttpInstanceSummary] -> ShowS
HttpInstanceSummary -> String
(Int -> HttpInstanceSummary -> ShowS)
-> (HttpInstanceSummary -> String)
-> ([HttpInstanceSummary] -> ShowS)
-> Show HttpInstanceSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HttpInstanceSummary] -> ShowS
$cshowList :: [HttpInstanceSummary] -> ShowS
show :: HttpInstanceSummary -> String
$cshow :: HttpInstanceSummary -> String
showsPrec :: Int -> HttpInstanceSummary -> ShowS
$cshowsPrec :: Int -> HttpInstanceSummary -> ShowS
Prelude.Show, (forall x. HttpInstanceSummary -> Rep HttpInstanceSummary x)
-> (forall x. Rep HttpInstanceSummary x -> HttpInstanceSummary)
-> Generic HttpInstanceSummary
forall x. Rep HttpInstanceSummary x -> HttpInstanceSummary
forall x. HttpInstanceSummary -> Rep HttpInstanceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HttpInstanceSummary x -> HttpInstanceSummary
$cfrom :: forall x. HttpInstanceSummary -> Rep HttpInstanceSummary x
Prelude.Generic)

-- |
-- Create a value of 'HttpInstanceSummary' 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:
--
-- 'instanceId', 'httpInstanceSummary_instanceId' - The ID of an instance that matches the values that you specified in the
-- request.
--
-- 'namespaceName', 'httpInstanceSummary_namespaceName' - @@ @@ @@
--
-- The @HttpName@ name of the namespace. It\'s found in the
-- @HttpProperties@ member of the @Properties@ member of the namespace.
--
-- 'attributes', 'httpInstanceSummary_attributes' - If you included any attributes when you registered the instance, the
-- values of those attributes.
--
-- 'serviceName', 'httpInstanceSummary_serviceName' - The name of the service that you specified when you registered the
-- instance.
--
-- 'healthStatus', 'httpInstanceSummary_healthStatus' - If you configured health checking in the service, the current health
-- status of the service instance.
newHttpInstanceSummary ::
  HttpInstanceSummary
newHttpInstanceSummary :: HttpInstanceSummary
newHttpInstanceSummary =
  HttpInstanceSummary' :: Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe HealthStatus
-> HttpInstanceSummary
HttpInstanceSummary'
    { $sel:instanceId:HttpInstanceSummary' :: Maybe Text
instanceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:namespaceName:HttpInstanceSummary' :: Maybe Text
namespaceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attributes:HttpInstanceSummary' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceName:HttpInstanceSummary' :: Maybe Text
serviceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:healthStatus:HttpInstanceSummary' :: Maybe HealthStatus
healthStatus = Maybe HealthStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of an instance that matches the values that you specified in the
-- request.
httpInstanceSummary_instanceId :: Lens.Lens' HttpInstanceSummary (Prelude.Maybe Prelude.Text)
httpInstanceSummary_instanceId :: (Maybe Text -> f (Maybe Text))
-> HttpInstanceSummary -> f HttpInstanceSummary
httpInstanceSummary_instanceId = (HttpInstanceSummary -> Maybe Text)
-> (HttpInstanceSummary -> Maybe Text -> HttpInstanceSummary)
-> Lens
     HttpInstanceSummary HttpInstanceSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpInstanceSummary' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:HttpInstanceSummary' :: HttpInstanceSummary -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: HttpInstanceSummary
s@HttpInstanceSummary' {} Maybe Text
a -> HttpInstanceSummary
s {$sel:instanceId:HttpInstanceSummary' :: Maybe Text
instanceId = Maybe Text
a} :: HttpInstanceSummary)

-- | @@ @@ @@
--
-- The @HttpName@ name of the namespace. It\'s found in the
-- @HttpProperties@ member of the @Properties@ member of the namespace.
httpInstanceSummary_namespaceName :: Lens.Lens' HttpInstanceSummary (Prelude.Maybe Prelude.Text)
httpInstanceSummary_namespaceName :: (Maybe Text -> f (Maybe Text))
-> HttpInstanceSummary -> f HttpInstanceSummary
httpInstanceSummary_namespaceName = (HttpInstanceSummary -> Maybe Text)
-> (HttpInstanceSummary -> Maybe Text -> HttpInstanceSummary)
-> Lens
     HttpInstanceSummary HttpInstanceSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpInstanceSummary' {Maybe Text
namespaceName :: Maybe Text
$sel:namespaceName:HttpInstanceSummary' :: HttpInstanceSummary -> Maybe Text
namespaceName} -> Maybe Text
namespaceName) (\s :: HttpInstanceSummary
s@HttpInstanceSummary' {} Maybe Text
a -> HttpInstanceSummary
s {$sel:namespaceName:HttpInstanceSummary' :: Maybe Text
namespaceName = Maybe Text
a} :: HttpInstanceSummary)

-- | If you included any attributes when you registered the instance, the
-- values of those attributes.
httpInstanceSummary_attributes :: Lens.Lens' HttpInstanceSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
httpInstanceSummary_attributes :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> HttpInstanceSummary -> f HttpInstanceSummary
httpInstanceSummary_attributes = (HttpInstanceSummary -> Maybe (HashMap Text Text))
-> (HttpInstanceSummary
    -> Maybe (HashMap Text Text) -> HttpInstanceSummary)
-> Lens
     HttpInstanceSummary
     HttpInstanceSummary
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpInstanceSummary' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:HttpInstanceSummary' :: HttpInstanceSummary -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: HttpInstanceSummary
s@HttpInstanceSummary' {} Maybe (HashMap Text Text)
a -> HttpInstanceSummary
s {$sel:attributes:HttpInstanceSummary' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: HttpInstanceSummary) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> HttpInstanceSummary -> f HttpInstanceSummary)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> HttpInstanceSummary
-> f HttpInstanceSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the service that you specified when you registered the
-- instance.
httpInstanceSummary_serviceName :: Lens.Lens' HttpInstanceSummary (Prelude.Maybe Prelude.Text)
httpInstanceSummary_serviceName :: (Maybe Text -> f (Maybe Text))
-> HttpInstanceSummary -> f HttpInstanceSummary
httpInstanceSummary_serviceName = (HttpInstanceSummary -> Maybe Text)
-> (HttpInstanceSummary -> Maybe Text -> HttpInstanceSummary)
-> Lens
     HttpInstanceSummary HttpInstanceSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpInstanceSummary' {Maybe Text
serviceName :: Maybe Text
$sel:serviceName:HttpInstanceSummary' :: HttpInstanceSummary -> Maybe Text
serviceName} -> Maybe Text
serviceName) (\s :: HttpInstanceSummary
s@HttpInstanceSummary' {} Maybe Text
a -> HttpInstanceSummary
s {$sel:serviceName:HttpInstanceSummary' :: Maybe Text
serviceName = Maybe Text
a} :: HttpInstanceSummary)

-- | If you configured health checking in the service, the current health
-- status of the service instance.
httpInstanceSummary_healthStatus :: Lens.Lens' HttpInstanceSummary (Prelude.Maybe HealthStatus)
httpInstanceSummary_healthStatus :: (Maybe HealthStatus -> f (Maybe HealthStatus))
-> HttpInstanceSummary -> f HttpInstanceSummary
httpInstanceSummary_healthStatus = (HttpInstanceSummary -> Maybe HealthStatus)
-> (HttpInstanceSummary
    -> Maybe HealthStatus -> HttpInstanceSummary)
-> Lens
     HttpInstanceSummary
     HttpInstanceSummary
     (Maybe HealthStatus)
     (Maybe HealthStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpInstanceSummary' {Maybe HealthStatus
healthStatus :: Maybe HealthStatus
$sel:healthStatus:HttpInstanceSummary' :: HttpInstanceSummary -> Maybe HealthStatus
healthStatus} -> Maybe HealthStatus
healthStatus) (\s :: HttpInstanceSummary
s@HttpInstanceSummary' {} Maybe HealthStatus
a -> HttpInstanceSummary
s {$sel:healthStatus:HttpInstanceSummary' :: Maybe HealthStatus
healthStatus = Maybe HealthStatus
a} :: HttpInstanceSummary)

instance Core.FromJSON HttpInstanceSummary where
  parseJSON :: Value -> Parser HttpInstanceSummary
parseJSON =
    String
-> (Object -> Parser HttpInstanceSummary)
-> Value
-> Parser HttpInstanceSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HttpInstanceSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe HealthStatus
-> HttpInstanceSummary
HttpInstanceSummary'
            (Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe Text
 -> Maybe HealthStatus
 -> HttpInstanceSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> Maybe HealthStatus
      -> HttpInstanceSummary)
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
"InstanceId")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe Text
   -> Maybe HealthStatus
   -> HttpInstanceSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe Text -> Maybe HealthStatus -> HttpInstanceSummary)
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
"NamespaceName")
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe Text -> Maybe HealthStatus -> HttpInstanceSummary)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Maybe Text -> Maybe HealthStatus -> HttpInstanceSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Attributes" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> Maybe HealthStatus -> HttpInstanceSummary)
-> Parser (Maybe Text)
-> Parser (Maybe HealthStatus -> HttpInstanceSummary)
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
"ServiceName")
            Parser (Maybe HealthStatus -> HttpInstanceSummary)
-> Parser (Maybe HealthStatus) -> Parser HttpInstanceSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HealthStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HealthStatus")
      )

instance Prelude.Hashable HttpInstanceSummary

instance Prelude.NFData HttpInstanceSummary