{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.BatchCreateChannelMembership
-- 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)
--
-- Adds a specified number of users to a channel.
module Amazonka.ChimeSDKMessaging.BatchCreateChannelMembership
  ( -- * Creating a Request
    BatchCreateChannelMembership (..),
    newBatchCreateChannelMembership,

    -- * Request Lenses
    batchCreateChannelMembership_type,
    batchCreateChannelMembership_channelArn,
    batchCreateChannelMembership_memberArns,
    batchCreateChannelMembership_chimeBearer,

    -- * Destructuring the Response
    BatchCreateChannelMembershipResponse (..),
    newBatchCreateChannelMembershipResponse,

    -- * Response Lenses
    batchCreateChannelMembershipResponse_errors,
    batchCreateChannelMembershipResponse_batchChannelMemberships,
    batchCreateChannelMembershipResponse_httpStatus,
  )
where

import Amazonka.ChimeSDKMessaging.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newBatchCreateChannelMembership' smart constructor.
data BatchCreateChannelMembership = BatchCreateChannelMembership'
  { -- | The membership type of a user, @DEFAULT@ or @HIDDEN@. Default members
    -- are always returned as part of @ListChannelMemberships@. Hidden members
    -- are only returned if the type filter in @ListChannelMemberships@ equals
    -- @HIDDEN@. Otherwise hidden members are not returned. This is only
    -- supported by moderators.
    BatchCreateChannelMembership -> Maybe ChannelMembershipType
type' :: Prelude.Maybe ChannelMembershipType,
    -- | The ARN of the channel to which you\'re adding users.
    BatchCreateChannelMembership -> Text
channelArn :: Prelude.Text,
    -- | The ARNs of the members you want to add to the channel.
    BatchCreateChannelMembership -> NonEmpty Text
memberArns :: Prelude.NonEmpty Prelude.Text,
    -- | The @AppInstanceUserArn@ of the user that makes the API call.
    BatchCreateChannelMembership -> Text
chimeBearer :: Prelude.Text
  }
  deriving (BatchCreateChannelMembership
-> BatchCreateChannelMembership -> Bool
(BatchCreateChannelMembership
 -> BatchCreateChannelMembership -> Bool)
-> (BatchCreateChannelMembership
    -> BatchCreateChannelMembership -> Bool)
-> Eq BatchCreateChannelMembership
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchCreateChannelMembership
-> BatchCreateChannelMembership -> Bool
$c/= :: BatchCreateChannelMembership
-> BatchCreateChannelMembership -> Bool
== :: BatchCreateChannelMembership
-> BatchCreateChannelMembership -> Bool
$c== :: BatchCreateChannelMembership
-> BatchCreateChannelMembership -> Bool
Prelude.Eq, ReadPrec [BatchCreateChannelMembership]
ReadPrec BatchCreateChannelMembership
Int -> ReadS BatchCreateChannelMembership
ReadS [BatchCreateChannelMembership]
(Int -> ReadS BatchCreateChannelMembership)
-> ReadS [BatchCreateChannelMembership]
-> ReadPrec BatchCreateChannelMembership
-> ReadPrec [BatchCreateChannelMembership]
-> Read BatchCreateChannelMembership
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchCreateChannelMembership]
$creadListPrec :: ReadPrec [BatchCreateChannelMembership]
readPrec :: ReadPrec BatchCreateChannelMembership
$creadPrec :: ReadPrec BatchCreateChannelMembership
readList :: ReadS [BatchCreateChannelMembership]
$creadList :: ReadS [BatchCreateChannelMembership]
readsPrec :: Int -> ReadS BatchCreateChannelMembership
$creadsPrec :: Int -> ReadS BatchCreateChannelMembership
Prelude.Read, Int -> BatchCreateChannelMembership -> ShowS
[BatchCreateChannelMembership] -> ShowS
BatchCreateChannelMembership -> String
(Int -> BatchCreateChannelMembership -> ShowS)
-> (BatchCreateChannelMembership -> String)
-> ([BatchCreateChannelMembership] -> ShowS)
-> Show BatchCreateChannelMembership
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchCreateChannelMembership] -> ShowS
$cshowList :: [BatchCreateChannelMembership] -> ShowS
show :: BatchCreateChannelMembership -> String
$cshow :: BatchCreateChannelMembership -> String
showsPrec :: Int -> BatchCreateChannelMembership -> ShowS
$cshowsPrec :: Int -> BatchCreateChannelMembership -> ShowS
Prelude.Show, (forall x.
 BatchCreateChannelMembership -> Rep BatchCreateChannelMembership x)
