{-# 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.EKS.Types.AddonIssue
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EKS.Types.AddonIssue where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EKS.Types.AddonIssueCode
import qualified Amazonka.Prelude as Prelude

-- | An issue related to an add-on.
--
-- /See:/ 'newAddonIssue' smart constructor.
data AddonIssue = AddonIssue'
  { -- | A code that describes the type of issue.
    AddonIssue -> Maybe AddonIssueCode
code :: Prelude.Maybe AddonIssueCode,
    -- | A message that provides details about the issue and what might cause it.
    AddonIssue -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The resource IDs of the issue.
    AddonIssue -> Maybe [Text]
resourceIds :: Prelude.Maybe [Prelude.Text]
  }
  deriving (AddonIssue -> AddonIssue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddonIssue -> AddonIssue -> Bool
$c/= :: AddonIssue -> AddonIssue -> Bool
== :: AddonIssue -> AddonIssue -> Bool
$c== :: AddonIssue -> AddonIssue -> Bool
Prelude.Eq, ReadPrec [AddonIssue]
ReadPrec AddonIssue
Int -> ReadS AddonIssue
ReadS [AddonIssue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddonIssue]
$creadListPrec :: ReadPrec [AddonIssue]
readPrec :: ReadPrec AddonIssue
$creadPrec :: ReadPrec AddonIssue
readList :: ReadS [AddonIssue]
$creadList :: ReadS [AddonIssue]
readsPrec :: Int -> ReadS AddonIssue
$creadsPrec :: Int -> ReadS AddonIssue
Prelude.Read, Int -> AddonIssue -> ShowS
[AddonIssue] -> ShowS
AddonIssue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddonIssue] -> ShowS
$cshowList :: [AddonIssue] -> ShowS
show :: AddonIssue -> String
$cshow :: AddonIssue -> String
showsPrec :: Int -> AddonIssue -> ShowS
$cshowsPrec :: Int -> AddonIssue -> ShowS
Prelude.Show, forall x. Rep AddonIssue x -> AddonIssue
forall x. AddonIssue -> Rep AddonIssue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddonIssue x -> AddonIssue
$cfrom :: forall x. AddonIssue -> Rep AddonIssue x
Prelude.Generic)

-- |
-- Create a value of 'AddonIssue' 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:
--
-- 'code', 'addonIssue_code' - A code that describes the type of issue.
--
-- 'message', 'addonIssue_message' - A message that provides details about the issue and what might cause it.
--
-- 'resourceIds', 'addonIssue_resourceIds' - The resource IDs of the issue.
newAddonIssue ::
  AddonIssue
newAddonIssue :: AddonIssue
newAddonIssue =
  AddonIssue'
    { $sel:code:AddonIssue' :: Maybe AddonIssueCode
code = forall a. Maybe a
Prelude.Nothing,
      $sel:message:AddonIssue' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceIds:AddonIssue' :: Maybe [Text]
resourceIds = forall a. Maybe a
Prelude.Nothing
    }

-- | A code that describes the type of issue.
addonIssue_code :: Lens.Lens' AddonIssue (Prelude.Maybe AddonIssueCode)
addonIssue_code :: Lens' AddonIssue (Maybe AddonIssueCode)
addonIssue_code = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddonIssue' {Maybe AddonIssueCode
code :: Maybe AddonIssueCode
$sel:code:AddonIssue' :: AddonIssue -> Maybe AddonIssueCode
code} -> Maybe AddonIssueCode
code) (\s :: AddonIssue
s@AddonIssue' {} Maybe AddonIssueCode
a -> AddonIssue
s {$sel:code:AddonIssue' :: Maybe AddonIssueCode
code = Maybe AddonIssueCode
a} :: AddonIssue)

-- | A message that provides details about the issue and what might cause it.
addonIssue_message :: Lens.Lens' AddonIssue (Prelude.Maybe Prelude.Text)
addonIssue_message :: Lens' AddonIssue (Maybe Text)
addonIssue_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddonIssue' {Maybe Text
message :: Maybe Text
$sel:message:AddonIssue' :: AddonIssue -> Maybe Text
message} -> Maybe Text
message) (\s :: AddonIssue
s@AddonIssue' {} Maybe Text
a -> AddonIssue
s {$sel:message:AddonIssue' :: Maybe Text
message = Maybe Text
a} :: AddonIssue)

-- | The resource IDs of the issue.
addonIssue_resourceIds :: Lens.Lens' AddonIssue (Prelude.Maybe [Prelude.Text])
addonIssue_resourceIds :: Lens' AddonIssue (Maybe [Text])
addonIssue_resourceIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddonIssue' {Maybe [Text]
resourceIds :: Maybe [Text]
$sel:resourceIds:AddonIssue' :: AddonIssue -> Maybe [Text]
resourceIds} -> Maybe [Text]
resourceIds) (\s :: AddonIssue
s@AddonIssue' {} Maybe [Text]
a -> AddonIssue
s {$sel:resourceIds:AddonIssue' :: Maybe [Text]
resourceIds = Maybe [Text]
a} :: AddonIssue) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON AddonIssue where
  parseJSON :: Value -> Parser AddonIssue
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AddonIssue"
      ( \Object
x ->
          Maybe AddonIssueCode -> Maybe Text -> Maybe [Text] -> AddonIssue
AddonIssue'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"code")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"message")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"resourceIds" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable AddonIssue where
  hashWithSalt :: Int -> AddonIssue -> Int
hashWithSalt Int
_salt AddonIssue' {Maybe [Text]
Maybe Text
Maybe AddonIssueCode
resourceIds :: Maybe [Text]
message :: Maybe Text
code :: Maybe AddonIssueCode
$sel:resourceIds:AddonIssue' :: AddonIssue -> Maybe [Text]
$sel:message:AddonIssue' :: AddonIssue -> Maybe Text
$sel:code:AddonIssue' :: AddonIssue -> Maybe AddonIssueCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AddonIssueCode
code
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
resourceIds

instance Prelude.NFData AddonIssue where
  rnf :: AddonIssue -> ()
rnf AddonIssue' {Maybe [Text]
Maybe Text
Maybe AddonIssueCode
resourceIds :: Maybe [Text]
message :: Maybe Text
code :: Maybe AddonIssueCode
$sel:resourceIds:AddonIssue' :: AddonIssue -> Maybe [Text]
$sel:message:AddonIssue' :: AddonIssue -> Maybe Text
$sel:code:AddonIssue' :: AddonIssue -> Maybe AddonIssueCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AddonIssueCode
code
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
resourceIds