{-# 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.AppRunner.Types.ServiceSummary
-- 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.AppRunner.Types.ServiceSummary where

import Amazonka.AppRunner.Types.ServiceStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides summary information for an App Runner service.
--
-- This type contains limited information about a service. It doesn\'t
-- include configuration details. It\'s returned by the
-- <https://docs.aws.amazon.com/apprunner/latest/api/API_ListServices.html ListServices>
-- action. Complete service information is returned by the
-- <https://docs.aws.amazon.com/apprunner/latest/api/API_CreateService.html CreateService>,
-- <https://docs.aws.amazon.com/apprunner/latest/api/API_DescribeService.html DescribeService>,
-- and
-- <https://docs.aws.amazon.com/apprunner/latest/api/API_DeleteService.html DeleteService>
-- actions using the
-- <https://docs.aws.amazon.com/apprunner/latest/api/API_Service.html Service>
-- type.
--
-- /See:/ 'newServiceSummary' smart constructor.
data ServiceSummary = ServiceSummary'
  { -- | The current state of the App Runner service. These particular values
    -- mean the following.
    --
    -- -   @CREATE_FAILED@ – The service failed to create. Read the failure
    --     events and logs, change any parameters that need to be fixed, and
    --     retry the call to create the service.
    --
    --     The failed service isn\'t usable, and still counts towards your
    --     service quota. When you\'re done analyzing the failure, delete the
    --     service.
    --
    -- -   @DELETE_FAILED@ – The service failed to delete and can\'t be
    --     successfully recovered. Retry the service deletion call to ensure
    --     that all related resources are removed.
    ServiceSummary -> Maybe ServiceStatus
status :: Prelude.Maybe ServiceStatus,
    -- | The time when the App Runner service was created. It\'s in the Unix time
    -- stamp format.
    ServiceSummary -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | A subdomain URL that App Runner generated for this service. You can use
    -- this URL to access your service web application.
    ServiceSummary -> Maybe Text
serviceUrl :: Prelude.Maybe Prelude.Text,
    -- | The customer-provided service name.
    ServiceSummary -> Maybe Text
serviceName :: Prelude.Maybe Prelude.Text,
    -- | The time when the App Runner service was last updated. It\'s in theUnix
    -- time stamp format.
    ServiceSummary -> Maybe POSIX
updatedAt :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of this service.
    ServiceSummary -> Maybe Text
serviceArn :: Prelude.Maybe Prelude.Text,
    -- | An ID that App Runner generated for this service. It\'s unique within
    -- the Amazon Web Services Region.
    ServiceSummary -> Maybe Text
serviceId :: Prelude.Maybe Prelude.Text
  }
  deriving (ServiceSummary -> ServiceSummary -> Bool
(ServiceSummary -> ServiceSummary -> Bool)
-> (ServiceSummary -> ServiceSummary -> Bool) -> Eq ServiceSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceSummary -> ServiceSummary -> Bool
$c/= :: ServiceSummary -> ServiceSummary -> Bool
== :: ServiceSummary -> ServiceSummary -> Bool
$c== :: ServiceSummary -> ServiceSummary -> Bool
Prelude.Eq, ReadPrec [ServiceSummary]
ReadPrec ServiceSummary
Int -> ReadS ServiceSummary
ReadS [ServiceSummary]
(Int -> ReadS ServiceSummary)
-> ReadS [ServiceSummary]
-> ReadPrec ServiceSummary
-> ReadPrec [ServiceSummary]
-> Read ServiceSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceSummary]
$creadListPrec :: ReadPrec [ServiceSummary]
readPrec :: ReadPrec ServiceSummary
$creadPrec :: ReadPrec ServiceSummary
readList :: ReadS [ServiceSummary]
$creadList :: ReadS [ServiceSummary]
readsPrec :: Int -> ReadS ServiceSummary
$creadsPrec :: Int -> ReadS ServiceSummary
Prelude.Read, Int -> ServiceSummary -> ShowS
[ServiceSummary] -> ShowS
ServiceSummary -> String
(Int -> ServiceSummary -> ShowS)
-> (ServiceSummary -> String)
-> ([ServiceSummary] -> ShowS)
-> Show ServiceSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceSummary] -> ShowS
$cshowList :: [ServiceSummary] -> ShowS
show :: ServiceSummary -> String
$cshow :: ServiceSummary -> String
showsPrec :: Int -> ServiceSummary -> ShowS
$cshowsPrec :: Int -> ServiceSummary -> ShowS
Prelude.Show, (forall x. ServiceSummary -> Rep ServiceSummary x)
-> (forall x. Rep ServiceSummary x -> ServiceSummary)
-> Generic ServiceSummary
forall x. Rep ServiceSummary x -> ServiceSummary
forall x. ServiceSummary -> Rep ServiceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServiceSummary x -> ServiceSummary
$cfrom :: forall x. ServiceSummary -> Rep ServiceSummary x
Prelude.Generic)

