{-# 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.Detective.CreateMembers
-- 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)
--
-- Sends a request to invite the specified AWS accounts to be member
-- accounts in the behavior graph. This operation can only be called by the
-- administrator account for a behavior graph.
--
-- @CreateMembers@ verifies the accounts and then invites the verified
-- accounts. The administrator can optionally specify to not send
-- invitation emails to the member accounts. This would be used when the
-- administrator manages their member accounts centrally.
--
-- The request provides the behavior graph ARN and the list of accounts to
-- invite.
--
-- The response separates the requested accounts into two lists:
--
-- -   The accounts that @CreateMembers@ was able to start the verification
--     for. This list includes member accounts that are being verified,
--     that have passed verification and are to be invited, and that have
--     failed verification.
--
-- -   The accounts that @CreateMembers@ was unable to process. This list
--     includes accounts that were already invited to be member accounts in
--     the behavior graph.
module Amazonka.Detective.CreateMembers
  ( -- * Creating a Request
    CreateMembers (..),
    newCreateMembers,

    -- * Request Lenses
    createMembers_disableEmailNotification,
    createMembers_message,
    createMembers_graphArn,
    createMembers_accounts,

    -- * Destructuring the Response
    CreateMembersResponse (..),
    newCreateMembersResponse,

    -- * Response Lenses
    createMembersResponse_members,
    createMembersResponse_unprocessedAccounts,
    createMembersResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Detective.Types
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:/ 'newCreateMembers' smart constructor.
data CreateMembers = CreateMembers'
  { -- | if set to @true@, then the member accounts do not receive email
    -- notifications. By default, this is set to @false@, and the member
    -- accounts receive email notifications.
    CreateMembers -> Maybe Bool
disableEmailNotification :: Prelude.Maybe Prelude.Bool,
    -- | Customized message text to include in the invitation email message to
    -- the invited member accounts.
    CreateMembers -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the behavior graph to invite the member accounts to
    -- contribute their data to.
    CreateMembers -> Text
graphArn :: Prelude.Text,
    -- | The list of AWS accounts to invite to become member accounts in the
    -- behavior graph. You can invite up to 50 accounts at a time. For each
    -- invited account, the account list contains the account identifier and
    -- the AWS account root user email address.
    CreateMembers -> NonEmpty Account
accounts :: Prelude.NonEmpty Account
  }
  deriving (CreateMembers -> CreateMembers -> Bool
(CreateMembers -> CreateMembers -> Bool)
-> (CreateMembers -> CreateMembers -> Bool) -> Eq CreateMembers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMembers -> CreateMembers -> Bool
$c/= :: CreateMembers -> CreateMembers -> Bool
== :: CreateMembers -> CreateMembers -> Bool
$c== :: CreateMembers -> CreateMembers -> Bool
Prelude.Eq, ReadPrec [CreateMembers]
ReadPrec CreateMembers
Int -> ReadS CreateMembers
ReadS [CreateMembers]
(Int -> ReadS CreateMembers)
-> ReadS [CreateMembers]
-> ReadPrec CreateMembers
-> ReadPrec [CreateMembers]
-> Read CreateMembers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMembers]
$creadListPrec :: ReadPrec [CreateMembers]
readPrec :: ReadPrec CreateMembers
$creadPrec :: ReadPrec CreateMembers
readList :: ReadS [CreateMembers]
$creadList :: ReadS [CreateMembers]
readsPrec :: Int -> ReadS CreateMembers
$creadsPrec :: Int -> ReadS CreateMembers
Prelude.Read, Int -> CreateMembers -> ShowS
[CreateMembers] -> ShowS
CreateMembers -> String
(Int -> CreateMembers -> ShowS)
-> (CreateMembers -> String)
-> ([CreateMembers] -> ShowS)
-> Show CreateMembers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMembers] -> ShowS
$cshowList :: [CreateMembers] -> ShowS
show :: CreateMembers -> String
$cshow :: CreateMembers -> String
showsPrec :: Int -> CreateMembers -> ShowS
$cshowsPrec :: Int -> CreateMembers -> ShowS
Prelude.Show, (forall x. CreateMembers -> Rep CreateMembers x)
-> (forall x. Rep CreateMembers x -> CreateMembers)
-> Generic CreateMembers
forall x. Rep CreateMembers x -> CreateMembers
forall x. CreateMembers -> Rep CreateMembers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMembers x -> CreateMembers
$cfrom :: forall x. CreateMembers -> Rep CreateMembers x
Prelude.Generic)

