{-# 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.RedshiftServerLess.GetCredentials
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a database user name and temporary password with temporary
-- authorization to log in to Amazon Redshift Serverless.
--
-- By default, the temporary credentials expire in 900 seconds. You can
-- optionally specify a duration between 900 seconds (15 minutes) and 3600
-- seconds (60 minutes).
--
-- >  <p>The Identity and Access Management (IAM) user or role that runs GetCredentials must have an IAM policy attached that allows access to all necessary actions and resources.</p> <p>If the <code>DbName</code> parameter is specified, the IAM policy must allow access to the resource dbname for the specified database name.</p>
module Amazonka.RedshiftServerLess.GetCredentials
  ( -- * Creating a Request
    GetCredentials (..),
    newGetCredentials,

    -- * Request Lenses
    getCredentials_dbName,
    getCredentials_durationSeconds,
    getCredentials_workgroupName,

    -- * Destructuring the Response
    GetCredentialsResponse (..),
    newGetCredentialsResponse,

    -- * Response Lenses
    getCredentialsResponse_dbPassword,
    getCredentialsResponse_dbUser,
    getCredentialsResponse_expiration,
    getCredentialsResponse_nextRefreshTime,
    getCredentialsResponse_httpStatus,
  )
where

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 Amazonka.RedshiftServerLess.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetCredentials' smart constructor.
data GetCredentials = GetCredentials'
  { -- | The name of the database to get temporary authorization to log on to.
    --
    -- Constraints:
    --
    -- -   Must be 1 to 64 alphanumeric characters or hyphens.
    --
    -- -   Must contain only uppercase or lowercase letters, numbers,
    --     underscore, plus sign, period (dot), at symbol (\@), or hyphen.
    --
    -- -   The first character must be a letter.
    --
    -- -   Must not contain a colon ( : ) or slash ( \/ ).
    --
    -- -   Cannot be a reserved word. A list of reserved words can be found in
    --     <https://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html Reserved Words>
    --     in the Amazon Redshift Database Developer Guide
    GetCredentials -> Maybe Text
dbName :: Prelude.Maybe Prelude.Text,
    -- | The number of seconds until the returned temporary password expires. The
    -- minimum is 900 seconds, and the maximum is 3600 seconds.
    GetCredentials -> Maybe Int
durationSeconds :: Prelude.Maybe Prelude.Int,
    -- | The name of the workgroup associated with the database.
    GetCredentials -> Text
workgroupName :: Prelude.Text
  }
  deriving (GetCredentials -> GetCredentials -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCredentials -> GetCredentials -> Bool
$c/= :: GetCredentials -> GetCredentials -> Bool
== :: GetCredentials -> GetCredentials -> Bool
$c== :: GetCredentials -> GetCredentials -> Bool
Prelude.Eq, ReadPrec [GetCredentials]
ReadPrec GetCredentials
Int -> ReadS GetCredentials
ReadS [GetCredentials]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCredentials]
$creadListPrec :: ReadPrec [GetCredentials]
readPrec :: ReadPrec GetCredentials
$creadPrec :: ReadPrec GetCredentials
readList :: ReadS [GetCredentials]
$creadList :: ReadS [GetCredentials]
readsPrec :: Int -> ReadS GetCredentials
$creadsPrec :: Int -> ReadS GetCredentials
Prelude.Read, Int -> GetCredentials -> ShowS
[GetCredentials] -> ShowS
GetCredentials -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCredentials] -> ShowS
$cshowList :: [GetCredentials] -> ShowS
show :: GetCredentials -> String
$cshow :: GetCredentials -> String
showsPrec :: Int -> GetCredentials -> ShowS
$cshowsPrec :: Int -> GetCredentials -> ShowS
Prelude.Show, forall x. Rep GetCredentials x -> GetCredentials
forall x. GetCredentials -> Rep GetCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCredentials x -> GetCredentials
$cfrom :: forall x. GetCredentials -> Rep GetCredentials x
Prelude.Generic)

