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

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

-- | Information about deployments related to the specified deployment.
--
-- /See:/ 'newRelatedDeployments' smart constructor.
data RelatedDeployments = RelatedDeployments'
  { -- | The deployment IDs of \'auto-update outdated instances\' deployments
    -- triggered by this deployment.
    RelatedDeployments -> Maybe [Text]
autoUpdateOutdatedInstancesDeploymentIds :: Prelude.Maybe [Prelude.Text],
    -- | The deployment ID of the root deployment that triggered this deployment.
    RelatedDeployments -> Maybe Text
autoUpdateOutdatedInstancesRootDeploymentId :: Prelude.Maybe Prelude.Text
  }
  deriving (RelatedDeployments -> RelatedDeployments -> Bool
(RelatedDeployments -> RelatedDeployments -> Bool)
-> (RelatedDeployments -> RelatedDeployments -> Bool)
-> Eq RelatedDeployments
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RelatedDeployments -> RelatedDeployments -> Bool
$c/= :: RelatedDeployments -> RelatedDeployments -> Bool
== :: RelatedDeployments -> RelatedDeployments -> Bool
$c== :: RelatedDeployments -> RelatedDeployments -> Bool
Prelude.Eq, ReadPrec [RelatedDeployments]
ReadPrec RelatedDeployments
Int -> ReadS RelatedDeployments
ReadS [RelatedDeployments]
(Int -> ReadS RelatedDeployments)
-> ReadS [RelatedDeployments]
-> ReadPrec RelatedDeployments
-> ReadPrec [RelatedDeployments]
-> Read RelatedDeployments
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RelatedDeployments]
$creadListPrec :: ReadPrec [RelatedDeployments]
readPrec :: ReadPrec RelatedDeployments
$creadPrec :: ReadPrec RelatedDeployments
readList :: ReadS [RelatedDeployments]
$creadList :: ReadS [RelatedDeployments]
readsPrec :: Int -> ReadS RelatedDeployments
$creadsPrec :: Int -> ReadS RelatedDeployments
Prelude.Read, Int -> RelatedDeployments -> ShowS
[RelatedDeployments] -> ShowS
RelatedDeployments -> String
(Int -> RelatedDeployments -> ShowS)
-> (RelatedDeployments -> String)
-> ([RelatedDeployments] -> ShowS)
-> Show RelatedDeployments
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RelatedDeployments] -> ShowS
$cshowList :: [RelatedDeployments] -> ShowS
show :: RelatedDeployments -> String
$cshow :: RelatedDeployments -> String
showsPrec :: Int -> RelatedDeployments -> ShowS
$cshowsPrec :: Int -> RelatedDeployments -> ShowS
Prelude.Show, (forall x. RelatedDeployments -> Rep RelatedDeployments x)
-> (forall x. Rep RelatedDeployments x -> RelatedDeployments)
-> Generic RelatedDeployments
forall x. Rep RelatedDeployments x -> RelatedDeployments
forall x. RelatedDeployments -> Rep RelatedDeployments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RelatedDeployments x -> RelatedDeployments
$cfrom :: forall x. RelatedDeployments -> Rep RelatedDeployments x
Prelude.Generic)

-- |
-- Create a value of 'RelatedDeployments' 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:
--
-- 'autoUpdateOutdatedInstancesDeploymentIds', 'relatedDeployments_autoUpdateOutdatedInstancesDeploymentIds' - The deployment IDs of \'auto-update outdated instances\' deployments
-- triggered by this deployment.
--
-- 'autoUpdateOutdatedInstancesRootDeploymentId', 'relatedDeployments_autoUpdateOutdatedInstancesRootDeploymentId' - The deployment ID of the root deployment that triggered this deployment.
newRelatedDeployments ::
  RelatedDeployments
newRelatedDeployments :: RelatedDeployments
newRelatedDeployments =
  RelatedDeployments' :: Maybe [Text] -> Maybe Text -> RelatedDeployments
