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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a deployment rollback.
--
-- /See:/ 'newRollbackInfo' smart constructor.
data RollbackInfo = RollbackInfo'
  { -- | The deployment ID of the deployment that was underway and triggered a
    -- rollback deployment because it failed or was stopped.
    RollbackInfo -> Maybe Text
rollbackTriggeringDeploymentId :: Prelude.Maybe Prelude.Text,
    -- | Information that describes the status of a deployment rollback (for
    -- example, whether the deployment can\'t be rolled back, is in progress,
    -- failed, or succeeded).
    RollbackInfo -> Maybe Text
rollbackMessage :: Prelude.Maybe Prelude.Text,
    -- | The ID of the deployment rollback.
    RollbackInfo -> Maybe Text
rollbackDeploymentId :: Prelude.Maybe Prelude.Text
  }
  deriving (RollbackInfo -> RollbackInfo -> Bool
(RollbackInfo -> RollbackInfo -> Bool)
-> (RollbackInfo -> RollbackInfo -> Bool) -> Eq RollbackInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RollbackInfo -> RollbackInfo -> Bool
$c/= :: RollbackInfo -> RollbackInfo -> Bool
== :: RollbackInfo -> RollbackInfo -> Bool
$c== :: RollbackInfo -> RollbackInfo -> Bool
Prelude.Eq, ReadPrec [RollbackInfo]
ReadPrec RollbackInfo
Int -> ReadS RollbackInfo
ReadS [RollbackInfo]
(Int -> ReadS RollbackInfo)
-> ReadS [RollbackInfo]
-> ReadPrec RollbackInfo
-> ReadPrec [RollbackInfo]
-> Read RollbackInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RollbackInfo]
$creadListPrec :: ReadPrec [RollbackInfo]
readPrec :: ReadPrec RollbackInfo
$creadPrec :: ReadPrec RollbackInfo
readList :: ReadS [RollbackInfo]
$creadList :: ReadS [RollbackInfo]
readsPrec :: Int -> ReadS RollbackInfo
$creadsPrec :: Int -> ReadS RollbackInfo
Prelude.Read, Int -> RollbackInfo -> ShowS
[RollbackInfo] -> ShowS
RollbackInfo -> String
(Int -> RollbackInfo -> ShowS)
-> (RollbackInfo -> String)
-> ([RollbackInfo] -> ShowS)
-> Show RollbackInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RollbackInfo] -> ShowS
$cshowList :: [RollbackInfo] -> ShowS
show :: RollbackInfo -> String
$cshow :: RollbackInfo -> String
showsPrec :: Int -> RollbackInfo -> ShowS
$cshowsPrec :: Int -> RollbackInfo -> ShowS
Prelude.Show, (forall x. RollbackInfo -> Rep RollbackInfo x)
-> (forall x. Rep RollbackInfo x -> RollbackInfo)
-> Generic RollbackInfo
forall x. Rep RollbackInfo x -> RollbackInfo
forall x. RollbackInfo -> Rep RollbackInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RollbackInfo x -> RollbackInfo
$cfrom :: forall x. RollbackInfo -> Rep RollbackInfo x
Prelude.Generic)

-- |
-- Create a value of 'RollbackInfo' 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:
--
-- 'rollbackTriggeringDeploymentId', 'rollbackInfo_rollbackTriggeringDeploymentId' - The deployment ID of the deployment that was underway and triggered a
-- rollback deployment because it failed or was stopped.
--
-- 'rollbackMessage', 'rollbackInfo_rollbackMessage' - Information that describes the status of a deployment rollback (for
-- example, whether the deployment can\'t be rolled back, is in progress,
-- failed, or succeeded).
--
-- 'rollbackDeploymentId', 'rollbackInfo_rollbackDeploymentId' - The ID of the deployment rollback.
newRollbackInfo ::
  RollbackInfo
newRollbackInfo :: RollbackInfo
newRollbackInfo =
  RollbackInfo' :: Maybe Text -> Maybe Text -> Maybe Text -> RollbackInfo
