{-# 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.ChimeSDKMessaging.Types.BatchCreateChannelMembershipError
-- 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.ChimeSDKMessaging.Types.BatchCreateChannelMembershipError where

import Amazonka.ChimeSDKMessaging.Types.ErrorCode
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A list of failed member ARNs, error codes, and error messages.
--
-- /See:/ 'newBatchCreateChannelMembershipError' smart constructor.
data BatchCreateChannelMembershipError = BatchCreateChannelMembershipError'
  { -- | The error code.
    BatchCreateChannelMembershipError -> Maybe ErrorCode
errorCode :: Prelude.Maybe ErrorCode,
    -- | The ARN of the member that the service couldn\'t add.
    BatchCreateChannelMembershipError -> Maybe Text
memberArn :: Prelude.Maybe Prelude.Text,
    -- | The error message.
    BatchCreateChannelMembershipError -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (BatchCreateChannelMembershipError
-> BatchCreateChannelMembershipError -> Bool
(BatchCreateChannelMembershipError
 -> BatchCreateChannelMembershipError -> Bool)
-> (BatchCreateChannelMembershipError
    -> BatchCreateChannelMembershipError -> Bool)
-> Eq BatchCreateChannelMembershipError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchCreateChannelMembershipError
-> BatchCreateChannelMembershipError -> Bool
$c/= :: BatchCreateChannelMembershipError
-> BatchCreateChannelMembershipError -> Bool
== :: BatchCreateChannelMembershipError
-> BatchCreateChannelMembershipError -> Bool
$c== :: BatchCreateChannelMembershipError
-> BatchCreateChannelMembershipError -> Bool
Prelude.Eq, ReadPrec [BatchCreateChannelMembershipError]
ReadPrec BatchCreateChannelMembershipError
Int -> ReadS BatchCreateChannelMembershipError
ReadS [BatchCreateChannelMembershipError]
(Int -> ReadS BatchCreateChannelMembershipError)
-> ReadS [BatchCreateChannelMembershipError]
-> ReadPrec BatchCreateChannelMembershipError
-> ReadPrec [BatchCreateChannelMembershipError]
-> Read BatchCreateChannelMembershipError
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchCreateChannelMembershipError]
$creadListPrec :: ReadPrec [BatchCreateChannelMembershipError]
readPrec :: ReadPrec BatchCreateChannelMembershipError
$creadPrec :: ReadPrec BatchCreateChannelMembershipError
readList :: ReadS [BatchCreateChannelMembershipError]
$creadList :: ReadS [BatchCreateChannelMembershipError]
readsPrec :: Int -> ReadS BatchCreateChannelMembershipError
$creadsPrec :: Int -> ReadS BatchCreateChannelMembershipError
Prelude.Read, Int -> BatchCreateChannelMembershipError -> ShowS
[BatchCreateChannelMembershipError] -> ShowS
BatchCreateChannelMembershipError -> String
(Int -> BatchCreateChannelMembershipError -> ShowS)
-> (BatchCreateChannelMembershipError -> String)
-> ([BatchCreateChannelMembershipError] -> ShowS)
-> Show BatchCreateChannelMembershipError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchCreateChannelMembershipError] -> ShowS
$cshowList :: [BatchCreateChannelMembershipError] -> ShowS
show :: BatchCreateChannelMembershipError -> String
$cshow :: BatchCreateChannelMembershipError -> String
showsPrec :: Int -> BatchCreateChannelMembershipError -> ShowS
$cshowsPrec :: Int -> BatchCreateChannelMembershipError -> ShowS
Prelude.Show, (forall x.
 BatchCreateChannelMembershipError
 -> Rep BatchCreateChannelMembershipError x)
-> (forall x.
    Rep BatchCreateChannelMembershipError x
    -> BatchCreateChannelMembershipError)
-> Generic BatchCreateChannelMembershipError
forall x.
Rep BatchCreateChannelMembershipError x
-> BatchCreateChannelMembershipError
forall x.
BatchCreateChannelMembershipError
-> Rep BatchCreateChannelMembershipError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchCreateChannelMembershipError x
-> BatchCreateChannelMembershipError
$cfrom :: forall x.
BatchCreateChannelMembershipError
-> Rep BatchCreateChannelMembershipError x
Prelude.Generic)

-- |
-- Create a value of 'BatchCreateChannelMembershipError' 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', 'batchCreateChannelMembershipError_errorCode' - The error code.
--
-- 'memberArn', 'batchCreateChannelMembershipError_memberArn' - The ARN of the member that the service couldn\'t add.
--
-- 'errorMessage', 'batchCreateChannelMembershipError_errorMessage' - The error message.
newBatchCreateChannelMembershipError ::
  BatchCreateChannelMembershipError
newBatchCreateChannelMembershipError :: BatchCreateChannelMembershipError
newBatchCreateChannelMembershipError =
  BatchCreateChannelMembershipError' :: Maybe ErrorCode
