{-# 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.InstanceSummary
-- 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.InstanceSummary where

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

-- | A complex type that contains information about the instances that you
-- registered by using a specified service.
--
-- /See:/ 'newInstanceSummary' smart constructor.
data InstanceSummary = InstanceSummary'
  { -- | A string map that contains the following information:
    --
    -- -   The attributes that are associated with the instance.
    --
    -- -   For each attribute, the applicable value.
    --
    -- Supported attribute keys include the following:
    --
    -- [AWS_ALIAS_DNS_NAME]
    --     For an alias record that routes traffic to an Elastic Load Balancing
    --     load balancer, the DNS name that\'s associated with the load
    --     balancer.
    --
    -- [AWS_EC2_INSTANCE_ID (HTTP namespaces only)]
    --     The Amazon EC2 instance ID for the instance. When the
    --     @AWS_EC2_INSTANCE_ID@ attribute is specified, then the
    --     @AWS_INSTANCE_IPV4@ attribute contains the primary private IPv4
    --     address.
    --
    -- [AWS_INIT_HEALTH_STATUS]
    --     If the service configuration includes @HealthCheckCustomConfig@, you
    --     can optionally use @AWS_INIT_HEALTH_STATUS@ to specify the initial
    --     status of the custom health check, @HEALTHY@ or @UNHEALTHY@. If you
    --     don\'t specify a value for @AWS_INIT_HEALTH_STATUS@, the initial
    --     status is @HEALTHY@.
    --
    -- [AWS_INSTANCE_CNAME]
    --     For a @CNAME@ record, the domain name that Route 53 returns in
    --     response to DNS queries (for example, @example.com@).
    --
    -- [AWS_INSTANCE_IPV4]
    --     For an @A@ record, the IPv4 address that Route 53 returns in
    --     response to DNS queries (for example, @192.0.2.44@).
    --
    -- [AWS_INSTANCE_IPV6]
    --     For an @AAAA@ record, the IPv6 address that Route 53 returns in
    --     response to DNS queries (for example,
    --     @2001:0db8:85a3:0000:0000:abcd:0001:2345@).
    --
    -- [AWS_INSTANCE_PORT]
    --     For an @SRV@ record, the value that Route 53 returns for the port.
    --     In addition, if the service includes @HealthCheckConfig@, the port
    --     on the endpoint that Route 53 sends requests to.
    InstanceSummary -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The ID for an instance that you created by using a specified service.
    InstanceSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (InstanceSummary -> InstanceSummary -> Bool
(InstanceSummary -> InstanceSummary -> Bool)
-> (InstanceSummary -> InstanceSummary -> Bool)
-> Eq InstanceSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceSummary -> InstanceSummary -> Bool
$c/= :: InstanceSummary -> InstanceSummary -> Bool
== :: InstanceSummary -> InstanceSummary -> Bool
$c== :: InstanceSummary -> InstanceSummary -> Bool
Prelude.Eq, ReadPrec [InstanceSummary]
ReadPrec InstanceSummary
Int -> ReadS InstanceSummary
ReadS [InstanceSummary]
(Int -> ReadS InstanceSummary)
-> ReadS [InstanceSummary]
-> ReadPrec InstanceSummary
-> ReadPrec [InstanceSummary]
-> Read InstanceSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceSummary]
$creadListPrec :: ReadPrec [InstanceSummary]
readPrec :: ReadPrec InstanceSummary
$creadPrec :: ReadPrec InstanceSummary
readList :: ReadS [InstanceSummary]
$creadList :: ReadS [InstanceSummary]
readsPrec :: Int -> ReadS InstanceSummary
$creadsPrec :: Int -> ReadS InstanceSummary
Prelude.Read, Int -> InstanceSummary -> ShowS
[InstanceSummary] -> ShowS
InstanceSummary -> String
(Int -> InstanceSummary -> ShowS)
-> (InstanceSummary -> String)
-> ([InstanceSummary] -> ShowS)
-> Show InstanceSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceSummary] -> ShowS
$cshowList :: [InstanceSummary] -> ShowS
show :: InstanceSummary -> String
$cshow :: InstanceSummary -> String
showsPrec :: Int -> InstanceSummary -> ShowS
$cshowsPrec :: Int -> InstanceSummary -> ShowS
Prelude.Show, (forall x. InstanceSummary -> Rep InstanceSummary x)
-> (forall x. Rep InstanceSummary x -> InstanceSummary)
-> Generic InstanceSummary
forall x. Rep InstanceSummary x -> InstanceSummary
forall x. InstanceSummary -> Rep InstanceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceSummary x -> InstanceSummary
$cfrom :: forall x. InstanceSummary -> Rep InstanceSummary x
Prelude.Generic)

