{-# 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.IAM.UpdateServiceSpecificCredential
-- 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)
--
-- Sets the status of a service-specific credential to @Active@ or
-- @Inactive@. Service-specific credentials that are inactive cannot be
-- used for authentication to the service. This operation can be used to
-- disable a user\'s service-specific credential as part of a credential
-- rotation work flow.
module Amazonka.IAM.UpdateServiceSpecificCredential
  ( -- * Creating a Request
    UpdateServiceSpecificCredential (..),
    newUpdateServiceSpecificCredential,

    -- * Request Lenses
    updateServiceSpecificCredential_userName,
    updateServiceSpecificCredential_serviceSpecificCredentialId,
    updateServiceSpecificCredential_status,

    -- * Destructuring the Response
    UpdateServiceSpecificCredentialResponse (..),
    newUpdateServiceSpecificCredentialResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IAM.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:/ 'newUpdateServiceSpecificCredential' smart constructor.
data UpdateServiceSpecificCredential = UpdateServiceSpecificCredential'
  { -- | The name of the IAM user associated with the service-specific
    -- credential. If you do not specify this value, then the operation assumes
    -- the user whose credentials are used to call the operation.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- consisting of upper and lowercase alphanumeric characters with no
    -- spaces. You can also include any of the following characters: _+=,.\@-
    UpdateServiceSpecificCredential -> Maybe Text
userName :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the service-specific credential.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- that can consist of any upper or lowercased letter or digit.
    UpdateServiceSpecificCredential -> Text
serviceSpecificCredentialId :: Prelude.Text,
    -- | The status to be assigned to the service-specific credential.
    UpdateServiceSpecificCredential -> StatusType
status :: StatusType
  }
  deriving (UpdateServiceSpecificCredential
-> UpdateServiceSpecificCredential -> Bool
(UpdateServiceSpecificCredential
 -> UpdateServiceSpecificCredential -> Bool)
-> (UpdateServiceSpecificCredential
    -> UpdateServiceSpecificCredential -> Bool)
-> Eq UpdateServiceSpecificCredential
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateServiceSpecificCredential
-> UpdateServiceSpecificCredential -> Bool
$c/= :: UpdateServiceSpecificCredential
-> UpdateServiceSpecificCredential -> Bool
== :: UpdateServiceSpecificCredential
-> UpdateServiceSpecificCredential -> Bool
$c== :: UpdateServiceSpecificCredential
-> UpdateServiceSpecificCredential -> Bool
Prelude.Eq, ReadPrec [UpdateServiceSpecificCredential]
ReadPrec UpdateServiceSpecificCredential
Int -> ReadS UpdateServiceSpecificCredential
ReadS [UpdateServiceSpecificCredential]
(Int -> ReadS UpdateServiceSpecificCredential)
-> ReadS [UpdateServiceSpecificCredential]
-> ReadPrec UpdateServiceSpecificCredential
-> ReadPrec [UpdateServiceSpecificCredential]
-> Read UpdateServiceSpecificCredential
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateServiceSpecificCredential]
$creadListPrec :: ReadPrec [UpdateServiceSpecificCredential]
readPrec :: ReadPrec UpdateServiceSpecificCredential
$creadPrec :: ReadPrec UpdateServiceSpecificCredential
readList :: ReadS [UpdateServiceSpecificCredential]
$creadList :: ReadS [UpdateServiceSpecificCredential]
readsPrec :: Int -> ReadS UpdateServiceSpecificCredential
$creadsPrec :: Int -> ReadS UpdateServiceSpecificCredential
Prelude.Read, Int -> UpdateServiceSpecificCredential -> ShowS
[UpdateServiceSpecificCredential] -> ShowS
UpdateServiceSpecificCredential -> String
(Int -> UpdateServiceSpecificCredential -> ShowS)
-> (UpdateServiceSpecificCredential -> String)
-> ([UpdateServiceSpecificCredential] -> ShowS)
-> Show UpdateServiceSpecificCredential
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateServiceSpecificCredential] -> ShowS
$cshowList :: [UpdateServiceSpecificCredential] -> ShowS
show :: UpdateServiceSpecificCredential -> String
$cshow :: UpdateServiceSpecificCredential -> String
showsPrec :: Int -> UpdateServiceSpecificCredential -> ShowS
$cshowsPrec :: Int -> UpdateServiceSpecificCredential -> ShowS
Prelude.Show, (forall x.
 UpdateServiceSpecificCredential
 -> Rep UpdateServiceSpecificCredential x)
-> (forall x.
    Rep UpdateServiceSpecificCredential x
    -> UpdateServiceSpecificCredential)
-> Generic UpdateServiceSpecificCredential
forall x.
Rep UpdateServiceSpecificCredential x
-> UpdateServiceSpecificCredential
forall x.
UpdateServiceSpecificCredential
-> Rep UpdateServiceSpecificCredential x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateServiceSpecificCredential x
-> UpdateServiceSpecificCredential
$cfrom :: forall x.
UpdateServiceSpecificCredential
-> Rep UpdateServiceSpecificCredential x
Prelude.Generic)

-- |
-- Create a value of 'UpdateServiceSpecificCredential' 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:
--
-- 'userName', 'updateServiceSpecificCredential_userName' - The name of the IAM user associated with the service-specific
-- credential. If you do not specify this value, then the operation assumes
-- the user whose credentials are used to call the operation.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
--
-- 'serviceSpecificCredentialId', 'updateServiceSpecificCredential_serviceSpecificCredentialId' - The unique identifier of the service-specific credential.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- that can consist of any upper or lowercased letter or digit.
--
-- 'status', 'updateServiceSpecificCredential_status' - The status to be assigned to the service-specific credential.
newUpdateServiceSpecificCredential ::
  -- | 'serviceSpecificCredentialId'
  Prelude.Text ->
  -- | 'status'
  StatusType ->
  UpdateServiceSpecificCredential
newUpdateServiceSpecificCredential :: Text -> StatusType -> UpdateServiceSpecificCredential
newUpdateServiceSpecificCredential
  Text
pServiceSpecificCredentialId_
  StatusType
pStatus_ =
    UpdateServiceSpecificCredential' :: Maybe Text -> Text -> StatusType -> UpdateServiceSpecificCredential
UpdateServiceSpecificCredential'
      { $sel:userName:UpdateServiceSpecificCredential' :: Maybe Text
userName =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:serviceSpecificCredentialId:UpdateServiceSpecificCredential' :: Text
serviceSpecificCredentialId =
          Text
pServiceSpecificCredentialId_,
        $sel:status:UpdateServiceSpecificCredential' :: StatusType
status = StatusType
pStatus_
      }

-- | The name of the IAM user associated with the service-specific
-- credential. If you do not specify this value, then the operation assumes
-- the user whose credentials are used to call the operation.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
updateServiceSpecificCredential_userName :: Lens.Lens' UpdateServiceSpecificCredential (Prelude.Maybe Prelude.Text)
updateServiceSpecificCredential_userName :: (Maybe Text -> f (Maybe Text))
-> UpdateServiceSpecificCredential
-> f UpdateServiceSpecificCredential
updateServiceSpecificCredential_userName = (UpdateServiceSpecificCredential -> Maybe Text)
-> (UpdateServiceSpecificCredential
    -> Maybe Text -> UpdateServiceSpecificCredential)
-> Lens
     UpdateServiceSpecificCredential
     UpdateServiceSpecificCredential
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceSpecificCredential' {Maybe Text
userName :: Maybe Text
$sel:userName:UpdateServiceSpecificCredential' :: UpdateServiceSpecificCredential -> Maybe Text
userName} -> Maybe Text
userName) (\s :: UpdateServiceSpecificCredential
s@UpdateServiceSpecificCredential' {} Maybe Text
a -> UpdateServiceSpecificCredential
s {$sel:userName:UpdateServiceSpecificCredential' :: Maybe Text
userName = Maybe Text
a} :: UpdateServiceSpecificCredential)

-- | The unique identifier of the service-specific credential.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- that can consist of any upper or lowercased letter or digit.
updateServiceSpecificCredential_serviceSpecificCredentialId :: Lens.Lens' UpdateServiceSpecificCredential Prelude.Text
updateServiceSpecificCredential_serviceSpecificCredentialId :: (Text -> f Text)
-> UpdateServiceSpecificCredential
-> f UpdateServiceSpecificCredential
updateServiceSpecificCredential_serviceSpecificCredentialId = (UpdateServiceSpecificCredential -> Text)
-> (UpdateServiceSpecificCredential
    -> Text -> UpdateServiceSpecificCredential)
-> Lens
     UpdateServiceSpecificCredential
     UpdateServiceSpecificCredential
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceSpecificCredential' {Text
serviceSpecificCredentialId :: Text
$sel:serviceSpecificCredentialId:UpdateServiceSpecificCredential' :: UpdateServiceSpecificCredential -> Text
serviceSpecificCredentialId} -> Text
serviceSpecificCredentialId) (\s :: UpdateServiceSpecificCredential
s@UpdateServiceSpecificCredential' {} Text
a -> UpdateServiceSpecificCredential
s {$sel:serviceSpecificCredentialId:UpdateServiceSpecificCredential' :: Text
serviceSpecificCredentialId = Text
a} :: UpdateServiceSpecificCredential)

-- | The status to be assigned to the service-specific credential.
updateServiceSpecificCredential_status :: Lens.Lens' UpdateServiceSpecificCredential StatusType
updateServiceSpecificCredential_status :: (StatusType -> f StatusType)
-> UpdateServiceSpecificCredential
-> f UpdateServiceSpecificCredential
updateServiceSpecificCredential_status = (UpdateServiceSpecificCredential -> StatusType)
-> (UpdateServiceSpecificCredential
    -> StatusType -> UpdateServiceSpecificCredential)
-> Lens
     UpdateServiceSpecificCredential
     UpdateServiceSpecificCredential
     StatusType
     StatusType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceSpecificCredential' {StatusType
status :: StatusType
$sel:status:UpdateServiceSpecificCredential' :: UpdateServiceSpecificCredential -> StatusType
status} -> StatusType
status) (\s :: UpdateServiceSpecificCredential
s@UpdateServiceSpecificCredential' {} StatusType
a -> UpdateServiceSpecificCredential
s {$sel:status:UpdateServiceSpecificCredential' :: StatusType
status = StatusType
a} :: UpdateServiceSpecificCredential)

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

instance
  Prelude.Hashable
    UpdateServiceSpecificCredential

instance
  Prelude.NFData
    UpdateServiceSpecificCredential

instance
  Core.ToHeaders
    UpdateServiceSpecificCredential
  where
  toHeaders :: UpdateServiceSpecificCredential -> [Header]
toHeaders = [Header] -> UpdateServiceSpecificCredential -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery UpdateServiceSpecificCredential where
  toQuery :: UpdateServiceSpecificCredential -> QueryString
toQuery UpdateServiceSpecificCredential' {Maybe Text
Text
StatusType
status :: StatusType
serviceSpecificCredentialId :: Text
userName :: Maybe Text
$sel:status:UpdateServiceSpecificCredential' :: UpdateServiceSpecificCredential -> StatusType
$sel:serviceSpecificCredentialId:UpdateServiceSpecificCredential' :: UpdateServiceSpecificCredential -> Text
$sel:userName:UpdateServiceSpecificCredential' :: UpdateServiceSpecificCredential -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"UpdateServiceSpecificCredential" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"UserName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
userName,
        ByteString
"ServiceSpecificCredentialId"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
serviceSpecificCredentialId,
        ByteString
"Status" ByteString -> StatusType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: StatusType
status
      ]

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

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

instance
  Prelude.NFData
    UpdateServiceSpecificCredentialResponse