-> (forall x.
    Rep BatchCreateChannelMembership x -> BatchCreateChannelMembership)
-> Generic BatchCreateChannelMembership
forall x.
Rep BatchCreateChannelMembership x -> BatchCreateChannelMembership
forall x.
BatchCreateChannelMembership -> Rep BatchCreateChannelMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchCreateChannelMembership x -> BatchCreateChannelMembership
$cfrom :: forall x.
BatchCreateChannelMembership -> Rep BatchCreateChannelMembership x
Prelude.Generic)

-- |
-- Create a value of 'BatchCreateChannelMembership' 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:
--
-- 'type'', 'batchCreateChannelMembership_type' - The membership type of a user, @DEFAULT@ or @HIDDEN@. Default members
-- are always returned as part of @ListChannelMemberships@. Hidden members
-- are only returned if the type filter in @ListChannelMemberships@ equals
-- @HIDDEN@. Otherwise hidden members are not returned. This is only
-- supported by moderators.
--
-- 'channelArn', 'batchCreateChannelMembership_channelArn' - The ARN of the channel to which you\'re adding users.
--
-- 'memberArns', 'batchCreateChannelMembership_memberArns' - The ARNs of the members you want to add to the channel.
--
-- 'chimeBearer', 'batchCreateChannelMembership_chimeBearer' - The @AppInstanceUserArn@ of the user that makes the API call.
newBatchCreateChannelMembership ::
  -- | 'channelArn'
  Prelude.Text ->
  -- | 'memberArns'
  Prelude.NonEmpty Prelude.Text ->
  -- | 'chimeBearer'
  Prelude.Text ->
  BatchCreateChannelMembership
newBatchCreateChannelMembership :: Text -> NonEmpty Text -> Text -> BatchCreateChannelMembership
newBatchCreateChannelMembership
  Text
pChannelArn_
  NonEmpty Text
pMemberArns_
  Text
pChimeBearer_ =
    BatchCreateChannelMembership' :: Maybe ChannelMembershipType
-> Text -> NonEmpty Text -> Text -> BatchCreateChannelMembership
BatchCreateChannelMembership'
      { $sel:type':BatchCreateChannelMembership' :: Maybe ChannelMembershipType
type' =
          Maybe ChannelMembershipType
forall a. Maybe a
Prelude.Nothing,
        $sel:channelArn:BatchCreateChannelMembership' :: Text
channelArn = Text
pChannelArn_,
        $sel:memberArns:BatchCreateChannelMembership' :: NonEmpty Text
memberArns = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pMemberArns_,
        $sel:chimeBearer:BatchCreateChannelMembership' :: Text
chimeBearer = Text
pChimeBearer_
      }

-- | The membership type of a user, @DEFAULT@ or @HIDDEN@. Default members
-- are always returned as part of @ListChannelMemberships@. Hidden members
-- are only returned if the type filter in @ListChannelMemberships@ equals
-- @HIDDEN@. Otherwise hidden members are not returned. This is only
-- supported by moderators.
batchCreateChannelMembership_type :: Lens.Lens' BatchCreateChannelMembership (Prelude.Maybe ChannelMembershipType)
batchCreateChannelMembership_type :: (Maybe ChannelMembershipType -> f (Maybe ChannelMembershipType))
-> BatchCreateChannelMembership -> f BatchCreateChannelMembership
batchCreateChannelMembership_type = (BatchCreateChannelMembership -> Maybe ChannelMembershipType)
-> (BatchCreateChannelMembership
    -> Maybe ChannelMembershipType -> BatchCreateChannelMembership)