-- |
-- Create a value of 'InstanceSummary' 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:
--
-- 'attributes', 'instanceSummary_attributes' - A string map that contains the following information:
--
-- -   The attributes that are associated with the instance.
--
-- -   For each attribute, the applicable value.
--
-- Supported attribute keys include the following:
--
-- [AWS_ALIAS_DNS_NAME]
--     For an alias record that routes traffic to an Elastic Load Balancing
--     load balancer, the DNS name that\'s associated with the load
--     balancer.
--
-- [AWS_EC2_INSTANCE_ID (HTTP namespaces only)]
--     The Amazon EC2 instance ID for the instance. When the
--     @AWS_EC2_INSTANCE_ID@ attribute is specified, then the
--     @AWS_INSTANCE_IPV4@ attribute contains the primary private IPv4
--     address.
--
-- [AWS_INIT_HEALTH_STATUS]
--     If the service configuration includes @HealthCheckCustomConfig@, you
--     can optionally use @AWS_INIT_HEALTH_STATUS@ to specify the initial
--     status of the custom health check, @HEALTHY@ or @UNHEALTHY@. If you
--     don\'t specify a value for @AWS_INIT_HEALTH_STATUS@, the initial
--     status is @HEALTHY@.
--
-- [AWS_INSTANCE_CNAME]
--     For a @CNAME@ record, the domain name that Route 53 returns in
--     response to DNS queries (for example, @example.com@).
--
-- [AWS_INSTANCE_IPV4]
--     For an @A@ record, the IPv4 address that Route 53 returns in
--     response to DNS queries (for example, @192.0.2.44@).
--
-- [AWS_INSTANCE_IPV6]
--     For an @AAAA@ record, the IPv6 address that Route 53 returns in
--     response to DNS queries (for example,
--     @2001:0db8:85a3:0000:0000:abcd:0001:2345@).
--
-- [AWS_INSTANCE_PORT]
--     For an @SRV@ record, the value that Route 53 returns for the port.
--     In addition, if the service includes @HealthCheckConfig@, the port
--     on the endpoint that Route 53 sends requests to.
--
-- 'id', 'instanceSummary_id' - The ID for an instance that you created by using a specified service.
newInstanceSummary ::
  InstanceSummary
newInstanceSummary :: InstanceSummary
newInstanceSummary =
  InstanceSummary' :: Maybe (HashMap Text Text) -> Maybe Text -> InstanceSummary
InstanceSummary'
    { $sel:attributes:InstanceSummary' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:id:InstanceSummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A string map that contains the following information:
--
-- -   The attributes that are associated with the instance.
--
-- -   For each attribute, the applicable value.
--
-- Supported attribute keys include the following:
--
-- [AWS_ALIAS_DNS_NAME]
--     For an alias record that routes traffic to an Elastic Load Balancing
--     load balancer, the DNS name that\'s associated with the load
--     balancer.
--
-- [AWS_EC2_INSTANCE_ID (HTTP namespaces only)]
--     The Amazon EC2 instance ID for the instance. When the
--     @AWS_EC2_INSTANCE_ID@ attribute is specified, then the
--     @AWS_INSTANCE_IPV4@ attribute contains the primary private IPv4
--     address.
--
-- [AWS_INIT_HEALTH_STATUS]
--     If the service configuration includes @HealthCheckCustomConfig@, you
--     can optionally use @AWS_INIT_HEALTH_STATUS@ to specify the initial
--     status of the custom health check, @HEALTHY@ or @UNHEALTHY@. If you
--     don\'t specify a value for @AWS_INIT_HEALTH_STATUS@, the initial
--     status is @HEALTHY@.
--
-- [AWS_INSTANCE_CNAME]
--     For a @CNAME@ record, the domain name that Route 53 returns in
--     response to DNS queries (for example, @example.com@).
--
-- [AWS_INSTANCE_IPV4]
--     For an @A@ record, the IPv4 address that Route 53 returns in
--     response to DNS queries (for example, @192.0.2.44@).
--
-- [AWS_INSTANCE_IPV6]
--     For an @AAAA@ record, the IPv6 address that Route 53 returns in
--     response to DNS queries (for example,
--     @2001:0db8:85a3:0000:0000:abcd:0001:2345@).
--
-- [AWS_INSTANCE_PORT]
--     For an @SRV@ record, the value that Route 53 returns for the port.
--     In addition, if the service includes @HealthCheckConfig@, the port
--     on the endpoint that Route 53 sends requests to.
instanceSummary_attributes :: Lens.Lens' InstanceSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
instanceSummary_attributes :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> InstanceSummary -> f InstanceSummary
instanceSummary_attributes = (InstanceSummary -> Maybe (HashMap Text Text))
-> (InstanceSummary
    -> Maybe (HashMap Text Text) -> InstanceSummary)
-> Lens
     InstanceSummary
     InstanceSummary
     (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 (\InstanceSummary' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:InstanceSummary' :: InstanceSummary -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: InstanceSummary
s@InstanceSummary' {} Maybe (HashMap Text Text)
a -> InstanceSummary
s {$sel:attributes:InstanceSummary' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: InstanceSummary) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> InstanceSummary -> f InstanceSummary)
-> ((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)))
-> InstanceSummary
-> f InstanceSummary
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 ID for an instance that you created by using a specified service.
instanceSummary_id :: Lens.Lens' InstanceSummary (Prelude.Maybe Prelude.Text)
instanceSummary_id :: (Maybe Text -> f (Maybe Text))
-> InstanceSummary -> f InstanceSummary
instanceSummary_id = (InstanceSummary -> Maybe Text)
-> (InstanceSummary -> Maybe Text -> InstanceSummary)
-> Lens InstanceSummary InstanceSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceSummary' {Maybe Text
id :: Maybe Text
$sel:id:InstanceSummary' :: InstanceSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: InstanceSummary
s@InstanceSummary' {} Maybe Text
a -> InstanceSummary
s {$sel:id:InstanceSummary' :: Maybe Text
id = Maybe Text
a} :: InstanceSummary)

instance Core.FromJSON InstanceSummary where
  parseJSON :: Value -> Parser InstanceSummary
parseJSON =
    String
-> (Object -> Parser InstanceSummary)
-> Value
-> Parser InstanceSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InstanceSummary"
      ( \Object
x ->
          Maybe (HashMap Text Text) -> Maybe Text -> InstanceSummary
InstanceSummary'
            (Maybe (HashMap Text Text) -> Maybe Text -> InstanceSummary)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Maybe Text -> InstanceSummary)
forall (f :: * -> *) a b. Functor 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 -> InstanceSummary)
-> Parser (Maybe Text) -> Parser InstanceSummary
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
"Id")
      )

instance Prelude.Hashable InstanceSummary

instance Prelude.NFData InstanceSummary