RelatedDeployments'
    { $sel:autoUpdateOutdatedInstancesDeploymentIds:RelatedDeployments' :: Maybe [Text]
autoUpdateOutdatedInstancesDeploymentIds =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:autoUpdateOutdatedInstancesRootDeploymentId:RelatedDeployments' :: Maybe Text
autoUpdateOutdatedInstancesRootDeploymentId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The deployment IDs of \'auto-update outdated instances\' deployments
-- triggered by this deployment.
relatedDeployments_autoUpdateOutdatedInstancesDeploymentIds :: Lens.Lens' RelatedDeployments (Prelude.Maybe [Prelude.Text])
relatedDeployments_autoUpdateOutdatedInstancesDeploymentIds :: (Maybe [Text] -> f (Maybe [Text]))
-> RelatedDeployments -> f RelatedDeployments
relatedDeployments_autoUpdateOutdatedInstancesDeploymentIds = (RelatedDeployments -> Maybe [Text])
-> (RelatedDeployments -> Maybe [Text] -> RelatedDeployments)
-> Lens
     RelatedDeployments RelatedDeployments (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelatedDeployments' {Maybe [Text]
autoUpdateOutdatedInstancesDeploymentIds :: Maybe [Text]
$sel:autoUpdateOutdatedInstancesDeploymentIds:RelatedDeployments' :: RelatedDeployments -> Maybe [Text]
autoUpdateOutdatedInstancesDeploymentIds} -> Maybe [Text]
autoUpdateOutdatedInstancesDeploymentIds) (\s :: RelatedDeployments
s@RelatedDeployments' {} Maybe [Text]
a -> RelatedDeployments
s {$sel:autoUpdateOutdatedInstancesDeploymentIds:RelatedDeployments' :: Maybe [Text]
autoUpdateOutdatedInstancesDeploymentIds = Maybe [Text]
a} :: RelatedDeployments) ((Maybe [Text] -> f (Maybe [Text]))
 -> RelatedDeployments -> f RelatedDeployments)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> RelatedDeployments
-> f RelatedDeployments
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The deployment ID of the root deployment that triggered this deployment.
relatedDeployments_autoUpdateOutdatedInstancesRootDeploymentId :: Lens.Lens' RelatedDeployments (Prelude.Maybe Prelude.Text)
relatedDeployments_autoUpdateOutdatedInstancesRootDeploymentId :: (Maybe Text -> f (Maybe Text))
-> RelatedDeployments -> f RelatedDeployments
relatedDeployments_autoUpdateOutdatedInstancesRootDeploymentId = (RelatedDeployments -> Maybe Text)
-> (RelatedDeployments -> Maybe Text -> RelatedDeployments)
-> Lens
     RelatedDeployments RelatedDeployments (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelatedDeployments' {Maybe Text
autoUpdateOutdatedInstancesRootDeploymentId :: Maybe Text
$sel:autoUpdateOutdatedInstancesRootDeploymentId:RelatedDeployments' :: RelatedDeployments -> Maybe Text
autoUpdateOutdatedInstancesRootDeploymentId} -> Maybe Text
autoUpdateOutdatedInstancesRootDeploymentId) (\s :: RelatedDeployments
s@RelatedDeployments' {} Maybe Text
a -> RelatedDeployments
s {$sel:autoUpdateOutdatedInstancesRootDeploymentId:RelatedDeployments' :: Maybe Text
autoUpdateOutdatedInstancesRootDeploymentId = Maybe Text
a} :: RelatedDeployments)

instance Core.FromJSON RelatedDeployments where
  parseJSON :: Value -> Parser RelatedDeployments
parseJSON =
    String
-> (Object -> Parser RelatedDeployments)
-> Value
-> Parser RelatedDeployments
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RelatedDeployments"
      ( \Object
x ->
          Maybe [Text] -> Maybe Text -> RelatedDeployments
RelatedDeployments'
            (Maybe [Text] -> Maybe Text -> RelatedDeployments)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> RelatedDeployments)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"autoUpdateOutdatedInstancesDeploymentIds"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> RelatedDeployments)
-> Parser (Maybe Text) -> Parser RelatedDeployments
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
"autoUpdateOutdatedInstancesRootDeploymentId"
                        )
      )

instance Prelude.Hashable RelatedDeployments

instance Prelude.NFData RelatedDeployments