-> Lens
     BatchCreateChannelMembership
     BatchCreateChannelMembership
     (Maybe ChannelMembershipType)
     (Maybe ChannelMembershipType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateChannelMembership' {Maybe ChannelMembershipType
type' :: Maybe ChannelMembershipType
$sel:type':BatchCreateChannelMembership' :: BatchCreateChannelMembership -> Maybe ChannelMembershipType
type'} -> Maybe ChannelMembershipType
type') (\s :: BatchCreateChannelMembership
s@BatchCreateChannelMembership' {} Maybe ChannelMembershipType
a -> BatchCreateChannelMembership
s {$sel:type':BatchCreateChannelMembership' :: Maybe ChannelMembershipType
type' = Maybe ChannelMembershipType
a} :: BatchCreateChannelMembership)

-- | The ARN of the channel to which you\'re adding users.
batchCreateChannelMembership_channelArn :: Lens.Lens' BatchCreateChannelMembership Prelude.Text
batchCreateChannelMembership_channelArn :: (Text -> f Text)
-> BatchCreateChannelMembership -> f BatchCreateChannelMembership
batchCreateChannelMembership_channelArn = (BatchCreateChannelMembership -> Text)
-> (BatchCreateChannelMembership
    -> Text -> BatchCreateChannelMembership)
-> Lens
     BatchCreateChannelMembership BatchCreateChannelMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateChannelMembership' {Text
channelArn :: Text
$sel:channelArn:BatchCreateChannelMembership' :: BatchCreateChannelMembership -> Text
channelArn} -> Text
channelArn) (\s :: BatchCreateChannelMembership
s@BatchCreateChannelMembership' {} Text
a -> BatchCreateChannelMembership
s {$sel:channelArn:BatchCreateChannelMembership' :: Text
channelArn = Text
a} :: BatchCreateChannelMembership)

-- | The ARNs of the members you want to add to the channel.
batchCreateChannelMembership_memberArns :: Lens.Lens' BatchCreateChannelMembership (Prelude.NonEmpty Prelude.Text)
batchCreateChannelMembership_memberArns :: (NonEmpty Text -> f (NonEmpty Text))
-> BatchCreateChannelMembership -> f BatchCreateChannelMembership
batchCreateChannelMembership_memberArns = (BatchCreateChannelMembership -> NonEmpty Text)
-> (BatchCreateChannelMembership
    -> NonEmpty Text -> BatchCreateChannelMembership)
-> Lens
     BatchCreateChannelMembership
     BatchCreateChannelMembership
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateChannelMembership' {NonEmpty Text
memberArns :: NonEmpty Text
$sel:memberArns:BatchCreateChannelMembership' :: BatchCreateChannelMembership -> NonEmpty Text
memberArns} -> NonEmpty Text
memberArns) (\s :: BatchCreateChannelMembership
s@BatchCreateChannelMembership' {} NonEmpty Text
a -> BatchCreateChannelMembership
s {$sel:memberArns:BatchCreateChannelMembership' :: NonEmpty Text
memberArns = NonEmpty Text
a} :: BatchCreateChannelMembership) ((NonEmpty Text -> f (NonEmpty Text))
 -> BatchCreateChannelMembership -> f BatchCreateChannelMembership)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> BatchCreateChannelMembership
-> f BatchCreateChannelMembership
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The @AppInstanceUserArn@ of the user that makes the API call.
batchCreateChannelMembership_chimeBearer :: Lens.Lens' BatchCreateChannelMembership Prelude.Text
batchCreateChannelMembership_chimeBearer :: (Text -> f Text)
-> BatchCreateChannelMembership -> f BatchCreateChannelMembership
batchCreateChannelMembership_chimeBearer = (BatchCreateChannelMembership -> Text)
-> (BatchCreateChannelMembership
    -> Text -> BatchCreateChannelMembership)
-> Lens
     BatchCreateChannelMembership BatchCreateChannelMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateChannelMembership' {Text