-- |
-- Create a value of 'GetCredentials' 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:
--
-- 'dbName', 'getCredentials_dbName' - The name of the database to get temporary authorization to log on to.
--
-- Constraints:
--
-- -   Must be 1 to 64 alphanumeric characters or hyphens.
--
-- -   Must contain only uppercase or lowercase letters, numbers,
--     underscore, plus sign, period (dot), at symbol (\@), or hyphen.
--
-- -   The first character must be a letter.
--
-- -   Must not contain a colon ( : ) or slash ( \/ ).
--
-- -   Cannot be a reserved word. A list of reserved words can be found in
--     <https://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html Reserved Words>
--     in the Amazon Redshift Database Developer Guide
--
-- 'durationSeconds', 'getCredentials_durationSeconds' - The number of seconds until the returned temporary password expires. The
-- minimum is 900 seconds, and the maximum is 3600 seconds.
--
-- 'workgroupName', 'getCredentials_workgroupName' - The name of the workgroup associated with the database.
newGetCredentials ::
  -- | 'workgroupName'
  Prelude.Text ->
  GetCredentials
newGetCredentials :: Text -> GetCredentials
newGetCredentials Text
pWorkgroupName_ =
  GetCredentials'
    { $sel:dbName:GetCredentials' :: Maybe Text
dbName = forall a. Maybe a
Prelude.Nothing,
      $sel:durationSeconds:GetCredentials' :: Maybe Int
durationSeconds = forall a. Maybe a
Prelude.Nothing,
      $sel:workgroupName:GetCredentials' :: Text
workgroupName = Text
pWorkgroupName_
    }

-- | The name of the database to get temporary authorization to log on to.
--
-- Constraints:
--
-- -   Must be 1 to 64 alphanumeric characters or hyphens.
--
-- -   Must contain only uppercase or lowercase letters, numbers,
--     underscore, plus sign, period (dot), at symbol (\@), or hyphen.
--
-- -   The first character must be a letter.
--
-- -   Must not contain a colon ( : ) or slash ( \/ ).
--
-- -   Cannot be a reserved word. A list of reserved words can be found in
--     <https://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html Reserved Words>
--     in the Amazon Redshift Database Developer Guide
getCredentials_dbName :: Lens.Lens' GetCredentials (Prelude.Maybe Prelude.Text)
getCredentials_dbName :: Lens' GetCredentials (Maybe Text)
getCredentials_dbName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCredentials' {Maybe Text
dbName :: Maybe Text
$sel:dbName:GetCredentials' :: GetCredentials -> Maybe Text
dbName} -> Maybe Text
dbName) (\s :: GetCredentials
s@GetCredentials' {} Maybe Text
a -> GetCredentials
s {$sel:dbName:GetCredentials' :: Maybe Text
dbName = Maybe Text
a} :: GetCredentials)

-- | The number of seconds until the returned temporary password expires. The
-- minimum is 900 seconds, and the maximum is 3600 seconds.
getCredentials_durationSeconds :: Lens.Lens' GetCredentials (Prelude.Maybe Prelude.Int)
getCredentials_durationSeconds :: Lens' GetCredentials (Maybe Int)
getCredentials_durationSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCredentials' {Maybe Int
durationSeconds :: Maybe Int
$sel:durationSeconds:GetCredentials' :: GetCredentials -> Maybe Int
durationSeconds} -> Maybe Int
durationSeconds) (\s :: GetCredentials
s@GetCredentials' {} Maybe Int
a -> GetCredentials
s {$sel:durationSeconds:GetCredentials' :: Maybe Int
durationSeconds = Maybe Int
a} :: GetCredentials)

