{-# 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.ElasticSearch.Types.VpcEndpointError
-- 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.ElasticSearch.Types.VpcEndpointError where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticSearch.Types.VpcEndpointErrorCode
import qualified Amazonka.Prelude as Prelude

-- | Error information when attempting to describe an Amazon OpenSearch
-- Service-managed VPC endpoint.
--
-- /See:/ 'newVpcEndpointError' smart constructor.
data VpcEndpointError = VpcEndpointError'
  { -- | The code associated with the error.
    VpcEndpointError -> Maybe VpcEndpointErrorCode
errorCode :: Prelude.Maybe VpcEndpointErrorCode,
    -- | A message describing the error.
    VpcEndpointError -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the endpoint.
    VpcEndpointError -> Maybe Text
vpcEndpointId :: Prelude.Maybe Prelude.Text
  }
  deriving (VpcEndpointError -> VpcEndpointError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcEndpointError -> VpcEndpointError -> Bool
$c/= :: VpcEndpointError -> VpcEndpointError -> Bool
== :: VpcEndpointError -> VpcEndpointError -> Bool
$c== :: VpcEndpointError -> VpcEndpointError -> Bool
Prelude.Eq, ReadPrec [VpcEndpointError]
ReadPrec VpcEndpointError
Int -> ReadS VpcEndpointError
ReadS [VpcEndpointError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcEndpointError]
$creadListPrec :: ReadPrec [VpcEndpointError]
readPrec :: ReadPrec VpcEndpointError
$creadPrec :: ReadPrec VpcEndpointError
readList :: ReadS [VpcEndpointError]
$creadList :: ReadS [VpcEndpointError]
readsPrec :: Int -> ReadS VpcEndpointError
$creadsPrec :: Int -> ReadS VpcEndpointError
Prelude.Read, Int -> VpcEndpointError -> ShowS
[VpcEndpointError] -> ShowS
VpcEndpointError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcEndpointError] -> ShowS
$cshowList :: [VpcEndpointError] -> ShowS
show :: VpcEndpointError -> String
$cshow :: VpcEndpointError -> String
showsPrec :: Int -> VpcEndpointError -> ShowS
$cshowsPrec :: Int -> VpcEndpointError -> ShowS
Prelude.Show, forall x. Rep VpcEndpointError x -> VpcEndpointError
forall x. VpcEndpointError -> Rep VpcEndpointError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcEndpointError x -> VpcEndpointError
$cfrom :: forall x. VpcEndpointError -> Rep VpcEndpointError x
Prelude.Generic)

-- |
-- Create a value of 'VpcEndpointError' 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', 'vpcEndpointError_errorCode' - The code associated with the error.
--
-- 'errorMessage', 'vpcEndpointError_errorMessage' - A message describing the error.
--
-- 'vpcEndpointId', 'vpcEndpointError_vpcEndpointId' - The unique identifier of the endpoint.
newVpcEndpointError ::
  VpcEndpointError
newVpcEndpointError :: VpcEndpointError
newVpcEndpointError =
  VpcEndpointError'
    { $sel:errorCode:VpcEndpointError' :: Maybe VpcEndpointErrorCode
errorCode = forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:VpcEndpointError' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcEndpointId:VpcEndpointError' :: Maybe Text
vpcEndpointId = forall a. Maybe a
Prelude.Nothing
    }

-- | The code associated with the error.
vpcEndpointError_errorCode :: Lens.Lens' VpcEndpointError (Prelude.Maybe VpcEndpointErrorCode)
vpcEndpointError_errorCode :: Lens' VpcEndpointError (Maybe VpcEndpointErrorCode)
vpcEndpointError_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpointError' {Maybe VpcEndpointErrorCode
errorCode :: Maybe VpcEndpointErrorCode
$sel:errorCode:VpcEndpointError' :: VpcEndpointError -> Maybe VpcEndpointErrorCode
errorCode} -> Maybe VpcEndpointErrorCode
errorCode) (\s :: VpcEndpointError
s@VpcEndpointError' {} Maybe VpcEndpointErrorCode
a -> VpcEndpointError
s {$sel:errorCode:VpcEndpointError' :: Maybe VpcEndpointErrorCode
errorCode = Maybe VpcEndpointErrorCode
a} :: VpcEndpointError)

-- | A message describing the error.
vpcEndpointError_errorMessage :: Lens.Lens' VpcEndpointError (Prelude.Maybe Prelude.Text)
vpcEndpointError_errorMessage :: Lens' VpcEndpointError (Maybe Text)
vpcEndpointError_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpointError' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:VpcEndpointError' :: VpcEndpointError -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: VpcEndpointError
s@VpcEndpointError' {} Maybe Text
a -> VpcEndpointError
s {$sel:errorMessage:VpcEndpointError' :: Maybe Text
errorMessage = Maybe Text
a} :: VpcEndpointError)

-- | The unique identifier of the endpoint.
vpcEndpointError_vpcEndpointId :: Lens.Lens' VpcEndpointError (Prelude.Maybe Prelude.Text)
vpcEndpointError_vpcEndpointId :: Lens' VpcEndpointError (Maybe Text)
vpcEndpointError_vpcEndpointId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpointError' {Maybe Text
vpcEndpointId :: Maybe Text
$sel:vpcEndpointId:VpcEndpointError' :: VpcEndpointError -> Maybe Text
vpcEndpointId} -> Maybe Text
vpcEndpointId) (\s :: VpcEndpointError
s@VpcEndpointError' {} Maybe Text
a -> VpcEndpointError
s {$sel:vpcEndpointId:VpcEndpointError' :: Maybe Text
vpcEndpointId = Maybe Text
a} :: VpcEndpointError)

instance Data.FromJSON VpcEndpointError where
  parseJSON :: Value -> Parser VpcEndpointError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VpcEndpointError"
      ( \Object
x ->
          Maybe VpcEndpointErrorCode
-> Maybe Text -> Maybe Text -> VpcEndpointError
VpcEndpointError'
            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
"ErrorCode")
            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
"ErrorMessage")
            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
"VpcEndpointId")
      )

instance Prelude.Hashable VpcEndpointError where
  hashWithSalt :: Int -> VpcEndpointError -> Int
hashWithSalt Int
_salt VpcEndpointError' {Maybe Text
Maybe VpcEndpointErrorCode
vpcEndpointId :: Maybe Text
errorMessage :: Maybe Text
errorCode :: Maybe VpcEndpointErrorCode
$sel:vpcEndpointId:VpcEndpointError' :: VpcEndpointError -> Maybe Text
$sel:errorMessage:VpcEndpointError' :: VpcEndpointError -> Maybe Text
$sel:errorCode:VpcEndpointError' :: VpcEndpointError -> Maybe VpcEndpointErrorCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpcEndpointErrorCode
errorCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcEndpointId

instance Prelude.NFData VpcEndpointError where
  rnf :: VpcEndpointError -> ()
rnf VpcEndpointError' {Maybe Text
Maybe VpcEndpointErrorCode
vpcEndpointId :: Maybe Text
errorMessage :: Maybe Text
errorCode :: Maybe VpcEndpointErrorCode
$sel:vpcEndpointId:VpcEndpointError' :: VpcEndpointError -> Maybe Text
$sel:errorMessage:VpcEndpointError' :: VpcEndpointError -> Maybe Text
$sel:errorCode:VpcEndpointError' :: VpcEndpointError -> Maybe VpcEndpointErrorCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe VpcEndpointErrorCode
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 Text
vpcEndpointId