{-# 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.SSOOIDC.StartDeviceAuthorization
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Initiates device authorization by requesting a pair of verification
-- codes from the authorization service.
module Amazonka.SSOOIDC.StartDeviceAuthorization
  ( -- * Creating a Request
    StartDeviceAuthorization (..),
    newStartDeviceAuthorization,

    -- * Request Lenses
    startDeviceAuthorization_clientId,
    startDeviceAuthorization_clientSecret,
    startDeviceAuthorization_startUrl,

    -- * Destructuring the Response
    StartDeviceAuthorizationResponse (..),
    newStartDeviceAuthorizationResponse,

    -- * Response Lenses
    startDeviceAuthorizationResponse_deviceCode,
    startDeviceAuthorizationResponse_expiresIn,
    startDeviceAuthorizationResponse_interval,
    startDeviceAuthorizationResponse_userCode,
    startDeviceAuthorizationResponse_verificationUri,
    startDeviceAuthorizationResponse_verificationUriComplete,
    startDeviceAuthorizationResponse_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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SSOOIDC.Types

-- | /See:/ 'newStartDeviceAuthorization' smart constructor.
data StartDeviceAuthorization = StartDeviceAuthorization'
  { -- | The unique identifier string for the client that is registered with IAM
    -- Identity Center. This value should come from the persisted result of the
    -- RegisterClient API operation.
    StartDeviceAuthorization -> Text
clientId :: Prelude.Text,
    -- | A secret string that is generated for the client. This value should come
    -- from the persisted result of the RegisterClient API operation.
    StartDeviceAuthorization -> Text
clientSecret :: Prelude.Text,
    -- | The URL for the AWS access portal. For more information, see
    -- <https://docs.aws.amazon.com/singlesignon/latest/userguide/using-the-portal.html Using the AWS access portal>
    -- in the /IAM Identity Center User Guide/.
    StartDeviceAuthorization -> Text
startUrl :: Prelude.Text
  }
  deriving (StartDeviceAuthorization -> StartDeviceAuthorization -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDeviceAuthorization -> StartDeviceAuthorization -> Bool
$c/= :: StartDeviceAuthorization -> StartDeviceAuthorization -> Bool
== :: StartDeviceAuthorization -> StartDeviceAuthorization -> Bool
$c== :: StartDeviceAuthorization -> StartDeviceAuthorization -> Bool
Prelude.Eq, ReadPrec [StartDeviceAuthorization]
ReadPrec StartDeviceAuthorization
Int -> ReadS StartDeviceAuthorization
ReadS [StartDeviceAuthorization]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDeviceAuthorization]
$creadListPrec :: ReadPrec [StartDeviceAuthorization]
readPrec :: ReadPrec StartDeviceAuthorization
$creadPrec :: ReadPrec StartDeviceAuthorization
readList :: ReadS [StartDeviceAuthorization]
$creadList :: ReadS [StartDeviceAuthorization]
readsPrec :: Int -> ReadS StartDeviceAuthorization
$creadsPrec :: Int -> ReadS StartDeviceAuthorization
Prelude.Read, Int -> StartDeviceAuthorization -> ShowS
[StartDeviceAuthorization] -> ShowS
StartDeviceAuthorization -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDeviceAuthorization] -> ShowS
$cshowList :: [StartDeviceAuthorization] -> ShowS
show :: StartDeviceAuthorization -> String
$cshow :: StartDeviceAuthorization -> String
showsPrec :: Int -> StartDeviceAuthorization -> ShowS
$cshowsPrec :: Int -> StartDeviceAuthorization -> ShowS
Prelude.Show, forall x.
Rep StartDeviceAuthorization x -> StartDeviceAuthorization
forall x.
StartDeviceAuthorization -> Rep StartDeviceAuthorization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartDeviceAuthorization x -> StartDeviceAuthorization
$cfrom :: forall x.
StartDeviceAuthorization -> Rep StartDeviceAuthorization x
Prelude.Generic)

