{-# 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.EC2.Types.CreateFleetError
-- 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.EC2.Types.CreateFleetError where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.InstanceLifecycle
import Amazonka.EC2.Types.LaunchTemplateAndOverridesResponse
import qualified Amazonka.Prelude as Prelude

-- | Describes the instances that could not be launched by the fleet.
--
-- /See:/ 'newCreateFleetError' smart constructor.
data CreateFleetError = CreateFleetError'
  { -- | The error code that indicates why the instance could not be launched.
    -- For more information about error codes, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html Error codes>.
    CreateFleetError -> Maybe Text
errorCode :: Prelude.Maybe Prelude.Text,
    -- | The error message that describes why the instance could not be launched.
    -- For more information about error messages, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html Error codes>.
    CreateFleetError -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The launch templates and overrides that were used for launching the
    -- instances. The values that you specify in the Overrides replace the
    -- values in the launch template.
    CreateFleetError -> Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides :: Prelude.Maybe LaunchTemplateAndOverridesResponse,
    -- | Indicates if the instance that could not be launched was a Spot Instance
    -- or On-Demand Instance.
    CreateFleetError -> Maybe InstanceLifecycle
lifecycle :: Prelude.Maybe InstanceLifecycle
  }
  deriving (CreateFleetError -> CreateFleetError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFleetError -> CreateFleetError -> Bool
$c/= :: CreateFleetError -> CreateFleetError -> Bool
== :: CreateFleetError -> CreateFleetError -> Bool
$c== :: CreateFleetError -> CreateFleetError -> Bool
Prelude.Eq, ReadPrec [CreateFleetError]
ReadPrec CreateFleetError
Int -> ReadS CreateFleetError
ReadS [CreateFleetError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFleetError]
$creadListPrec :: ReadPrec [CreateFleetError]
readPrec :: ReadPrec CreateFleetError
$creadPrec :: ReadPrec CreateFleetError
readList :: ReadS [CreateFleetError]
$creadList :: ReadS [CreateFleetError]
readsPrec :: Int -> ReadS CreateFleetError
$creadsPrec :: Int -> ReadS CreateFleetError
Prelude.Read, Int -> CreateFleetError -> ShowS
[CreateFleetError] -> ShowS
CreateFleetError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFleetError] -> ShowS
$cshowList :: [CreateFleetError] -> ShowS
show :: CreateFleetError -> String
$cshow :: CreateFleetError -> String
showsPrec :: Int -> CreateFleetError -> ShowS
$cshowsPrec :: Int -> CreateFleetError -> ShowS
Prelude.Show, forall x. Rep CreateFleetError x -> CreateFleetError
forall x. CreateFleetError -> Rep CreateFleetError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFleetError x -> CreateFleetError
$cfrom :: forall x. CreateFleetError -> Rep CreateFleetError x
Prelude.Generic)

-- |
-- Create a value of 'CreateFleetError' 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:
--
-- 'errorCode', 'createFleetError_errorCode' - The error code that indicates why the instance could not be launched.
-- For more information about error codes, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html Error codes>.
--
-- 'errorMessage', 'createFleetError_errorMessage' - The error message that describes why the instance could not be launched.
-- For more information about error messages, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html Error codes>.
--
-- 'launchTemplateAndOverrides', 'createFleetError_launchTemplateAndOverrides' - The launch templates and overrides that were used for launching the
-- instances. The values that you specify in the Overrides replace the
-- values in the launch template.
--
-- 'lifecycle', 'createFleetError_lifecycle' - Indicates if the instance that could not be launched was a Spot Instance
-- or On-Demand Instance.
newCreateFleetError ::
  CreateFleetError
newCreateFleetError :: CreateFleetError
newCreateFleetError =
  CreateFleetError'
    { $sel:errorCode:CreateFleetError' :: Maybe Text
errorCode = forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:CreateFleetError' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:launchTemplateAndOverrides:CreateFleetError' :: Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides = forall a. Maybe a
Prelude.Nothing,
      $sel:lifecycle:CreateFleetError' :: Maybe InstanceLifecycle
lifecycle = forall a. Maybe a
Prelude.Nothing
    }

-- | The error code that indicates why the instance could not be launched.
-- For more information about error codes, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html Error codes>.
createFleetError_errorCode :: Lens.Lens' CreateFleetError (Prelude.Maybe Prelude.Text)
createFleetError_errorCode :: Lens' CreateFleetError (Maybe Text)
createFleetError_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFleetError' {Maybe Text
errorCode :: Maybe Text
$sel:errorCode:CreateFleetError' :: CreateFleetError -> Maybe Text
errorCode} -> Maybe Text
errorCode) (\s :: CreateFleetError
s@CreateFleetError' {} Maybe Text
a -> CreateFleetError
s {$sel:errorCode:CreateFleetError' :: Maybe Text
errorCode = Maybe Text
a} :: CreateFleetError)

