{-# 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-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.EKS.Types.Issue where

import qualified Amazonka.Core as Core
import Amazonka.EKS.Types.NodegroupIssueCode
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object representing an issue with an Amazon EKS resource.
--
-- /See:/ 'newIssue' smart constructor.
data Issue = Issue'
  { -- | The Amazon Web Services resources that are afflicted by this issue.
    Issue -> Maybe [Text]
resourceIds :: Prelude.Maybe [Prelude.Text],
    -- | 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/worker_node_IAM_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
  }
  deriving (Issue -> Issue -> Bool
(Issue -> Issue -> Bool) -> (Issue -> Issue -> Bool) -> Eq Issue
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]
(Int -> ReadS Issue)
-> ReadS [Issue]
-> ReadPrec Issue
-> ReadPrec [Issue]
-> Read 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
(Int -> Issue -> ShowS)
-> (Issue -> String) -> ([Issue] -> ShowS) -> Show Issue
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. Issue -> Rep Issue x)
-> (forall x. Rep Issue x -> Issue) -> Generic Issue
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:
--
-- 'resourceIds', 'issue_resourceIds' - The Amazon Web Services resources that are afflicted by this issue.
--
-- '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/worker_node_IAM_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.
newIssue ::
  Issue
newIssue :: Issue
newIssue =
  Issue' :: Maybe [Text] -> Maybe NodegroupIssueCode -> Maybe Text -> Issue
Issue'
    { $sel:resourceIds:Issue' :: Maybe [Text]
resourceIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:code:Issue' :: Maybe NodegroupIssueCode
code = Maybe NodegroupIssueCode
forall a. Maybe a
Prelude.Nothing,
      $sel:message:Issue' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services resources that are afflicted by this issue.
issue_resourceIds :: Lens.Lens' Issue (Prelude.Maybe [Prelude.Text])
issue_resourceIds :: (Maybe [Text] -> f (Maybe [Text])) -> Issue -> f Issue
issue_resourceIds = (Issue -> Maybe [Text])
-> (Issue -> Maybe [Text] -> Issue)
-> Lens Issue Issue (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text])) -> Issue -> f Issue)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Issue
-> f Issue
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

-- | 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/worker_node_IAM_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 :: (Maybe NodegroupIssueCode -> f (Maybe NodegroupIssueCode))
-> Issue -> f Issue
issue_code = (Issue -> Maybe NodegroupIssueCode)
-> (Issue -> Maybe NodegroupIssueCode -> Issue)
-> Lens
     Issue Issue (Maybe NodegroupIssueCode) (Maybe NodegroupIssueCode)
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 :: (Maybe Text -> f (Maybe Text)) -> Issue -> f Issue
issue_message = (Issue -> Maybe Text)
-> (Issue -> Maybe Text -> Issue)
-> Lens Issue Issue (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON Issue where
  parseJSON :: Value -> Parser Issue
parseJSON =
    String -> (Object -> Parser Issue) -> Value -> Parser Issue
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Issue"
      ( \Object
x ->
          Maybe [Text] -> Maybe NodegroupIssueCode -> Maybe Text -> Issue
Issue'
            (Maybe [Text] -> Maybe NodegroupIssueCode -> Maybe Text -> Issue)
-> Parser (Maybe [Text])
-> Parser (Maybe NodegroupIssueCode -> Maybe Text -> Issue)
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
"resourceIds" 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 NodegroupIssueCode -> Maybe Text -> Issue)
-> Parser (Maybe NodegroupIssueCode)
-> Parser (Maybe Text -> Issue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe NodegroupIssueCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"code")
            Parser (Maybe Text -> Issue) -> Parser (Maybe Text) -> Parser Issue
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 Issue

instance Prelude.NFData Issue