-- |
-- Create a value of 'CreateMembers' 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:
--
-- 'disableEmailNotification', 'createMembers_disableEmailNotification' - if set to @true@, then the member accounts do not receive email
-- notifications. By default, this is set to @false@, and the member
-- accounts receive email notifications.
--
-- 'message', 'createMembers_message' - Customized message text to include in the invitation email message to
-- the invited member accounts.
--
-- 'graphArn', 'createMembers_graphArn' - The ARN of the behavior graph to invite the member accounts to
-- contribute their data to.
--
-- 'accounts', 'createMembers_accounts' - The list of AWS accounts to invite to become member accounts in the
-- behavior graph. You can invite up to 50 accounts at a time. For each
-- invited account, the account list contains the account identifier and
-- the AWS account root user email address.
newCreateMembers ::
  -- | 'graphArn'
  Prelude.Text ->
  -- | 'accounts'
  Prelude.NonEmpty Account ->
  CreateMembers
newCreateMembers :: Text -> NonEmpty Account -> CreateMembers
newCreateMembers Text
pGraphArn_ NonEmpty Account
pAccounts_ =
  CreateMembers' :: Maybe Bool
-> Maybe Text -> Text -> NonEmpty Account -> CreateMembers
CreateMembers'
    { $sel:disableEmailNotification:CreateMembers' :: Maybe Bool
disableEmailNotification =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:message:CreateMembers' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:graphArn:CreateMembers' :: Text
graphArn = Text
pGraphArn_,
      $sel:accounts:CreateMembers' :: NonEmpty Account
accounts = Tagged (NonEmpty Account) (Identity (NonEmpty Account))
-> Tagged (NonEmpty Account) (Identity (NonEmpty Account))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Account) (Identity (NonEmpty Account))
 -> Tagged (NonEmpty Account) (Identity (NonEmpty Account)))
-> NonEmpty Account -> NonEmpty Account
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Account
pAccounts_
    }

-- | if set to @true@, then the member accounts do not receive email
-- notifications. By default, this is set to @false@, and the member
-- accounts receive email notifications.
createMembers_disableEmailNotification :: Lens.Lens' CreateMembers (Prelude.Maybe Prelude.Bool)
createMembers_disableEmailNotification :: (Maybe Bool -> f (Maybe Bool)) -> CreateMembers -> f CreateMembers
createMembers_disableEmailNotification = (CreateMembers -> Maybe Bool)
-> (CreateMembers -> Maybe Bool -> CreateMembers)
-> Lens CreateMembers CreateMembers (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMembers' {Maybe Bool
disableEmailNotification :: Maybe Bool
$sel:disableEmailNotification:CreateMembers' :: CreateMembers -> Maybe Bool
disableEmailNotification} -> Maybe Bool
disableEmailNotification) (\s :: CreateMembers
s@CreateMembers' {} Maybe Bool
a -> CreateMembers
s {$sel:disableEmailNotification:CreateMembers' :: Maybe Bool
disableEmailNotification = Maybe Bool
a} :: CreateMembers)

-- | Customized message text to include in the invitation email message to
-- the invited member accounts.
createMembers_message :: Lens.Lens' CreateMembers (Prelude.Maybe Prelude.Text)
createMembers_message :: (Maybe Text -> f (Maybe Text)) -> CreateMembers -> f CreateMembers
createMembers_message = (CreateMembers -> Maybe Text)
-> (CreateMembers -> Maybe Text -> CreateMembers)
-> Lens CreateMembers CreateMembers (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMembers' {Maybe Text
message :: Maybe Text
$sel:message:CreateMembers' :: CreateMembers -> Maybe Text
message} -> Maybe Text
message) (\s :: CreateMembers
s@CreateMembers' {} Maybe Text
a -> CreateMembers
s {$sel:message:CreateMembers' :: Maybe Text
message = Maybe Text
a} :: CreateMembers)

-- | The ARN of the behavior graph to invite the member accounts to
-- contribute their data to.
createMembers_graphArn :: Lens.Lens' CreateMembers Prelude.Text
createMembers_graphArn :: (Text -> f Text) -> CreateMembers -> f CreateMembers
createMembers_graphArn = (CreateMembers -> Text)
-> (CreateMembers -> Text -> CreateMembers)
-> Lens CreateMembers CreateMembers Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMembers' {Text
graphArn :: Text
$sel:graphArn:CreateMembers' :: CreateMembers -> Text
graphArn} -> Text
graphArn) (\s :: CreateMembers
s@CreateMembers' {} Text
a -> CreateMembers
s {$sel:graphArn:CreateMembers' :: Text
graphArn = Text
a} :: CreateMembers)