RollbackInfo'
    { $sel:rollbackTriggeringDeploymentId:RollbackInfo' :: Maybe Text
rollbackTriggeringDeploymentId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:rollbackMessage:RollbackInfo' :: Maybe Text
rollbackMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:rollbackDeploymentId:RollbackInfo' :: Maybe Text
rollbackDeploymentId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The deployment ID of the deployment that was underway and triggered a
-- rollback deployment because it failed or was stopped.
rollbackInfo_rollbackTriggeringDeploymentId :: Lens.Lens' RollbackInfo (Prelude.Maybe Prelude.Text)
rollbackInfo_rollbackTriggeringDeploymentId :: (Maybe Text -> f (Maybe Text)) -> RollbackInfo -> f RollbackInfo
rollbackInfo_rollbackTriggeringDeploymentId = (RollbackInfo -> Maybe Text)
-> (RollbackInfo -> Maybe Text -> RollbackInfo)
-> Lens RollbackInfo RollbackInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RollbackInfo' {Maybe Text
rollbackTriggeringDeploymentId :: Maybe Text
$sel:rollbackTriggeringDeploymentId:RollbackInfo' :: RollbackInfo -> Maybe Text
rollbackTriggeringDeploymentId} -> Maybe Text
rollbackTriggeringDeploymentId) (\s :: RollbackInfo
s@RollbackInfo' {} Maybe Text
a -> RollbackInfo
s {$sel:rollbackTriggeringDeploymentId:RollbackInfo' :: Maybe Text
rollbackTriggeringDeploymentId = Maybe Text
a} :: RollbackInfo)

-- | Information that describes the status of a deployment rollback (for
-- example, whether the deployment can\'t be rolled back, is in progress,
-- failed, or succeeded).
rollbackInfo_rollbackMessage :: Lens.Lens' RollbackInfo (Prelude.Maybe Prelude.Text)
rollbackInfo_rollbackMessage :: (Maybe Text -> f (Maybe Text)) -> RollbackInfo -> f RollbackInfo
rollbackInfo_rollbackMessage = (RollbackInfo -> Maybe Text)
-> (RollbackInfo -> Maybe Text -> RollbackInfo)
-> Lens RollbackInfo RollbackInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RollbackInfo' {Maybe Text
rollbackMessage :: Maybe Text
$sel:rollbackMessage:RollbackInfo' :: RollbackInfo -> Maybe Text
rollbackMessage} -> Maybe Text
rollbackMessage) (\s :: RollbackInfo
s@RollbackInfo' {} Maybe Text
a -> RollbackInfo
s {$sel:rollbackMessage:RollbackInfo' :: Maybe Text
rollbackMessage = Maybe Text
a} :: RollbackInfo)

-- | The ID of the deployment rollback.
rollbackInfo_rollbackDeploymentId :: Lens.Lens' RollbackInfo (Prelude.Maybe Prelude.Text)
rollbackInfo_rollbackDeploymentId :: (Maybe Text -> f (Maybe Text)) -> RollbackInfo -> f RollbackInfo
rollbackInfo_rollbackDeploymentId = (RollbackInfo -> Maybe Text)
-> (RollbackInfo -> Maybe Text -> RollbackInfo)
-> Lens RollbackInfo RollbackInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RollbackInfo' {Maybe Text
rollbackDeploymentId :: Maybe Text
$sel:rollbackDeploymentId:RollbackInfo' :: RollbackInfo -> Maybe Text
rollbackDeploymentId} -> Maybe Text
rollbackDeploymentId) (\s :: RollbackInfo
s@RollbackInfo' {} Maybe Text
a -> RollbackInfo
s {$sel:rollbackDeploymentId:RollbackInfo' :: Maybe Text
rollbackDeploymentId = Maybe Text
a} :: RollbackInfo)

instance Core.FromJSON RollbackInfo where
  parseJSON :: Value -> Parser RollbackInfo
parseJSON =
    String
-> (Object -> Parser RollbackInfo) -> Value -> Parser RollbackInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RollbackInfo"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> RollbackInfo
RollbackInfo'
            (Maybe Text -> Maybe Text -> Maybe Text -> RollbackInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> RollbackInfo)
forall (f :: * -> *) a b. Functor 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
"rollbackTriggeringDeploymentId")
            Parser (Maybe Text -> Maybe Text -> RollbackInfo)
-> Parser (Maybe Text) -> Parser (Maybe Text -> RollbackInfo)
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
"rollbackMessage")
            Parser (Maybe Text -> RollbackInfo)
-> Parser (Maybe Text) -> Parser RollbackInfo
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
"rollbackDeploymentId")
      )

instance Prelude.Hashable RollbackInfo

instance Prelude.NFData RollbackInfo