-- | The error message that describes why the instance could not be launched.
-- For more information about error messages, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html.html Error codes>.
createFleetError_errorMessage :: Lens.Lens' CreateFleetError (Prelude.Maybe Prelude.Text)
createFleetError_errorMessage :: Lens' CreateFleetError (Maybe Text)
createFleetError_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFleetError' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:CreateFleetError' :: CreateFleetError -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: CreateFleetError
s@CreateFleetError' {} Maybe Text
a -> CreateFleetError
s {$sel:errorMessage:CreateFleetError' :: Maybe Text
errorMessage = Maybe Text
a} :: CreateFleetError)

-- | The launch templates and overrides that were used for launching the
-- instances. The values that you specify in the Overrides replace the
-- values in the launch template.
createFleetError_launchTemplateAndOverrides :: Lens.Lens' CreateFleetError (Prelude.Maybe LaunchTemplateAndOverridesResponse)
createFleetError_launchTemplateAndOverrides :: Lens' CreateFleetError (Maybe LaunchTemplateAndOverridesResponse)
createFleetError_launchTemplateAndOverrides = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFleetError' {Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides :: Maybe LaunchTemplateAndOverridesResponse
$sel:launchTemplateAndOverrides:CreateFleetError' :: CreateFleetError -> Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides} -> Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides) (\s :: CreateFleetError
s@CreateFleetError' {} Maybe LaunchTemplateAndOverridesResponse
a -> CreateFleetError
s {$sel:launchTemplateAndOverrides:CreateFleetError' :: Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides = Maybe LaunchTemplateAndOverridesResponse
a} :: CreateFleetError)

-- | Indicates if the instance that could not be launched was a Spot Instance
-- or On-Demand Instance.
createFleetError_lifecycle :: Lens.Lens' CreateFleetError (Prelude.Maybe InstanceLifecycle)
createFleetError_lifecycle :: Lens' CreateFleetError (Maybe InstanceLifecycle)
createFleetError_lifecycle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFleetError' {Maybe InstanceLifecycle
lifecycle :: Maybe InstanceLifecycle
$sel:lifecycle:CreateFleetError' :: CreateFleetError -> Maybe InstanceLifecycle
lifecycle} -> Maybe InstanceLifecycle
lifecycle) (\s :: CreateFleetError
s@CreateFleetError' {} Maybe InstanceLifecycle
a -> CreateFleetError
s {$sel:lifecycle:CreateFleetError' :: Maybe InstanceLifecycle
lifecycle = Maybe InstanceLifecycle
a} :: CreateFleetError)

instance Data.FromXML CreateFleetError where
  parseXML :: [Node] -> Either String CreateFleetError
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe LaunchTemplateAndOverridesResponse
-> Maybe InstanceLifecycle
-> CreateFleetError
CreateFleetError'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"errorCode")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"errorMessage")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"launchTemplateAndOverrides")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"lifecycle")

instance Prelude.Hashable CreateFleetError where
  hashWithSalt :: Int -> CreateFleetError -> Int
hashWithSalt Int
_salt CreateFleetError' {Maybe Text
Maybe InstanceLifecycle
Maybe LaunchTemplateAndOverridesResponse
lifecycle :: Maybe InstanceLifecycle
launchTemplateAndOverrides :: Maybe LaunchTemplateAndOverridesResponse
errorMessage :: Maybe Text
errorCode :: Maybe Text
$sel:lifecycle:CreateFleetError' :: CreateFleetError -> Maybe InstanceLifecycle
$sel:launchTemplateAndOverrides:CreateFleetError' :: CreateFleetError -> Maybe LaunchTemplateAndOverridesResponse
$sel:errorMessage:CreateFleetError' :: CreateFleetError -> Maybe Text
$sel:errorCode:CreateFleetError' :: CreateFleetError -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceLifecycle
lifecycle

instance Prelude.NFData CreateFleetError where
  rnf :: CreateFleetError -> ()
rnf CreateFleetError' {Maybe Text
Maybe InstanceLifecycle
Maybe LaunchTemplateAndOverridesResponse
lifecycle :: Maybe InstanceLifecycle
launchTemplateAndOverrides :: Maybe LaunchTemplateAndOverridesResponse
errorMessage :: Maybe Text
errorCode :: Maybe Text
$sel:lifecycle:CreateFleetError' :: CreateFleetError -> Maybe InstanceLifecycle
$sel:launchTemplateAndOverrides:CreateFleetError' :: CreateFleetError -> Maybe LaunchTemplateAndOverridesResponse
$sel:errorMessage:CreateFleetError' :: CreateFleetError -> Maybe Text
$sel:errorCode:CreateFleetError' :: CreateFleetError -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LaunchTemplateAndOverridesResponse
launchTemplateAndOverrides
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceLifecycle
lifecycle