-- |
-- Create a value of 'StartDeviceAuthorization' 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:
--
-- 'clientId', 'startDeviceAuthorization_clientId' - The unique identifier string for the client that is registered with IAM
-- Identity Center. This value should come from the persisted result of the
-- RegisterClient API operation.
--
-- 'clientSecret', 'startDeviceAuthorization_clientSecret' - A secret string that is generated for the client. This value should come
-- from the persisted result of the RegisterClient API operation.
--
-- 'startUrl', 'startDeviceAuthorization_startUrl' - The URL for the AWS access portal. For more information, see
-- <https://docs.aws.amazon.com/singlesignon/latest/userguide/using-the-portal.html Using the AWS access portal>
-- in the /IAM Identity Center User Guide/.
newStartDeviceAuthorization ::
  -- | 'clientId'
  Prelude.Text ->
  -- | 'clientSecret'
  Prelude.Text ->
  -- | 'startUrl'
  Prelude.Text ->
  StartDeviceAuthorization
newStartDeviceAuthorization :: Text -> Text -> Text -> StartDeviceAuthorization
newStartDeviceAuthorization
  Text
pClientId_
  Text
pClientSecret_
  Text
pStartUrl_ =
    StartDeviceAuthorization'
      { $sel:clientId:StartDeviceAuthorization' :: Text
clientId = Text
pClientId_,
        $sel:clientSecret:StartDeviceAuthorization' :: Text
clientSecret = Text
pClientSecret_,
        $sel:startUrl:StartDeviceAuthorization' :: Text
startUrl = Text
pStartUrl_
      }

-- | The unique identifier string for the client that is registered with IAM
-- Identity Center. This value should come from the persisted result of the
-- RegisterClient API operation.
startDeviceAuthorization_clientId :: Lens.Lens' StartDeviceAuthorization Prelude.Text
startDeviceAuthorization_clientId :: Lens' StartDeviceAuthorization Text
startDeviceAuthorization_clientId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeviceAuthorization' {Text
clientId :: Text
$sel:clientId:StartDeviceAuthorization' :: StartDeviceAuthorization -> Text
clientId} -> Text
clientId) (\s :: StartDeviceAuthorization
s@StartDeviceAuthorization' {} Text
a -> StartDeviceAuthorization
s {$sel:clientId:StartDeviceAuthorization' :: Text
clientId = Text
a} :: StartDeviceAuthorization)

-- | A secret string that is generated for the client. This value should come
-- from the persisted result of the RegisterClient API operation.
startDeviceAuthorization_clientSecret :: Lens.Lens' StartDeviceAuthorization Prelude.Text
startDeviceAuthorization_clientSecret :: Lens' StartDeviceAuthorization Text
startDeviceAuthorization_clientSecret = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeviceAuthorization' {Text
clientSecret :: Text
$sel:clientSecret:StartDeviceAuthorization' :: StartDeviceAuthorization -> Text
clientSecret} -> Text
clientSecret) (\s :: StartDeviceAuthorization
s@StartDeviceAuthorization' {} Text
a -> StartDeviceAuthorization
s {$sel:clientSecret:StartDeviceAuthorization' :: Text
clientSecret = Text
a} :: StartDeviceAuthorization)

-- | The URL for the AWS access portal. For more information, see
-- <https://docs.aws.amazon.com/singlesignon/latest/userguide/using-the-portal.html Using the AWS access portal>
-- in the /IAM Identity Center User Guide/.
startDeviceAuthorization_startUrl :: Lens.Lens' StartDeviceAuthorization Prelude.Text
startDeviceAuthorization_startUrl :: Lens' StartDeviceAuthorization Text
startDeviceAuthorization_startUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeviceAuthorization' {Text
startUrl :: Text
$sel:startUrl:StartDeviceAuthorization' :: StartDeviceAuthorization -> Text
startUrl} -> Text
startUrl) (\s :: StartDeviceAuthorization
s@StartDeviceAuthorization' {} Text
a -> StartDeviceAuthorization
s {$sel:startUrl:StartDeviceAuthorization' :: Text
startUrl = Text
a} :: StartDeviceAuthorization)

instance Core.AWSRequest StartDeviceAuthorization where
  type
    AWSResponse StartDeviceAuthorization =
      StartDeviceAuthorizationResponse
  request :: (Service -> Service)
