{-# 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.Connect.UpdateUserSecurityProfiles
-- 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)
--
-- Assigns the specified security profiles to the specified user.
module Amazonka.Connect.UpdateUserSecurityProfiles
  ( -- * Creating a Request
    UpdateUserSecurityProfiles (..),
    newUpdateUserSecurityProfiles,

    -- * Request Lenses
    updateUserSecurityProfiles_securityProfileIds,
    updateUserSecurityProfiles_userId,
    updateUserSecurityProfiles_instanceId,

    -- * Destructuring the Response
    UpdateUserSecurityProfilesResponse (..),
    newUpdateUserSecurityProfilesResponse,
  )
where

import Amazonka.Connect.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:/ 'newUpdateUserSecurityProfiles' smart constructor.
data UpdateUserSecurityProfiles = UpdateUserSecurityProfiles'
  { -- | The identifiers of the security profiles for the user.
    UpdateUserSecurityProfiles -> NonEmpty Text
securityProfileIds :: Prelude.NonEmpty Prelude.Text,
    -- | The identifier of the user account.
    UpdateUserSecurityProfiles -> Text
userId :: Prelude.Text,
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    UpdateUserSecurityProfiles -> Text
instanceId :: Prelude.Text
  }
  deriving (UpdateUserSecurityProfiles -> UpdateUserSecurityProfiles -> Bool
(UpdateUserSecurityProfiles -> UpdateUserSecurityProfiles -> Bool)
-> (UpdateUserSecurityProfiles
    -> UpdateUserSecurityProfiles -> Bool)
-> Eq UpdateUserSecurityProfiles
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUserSecurityProfiles -> UpdateUserSecurityProfiles -> Bool
$c/= :: UpdateUserSecurityProfiles -> UpdateUserSecurityProfiles -> Bool
== :: UpdateUserSecurityProfiles -> UpdateUserSecurityProfiles -> Bool
$c== :: UpdateUserSecurityProfiles -> UpdateUserSecurityProfiles -> Bool
Prelude.Eq, ReadPrec [UpdateUserSecurityProfiles]
ReadPrec UpdateUserSecurityProfiles
Int -> ReadS UpdateUserSecurityProfiles
ReadS [UpdateUserSecurityProfiles]
(Int -> ReadS UpdateUserSecurityProfiles)
-> ReadS [UpdateUserSecurityProfiles]
-> ReadPrec UpdateUserSecurityProfiles
-> ReadPrec [UpdateUserSecurityProfiles]
-> Read UpdateUserSecurityProfiles
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateUserSecurityProfiles]
$creadListPrec :: ReadPrec [UpdateUserSecurityProfiles]
readPrec :: ReadPrec UpdateUserSecurityProfiles
$creadPrec :: ReadPrec UpdateUserSecurityProfiles
readList :: ReadS [UpdateUserSecurityProfiles]
$creadList :: ReadS [UpdateUserSecurityProfiles]
readsPrec :: Int -> ReadS UpdateUserSecurityProfiles
$creadsPrec :: Int -> ReadS UpdateUserSecurityProfiles
Prelude.Read, Int -> UpdateUserSecurityProfiles -> ShowS
[UpdateUserSecurityProfiles] -> ShowS
UpdateUserSecurityProfiles -> String
(Int -> UpdateUserSecurityProfiles -> ShowS)
-> (UpdateUserSecurityProfiles -> String)
-> ([UpdateUserSecurityProfiles] -> ShowS)
-> Show UpdateUserSecurityProfiles
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUserSecurityProfiles] -> ShowS
$cshowList :: [UpdateUserSecurityProfiles] -> ShowS
show :: UpdateUserSecurityProfiles -> String
$cshow :: UpdateUserSecurityProfiles -> String
showsPrec :: Int -> UpdateUserSecurityProfiles -> ShowS
$cshowsPrec :: Int -> UpdateUserSecurityProfiles -> ShowS
Prelude.Show, (forall x.
 UpdateUserSecurityProfiles -> Rep UpdateUserSecurityProfiles x)
-> (forall x.
    Rep UpdateUserSecurityProfiles x -> UpdateUserSecurityProfiles)