chimeBearer :: Text
$sel:chimeBearer:BatchCreateChannelMembership' :: BatchCreateChannelMembership -> Text
chimeBearer} -> Text
chimeBearer) (\s :: BatchCreateChannelMembership
s@BatchCreateChannelMembership' {} Text
a -> BatchCreateChannelMembership
s {$sel:chimeBearer:BatchCreateChannelMembership' :: Text
chimeBearer = Text
a} :: BatchCreateChannelMembership)

instance Core.AWSRequest BatchCreateChannelMembership where
  type
    AWSResponse BatchCreateChannelMembership =
      BatchCreateChannelMembershipResponse
  request :: BatchCreateChannelMembership
-> Request BatchCreateChannelMembership
request = Service
-> BatchCreateChannelMembership
-> Request BatchCreateChannelMembership
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy BatchCreateChannelMembership
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse BatchCreateChannelMembership)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse BatchCreateChannelMembership))
-> Logger
-> Service
-> Proxy BatchCreateChannelMembership
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse BatchCreateChannelMembership)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [BatchCreateChannelMembershipError]
-> Maybe BatchChannelMemberships
-> Int
-> BatchCreateChannelMembershipResponse
BatchCreateChannelMembershipResponse'
            (Maybe [BatchCreateChannelMembershipError]
 -> Maybe BatchChannelMemberships
 -> Int
 -> BatchCreateChannelMembershipResponse)
-> Either String (Maybe [BatchCreateChannelMembershipError])
-> Either
     String
     (Maybe BatchChannelMemberships
      -> Int -> BatchCreateChannelMembershipResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Either
     String (Maybe (Maybe [BatchCreateChannelMembershipError]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Errors" Either String (Maybe (Maybe [BatchCreateChannelMembershipError]))
-> Maybe [BatchCreateChannelMembershipError]
-> Either String (Maybe [BatchCreateChannelMembershipError])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BatchCreateChannelMembershipError]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe BatchChannelMemberships
   -> Int -> BatchCreateChannelMembershipResponse)
-> Either String (Maybe BatchChannelMemberships)
-> Either String (Int -> BatchCreateChannelMembershipResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe BatchChannelMemberships)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"BatchChannelMemberships")
            Either String (Int -> BatchCreateChannelMembershipResponse)
-> Either String Int
-> Either String BatchCreateChannelMembershipResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    BatchCreateChannelMembership

instance Prelude.NFData BatchCreateChannelMembership

instance Core.ToHeaders BatchCreateChannelMembership where
  toHeaders :: BatchCreateChannelMembership -> ResponseHeaders
toHeaders BatchCreateChannelMembership' {Maybe ChannelMembershipType
NonEmpty Text
Text
chimeBearer :: Text
memberArns :: NonEmpty Text
channelArn :: Text
type' :: Maybe ChannelMembershipType
$sel:chimeBearer:BatchCreateChannelMembership' :: BatchCreateChannelMembership -> Text
$sel:memberArns:BatchCreateChannelMembership' :: BatchCreateChannelMembership -> NonEmpty Text
$sel:channelArn:BatchCreateChannelMembership' :: BatchCreateChannelMembership -> Text
$sel:type':BatchCreateChannelMembership' :: BatchCreateChannelMembership -> Maybe ChannelMembershipType
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [HeaderName
"x-amz-chime-bearer" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
chimeBearer]

instance Core.ToJSON BatchCreateChannelMembership where
  toJSON :: BatchCreateChannelMembership -> Value
toJSON BatchCreateChannelMembership' {Maybe ChannelMembershipType
NonEmpty Text
Text
chimeBearer :: Text
memberArns :: NonEmpty Text
channelArn :: Text
type' :: Maybe ChannelMembershipType
$sel:chimeBearer:BatchCreateChannelMembership' :: BatchCreateChannelMembership -> Text
$sel:memberArns:BatchCreateChannelMembership' :: BatchCreateChannelMembership -> NonEmpty Text
$sel:channelArn:BatchCreateChannelMembership' :: BatchCreateChannelMembership -> Text
$sel:type':BatchCreateChannelMembership' :: BatchCreateChannelMembership -> Maybe ChannelMembershipType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Type" Text -> ChannelMembershipType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ChannelMembershipType -> Pair)
-> Maybe ChannelMembershipType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ChannelMembershipType
type',
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MemberArns" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
memberArns)
          ]
      )

