{-# 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.MwAA.CreateCliToken
(
CreateCliToken (..),
newCreateCliToken,
createCliToken_name,
CreateCliTokenResponse (..),
newCreateCliTokenResponse,
createCliTokenResponse_webServerHostname,
createCliTokenResponse_cliToken,
createCliTokenResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MwAA.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateCliToken = CreateCliToken'
{
CreateCliToken -> Text
name :: Prelude.Text
}
deriving (CreateCliToken -> CreateCliToken -> Bool
(CreateCliToken -> CreateCliToken -> Bool)
-> (CreateCliToken -> CreateCliToken -> Bool) -> Eq CreateCliToken
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCliToken -> CreateCliToken -> Bool
$c/= :: CreateCliToken -> CreateCliToken -> Bool
== :: CreateCliToken -> CreateCliToken -> Bool
$c== :: CreateCliToken -> CreateCliToken -> Bool
Prelude.Eq, ReadPrec [CreateCliToken]
ReadPrec CreateCliToken
Int -> ReadS CreateCliToken
ReadS [CreateCliToken]
(Int -> ReadS CreateCliToken)
-> ReadS [CreateCliToken]
-> ReadPrec CreateCliToken
-> ReadPrec [CreateCliToken]
-> Read CreateCliToken
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCliToken]
$creadListPrec :: ReadPrec [CreateCliToken]
readPrec :: ReadPrec CreateCliToken
$creadPrec :: ReadPrec CreateCliToken
readList :: ReadS [CreateCliToken]
$creadList :: ReadS [CreateCliToken]
readsPrec :: Int -> ReadS CreateCliToken
$creadsPrec :: Int -> ReadS CreateCliToken
Prelude.Read, Int -> CreateCliToken -> ShowS
[CreateCliToken] -> ShowS
CreateCliToken -> String
(Int -> CreateCliToken -> ShowS)
-> (CreateCliToken -> String)
-> ([CreateCliToken] -> ShowS)
-> Show CreateCliToken
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCliToken] -> ShowS
$cshowList :: [CreateCliToken] -> ShowS
show :: CreateCliToken -> String
$cshow :: CreateCliToken -> String
showsPrec :: Int -> CreateCliToken -> ShowS
$cshowsPrec :: Int -> CreateCliToken -> ShowS
Prelude.Show, (forall x. CreateCliToken -> Rep CreateCliToken x)
-> (forall x. Rep CreateCliToken x -> CreateCliToken)
-> Generic CreateCliToken
forall x. Rep CreateCliToken x -> CreateCliToken
forall x. CreateCliToken -> Rep CreateCliToken x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCliToken x -> CreateCliToken
$cfrom :: forall x. CreateCliToken -> Rep CreateCliToken x
Prelude.Generic)
newCreateCliToken ::
Prelude.Text ->
CreateCliToken
newCreateCliToken :: Text -> CreateCliToken
newCreateCliToken Text
pName_ =
CreateCliToken' :: Text -> CreateCliToken
CreateCliToken' {$sel:name:CreateCliToken' :: Text
name = Text
pName_}
createCliToken_name :: Lens.Lens' CreateCliToken Prelude.Text
createCliToken_name :: (Text -> f Text) -> CreateCliToken -> f CreateCliToken
createCliToken_name = (CreateCliToken -> Text)
-> (CreateCliToken -> Text -> CreateCliToken)
-> Lens CreateCliToken CreateCliToken Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCliToken' {Text
name :: Text
$sel:name:CreateCliToken' :: CreateCliToken -> Text
name} -> Text
name) (\s :: CreateCliToken
s@CreateCliToken' {} Text
a -> CreateCliToken
s {$sel:name:CreateCliToken' :: Text
name = Text
a} :: CreateCliToken)
instance Core.AWSRequest CreateCliToken where
type
AWSResponse CreateCliToken =
CreateCliTokenResponse
request :: CreateCliToken -> Request CreateCliToken
request = Service -> CreateCliToken -> Request CreateCliToken
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateCliToken
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateCliToken)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateCliToken))
-> Logger
-> Service
-> Proxy CreateCliToken
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateCliToken)))
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 Text
-> Maybe (Sensitive Text) -> Int -> CreateCliTokenResponse
CreateCliTokenResponse'
(Maybe Text
-> Maybe (Sensitive Text) -> Int -> CreateCliTokenResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe (Sensitive Text) -> Int -> CreateCliTokenResponse)
forall (f :: * -> *) a b. Functor 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
"WebServerHostname")
Either
String (Maybe (Sensitive Text) -> Int -> CreateCliTokenResponse)
-> Either String (Maybe (Sensitive Text))
-> Either String (Int -> CreateCliTokenResponse)
forall (f :: * -> *) a b. Applicative f => 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
"CliToken")
Either String (Int -> CreateCliTokenResponse)
-> Either String Int -> Either String CreateCliTokenResponse
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 CreateCliToken
instance Prelude.NFData CreateCliToken
instance Core.ToHeaders CreateCliToken where
toHeaders :: CreateCliToken -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateCliToken -> 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 CreateCliToken where
toJSON :: CreateCliToken -> Value
toJSON = Value -> CreateCliToken -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath CreateCliToken where
toPath :: CreateCliToken -> ByteString
toPath CreateCliToken' {Text
name :: Text
$sel:name:CreateCliToken' :: CreateCliToken -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/clitoken/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name]
instance Core.ToQuery CreateCliToken where
toQuery :: CreateCliToken -> QueryString
toQuery = QueryString -> CreateCliToken -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateCliTokenResponse = CreateCliTokenResponse'
{
CreateCliTokenResponse -> Maybe Text
webServerHostname :: Prelude.Maybe Prelude.Text,
CreateCliTokenResponse -> Maybe (Sensitive Text)
cliToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
CreateCliTokenResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateCliTokenResponse -> CreateCliTokenResponse -> Bool
(CreateCliTokenResponse -> CreateCliTokenResponse -> Bool)
-> (CreateCliTokenResponse -> CreateCliTokenResponse -> Bool)
-> Eq CreateCliTokenResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCliTokenResponse -> CreateCliTokenResponse -> Bool
$c/= :: CreateCliTokenResponse -> CreateCliTokenResponse -> Bool
== :: CreateCliTokenResponse -> CreateCliTokenResponse -> Bool
$c== :: CreateCliTokenResponse -> CreateCliTokenResponse -> Bool
Prelude.Eq, Int -> CreateCliTokenResponse -> ShowS
[CreateCliTokenResponse] -> ShowS
CreateCliTokenResponse -> String
(Int -> CreateCliTokenResponse -> ShowS)
-> (CreateCliTokenResponse -> String)
-> ([CreateCliTokenResponse] -> ShowS)
-> Show CreateCliTokenResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCliTokenResponse] -> ShowS
$cshowList :: [CreateCliTokenResponse] -> ShowS
show :: CreateCliTokenResponse -> String
$cshow :: CreateCliTokenResponse -> String
showsPrec :: Int -> CreateCliTokenResponse -> ShowS
$cshowsPrec :: Int -> CreateCliTokenResponse -> ShowS
Prelude.Show, (forall x. CreateCliTokenResponse -> Rep CreateCliTokenResponse x)
-> (forall x.
Rep CreateCliTokenResponse x -> CreateCliTokenResponse)
-> Generic CreateCliTokenResponse
forall x. Rep CreateCliTokenResponse x -> CreateCliTokenResponse
forall x. CreateCliTokenResponse -> Rep CreateCliTokenResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCliTokenResponse x -> CreateCliTokenResponse
$cfrom :: forall x. CreateCliTokenResponse -> Rep CreateCliTokenResponse x
Prelude.Generic)
newCreateCliTokenResponse ::
Prelude.Int ->
CreateCliTokenResponse
newCreateCliTokenResponse :: Int -> CreateCliTokenResponse
newCreateCliTokenResponse Int
pHttpStatus_ =
CreateCliTokenResponse' :: Maybe Text
-> Maybe (Sensitive Text) -> Int -> CreateCliTokenResponse
CreateCliTokenResponse'
{ $sel:webServerHostname:CreateCliTokenResponse' :: Maybe Text
webServerHostname =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:cliToken:CreateCliTokenResponse' :: Maybe (Sensitive Text)
cliToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateCliTokenResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createCliTokenResponse_webServerHostname :: Lens.Lens' CreateCliTokenResponse (Prelude.Maybe Prelude.Text)
createCliTokenResponse_webServerHostname :: (Maybe Text -> f (Maybe Text))
-> CreateCliTokenResponse -> f CreateCliTokenResponse
createCliTokenResponse_webServerHostname = (CreateCliTokenResponse -> Maybe Text)
-> (CreateCliTokenResponse -> Maybe Text -> CreateCliTokenResponse)
-> Lens
CreateCliTokenResponse
CreateCliTokenResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCliTokenResponse' {Maybe Text
webServerHostname :: Maybe Text
$sel:webServerHostname:CreateCliTokenResponse' :: CreateCliTokenResponse -> Maybe Text
webServerHostname} -> Maybe Text
webServerHostname) (\s :: CreateCliTokenResponse
s@CreateCliTokenResponse' {} Maybe Text
a -> CreateCliTokenResponse
s {$sel:webServerHostname:CreateCliTokenResponse' :: Maybe Text
webServerHostname = Maybe Text
a} :: CreateCliTokenResponse)
createCliTokenResponse_cliToken :: Lens.Lens' CreateCliTokenResponse (Prelude.Maybe Prelude.Text)
createCliTokenResponse_cliToken :: (Maybe Text -> f (Maybe Text))
-> CreateCliTokenResponse -> f CreateCliTokenResponse
createCliTokenResponse_cliToken = (CreateCliTokenResponse -> Maybe (Sensitive Text))
-> (CreateCliTokenResponse
-> Maybe (Sensitive Text) -> CreateCliTokenResponse)
-> Lens
CreateCliTokenResponse
CreateCliTokenResponse
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCliTokenResponse' {Maybe (Sensitive Text)
cliToken :: Maybe (Sensitive Text)
$sel:cliToken:CreateCliTokenResponse' :: CreateCliTokenResponse -> Maybe (Sensitive Text)
cliToken} -> Maybe (Sensitive Text)
cliToken) (\s :: CreateCliTokenResponse
s@CreateCliTokenResponse' {} Maybe (Sensitive Text)
a -> CreateCliTokenResponse
s {$sel:cliToken:CreateCliTokenResponse' :: Maybe (Sensitive Text)
cliToken = Maybe (Sensitive Text)
a} :: CreateCliTokenResponse) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> CreateCliTokenResponse -> f CreateCliTokenResponse)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateCliTokenResponse
-> f CreateCliTokenResponse
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
createCliTokenResponse_httpStatus :: Lens.Lens' CreateCliTokenResponse Prelude.Int
createCliTokenResponse_httpStatus :: (Int -> f Int)
-> CreateCliTokenResponse -> f CreateCliTokenResponse
createCliTokenResponse_httpStatus = (CreateCliTokenResponse -> Int)
-> (CreateCliTokenResponse -> Int -> CreateCliTokenResponse)
-> Lens CreateCliTokenResponse CreateCliTokenResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCliTokenResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCliTokenResponse' :: CreateCliTokenResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCliTokenResponse
s@CreateCliTokenResponse' {} Int
a -> CreateCliTokenResponse
s {$sel:httpStatus:CreateCliTokenResponse' :: Int
httpStatus = Int
a} :: CreateCliTokenResponse)
instance Prelude.NFData CreateCliTokenResponse