{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.ServiceSpecificCredentialMetadata
-- 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)
module Amazonka.IAM.Types.ServiceSpecificCredentialMetadata where

import qualified Amazonka.Core as Core
import Amazonka.IAM.Types.StatusType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains additional details about a service-specific credential.
--
-- /See:/ 'newServiceSpecificCredentialMetadata' smart constructor.
data ServiceSpecificCredentialMetadata = ServiceSpecificCredentialMetadata'
  { -- | The name of the IAM user associated with the service-specific
    -- credential.
    ServiceSpecificCredentialMetadata -> Text
userName :: Prelude.Text,
    -- | The status of the service-specific credential. @Active@ means that the
    -- key is valid for API calls, while @Inactive@ means it is not.
    ServiceSpecificCredentialMetadata -> StatusType
status :: StatusType,
    -- | The generated user name for the service-specific credential.
    ServiceSpecificCredentialMetadata -> Text
serviceUserName :: Prelude.Text,
    -- | The date and time, in
    -- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
    -- service-specific credential were created.
    ServiceSpecificCredentialMetadata -> ISO8601
createDate :: Core.ISO8601,
    -- | The unique identifier for the service-specific credential.
    ServiceSpecificCredentialMetadata -> Text
serviceSpecificCredentialId :: Prelude.Text,
    -- | The name of the service associated with the service-specific credential.
    ServiceSpecificCredentialMetadata -> Text
serviceName :: Prelude.Text
  }
  deriving (ServiceSpecificCredentialMetadata
-> ServiceSpecificCredentialMetadata -> Bool
(ServiceSpecificCredentialMetadata
 -> ServiceSpecificCredentialMetadata -> Bool)
-> (ServiceSpecificCredentialMetadata
    -> ServiceSpecificCredentialMetadata -> Bool)
-> Eq ServiceSpecificCredentialMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceSpecificCredentialMetadata
-> ServiceSpecificCredentialMetadata -> Bool
$c/= :: ServiceSpecificCredentialMetadata
-> ServiceSpecificCredentialMetadata -> Bool
== :: ServiceSpecificCredentialMetadata
-> ServiceSpecificCredentialMetadata -> Bool
$c== :: ServiceSpecificCredentialMetadata
-> ServiceSpecificCredentialMetadata -> Bool
Prelude.Eq, ReadPrec [ServiceSpecificCredentialMetadata]
ReadPrec ServiceSpecificCredentialMetadata
Int -> ReadS ServiceSpecificCredentialMetadata
ReadS [ServiceSpecificCredentialMetadata]
(Int -> ReadS ServiceSpecificCredentialMetadata)
-> ReadS [ServiceSpecificCredentialMetadata]
-> ReadPrec ServiceSpecificCredentialMetadata
-> ReadPrec [ServiceSpecificCredentialMetadata]
-> Read ServiceSpecificCredentialMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceSpecificCredentialMetadata]
$creadListPrec :: ReadPrec [ServiceSpecificCredentialMetadata]
readPrec :: ReadPrec ServiceSpecificCredentialMetadata
$creadPrec :: ReadPrec ServiceSpecificCredentialMetadata
readList :: ReadS [ServiceSpecificCredentialMetadata]
$creadList :: ReadS [ServiceSpecificCredentialMetadata]
readsPrec :: Int -> ReadS ServiceSpecificCredentialMetadata
$creadsPrec :: Int -> ReadS ServiceSpecificCredentialMetadata
Prelude.Read, Int -> ServiceSpecificCredentialMetadata -> ShowS
[ServiceSpecificCredentialMetadata] -> ShowS
ServiceSpecificCredentialMetadata -> String
(Int -> ServiceSpecificCredentialMetadata -> ShowS)
-> (ServiceSpecificCredentialMetadata -> String)
-> ([ServiceSpecificCredentialMetadata] -> ShowS)
-> Show ServiceSpecificCredentialMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceSpecificCredentialMetadata] -> ShowS
$cshowList :: [ServiceSpecificCredentialMetadata] -> ShowS
show :: ServiceSpecificCredentialMetadata -> String
$cshow :: ServiceSpecificCredentialMetadata -> String
showsPrec :: Int -> ServiceSpecificCredentialMetadata -> ShowS
$cshowsPrec :: Int -> ServiceSpecificCredentialMetadata -> ShowS
Prelude.Show, (forall x.
 ServiceSpecificCredentialMetadata
 -> Rep ServiceSpecificCredentialMetadata x)
-> (forall x.
    Rep ServiceSpecificCredentialMetadata x
    -> ServiceSpecificCredentialMetadata)
-> Generic ServiceSpecificCredentialMetadata
forall x.
Rep ServiceSpecificCredentialMetadata x
-> ServiceSpecificCredentialMetadata
forall x.
ServiceSpecificCredentialMetadata
-> Rep ServiceSpecificCredentialMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ServiceSpecificCredentialMetadata x
-> ServiceSpecificCredentialMetadata
$cfrom :: forall x.
ServiceSpecificCredentialMetadata
-> Rep ServiceSpecificCredentialMetadata x
Prelude.Generic)

-- |
-- Create a value of 'ServiceSpecificCredentialMetadata' 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', 'serviceSpecificCredentialMetadata_userName' - The name of the IAM user associated with the service-specific
-- credential.
--
-- 'status', 'serviceSpecificCredentialMetadata_status' - The status of the service-specific credential. @Active@ means that the
-- key is valid for API calls, while @Inactive@ means it is not.
--
-- 'serviceUserName', 'serviceSpecificCredentialMetadata_serviceUserName' - The generated user name for the service-specific credential.
--
-- 'createDate', 'serviceSpecificCredentialMetadata_createDate' - The date and time, in
-- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
-- service-specific credential were created.
--
-- 'serviceSpecificCredentialId', 'serviceSpecificCredentialMetadata_serviceSpecificCredentialId' - The unique identifier for the service-specific credential.
--
-- 'serviceName', 'serviceSpecificCredentialMetadata_serviceName' - The name of the service associated with the service-specific credential.
newServiceSpecificCredentialMetadata ::
  -- | 'userName'
  Prelude.Text ->
  -- | 'status'
  StatusType ->
  -- | 'serviceUserName'
  Prelude.Text ->
  -- | 'createDate'
  Prelude.UTCTime ->
  -- | 'serviceSpecificCredentialId'
  Prelude.Text ->
  -- | 'serviceName'
  Prelude.Text ->
  ServiceSpecificCredentialMetadata
newServiceSpecificCredentialMetadata :: Text
-> StatusType
-> Text
-> UTCTime
-> Text
-> Text
-> ServiceSpecificCredentialMetadata
newServiceSpecificCredentialMetadata
  Text
pUserName_
  StatusType
pStatus_
  Text
pServiceUserName_
  UTCTime
pCreateDate_
  Text
pServiceSpecificCredentialId_
  Text
pServiceName_ =
    ServiceSpecificCredentialMetadata' :: Text
-> StatusType
-> Text
-> ISO8601
-> Text
-> Text
-> ServiceSpecificCredentialMetadata
ServiceSpecificCredentialMetadata'
      { $sel:userName:ServiceSpecificCredentialMetadata' :: Text
userName =
          Text
pUserName_,
        $sel:status:ServiceSpecificCredentialMetadata' :: StatusType
status = StatusType
pStatus_,
        $sel:serviceUserName:ServiceSpecificCredentialMetadata' :: Text
serviceUserName = Text
pServiceUserName_,
        $sel:createDate:ServiceSpecificCredentialMetadata' :: ISO8601
createDate =
          Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreateDate_,
        $sel:serviceSpecificCredentialId:ServiceSpecificCredentialMetadata' :: Text
serviceSpecificCredentialId =
          Text
pServiceSpecificCredentialId_,
        $sel:serviceName:ServiceSpecificCredentialMetadata' :: Text
serviceName = Text
pServiceName_
      }

-- | The name of the IAM user associated with the service-specific
-- credential.
serviceSpecificCredentialMetadata_userName :: Lens.Lens' ServiceSpecificCredentialMetadata Prelude.Text
serviceSpecificCredentialMetadata_userName :: (Text -> f Text)
-> ServiceSpecificCredentialMetadata
-> f ServiceSpecificCredentialMetadata
serviceSpecificCredentialMetadata_userName = (ServiceSpecificCredentialMetadata -> Text)
-> (ServiceSpecificCredentialMetadata
    -> Text -> ServiceSpecificCredentialMetadata)
-> Lens
     ServiceSpecificCredentialMetadata
     ServiceSpecificCredentialMetadata
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSpecificCredentialMetadata' {Text
userName :: Text
$sel:userName:ServiceSpecificCredentialMetadata' :: ServiceSpecificCredentialMetadata -> Text
userName} -> Text
userName) (\s :: ServiceSpecificCredentialMetadata
s@ServiceSpecificCredentialMetadata' {} Text
a -> ServiceSpecificCredentialMetadata
s {$sel:userName:ServiceSpecificCredentialMetadata' :: Text
userName = Text
a} :: ServiceSpecificCredentialMetadata)

-- | The status of the service-specific credential. @Active@ means that the
-- key is valid for API calls, while @Inactive@ means it is not.
serviceSpecificCredentialMetadata_status :: Lens.Lens' ServiceSpecificCredentialMetadata StatusType
serviceSpecificCredentialMetadata_status :: (StatusType -> f StatusType)
-> ServiceSpecificCredentialMetadata
-> f ServiceSpecificCredentialMetadata
serviceSpecificCredentialMetadata_status = (ServiceSpecificCredentialMetadata -> StatusType)
-> (ServiceSpecificCredentialMetadata
    -> StatusType -> ServiceSpecificCredentialMetadata)
-> Lens
     ServiceSpecificCredentialMetadata
     ServiceSpecificCredentialMetadata
     StatusType
     StatusType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSpecificCredentialMetadata' {StatusType
status :: StatusType
$sel:status:ServiceSpecificCredentialMetadata' :: ServiceSpecificCredentialMetadata -> StatusType
status} -> StatusType
status) (\s :: ServiceSpecificCredentialMetadata
s@ServiceSpecificCredentialMetadata' {} StatusType
a -> ServiceSpecificCredentialMetadata
s {$sel:status:ServiceSpecificCredentialMetadata' :: StatusType
status = StatusType
a} :: ServiceSpecificCredentialMetadata)

-- | The generated user name for the service-specific credential.
serviceSpecificCredentialMetadata_serviceUserName :: Lens.Lens' ServiceSpecificCredentialMetadata Prelude.Text
serviceSpecificCredentialMetadata_serviceUserName :: (Text -> f Text)
-> ServiceSpecificCredentialMetadata
-> f ServiceSpecificCredentialMetadata
serviceSpecificCredentialMetadata_serviceUserName = (ServiceSpecificCredentialMetadata -> Text)
-> (ServiceSpecificCredentialMetadata
    -> Text -> ServiceSpecificCredentialMetadata)
-> Lens
     ServiceSpecificCredentialMetadata
     ServiceSpecificCredentialMetadata
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSpecificCredentialMetadata' {Text
serviceUserName :: Text
$sel:serviceUserName:ServiceSpecificCredentialMetadata' :: ServiceSpecificCredentialMetadata -> Text
serviceUserName} -> Text
serviceUserName) (\s :: ServiceSpecificCredentialMetadata
s@ServiceSpecificCredentialMetadata' {} Text
a -> ServiceSpecificCredentialMetadata
s {$sel:serviceUserName:ServiceSpecificCredentialMetadata' :: Text
serviceUserName = Text
a} :: ServiceSpecificCredentialMetadata)

-- | The date and time, in
-- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
-- service-specific credential were created.
serviceSpecificCredentialMetadata_createDate :: Lens.Lens' ServiceSpecificCredentialMetadata Prelude.UTCTime
serviceSpecificCredentialMetadata_createDate :: (UTCTime -> f UTCTime)
-> ServiceSpecificCredentialMetadata
-> f ServiceSpecificCredentialMetadata
serviceSpecificCredentialMetadata_createDate = (ServiceSpecificCredentialMetadata -> ISO8601)
-> (ServiceSpecificCredentialMetadata
    -> ISO8601 -> ServiceSpecificCredentialMetadata)
-> Lens
     ServiceSpecificCredentialMetadata
     ServiceSpecificCredentialMetadata
     ISO8601
     ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSpecificCredentialMetadata' {ISO8601
createDate :: ISO8601
$sel:createDate:ServiceSpecificCredentialMetadata' :: ServiceSpecificCredentialMetadata -> ISO8601
createDate} -> ISO8601
createDate) (\s :: ServiceSpecificCredentialMetadata
s@ServiceSpecificCredentialMetadata' {} ISO8601
a -> ServiceSpecificCredentialMetadata
s {$sel:createDate:ServiceSpecificCredentialMetadata' :: ISO8601
createDate = ISO8601
a} :: ServiceSpecificCredentialMetadata) ((ISO8601 -> f ISO8601)
 -> ServiceSpecificCredentialMetadata
 -> f ServiceSpecificCredentialMetadata)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> ServiceSpecificCredentialMetadata
-> f ServiceSpecificCredentialMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The unique identifier for the service-specific credential.
serviceSpecificCredentialMetadata_serviceSpecificCredentialId :: Lens.Lens' ServiceSpecificCredentialMetadata Prelude.Text
serviceSpecificCredentialMetadata_serviceSpecificCredentialId :: (Text -> f Text)
-> ServiceSpecificCredentialMetadata
-> f ServiceSpecificCredentialMetadata
serviceSpecificCredentialMetadata_serviceSpecificCredentialId = (ServiceSpecificCredentialMetadata -> Text)
-> (ServiceSpecificCredentialMetadata
    -> Text -> ServiceSpecificCredentialMetadata)
-> Lens
     ServiceSpecificCredentialMetadata
     ServiceSpecificCredentialMetadata
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSpecificCredentialMetadata' {Text
serviceSpecificCredentialId :: Text
$sel:serviceSpecificCredentialId:ServiceSpecificCredentialMetadata' :: ServiceSpecificCredentialMetadata -> Text
serviceSpecificCredentialId} -> Text
serviceSpecificCredentialId) (\s :: ServiceSpecificCredentialMetadata
s@ServiceSpecificCredentialMetadata' {} Text
a -> ServiceSpecificCredentialMetadata
s {$sel:serviceSpecificCredentialId:ServiceSpecificCredentialMetadata' :: Text
serviceSpecificCredentialId = Text
a} :: ServiceSpecificCredentialMetadata)

-- | The name of the service associated with the service-specific credential.
serviceSpecificCredentialMetadata_serviceName :: Lens.Lens' ServiceSpecificCredentialMetadata Prelude.Text
serviceSpecificCredentialMetadata_serviceName :: (Text -> f Text)
-> ServiceSpecificCredentialMetadata
-> f ServiceSpecificCredentialMetadata
serviceSpecificCredentialMetadata_serviceName = (ServiceSpecificCredentialMetadata -> Text)
-> (ServiceSpecificCredentialMetadata
    -> Text -> ServiceSpecificCredentialMetadata)
-> Lens
     ServiceSpecificCredentialMetadata
     ServiceSpecificCredentialMetadata
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSpecificCredentialMetadata' {Text
serviceName :: Text
$sel:serviceName:ServiceSpecificCredentialMetadata' :: ServiceSpecificCredentialMetadata -> Text
serviceName} -> Text
serviceName) (\s :: ServiceSpecificCredentialMetadata
s@ServiceSpecificCredentialMetadata' {} Text
a -> ServiceSpecificCredentialMetadata
s {$sel:serviceName:ServiceSpecificCredentialMetadata' :: Text
serviceName = Text
a} :: ServiceSpecificCredentialMetadata)

instance
  Core.FromXML
    ServiceSpecificCredentialMetadata
  where
  parseXML :: [Node] -> Either String ServiceSpecificCredentialMetadata
parseXML [Node]
x =
    Text
-> StatusType
-> Text
-> ISO8601
-> Text
-> Text
-> ServiceSpecificCredentialMetadata
ServiceSpecificCredentialMetadata'
      (Text
 -> StatusType
 -> Text
 -> ISO8601
 -> Text
 -> Text
 -> ServiceSpecificCredentialMetadata)
-> Either String Text
-> Either
     String
     (StatusType
      -> Text
      -> ISO8601
      -> Text
      -> Text
      -> ServiceSpecificCredentialMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"UserName")
      Either
  String
  (StatusType
   -> Text
   -> ISO8601
   -> Text
   -> Text
   -> ServiceSpecificCredentialMetadata)
-> Either String StatusType
-> Either
     String
     (Text
      -> ISO8601 -> Text -> Text -> ServiceSpecificCredentialMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String StatusType
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Status")
      Either
  String
  (Text
   -> ISO8601 -> Text -> Text -> ServiceSpecificCredentialMetadata)
-> Either String Text
-> Either
     String
     (ISO8601 -> Text -> Text -> ServiceSpecificCredentialMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ServiceUserName")
      Either
  String
  (ISO8601 -> Text -> Text -> ServiceSpecificCredentialMetadata)
-> Either String ISO8601
-> Either
     String (Text -> Text -> ServiceSpecificCredentialMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ISO8601
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"CreateDate")
      Either String (Text -> Text -> ServiceSpecificCredentialMetadata)
-> Either String Text
-> Either String (Text -> ServiceSpecificCredentialMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ServiceSpecificCredentialId")
      Either String (Text -> ServiceSpecificCredentialMetadata)
-> Either String Text
-> Either String ServiceSpecificCredentialMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ServiceName")

instance
  Prelude.Hashable
    ServiceSpecificCredentialMetadata

instance
  Prelude.NFData
    ServiceSpecificCredentialMetadata