instance Core.ToPath BatchCreateChannelMembership where
  toPath :: BatchCreateChannelMembership -> ByteString
toPath BatchCreateChannelMembership' {Maybe ChannelMembershipType
NonEmpty Text
Text
chimeBearer :: Text
memberArns :: NonEmpty Text
channelArn :: Text
type' :: Maybe ChannelMembershipType
$sel:chimeBearer:BatchCreateChannelMembership' :: BatchCreateChannelMembership -> Text
$sel:memberArns:BatchCreateChannelMembership' :: BatchCreateChannelMembership -> NonEmpty Text
$sel:channelArn:BatchCreateChannelMembership' :: BatchCreateChannelMembership -> Text
$sel:type':BatchCreateChannelMembership' :: BatchCreateChannelMembership -> Maybe ChannelMembershipType
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/channels/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelArn, ByteString
"/memberships"]

instance Core.ToQuery BatchCreateChannelMembership where
  toQuery :: BatchCreateChannelMembership -> QueryString
toQuery =
    QueryString -> BatchCreateChannelMembership -> QueryString
forall a b. a -> b -> a
Prelude.const
      ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"operation=batch-create"])

-- | /See:/ 'newBatchCreateChannelMembershipResponse' smart constructor.
data BatchCreateChannelMembershipResponse = BatchCreateChannelMembershipResponse'
  { -- | If the action fails for one or more of the memberships in the request, a
    -- list of the memberships is returned, along with error codes and error
    -- messages.
    BatchCreateChannelMembershipResponse
-> Maybe [BatchCreateChannelMembershipError]
errors :: Prelude.Maybe [BatchCreateChannelMembershipError],
    -- | The list of channel memberships in the response.
    BatchCreateChannelMembershipResponse
-> Maybe BatchChannelMemberships
batchChannelMemberships :: Prelude.Maybe BatchChannelMemberships,
    -- | The response's http status code.
    BatchCreateChannelMembershipResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (BatchCreateChannelMembershipResponse
-> BatchCreateChannelMembershipResponse -> Bool
(BatchCreateChannelMembershipResponse
 -> BatchCreateChannelMembershipResponse -> Bool)
-> (BatchCreateChannelMembershipResponse
    -> BatchCreateChannelMembershipResponse -> Bool)
-> Eq BatchCreateChannelMembershipResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchCreateChannelMembershipResponse
-> BatchCreateChannelMembershipResponse -> Bool
$c/= :: BatchCreateChannelMembershipResponse
-> BatchCreateChannelMembershipResponse -> Bool
== :: BatchCreateChannelMembershipResponse
-> BatchCreateChannelMembershipResponse -> Bool
$c== :: BatchCreateChannelMembershipResponse
-> BatchCreateChannelMembershipResponse -> Bool
Prelude.Eq, Int -> BatchCreateChannelMembershipResponse -> ShowS
[BatchCreateChannelMembershipResponse] -> ShowS
BatchCreateChannelMembershipResponse -> String
(Int -> BatchCreateChannelMembershipResponse -> ShowS)
-> (BatchCreateChannelMembershipResponse -> String)
-> ([BatchCreateChannelMembershipResponse] -> ShowS)
-> Show BatchCreateChannelMembershipResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchCreateChannelMembershipResponse] -> ShowS
$cshowList :: [BatchCreateChannelMembershipResponse] -> ShowS
show :: BatchCreateChannelMembershipResponse -> String
$cshow :: BatchCreateChannelMembershipResponse -> String
showsPrec :: Int -> BatchCreateChannelMembershipResponse -> ShowS
$cshowsPrec :: Int -> BatchCreateChannelMembershipResponse -> ShowS
Prelude.Show, (forall x.
 BatchCreateChannelMembershipResponse
 -> Rep BatchCreateChannelMembershipResponse x)
-> (forall x.
    Rep BatchCreateChannelMembershipResponse x
    -> BatchCreateChannelMembershipResponse)
-> Generic BatchCreateChannelMembershipResponse
forall x.
Rep BatchCreateChannelMembershipResponse x
-> BatchCreateChannelMembershipResponse
forall x.
BatchCreateChannelMembershipResponse
-> Rep BatchCreateChannelMembershipResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchCreateChannelMembershipResponse x
-> BatchCreateChannelMembershipResponse
$cfrom :: forall x.
BatchCreateChannelMembershipResponse
-> Rep BatchCreateChannelMembershipResponse x
Prelude.Generic)