-- | The list of AWS accounts to invite to become member accounts in the
-- behavior graph. You can invite up to 50 accounts at a time. For each
-- invited account, the account list contains the account identifier and
-- the AWS account root user email address.
createMembers_accounts :: Lens.Lens' CreateMembers (Prelude.NonEmpty Account)
createMembers_accounts :: (NonEmpty Account -> f (NonEmpty Account))
-> CreateMembers -> f CreateMembers
createMembers_accounts = (CreateMembers -> NonEmpty Account)
-> (CreateMembers -> NonEmpty Account -> CreateMembers)
-> Lens
     CreateMembers CreateMembers (NonEmpty Account) (NonEmpty Account)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMembers' {NonEmpty Account
accounts :: NonEmpty Account
$sel:accounts:CreateMembers' :: CreateMembers -> NonEmpty Account
accounts} -> NonEmpty Account
accounts) (\s :: CreateMembers
s@CreateMembers' {} NonEmpty Account
a -> CreateMembers
s {$sel:accounts:CreateMembers' :: NonEmpty Account
accounts = NonEmpty Account
a} :: CreateMembers) ((NonEmpty Account -> f (NonEmpty Account))
 -> CreateMembers -> f CreateMembers)
-> ((NonEmpty Account -> f (NonEmpty Account))
    -> NonEmpty Account -> f (NonEmpty Account))
-> (NonEmpty Account -> f (NonEmpty Account))
-> CreateMembers
-> f CreateMembers
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Account -> f (NonEmpty Account))
-> NonEmpty Account -> f (NonEmpty Account)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateMembers where
  type
    AWSResponse CreateMembers =
      CreateMembersResponse
  request :: CreateMembers -> Request CreateMembers
request = Service -> CreateMembers -> Request CreateMembers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateMembers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateMembers)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateMembers))
-> Logger
-> Service
-> Proxy CreateMembers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateMembers)))
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 [MemberDetail]
-> Maybe [UnprocessedAccount] -> Int -> CreateMembersResponse
CreateMembersResponse'
            (Maybe [MemberDetail]
 -> Maybe [UnprocessedAccount] -> Int -> CreateMembersResponse)
-> Either String (Maybe [MemberDetail])
-> Either
     String (Maybe [UnprocessedAccount] -> Int -> CreateMembersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [MemberDetail]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Members" Either String (Maybe (Maybe [MemberDetail]))
-> Maybe [MemberDetail] -> Either String (Maybe [MemberDetail])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [MemberDetail]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String (Maybe [UnprocessedAccount] -> Int -> CreateMembersResponse)
-> Either String (Maybe [UnprocessedAccount])
-> Either String (Int -> CreateMembersResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [UnprocessedAccount]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UnprocessedAccounts"
                            Either String (Maybe (Maybe [UnprocessedAccount]))
-> Maybe [UnprocessedAccount]
-> Either String (Maybe [UnprocessedAccount])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [UnprocessedAccount]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> CreateMembersResponse)
-> Either String Int -> Either String CreateMembersResponse
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 CreateMembers

instance Prelude.NFData CreateMembers

instance Core.ToHeaders CreateMembers where
  toHeaders :: CreateMembers -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateMembers -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateMembers where
  toJSON :: CreateMembers -> Value
toJSON CreateMembers' {Maybe Bool
Maybe Text
NonEmpty Account
Text
accounts :: NonEmpty Account
graphArn :: Text
message :: Maybe Text
disableEmailNotification :: Maybe Bool
$sel:accounts:CreateMembers' :: CreateMembers -> NonEmpty Account
$sel:graphArn:CreateMembers' :: CreateMembers -> Text
$sel:message:CreateMembers' :: CreateMembers -> Maybe Text
$sel:disableEmailNotification:CreateMembers' :: CreateMembers -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DisableEmailNotification" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
disableEmailNotification,
            (Text
"Message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
message,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GraphArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
graphArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Accounts" Text -> NonEmpty Account -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Account
accounts)
          ]
      )

instance Core.ToPath CreateMembers where
  toPath :: CreateMembers -> ByteString
toPath = ByteString -> CreateMembers -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/graph/members"

instance Core.ToQuery CreateMembers where
  toQuery :: CreateMembers -> QueryString
toQuery = QueryString -> CreateMembers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateMembersResponse' smart constructor.
data CreateMembersResponse = CreateMembersResponse'
  { -- | The set of member account invitation requests that Detective was able to
    -- process. This includes accounts that are being verified, that failed
    -- verification, and that passed verification and are being sent an
    -- invitation.
    CreateMembersResponse -> Maybe [MemberDetail]
members :: Prelude.Maybe [MemberDetail],
    -- | The list of accounts for which Detective was unable to process the
    -- invitation request. For each account, the list provides the reason why
    -- the request could not be processed. The list includes accounts that are
    -- already member accounts in the behavior graph.
    CreateMembersResponse -> Maybe [UnprocessedAccount]
unprocessedAccounts :: Prelude.Maybe [UnprocessedAccount],
    -- | The response's http status code.
    CreateMembersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateMembersResponse -> CreateMembersResponse -> Bool
(CreateMembersResponse -> CreateMembersResponse -> Bool)
-> (CreateMembersResponse -> CreateMembersResponse -> Bool)
-> Eq CreateMembersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMembersResponse -> CreateMembersResponse -> Bool
$c/= :: CreateMembersResponse -> CreateMembersResponse -> Bool
== :: CreateMembersResponse -> CreateMembersResponse -> Bool
$c== :: CreateMembersResponse -> CreateMembersResponse -> Bool
Prelude.Eq, ReadPrec [CreateMembersResponse]
ReadPrec CreateMembersResponse
Int -> ReadS CreateMembersResponse
ReadS [CreateMembersResponse]
(Int -> ReadS CreateMembersResponse)
-> ReadS [CreateMembersResponse]
-> ReadPrec CreateMembersResponse
-> ReadPrec [CreateMembersResponse]
-> Read CreateMembersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMembersResponse]
$creadListPrec :: ReadPrec [CreateMembersResponse]
readPrec :: ReadPrec CreateMembersResponse
$creadPrec :: ReadPrec CreateMembersResponse
readList :: ReadS [CreateMembersResponse]
$creadList :: ReadS [CreateMembersResponse]
readsPrec :: Int -> ReadS CreateMembersResponse
$creadsPrec :: Int -> ReadS CreateMembersResponse
Prelude.Read, Int -> CreateMembersResponse -> ShowS
[CreateMembersResponse] -> ShowS
CreateMembersResponse -> String
(Int -> CreateMembersResponse -> ShowS)
-> (CreateMembersResponse -> String)
-> ([CreateMembersResponse] -> ShowS)
-> Show CreateMembersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMembersResponse] -> ShowS
$cshowList :: [CreateMembersResponse] -> ShowS
show :: CreateMembersResponse -> String
$cshow :: CreateMembersResponse -> String
showsPrec :: Int -> CreateMembersResponse -> ShowS
$cshowsPrec :: Int -> CreateMembersResponse -> ShowS
Prelude.Show, (forall x. CreateMembersResponse -> Rep CreateMembersResponse x)
-> (forall x. Rep CreateMembersResponse x -> CreateMembersResponse)
-> Generic CreateMembersResponse
forall x. Rep CreateMembersResponse x -> CreateMembersResponse
forall x. CreateMembersResponse -> Rep CreateMembersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMembersResponse x -> CreateMembersResponse
$cfrom :: forall x. CreateMembersResponse -> Rep CreateMembersResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateMembersResponse' 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:
--
-- 'members', 'createMembersResponse_members' - The set of member account invitation requests that Detective was able to
-- process. This includes accounts that are being verified, that failed
-- verification, and that passed verification and are being sent an
-- invitation.
--
-- 'unprocessedAccounts', 'createMembersResponse_unprocessedAccounts' - The list of accounts for which Detective was unable to process the
-- invitation request. For each account, the list provides the reason why
-- the request could not be processed. The list includes accounts that are
-- already member accounts in the behavior graph.
--
-- 'httpStatus', 'createMembersResponse_httpStatus' - The response's http status code.
newCreateMembersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateMembersResponse
newCreateMembersResponse :: Int -> CreateMembersResponse
newCreateMembersResponse Int
pHttpStatus_ =
  CreateMembersResponse' :: Maybe [MemberDetail]
