{-# 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.CodeDeploy.Types.ApplicationInfo
-- 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.CodeDeploy.Types.ApplicationInfo where

import Amazonka.CodeDeploy.Types.ComputePlatform
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about an application.
--
-- /See:/ 'newApplicationInfo' smart constructor.
data ApplicationInfo = ApplicationInfo'
  { -- | True if the user has authenticated with GitHub for the specified
    -- application. Otherwise, false.
    ApplicationInfo -> Maybe Bool
linkedToGitHub :: Prelude.Maybe Prelude.Bool,
    -- | The destination platform type for deployment of the application
    -- (@Lambda@ or @Server@).
    ApplicationInfo -> Maybe ComputePlatform
computePlatform :: Prelude.Maybe ComputePlatform,
    -- | The application ID.
    ApplicationInfo -> Maybe Text
applicationId :: Prelude.Maybe Prelude.Text,
    -- | The application name.
    ApplicationInfo -> Maybe Text
applicationName :: Prelude.Maybe Prelude.Text,
    -- | The name for a connection to a GitHub account.
    ApplicationInfo -> Maybe Text
gitHubAccountName :: Prelude.Maybe Prelude.Text,
    -- | The time at which the application was created.
    ApplicationInfo -> Maybe POSIX
createTime :: Prelude.Maybe Core.POSIX
  }
  deriving (ApplicationInfo -> ApplicationInfo -> Bool
(ApplicationInfo -> ApplicationInfo -> Bool)
-> (ApplicationInfo -> ApplicationInfo -> Bool)
-> Eq ApplicationInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationInfo -> ApplicationInfo -> Bool
$c/= :: ApplicationInfo -> ApplicationInfo -> Bool
== :: ApplicationInfo -> ApplicationInfo -> Bool
$c== :: ApplicationInfo -> ApplicationInfo -> Bool
Prelude.Eq, ReadPrec [ApplicationInfo]
ReadPrec ApplicationInfo
Int -> ReadS ApplicationInfo
ReadS [ApplicationInfo]
(Int -> ReadS ApplicationInfo)
-> ReadS [ApplicationInfo]
-> ReadPrec ApplicationInfo
-> ReadPrec [ApplicationInfo]
-> Read ApplicationInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplicationInfo]
$creadListPrec :: ReadPrec [ApplicationInfo]
readPrec :: ReadPrec ApplicationInfo
$creadPrec :: ReadPrec ApplicationInfo
readList :: ReadS [ApplicationInfo]
$creadList :: ReadS [ApplicationInfo]
readsPrec :: Int -> ReadS ApplicationInfo
$creadsPrec :: Int -> ReadS ApplicationInfo
Prelude.Read, Int -> ApplicationInfo -> ShowS
[ApplicationInfo] -> ShowS
ApplicationInfo -> String
(Int -> ApplicationInfo -> ShowS)
-> (ApplicationInfo -> String)
-> ([ApplicationInfo] -> ShowS)
-> Show ApplicationInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationInfo] -> ShowS
$cshowList :: [ApplicationInfo] -> ShowS
show :: ApplicationInfo -> String
$cshow :: ApplicationInfo -> String
showsPrec :: Int -> ApplicationInfo -> ShowS
$cshowsPrec :: Int -> ApplicationInfo -> ShowS
Prelude.Show, (forall x. ApplicationInfo -> Rep ApplicationInfo x)
-> (forall x. Rep ApplicationInfo x -> ApplicationInfo)
-> Generic ApplicationInfo
forall x. Rep ApplicationInfo x -> ApplicationInfo
forall x. ApplicationInfo -> Rep ApplicationInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApplicationInfo x -> ApplicationInfo
$cfrom :: forall x. ApplicationInfo -> Rep ApplicationInfo x
Prelude.Generic)

-- |
-- Create a value of 'ApplicationInfo' 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:
--
-- 'linkedToGitHub', 'applicationInfo_linkedToGitHub' - True if the user has authenticated with GitHub for the specified
-- application. Otherwise, false.
--
-- 'computePlatform', 'applicationInfo_computePlatform' - The destination platform type for deployment of the application
-- (@Lambda@ or @Server@).
--
-- 'applicationId', 'applicationInfo_applicationId' - The application ID.
--
-- 'applicationName', 'applicationInfo_applicationName' - The application name.
--
-- 'gitHubAccountName', 'applicationInfo_gitHubAccountName' - The name for a connection to a GitHub account.
--
-- 'createTime', 'applicationInfo_createTime' - The time at which the application was created.
newApplicationInfo ::
  ApplicationInfo
newApplicationInfo :: ApplicationInfo
newApplicationInfo =
  ApplicationInfo' :: Maybe Bool
-> Maybe ComputePlatform
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> ApplicationInfo
ApplicationInfo'
    { $sel:linkedToGitHub:ApplicationInfo' :: Maybe Bool
linkedToGitHub = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:computePlatform:ApplicationInfo' :: Maybe ComputePlatform
computePlatform = Maybe ComputePlatform
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationId:ApplicationInfo' :: Maybe Text
applicationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationName:ApplicationInfo' :: Maybe Text
applicationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gitHubAccountName:ApplicationInfo' :: Maybe Text
gitHubAccountName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createTime:ApplicationInfo' :: Maybe POSIX
createTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | True if the user has authenticated with GitHub for the specified
-- application. Otherwise, false.
applicationInfo_linkedToGitHub :: Lens.Lens' ApplicationInfo (Prelude.Maybe Prelude.Bool)
applicationInfo_linkedToGitHub :: (Maybe Bool -> f (Maybe Bool))
-> ApplicationInfo -> f ApplicationInfo
applicationInfo_linkedToGitHub = (ApplicationInfo -> Maybe Bool)
-> (ApplicationInfo -> Maybe Bool -> ApplicationInfo)
-> Lens ApplicationInfo ApplicationInfo (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationInfo' {Maybe Bool
linkedToGitHub :: Maybe Bool
$sel:linkedToGitHub:ApplicationInfo' :: ApplicationInfo -> Maybe Bool
linkedToGitHub} -> Maybe Bool
linkedToGitHub) (\s :: ApplicationInfo
s@ApplicationInfo' {} Maybe Bool
a -> ApplicationInfo
s {$sel:linkedToGitHub:ApplicationInfo' :: Maybe Bool
linkedToGitHub = Maybe Bool
a} :: ApplicationInfo)

-- | The destination platform type for deployment of the application
-- (@Lambda@ or @Server@).
applicationInfo_computePlatform :: Lens.Lens' ApplicationInfo (Prelude.Maybe ComputePlatform)
applicationInfo_computePlatform :: (Maybe ComputePlatform -> f (Maybe ComputePlatform))
-> ApplicationInfo -> f ApplicationInfo
applicationInfo_computePlatform = (ApplicationInfo -> Maybe ComputePlatform)
-> (ApplicationInfo -> Maybe ComputePlatform -> ApplicationInfo)
-> Lens
     ApplicationInfo
     ApplicationInfo
     (Maybe ComputePlatform)
     (Maybe ComputePlatform)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationInfo' {Maybe ComputePlatform
computePlatform :: Maybe ComputePlatform
$sel:computePlatform:ApplicationInfo' :: ApplicationInfo -> Maybe ComputePlatform
computePlatform} -> Maybe ComputePlatform
computePlatform) (\s :: ApplicationInfo
s@ApplicationInfo' {} Maybe ComputePlatform
a -> ApplicationInfo
s {$sel:computePlatform:ApplicationInfo' :: Maybe ComputePlatform
computePlatform = Maybe ComputePlatform
a} :: ApplicationInfo)

-- | The application ID.
applicationInfo_applicationId :: Lens.Lens' ApplicationInfo (Prelude.Maybe Prelude.Text)
applicationInfo_applicationId :: (Maybe Text -> f (Maybe Text))
-> ApplicationInfo -> f ApplicationInfo
applicationInfo_applicationId = (ApplicationInfo -> Maybe Text)
-> (ApplicationInfo -> Maybe Text -> ApplicationInfo)
-> Lens ApplicationInfo ApplicationInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationInfo' {Maybe Text
applicationId :: Maybe Text
$sel:applicationId:ApplicationInfo' :: ApplicationInfo -> Maybe Text
applicationId} -> Maybe Text
applicationId) (\s :: ApplicationInfo
s@ApplicationInfo' {} Maybe Text
a -> ApplicationInfo
s {$sel:applicationId:ApplicationInfo' :: Maybe Text
applicationId = Maybe Text
a} :: ApplicationInfo)

