{-# 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.Issue
-- 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.Issue 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.NodegroupIssueCode
import qualified Amazonka.Prelude as Prelude

-- | An object representing an issue with an Amazon EKS resource.
--
-- /See:/ 'newIssue' smart constructor.
data Issue = Issue'
  { -- | A brief description of the error.
    --
    -- -   __AccessDenied__: Amazon EKS or one or more of your managed nodes is
    --     failing to authenticate or authorize with your Kubernetes cluster
    --     API server.
    --
    -- -   __AsgInstanceLaunchFailures__: Your Auto Scaling group is
    --     experiencing failures while attempting to launch instances.
    --
    -- -   __AutoScalingGroupNotFound__: We couldn\'t find the Auto Scaling
    --     group associated with the managed node group. You may be able to
    --     recreate an Auto Scaling group with the same settings to recover.
    --
    -- -   __ClusterUnreachable__: Amazon EKS or one or more of your managed
    --     nodes is unable to to communicate with your Kubernetes cluster API
    --     server. This can happen if there are network disruptions or if API
    --     servers are timing out processing requests.
    --
    -- -   __Ec2LaunchTemplateNotFound__: We couldn\'t find the Amazon EC2
    --     launch template for your managed node group. You may be able to
    --     recreate a launch template with the same settings to recover.
    --
    -- -   __Ec2LaunchTemplateVersionMismatch__: The Amazon EC2 launch template
    --     version for your managed node group does not match the version that
    --     Amazon EKS created. You may be able to revert to the version that
    --     Amazon EKS created to recover.
    --
    -- -   __Ec2SecurityGroupDeletionFailure__: We could not delete the remote
    --     access security group for your managed node group. Remove any
    --     dependencies from the security group.
    --
    -- -   __Ec2SecurityGroupNotFound__: We couldn\'t find the cluster security
    --     group for the cluster. You must recreate your cluster.
    --
    -- -   __Ec2SubnetInvalidConfiguration__: One or more Amazon EC2 subnets
    --     specified for a node group do not automatically assign public IP
    --     addresses to instances launched into it. If you want your instances
    --     to be assigned a public IP address, then you need to enable the
    --     @auto-assign public IP address@ setting for the subnet. See
    --     <https://docs.aws.amazon.com/vpc/latest/userguide/vpc-ip-addressing.html#subnet-public-ip Modifying the public IPv4 addressing attribute for your subnet>
    --     in the /Amazon VPC User Guide/.
    --
    -- -   __IamInstanceProfileNotFound__: We couldn\'t find the IAM instance
    --     profile for your managed node group. You may be able to recreate an
    --     instance profile with the same settings to recover.
    --
    -- -   __IamNodeRoleNotFound__: We couldn\'t find the IAM role for your
    --     managed node group. You may be able to recreate an IAM role with the
    --     same settings to recover.
    --
    -- -   __InstanceLimitExceeded__: Your Amazon Web Services account is
    --     unable to launch any more instances of the specified instance type.
    --     You may be able to request an Amazon EC2 instance limit increase to
    --     recover.
    --
    -- -   __InsufficientFreeAddresses__: One or more of the subnets associated
    --     with your managed node group does not have enough available IP
    --     addresses for new nodes.
    --
    -- -   __InternalFailure__: These errors are usually caused by an Amazon
    --     EKS server-side issue.
    --
    -- -   __NodeCreationFailure__: Your launched instances are unable to
    --     register with your Amazon EKS cluster. Common causes of this failure
    --     are insufficient
    --     <https://docs.aws.amazon.com/eks/latest/userguide/create-node-role.html node IAM role>
    --     permissions or lack of outbound internet access for the nodes.
    Issue -> Maybe NodegroupIssueCode
code :: Prelude.Maybe NodegroupIssueCode,
    -- | The error message associated with the issue.
    Issue -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services resources that are afflicted by this issue.
    Issue -> Maybe [Text]
resourceIds :: Prelude.Maybe [Prelude.Text]
  }
  deriving (Issue -> Issue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Issue -> Issue -> Bool
$c/= :: Issue -> Issue -> Bool
== :: Issue -> Issue -> Bool
$c== :: Issue -> Issue -> Bool
Prelude.Eq, ReadPrec [Issue]
ReadPrec Issue
Int -> ReadS Issue
ReadS [Issue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Issue]
$creadListPrec :: ReadPrec [Issue]
readPrec :: ReadPrec Issue
$creadPrec :: ReadPrec Issue
readList :: ReadS [Issue]
$creadList :: ReadS [Issue]
readsPrec :: Int -> ReadS Issue
$creadsPrec :: Int -> ReadS Issue
Prelude.Read, Int -> Issue -> ShowS
[Issue] -> ShowS
Issue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Issue] -> ShowS
$cshowList :: [Issue] -> ShowS
show :: Issue -> String
$cshow :: Issue -> String
showsPrec :: Int -> Issue -> ShowS
$cshowsPrec :: Int -> Issue -> ShowS
Prelude.Show, forall x. Rep Issue x -> Issue
forall x. Issue -> Rep Issue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Issue x -> Issue
$cfrom :: forall x. Issue -> Rep Issue x
Prelude.Generic)

-- |
-- Create a value of 'Issue' 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', 'issue_code' - A brief description of the error.
--
-- -   __AccessDenied__: Amazon EKS or one or more of your managed nodes is
--     failing to authenticate or authorize with your Kubernetes cluster
--     API server.
--
-- -   __AsgInstanceLaunchFailures__: Your Auto Scaling group is
--     experiencing failures while attempting to launch instances.
--
-- -   __AutoScalingGroupNotFound__: We couldn\'t find the Auto Scaling
--     group associated with the managed node group. You may be able to
--     recreate an Auto Scaling group with the same settings to recover.
--
-- -   __ClusterUnreachable__: Amazon EKS or one or more of your managed
--     nodes is unable to to communicate with your Kubernetes cluster API
--     server. This can happen if there are network disruptions or if API
--     servers are timing out processing requests.
--
-- -   __Ec2LaunchTemplateNotFound__: We couldn\'t find the Amazon EC2
--     launch template for your managed node group. You may be able to
--     recreate a launch template with the same settings to recover.
--
-- -   __Ec2LaunchTemplateVersionMismatch__: The Amazon EC2 launch template
--     version for your managed node group does not match the version that
--     Amazon EKS created. You may be able to revert to the version that
--     Amazon EKS created to recover.
--
-- -   __Ec2SecurityGroupDeletionFailure__: We could not delete the remote
--     access security group for your managed node group. Remove any
--     dependencies from the security group.
--
-- -   __Ec2SecurityGroupNotFound__: We couldn\'t find the cluster security
--     group for the cluster. You must recreate your cluster.
--
-- -   __Ec2SubnetInvalidConfiguration__: One or more Amazon EC2 subnets
--     specified for a node group do not automatically assign public IP
--     addresses to instances launched into it. If you want your instances
--     to be assigned a public IP address, then you need to enable the
--     @auto-assign public IP address@ setting for the subnet. See
--     <https://docs.aws.amazon.com/vpc/latest/userguide/vpc-ip-addressing.html#subnet-public-ip Modifying the public IPv4 addressing attribute for your subnet>
--     in the /Amazon VPC User Guide/.
--
-- -   __IamInstanceProfileNotFound__: We couldn\'t find the IAM instance
--     profile for your managed node group. You may be able to recreate an
--     instance profile with the same settings to recover.
--
-- -   __IamNodeRoleNotFound__: We couldn\'t find the IAM role for your
--     managed node group. You may be able to recreate an IAM role with the
--     same settings to recover.
--
-- -   __InstanceLimitExceeded__: Your Amazon Web Services account is
--     unable to launch any more instances of the specified instance type.
--     You may be able to request an Amazon EC2 instance limit increase to
--     recover.
--
-- -   __InsufficientFreeAddresses__: One or more of the subnets associated
--     with your managed node group does not have enough available IP
--     addresses for new nodes.
--
-- -   __InternalFailure__: These errors are usually caused by an Amazon
--     EKS server-side issue.
--
-- -   __NodeCreationFailure__: Your launched instances are unable to
--     register with your Amazon EKS cluster. Common causes of this failure
--     are insufficient
--     <https://docs.aws.amazon.com/eks/latest/userguide/create-node-role.html node IAM role>
--     permissions or lack of outbound internet access for the nodes.
--
-- 'message', 'issue_message' - The error message associated with the issue.
--
-- 'resourceIds', 'issue_resourceIds' - The Amazon Web Services resources that are afflicted by this issue.
newIssue ::
  Issue
newIssue :: Issue
newIssue =
  Issue'
    { $sel:code:Issue' :: Maybe NodegroupIssueCode
code = forall a. Maybe a
Prelude.Nothing,
      $sel:message:Issue' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceIds:Issue' :: Maybe [Text]
resourceIds = forall a. Maybe a
Prelude.Nothing
    }

-- | A brief description of the error.
--
-- -   __AccessDenied__: Amazon EKS or one or more of your managed nodes is
--     failing to authenticate or authorize with your Kubernetes cluster
--     API server.
--
-- -   __AsgInstanceLaunchFailures__: Your Auto Scaling group is
--     experiencing failures while attempting to launch instances.
--
-- -   __AutoScalingGroupNotFound__: We couldn\'t find the Auto Scaling
--     group associated with the managed node group. You may be able to
--     recreate an Auto Scaling group with the same settings to recover.
--
-- -   __ClusterUnreachable__: Amazon EKS or one or more of your managed
--     nodes is unable to to communicate with your Kubernetes cluster API
--     server. This can happen if there are network disruptions or if API
--     servers are timing out processing requests.
--
-- -   __Ec2LaunchTemplateNotFound__: We couldn\'t find the Amazon EC2
--     launch template for your managed node group. You may be able to
--     recreate a launch template with the same settings to recover.
--
-- -   __Ec2LaunchTemplateVersionMismatch__: The Amazon EC2 launch template
--     version for your managed node group does not match the version that
--     Amazon EKS created. You may be able to revert to the version that
--     Amazon EKS created to recover.
--
-- -   __Ec2SecurityGroupDeletionFailure__: We could not delete the remote
--     access security group for your managed node group. Remove any
--     dependencies from the security group.
--
-- -   __Ec2SecurityGroupNotFound__: We couldn\'t find the cluster security
--     group for the cluster. You must recreate your cluster.
--
-- -   __Ec2SubnetInvalidConfiguration__: One or more Amazon EC2 subnets
--     specified for a node group do not automatically assign public IP
--     addresses to instances launched into it. If you want your instances
--     to be assigned a public IP address, then you need to enable the
--     @auto-assign public IP address@ setting for the subnet. See
--     <https://docs.aws.amazon.com/vpc/latest/userguide/vpc-ip-addressing.html#subnet-public-ip Modifying the public IPv4 addressing attribute for your subnet>
--     in the /Amazon VPC User Guide/.
--
-- -   __IamInstanceProfileNotFound__: We couldn\'t find the IAM instance
--     profile for your managed node group. You may be able to recreate an
--     instance profile with the same settings to recover.
--
-- -   __IamNodeRoleNotFound__: We couldn\'t find the IAM role for your
--     managed node group. You may be able to recreate an IAM role with the
--     same settings to recover.
--
-- -   __InstanceLimitExceeded__: Your Amazon Web Services account is
--     unable to launch any more instances of the specified instance type.
--     You may be able to request an Amazon EC2 instance limit increase to
--     recover.
--
-- -   __InsufficientFreeAddresses__: One or more of the subnets associated
--     with your managed node group does not have enough available IP
--     addresses for new nodes.
--
-- -   __InternalFailure__: These errors are usually caused by an Amazon
--     EKS server-side issue.
--
-- -   __NodeCreationFailure__: Your launched instances are unable to
--     register with your Amazon EKS cluster. Common causes of this failure
--     are insufficient
--     <https://docs.aws.amazon.com/eks/latest/userguide/create-node-role.html node IAM role>
--     permissions or lack of outbound internet access for the nodes.
issue_code :: Lens.Lens' Issue (Prelude.Maybe NodegroupIssueCode)
issue_code :: Lens' Issue (Maybe NodegroupIssueCode)
issue_code = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Issue' {Maybe NodegroupIssueCode
code :: Maybe NodegroupIssueCode
$sel:code:Issue' :: Issue -> Maybe NodegroupIssueCode
code} -> Maybe NodegroupIssueCode
code) (\s :: Issue
s@Issue' {} Maybe NodegroupIssueCode
a -> Issue
s {$sel:code:Issue' :: Maybe NodegroupIssueCode
code = Maybe NodegroupIssueCode
a} :: Issue)

-- | The error message associated with the issue.
issue_message :: Lens.Lens' Issue (Prelude.Maybe Prelude.Text)
issue_message :: Lens' Issue (Maybe Text)
issue_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Issue' {Maybe Text
message :: Maybe Text
$sel:message:Issue' :: Issue -> Maybe Text
message} -> Maybe Text
message) (\s :: Issue
s@Issue' {} Maybe Text
a -> Issue
s {$sel:message:Issue' :: Maybe Text
message = Maybe Text
a} :: Issue)

-- | The Amazon Web Services resources that are afflicted by this issue.
issue_resourceIds :: Lens.Lens' Issue (Prelude.Maybe [Prelude.Text])
issue_resourceIds :: Lens' Issue (Maybe [Text])
issue_resourceIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Issue' {Maybe [Text]
resourceIds :: Maybe [Text]
$sel:resourceIds:Issue' :: Issue -> Maybe [Text]
resourceIds} -> Maybe [Text]
resourceIds) (\s :: Issue
s@Issue' {} Maybe [Text]
a -> Issue
s {$sel:resourceIds:Issue' :: Maybe [Text]
resourceIds = Maybe [Text]
a} :: Issue) 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 Issue where
  parseJSON :: Value -> Parser Issue
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Issue"
      ( \Object
x ->
          Maybe NodegroupIssueCode -> Maybe Text -> Maybe [Text] -> Issue
Issue'
            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 Issue where
  hashWithSalt :: Int -> Issue -> Int
hashWithSalt Int
_salt Issue' {Maybe [Text]
Maybe Text
Maybe NodegroupIssueCode
resourceIds :: Maybe [Text]
message :: Maybe Text
code :: Maybe NodegroupIssueCode
$sel:resourceIds:Issue' :: Issue -> Maybe [Text]
$sel:message:Issue' :: Issue -> Maybe Text
$sel:code:Issue' :: Issue -> Maybe NodegroupIssueCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NodegroupIssueCode
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 Issue where
  rnf :: Issue -> ()
rnf Issue' {Maybe [Text]
Maybe Text
Maybe NodegroupIssueCode
resourceIds :: Maybe [Text]
message :: Maybe Text
code :: Maybe NodegroupIssueCode
$sel:resourceIds:Issue' :: Issue -> Maybe [Text]
$sel:message:Issue' :: Issue -> Maybe Text
$sel:code:Issue' :: Issue -> Maybe NodegroupIssueCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe NodegroupIssueCode
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