-> Maybe [UnprocessedAccount] -> Int -> CreateMembersResponse
CreateMembersResponse'
    { $sel:members:CreateMembersResponse' :: Maybe [MemberDetail]
members = Maybe [MemberDetail]
forall a. Maybe a
Prelude.Nothing,
      $sel:unprocessedAccounts:CreateMembersResponse' :: Maybe [UnprocessedAccount]
unprocessedAccounts = Maybe [UnprocessedAccount]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateMembersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The set of member account invitation requests that Detective was able to
-- process. This includes accounts that are being verified, that failed
-- verification, and that passed verification and are being sent an
-- invitation.
createMembersResponse_members :: Lens.Lens' CreateMembersResponse (Prelude.Maybe [MemberDetail])
createMembersResponse_members :: (Maybe [MemberDetail] -> f (Maybe [MemberDetail]))
-> CreateMembersResponse -> f CreateMembersResponse
createMembersResponse_members = (CreateMembersResponse -> Maybe [MemberDetail])
-> (CreateMembersResponse
    -> Maybe [MemberDetail] -> CreateMembersResponse)
-> Lens
     CreateMembersResponse
     CreateMembersResponse
     (Maybe [MemberDetail])
     (Maybe [MemberDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMembersResponse' {Maybe [MemberDetail]
members :: Maybe [MemberDetail]
$sel:members:CreateMembersResponse' :: CreateMembersResponse -> Maybe [MemberDetail]
members} -> Maybe [MemberDetail]
members) (\s :: CreateMembersResponse
s@CreateMembersResponse' {} Maybe [MemberDetail]
a -> CreateMembersResponse
s {$sel:members:CreateMembersResponse' :: Maybe [MemberDetail]
members = Maybe [MemberDetail]
a} :: CreateMembersResponse) ((Maybe [MemberDetail] -> f (Maybe [MemberDetail]))
 -> CreateMembersResponse -> f CreateMembersResponse)
-> ((Maybe [MemberDetail] -> f (Maybe [MemberDetail]))
    -> Maybe [MemberDetail] -> f (Maybe [MemberDetail]))
-> (Maybe [MemberDetail] -> f (Maybe [MemberDetail]))
-> CreateMembersResponse
-> f CreateMembersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [MemberDetail] [MemberDetail] [MemberDetail] [MemberDetail]
-> Iso
     (Maybe [MemberDetail])
     (Maybe [MemberDetail])
     (Maybe [MemberDetail])
     (Maybe [MemberDetail])
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 [MemberDetail] [MemberDetail] [MemberDetail] [MemberDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The list of accounts for which Detective was unable to process the
-- invitation request. For each account, the list provides the reason why
-- the request could not be processed. The list includes accounts that are
-- already member accounts in the behavior graph.
createMembersResponse_unprocessedAccounts :: Lens.Lens' CreateMembersResponse (Prelude.Maybe [UnprocessedAccount])
createMembersResponse_unprocessedAccounts :: (Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
-> CreateMembersResponse -> f CreateMembersResponse
createMembersResponse_unprocessedAccounts = (CreateMembersResponse -> Maybe [UnprocessedAccount])
-> (CreateMembersResponse
    -> Maybe [UnprocessedAccount] -> CreateMembersResponse)
-> Lens
     CreateMembersResponse
     CreateMembersResponse
     (Maybe [UnprocessedAccount])
     (Maybe [UnprocessedAccount])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMembersResponse' {Maybe [UnprocessedAccount]
unprocessedAccounts :: Maybe [UnprocessedAccount]
$sel:unprocessedAccounts:CreateMembersResponse' :: CreateMembersResponse -> Maybe [UnprocessedAccount]
unprocessedAccounts} -> Maybe [UnprocessedAccount]
unprocessedAccounts) (\s :: CreateMembersResponse
s@CreateMembersResponse' {} Maybe [UnprocessedAccount]
a -> CreateMembersResponse
s {$sel:unprocessedAccounts:CreateMembersResponse' :: Maybe [UnprocessedAccount]
unprocessedAccounts = Maybe [UnprocessedAccount]
a} :: CreateMembersResponse) ((Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
 -> CreateMembersResponse -> f CreateMembersResponse)
-> ((Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
    -> Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
-> (Maybe [UnprocessedAccount] -> f (Maybe [UnprocessedAccount]))
-> CreateMembersResponse
-> f CreateMembersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [UnprocessedAccount]
  [UnprocessedAccount]
  [UnprocessedAccount]
  [UnprocessedAccount]
-> Iso
     (Maybe [UnprocessedAccount])
     (Maybe [UnprocessedAccount])
     (Maybe [UnprocessedAccount])
     (Maybe [UnprocessedAccount])
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
  [UnprocessedAccount]
  [UnprocessedAccount]
  [UnprocessedAccount]
  [UnprocessedAccount]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData CreateMembersResponse