{-# 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.XRay.Types.InsightImpactGraphService
-- 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.XRay.Types.InsightImpactGraphService 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.XRay.Types.InsightImpactGraphEdge

-- | Information about an application that processed requests, users that
-- made requests, or downstream services, resources, and applications that
-- an application used.
--
-- /See:/ 'newInsightImpactGraphService' smart constructor.
data InsightImpactGraphService = InsightImpactGraphService'
  { -- | Identifier of the Amazon Web Services account in which the service runs.
    InsightImpactGraphService -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | Connections to downstream services.
    InsightImpactGraphService -> Maybe [InsightImpactGraphEdge]
edges :: Prelude.Maybe [InsightImpactGraphEdge],
    -- | The canonical name of the service.
    InsightImpactGraphService -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A list of names for the service, including the canonical name.
    InsightImpactGraphService -> Maybe [Text]
names :: Prelude.Maybe [Prelude.Text],
    -- | Identifier for the service. Unique within the service map.
    InsightImpactGraphService -> Maybe Int
referenceId :: Prelude.Maybe Prelude.Int,
    -- | Identifier for the service. Unique within the service map.
    --
    -- -   Amazon Web Services Resource - The type of an Amazon Web Services
    --     resource. For example, AWS::EC2::Instance for an application running
    --     on Amazon EC2 or AWS::DynamoDB::Table for an Amazon DynamoDB table
    --     that the application used.
    --
    -- -   Amazon Web Services Service - The type of an Amazon Web Services
    --     service. For example, AWS::DynamoDB for downstream calls to Amazon
    --     DynamoDB that didn\'t target a specific table.
    --
    -- -   Amazon Web Services Service - The type of an Amazon Web Services
    --     service. For example, AWS::DynamoDB for downstream calls to Amazon
    --     DynamoDB that didn\'t target a specific table.
    --
    -- -   remote - A downstream service of indeterminate type.
    InsightImpactGraphService -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (InsightImpactGraphService -> InsightImpactGraphService -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InsightImpactGraphService -> InsightImpactGraphService -> Bool
$c/= :: InsightImpactGraphService -> InsightImpactGraphService -> Bool
== :: InsightImpactGraphService -> InsightImpactGraphService -> Bool
$c== :: InsightImpactGraphService -> InsightImpactGraphService -> Bool
Prelude.Eq, ReadPrec [InsightImpactGraphService]
ReadPrec InsightImpactGraphService
Int -> ReadS InsightImpactGraphService
ReadS [InsightImpactGraphService]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InsightImpactGraphService]
$creadListPrec :: ReadPrec [InsightImpactGraphService]
readPrec :: ReadPrec InsightImpactGraphService
$creadPrec :: ReadPrec InsightImpactGraphService
readList :: ReadS [InsightImpactGraphService]
$creadList :: ReadS [InsightImpactGraphService]
readsPrec :: Int -> ReadS InsightImpactGraphService
$creadsPrec :: Int -> ReadS InsightImpactGraphService
Prelude.Read, Int -> InsightImpactGraphService -> ShowS
[InsightImpactGraphService] -> ShowS
InsightImpactGraphService -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InsightImpactGraphService] -> ShowS
$cshowList :: [InsightImpactGraphService] -> ShowS
show :: InsightImpactGraphService -> String
$cshow :: InsightImpactGraphService -> String
showsPrec :: Int -> InsightImpactGraphService -> ShowS
$cshowsPrec :: Int -> InsightImpactGraphService -> ShowS
Prelude.Show, forall x.
Rep InsightImpactGraphService x -> InsightImpactGraphService
forall x.
InsightImpactGraphService -> Rep InsightImpactGraphService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InsightImpactGraphService x -> InsightImpactGraphService
$cfrom :: forall x.
InsightImpactGraphService -> Rep InsightImpactGraphService x
Prelude.Generic)

-- |
-- Create a value of 'InsightImpactGraphService' 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:
--
-- 'accountId', 'insightImpactGraphService_accountId' - Identifier of the Amazon Web Services account in which the service runs.
--
-- 'edges', 'insightImpactGraphService_edges' - Connections to downstream services.
--
-- 'name', 'insightImpactGraphService_name' - The canonical name of the service.
--
-- 'names', 'insightImpactGraphService_names' - A list of names for the service, including the canonical name.
--
-- 'referenceId', 'insightImpactGraphService_referenceId' - Identifier for the service. Unique within the service map.
--
-- 'type'', 'insightImpactGraphService_type' - Identifier for the service. Unique within the service map.
--
-- -   Amazon Web Services Resource - The type of an Amazon Web Services
--     resource. For example, AWS::EC2::Instance for an application running
--     on Amazon EC2 or AWS::DynamoDB::Table for an Amazon DynamoDB table
--     that the application used.
--
-- -   Amazon Web Services Service - The type of an Amazon Web Services
--     service. For example, AWS::DynamoDB for downstream calls to Amazon
--     DynamoDB that didn\'t target a specific table.
--
-- -   Amazon Web Services Service - The type of an Amazon Web Services
--     service. For example, AWS::DynamoDB for downstream calls to Amazon
--     DynamoDB that didn\'t target a specific table.
--
-- -   remote - A downstream service of indeterminate type.
newInsightImpactGraphService ::
  InsightImpactGraphService
newInsightImpactGraphService :: InsightImpactGraphService
newInsightImpactGraphService =
  InsightImpactGraphService'
    { $sel:accountId:InsightImpactGraphService' :: Maybe Text
accountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:edges:InsightImpactGraphService' :: Maybe [InsightImpactGraphEdge]
edges = forall a. Maybe a
Prelude.Nothing,
      $sel:name:InsightImpactGraphService' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:names:InsightImpactGraphService' :: Maybe [Text]
names = forall a. Maybe a
Prelude.Nothing,
      $sel:referenceId:InsightImpactGraphService' :: Maybe Int
referenceId = forall a. Maybe a
Prelude.Nothing,
      $sel:type':InsightImpactGraphService' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | Identifier of the Amazon Web Services account in which the service runs.
insightImpactGraphService_accountId :: Lens.Lens' InsightImpactGraphService (Prelude.Maybe Prelude.Text)
insightImpactGraphService_accountId :: Lens' InsightImpactGraphService (Maybe Text)
insightImpactGraphService_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightImpactGraphService' {Maybe Text
accountId :: Maybe Text
$sel:accountId:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: InsightImpactGraphService
s@InsightImpactGraphService' {} Maybe Text
a -> InsightImpactGraphService
s {$sel:accountId:InsightImpactGraphService' :: Maybe Text
accountId = Maybe Text
a} :: InsightImpactGraphService)

-- | Connections to downstream services.
insightImpactGraphService_edges :: Lens.Lens' InsightImpactGraphService (Prelude.Maybe [InsightImpactGraphEdge])
insightImpactGraphService_edges :: Lens' InsightImpactGraphService (Maybe [InsightImpactGraphEdge])
insightImpactGraphService_edges = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightImpactGraphService' {Maybe [InsightImpactGraphEdge]
edges :: Maybe [InsightImpactGraphEdge]
$sel:edges:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe [InsightImpactGraphEdge]
edges} -> Maybe [InsightImpactGraphEdge]
edges) (\s :: InsightImpactGraphService
s@InsightImpactGraphService' {} Maybe [InsightImpactGraphEdge]
a -> InsightImpactGraphService
s {$sel:edges:InsightImpactGraphService' :: Maybe [InsightImpactGraphEdge]
edges = Maybe [InsightImpactGraphEdge]
a} :: InsightImpactGraphService) 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 canonical name of the service.
insightImpactGraphService_name :: Lens.Lens' InsightImpactGraphService (Prelude.Maybe Prelude.Text)
insightImpactGraphService_name :: Lens' InsightImpactGraphService (Maybe Text)
insightImpactGraphService_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightImpactGraphService' {Maybe Text
name :: Maybe Text
$sel:name:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe Text
name} -> Maybe Text
name) (\s :: InsightImpactGraphService
s@InsightImpactGraphService' {} Maybe Text
a -> InsightImpactGraphService
s {$sel:name:InsightImpactGraphService' :: Maybe Text
name = Maybe Text
a} :: InsightImpactGraphService)

-- | A list of names for the service, including the canonical name.
insightImpactGraphService_names :: Lens.Lens' InsightImpactGraphService (Prelude.Maybe [Prelude.Text])
insightImpactGraphService_names :: Lens' InsightImpactGraphService (Maybe [Text])
insightImpactGraphService_names = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightImpactGraphService' {Maybe [Text]
names :: Maybe [Text]
$sel:names:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe [Text]
names} -> Maybe [Text]
names) (\s :: InsightImpactGraphService
s@InsightImpactGraphService' {} Maybe [Text]
a -> InsightImpactGraphService
s {$sel:names:InsightImpactGraphService' :: Maybe [Text]
names = Maybe [Text]
a} :: InsightImpactGraphService) 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

-- | Identifier for the service. Unique within the service map.
insightImpactGraphService_referenceId :: Lens.Lens' InsightImpactGraphService (Prelude.Maybe Prelude.Int)
insightImpactGraphService_referenceId :: Lens' InsightImpactGraphService (Maybe Int)
insightImpactGraphService_referenceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightImpactGraphService' {Maybe Int
referenceId :: Maybe Int
$sel:referenceId:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe Int
referenceId} -> Maybe Int
referenceId) (\s :: InsightImpactGraphService
s@InsightImpactGraphService' {} Maybe Int
a -> InsightImpactGraphService
s {$sel:referenceId:InsightImpactGraphService' :: Maybe Int
referenceId = Maybe Int
a} :: InsightImpactGraphService)

-- | Identifier for the service. Unique within the service map.
--
-- -   Amazon Web Services Resource - The type of an Amazon Web Services
--     resource. For example, AWS::EC2::Instance for an application running
--     on Amazon EC2 or AWS::DynamoDB::Table for an Amazon DynamoDB table
--     that the application used.
--
-- -   Amazon Web Services Service - The type of an Amazon Web Services
--     service. For example, AWS::DynamoDB for downstream calls to Amazon
--     DynamoDB that didn\'t target a specific table.
--
-- -   Amazon Web Services Service - The type of an Amazon Web Services
--     service. For example, AWS::DynamoDB for downstream calls to Amazon
--     DynamoDB that didn\'t target a specific table.
--
-- -   remote - A downstream service of indeterminate type.
insightImpactGraphService_type :: Lens.Lens' InsightImpactGraphService (Prelude.Maybe Prelude.Text)
insightImpactGraphService_type :: Lens' InsightImpactGraphService (Maybe Text)
insightImpactGraphService_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightImpactGraphService' {Maybe Text
type' :: Maybe Text
$sel:type':InsightImpactGraphService' :: InsightImpactGraphService -> Maybe Text
type'} -> Maybe Text
type') (\s :: InsightImpactGraphService
s@InsightImpactGraphService' {} Maybe Text
a -> InsightImpactGraphService
s {$sel:type':InsightImpactGraphService' :: Maybe Text
type' = Maybe Text
a} :: InsightImpactGraphService)

instance Data.FromJSON InsightImpactGraphService where
  parseJSON :: Value -> Parser InsightImpactGraphService
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InsightImpactGraphService"
      ( \Object
x ->
          Maybe Text
-> Maybe [InsightImpactGraphEdge]
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> Maybe Text
-> InsightImpactGraphService
InsightImpactGraphService'
            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
"AccountId")
            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
"Edges" 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
"Name")
            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
"Names" 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
"ReferenceId")
            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
"Type")
      )

instance Prelude.Hashable InsightImpactGraphService where
  hashWithSalt :: Int -> InsightImpactGraphService -> Int
hashWithSalt Int
_salt InsightImpactGraphService' {Maybe Int
Maybe [Text]
Maybe [InsightImpactGraphEdge]
Maybe Text
type' :: Maybe Text
referenceId :: Maybe Int
names :: Maybe [Text]
name :: Maybe Text
edges :: Maybe [InsightImpactGraphEdge]
accountId :: Maybe Text
$sel:type':InsightImpactGraphService' :: InsightImpactGraphService -> Maybe Text
$sel:referenceId:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe Int
$sel:names:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe [Text]
$sel:name:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe Text
$sel:edges:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe [InsightImpactGraphEdge]
$sel:accountId:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [InsightImpactGraphEdge]
edges
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
names
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
referenceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
type'

instance Prelude.NFData InsightImpactGraphService where
  rnf :: InsightImpactGraphService -> ()
rnf InsightImpactGraphService' {Maybe Int
Maybe [Text]
Maybe [InsightImpactGraphEdge]
Maybe Text
type' :: Maybe Text
referenceId :: Maybe Int
names :: Maybe [Text]
name :: Maybe Text
edges :: Maybe [InsightImpactGraphEdge]
accountId :: Maybe Text
$sel:type':InsightImpactGraphService' :: InsightImpactGraphService -> Maybe Text
$sel:referenceId:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe Int
$sel:names:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe [Text]
$sel:name:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe Text
$sel:edges:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe [InsightImpactGraphEdge]
$sel:accountId:InsightImpactGraphService' :: InsightImpactGraphService -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [InsightImpactGraphEdge]
edges
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
names
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
referenceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
type'