-> Generic UpdateUserSecurityProfiles
forall x.
Rep UpdateUserSecurityProfiles x -> UpdateUserSecurityProfiles
forall x.
UpdateUserSecurityProfiles -> Rep UpdateUserSecurityProfiles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateUserSecurityProfiles x -> UpdateUserSecurityProfiles
$cfrom :: forall x.
UpdateUserSecurityProfiles -> Rep UpdateUserSecurityProfiles x
Prelude.Generic)

-- |
-- Create a value of 'UpdateUserSecurityProfiles' 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:
--
-- 'securityProfileIds', 'updateUserSecurityProfiles_securityProfileIds' - The identifiers of the security profiles for the user.
--
-- 'userId', 'updateUserSecurityProfiles_userId' - The identifier of the user account.
--
-- 'instanceId', 'updateUserSecurityProfiles_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
newUpdateUserSecurityProfiles ::
  -- | 'securityProfileIds'
  Prelude.NonEmpty Prelude.Text ->
  -- | 'userId'
  Prelude.Text ->
  -- | 'instanceId'
  Prelude.Text ->
  UpdateUserSecurityProfiles
newUpdateUserSecurityProfiles :: NonEmpty Text -> Text -> Text -> UpdateUserSecurityProfiles
newUpdateUserSecurityProfiles
  NonEmpty Text
pSecurityProfileIds_
  Text
pUserId_
  Text
pInstanceId_ =
    UpdateUserSecurityProfiles' :: NonEmpty Text -> Text -> Text -> UpdateUserSecurityProfiles
UpdateUserSecurityProfiles'
      { $sel:securityProfileIds:UpdateUserSecurityProfiles' :: NonEmpty Text
securityProfileIds =
          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
pSecurityProfileIds_,
        $sel:userId:UpdateUserSecurityProfiles' :: Text
userId = Text
pUserId_,
        $sel:instanceId:UpdateUserSecurityProfiles' :: Text
instanceId = Text
pInstanceId_
      }

-- | The identifiers of the security profiles for the user.
updateUserSecurityProfiles_securityProfileIds :: Lens.Lens' UpdateUserSecurityProfiles (Prelude.NonEmpty Prelude.Text)
updateUserSecurityProfiles_securityProfileIds :: (NonEmpty Text -> f (NonEmpty Text))
-> UpdateUserSecurityProfiles -> f UpdateUserSecurityProfiles
updateUserSecurityProfiles_securityProfileIds = (UpdateUserSecurityProfiles -> NonEmpty Text)
-> (UpdateUserSecurityProfiles
    -> NonEmpty Text -> UpdateUserSecurityProfiles)
-> Lens
     UpdateUserSecurityProfiles
     UpdateUserSecurityProfiles
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserSecurityProfiles' {NonEmpty Text
securityProfileIds :: NonEmpty Text
$sel:securityProfileIds:UpdateUserSecurityProfiles' :: UpdateUserSecurityProfiles -> NonEmpty Text
securityProfileIds} -> NonEmpty Text
securityProfileIds) (\s :: UpdateUserSecurityProfiles
s@UpdateUserSecurityProfiles' {} NonEmpty Text
a -> UpdateUserSecurityProfiles
s {$sel:securityProfileIds:UpdateUserSecurityProfiles' :: NonEmpty Text
securityProfileIds = NonEmpty Text
a} :: UpdateUserSecurityProfiles) ((NonEmpty Text -> f (NonEmpty Text))
 -> UpdateUserSecurityProfiles -> f UpdateUserSecurityProfiles)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> UpdateUserSecurityProfiles
-> f UpdateUserSecurityProfiles
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 identifier of the user account.
updateUserSecurityProfiles_userId :: Lens.Lens' UpdateUserSecurityProfiles Prelude.Text
updateUserSecurityProfiles_userId :: (Text -> f Text)
-> UpdateUserSecurityProfiles -> f UpdateUserSecurityProfiles
updateUserSecurityProfiles_userId = (UpdateUserSecurityProfiles -> Text)
-> (UpdateUserSecurityProfiles
    -> Text -> UpdateUserSecurityProfiles)
-> Lens
     UpdateUserSecurityProfiles UpdateUserSecurityProfiles Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserSecurityProfiles' {Text
userId :: Text
$sel:userId:UpdateUserSecurityProfiles' :: UpdateUserSecurityProfiles -> Text
userId} -> Text
userId) (\s :: UpdateUserSecurityProfiles
s@UpdateUserSecurityProfiles' {} Text
a -> UpdateUserSecurityProfiles
s {$sel:userId:UpdateUserSecurityProfiles' :: Text
userId = Text
a} :: UpdateUserSecurityProfiles)

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
updateUserSecurityProfiles_instanceId :: Lens.Lens' UpdateUserSecurityProfiles Prelude.Text
updateUserSecurityProfiles_instanceId :: (Text -> f Text)
-> UpdateUserSecurityProfiles -> f UpdateUserSecurityProfiles
updateUserSecurityProfiles_instanceId = (UpdateUserSecurityProfiles -> Text)
-> (UpdateUserSecurityProfiles
    -> Text -> UpdateUserSecurityProfiles)
-> Lens
     UpdateUserSecurityProfiles UpdateUserSecurityProfiles Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserSecurityProfiles' {Text
instanceId :: Text
$sel:instanceId:UpdateUserSecurityProfiles' :: UpdateUserSecurityProfiles -> Text
instanceId} -> Text
instanceId) (\s :: UpdateUserSecurityProfiles
s@UpdateUserSecurityProfiles' {} Text
a -> UpdateUserSecurityProfiles
s {$sel:instanceId:UpdateUserSecurityProfiles' :: Text
instanceId = Text
a} :: UpdateUserSecurityProfiles)

instance Core.AWSRequest UpdateUserSecurityProfiles where
  type
    AWSResponse UpdateUserSecurityProfiles =
      UpdateUserSecurityProfilesResponse
  request :: UpdateUserSecurityProfiles -> Request UpdateUserSecurityProfiles
request = Service
-> UpdateUserSecurityProfiles -> Request UpdateUserSecurityProfiles
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateUserSecurityProfiles
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateUserSecurityProfiles)))
response =
    AWSResponse UpdateUserSecurityProfiles
-> Logger
-> Service
-> Proxy UpdateUserSecurityProfiles
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateUserSecurityProfiles)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse UpdateUserSecurityProfiles
UpdateUserSecurityProfilesResponse
UpdateUserSecurityProfilesResponse'

instance Prelude.Hashable UpdateUserSecurityProfiles

instance Prelude.NFData UpdateUserSecurityProfiles

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

instance Core.ToJSON UpdateUserSecurityProfiles where
  toJSON :: UpdateUserSecurityProfiles -> Value
toJSON UpdateUserSecurityProfiles' {NonEmpty Text
Text
instanceId :: Text
userId :: Text
securityProfileIds :: NonEmpty Text
$sel:instanceId:UpdateUserSecurityProfiles' :: UpdateUserSecurityProfiles -> Text
$sel:userId:UpdateUserSecurityProfiles' :: UpdateUserSecurityProfiles -> Text
$sel:securityProfileIds:UpdateUserSecurityProfiles' :: UpdateUserSecurityProfiles -> NonEmpty Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SecurityProfileIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
securityProfileIds)
          ]
      )

instance Core.ToPath UpdateUserSecurityProfiles where
  toPath :: UpdateUserSecurityProfiles -> ByteString
toPath UpdateUserSecurityProfiles' {NonEmpty Text
Text
instanceId :: Text
userId :: Text
securityProfileIds :: NonEmpty Text
$sel:instanceId:UpdateUserSecurityProfiles' :: UpdateUserSecurityProfiles -> Text
$sel:userId:UpdateUserSecurityProfiles' :: UpdateUserSecurityProfiles -> Text
$sel:securityProfileIds:UpdateUserSecurityProfiles' :: UpdateUserSecurityProfiles -> NonEmpty Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/users/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId,
        ByteString
"/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
userId,
        ByteString
"/security-profiles"
      ]

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