-> Maybe Text -> Maybe Text -> BatchCreateChannelMembershipError
BatchCreateChannelMembershipError'
    { $sel:errorCode:BatchCreateChannelMembershipError' :: Maybe ErrorCode
errorCode =
        Maybe ErrorCode
forall a. Maybe a
Prelude.Nothing,
      $sel:memberArn:BatchCreateChannelMembershipError' :: Maybe Text
memberArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:BatchCreateChannelMembershipError' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The error code.
batchCreateChannelMembershipError_errorCode :: Lens.Lens' BatchCreateChannelMembershipError (Prelude.Maybe ErrorCode)
batchCreateChannelMembershipError_errorCode :: (Maybe ErrorCode -> f (Maybe ErrorCode))
-> BatchCreateChannelMembershipError
-> f BatchCreateChannelMembershipError
batchCreateChannelMembershipError_errorCode = (BatchCreateChannelMembershipError -> Maybe ErrorCode)
-> (BatchCreateChannelMembershipError
    -> Maybe ErrorCode -> BatchCreateChannelMembershipError)
-> Lens
     BatchCreateChannelMembershipError
     BatchCreateChannelMembershipError
     (Maybe ErrorCode)
     (Maybe ErrorCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateChannelMembershipError' {Maybe ErrorCode
errorCode :: Maybe ErrorCode
$sel:errorCode:BatchCreateChannelMembershipError' :: BatchCreateChannelMembershipError -> Maybe ErrorCode
errorCode} -> Maybe ErrorCode
errorCode) (\s :: BatchCreateChannelMembershipError
s@BatchCreateChannelMembershipError' {} Maybe ErrorCode
a -> BatchCreateChannelMembershipError
s {$sel:errorCode:BatchCreateChannelMembershipError' :: Maybe ErrorCode
errorCode = Maybe ErrorCode
a} :: BatchCreateChannelMembershipError)

-- | The ARN of the member that the service couldn\'t add.
batchCreateChannelMembershipError_memberArn :: Lens.Lens' BatchCreateChannelMembershipError (Prelude.Maybe Prelude.Text)
batchCreateChannelMembershipError_memberArn :: (Maybe Text -> f (Maybe Text))
-> BatchCreateChannelMembershipError
-> f BatchCreateChannelMembershipError
batchCreateChannelMembershipError_memberArn = (BatchCreateChannelMembershipError -> Maybe Text)
-> (BatchCreateChannelMembershipError
    -> Maybe Text -> BatchCreateChannelMembershipError)
-> Lens
     BatchCreateChannelMembershipError
     BatchCreateChannelMembershipError
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateChannelMembershipError' {Maybe Text
memberArn :: Maybe Text
$sel:memberArn:BatchCreateChannelMembershipError' :: BatchCreateChannelMembershipError -> Maybe Text
memberArn} -> Maybe Text
memberArn) (\s :: BatchCreateChannelMembershipError
s@BatchCreateChannelMembershipError' {} Maybe Text
a -> BatchCreateChannelMembershipError
s {$sel:memberArn:BatchCreateChannelMembershipError' :: Maybe Text
memberArn = Maybe Text
a} :: BatchCreateChannelMembershipError)

-- | The error message.
batchCreateChannelMembershipError_errorMessage :: Lens.Lens' BatchCreateChannelMembershipError (Prelude.Maybe Prelude.Text)
batchCreateChannelMembershipError_errorMessage :: (Maybe Text -> f (Maybe Text))
-> BatchCreateChannelMembershipError
-> f BatchCreateChannelMembershipError
batchCreateChannelMembershipError_errorMessage = (BatchCreateChannelMembershipError -> Maybe Text)
-> (BatchCreateChannelMembershipError
    -> Maybe Text -> BatchCreateChannelMembershipError)
-> Lens
     BatchCreateChannelMembershipError
     BatchCreateChannelMembershipError
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateChannelMembershipError' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:BatchCreateChannelMembershipError' :: BatchCreateChannelMembershipError -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: BatchCreateChannelMembershipError
s@BatchCreateChannelMembershipError' {} Maybe Text
a -> BatchCreateChannelMembershipError
s {$sel:errorMessage:BatchCreateChannelMembershipError' :: Maybe Text
errorMessage = Maybe Text
a} :: BatchCreateChannelMembershipError)

instance
  Core.FromJSON
    BatchCreateChannelMembershipError
  where
  parseJSON :: Value -> Parser BatchCreateChannelMembershipError
parseJSON =
    String
-> (Object -> Parser BatchCreateChannelMembershipError)
-> Value
-> Parser BatchCreateChannelMembershipError
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BatchCreateChannelMembershipError"
      ( \Object
x ->
          Maybe ErrorCode
-> Maybe Text -> Maybe Text -> BatchCreateChannelMembershipError
BatchCreateChannelMembershipError'
            (Maybe ErrorCode
 -> Maybe Text -> Maybe Text -> BatchCreateChannelMembershipError)
-> Parser (Maybe ErrorCode)
-> Parser
     (Maybe Text -> Maybe Text -> BatchCreateChannelMembershipError)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ErrorCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ErrorCode")
            Parser
  (Maybe Text -> Maybe Text -> BatchCreateChannelMembershipError)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> BatchCreateChannelMembershipError)
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
"MemberArn")
            Parser (Maybe Text -> BatchCreateChannelMembershipError)
-> Parser (Maybe Text) -> Parser BatchCreateChannelMembershipError
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
"ErrorMessage")
      )

instance
  Prelude.Hashable
    BatchCreateChannelMembershipError

instance
  Prelude.NFData
    BatchCreateChannelMembershipError