-- |
-- Create a value of 'ServiceSummary' 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:
--
-- 'status', 'serviceSummary_status' - The current state of the App Runner service. These particular values
-- mean the following.
--
-- -   @CREATE_FAILED@ – The service failed to create. Read the failure
--     events and logs, change any parameters that need to be fixed, and
--     retry the call to create the service.
--
--     The failed service isn\'t usable, and still counts towards your
--     service quota. When you\'re done analyzing the failure, delete the
--     service.
--
-- -   @DELETE_FAILED@ – The service failed to delete and can\'t be
--     successfully recovered. Retry the service deletion call to ensure
--     that all related resources are removed.
--
-- 'createdAt', 'serviceSummary_createdAt' - The time when the App Runner service was created. It\'s in the Unix time
-- stamp format.
--
-- 'serviceUrl', 'serviceSummary_serviceUrl' - A subdomain URL that App Runner generated for this service. You can use
-- this URL to access your service web application.
--
-- 'serviceName', 'serviceSummary_serviceName' - The customer-provided service name.
--
-- 'updatedAt', 'serviceSummary_updatedAt' - The time when the App Runner service was last updated. It\'s in theUnix
-- time stamp format.
--
-- 'serviceArn', 'serviceSummary_serviceArn' - The Amazon Resource Name (ARN) of this service.
--
-- 'serviceId', 'serviceSummary_serviceId' - An ID that App Runner generated for this service. It\'s unique within
-- the Amazon Web Services Region.
newServiceSummary ::
  ServiceSummary
newServiceSummary :: ServiceSummary
newServiceSummary =
  ServiceSummary' :: Maybe ServiceStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> ServiceSummary
ServiceSummary'
    { $sel:status:ServiceSummary' :: Maybe ServiceStatus
status = Maybe ServiceStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:ServiceSummary' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceUrl:ServiceSummary' :: Maybe Text
serviceUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceName:ServiceSummary' :: Maybe Text
serviceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:ServiceSummary' :: Maybe POSIX
updatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceArn:ServiceSummary' :: Maybe Text
serviceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceId:ServiceSummary' :: Maybe Text
serviceId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The current state of the App Runner service. These particular values
-- mean the following.
--
-- -   @CREATE_FAILED@ – The service failed to create. Read the failure
--     events and logs, change any parameters that need to be fixed, and
--     retry the call to create the service.
--
--     The failed service isn\'t usable, and still counts towards your
--     service quota. When you\'re done analyzing the failure, delete the
--     service.
--
-- -   @DELETE_FAILED@ – The service failed to delete and can\'t be
--     successfully recovered. Retry the service deletion call to ensure
--     that all related resources are removed.
serviceSummary_status :: Lens.Lens' ServiceSummary (Prelude.Maybe ServiceStatus)
serviceSummary_status :: (Maybe ServiceStatus -> f (Maybe ServiceStatus))
-> ServiceSummary -> f ServiceSummary
serviceSummary_status = (ServiceSummary -> Maybe ServiceStatus)
-> (ServiceSummary -> Maybe ServiceStatus -> ServiceSummary)
-> Lens
     ServiceSummary
     ServiceSummary
     (Maybe ServiceStatus)
     (Maybe ServiceStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSummary' {Maybe ServiceStatus
status :: Maybe ServiceStatus
$sel:status:ServiceSummary' :: ServiceSummary -> Maybe ServiceStatus
status} -> Maybe ServiceStatus
status) (\s :: ServiceSummary
s@ServiceSummary' {} Maybe ServiceStatus
a -> ServiceSummary
s {$sel:status:ServiceSummary' :: Maybe ServiceStatus
status = Maybe ServiceStatus
a} :: ServiceSummary)