-- | /See:/ 'newUpdateUserSecurityProfilesResponse' smart constructor.
data UpdateUserSecurityProfilesResponse = UpdateUserSecurityProfilesResponse'
  {
  }
  deriving (UpdateUserSecurityProfilesResponse
-> UpdateUserSecurityProfilesResponse -> Bool
(UpdateUserSecurityProfilesResponse
 -> UpdateUserSecurityProfilesResponse -> Bool)
-> (UpdateUserSecurityProfilesResponse
    -> UpdateUserSecurityProfilesResponse -> Bool)
-> Eq UpdateUserSecurityProfilesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUserSecurityProfilesResponse
-> UpdateUserSecurityProfilesResponse -> Bool
$c/= :: UpdateUserSecurityProfilesResponse
-> UpdateUserSecurityProfilesResponse -> Bool
== :: UpdateUserSecurityProfilesResponse
-> UpdateUserSecurityProfilesResponse -> Bool
$c== :: UpdateUserSecurityProfilesResponse
-> UpdateUserSecurityProfilesResponse -> Bool
Prelude.Eq, ReadPrec [UpdateUserSecurityProfilesResponse]
ReadPrec UpdateUserSecurityProfilesResponse
Int -> ReadS UpdateUserSecurityProfilesResponse
ReadS [UpdateUserSecurityProfilesResponse]
(Int -> ReadS UpdateUserSecurityProfilesResponse)
-> ReadS [UpdateUserSecurityProfilesResponse]
-> ReadPrec UpdateUserSecurityProfilesResponse
-> ReadPrec [UpdateUserSecurityProfilesResponse]
-> Read UpdateUserSecurityProfilesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateUserSecurityProfilesResponse]
$creadListPrec :: ReadPrec [UpdateUserSecurityProfilesResponse]
readPrec :: ReadPrec UpdateUserSecurityProfilesResponse
$creadPrec :: ReadPrec UpdateUserSecurityProfilesResponse
readList :: ReadS [UpdateUserSecurityProfilesResponse]
$creadList :: ReadS [UpdateUserSecurityProfilesResponse]
readsPrec :: Int -> ReadS UpdateUserSecurityProfilesResponse
$creadsPrec :: Int -> ReadS UpdateUserSecurityProfilesResponse
Prelude.Read, Int -> UpdateUserSecurityProfilesResponse -> ShowS
[UpdateUserSecurityProfilesResponse] -> ShowS
UpdateUserSecurityProfilesResponse -> String
(Int -> UpdateUserSecurityProfilesResponse -> ShowS)
-> (UpdateUserSecurityProfilesResponse -> String)
-> ([UpdateUserSecurityProfilesResponse] -> ShowS)
-> Show UpdateUserSecurityProfilesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUserSecurityProfilesResponse] -> ShowS
$cshowList :: [UpdateUserSecurityProfilesResponse] -> ShowS
show :: UpdateUserSecurityProfilesResponse -> String
$cshow :: UpdateUserSecurityProfilesResponse -> String
showsPrec :: Int -> UpdateUserSecurityProfilesResponse -> ShowS
$cshowsPrec :: Int -> UpdateUserSecurityProfilesResponse -> ShowS
Prelude.Show, (forall x.
 UpdateUserSecurityProfilesResponse
 -> Rep UpdateUserSecurityProfilesResponse x)
-> (forall x.
    Rep UpdateUserSecurityProfilesResponse x
    -> UpdateUserSecurityProfilesResponse)
-> Generic UpdateUserSecurityProfilesResponse
forall x.
Rep UpdateUserSecurityProfilesResponse x
-> UpdateUserSecurityProfilesResponse
forall x.
UpdateUserSecurityProfilesResponse
-> Rep UpdateUserSecurityProfilesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateUserSecurityProfilesResponse x
-> UpdateUserSecurityProfilesResponse
$cfrom :: forall x.
UpdateUserSecurityProfilesResponse
-> Rep UpdateUserSecurityProfilesResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateUserSecurityProfilesResponse' 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.
newUpdateUserSecurityProfilesResponse ::
  UpdateUserSecurityProfilesResponse
newUpdateUserSecurityProfilesResponse :: UpdateUserSecurityProfilesResponse
newUpdateUserSecurityProfilesResponse =
  UpdateUserSecurityProfilesResponse
UpdateUserSecurityProfilesResponse'

instance
  Prelude.NFData
    UpdateUserSecurityProfilesResponse