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

import Amazonka.AppRunner.Types.ConnectionStatus
import Amazonka.AppRunner.Types.ProviderType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides summary information about an App Runner connection resource.
--
-- /See:/ 'newConnectionSummary' smart constructor.
data ConnectionSummary = ConnectionSummary'
  { -- | The current state of the App Runner connection. When the state is
    -- @AVAILABLE@, you can use the connection to create an App Runner service.
    ConnectionSummary -> Maybe ConnectionStatus
status :: Prelude.Maybe ConnectionStatus,
    -- | The App Runner connection creation time, expressed as a Unix time stamp.
    ConnectionSummary -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The source repository provider.
    ConnectionSummary -> Maybe ProviderType
providerType :: Prelude.Maybe ProviderType,
    -- | The customer-provided connection name.
    ConnectionSummary -> Maybe Text
connectionName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of this connection.
    ConnectionSummary -> Maybe Text
connectionArn :: Prelude.Maybe Prelude.Text
  }
  deriving (ConnectionSummary -> ConnectionSummary -> Bool
(ConnectionSummary -> ConnectionSummary -> Bool)
-> (ConnectionSummary -> ConnectionSummary -> Bool)
-> Eq ConnectionSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionSummary -> ConnectionSummary -> Bool
$c/= :: ConnectionSummary -> ConnectionSummary -> Bool
== :: ConnectionSummary -> ConnectionSummary -> Bool
$c== :: ConnectionSummary -> ConnectionSummary -> Bool
Prelude.Eq, ReadPrec [ConnectionSummary]
ReadPrec ConnectionSummary
Int -> ReadS ConnectionSummary
ReadS [ConnectionSummary]
(Int -> ReadS ConnectionSummary)
-> ReadS [ConnectionSummary]
-> ReadPrec ConnectionSummary
-> ReadPrec [ConnectionSummary]
-> Read ConnectionSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectionSummary]
$creadListPrec :: ReadPrec [ConnectionSummary]
readPrec :: ReadPrec ConnectionSummary
$creadPrec :: ReadPrec ConnectionSummary
readList :: ReadS [ConnectionSummary]
$creadList :: ReadS [ConnectionSummary]
readsPrec :: Int -> ReadS ConnectionSummary
$creadsPrec :: Int -> ReadS ConnectionSummary
Prelude.Read, Int -> ConnectionSummary -> ShowS
[ConnectionSummary] -> ShowS
ConnectionSummary -> String
(Int -> ConnectionSummary -> ShowS)
-> (ConnectionSummary -> String)
-> ([ConnectionSummary] -> ShowS)
-> Show ConnectionSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectionSummary] -> ShowS
$cshowList :: [ConnectionSummary] -> ShowS
show :: ConnectionSummary -> String
$cshow :: ConnectionSummary -> String
showsPrec :: Int -> ConnectionSummary -> ShowS
$cshowsPrec :: Int -> ConnectionSummary -> ShowS
Prelude.Show, (forall x. ConnectionSummary -> Rep ConnectionSummary x)
-> (forall x. Rep ConnectionSummary x -> ConnectionSummary)
-> Generic ConnectionSummary
forall x. Rep ConnectionSummary x -> ConnectionSummary
forall x. ConnectionSummary -> Rep ConnectionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConnectionSummary x -> ConnectionSummary
$cfrom :: forall x. ConnectionSummary -> Rep ConnectionSummary x
Prelude.Generic)

-- |
-- Create a value of 'ConnectionSummary' 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', 'connectionSummary_status' - The current state of the App Runner connection. When the state is
-- @AVAILABLE@, you can use the connection to create an App Runner service.
--
-- 'createdAt', 'connectionSummary_createdAt' - The App Runner connection creation time, expressed as a Unix time stamp.
--
-- 'providerType', 'connectionSummary_providerType' - The source repository provider.
--
-- 'connectionName', 'connectionSummary_connectionName' - The customer-provided connection name.
--
-- 'connectionArn', 'connectionSummary_connectionArn' - The Amazon Resource Name (ARN) of this connection.
newConnectionSummary ::
  ConnectionSummary
newConnectionSummary :: ConnectionSummary
newConnectionSummary =
  ConnectionSummary' :: Maybe ConnectionStatus
-> Maybe POSIX
-> Maybe ProviderType
-> Maybe Text
-> Maybe Text
-> ConnectionSummary
ConnectionSummary'
    { $sel:status:ConnectionSummary' :: Maybe ConnectionStatus
status = Maybe ConnectionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:ConnectionSummary' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:providerType:ConnectionSummary' :: Maybe ProviderType
providerType = Maybe ProviderType
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionName:ConnectionSummary' :: Maybe Text
connectionName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionArn:ConnectionSummary' :: Maybe Text
connectionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The current state of the App Runner connection. When the state is
-- @AVAILABLE@, you can use the connection to create an App Runner service.
connectionSummary_status :: Lens.Lens' ConnectionSummary (Prelude.Maybe ConnectionStatus)
connectionSummary_status :: (Maybe ConnectionStatus -> f (Maybe ConnectionStatus))
-> ConnectionSummary -> f ConnectionSummary
connectionSummary_status = (ConnectionSummary -> Maybe ConnectionStatus)
-> (ConnectionSummary
    -> Maybe ConnectionStatus -> ConnectionSummary)
-> Lens
     ConnectionSummary
     ConnectionSummary
     (Maybe ConnectionStatus)
     (Maybe ConnectionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionSummary' {Maybe ConnectionStatus
status :: Maybe ConnectionStatus
$sel:status:ConnectionSummary' :: ConnectionSummary -> Maybe ConnectionStatus
status} -> Maybe ConnectionStatus
status) (\s :: ConnectionSummary
s@ConnectionSummary' {} Maybe ConnectionStatus
a -> ConnectionSummary
s {$sel:status:ConnectionSummary' :: Maybe ConnectionStatus
status = Maybe ConnectionStatus
a} :: ConnectionSummary)

-- | The App Runner connection creation time, expressed as a Unix time stamp.
connectionSummary_createdAt :: Lens.Lens' ConnectionSummary (Prelude.Maybe Prelude.UTCTime)
connectionSummary_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ConnectionSummary -> f ConnectionSummary
connectionSummary_createdAt = (ConnectionSummary -> Maybe POSIX)
-> (ConnectionSummary -> Maybe POSIX -> ConnectionSummary)
-> Lens
     ConnectionSummary ConnectionSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionSummary' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:ConnectionSummary' :: ConnectionSummary -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: ConnectionSummary
s@ConnectionSummary' {} Maybe POSIX
a -> ConnectionSummary
s {$sel:createdAt:ConnectionSummary' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: ConnectionSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> ConnectionSummary -> f ConnectionSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ConnectionSummary
-> f ConnectionSummary
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 source repository provider.
connectionSummary_providerType :: Lens.Lens' ConnectionSummary (Prelude.Maybe ProviderType)
connectionSummary_providerType :: (Maybe ProviderType -> f (Maybe ProviderType))
-> ConnectionSummary -> f ConnectionSummary
connectionSummary_providerType = (ConnectionSummary -> Maybe ProviderType)
-> (ConnectionSummary -> Maybe ProviderType -> ConnectionSummary)
-> Lens
     ConnectionSummary
     ConnectionSummary
     (Maybe ProviderType)
     (Maybe ProviderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionSummary' {Maybe ProviderType
providerType :: Maybe ProviderType
$sel:providerType:ConnectionSummary' :: ConnectionSummary -> Maybe ProviderType
providerType} -> Maybe ProviderType
providerType) (\s :: ConnectionSummary
s@ConnectionSummary' {} Maybe ProviderType
a -> ConnectionSummary
s {$sel:providerType:ConnectionSummary' :: Maybe ProviderType
providerType = Maybe ProviderType
a} :: ConnectionSummary)

-- | The customer-provided connection name.
connectionSummary_connectionName :: Lens.Lens' ConnectionSummary (Prelude.Maybe Prelude.Text)
connectionSummary_connectionName :: (Maybe Text -> f (Maybe Text))
-> ConnectionSummary -> f ConnectionSummary
connectionSummary_connectionName = (ConnectionSummary -> Maybe Text)
-> (ConnectionSummary -> Maybe Text -> ConnectionSummary)
-> Lens
     ConnectionSummary ConnectionSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionSummary' {Maybe Text
connectionName :: Maybe Text
$sel:connectionName:ConnectionSummary' :: ConnectionSummary -> Maybe Text
connectionName} -> Maybe Text
connectionName) (\s :: ConnectionSummary
s@ConnectionSummary' {} Maybe Text
a -> ConnectionSummary
s {$sel:connectionName:ConnectionSummary' :: Maybe Text
connectionName = Maybe Text
a} :: ConnectionSummary)

-- | The Amazon Resource Name (ARN) of this connection.
connectionSummary_connectionArn :: Lens.Lens' ConnectionSummary (Prelude.Maybe Prelude.Text)
connectionSummary_connectionArn :: (Maybe Text -> f (Maybe Text))
-> ConnectionSummary -> f ConnectionSummary
connectionSummary_connectionArn = (ConnectionSummary -> Maybe Text)
-> (ConnectionSummary -> Maybe Text -> ConnectionSummary)
-> Lens
     ConnectionSummary ConnectionSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionSummary' {Maybe Text
connectionArn :: Maybe Text
$sel:connectionArn:ConnectionSummary' :: ConnectionSummary -> Maybe Text
connectionArn} -> Maybe Text
connectionArn) (\s :: ConnectionSummary
s@ConnectionSummary' {} Maybe Text
a -> ConnectionSummary
s {$sel:connectionArn:ConnectionSummary' :: Maybe Text
connectionArn = Maybe Text
a} :: ConnectionSummary)

instance Core.FromJSON ConnectionSummary where
  parseJSON :: Value -> Parser ConnectionSummary
parseJSON =
    String
-> (Object -> Parser ConnectionSummary)
-> Value
-> Parser ConnectionSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConnectionSummary"
      ( \Object
x ->
          Maybe ConnectionStatus
-> Maybe POSIX
-> Maybe ProviderType
-> Maybe Text
-> Maybe Text
-> ConnectionSummary
ConnectionSummary'
            (Maybe ConnectionStatus
 -> Maybe POSIX
 -> Maybe ProviderType
 -> Maybe Text
 -> Maybe Text
 -> ConnectionSummary)
-> Parser (Maybe ConnectionStatus)
-> Parser
     (Maybe POSIX
      -> Maybe ProviderType
      -> Maybe Text
      -> Maybe Text
      -> ConnectionSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ConnectionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe POSIX
   -> Maybe ProviderType
   -> Maybe Text
   -> Maybe Text
   -> ConnectionSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe ProviderType
      -> Maybe Text -> Maybe Text -> ConnectionSummary)
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 ProviderType
   -> Maybe Text -> Maybe Text -> ConnectionSummary)
-> Parser (Maybe ProviderType)
-> Parser (Maybe Text -> Maybe Text -> ConnectionSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ProviderType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProviderType")
            Parser (Maybe Text -> Maybe Text -> ConnectionSummary)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ConnectionSummary)
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
"ConnectionName")
            Parser (Maybe Text -> ConnectionSummary)
-> Parser (Maybe Text) -> Parser ConnectionSummary
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
"ConnectionArn")
      )

instance Prelude.Hashable ConnectionSummary

instance Prelude.NFData ConnectionSummary