{-# 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.IAM.CreateVirtualMFADevice
(
CreateVirtualMFADevice (..),
newCreateVirtualMFADevice,
createVirtualMFADevice_path,
createVirtualMFADevice_tags,
createVirtualMFADevice_virtualMFADeviceName,
CreateVirtualMFADeviceResponse (..),
newCreateVirtualMFADeviceResponse,
createVirtualMFADeviceResponse_httpStatus,
createVirtualMFADeviceResponse_virtualMFADevice,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IAM.Types
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 CreateVirtualMFADevice = CreateVirtualMFADevice'
{
CreateVirtualMFADevice -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
CreateVirtualMFADevice -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateVirtualMFADevice -> Text
virtualMFADeviceName :: Prelude.Text
}
deriving (CreateVirtualMFADevice -> CreateVirtualMFADevice -> Bool
(CreateVirtualMFADevice -> CreateVirtualMFADevice -> Bool)
-> (CreateVirtualMFADevice -> CreateVirtualMFADevice -> Bool)
-> Eq CreateVirtualMFADevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVirtualMFADevice -> CreateVirtualMFADevice -> Bool
$c/= :: CreateVirtualMFADevice -> CreateVirtualMFADevice -> Bool
== :: CreateVirtualMFADevice -> CreateVirtualMFADevice -> Bool
$c== :: CreateVirtualMFADevice -> CreateVirtualMFADevice -> Bool
Prelude.Eq, ReadPrec [CreateVirtualMFADevice]
ReadPrec CreateVirtualMFADevice
Int -> ReadS CreateVirtualMFADevice
ReadS [CreateVirtualMFADevice]
(Int -> ReadS CreateVirtualMFADevice)
-> ReadS [CreateVirtualMFADevice]
-> ReadPrec CreateVirtualMFADevice
-> ReadPrec [CreateVirtualMFADevice]
-> Read CreateVirtualMFADevice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateVirtualMFADevice]
$creadListPrec :: ReadPrec [CreateVirtualMFADevice]
readPrec :: ReadPrec CreateVirtualMFADevice
$creadPrec :: ReadPrec CreateVirtualMFADevice
readList :: ReadS [CreateVirtualMFADevice]
$creadList :: ReadS [CreateVirtualMFADevice]
readsPrec :: Int -> ReadS CreateVirtualMFADevice
$creadsPrec :: Int -> ReadS CreateVirtualMFADevice
Prelude.Read, Int -> CreateVirtualMFADevice -> ShowS
[CreateVirtualMFADevice] -> ShowS
CreateVirtualMFADevice -> String
(Int -> CreateVirtualMFADevice -> ShowS)
-> (CreateVirtualMFADevice -> String)
-> ([CreateVirtualMFADevice] -> ShowS)
-> Show CreateVirtualMFADevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVirtualMFADevice] -> ShowS
$cshowList :: [CreateVirtualMFADevice] -> ShowS
show :: CreateVirtualMFADevice -> String
$cshow :: CreateVirtualMFADevice -> String
showsPrec :: Int -> CreateVirtualMFADevice -> ShowS
$cshowsPrec :: Int -> CreateVirtualMFADevice -> ShowS
Prelude.Show, (forall x. CreateVirtualMFADevice -> Rep CreateVirtualMFADevice x)
-> (forall x.
Rep CreateVirtualMFADevice x -> CreateVirtualMFADevice)
-> Generic CreateVirtualMFADevice
forall x. Rep CreateVirtualMFADevice x -> CreateVirtualMFADevice
forall x. CreateVirtualMFADevice -> Rep CreateVirtualMFADevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateVirtualMFADevice x -> CreateVirtualMFADevice
$cfrom :: forall x. CreateVirtualMFADevice -> Rep CreateVirtualMFADevice x
Prelude.Generic)
newCreateVirtualMFADevice ::
Prelude.Text ->
CreateVirtualMFADevice
newCreateVirtualMFADevice :: Text -> CreateVirtualMFADevice
newCreateVirtualMFADevice Text
pVirtualMFADeviceName_ =
CreateVirtualMFADevice' :: Maybe Text -> Maybe [Tag] -> Text -> CreateVirtualMFADevice
CreateVirtualMFADevice'
{ $sel:path:CreateVirtualMFADevice' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateVirtualMFADevice' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:virtualMFADeviceName:CreateVirtualMFADevice' :: Text
virtualMFADeviceName = Text
pVirtualMFADeviceName_
}
createVirtualMFADevice_path :: Lens.Lens' CreateVirtualMFADevice (Prelude.Maybe Prelude.Text)
createVirtualMFADevice_path :: (Maybe Text -> f (Maybe Text))
-> CreateVirtualMFADevice -> f CreateVirtualMFADevice
createVirtualMFADevice_path = (CreateVirtualMFADevice -> Maybe Text)
-> (CreateVirtualMFADevice -> Maybe Text -> CreateVirtualMFADevice)
-> Lens
CreateVirtualMFADevice
CreateVirtualMFADevice
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualMFADevice' {Maybe Text
path :: Maybe Text
$sel:path:CreateVirtualMFADevice' :: CreateVirtualMFADevice -> Maybe Text
path} -> Maybe Text
path) (\s :: CreateVirtualMFADevice
s@CreateVirtualMFADevice' {} Maybe Text
a -> CreateVirtualMFADevice
s {$sel:path:CreateVirtualMFADevice' :: Maybe Text
path = Maybe Text
a} :: CreateVirtualMFADevice)
createVirtualMFADevice_tags :: Lens.Lens' CreateVirtualMFADevice (Prelude.Maybe [Tag])
createVirtualMFADevice_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateVirtualMFADevice -> f CreateVirtualMFADevice
createVirtualMFADevice_tags = (CreateVirtualMFADevice -> Maybe [Tag])
-> (CreateVirtualMFADevice
-> Maybe [Tag] -> CreateVirtualMFADevice)
-> Lens
CreateVirtualMFADevice
CreateVirtualMFADevice
(Maybe [Tag])
(Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualMFADevice' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateVirtualMFADevice' :: CreateVirtualMFADevice -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateVirtualMFADevice
s@CreateVirtualMFADevice' {} Maybe [Tag]
a -> CreateVirtualMFADevice
s {$sel:tags:CreateVirtualMFADevice' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateVirtualMFADevice) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateVirtualMFADevice -> f CreateVirtualMFADevice)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateVirtualMFADevice
-> f CreateVirtualMFADevice
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createVirtualMFADevice_virtualMFADeviceName :: Lens.Lens' CreateVirtualMFADevice Prelude.Text
createVirtualMFADevice_virtualMFADeviceName :: (Text -> f Text)
-> CreateVirtualMFADevice -> f CreateVirtualMFADevice
createVirtualMFADevice_virtualMFADeviceName = (CreateVirtualMFADevice -> Text)
-> (CreateVirtualMFADevice -> Text -> CreateVirtualMFADevice)
-> Lens CreateVirtualMFADevice CreateVirtualMFADevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualMFADevice' {Text
virtualMFADeviceName :: Text
$sel:virtualMFADeviceName:CreateVirtualMFADevice' :: CreateVirtualMFADevice -> Text
virtualMFADeviceName} -> Text
virtualMFADeviceName) (\s :: CreateVirtualMFADevice
s@CreateVirtualMFADevice' {} Text
a -> CreateVirtualMFADevice
s {$sel:virtualMFADeviceName:CreateVirtualMFADevice' :: Text
virtualMFADeviceName = Text
a} :: CreateVirtualMFADevice)
instance Core.AWSRequest CreateVirtualMFADevice where
type
AWSResponse CreateVirtualMFADevice =
CreateVirtualMFADeviceResponse
request :: CreateVirtualMFADevice -> Request CreateVirtualMFADevice
request = Service -> CreateVirtualMFADevice -> Request CreateVirtualMFADevice
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreateVirtualMFADevice
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateVirtualMFADevice)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateVirtualMFADevice))
-> Logger
-> Service
-> Proxy CreateVirtualMFADevice
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateVirtualMFADevice)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"CreateVirtualMFADeviceResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> VirtualMFADevice -> CreateVirtualMFADeviceResponse
CreateVirtualMFADeviceResponse'
(Int -> VirtualMFADevice -> CreateVirtualMFADeviceResponse)
-> Either String Int
-> Either
String (VirtualMFADevice -> CreateVirtualMFADeviceResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (VirtualMFADevice -> CreateVirtualMFADeviceResponse)
-> Either String VirtualMFADevice
-> Either String CreateVirtualMFADeviceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String VirtualMFADevice
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"VirtualMFADevice")
)
instance Prelude.Hashable CreateVirtualMFADevice
instance Prelude.NFData CreateVirtualMFADevice
instance Core.ToHeaders CreateVirtualMFADevice where
toHeaders :: CreateVirtualMFADevice -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateVirtualMFADevice -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateVirtualMFADevice where
toPath :: CreateVirtualMFADevice -> ByteString
toPath = ByteString -> CreateVirtualMFADevice -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateVirtualMFADevice where
toQuery :: CreateVirtualMFADevice -> QueryString
toQuery CreateVirtualMFADevice' {Maybe [Tag]
Maybe Text
Text
virtualMFADeviceName :: Text
tags :: Maybe [Tag]
path :: Maybe Text
$sel:virtualMFADeviceName:CreateVirtualMFADevice' :: CreateVirtualMFADevice -> Text
$sel:tags:CreateVirtualMFADevice' :: CreateVirtualMFADevice -> Maybe [Tag]
$sel:path:CreateVirtualMFADevice' :: CreateVirtualMFADevice -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateVirtualMFADevice" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
ByteString
"Path" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
path,
ByteString
"Tags"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [Tag] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Tag] -> QueryString) -> Maybe [Tag] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags),
ByteString
"VirtualMFADeviceName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
virtualMFADeviceName
]
data CreateVirtualMFADeviceResponse = CreateVirtualMFADeviceResponse'
{
CreateVirtualMFADeviceResponse -> Int
httpStatus :: Prelude.Int,
CreateVirtualMFADeviceResponse -> VirtualMFADevice
virtualMFADevice :: VirtualMFADevice
}
deriving (CreateVirtualMFADeviceResponse
-> CreateVirtualMFADeviceResponse -> Bool
(CreateVirtualMFADeviceResponse
-> CreateVirtualMFADeviceResponse -> Bool)
-> (CreateVirtualMFADeviceResponse
-> CreateVirtualMFADeviceResponse -> Bool)
-> Eq CreateVirtualMFADeviceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateVirtualMFADeviceResponse
-> CreateVirtualMFADeviceResponse -> Bool
$c/= :: CreateVirtualMFADeviceResponse
-> CreateVirtualMFADeviceResponse -> Bool
== :: CreateVirtualMFADeviceResponse
-> CreateVirtualMFADeviceResponse -> Bool
$c== :: CreateVirtualMFADeviceResponse
-> CreateVirtualMFADeviceResponse -> Bool
Prelude.Eq, Int -> CreateVirtualMFADeviceResponse -> ShowS
[CreateVirtualMFADeviceResponse] -> ShowS
CreateVirtualMFADeviceResponse -> String
(Int -> CreateVirtualMFADeviceResponse -> ShowS)
-> (CreateVirtualMFADeviceResponse -> String)
-> ([CreateVirtualMFADeviceResponse] -> ShowS)
-> Show CreateVirtualMFADeviceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateVirtualMFADeviceResponse] -> ShowS
$cshowList :: [CreateVirtualMFADeviceResponse] -> ShowS
show :: CreateVirtualMFADeviceResponse -> String
$cshow :: CreateVirtualMFADeviceResponse -> String
showsPrec :: Int -> CreateVirtualMFADeviceResponse -> ShowS
$cshowsPrec :: Int -> CreateVirtualMFADeviceResponse -> ShowS
Prelude.Show, (forall x.
CreateVirtualMFADeviceResponse
-> Rep CreateVirtualMFADeviceResponse x)
-> (forall x.
Rep CreateVirtualMFADeviceResponse x
-> CreateVirtualMFADeviceResponse)
-> Generic CreateVirtualMFADeviceResponse
forall x.
Rep CreateVirtualMFADeviceResponse x
-> CreateVirtualMFADeviceResponse
forall x.
CreateVirtualMFADeviceResponse
-> Rep CreateVirtualMFADeviceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateVirtualMFADeviceResponse x
-> CreateVirtualMFADeviceResponse
$cfrom :: forall x.
CreateVirtualMFADeviceResponse
-> Rep CreateVirtualMFADeviceResponse x
Prelude.Generic)
newCreateVirtualMFADeviceResponse ::
Prelude.Int ->
VirtualMFADevice ->
CreateVirtualMFADeviceResponse
newCreateVirtualMFADeviceResponse :: Int -> VirtualMFADevice -> CreateVirtualMFADeviceResponse
newCreateVirtualMFADeviceResponse
Int
pHttpStatus_
VirtualMFADevice
pVirtualMFADevice_ =
CreateVirtualMFADeviceResponse' :: Int -> VirtualMFADevice -> CreateVirtualMFADeviceResponse
CreateVirtualMFADeviceResponse'
{ $sel:httpStatus:CreateVirtualMFADeviceResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:virtualMFADevice:CreateVirtualMFADeviceResponse' :: VirtualMFADevice
virtualMFADevice = VirtualMFADevice
pVirtualMFADevice_
}
createVirtualMFADeviceResponse_httpStatus :: Lens.Lens' CreateVirtualMFADeviceResponse Prelude.Int
createVirtualMFADeviceResponse_httpStatus :: (Int -> f Int)
-> CreateVirtualMFADeviceResponse
-> f CreateVirtualMFADeviceResponse
createVirtualMFADeviceResponse_httpStatus = (CreateVirtualMFADeviceResponse -> Int)
-> (CreateVirtualMFADeviceResponse
-> Int -> CreateVirtualMFADeviceResponse)
-> Lens
CreateVirtualMFADeviceResponse
CreateVirtualMFADeviceResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualMFADeviceResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateVirtualMFADeviceResponse' :: CreateVirtualMFADeviceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateVirtualMFADeviceResponse
s@CreateVirtualMFADeviceResponse' {} Int
a -> CreateVirtualMFADeviceResponse
s {$sel:httpStatus:CreateVirtualMFADeviceResponse' :: Int
httpStatus = Int
a} :: CreateVirtualMFADeviceResponse)
createVirtualMFADeviceResponse_virtualMFADevice :: Lens.Lens' CreateVirtualMFADeviceResponse VirtualMFADevice
createVirtualMFADeviceResponse_virtualMFADevice :: (VirtualMFADevice -> f VirtualMFADevice)
-> CreateVirtualMFADeviceResponse
-> f CreateVirtualMFADeviceResponse
createVirtualMFADeviceResponse_virtualMFADevice = (CreateVirtualMFADeviceResponse -> VirtualMFADevice)
-> (CreateVirtualMFADeviceResponse
-> VirtualMFADevice -> CreateVirtualMFADeviceResponse)
-> Lens
CreateVirtualMFADeviceResponse
CreateVirtualMFADeviceResponse
VirtualMFADevice
VirtualMFADevice
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateVirtualMFADeviceResponse' {VirtualMFADevice
virtualMFADevice :: VirtualMFADevice
$sel:virtualMFADevice:CreateVirtualMFADeviceResponse' :: CreateVirtualMFADeviceResponse -> VirtualMFADevice
virtualMFADevice} -> VirtualMFADevice
virtualMFADevice) (\s :: CreateVirtualMFADeviceResponse
s@CreateVirtualMFADeviceResponse' {} VirtualMFADevice
a -> CreateVirtualMFADeviceResponse
s {$sel:virtualMFADevice:CreateVirtualMFADeviceResponse' :: VirtualMFADevice
virtualMFADevice = VirtualMFADevice
a} :: CreateVirtualMFADeviceResponse)
instance
Prelude.NFData
CreateVirtualMFADeviceResponse