{-# 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.SSM.Types.FailedCreateAssociation
-- 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.SSM.Types.FailedCreateAssociation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.CreateAssociationBatchRequestEntry
import Amazonka.SSM.Types.Fault

-- | Describes a failed association.
--
-- /See:/ 'newFailedCreateAssociation' smart constructor.
data FailedCreateAssociation = FailedCreateAssociation'
  { -- | The association.
    FailedCreateAssociation -> Maybe CreateAssociationBatchRequestEntry
entry :: Prelude.Maybe CreateAssociationBatchRequestEntry,
    -- | The source of the failure.
    FailedCreateAssociation -> Maybe Fault
fault :: Prelude.Maybe Fault,
    -- | A description of the failure.
    FailedCreateAssociation -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (FailedCreateAssociation -> FailedCreateAssociation -> Bool
(FailedCreateAssociation -> FailedCreateAssociation -> Bool)
-> (FailedCreateAssociation -> FailedCreateAssociation -> Bool)
-> Eq FailedCreateAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FailedCreateAssociation -> FailedCreateAssociation -> Bool
$c/= :: FailedCreateAssociation -> FailedCreateAssociation -> Bool
== :: FailedCreateAssociation -> FailedCreateAssociation -> Bool
$c== :: FailedCreateAssociation -> FailedCreateAssociation -> Bool
Prelude.Eq, ReadPrec [FailedCreateAssociation]
ReadPrec FailedCreateAssociation
Int -> ReadS FailedCreateAssociation
ReadS [FailedCreateAssociation]
(Int -> ReadS FailedCreateAssociation)
-> ReadS [FailedCreateAssociation]
-> ReadPrec FailedCreateAssociation
-> ReadPrec [FailedCreateAssociation]
-> Read FailedCreateAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FailedCreateAssociation]
$creadListPrec :: ReadPrec [FailedCreateAssociation]
readPrec :: ReadPrec FailedCreateAssociation
$creadPrec :: ReadPrec FailedCreateAssociation
readList :: ReadS [FailedCreateAssociation]
$creadList :: ReadS [FailedCreateAssociation]
readsPrec :: Int -> ReadS FailedCreateAssociation
$creadsPrec :: Int -> ReadS FailedCreateAssociation
Prelude.Read, Int -> FailedCreateAssociation -> ShowS
[FailedCreateAssociation] -> ShowS
FailedCreateAssociation -> String
(Int -> FailedCreateAssociation -> ShowS)
-> (FailedCreateAssociation -> String)
-> ([FailedCreateAssociation] -> ShowS)
-> Show FailedCreateAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FailedCreateAssociation] -> ShowS
$cshowList :: [FailedCreateAssociation] -> ShowS
show :: FailedCreateAssociation -> String
$cshow :: FailedCreateAssociation -> String
showsPrec :: Int -> FailedCreateAssociation -> ShowS
$cshowsPrec :: Int -> FailedCreateAssociation -> ShowS
Prelude.Show, (forall x.
 FailedCreateAssociation -> Rep FailedCreateAssociation x)
-> (forall x.
    Rep FailedCreateAssociation x -> FailedCreateAssociation)
-> Generic FailedCreateAssociation
forall x. Rep FailedCreateAssociation x -> FailedCreateAssociation
forall x. FailedCreateAssociation -> Rep FailedCreateAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FailedCreateAssociation x -> FailedCreateAssociation
$cfrom :: forall x. FailedCreateAssociation -> Rep FailedCreateAssociation x
Prelude.Generic)

-- |
-- Create a value of 'FailedCreateAssociation' 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:
--
-- 'entry', 'failedCreateAssociation_entry' - The association.
--
-- 'fault', 'failedCreateAssociation_fault' - The source of the failure.
--
-- 'message', 'failedCreateAssociation_message' - A description of the failure.
newFailedCreateAssociation ::
  FailedCreateAssociation
newFailedCreateAssociation :: FailedCreateAssociation
newFailedCreateAssociation =
  FailedCreateAssociation' :: Maybe CreateAssociationBatchRequestEntry
-> Maybe Fault -> Maybe Text -> FailedCreateAssociation
FailedCreateAssociation'
    { $sel:entry:FailedCreateAssociation' :: Maybe CreateAssociationBatchRequestEntry
entry = Maybe CreateAssociationBatchRequestEntry
forall a. Maybe a
Prelude.Nothing,
      $sel:fault:FailedCreateAssociation' :: Maybe Fault
fault = Maybe Fault
forall a. Maybe a
Prelude.Nothing,
      $sel:message:FailedCreateAssociation' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The association.
failedCreateAssociation_entry :: Lens.Lens' FailedCreateAssociation (Prelude.Maybe CreateAssociationBatchRequestEntry)
failedCreateAssociation_entry :: (Maybe CreateAssociationBatchRequestEntry
 -> f (Maybe CreateAssociationBatchRequestEntry))
-> FailedCreateAssociation -> f FailedCreateAssociation
failedCreateAssociation_entry = (FailedCreateAssociation
 -> Maybe CreateAssociationBatchRequestEntry)
-> (FailedCreateAssociation
    -> Maybe CreateAssociationBatchRequestEntry
    -> FailedCreateAssociation)
-> Lens
     FailedCreateAssociation
     FailedCreateAssociation
     (Maybe CreateAssociationBatchRequestEntry)
     (Maybe CreateAssociationBatchRequestEntry)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailedCreateAssociation' {Maybe CreateAssociationBatchRequestEntry
entry :: Maybe CreateAssociationBatchRequestEntry
$sel:entry:FailedCreateAssociation' :: FailedCreateAssociation -> Maybe CreateAssociationBatchRequestEntry
entry} -> Maybe CreateAssociationBatchRequestEntry
entry) (\s :: FailedCreateAssociation
s@FailedCreateAssociation' {} Maybe CreateAssociationBatchRequestEntry
a -> FailedCreateAssociation
s {$sel:entry:FailedCreateAssociation' :: Maybe CreateAssociationBatchRequestEntry
entry = Maybe CreateAssociationBatchRequestEntry
a} :: FailedCreateAssociation)

-- | The source of the failure.
failedCreateAssociation_fault :: Lens.Lens' FailedCreateAssociation (Prelude.Maybe Fault)
failedCreateAssociation_fault :: (Maybe Fault -> f (Maybe Fault))
-> FailedCreateAssociation -> f FailedCreateAssociation
failedCreateAssociation_fault = (FailedCreateAssociation -> Maybe Fault)
-> (FailedCreateAssociation
    -> Maybe Fault -> FailedCreateAssociation)
-> Lens
     FailedCreateAssociation
     FailedCreateAssociation
     (Maybe Fault)
     (Maybe Fault)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailedCreateAssociation' {Maybe Fault
fault :: Maybe Fault
$sel:fault:FailedCreateAssociation' :: FailedCreateAssociation -> Maybe Fault
fault} -> Maybe Fault
fault) (\s :: FailedCreateAssociation
s@FailedCreateAssociation' {} Maybe Fault
a -> FailedCreateAssociation
s {$sel:fault:FailedCreateAssociation' :: Maybe Fault
fault = Maybe Fault
a} :: FailedCreateAssociation)

-- | A description of the failure.
failedCreateAssociation_message :: Lens.Lens' FailedCreateAssociation (Prelude.Maybe Prelude.Text)
failedCreateAssociation_message :: (Maybe Text -> f (Maybe Text))
-> FailedCreateAssociation -> f FailedCreateAssociation
failedCreateAssociation_message = (FailedCreateAssociation -> Maybe Text)
-> (FailedCreateAssociation
    -> Maybe Text -> FailedCreateAssociation)
-> Lens
     FailedCreateAssociation
     FailedCreateAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailedCreateAssociation' {Maybe Text
message :: Maybe Text
$sel:message:FailedCreateAssociation' :: FailedCreateAssociation -> Maybe Text
message} -> Maybe Text
message) (\s :: FailedCreateAssociation
s@FailedCreateAssociation' {} Maybe Text
a -> FailedCreateAssociation
s {$sel:message:FailedCreateAssociation' :: Maybe Text
message = Maybe Text
a} :: FailedCreateAssociation)

instance Core.FromJSON FailedCreateAssociation where
  parseJSON :: Value -> Parser FailedCreateAssociation
parseJSON =
    String
-> (Object -> Parser FailedCreateAssociation)
-> Value
-> Parser FailedCreateAssociation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FailedCreateAssociation"
      ( \Object
x ->
          Maybe CreateAssociationBatchRequestEntry
-> Maybe Fault -> Maybe Text -> FailedCreateAssociation
FailedCreateAssociation'
            (Maybe CreateAssociationBatchRequestEntry
 -> Maybe Fault -> Maybe Text -> FailedCreateAssociation)
-> Parser (Maybe CreateAssociationBatchRequestEntry)
-> Parser (Maybe Fault -> Maybe Text -> FailedCreateAssociation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CreateAssociationBatchRequestEntry)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Entry")
            Parser (Maybe Fault -> Maybe Text -> FailedCreateAssociation)
-> Parser (Maybe Fault)
-> Parser (Maybe Text -> FailedCreateAssociation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Fault)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Fault")
            Parser (Maybe Text -> FailedCreateAssociation)
-> Parser (Maybe Text) -> Parser FailedCreateAssociation
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
"Message")
      )

instance Prelude.Hashable FailedCreateAssociation

instance Prelude.NFData FailedCreateAssociation