{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
      { $sel:securityProfileIds:UpdateUserSecurityProfiles' :: NonEmpty Text
securityProfileIds =
          forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced 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 :: Lens' UpdateUserSecurityProfiles (NonEmpty Text)
updateUserSecurityProfiles_securityProfileIds = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 :: Lens' UpdateUserSecurityProfiles Text
updateUserSecurityProfiles_userId = 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 :: Lens' UpdateUserSecurityProfiles Text
updateUserSecurityProfiles_instanceId = 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 :: (Service -> Service)
-> UpdateUserSecurityProfiles -> Request UpdateUserSecurityProfiles
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateUserSecurityProfiles
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateUserSecurityProfiles)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      UpdateUserSecurityProfilesResponse
UpdateUserSecurityProfilesResponse'

instance Prelude.Hashable UpdateUserSecurityProfiles where
  hashWithSalt :: Int -> UpdateUserSecurityProfiles -> Int
hashWithSalt Int
_salt 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
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
securityProfileIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId

instance Prelude.NFData UpdateUserSecurityProfiles where
  rnf :: UpdateUserSecurityProfiles -> ()
rnf 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
..} =
    forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
securityProfileIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
userId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId

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

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"SecurityProfileIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
securityProfileIds)
          ]
      )

instance Data.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
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/users/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId,
        ByteString
"/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
userId,
        ByteString
"/security-profiles"
      ]

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

-- | /See:/ 'newUpdateUserSecurityProfilesResponse' smart constructor.
data UpdateUserSecurityProfilesResponse = UpdateUserSecurityProfilesResponse'
  {
  }
  deriving (UpdateUserSecurityProfilesResponse
-> UpdateUserSecurityProfilesResponse -> Bool
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]
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
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.
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
  where
  rnf :: UpdateUserSecurityProfilesResponse -> ()
rnf UpdateUserSecurityProfilesResponse
_ = ()