-- | The time when the App Runner service was created. It\'s in the Unix time
-- stamp format.
serviceSummary_createdAt :: Lens.Lens' ServiceSummary (Prelude.Maybe Prelude.UTCTime)
serviceSummary_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ServiceSummary -> f ServiceSummary
serviceSummary_createdAt = (ServiceSummary -> Maybe POSIX)
-> (ServiceSummary -> Maybe POSIX -> ServiceSummary)
-> Lens ServiceSummary ServiceSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSummary' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:ServiceSummary' :: ServiceSummary -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: ServiceSummary
s@ServiceSummary' {} Maybe POSIX
a -> ServiceSummary
s {$sel:createdAt:ServiceSummary' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: ServiceSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> ServiceSummary -> f ServiceSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ServiceSummary
-> f ServiceSummary
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

-- | A subdomain URL that App Runner generated for this service. You can use
-- this URL to access your service web application.
serviceSummary_serviceUrl :: Lens.Lens' ServiceSummary (Prelude.Maybe Prelude.Text)
serviceSummary_serviceUrl :: (Maybe Text -> f (Maybe Text))
-> ServiceSummary -> f ServiceSummary
serviceSummary_serviceUrl = (ServiceSummary -> Maybe Text)
-> (ServiceSummary -> Maybe Text -> ServiceSummary)
-> Lens ServiceSummary ServiceSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSummary' {Maybe Text
serviceUrl :: Maybe Text
$sel:serviceUrl:ServiceSummary' :: ServiceSummary -> Maybe Text
serviceUrl} -> Maybe Text
serviceUrl) (\s :: ServiceSummary
s@ServiceSummary' {} Maybe Text
a -> ServiceSummary
s {$sel:serviceUrl:ServiceSummary' :: Maybe Text
serviceUrl = Maybe Text
a} :: ServiceSummary)

-- | The customer-provided service name.
serviceSummary_serviceName :: Lens.Lens' ServiceSummary (Prelude.Maybe Prelude.Text)
serviceSummary_serviceName :: (Maybe Text -> f (Maybe Text))
-> ServiceSummary -> f ServiceSummary
serviceSummary_serviceName = (ServiceSummary -> Maybe Text)
-> (ServiceSummary -> Maybe Text -> ServiceSummary)
-> Lens ServiceSummary ServiceSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSummary' {Maybe Text
serviceName :: Maybe Text
$sel:serviceName:ServiceSummary' :: ServiceSummary -> Maybe Text
serviceName} -> Maybe Text
serviceName) (\s :: ServiceSummary
s@ServiceSummary' {} Maybe Text
a -> ServiceSummary
s {$sel:serviceName:ServiceSummary' :: Maybe Text
serviceName = Maybe Text
a} :: ServiceSummary)

-- | The time when the App Runner service was last updated. It\'s in theUnix
-- time stamp format.
serviceSummary_updatedAt :: Lens.Lens' ServiceSummary (Prelude.Maybe Prelude.UTCTime)
serviceSummary_updatedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ServiceSummary -> f ServiceSummary
serviceSummary_updatedAt = (ServiceSummary -> Maybe POSIX)
-> (ServiceSummary -> Maybe POSIX -> ServiceSummary)
-> Lens ServiceSummary ServiceSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSummary' {Maybe POSIX
updatedAt :: Maybe POSIX
$sel:updatedAt:ServiceSummary' :: ServiceSummary -> Maybe POSIX
updatedAt} -> Maybe POSIX
updatedAt) (\s :: ServiceSummary
s@ServiceSummary' {} Maybe POSIX
a -> ServiceSummary
s {$sel:updatedAt:ServiceSummary' :: Maybe POSIX
updatedAt = Maybe POSIX
a} :: ServiceSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> ServiceSummary -> f ServiceSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ServiceSummary
-> f ServiceSummary
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 Amazon Resource Name (ARN) of this service.
serviceSummary_serviceArn :: Lens.Lens' ServiceSummary (Prelude.Maybe Prelude.Text)
serviceSummary_serviceArn :: (Maybe Text -> f (Maybe Text))
-> ServiceSummary -> f ServiceSummary
serviceSummary_serviceArn = (ServiceSummary -> Maybe Text)
-> (ServiceSummary -> Maybe Text -> ServiceSummary)
-> Lens ServiceSummary ServiceSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSummary' {Maybe Text
serviceArn :: Maybe Text
$sel:serviceArn:ServiceSummary' :: ServiceSummary -> Maybe Text
serviceArn} -> Maybe Text
serviceArn) (\s :: ServiceSummary
s@ServiceSummary' {} Maybe Text
a -> ServiceSummary
s {$sel:serviceArn:ServiceSummary' :: Maybe Text
serviceArn = Maybe Text
a} :: ServiceSummary)

-- | An ID that App Runner generated for this service. It\'s unique within
-- the Amazon Web Services Region.
serviceSummary_serviceId :: Lens.Lens' ServiceSummary (Prelude.Maybe Prelude.Text)
serviceSummary_serviceId :: (Maybe Text -> f (Maybe Text))
-> ServiceSummary -> f ServiceSummary
serviceSummary_serviceId = (ServiceSummary -> Maybe Text)
-> (ServiceSummary -> Maybe Text -> ServiceSummary)
-> Lens ServiceSummary ServiceSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSummary' {Maybe Text
serviceId :: Maybe Text
$sel:serviceId:ServiceSummary' :: ServiceSummary -> Maybe Text
serviceId} -> Maybe Text
serviceId) (\s :: ServiceSummary
s@ServiceSummary' {} Maybe Text
a -> ServiceSummary
s {$sel:serviceId:ServiceSummary' :: Maybe Text
serviceId = Maybe Text
a} :: ServiceSummary)

instance Core.FromJSON ServiceSummary where
  parseJSON :: Value -> Parser ServiceSummary
parseJSON =
    String
-> (Object -> Parser ServiceSummary)
-> Value
-> Parser ServiceSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ServiceSummary"
      ( \Object
x ->
          Maybe ServiceStatus
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> ServiceSummary
ServiceSummary'
            (Maybe ServiceStatus
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> ServiceSummary)
-> Parser (Maybe ServiceStatus)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> ServiceSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ServiceStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> ServiceSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> ServiceSummary)
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
"CreatedAt")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> ServiceSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX -> Maybe Text -> Maybe Text -> ServiceSummary)
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
"ServiceUrl")
            Parser
  (Maybe Text
   -> Maybe POSIX -> Maybe Text -> Maybe Text -> ServiceSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX -> Maybe Text -> Maybe Text -> ServiceSummary)
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 POSIX -> Maybe Text -> Maybe Text -> ServiceSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> ServiceSummary)
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
"UpdatedAt")
            Parser (Maybe Text -> Maybe Text -> ServiceSummary)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ServiceSummary)
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
"ServiceArn")
            Parser (Maybe Text -> ServiceSummary)
-> Parser (Maybe Text) -> Parser ServiceSummary
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
"ServiceId")
      )

instance Prelude.Hashable ServiceSummary

instance Prelude.NFData ServiceSummary