-- |
-- Create a value of 'BatchCreateChannelMembershipResponse' 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:
--
-- 'errors', 'batchCreateChannelMembershipResponse_errors' - If the action fails for one or more of the memberships in the request, a
-- list of the memberships is returned, along with error codes and error
-- messages.
--
-- 'batchChannelMemberships', 'batchCreateChannelMembershipResponse_batchChannelMemberships' - The list of channel memberships in the response.
--
-- 'httpStatus', 'batchCreateChannelMembershipResponse_httpStatus' - The response's http status code.
newBatchCreateChannelMembershipResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  BatchCreateChannelMembershipResponse
newBatchCreateChannelMembershipResponse :: Int -> BatchCreateChannelMembershipResponse
newBatchCreateChannelMembershipResponse Int
pHttpStatus_ =
  BatchCreateChannelMembershipResponse' :: Maybe [BatchCreateChannelMembershipError]
-> Maybe BatchChannelMemberships
-> Int
-> BatchCreateChannelMembershipResponse
BatchCreateChannelMembershipResponse'
    { $sel:errors:BatchCreateChannelMembershipResponse' :: Maybe [BatchCreateChannelMembershipError]
errors =
        Maybe [BatchCreateChannelMembershipError]
forall a. Maybe a
Prelude.Nothing,
      $sel:batchChannelMemberships:BatchCreateChannelMembershipResponse' :: Maybe BatchChannelMemberships
batchChannelMemberships =
        Maybe BatchChannelMemberships
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:BatchCreateChannelMembershipResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If the action fails for one or more of the memberships in the request, a
-- list of the memberships is returned, along with error codes and error
-- messages.
batchCreateChannelMembershipResponse_errors :: Lens.Lens' BatchCreateChannelMembershipResponse (Prelude.Maybe [BatchCreateChannelMembershipError])
batchCreateChannelMembershipResponse_errors :: (Maybe [BatchCreateChannelMembershipError]
 -> f (Maybe [BatchCreateChannelMembershipError]))
-> BatchCreateChannelMembershipResponse
-> f BatchCreateChannelMembershipResponse
batchCreateChannelMembershipResponse_errors = (BatchCreateChannelMembershipResponse
 -> Maybe [BatchCreateChannelMembershipError])
-> (BatchCreateChannelMembershipResponse
    -> Maybe [BatchCreateChannelMembershipError]
    -> BatchCreateChannelMembershipResponse)
-> Lens
     BatchCreateChannelMembershipResponse
     BatchCreateChannelMembershipResponse
     (Maybe [BatchCreateChannelMembershipError])
     (Maybe [BatchCreateChannelMembershipError])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateChannelMembershipResponse' {Maybe [BatchCreateChannelMembershipError]
errors :: Maybe [BatchCreateChannelMembershipError]
$sel:errors:BatchCreateChannelMembershipResponse' :: BatchCreateChannelMembershipResponse
-> Maybe [BatchCreateChannelMembershipError]
errors} -> Maybe [BatchCreateChannelMembershipError]
errors) (\s :: BatchCreateChannelMembershipResponse
s@BatchCreateChannelMembershipResponse' {} Maybe [BatchCreateChannelMembershipError]
a -> BatchCreateChannelMembershipResponse
s {$sel:errors:BatchCreateChannelMembershipResponse' :: Maybe [BatchCreateChannelMembershipError]
errors = Maybe [BatchCreateChannelMembershipError]
a} :: BatchCreateChannelMembershipResponse) ((Maybe [BatchCreateChannelMembershipError]
  -> f (Maybe [BatchCreateChannelMembershipError]))
 -> BatchCreateChannelMembershipResponse
 -> f BatchCreateChannelMembershipResponse)
-> ((Maybe [BatchCreateChannelMembershipError]
     -> f (Maybe [BatchCreateChannelMembershipError]))
    -> Maybe [BatchCreateChannelMembershipError]
    -> f (Maybe [BatchCreateChannelMembershipError]))
-> (Maybe [BatchCreateChannelMembershipError]
    -> f (Maybe [BatchCreateChannelMembershipError]))
-> BatchCreateChannelMembershipResponse
-> f BatchCreateChannelMembershipResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [BatchCreateChannelMembershipError]
  [BatchCreateChannelMembershipError]
  [BatchCreateChannelMembershipError]
  [BatchCreateChannelMembershipError]
-> Iso
     (Maybe [BatchCreateChannelMembershipError])
     (Maybe [BatchCreateChannelMembershipError])
     (Maybe [BatchCreateChannelMembershipError])
     (Maybe [BatchCreateChannelMembershipError])
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
  [BatchCreateChannelMembershipError]
  [BatchCreateChannelMembershipError]
  [BatchCreateChannelMembershipError]
  [BatchCreateChannelMembershipError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The list of channel memberships in the response.
batchCreateChannelMembershipResponse_batchChannelMemberships :: Lens.Lens' BatchCreateChannelMembershipResponse (Prelude.Maybe BatchChannelMemberships)
batchCreateChannelMembershipResponse_batchChannelMemberships :: (Maybe BatchChannelMemberships
 -> f (Maybe BatchChannelMemberships))
-> BatchCreateChannelMembershipResponse
-> f BatchCreateChannelMembershipResponse
batchCreateChannelMembershipResponse_batchChannelMemberships = (BatchCreateChannelMembershipResponse
 -> Maybe BatchChannelMemberships)
-> (BatchCreateChannelMembershipResponse
    -> Maybe BatchChannelMemberships
    -> BatchCreateChannelMembershipResponse)
-> Lens
     BatchCreateChannelMembershipResponse
     BatchCreateChannelMembershipResponse
     (Maybe BatchChannelMemberships)
     (Maybe BatchChannelMemberships)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateChannelMembershipResponse' {Maybe BatchChannelMemberships
batchChannelMemberships :: Maybe BatchChannelMemberships
$sel:batchChannelMemberships:BatchCreateChannelMembershipResponse' :: BatchCreateChannelMembershipResponse
-> Maybe BatchChannelMemberships
batchChannelMemberships} -> Maybe BatchChannelMemberships
batchChannelMemberships) (\s :: BatchCreateChannelMembershipResponse
s@BatchCreateChannelMembershipResponse' {} Maybe BatchChannelMemberships
a -> BatchCreateChannelMembershipResponse
s {$sel:batchChannelMemberships:BatchCreateChannelMembershipResponse' :: Maybe BatchChannelMemberships
batchChannelMemberships = Maybe BatchChannelMemberships
a} :: BatchCreateChannelMembershipResponse)

-- | The response's http status code.
batchCreateChannelMembershipResponse_httpStatus :: Lens.Lens' BatchCreateChannelMembershipResponse Prelude.Int
batchCreateChannelMembershipResponse_httpStatus :: (Int -> f Int)
-> BatchCreateChannelMembershipResponse
-> f BatchCreateChannelMembershipResponse
batchCreateChannelMembershipResponse_httpStatus = (BatchCreateChannelMembershipResponse -> Int)
-> (BatchCreateChannelMembershipResponse
    -> Int -> BatchCreateChannelMembershipResponse)
-> Lens
     BatchCreateChannelMembershipResponse
     BatchCreateChannelMembershipResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateChannelMembershipResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchCreateChannelMembershipResponse' :: BatchCreateChannelMembershipResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchCreateChannelMembershipResponse
s@BatchCreateChannelMembershipResponse' {} Int
a -> BatchCreateChannelMembershipResponse
s {$sel:httpStatus:BatchCreateChannelMembershipResponse' :: Int
httpStatus = Int
a} :: BatchCreateChannelMembershipResponse)

instance
  Prelude.NFData
    BatchCreateChannelMembershipResponse