-> StartDeviceAuthorization -> Request StartDeviceAuthorization
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 StartDeviceAuthorization
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartDeviceAuthorization)))
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 Text
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> StartDeviceAuthorizationResponse
StartDeviceAuthorizationResponse'
            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
"deviceCode")
            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
"expiresIn")
            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
"interval")
            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
"userCode")
            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
"verificationUri")
            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
"verificationUriComplete")
            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 StartDeviceAuthorization where
  hashWithSalt :: Int -> StartDeviceAuthorization -> Int
hashWithSalt Int
_salt StartDeviceAuthorization' {Text
startUrl :: Text
clientSecret :: Text
clientId :: Text
$sel:startUrl:StartDeviceAuthorization' :: StartDeviceAuthorization -> Text
$sel:clientSecret:StartDeviceAuthorization' :: StartDeviceAuthorization -> Text
$sel:clientId:StartDeviceAuthorization' :: StartDeviceAuthorization -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clientId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clientSecret
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
startUrl

instance Prelude.NFData StartDeviceAuthorization where
  rnf :: StartDeviceAuthorization -> ()
rnf StartDeviceAuthorization' {Text
startUrl :: Text
clientSecret :: Text
clientId :: Text
$sel:startUrl:StartDeviceAuthorization' :: StartDeviceAuthorization -> Text
$sel:clientSecret:StartDeviceAuthorization' :: StartDeviceAuthorization -> Text
$sel:clientId:StartDeviceAuthorization' :: StartDeviceAuthorization -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
clientId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
clientSecret
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
startUrl

instance Data.ToHeaders StartDeviceAuthorization where
  toHeaders :: StartDeviceAuthorization -> ResponseHeaders
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 -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON StartDeviceAuthorization where
  toJSON :: StartDeviceAuthorization -> Value
toJSON StartDeviceAuthorization' {Text
startUrl :: Text
clientSecret :: Text
clientId :: Text
$sel:startUrl:StartDeviceAuthorization' :: StartDeviceAuthorization -> Text
$sel:clientSecret:StartDeviceAuthorization' :: StartDeviceAuthorization -> Text
$sel:clientId:StartDeviceAuthorization' :: StartDeviceAuthorization -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"clientId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
clientId),
            forall a. a -> Maybe a
Prelude.Just (Key
"clientSecret" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
clientSecret),
            forall a. a -> Maybe a
Prelude.Just (Key
"startUrl" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
startUrl)
          ]
      )

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

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

-- | /See:/ 'newStartDeviceAuthorizationResponse' smart constructor.
data StartDeviceAuthorizationResponse = StartDeviceAuthorizationResponse'
  { -- | The short-lived code that is used by the device when polling for a
    -- session token.
    StartDeviceAuthorizationResponse -> Maybe Text
deviceCode :: Prelude.Maybe Prelude.Text,
    -- | Indicates the number of seconds in which the verification code will
    -- become invalid.
    StartDeviceAuthorizationResponse -> Maybe Int
expiresIn :: Prelude.Maybe Prelude.Int,
    -- | Indicates the number of seconds the client must wait between attempts
    -- when polling for a session.
    StartDeviceAuthorizationResponse -> Maybe Int
interval :: Prelude.Maybe Prelude.Int,
    -- | A one-time user verification code. This is needed to authorize an in-use
    -- device.
    StartDeviceAuthorizationResponse -> Maybe Text
userCode :: Prelude.Maybe Prelude.Text,
    -- | The URI of the verification page that takes the @userCode@ to authorize
    -- the device.
    StartDeviceAuthorizationResponse -> Maybe Text
verificationUri :: Prelude.Maybe Prelude.Text,
    -- | An alternate URL that the client can use to automatically launch a
    -- browser. This process skips the manual step in which the user visits the
    -- verification page and enters their code.
    StartDeviceAuthorizationResponse -> Maybe Text
verificationUriComplete :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartDeviceAuthorizationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartDeviceAuthorizationResponse
-> StartDeviceAuthorizationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDeviceAuthorizationResponse
-> StartDeviceAuthorizationResponse -> Bool
$c/= :: StartDeviceAuthorizationResponse
-> StartDeviceAuthorizationResponse -> Bool
== :: StartDeviceAuthorizationResponse
-> StartDeviceAuthorizationResponse -> Bool
$c== :: StartDeviceAuthorizationResponse
-> StartDeviceAuthorizationResponse -> Bool
Prelude.Eq, ReadPrec [StartDeviceAuthorizationResponse]
ReadPrec StartDeviceAuthorizationResponse
Int -> ReadS StartDeviceAuthorizationResponse
ReadS [StartDeviceAuthorizationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDeviceAuthorizationResponse]
$creadListPrec :: ReadPrec [StartDeviceAuthorizationResponse]
readPrec :: ReadPrec StartDeviceAuthorizationResponse
$creadPrec :: ReadPrec StartDeviceAuthorizationResponse
readList :: ReadS [StartDeviceAuthorizationResponse]
$creadList :: ReadS [StartDeviceAuthorizationResponse]
readsPrec :: Int -> ReadS StartDeviceAuthorizationResponse
$creadsPrec :: Int -> ReadS StartDeviceAuthorizationResponse
Prelude.Read, Int -> StartDeviceAuthorizationResponse -> ShowS
[StartDeviceAuthorizationResponse] -> ShowS
StartDeviceAuthorizationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDeviceAuthorizationResponse] -> ShowS
$cshowList :: [StartDeviceAuthorizationResponse] -> ShowS
show :: StartDeviceAuthorizationResponse -> String
$cshow :: StartDeviceAuthorizationResponse -> String
showsPrec :: Int -> StartDeviceAuthorizationResponse -> ShowS
$cshowsPrec :: Int -> StartDeviceAuthorizationResponse -> ShowS
Prelude.Show, forall x.
Rep StartDeviceAuthorizationResponse x
-> StartDeviceAuthorizationResponse
forall x.
StartDeviceAuthorizationResponse
-> Rep StartDeviceAuthorizationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartDeviceAuthorizationResponse x
-> StartDeviceAuthorizationResponse
$cfrom :: forall x.
StartDeviceAuthorizationResponse
-> Rep StartDeviceAuthorizationResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartDeviceAuthorizationResponse' 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:
--
-- 'deviceCode', 'startDeviceAuthorizationResponse_deviceCode' - The short-lived code that is used by the device when polling for a
-- session token.
--
-- 'expiresIn', 'startDeviceAuthorizationResponse_expiresIn' - Indicates the number of seconds in which the verification code will
-- become invalid.
--
-- 'interval', 'startDeviceAuthorizationResponse_interval' - Indicates the number of seconds the client must wait between attempts
-- when polling for a session.
--
-- 'userCode', 'startDeviceAuthorizationResponse_userCode' - A one-time user verification code. This is needed to authorize an in-use
-- device.
--
-- 'verificationUri', 'startDeviceAuthorizationResponse_verificationUri' - The URI of the verification page that takes the @userCode@ to authorize
-- the device.
--
-- 'verificationUriComplete', 'startDeviceAuthorizationResponse_verificationUriComplete' - An alternate URL that the client can use to automatically launch a
-- browser. This process skips the manual step in which the user visits the
-- verification page and enters their code.
--
-- 'httpStatus', 'startDeviceAuthorizationResponse_httpStatus' - The response's http status code.
newStartDeviceAuthorizationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartDeviceAuthorizationResponse
newStartDeviceAuthorizationResponse :: Int -> StartDeviceAuthorizationResponse
newStartDeviceAuthorizationResponse Int
pHttpStatus_ =
  StartDeviceAuthorizationResponse'
    { $sel:deviceCode:StartDeviceAuthorizationResponse' :: Maybe Text
deviceCode =
        forall a. Maybe a
Prelude.Nothing,
      $sel:expiresIn:StartDeviceAuthorizationResponse' :: Maybe Int
expiresIn = forall a. Maybe a
Prelude.Nothing,
      $sel:interval:StartDeviceAuthorizationResponse' :: Maybe Int
interval = forall a. Maybe a
Prelude.Nothing,
      $sel:userCode:StartDeviceAuthorizationResponse' :: Maybe Text
userCode = forall a. Maybe a
Prelude.Nothing,
      $sel:verificationUri:StartDeviceAuthorizationResponse' :: Maybe Text
verificationUri = forall a. Maybe a
Prelude.Nothing,
      $sel:verificationUriComplete:StartDeviceAuthorizationResponse' :: Maybe Text
verificationUriComplete = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartDeviceAuthorizationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The short-lived code that is used by the device when polling for a
-- session token.
startDeviceAuthorizationResponse_deviceCode :: Lens.Lens' StartDeviceAuthorizationResponse (Prelude.Maybe Prelude.Text)
startDeviceAuthorizationResponse_deviceCode :: Lens' StartDeviceAuthorizationResponse (Maybe Text)
startDeviceAuthorizationResponse_deviceCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeviceAuthorizationResponse' {Maybe Text
deviceCode :: Maybe Text
$sel:deviceCode:StartDeviceAuthorizationResponse' :: StartDeviceAuthorizationResponse -> Maybe Text
deviceCode} -> Maybe Text
deviceCode) (\s :: StartDeviceAuthorizationResponse
s@StartDeviceAuthorizationResponse' {} Maybe Text
a -> StartDeviceAuthorizationResponse
s {$sel:deviceCode:StartDeviceAuthorizationResponse' :: Maybe Text
deviceCode = Maybe Text
a} :: StartDeviceAuthorizationResponse)

