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

import Amazonka.CodeDeploy.Types.GenericRevisionInfo
import Amazonka.CodeDeploy.Types.RevisionLocation
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about an application revision.
--
-- /See:/ 'newRevisionInfo' smart constructor.
data RevisionInfo = RevisionInfo'
  { -- | Information about an application revision, including usage details and
    -- associated deployment groups.
    RevisionInfo -> Maybe GenericRevisionInfo
genericRevisionInfo :: Prelude.Maybe GenericRevisionInfo,
    -- | Information about the location and type of an application revision.
    RevisionInfo -> Maybe RevisionLocation
revisionLocation :: Prelude.Maybe RevisionLocation
  }
  deriving (RevisionInfo -> RevisionInfo -> Bool
(RevisionInfo -> RevisionInfo -> Bool)
-> (RevisionInfo -> RevisionInfo -> Bool) -> Eq RevisionInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevisionInfo -> RevisionInfo -> Bool
$c/= :: RevisionInfo -> RevisionInfo -> Bool
== :: RevisionInfo -> RevisionInfo -> Bool
$c== :: RevisionInfo -> RevisionInfo -> Bool
Prelude.Eq, ReadPrec [RevisionInfo]
ReadPrec RevisionInfo
Int -> ReadS RevisionInfo
ReadS [RevisionInfo]
(Int -> ReadS RevisionInfo)
-> ReadS [RevisionInfo]
-> ReadPrec RevisionInfo
-> ReadPrec [RevisionInfo]
-> Read RevisionInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevisionInfo]
$creadListPrec :: ReadPrec [RevisionInfo]
readPrec :: ReadPrec RevisionInfo
$creadPrec :: ReadPrec RevisionInfo
readList :: ReadS [RevisionInfo]
$creadList :: ReadS [RevisionInfo]
readsPrec :: Int -> ReadS RevisionInfo
$creadsPrec :: Int -> ReadS RevisionInfo
Prelude.Read, Int -> RevisionInfo -> ShowS
[RevisionInfo] -> ShowS
RevisionInfo -> String
(Int -> RevisionInfo -> ShowS)
-> (RevisionInfo -> String)
-> ([RevisionInfo] -> ShowS)
-> Show RevisionInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevisionInfo] -> ShowS
$cshowList :: [RevisionInfo] -> ShowS
show :: RevisionInfo -> String
$cshow :: RevisionInfo -> String
showsPrec :: Int -> RevisionInfo -> ShowS
$cshowsPrec :: Int -> RevisionInfo -> ShowS
Prelude.Show, (forall x. RevisionInfo -> Rep RevisionInfo x)
-> (forall x. Rep RevisionInfo x -> RevisionInfo)
-> Generic RevisionInfo
forall x. Rep RevisionInfo x -> RevisionInfo
forall x. RevisionInfo -> Rep RevisionInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RevisionInfo x -> RevisionInfo
$cfrom :: forall x. RevisionInfo -> Rep RevisionInfo x
Prelude.Generic)

-- |
-- Create a value of 'RevisionInfo' 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:
--
-- 'genericRevisionInfo', 'revisionInfo_genericRevisionInfo' - Information about an application revision, including usage details and
-- associated deployment groups.
--
-- 'revisionLocation', 'revisionInfo_revisionLocation' - Information about the location and type of an application revision.
newRevisionInfo ::
  RevisionInfo
newRevisionInfo :: RevisionInfo
newRevisionInfo =
  RevisionInfo' :: Maybe GenericRevisionInfo -> Maybe RevisionLocation -> RevisionInfo
RevisionInfo'
    { $sel:genericRevisionInfo:RevisionInfo' :: Maybe GenericRevisionInfo
genericRevisionInfo =
        Maybe GenericRevisionInfo
forall a. Maybe a
Prelude.Nothing,
      $sel:revisionLocation:RevisionInfo' :: Maybe RevisionLocation
revisionLocation = Maybe RevisionLocation
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about an application revision, including usage details and
-- associated deployment groups.
revisionInfo_genericRevisionInfo :: Lens.Lens' RevisionInfo (Prelude.Maybe GenericRevisionInfo)
revisionInfo_genericRevisionInfo :: (Maybe GenericRevisionInfo -> f (Maybe GenericRevisionInfo))
-> RevisionInfo -> f RevisionInfo
revisionInfo_genericRevisionInfo = (RevisionInfo -> Maybe GenericRevisionInfo)
-> (RevisionInfo -> Maybe GenericRevisionInfo -> RevisionInfo)
-> Lens
     RevisionInfo
     RevisionInfo
     (Maybe GenericRevisionInfo)
     (Maybe GenericRevisionInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionInfo' {Maybe GenericRevisionInfo
genericRevisionInfo :: Maybe GenericRevisionInfo
$sel:genericRevisionInfo:RevisionInfo' :: RevisionInfo -> Maybe GenericRevisionInfo
genericRevisionInfo} -> Maybe GenericRevisionInfo
genericRevisionInfo) (\s :: RevisionInfo
s@RevisionInfo' {} Maybe GenericRevisionInfo
a -> RevisionInfo
s {$sel:genericRevisionInfo:RevisionInfo' :: Maybe GenericRevisionInfo
genericRevisionInfo = Maybe GenericRevisionInfo
a} :: RevisionInfo)

-- | Information about the location and type of an application revision.
revisionInfo_revisionLocation :: Lens.Lens' RevisionInfo (Prelude.Maybe RevisionLocation)
revisionInfo_revisionLocation :: (Maybe RevisionLocation -> f (Maybe RevisionLocation))
-> RevisionInfo -> f RevisionInfo
revisionInfo_revisionLocation = (RevisionInfo -> Maybe RevisionLocation)
-> (RevisionInfo -> Maybe RevisionLocation -> RevisionInfo)
-> Lens
     RevisionInfo
     RevisionInfo
     (Maybe RevisionLocation)
     (Maybe RevisionLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevisionInfo' {Maybe RevisionLocation
revisionLocation :: Maybe RevisionLocation
$sel:revisionLocation:RevisionInfo' :: RevisionInfo -> Maybe RevisionLocation
revisionLocation} -> Maybe RevisionLocation
revisionLocation) (\s :: RevisionInfo
s@RevisionInfo' {} Maybe RevisionLocation
a -> RevisionInfo
s {$sel:revisionLocation:RevisionInfo' :: Maybe RevisionLocation
revisionLocation = Maybe RevisionLocation
a} :: RevisionInfo)

instance Core.FromJSON RevisionInfo where
  parseJSON :: Value -> Parser RevisionInfo
parseJSON =
    String
-> (Object -> Parser RevisionInfo) -> Value -> Parser RevisionInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RevisionInfo"
      ( \Object
x ->
          Maybe GenericRevisionInfo -> Maybe RevisionLocation -> RevisionInfo
RevisionInfo'
            (Maybe GenericRevisionInfo
 -> Maybe RevisionLocation -> RevisionInfo)
-> Parser (Maybe GenericRevisionInfo)
-> Parser (Maybe RevisionLocation -> RevisionInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe GenericRevisionInfo)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"genericRevisionInfo")
            Parser (Maybe RevisionLocation -> RevisionInfo)
-> Parser (Maybe RevisionLocation) -> Parser RevisionInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RevisionLocation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"revisionLocation")
      )

instance Prelude.Hashable RevisionInfo

instance Prelude.NFData RevisionInfo