-- | The application name.
applicationInfo_applicationName :: Lens.Lens' ApplicationInfo (Prelude.Maybe Prelude.Text)
applicationInfo_applicationName :: (Maybe Text -> f (Maybe Text))
-> ApplicationInfo -> f ApplicationInfo
applicationInfo_applicationName = (ApplicationInfo -> Maybe Text)
-> (ApplicationInfo -> Maybe Text -> ApplicationInfo)
-> Lens ApplicationInfo ApplicationInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationInfo' {Maybe Text
applicationName :: Maybe Text
$sel:applicationName:ApplicationInfo' :: ApplicationInfo -> Maybe Text
applicationName} -> Maybe Text
applicationName) (\s :: ApplicationInfo
s@ApplicationInfo' {} Maybe Text
a -> ApplicationInfo
s {$sel:applicationName:ApplicationInfo' :: Maybe Text
applicationName = Maybe Text
a} :: ApplicationInfo)

-- | The name for a connection to a GitHub account.
applicationInfo_gitHubAccountName :: Lens.Lens' ApplicationInfo (Prelude.Maybe Prelude.Text)
applicationInfo_gitHubAccountName :: (Maybe Text -> f (Maybe Text))
-> ApplicationInfo -> f ApplicationInfo
applicationInfo_gitHubAccountName = (ApplicationInfo -> Maybe Text)
-> (ApplicationInfo -> Maybe Text -> ApplicationInfo)
-> Lens ApplicationInfo ApplicationInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationInfo' {Maybe Text
gitHubAccountName :: Maybe Text
$sel:gitHubAccountName:ApplicationInfo' :: ApplicationInfo -> Maybe Text
gitHubAccountName} -> Maybe Text
gitHubAccountName) (\s :: ApplicationInfo
s@ApplicationInfo' {} Maybe Text
a -> ApplicationInfo
s {$sel:gitHubAccountName:ApplicationInfo' :: Maybe Text
gitHubAccountName = Maybe Text
a} :: ApplicationInfo)

-- | The time at which the application was created.
applicationInfo_createTime :: Lens.Lens' ApplicationInfo (Prelude.Maybe Prelude.UTCTime)
applicationInfo_createTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ApplicationInfo -> f ApplicationInfo
applicationInfo_createTime = (ApplicationInfo -> Maybe POSIX)
-> (ApplicationInfo -> Maybe POSIX -> ApplicationInfo)
-> Lens ApplicationInfo ApplicationInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationInfo' {Maybe POSIX
createTime :: Maybe POSIX
$sel:createTime:ApplicationInfo' :: ApplicationInfo -> Maybe POSIX
createTime} -> Maybe POSIX
createTime) (\s :: ApplicationInfo
s@ApplicationInfo' {} Maybe POSIX
a -> ApplicationInfo
s {$sel:createTime:ApplicationInfo' :: Maybe POSIX
createTime = Maybe POSIX
a} :: ApplicationInfo) ((Maybe POSIX -> f (Maybe POSIX))
 -> ApplicationInfo -> f ApplicationInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ApplicationInfo
-> f ApplicationInfo
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

instance Core.FromJSON ApplicationInfo where
  parseJSON :: Value -> Parser ApplicationInfo
parseJSON =
    String
-> (Object -> Parser ApplicationInfo)
-> Value
-> Parser ApplicationInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ApplicationInfo"
      ( \Object
x ->
          Maybe Bool
-> Maybe ComputePlatform
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> ApplicationInfo
ApplicationInfo'
            (Maybe Bool
 -> Maybe ComputePlatform
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> ApplicationInfo)
-> Parser (Maybe Bool)
-> Parser
     (Maybe ComputePlatform
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> ApplicationInfo)
forall (f :: * -> *) a b. Functor 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
"linkedToGitHub")
            Parser
  (Maybe ComputePlatform
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> ApplicationInfo)
-> Parser (Maybe ComputePlatform)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe POSIX -> ApplicationInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ComputePlatform)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"computePlatform")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe POSIX -> ApplicationInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe POSIX -> ApplicationInfo)
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
"applicationId")
            Parser (Maybe Text -> Maybe Text -> Maybe POSIX -> ApplicationInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> ApplicationInfo)
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
"applicationName")
            Parser (Maybe Text -> Maybe POSIX -> ApplicationInfo)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> ApplicationInfo)
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
"gitHubAccountName")
            Parser (Maybe POSIX -> ApplicationInfo)
-> Parser (Maybe POSIX) -> Parser ApplicationInfo
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
"createTime")
      )

instance Prelude.Hashable ApplicationInfo

instance Prelude.NFData ApplicationInfo