{-# 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 #-}
module Amazonka.CognitoIdentityProvider.AssociateSoftwareToken
(
AssociateSoftwareToken (..),
newAssociateSoftwareToken,
associateSoftwareToken_accessToken,
associateSoftwareToken_session,
AssociateSoftwareTokenResponse (..),
newAssociateSoftwareTokenResponse,
associateSoftwareTokenResponse_secretCode,
associateSoftwareTokenResponse_session,
associateSoftwareTokenResponse_httpStatus,
)
where
import Amazonka.CognitoIdentityProvider.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
data AssociateSoftwareToken = AssociateSoftwareToken'
{
AssociateSoftwareToken -> Maybe (Sensitive Text)
accessToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
AssociateSoftwareToken -> Maybe Text
session :: Prelude.Maybe Prelude.Text
}
deriving (AssociateSoftwareToken -> AssociateSoftwareToken -> Bool
(AssociateSoftwareToken -> AssociateSoftwareToken -> Bool)
-> (AssociateSoftwareToken -> AssociateSoftwareToken -> Bool)
-> Eq AssociateSoftwareToken
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateSoftwareToken -> AssociateSoftwareToken -> Bool
$c/= :: AssociateSoftwareToken -> AssociateSoftwareToken -> Bool
== :: AssociateSoftwareToken -> AssociateSoftwareToken -> Bool
$c== :: AssociateSoftwareToken -> AssociateSoftwareToken -> Bool
Prelude.Eq, Int -> AssociateSoftwareToken -> ShowS
[AssociateSoftwareToken] -> ShowS
AssociateSoftwareToken -> String
(Int -> AssociateSoftwareToken -> ShowS)
-> (AssociateSoftwareToken -> String)
-> ([AssociateSoftwareToken] -> ShowS)
-> Show AssociateSoftwareToken
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateSoftwareToken] -> ShowS
$cshowList :: [AssociateSoftwareToken] -> ShowS
show :: AssociateSoftwareToken -> String
$cshow :: AssociateSoftwareToken -> String
showsPrec :: Int -> AssociateSoftwareToken -> ShowS
$cshowsPrec :: Int -> AssociateSoftwareToken -> ShowS
Prelude.Show, (forall x. AssociateSoftwareToken -> Rep AssociateSoftwareToken x)
-> (forall x.
Rep AssociateSoftwareToken x -> AssociateSoftwareToken)
-> Generic AssociateSoftwareToken
forall x. Rep AssociateSoftwareToken x -> AssociateSoftwareToken
forall x. AssociateSoftwareToken -> Rep AssociateSoftwareToken x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateSoftwareToken x -> AssociateSoftwareToken
$cfrom :: forall x. AssociateSoftwareToken -> Rep AssociateSoftwareToken x
Prelude.Generic)
newAssociateSoftwareToken ::
AssociateSoftwareToken
newAssociateSoftwareToken :: AssociateSoftwareToken
newAssociateSoftwareToken =
AssociateSoftwareToken' :: Maybe (Sensitive Text) -> Maybe Text -> AssociateSoftwareToken
AssociateSoftwareToken'
{ $sel:accessToken:AssociateSoftwareToken' :: Maybe (Sensitive Text)
accessToken =
Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:session:AssociateSoftwareToken' :: Maybe Text
session = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
associateSoftwareToken_accessToken :: Lens.Lens' AssociateSoftwareToken (Prelude.Maybe Prelude.Text)
associateSoftwareToken_accessToken :: (Maybe Text -> f (Maybe Text))
-> AssociateSoftwareToken -> f AssociateSoftwareToken
associateSoftwareToken_accessToken = (AssociateSoftwareToken -> Maybe (Sensitive Text))
-> (AssociateSoftwareToken
-> Maybe (Sensitive Text) -> AssociateSoftwareToken)
-> Lens
AssociateSoftwareToken
AssociateSoftwareToken
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSoftwareToken' {Maybe (Sensitive Text)
accessToken :: Maybe (Sensitive Text)
$sel:accessToken:AssociateSoftwareToken' :: AssociateSoftwareToken -> Maybe (Sensitive Text)
accessToken} -> Maybe (Sensitive Text)
accessToken) (\s :: AssociateSoftwareToken
s@AssociateSoftwareToken' {} Maybe (Sensitive Text)
a -> AssociateSoftwareToken
s {$sel:accessToken:AssociateSoftwareToken' :: Maybe (Sensitive Text)
accessToken = Maybe (Sensitive Text)
a} :: AssociateSoftwareToken) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> AssociateSoftwareToken -> f AssociateSoftwareToken)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> AssociateSoftwareToken
-> f AssociateSoftwareToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
associateSoftwareToken_session :: Lens.Lens' AssociateSoftwareToken (Prelude.Maybe Prelude.Text)
associateSoftwareToken_session :: (Maybe Text -> f (Maybe Text))
-> AssociateSoftwareToken -> f AssociateSoftwareToken
associateSoftwareToken_session = (AssociateSoftwareToken -> Maybe Text)
-> (AssociateSoftwareToken -> Maybe Text -> AssociateSoftwareToken)
-> Lens
AssociateSoftwareToken
AssociateSoftwareToken
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSoftwareToken' {Maybe Text
session :: Maybe Text
$sel:session:AssociateSoftwareToken' :: AssociateSoftwareToken -> Maybe Text
session} -> Maybe Text
session) (\s :: AssociateSoftwareToken
s@AssociateSoftwareToken' {} Maybe Text
a -> AssociateSoftwareToken
s {$sel:session:AssociateSoftwareToken' :: Maybe Text
session = Maybe Text
a} :: AssociateSoftwareToken)
instance Core.AWSRequest AssociateSoftwareToken where
type
AWSResponse AssociateSoftwareToken =
AssociateSoftwareTokenResponse
request :: AssociateSoftwareToken -> Request AssociateSoftwareToken
request = Service -> AssociateSoftwareToken -> Request AssociateSoftwareToken
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateSoftwareToken
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateSoftwareToken)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AssociateSoftwareToken))
-> Logger
-> Service
-> Proxy AssociateSoftwareToken
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateSoftwareToken)))
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 (Sensitive Text)
-> Maybe Text -> Int -> AssociateSoftwareTokenResponse
AssociateSoftwareTokenResponse'
(Maybe (Sensitive Text)
-> Maybe Text -> Int -> AssociateSoftwareTokenResponse)
-> Either String (Maybe (Sensitive Text))
-> Either
String (Maybe Text -> Int -> AssociateSoftwareTokenResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SecretCode")
Either String (Maybe Text -> Int -> AssociateSoftwareTokenResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AssociateSoftwareTokenResponse)
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
"Session")
Either String (Int -> AssociateSoftwareTokenResponse)
-> Either String Int
-> Either String AssociateSoftwareTokenResponse
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 AssociateSoftwareToken
instance Prelude.NFData AssociateSoftwareToken
instance Core.ToHeaders AssociateSoftwareToken where
toHeaders :: AssociateSoftwareToken -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateSoftwareToken -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSCognitoIdentityProviderService.AssociateSoftwareToken" ::
Prelude.ByteString
),
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 AssociateSoftwareToken where
toJSON :: AssociateSoftwareToken -> Value
toJSON AssociateSoftwareToken' {Maybe Text
Maybe (Sensitive Text)
session :: Maybe Text
accessToken :: Maybe (Sensitive Text)
$sel:session:AssociateSoftwareToken' :: AssociateSoftwareToken -> Maybe Text
$sel:accessToken:AssociateSoftwareToken' :: AssociateSoftwareToken -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AccessToken" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
accessToken,
(Text
"Session" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
session
]
)
instance Core.ToPath AssociateSoftwareToken where
toPath :: AssociateSoftwareToken -> ByteString
toPath = ByteString -> AssociateSoftwareToken -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AssociateSoftwareToken where
toQuery :: AssociateSoftwareToken -> QueryString
toQuery = QueryString -> AssociateSoftwareToken -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateSoftwareTokenResponse = AssociateSoftwareTokenResponse'
{
AssociateSoftwareTokenResponse -> Maybe (Sensitive Text)
secretCode :: Prelude.Maybe (Core.Sensitive Prelude.Text),
AssociateSoftwareTokenResponse -> Maybe Text
session :: Prelude.Maybe Prelude.Text,
AssociateSoftwareTokenResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateSoftwareTokenResponse
-> AssociateSoftwareTokenResponse -> Bool
(AssociateSoftwareTokenResponse
-> AssociateSoftwareTokenResponse -> Bool)
-> (AssociateSoftwareTokenResponse
-> AssociateSoftwareTokenResponse -> Bool)
-> Eq AssociateSoftwareTokenResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateSoftwareTokenResponse
-> AssociateSoftwareTokenResponse -> Bool
$c/= :: AssociateSoftwareTokenResponse
-> AssociateSoftwareTokenResponse -> Bool
== :: AssociateSoftwareTokenResponse
-> AssociateSoftwareTokenResponse -> Bool
$c== :: AssociateSoftwareTokenResponse
-> AssociateSoftwareTokenResponse -> Bool
Prelude.Eq, Int -> AssociateSoftwareTokenResponse -> ShowS
[AssociateSoftwareTokenResponse] -> ShowS
AssociateSoftwareTokenResponse -> String
(Int -> AssociateSoftwareTokenResponse -> ShowS)
-> (AssociateSoftwareTokenResponse -> String)
-> ([AssociateSoftwareTokenResponse] -> ShowS)
-> Show AssociateSoftwareTokenResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateSoftwareTokenResponse] -> ShowS
$cshowList :: [AssociateSoftwareTokenResponse] -> ShowS
show :: AssociateSoftwareTokenResponse -> String
$cshow :: AssociateSoftwareTokenResponse -> String
showsPrec :: Int -> AssociateSoftwareTokenResponse -> ShowS
$cshowsPrec :: Int -> AssociateSoftwareTokenResponse -> ShowS
Prelude.Show, (forall x.
AssociateSoftwareTokenResponse
-> Rep AssociateSoftwareTokenResponse x)
-> (forall x.
Rep AssociateSoftwareTokenResponse x
-> AssociateSoftwareTokenResponse)
-> Generic AssociateSoftwareTokenResponse
forall x.
Rep AssociateSoftwareTokenResponse x
-> AssociateSoftwareTokenResponse
forall x.
AssociateSoftwareTokenResponse
-> Rep AssociateSoftwareTokenResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateSoftwareTokenResponse x
-> AssociateSoftwareTokenResponse
$cfrom :: forall x.
AssociateSoftwareTokenResponse
-> Rep AssociateSoftwareTokenResponse x
Prelude.Generic)
newAssociateSoftwareTokenResponse ::
Prelude.Int ->
AssociateSoftwareTokenResponse
newAssociateSoftwareTokenResponse :: Int -> AssociateSoftwareTokenResponse
newAssociateSoftwareTokenResponse Int
pHttpStatus_ =
AssociateSoftwareTokenResponse' :: Maybe (Sensitive Text)
-> Maybe Text -> Int -> AssociateSoftwareTokenResponse
AssociateSoftwareTokenResponse'
{ $sel:secretCode:AssociateSoftwareTokenResponse' :: Maybe (Sensitive Text)
secretCode =
Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:session:AssociateSoftwareTokenResponse' :: Maybe Text
session = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateSoftwareTokenResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateSoftwareTokenResponse_secretCode :: Lens.Lens' AssociateSoftwareTokenResponse (Prelude.Maybe Prelude.Text)
associateSoftwareTokenResponse_secretCode :: (Maybe Text -> f (Maybe Text))
-> AssociateSoftwareTokenResponse
-> f AssociateSoftwareTokenResponse
associateSoftwareTokenResponse_secretCode = (AssociateSoftwareTokenResponse -> Maybe (Sensitive Text))
-> (AssociateSoftwareTokenResponse
-> Maybe (Sensitive Text) -> AssociateSoftwareTokenResponse)
-> Lens
AssociateSoftwareTokenResponse
AssociateSoftwareTokenResponse
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSoftwareTokenResponse' {Maybe (Sensitive Text)
secretCode :: Maybe (Sensitive Text)
$sel:secretCode:AssociateSoftwareTokenResponse' :: AssociateSoftwareTokenResponse -> Maybe (Sensitive Text)
secretCode} -> Maybe (Sensitive Text)
secretCode) (\s :: AssociateSoftwareTokenResponse
s@AssociateSoftwareTokenResponse' {} Maybe (Sensitive Text)
a -> AssociateSoftwareTokenResponse
s {$sel:secretCode:AssociateSoftwareTokenResponse' :: Maybe (Sensitive Text)
secretCode = Maybe (Sensitive Text)
a} :: AssociateSoftwareTokenResponse) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> AssociateSoftwareTokenResponse
-> f AssociateSoftwareTokenResponse)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> AssociateSoftwareTokenResponse
-> f AssociateSoftwareTokenResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
associateSoftwareTokenResponse_session :: Lens.Lens' AssociateSoftwareTokenResponse (Prelude.Maybe Prelude.Text)
associateSoftwareTokenResponse_session :: (Maybe Text -> f (Maybe Text))
-> AssociateSoftwareTokenResponse
-> f AssociateSoftwareTokenResponse
associateSoftwareTokenResponse_session = (AssociateSoftwareTokenResponse -> Maybe Text)
-> (AssociateSoftwareTokenResponse
-> Maybe Text -> AssociateSoftwareTokenResponse)
-> Lens
AssociateSoftwareTokenResponse
AssociateSoftwareTokenResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSoftwareTokenResponse' {Maybe Text
session :: Maybe Text
$sel:session:AssociateSoftwareTokenResponse' :: AssociateSoftwareTokenResponse -> Maybe Text
session} -> Maybe Text
session) (\s :: AssociateSoftwareTokenResponse
s@AssociateSoftwareTokenResponse' {} Maybe Text
a -> AssociateSoftwareTokenResponse
s {$sel:session:AssociateSoftwareTokenResponse' :: Maybe Text
session = Maybe Text
a} :: AssociateSoftwareTokenResponse)
associateSoftwareTokenResponse_httpStatus :: Lens.Lens' AssociateSoftwareTokenResponse Prelude.Int
associateSoftwareTokenResponse_httpStatus :: (Int -> f Int)
-> AssociateSoftwareTokenResponse
-> f AssociateSoftwareTokenResponse
associateSoftwareTokenResponse_httpStatus = (AssociateSoftwareTokenResponse -> Int)
-> (AssociateSoftwareTokenResponse
-> Int -> AssociateSoftwareTokenResponse)
-> Lens
AssociateSoftwareTokenResponse
AssociateSoftwareTokenResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSoftwareTokenResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateSoftwareTokenResponse' :: AssociateSoftwareTokenResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateSoftwareTokenResponse
s@AssociateSoftwareTokenResponse' {} Int
a -> AssociateSoftwareTokenResponse
s {$sel:httpStatus:AssociateSoftwareTokenResponse' :: Int
httpStatus = Int
a} :: AssociateSoftwareTokenResponse)
instance
Prelude.NFData
AssociateSoftwareTokenResponse