-- | The name of the workgroup associated with the database.
getCredentials_workgroupName :: Lens.Lens' GetCredentials Prelude.Text
getCredentials_workgroupName :: Lens' GetCredentials Text
getCredentials_workgroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCredentials' {Text
workgroupName :: Text
$sel:workgroupName:GetCredentials' :: GetCredentials -> Text
workgroupName} -> Text
workgroupName) (\s :: GetCredentials
s@GetCredentials' {} Text
a -> GetCredentials
s {$sel:workgroupName:GetCredentials' :: Text
workgroupName = Text
a} :: GetCredentials)

instance Core.AWSRequest GetCredentials where
  type
    AWSResponse GetCredentials =
      GetCredentialsResponse
  request :: (Service -> Service) -> GetCredentials -> Request GetCredentials
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 GetCredentials
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCredentials)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe POSIX
-> Int
-> GetCredentialsResponse
GetCredentialsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"dbPassword")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"dbUser")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"expiration")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextRefreshTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetCredentials where
  hashWithSalt :: Int -> GetCredentials -> Int
hashWithSalt Int
_salt GetCredentials' {Maybe Int
Maybe Text
Text
workgroupName :: Text
durationSeconds :: Maybe Int
dbName :: Maybe Text
$sel:workgroupName:GetCredentials' :: GetCredentials -> Text
$sel:durationSeconds:GetCredentials' :: GetCredentials -> Maybe Int
$sel:dbName:GetCredentials' :: GetCredentials -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dbName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
durationSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workgroupName

instance Prelude.NFData GetCredentials where
  rnf :: GetCredentials -> ()
rnf GetCredentials' {Maybe Int
Maybe Text
Text
workgroupName :: Text
durationSeconds :: Maybe Int
dbName :: Maybe Text
$sel:workgroupName:GetCredentials' :: GetCredentials -> Text
$sel:durationSeconds:GetCredentials' :: GetCredentials -> Maybe Int
$sel:dbName:GetCredentials' :: GetCredentials -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dbName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
durationSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workgroupName

instance Data.ToHeaders GetCredentials where
  toHeaders :: GetCredentials -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"RedshiftServerless.GetCredentials" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetCredentials where
  toJSON :: GetCredentials -> Value
toJSON GetCredentials' {Maybe Int
Maybe Text
Text
workgroupName :: Text
durationSeconds :: Maybe Int
dbName :: Maybe Text
$sel:workgroupName:GetCredentials' :: GetCredentials -> Text
$sel:durationSeconds:GetCredentials' :: GetCredentials -> Maybe Int
$sel:dbName:GetCredentials' :: GetCredentials -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"dbName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
dbName,
            (Key
"durationSeconds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
durationSeconds,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"workgroupName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
workgroupName)
          ]
      )

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

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

-- | /See:/ 'newGetCredentialsResponse' smart constructor.
data GetCredentialsResponse = GetCredentialsResponse'
  { -- | A temporary password that authorizes the user name returned by @DbUser@
    -- to log on to the database @DbName@.
    GetCredentialsResponse -> Maybe (Sensitive Text)
dbPassword :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | A database user name that is authorized to log on to the database
    -- @DbName@ using the password @DbPassword@. If the specified @DbUser@
    -- exists in the database, the new user name has the same database
    -- privileges as the the user named in @DbUser@. By default, the user is
    -- added to PUBLIC.
    GetCredentialsResponse -> Maybe (Sensitive Text)
dbUser :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The date and time the password in @DbPassword@ expires.
    GetCredentialsResponse -> Maybe POSIX
expiration :: Prelude.Maybe Data.POSIX,
    -- | The date and time of when the @DbUser@ and @DbPassword@ authorization
    -- refreshes.
    GetCredentialsResponse -> Maybe POSIX
nextRefreshTime :: Prelude.Maybe Data.POSIX,
    -- | The response's http status code.
    GetCredentialsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetCredentialsResponse -> GetCredentialsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCredentialsResponse -> GetCredentialsResponse -> Bool
$c/= :: GetCredentialsResponse -> GetCredentialsResponse -> Bool
== :: GetCredentialsResponse -> GetCredentialsResponse -> Bool
$c== :: GetCredentialsResponse -> GetCredentialsResponse -> Bool
Prelude.Eq, Int -> GetCredentialsResponse -> ShowS
[GetCredentialsResponse] -> ShowS
GetCredentialsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCredentialsResponse] -> ShowS
$cshowList :: [GetCredentialsResponse] -> ShowS
show :: GetCredentialsResponse -> String
$cshow :: GetCredentialsResponse -> String
showsPrec :: Int -> GetCredentialsResponse -> ShowS
$cshowsPrec :: Int -> GetCredentialsResponse -> ShowS
Prelude.Show, forall x. Rep GetCredentialsResponse x -> GetCredentialsResponse
forall x. GetCredentialsResponse -> Rep GetCredentialsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCredentialsResponse x -> GetCredentialsResponse
$cfrom :: forall x. GetCredentialsResponse -> Rep GetCredentialsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetCredentialsResponse' 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:
--
-- 'dbPassword', 'getCredentialsResponse_dbPassword' - A temporary password that authorizes the user name returned by @DbUser@
-- to log on to the database @DbName@.
--
-- 'dbUser', 'getCredentialsResponse_dbUser' - A database user name that is authorized to log on to the database
-- @DbName@ using the password @DbPassword@. If the specified @DbUser@
-- exists in the database, the new user name has the same database
-- privileges as the the user named in @DbUser@. By default, the user is
-- added to PUBLIC.
--
-- 'expiration', 'getCredentialsResponse_expiration' - The date and time the password in @DbPassword@ expires.
--
-- 'nextRefreshTime', 'getCredentialsResponse_nextRefreshTime' - The date and time of when the @DbUser@ and @DbPassword@ authorization
-- refreshes.
--
-- 'httpStatus', 'getCredentialsResponse_httpStatus' - The response's http status code.
newGetCredentialsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetCredentialsResponse
newGetCredentialsResponse :: Int -> GetCredentialsResponse
newGetCredentialsResponse Int
pHttpStatus_ =
  GetCredentialsResponse'
    { $sel:dbPassword:GetCredentialsResponse' :: Maybe (Sensitive Text)
dbPassword =
        forall a. Maybe a
Prelude.Nothing,
      $sel:dbUser:GetCredentialsResponse' :: Maybe (Sensitive Text)
dbUser = forall a. Maybe a
Prelude.Nothing,
      $sel:expiration:GetCredentialsResponse' :: Maybe POSIX
expiration = forall a. Maybe a
Prelude.Nothing,
      $sel:nextRefreshTime:GetCredentialsResponse' :: Maybe POSIX
nextRefreshTime = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetCredentialsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A temporary password that authorizes the user name returned by @DbUser@
-- to log on to the database @DbName@.
getCredentialsResponse_dbPassword :: Lens.Lens' GetCredentialsResponse (Prelude.Maybe Prelude.Text)
getCredentialsResponse_dbPassword :: Lens' GetCredentialsResponse (Maybe Text)
getCredentialsResponse_dbPassword = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCredentialsResponse' {Maybe (Sensitive Text)
dbPassword :: Maybe (Sensitive Text)
$sel:dbPassword:GetCredentialsResponse' :: GetCredentialsResponse -> Maybe (Sensitive Text)
dbPassword} -> Maybe (Sensitive Text)
dbPassword) (\s :: GetCredentialsResponse
s@GetCredentialsResponse' {} Maybe (Sensitive Text)
a -> GetCredentialsResponse
s {$sel:dbPassword:GetCredentialsResponse' :: Maybe (Sensitive Text)
dbPassword = Maybe (Sensitive Text)
a} :: GetCredentialsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | A database user name that is authorized to log on to the database
-- @DbName@ using the password @DbPassword@. If the specified @DbUser@
-- exists in the database, the new user name has the same database
-- privileges as the the user named in @DbUser@. By default, the user is
-- added to PUBLIC.
getCredentialsResponse_dbUser :: Lens.Lens' GetCredentialsResponse (Prelude.Maybe Prelude.Text)
getCredentialsResponse_dbUser :: Lens' GetCredentialsResponse (Maybe Text)
getCredentialsResponse_dbUser = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCredentialsResponse' {Maybe (Sensitive Text)
dbUser :: Maybe (Sensitive Text)
$sel:dbUser:GetCredentialsResponse' :: GetCredentialsResponse -> Maybe (Sensitive Text)
dbUser} -> Maybe (Sensitive Text)
dbUser) (\s :: GetCredentialsResponse
s@GetCredentialsResponse' {} Maybe (Sensitive Text)
a -> GetCredentialsResponse
s {$sel:dbUser:GetCredentialsResponse' :: Maybe (Sensitive Text)
dbUser = Maybe (Sensitive Text)
a} :: GetCredentialsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The date and time the password in @DbPassword@ expires.
getCredentialsResponse_expiration :: Lens.Lens' GetCredentialsResponse (Prelude.Maybe Prelude.UTCTime)
getCredentialsResponse_expiration :: Lens' GetCredentialsResponse (Maybe UTCTime)
getCredentialsResponse_expiration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCredentialsResponse' {Maybe POSIX
expiration :: Maybe POSIX
$sel:expiration:GetCredentialsResponse' :: GetCredentialsResponse -> Maybe POSIX
expiration} -> Maybe POSIX
expiration) (\s :: GetCredentialsResponse
s@GetCredentialsResponse' {} Maybe POSIX
a -> GetCredentialsResponse
s {$sel:expiration:GetCredentialsResponse' :: Maybe POSIX
expiration = Maybe POSIX
a} :: GetCredentialsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The date and time of when the @DbUser@ and @DbPassword@ authorization
-- refreshes.
getCredentialsResponse_nextRefreshTime :: Lens.Lens' GetCredentialsResponse (Prelude.Maybe Prelude.UTCTime)
getCredentialsResponse_nextRefreshTime :: Lens' GetCredentialsResponse (Maybe UTCTime)
getCredentialsResponse_nextRefreshTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCredentialsResponse' {Maybe POSIX
nextRefreshTime :: Maybe POSIX
$sel:nextRefreshTime:GetCredentialsResponse' :: GetCredentialsResponse -> Maybe POSIX
nextRefreshTime} -> Maybe POSIX
nextRefreshTime) (\s :: GetCredentialsResponse
s@GetCredentialsResponse' {} Maybe POSIX
a -> GetCredentialsResponse
s {$sel:nextRefreshTime:GetCredentialsResponse' :: Maybe POSIX
nextRefreshTime = Maybe POSIX
a} :: GetCredentialsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

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

instance Prelude.NFData GetCredentialsResponse where
  rnf :: GetCredentialsResponse -> ()
rnf GetCredentialsResponse' {Int
Maybe (Sensitive Text)
Maybe POSIX
httpStatus :: Int
nextRefreshTime :: Maybe POSIX
expiration :: Maybe POSIX
dbUser :: Maybe (Sensitive Text)
dbPassword :: Maybe (Sensitive Text)
$sel:httpStatus:GetCredentialsResponse' :: GetCredentialsResponse -> Int
$sel:nextRefreshTime:GetCredentialsResponse' :: GetCredentialsResponse -> Maybe POSIX
$sel:expiration:GetCredentialsResponse' :: GetCredentialsResponse -> Maybe POSIX
$sel:dbUser:GetCredentialsResponse' :: GetCredentialsResponse -> Maybe (Sensitive Text)
$sel:dbPassword:GetCredentialsResponse' :: GetCredentialsResponse -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
dbPassword
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
dbUser
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
expiration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
nextRefreshTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus