{-# 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.CodeArtifact.GetAuthorizationToken
-- 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)
--
-- Generates a temporary authorization token for accessing repositories in
-- the domain. This API requires the @codeartifact:GetAuthorizationToken@
-- and @sts:GetServiceBearerToken@ permissions. For more information about
-- authorization tokens, see
-- <https://docs.aws.amazon.com/codeartifact/latest/ug/tokens-authentication.html AWS CodeArtifact authentication and tokens>.
--
-- CodeArtifact authorization tokens are valid for a period of 12 hours
-- when created with the @login@ command. You can call @login@ periodically
-- to refresh the token. When you create an authorization token with the
-- @GetAuthorizationToken@ API, you can set a custom authorization period,
-- up to a maximum of 12 hours, with the @durationSeconds@ parameter.
--
-- The authorization period begins after @login@ or @GetAuthorizationToken@
-- is called. If @login@ or @GetAuthorizationToken@ is called while
-- assuming a role, the token lifetime is independent of the maximum
-- session duration of the role. For example, if you call @sts assume-role@
-- and specify a session duration of 15 minutes, then generate a
-- CodeArtifact authorization token, the token will be valid for the full
-- authorization period even though this is longer than the 15-minute
-- session duration.
--
-- See
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html Using IAM Roles>
-- for more information on controlling session duration.
module Amazonka.CodeArtifact.GetAuthorizationToken
  ( -- * Creating a Request
    GetAuthorizationToken (..),
    newGetAuthorizationToken,

    -- * Request Lenses
    getAuthorizationToken_domainOwner,
    getAuthorizationToken_durationSeconds,
    getAuthorizationToken_domain,

    -- * Destructuring the Response
    GetAuthorizationTokenResponse (..),
    newGetAuthorizationTokenResponse,

    -- * Response Lenses
    getAuthorizationTokenResponse_expiration,
    getAuthorizationTokenResponse_authorizationToken,
    getAuthorizationTokenResponse_httpStatus,
  )
where

import Amazonka.CodeArtifact.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:/ 'newGetAuthorizationToken' smart constructor.
data GetAuthorizationToken = GetAuthorizationToken'
  { -- | The 12-digit account number of the AWS account that owns the domain. It
    -- does not include dashes or spaces.
    GetAuthorizationToken -> Maybe Text
domainOwner :: Prelude.Maybe Prelude.Text,
    -- | The time, in seconds, that the generated authorization token is valid.
    -- Valid values are @0@ and any number between @900@ (15 minutes) and
    -- @43200@ (12 hours). A value of @0@ will set the expiration of the
    -- authorization token to the same expiration of the user\'s role\'s
    -- temporary credentials.
    GetAuthorizationToken -> Maybe Natural
durationSeconds :: Prelude.Maybe Prelude.Natural,
    -- | The name of the domain that is in scope for the generated authorization
    -- token.
    GetAuthorizationToken -> Text
domain :: Prelude.Text
  }
  deriving (GetAuthorizationToken -> GetAuthorizationToken -> Bool
(GetAuthorizationToken -> GetAuthorizationToken -> Bool)
-> (GetAuthorizationToken -> GetAuthorizationToken -> Bool)
-> Eq GetAuthorizationToken
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAuthorizationToken -> GetAuthorizationToken -> Bool
$c/= :: GetAuthorizationToken -> GetAuthorizationToken -> Bool
== :: GetAuthorizationToken -> GetAuthorizationToken -> Bool
$c== :: GetAuthorizationToken -> GetAuthorizationToken -> Bool
Prelude.Eq, ReadPrec [GetAuthorizationToken]
ReadPrec GetAuthorizationToken
Int -> ReadS GetAuthorizationToken
ReadS [GetAuthorizationToken]
(Int -> ReadS GetAuthorizationToken)
-> ReadS [GetAuthorizationToken]
-> ReadPrec GetAuthorizationToken
-> ReadPrec [GetAuthorizationToken]
-> Read GetAuthorizationToken
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAuthorizationToken]
$creadListPrec :: ReadPrec [GetAuthorizationToken]
readPrec :: ReadPrec GetAuthorizationToken
$creadPrec :: ReadPrec GetAuthorizationToken
readList :: ReadS [GetAuthorizationToken]
$creadList :: ReadS [GetAuthorizationToken]
readsPrec :: Int -> ReadS GetAuthorizationToken
$creadsPrec :: Int -> ReadS GetAuthorizationToken
Prelude.Read, Int -> GetAuthorizationToken -> ShowS
[GetAuthorizationToken] -> ShowS
GetAuthorizationToken -> String
(Int -> GetAuthorizationToken -> ShowS)
-> (GetAuthorizationToken -> String)
-> ([GetAuthorizationToken] -> ShowS)
-> Show GetAuthorizationToken
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAuthorizationToken] -> ShowS
$cshowList :: [GetAuthorizationToken] -> ShowS
show :: GetAuthorizationToken -> String
$cshow :: GetAuthorizationToken -> String
showsPrec :: Int -> GetAuthorizationToken -> ShowS
$cshowsPrec :: Int -> GetAuthorizationToken -> ShowS
Prelude.Show, (forall x. GetAuthorizationToken -> Rep GetAuthorizationToken x)
-> (forall x. Rep GetAuthorizationToken x -> GetAuthorizationToken)
-> Generic GetAuthorizationToken
forall x. Rep GetAuthorizationToken x -> GetAuthorizationToken
forall x. GetAuthorizationToken -> Rep GetAuthorizationToken x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAuthorizationToken x -> GetAuthorizationToken
$cfrom :: forall x. GetAuthorizationToken -> Rep GetAuthorizationToken x
Prelude.Generic)

-- |
-- Create a value of 'GetAuthorizationToken' 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:
--
-- 'domainOwner', 'getAuthorizationToken_domainOwner' - The 12-digit account number of the AWS account that owns the domain. It
-- does not include dashes or spaces.
--
-- 'durationSeconds', 'getAuthorizationToken_durationSeconds' - The time, in seconds, that the generated authorization token is valid.
-- Valid values are @0@ and any number between @900@ (15 minutes) and
-- @43200@ (12 hours). A value of @0@ will set the expiration of the
-- authorization token to the same expiration of the user\'s role\'s
-- temporary credentials.
--
-- 'domain', 'getAuthorizationToken_domain' - The name of the domain that is in scope for the generated authorization
-- token.
newGetAuthorizationToken ::
  -- | 'domain'
  Prelude.Text ->
  GetAuthorizationToken
newGetAuthorizationToken :: Text -> GetAuthorizationToken
newGetAuthorizationToken Text
pDomain_ =
  GetAuthorizationToken' :: Maybe Text -> Maybe Natural -> Text -> GetAuthorizationToken
GetAuthorizationToken'
    { $sel:domainOwner:GetAuthorizationToken' :: Maybe Text
domainOwner =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:durationSeconds:GetAuthorizationToken' :: Maybe Natural
durationSeconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:domain:GetAuthorizationToken' :: Text
domain = Text
pDomain_
    }

-- | The 12-digit account number of the AWS account that owns the domain. It
-- does not include dashes or spaces.
getAuthorizationToken_domainOwner :: Lens.Lens' GetAuthorizationToken (Prelude.Maybe Prelude.Text)
getAuthorizationToken_domainOwner :: (Maybe Text -> f (Maybe Text))
-> GetAuthorizationToken -> f GetAuthorizationToken
getAuthorizationToken_domainOwner = (GetAuthorizationToken -> Maybe Text)
-> (GetAuthorizationToken -> Maybe Text -> GetAuthorizationToken)
-> Lens
     GetAuthorizationToken
     GetAuthorizationToken
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAuthorizationToken' {Maybe Text
domainOwner :: Maybe Text
$sel:domainOwner:GetAuthorizationToken' :: GetAuthorizationToken -> Maybe Text
domainOwner} -> Maybe Text
domainOwner) (\s :: GetAuthorizationToken
s@GetAuthorizationToken' {} Maybe Text
a -> GetAuthorizationToken
s {$sel:domainOwner:GetAuthorizationToken' :: Maybe Text
domainOwner = Maybe Text
a} :: GetAuthorizationToken)

-- | The time, in seconds, that the generated authorization token is valid.
-- Valid values are @0@ and any number between @900@ (15 minutes) and
-- @43200@ (12 hours). A value of @0@ will set the expiration of the
-- authorization token to the same expiration of the user\'s role\'s
-- temporary credentials.
getAuthorizationToken_durationSeconds :: Lens.Lens' GetAuthorizationToken (Prelude.Maybe Prelude.Natural)
getAuthorizationToken_durationSeconds :: (Maybe Natural -> f (Maybe Natural))
-> GetAuthorizationToken -> f GetAuthorizationToken
getAuthorizationToken_durationSeconds = (GetAuthorizationToken -> Maybe Natural)
-> (GetAuthorizationToken
    -> Maybe Natural -> GetAuthorizationToken)
-> Lens
     GetAuthorizationToken
     GetAuthorizationToken
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAuthorizationToken' {Maybe Natural
durationSeconds :: Maybe Natural
$sel:durationSeconds:GetAuthorizationToken' :: GetAuthorizationToken -> Maybe Natural
durationSeconds} -> Maybe Natural
durationSeconds) (\s :: GetAuthorizationToken
s@GetAuthorizationToken' {} Maybe Natural
a -> GetAuthorizationToken
s {$sel:durationSeconds:GetAuthorizationToken' :: Maybe Natural
durationSeconds = Maybe Natural
a} :: GetAuthorizationToken)

-- | The name of the domain that is in scope for the generated authorization
-- token.
getAuthorizationToken_domain :: Lens.Lens' GetAuthorizationToken Prelude.Text
getAuthorizationToken_domain :: (Text -> f Text)
-> GetAuthorizationToken -> f GetAuthorizationToken
getAuthorizationToken_domain = (GetAuthorizationToken -> Text)
-> (GetAuthorizationToken -> Text -> GetAuthorizationToken)
-> Lens GetAuthorizationToken GetAuthorizationToken Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAuthorizationToken' {Text
domain :: Text
$sel:domain:GetAuthorizationToken' :: GetAuthorizationToken -> Text
domain} -> Text
domain) (\s :: GetAuthorizationToken
s@GetAuthorizationToken' {} Text
a -> GetAuthorizationToken
s {$sel:domain:GetAuthorizationToken' :: Text
domain = Text
a} :: GetAuthorizationToken)

instance Core.AWSRequest GetAuthorizationToken where
  type
    AWSResponse GetAuthorizationToken =
      GetAuthorizationTokenResponse
  request :: GetAuthorizationToken -> Request GetAuthorizationToken
request = Service -> GetAuthorizationToken -> Request GetAuthorizationToken
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetAuthorizationToken
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetAuthorizationToken)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetAuthorizationToken))
-> Logger
-> Service
-> Proxy GetAuthorizationToken
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetAuthorizationToken)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe POSIX -> Maybe Text -> Int -> GetAuthorizationTokenResponse
GetAuthorizationTokenResponse'
            (Maybe POSIX -> Maybe Text -> Int -> GetAuthorizationTokenResponse)
-> Either String (Maybe POSIX)
-> Either
     String (Maybe Text -> Int -> GetAuthorizationTokenResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"expiration")
            Either String (Maybe Text -> Int -> GetAuthorizationTokenResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetAuthorizationTokenResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"authorizationToken")
            Either String (Int -> GetAuthorizationTokenResponse)
-> Either String Int -> Either String GetAuthorizationTokenResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetAuthorizationToken

instance Prelude.NFData GetAuthorizationToken

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

instance Core.ToJSON GetAuthorizationToken where
  toJSON :: GetAuthorizationToken -> Value
toJSON = Value -> GetAuthorizationToken -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

instance Core.ToPath GetAuthorizationToken where
  toPath :: GetAuthorizationToken -> ByteString
toPath = ByteString -> GetAuthorizationToken -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/authorization-token"

instance Core.ToQuery GetAuthorizationToken where
  toQuery :: GetAuthorizationToken -> QueryString
toQuery GetAuthorizationToken' {Maybe Natural
Maybe Text
Text
domain :: Text
durationSeconds :: Maybe Natural
domainOwner :: Maybe Text
$sel:domain:GetAuthorizationToken' :: GetAuthorizationToken -> Text
$sel:durationSeconds:GetAuthorizationToken' :: GetAuthorizationToken -> Maybe Natural
$sel:domainOwner:GetAuthorizationToken' :: GetAuthorizationToken -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"domain-owner" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
domainOwner,
        ByteString
"duration" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
durationSeconds,
        ByteString
"domain" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
domain
      ]

-- | /See:/ 'newGetAuthorizationTokenResponse' smart constructor.
data GetAuthorizationTokenResponse = GetAuthorizationTokenResponse'
  { -- | A timestamp that specifies the date and time the authorization token
    -- expires.
    GetAuthorizationTokenResponse -> Maybe POSIX
expiration :: Prelude.Maybe Core.POSIX,
    -- | The returned authentication token.
    GetAuthorizationTokenResponse -> Maybe Text
authorizationToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetAuthorizationTokenResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetAuthorizationTokenResponse
-> GetAuthorizationTokenResponse -> Bool
(GetAuthorizationTokenResponse
 -> GetAuthorizationTokenResponse -> Bool)
-> (GetAuthorizationTokenResponse
    -> GetAuthorizationTokenResponse -> Bool)
-> Eq GetAuthorizationTokenResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAuthorizationTokenResponse
-> GetAuthorizationTokenResponse -> Bool
$c/= :: GetAuthorizationTokenResponse
-> GetAuthorizationTokenResponse -> Bool
== :: GetAuthorizationTokenResponse
-> GetAuthorizationTokenResponse -> Bool
$c== :: GetAuthorizationTokenResponse
-> GetAuthorizationTokenResponse -> Bool
Prelude.Eq, ReadPrec [GetAuthorizationTokenResponse]
ReadPrec GetAuthorizationTokenResponse
Int -> ReadS GetAuthorizationTokenResponse
ReadS [GetAuthorizationTokenResponse]
(Int -> ReadS GetAuthorizationTokenResponse)
-> ReadS [GetAuthorizationTokenResponse]
-> ReadPrec GetAuthorizationTokenResponse
-> ReadPrec [GetAuthorizationTokenResponse]
-> Read GetAuthorizationTokenResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAuthorizationTokenResponse]
$creadListPrec :: ReadPrec [GetAuthorizationTokenResponse]
readPrec :: ReadPrec GetAuthorizationTokenResponse
$creadPrec :: ReadPrec GetAuthorizationTokenResponse
readList :: ReadS [GetAuthorizationTokenResponse]
$creadList :: ReadS [GetAuthorizationTokenResponse]
readsPrec :: Int -> ReadS GetAuthorizationTokenResponse
$creadsPrec :: Int -> ReadS GetAuthorizationTokenResponse
Prelude.Read, Int -> GetAuthorizationTokenResponse -> ShowS
[GetAuthorizationTokenResponse] -> ShowS
GetAuthorizationTokenResponse -> String
(Int -> GetAuthorizationTokenResponse -> ShowS)
-> (GetAuthorizationTokenResponse -> String)
-> ([GetAuthorizationTokenResponse] -> ShowS)
-> Show GetAuthorizationTokenResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAuthorizationTokenResponse] -> ShowS
$cshowList :: [GetAuthorizationTokenResponse] -> ShowS
show :: GetAuthorizationTokenResponse -> String
$cshow :: GetAuthorizationTokenResponse -> String
showsPrec :: Int -> GetAuthorizationTokenResponse -> ShowS
$cshowsPrec :: Int -> GetAuthorizationTokenResponse -> ShowS
Prelude.Show, (forall x.
 GetAuthorizationTokenResponse
 -> Rep GetAuthorizationTokenResponse x)
-> (forall x.
    Rep GetAuthorizationTokenResponse x
    -> GetAuthorizationTokenResponse)
-> Generic GetAuthorizationTokenResponse
forall x.
Rep GetAuthorizationTokenResponse x
-> GetAuthorizationTokenResponse
forall x.
GetAuthorizationTokenResponse
-> Rep GetAuthorizationTokenResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAuthorizationTokenResponse x
-> GetAuthorizationTokenResponse
$cfrom :: forall x.
GetAuthorizationTokenResponse
-> Rep GetAuthorizationTokenResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetAuthorizationTokenResponse' 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:
--
-- 'expiration', 'getAuthorizationTokenResponse_expiration' - A timestamp that specifies the date and time the authorization token
-- expires.
--
-- 'authorizationToken', 'getAuthorizationTokenResponse_authorizationToken' - The returned authentication token.
--
-- 'httpStatus', 'getAuthorizationTokenResponse_httpStatus' - The response's http status code.
newGetAuthorizationTokenResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAuthorizationTokenResponse
newGetAuthorizationTokenResponse :: Int -> GetAuthorizationTokenResponse
newGetAuthorizationTokenResponse Int
pHttpStatus_ =
  GetAuthorizationTokenResponse' :: Maybe POSIX -> Maybe Text -> Int -> GetAuthorizationTokenResponse
GetAuthorizationTokenResponse'
    { $sel:expiration:GetAuthorizationTokenResponse' :: Maybe POSIX
expiration =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:authorizationToken:GetAuthorizationTokenResponse' :: Maybe Text
authorizationToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetAuthorizationTokenResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A timestamp that specifies the date and time the authorization token
-- expires.
getAuthorizationTokenResponse_expiration :: Lens.Lens' GetAuthorizationTokenResponse (Prelude.Maybe Prelude.UTCTime)
getAuthorizationTokenResponse_expiration :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetAuthorizationTokenResponse -> f GetAuthorizationTokenResponse
getAuthorizationTokenResponse_expiration = (GetAuthorizationTokenResponse -> Maybe POSIX)
-> (GetAuthorizationTokenResponse
    -> Maybe POSIX -> GetAuthorizationTokenResponse)
-> Lens
     GetAuthorizationTokenResponse
     GetAuthorizationTokenResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAuthorizationTokenResponse' {Maybe POSIX
expiration :: Maybe POSIX
$sel:expiration:GetAuthorizationTokenResponse' :: GetAuthorizationTokenResponse -> Maybe POSIX
expiration} -> Maybe POSIX
expiration) (\s :: GetAuthorizationTokenResponse
s@GetAuthorizationTokenResponse' {} Maybe POSIX
a -> GetAuthorizationTokenResponse
s {$sel:expiration:GetAuthorizationTokenResponse' :: Maybe POSIX
expiration = Maybe POSIX
a} :: GetAuthorizationTokenResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetAuthorizationTokenResponse
 -> f GetAuthorizationTokenResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetAuthorizationTokenResponse
-> f GetAuthorizationTokenResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The returned authentication token.
getAuthorizationTokenResponse_authorizationToken :: Lens.Lens' GetAuthorizationTokenResponse (Prelude.Maybe Prelude.Text)
getAuthorizationTokenResponse_authorizationToken :: (Maybe Text -> f (Maybe Text))
-> GetAuthorizationTokenResponse -> f GetAuthorizationTokenResponse
getAuthorizationTokenResponse_authorizationToken = (GetAuthorizationTokenResponse -> Maybe Text)
-> (GetAuthorizationTokenResponse
    -> Maybe Text -> GetAuthorizationTokenResponse)
-> Lens
     GetAuthorizationTokenResponse
     GetAuthorizationTokenResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAuthorizationTokenResponse' {Maybe Text
authorizationToken :: Maybe Text
$sel:authorizationToken:GetAuthorizationTokenResponse' :: GetAuthorizationTokenResponse -> Maybe Text
authorizationToken} -> Maybe Text
authorizationToken) (\s :: GetAuthorizationTokenResponse
s@GetAuthorizationTokenResponse' {} Maybe Text
a -> GetAuthorizationTokenResponse
s {$sel:authorizationToken:GetAuthorizationTokenResponse' :: Maybe Text
authorizationToken = Maybe Text
a} :: GetAuthorizationTokenResponse)

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

instance Prelude.NFData GetAuthorizationTokenResponse