-- | Indicates the number of seconds in which the verification code will
-- become invalid.
startDeviceAuthorizationResponse_expiresIn :: Lens.Lens' StartDeviceAuthorizationResponse (Prelude.Maybe Prelude.Int)
startDeviceAuthorizationResponse_expiresIn :: Lens' StartDeviceAuthorizationResponse (Maybe Int)
startDeviceAuthorizationResponse_expiresIn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeviceAuthorizationResponse' {Maybe Int
expiresIn :: Maybe Int
$sel:expiresIn:StartDeviceAuthorizationResponse' :: StartDeviceAuthorizationResponse -> Maybe Int
expiresIn} -> Maybe Int
expiresIn) (\s :: StartDeviceAuthorizationResponse
s@StartDeviceAuthorizationResponse' {} Maybe Int
a -> StartDeviceAuthorizationResponse
s {$sel:expiresIn:StartDeviceAuthorizationResponse' :: Maybe Int
expiresIn = Maybe Int
a} :: StartDeviceAuthorizationResponse)

-- | Indicates the number of seconds the client must wait between attempts
-- when polling for a session.
startDeviceAuthorizationResponse_interval :: Lens.Lens' StartDeviceAuthorizationResponse (Prelude.Maybe Prelude.Int)
startDeviceAuthorizationResponse_interval :: Lens' StartDeviceAuthorizationResponse (Maybe Int)
startDeviceAuthorizationResponse_interval = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeviceAuthorizationResponse' {Maybe Int
interval :: Maybe Int
$sel:interval:StartDeviceAuthorizationResponse' :: StartDeviceAuthorizationResponse -> Maybe Int
interval} -> Maybe Int
interval) (\s :: StartDeviceAuthorizationResponse
s@StartDeviceAuthorizationResponse' {} Maybe Int
a -> StartDeviceAuthorizationResponse
s {$sel:interval:StartDeviceAuthorizationResponse' :: Maybe Int
interval = Maybe Int
a} :: StartDeviceAuthorizationResponse)

-- | A one-time user verification code. This is needed to authorize an in-use
-- device.
startDeviceAuthorizationResponse_userCode :: Lens.Lens' StartDeviceAuthorizationResponse (Prelude.Maybe Prelude.Text)
startDeviceAuthorizationResponse_userCode :: Lens' StartDeviceAuthorizationResponse (Maybe Text)
startDeviceAuthorizationResponse_userCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeviceAuthorizationResponse' {Maybe Text
userCode :: Maybe Text
$sel:userCode:StartDeviceAuthorizationResponse' :: StartDeviceAuthorizationResponse -> Maybe Text
userCode} -> Maybe Text
userCode) (\s :: StartDeviceAuthorizationResponse
s@StartDeviceAuthorizationResponse' {} Maybe Text
a -> StartDeviceAuthorizationResponse
s {$sel:userCode:StartDeviceAuthorizationResponse' :: Maybe Text
userCode = Maybe Text
a} :: StartDeviceAuthorizationResponse)

-- | The URI of the verification page that takes the @userCode@ to authorize
-- the device.
startDeviceAuthorizationResponse_verificationUri :: Lens.Lens' StartDeviceAuthorizationResponse (Prelude.Maybe Prelude.Text)
startDeviceAuthorizationResponse_verificationUri :: Lens' StartDeviceAuthorizationResponse (Maybe Text)
startDeviceAuthorizationResponse_verificationUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeviceAuthorizationResponse' {Maybe Text
verificationUri :: Maybe Text
$sel:verificationUri:StartDeviceAuthorizationResponse' :: StartDeviceAuthorizationResponse -> Maybe Text
verificationUri} -> Maybe Text
verificationUri) (\s :: StartDeviceAuthorizationResponse
s@StartDeviceAuthorizationResponse' {} Maybe Text
a -> StartDeviceAuthorizationResponse
s {$sel:verificationUri:StartDeviceAuthorizationResponse' :: Maybe Text
verificationUri = Maybe Text
a} :: StartDeviceAuthorizationResponse)

-- | An alternate URL that the client can use to automatically launch a
-- browser. This process skips the manual step in which the user visits the
-- verification page and enters their code.
startDeviceAuthorizationResponse_verificationUriComplete :: Lens.Lens' StartDeviceAuthorizationResponse (Prelude.Maybe Prelude.Text)
startDeviceAuthorizationResponse_verificationUriComplete :: Lens' StartDeviceAuthorizationResponse (Maybe Text)
startDeviceAuthorizationResponse_verificationUriComplete = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeviceAuthorizationResponse' {Maybe Text
verificationUriComplete :: Maybe Text
$sel:verificationUriComplete:StartDeviceAuthorizationResponse' :: StartDeviceAuthorizationResponse -> Maybe Text
verificationUriComplete} -> Maybe Text
verificationUriComplete) (\s :: StartDeviceAuthorizationResponse
s@StartDeviceAuthorizationResponse' {} Maybe Text
a -> StartDeviceAuthorizationResponse
s {$sel:verificationUriComplete:StartDeviceAuthorizationResponse' :: Maybe Text
verificationUriComplete = Maybe Text
a} :: StartDeviceAuthorizationResponse)

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

instance
  Prelude.NFData
    StartDeviceAuthorizationResponse
  where
  rnf :: StartDeviceAuthorizationResponse -> ()
rnf StartDeviceAuthorizationResponse' {Int
Maybe Int
Maybe Text
httpStatus :: Int
verificationUriComplete :: Maybe Text
verificationUri :: Maybe Text
userCode :: Maybe Text
interval :: Maybe Int
expiresIn :: Maybe Int
deviceCode :: Maybe Text
$sel:httpStatus:StartDeviceAuthorizationResponse' :: StartDeviceAuthorizationResponse -> Int
$sel:verificationUriComplete:StartDeviceAuthorizationResponse' :: StartDeviceAuthorizationResponse -> Maybe Text
$sel:verificationUri:StartDeviceAuthorizationResponse' :: StartDeviceAuthorizationResponse -> Maybe Text
$sel:userCode:StartDeviceAuthorizationResponse' :: StartDeviceAuthorizationResponse -> Maybe Text
$sel:interval:StartDeviceAuthorizationResponse' :: StartDeviceAuthorizationResponse -> Maybe Int
$sel:expiresIn:StartDeviceAuthorizationResponse' :: StartDeviceAuthorizationResponse -> Maybe Int
$sel:deviceCode:StartDeviceAuthorizationResponse' :: StartDeviceAuthorizationResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deviceCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
expiresIn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
interval
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
userCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
verificationUri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
verificationUriComplete
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus