{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53AutoNaming.Types.InstanceSummary 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

-- | 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
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]
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
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. 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'
    { $sel:attributes:InstanceSummary' :: Maybe (HashMap Text Text)
attributes = forall a. Maybe a
Prelude.Nothing,
      $sel:id:InstanceSummary' :: Maybe Text
id = 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 :: Lens' InstanceSummary (Maybe (HashMap Text Text))
instanceSummary_attributes = 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) 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

-- | The ID for an instance that you created by using a specified service.
instanceSummary_id :: Lens.Lens' InstanceSummary (Prelude.Maybe Prelude.Text)
instanceSummary_id :: Lens' InstanceSummary (Maybe Text)
instanceSummary_id = 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 Data.FromJSON InstanceSummary where
  parseJSON :: Value -> Parser InstanceSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InstanceSummary"
      ( \Object
x ->
          Maybe (HashMap Text Text) -> Maybe Text -> InstanceSummary
InstanceSummary'
            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
"Attributes" 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
"Id")
      )

instance Prelude.Hashable InstanceSummary where
  hashWithSalt :: Int -> InstanceSummary -> Int
hashWithSalt Int
_salt InstanceSummary' {Maybe Text
Maybe (HashMap Text Text)
id :: Maybe Text
attributes :: Maybe (HashMap Text Text)
$sel:id:InstanceSummary' :: InstanceSummary -> Maybe Text
$sel:attributes:InstanceSummary' :: InstanceSummary -> Maybe (HashMap Text Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
attributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id

instance Prelude.NFData InstanceSummary where
  rnf :: InstanceSummary -> ()
rnf InstanceSummary' {Maybe Text
Maybe (HashMap Text Text)
id :: Maybe Text
attributes :: Maybe (HashMap Text Text)
$sel:id:InstanceSummary' :: InstanceSummary -> Maybe Text
$sel:attributes:InstanceSummary' :: InstanceSummary -> Maybe (HashMap Text Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
attributes seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id