{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Provides summary information about an App Runner connection resource.
--
-- /See:/ 'newConnectionSummary' smart constructor.
data ConnectionSummary = ConnectionSummary'
  { -- | The Amazon Resource Name (ARN) of this connection.
    ConnectionSummary -> Maybe Text
connectionArn :: Prelude.Maybe Prelude.Text,
    -- | The customer-provided connection name.
    ConnectionSummary -> Maybe Text
connectionName :: Prelude.Maybe Prelude.Text,
    -- | The App Runner connection creation time, expressed as a Unix time stamp.
    ConnectionSummary -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | The source repository provider.
    ConnectionSummary -> Maybe ProviderType
providerType :: Prelude.Maybe ProviderType,
    -- | 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
  }
  deriving (ConnectionSummary -> ConnectionSummary -> Bool
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]
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
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. 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:
--
-- 'connectionArn', 'connectionSummary_connectionArn' - The Amazon Resource Name (ARN) of this connection.
--
-- 'connectionName', 'connectionSummary_connectionName' - The customer-provided connection name.
--
-- 'createdAt', 'connectionSummary_createdAt' - The App Runner connection creation time, expressed as a Unix time stamp.
--
-- 'providerType', 'connectionSummary_providerType' - The source repository provider.
--
-- '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.
newConnectionSummary ::
  ConnectionSummary
newConnectionSummary :: ConnectionSummary
newConnectionSummary =
  ConnectionSummary'
    { $sel:connectionArn:ConnectionSummary' :: Maybe Text
connectionArn = forall a. Maybe a
Prelude.Nothing,
      $sel:connectionName:ConnectionSummary' :: Maybe Text
connectionName = forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:ConnectionSummary' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:providerType:ConnectionSummary' :: Maybe ProviderType
providerType = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ConnectionSummary' :: Maybe ConnectionStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of this connection.
connectionSummary_connectionArn :: Lens.Lens' ConnectionSummary (Prelude.Maybe Prelude.Text)
connectionSummary_connectionArn :: Lens' ConnectionSummary (Maybe Text)
connectionSummary_connectionArn = 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)

-- | The customer-provided connection name.
connectionSummary_connectionName :: Lens.Lens' ConnectionSummary (Prelude.Maybe Prelude.Text)
connectionSummary_connectionName :: Lens' ConnectionSummary (Maybe Text)
connectionSummary_connectionName = 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 App Runner connection creation time, expressed as a Unix time stamp.
connectionSummary_createdAt :: Lens.Lens' ConnectionSummary (Prelude.Maybe Prelude.UTCTime)
connectionSummary_createdAt :: Lens' ConnectionSummary (Maybe UTCTime)
connectionSummary_createdAt = 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) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The source repository provider.
connectionSummary_providerType :: Lens.Lens' ConnectionSummary (Prelude.Maybe ProviderType)
connectionSummary_providerType :: Lens' ConnectionSummary (Maybe ProviderType)
connectionSummary_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 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 :: Lens' ConnectionSummary (Maybe ConnectionStatus)
connectionSummary_status = 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)

instance Data.FromJSON ConnectionSummary where
  parseJSON :: Value -> Parser ConnectionSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConnectionSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe ProviderType
-> Maybe ConnectionStatus
-> ConnectionSummary
ConnectionSummary'
            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
"ConnectionArn")
            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
"ConnectionName")
            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
"CreatedAt")
            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
"ProviderType")
            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
"Status")
      )

instance Prelude.Hashable ConnectionSummary where
  hashWithSalt :: Int -> ConnectionSummary -> Int
hashWithSalt Int
_salt ConnectionSummary' {Maybe Text
Maybe POSIX
Maybe ConnectionStatus
Maybe ProviderType
status :: Maybe ConnectionStatus
providerType :: Maybe ProviderType
createdAt :: Maybe POSIX
connectionName :: Maybe Text
connectionArn :: Maybe Text
$sel:status:ConnectionSummary' :: ConnectionSummary -> Maybe ConnectionStatus
$sel:providerType:ConnectionSummary' :: ConnectionSummary -> Maybe ProviderType
$sel:createdAt:ConnectionSummary' :: ConnectionSummary -> Maybe POSIX
$sel:connectionName:ConnectionSummary' :: ConnectionSummary -> Maybe Text
$sel:connectionArn:ConnectionSummary' :: ConnectionSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectionArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProviderType
providerType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConnectionStatus
status

instance Prelude.NFData ConnectionSummary where
  rnf :: ConnectionSummary -> ()
rnf ConnectionSummary' {Maybe Text
Maybe POSIX
Maybe ConnectionStatus
Maybe ProviderType
status :: Maybe ConnectionStatus
providerType :: Maybe ProviderType
createdAt :: Maybe POSIX
connectionName :: Maybe Text
connectionArn :: Maybe Text
$sel:status:ConnectionSummary' :: ConnectionSummary -> Maybe ConnectionStatus
$sel:providerType:ConnectionSummary' :: ConnectionSummary -> Maybe ProviderType
$sel:createdAt:ConnectionSummary' :: ConnectionSummary -> Maybe POSIX
$sel:connectionName:ConnectionSummary' :: ConnectionSummary -> Maybe Text
$sel:connectionArn:ConnectionSummary' :: ConnectionSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectionArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProviderType
providerType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectionStatus
status