{-# 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.ServiceInfo
-- 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.XRay.Types.ServiceInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.XRay.Types.Edge
import Amazonka.XRay.Types.HistogramEntry
import Amazonka.XRay.Types.ServiceStatistics

-- | Information about an application that processed requests, users that
-- made requests, or downstream services, resources, and applications that
-- an application used.
--
-- /See:/ 'newServiceInfo' smart constructor.
data ServiceInfo = ServiceInfo'
  { -- | The service\'s state.
    ServiceInfo -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
    -- | The start time of the first segment that the service generated.
    ServiceInfo -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | Indicates that the service was the first service to process a request.
    ServiceInfo -> Maybe Bool
root :: Prelude.Maybe Prelude.Bool,
    -- | A histogram that maps the spread of service response times.
    ServiceInfo -> Maybe [HistogramEntry]
responseTimeHistogram :: Prelude.Maybe [HistogramEntry],
    -- | A histogram that maps the spread of service durations.
    ServiceInfo -> Maybe [HistogramEntry]
durationHistogram :: Prelude.Maybe [HistogramEntry],
    -- | Identifier for the service. Unique within the service map.
    ServiceInfo -> Maybe Int
referenceId :: Prelude.Maybe Prelude.Int,
    -- | Identifier of the Amazon Web Services account in which the service runs.
    ServiceInfo -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | A list of names for the service, including the canonical name.
    ServiceInfo -> Maybe [Text]
names :: Prelude.Maybe [Prelude.Text],
    -- | The canonical name of the service.
    ServiceInfo -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The end time of the last segment that the service generated.
    ServiceInfo -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX,
    -- | The type of service.
    --
    -- -   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.
    --
    -- -   @client@ - Represents the clients that sent requests to a root
    --     service.
    --
    -- -   @remote@ - A downstream service of indeterminate type.
    ServiceInfo -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
    -- | Connections to downstream services.
    ServiceInfo -> Maybe [Edge]
edges :: Prelude.Maybe [Edge],
    -- | Aggregated statistics for the service.
    ServiceInfo -> Maybe ServiceStatistics
summaryStatistics :: Prelude.Maybe ServiceStatistics
  }
  deriving (ServiceInfo -> ServiceInfo -> Bool
(ServiceInfo -> ServiceInfo -> Bool)
-> (ServiceInfo -> ServiceInfo -> Bool) -> Eq ServiceInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceInfo -> ServiceInfo -> Bool
$c/= :: ServiceInfo -> ServiceInfo -> Bool
== :: ServiceInfo -> ServiceInfo -> Bool
$c== :: ServiceInfo -> ServiceInfo -> Bool
Prelude.Eq, ReadPrec [ServiceInfo]
ReadPrec ServiceInfo
Int -> ReadS ServiceInfo
ReadS [ServiceInfo]
(Int -> ReadS ServiceInfo)
-> ReadS [ServiceInfo]
-> ReadPrec ServiceInfo
-> ReadPrec [ServiceInfo]
-> Read ServiceInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceInfo]
$creadListPrec :: ReadPrec [ServiceInfo]
readPrec :: ReadPrec ServiceInfo
$creadPrec :: ReadPrec ServiceInfo
readList :: ReadS [ServiceInfo]
$creadList :: ReadS [ServiceInfo]
readsPrec :: Int -> ReadS ServiceInfo
$creadsPrec :: Int -> ReadS ServiceInfo
Prelude.Read, Int -> ServiceInfo -> ShowS
[ServiceInfo] -> ShowS
ServiceInfo -> String
(Int -> ServiceInfo -> ShowS)
-> (ServiceInfo -> String)
-> ([ServiceInfo] -> ShowS)
-> Show ServiceInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceInfo] -> ShowS
$cshowList :: [ServiceInfo] -> ShowS
show :: ServiceInfo -> String
$cshow :: ServiceInfo -> String
showsPrec :: Int -> ServiceInfo -> ShowS
$cshowsPrec :: Int -> ServiceInfo -> ShowS
Prelude.Show, (forall x. ServiceInfo -> Rep ServiceInfo x)
-> (forall x. Rep ServiceInfo x -> ServiceInfo)
-> Generic ServiceInfo
forall x. Rep ServiceInfo x -> ServiceInfo
forall x. ServiceInfo -> Rep ServiceInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServiceInfo x -> ServiceInfo
$cfrom :: forall x. ServiceInfo -> Rep ServiceInfo x
Prelude.Generic)

-- |
-- Create a value of 'ServiceInfo' 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:
--
-- 'state', 'serviceInfo_state' - The service\'s state.
--
-- 'startTime', 'serviceInfo_startTime' - The start time of the first segment that the service generated.
--
-- 'root', 'serviceInfo_root' - Indicates that the service was the first service to process a request.
--
-- 'responseTimeHistogram', 'serviceInfo_responseTimeHistogram' - A histogram that maps the spread of service response times.
--
-- 'durationHistogram', 'serviceInfo_durationHistogram' - A histogram that maps the spread of service durations.
--
-- 'referenceId', 'serviceInfo_referenceId' - Identifier for the service. Unique within the service map.
--
-- 'accountId', 'serviceInfo_accountId' - Identifier of the Amazon Web Services account in which the service runs.
--
-- 'names', 'serviceInfo_names' - A list of names for the service, including the canonical name.
--
-- 'name', 'serviceInfo_name' - The canonical name of the service.
--
-- 'endTime', 'serviceInfo_endTime' - The end time of the last segment that the service generated.
--
-- 'type'', 'serviceInfo_type' - The type of service.
--
-- -   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.
--
-- -   @client@ - Represents the clients that sent requests to a root
--     service.
--
-- -   @remote@ - A downstream service of indeterminate type.
--
-- 'edges', 'serviceInfo_edges' - Connections to downstream services.
--
-- 'summaryStatistics', 'serviceInfo_summaryStatistics' - Aggregated statistics for the service.
newServiceInfo ::
  ServiceInfo
newServiceInfo :: ServiceInfo
newServiceInfo =
  ServiceInfo' :: Maybe Text
-> Maybe POSIX
-> Maybe Bool
-> Maybe [HistogramEntry]
-> Maybe [HistogramEntry]
-> Maybe Int
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe [Edge]
-> Maybe ServiceStatistics
-> ServiceInfo
ServiceInfo'
    { $sel:state:ServiceInfo' :: Maybe Text
state = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:ServiceInfo' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:root:ServiceInfo' :: Maybe Bool
root = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:responseTimeHistogram:ServiceInfo' :: Maybe [HistogramEntry]
responseTimeHistogram = Maybe [HistogramEntry]
forall a. Maybe a
Prelude.Nothing,
      $sel:durationHistogram:ServiceInfo' :: Maybe [HistogramEntry]
durationHistogram = Maybe [HistogramEntry]
forall a. Maybe a
Prelude.Nothing,
      $sel:referenceId:ServiceInfo' :: Maybe Int
referenceId = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:ServiceInfo' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:names:ServiceInfo' :: Maybe [Text]
names = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ServiceInfo' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:ServiceInfo' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:type':ServiceInfo' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:edges:ServiceInfo' :: Maybe [Edge]
edges = Maybe [Edge]
forall a. Maybe a
Prelude.Nothing,
      $sel:summaryStatistics:ServiceInfo' :: Maybe ServiceStatistics
summaryStatistics = Maybe ServiceStatistics
forall a. Maybe a
Prelude.Nothing
    }

-- | The service\'s state.
serviceInfo_state :: Lens.Lens' ServiceInfo (Prelude.Maybe Prelude.Text)
serviceInfo_state :: (Maybe Text -> f (Maybe Text)) -> ServiceInfo -> f ServiceInfo
serviceInfo_state = (ServiceInfo -> Maybe Text)
-> (ServiceInfo -> Maybe Text -> ServiceInfo)
-> Lens ServiceInfo ServiceInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceInfo' {Maybe Text
state :: Maybe Text
$sel:state:ServiceInfo' :: ServiceInfo -> Maybe Text
state} -> Maybe Text
state) (\s :: ServiceInfo
s@ServiceInfo' {} Maybe Text
a -> ServiceInfo
s {$sel:state:ServiceInfo' :: Maybe Text
state = Maybe Text
a} :: ServiceInfo)

-- | The start time of the first segment that the service generated.
serviceInfo_startTime :: Lens.Lens' ServiceInfo (Prelude.Maybe Prelude.UTCTime)
serviceInfo_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ServiceInfo -> f ServiceInfo
serviceInfo_startTime = (ServiceInfo -> Maybe POSIX)
-> (ServiceInfo -> Maybe POSIX -> ServiceInfo)
-> Lens ServiceInfo ServiceInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceInfo' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:ServiceInfo' :: ServiceInfo -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: ServiceInfo
s@ServiceInfo' {} Maybe POSIX
a -> ServiceInfo
s {$sel:startTime:ServiceInfo' :: Maybe POSIX
startTime = Maybe POSIX
a} :: ServiceInfo) ((Maybe POSIX -> f (Maybe POSIX)) -> ServiceInfo -> f ServiceInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ServiceInfo
-> f ServiceInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Indicates that the service was the first service to process a request.
serviceInfo_root :: Lens.Lens' ServiceInfo (Prelude.Maybe Prelude.Bool)
serviceInfo_root :: (Maybe Bool -> f (Maybe Bool)) -> ServiceInfo -> f ServiceInfo
serviceInfo_root = (ServiceInfo -> Maybe Bool)
-> (ServiceInfo -> Maybe Bool -> ServiceInfo)
-> Lens ServiceInfo ServiceInfo (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceInfo' {Maybe Bool
root :: Maybe Bool
$sel:root:ServiceInfo' :: ServiceInfo -> Maybe Bool
root} -> Maybe Bool
root) (\s :: ServiceInfo
s@ServiceInfo' {} Maybe Bool
a -> ServiceInfo
s {$sel:root:ServiceInfo' :: Maybe Bool
root = Maybe Bool
a} :: ServiceInfo)

-- | A histogram that maps the spread of service response times.
serviceInfo_responseTimeHistogram :: Lens.Lens' ServiceInfo (Prelude.Maybe [HistogramEntry])
serviceInfo_responseTimeHistogram :: (Maybe [HistogramEntry] -> f (Maybe [HistogramEntry]))
-> ServiceInfo -> f ServiceInfo
serviceInfo_responseTimeHistogram = (ServiceInfo -> Maybe [HistogramEntry])
-> (ServiceInfo -> Maybe [HistogramEntry] -> ServiceInfo)
-> Lens
     ServiceInfo
     ServiceInfo
     (Maybe [HistogramEntry])
     (Maybe [HistogramEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceInfo' {Maybe [HistogramEntry]
responseTimeHistogram :: Maybe [HistogramEntry]
$sel:responseTimeHistogram:ServiceInfo' :: ServiceInfo -> Maybe [HistogramEntry]
responseTimeHistogram} -> Maybe [HistogramEntry]
responseTimeHistogram) (\s :: ServiceInfo
s@ServiceInfo' {} Maybe [HistogramEntry]
a -> ServiceInfo
s {$sel:responseTimeHistogram:ServiceInfo' :: Maybe [HistogramEntry]
responseTimeHistogram = Maybe [HistogramEntry]
a} :: ServiceInfo) ((Maybe [HistogramEntry] -> f (Maybe [HistogramEntry]))
 -> ServiceInfo -> f ServiceInfo)
-> ((Maybe [HistogramEntry] -> f (Maybe [HistogramEntry]))
    -> Maybe [HistogramEntry] -> f (Maybe [HistogramEntry]))
-> (Maybe [HistogramEntry] -> f (Maybe [HistogramEntry]))
-> ServiceInfo
-> f ServiceInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [HistogramEntry] [HistogramEntry] [HistogramEntry] [HistogramEntry]
-> Iso
     (Maybe [HistogramEntry])
     (Maybe [HistogramEntry])
     (Maybe [HistogramEntry])
     (Maybe [HistogramEntry])
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
  [HistogramEntry] [HistogramEntry] [HistogramEntry] [HistogramEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A histogram that maps the spread of service durations.
serviceInfo_durationHistogram :: Lens.Lens' ServiceInfo (Prelude.Maybe [HistogramEntry])
serviceInfo_durationHistogram :: (Maybe [HistogramEntry] -> f (Maybe [HistogramEntry]))
-> ServiceInfo -> f ServiceInfo
serviceInfo_durationHistogram = (ServiceInfo -> Maybe [HistogramEntry])
-> (ServiceInfo -> Maybe [HistogramEntry] -> ServiceInfo)
-> Lens
     ServiceInfo
     ServiceInfo
     (Maybe [HistogramEntry])
     (Maybe [HistogramEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceInfo' {Maybe [HistogramEntry]
durationHistogram :: Maybe [HistogramEntry]
$sel:durationHistogram:ServiceInfo' :: ServiceInfo -> Maybe [HistogramEntry]
durationHistogram} -> Maybe [HistogramEntry]
durationHistogram) (\s :: ServiceInfo
s@ServiceInfo' {} Maybe [HistogramEntry]
a -> ServiceInfo
s {$sel:durationHistogram:ServiceInfo' :: Maybe [HistogramEntry]
durationHistogram = Maybe [HistogramEntry]
a} :: ServiceInfo) ((Maybe [HistogramEntry] -> f (Maybe [HistogramEntry]))
 -> ServiceInfo -> f ServiceInfo)
-> ((Maybe [HistogramEntry] -> f (Maybe [HistogramEntry]))
    -> Maybe [HistogramEntry] -> f (Maybe [HistogramEntry]))
-> (Maybe [HistogramEntry] -> f (Maybe [HistogramEntry]))
-> ServiceInfo
-> f ServiceInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [HistogramEntry] [HistogramEntry] [HistogramEntry] [HistogramEntry]
-> Iso
     (Maybe [HistogramEntry])
     (Maybe [HistogramEntry])
     (Maybe [HistogramEntry])
     (Maybe [HistogramEntry])
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
  [HistogramEntry] [HistogramEntry] [HistogramEntry] [HistogramEntry]
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.
serviceInfo_referenceId :: Lens.Lens' ServiceInfo (Prelude.Maybe Prelude.Int)
serviceInfo_referenceId :: (Maybe Int -> f (Maybe Int)) -> ServiceInfo -> f ServiceInfo
serviceInfo_referenceId = (ServiceInfo -> Maybe Int)
-> (ServiceInfo -> Maybe Int -> ServiceInfo)
-> Lens ServiceInfo ServiceInfo (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceInfo' {Maybe Int
referenceId :: Maybe Int
$sel:referenceId:ServiceInfo' :: ServiceInfo -> Maybe Int
referenceId} -> Maybe Int
referenceId) (\s :: ServiceInfo
s@ServiceInfo' {} Maybe Int
a -> ServiceInfo
s {$sel:referenceId:ServiceInfo' :: Maybe Int
referenceId = Maybe Int
a} :: ServiceInfo)

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

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

-- | The canonical name of the service.
serviceInfo_name :: Lens.Lens' ServiceInfo (Prelude.Maybe Prelude.Text)
serviceInfo_name :: (Maybe Text -> f (Maybe Text)) -> ServiceInfo -> f ServiceInfo
serviceInfo_name = (ServiceInfo -> Maybe Text)
-> (ServiceInfo -> Maybe Text -> ServiceInfo)
-> Lens ServiceInfo ServiceInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceInfo' {Maybe Text
name :: Maybe Text
$sel:name:ServiceInfo' :: ServiceInfo -> Maybe Text
name} -> Maybe Text
name) (\s :: ServiceInfo
s@ServiceInfo' {} Maybe Text
a -> ServiceInfo
s {$sel:name:ServiceInfo' :: Maybe Text
name = Maybe Text
a} :: ServiceInfo)

-- | The end time of the last segment that the service generated.
serviceInfo_endTime :: Lens.Lens' ServiceInfo (Prelude.Maybe Prelude.UTCTime)
serviceInfo_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ServiceInfo -> f ServiceInfo
serviceInfo_endTime = (ServiceInfo -> Maybe POSIX)
-> (ServiceInfo -> Maybe POSIX -> ServiceInfo)
-> Lens ServiceInfo ServiceInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceInfo' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:ServiceInfo' :: ServiceInfo -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: ServiceInfo
s@ServiceInfo' {} Maybe POSIX
a -> ServiceInfo
s {$sel:endTime:ServiceInfo' :: Maybe POSIX
endTime = Maybe POSIX
a} :: ServiceInfo) ((Maybe POSIX -> f (Maybe POSIX)) -> ServiceInfo -> f ServiceInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ServiceInfo
-> f ServiceInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The type of service.
--
-- -   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.
--
-- -   @client@ - Represents the clients that sent requests to a root
--     service.
--
-- -   @remote@ - A downstream service of indeterminate type.
serviceInfo_type :: Lens.Lens' ServiceInfo (Prelude.Maybe Prelude.Text)
serviceInfo_type :: (Maybe Text -> f (Maybe Text)) -> ServiceInfo -> f ServiceInfo
serviceInfo_type = (ServiceInfo -> Maybe Text)
-> (ServiceInfo -> Maybe Text -> ServiceInfo)
-> Lens ServiceInfo ServiceInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceInfo' {Maybe Text
type' :: Maybe Text
$sel:type':ServiceInfo' :: ServiceInfo -> Maybe Text
type'} -> Maybe Text
type') (\s :: ServiceInfo
s@ServiceInfo' {} Maybe Text
a -> ServiceInfo
s {$sel:type':ServiceInfo' :: Maybe Text
type' = Maybe Text
a} :: ServiceInfo)

-- | Connections to downstream services.
serviceInfo_edges :: Lens.Lens' ServiceInfo (Prelude.Maybe [Edge])
serviceInfo_edges :: (Maybe [Edge] -> f (Maybe [Edge])) -> ServiceInfo -> f ServiceInfo
serviceInfo_edges = (ServiceInfo -> Maybe [Edge])
-> (ServiceInfo -> Maybe [Edge] -> ServiceInfo)
-> Lens ServiceInfo ServiceInfo (Maybe [Edge]) (Maybe [Edge])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceInfo' {Maybe [Edge]
edges :: Maybe [Edge]
$sel:edges:ServiceInfo' :: ServiceInfo -> Maybe [Edge]
edges} -> Maybe [Edge]
edges) (\s :: ServiceInfo
s@ServiceInfo' {} Maybe [Edge]
a -> ServiceInfo
s {$sel:edges:ServiceInfo' :: Maybe [Edge]
edges = Maybe [Edge]
a} :: ServiceInfo) ((Maybe [Edge] -> f (Maybe [Edge]))
 -> ServiceInfo -> f ServiceInfo)
-> ((Maybe [Edge] -> f (Maybe [Edge]))
    -> Maybe [Edge] -> f (Maybe [Edge]))
-> (Maybe [Edge] -> f (Maybe [Edge]))
-> ServiceInfo
-> f ServiceInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Edge] [Edge] [Edge] [Edge]
-> Iso (Maybe [Edge]) (Maybe [Edge]) (Maybe [Edge]) (Maybe [Edge])
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 [Edge] [Edge] [Edge] [Edge]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Aggregated statistics for the service.
serviceInfo_summaryStatistics :: Lens.Lens' ServiceInfo (Prelude.Maybe ServiceStatistics)
serviceInfo_summaryStatistics :: (Maybe ServiceStatistics -> f (Maybe ServiceStatistics))
-> ServiceInfo -> f ServiceInfo
serviceInfo_summaryStatistics = (ServiceInfo -> Maybe ServiceStatistics)
-> (ServiceInfo -> Maybe ServiceStatistics -> ServiceInfo)
-> Lens
     ServiceInfo
     ServiceInfo
     (Maybe ServiceStatistics)
     (Maybe ServiceStatistics)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceInfo' {Maybe ServiceStatistics
summaryStatistics :: Maybe ServiceStatistics
$sel:summaryStatistics:ServiceInfo' :: ServiceInfo -> Maybe ServiceStatistics
summaryStatistics} -> Maybe ServiceStatistics
summaryStatistics) (\s :: ServiceInfo
s@ServiceInfo' {} Maybe ServiceStatistics
a -> ServiceInfo
s {$sel:summaryStatistics:ServiceInfo' :: Maybe ServiceStatistics
summaryStatistics = Maybe ServiceStatistics
a} :: ServiceInfo)

instance Core.FromJSON ServiceInfo where
  parseJSON :: Value -> Parser ServiceInfo
parseJSON =
    String
-> (Object -> Parser ServiceInfo) -> Value -> Parser ServiceInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ServiceInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Bool
-> Maybe [HistogramEntry]
-> Maybe [HistogramEntry]
-> Maybe Int
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe [Edge]
-> Maybe ServiceStatistics
-> ServiceInfo
ServiceInfo'
            (Maybe Text
 -> Maybe POSIX
 -> Maybe Bool
 -> Maybe [HistogramEntry]
 -> Maybe [HistogramEntry]
 -> Maybe Int
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe [Edge]
 -> Maybe ServiceStatistics
 -> ServiceInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Bool
      -> Maybe [HistogramEntry]
      -> Maybe [HistogramEntry]
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [Edge]
      -> Maybe ServiceStatistics
      -> ServiceInfo)
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
"State")
            Parser
  (Maybe POSIX
   -> Maybe Bool
   -> Maybe [HistogramEntry]
   -> Maybe [HistogramEntry]
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [Edge]
   -> Maybe ServiceStatistics
   -> ServiceInfo)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Bool
      -> Maybe [HistogramEntry]
      -> Maybe [HistogramEntry]
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [Edge]
      -> Maybe ServiceStatistics
      -> ServiceInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartTime")
            Parser
  (Maybe Bool
   -> Maybe [HistogramEntry]
   -> Maybe [HistogramEntry]
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [Edge]
   -> Maybe ServiceStatistics
   -> ServiceInfo)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [HistogramEntry]
      -> Maybe [HistogramEntry]
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [Edge]
      -> Maybe ServiceStatistics
      -> ServiceInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Root")
            Parser
  (Maybe [HistogramEntry]
   -> Maybe [HistogramEntry]
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [Edge]
   -> Maybe ServiceStatistics
   -> ServiceInfo)
-> Parser (Maybe [HistogramEntry])
-> Parser
     (Maybe [HistogramEntry]
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [Edge]
      -> Maybe ServiceStatistics
      -> ServiceInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [HistogramEntry]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResponseTimeHistogram"
                            Parser (Maybe (Maybe [HistogramEntry]))
-> Maybe [HistogramEntry] -> Parser (Maybe [HistogramEntry])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [HistogramEntry]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe [HistogramEntry]
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [Edge]
   -> Maybe ServiceStatistics
   -> ServiceInfo)
-> Parser (Maybe [HistogramEntry])
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [Edge]
      -> Maybe ServiceStatistics
      -> ServiceInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [HistogramEntry]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DurationHistogram"
                            Parser (Maybe (Maybe [HistogramEntry]))
-> Maybe [HistogramEntry] -> Parser (Maybe [HistogramEntry])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [HistogramEntry]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Int
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [Edge]
   -> Maybe ServiceStatistics
   -> ServiceInfo)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [Edge]
      -> Maybe ServiceStatistics
      -> ServiceInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReferenceId")
            Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [Edge]
   -> Maybe ServiceStatistics
   -> ServiceInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [Edge]
      -> Maybe ServiceStatistics
      -> ServiceInfo)
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
"AccountId")
            Parser
  (Maybe [Text]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [Edge]
   -> Maybe ServiceStatistics
   -> ServiceInfo)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe [Edge]
      -> Maybe ServiceStatistics
      -> ServiceInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Names" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe [Edge]
   -> Maybe ServiceStatistics
   -> ServiceInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe [Edge]
      -> Maybe ServiceStatistics
      -> ServiceInfo)
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
"Name")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe [Edge]
   -> Maybe ServiceStatistics
   -> ServiceInfo)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe [Edge] -> Maybe ServiceStatistics -> ServiceInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndTime")
            Parser
  (Maybe Text
   -> Maybe [Edge] -> Maybe ServiceStatistics -> ServiceInfo)
-> Parser (Maybe Text)
-> Parser (Maybe [Edge] -> Maybe ServiceStatistics -> ServiceInfo)
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
"Type")
            Parser (Maybe [Edge] -> Maybe ServiceStatistics -> ServiceInfo)
-> Parser (Maybe [Edge])
-> Parser (Maybe ServiceStatistics -> ServiceInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Edge]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Edges" Parser (Maybe (Maybe [Edge]))
-> Maybe [Edge] -> Parser (Maybe [Edge])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Edge]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe ServiceStatistics -> ServiceInfo)
-> Parser (Maybe ServiceStatistics) -> Parser ServiceInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ServiceStatistics)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SummaryStatistics")
      )

instance Prelude.Hashable ServiceInfo

instance Prelude.NFData ServiceInfo