{-# 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.StorageGateway.SetLocalConsolePassword
(
SetLocalConsolePassword (..),
newSetLocalConsolePassword,
setLocalConsolePassword_gatewayARN,
setLocalConsolePassword_localConsolePassword,
SetLocalConsolePasswordResponse (..),
newSetLocalConsolePasswordResponse,
setLocalConsolePasswordResponse_gatewayARN,
setLocalConsolePasswordResponse_httpStatus,
)
where
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
import Amazonka.StorageGateway.Types
data SetLocalConsolePassword = SetLocalConsolePassword'
{ SetLocalConsolePassword -> Text
gatewayARN :: Prelude.Text,
SetLocalConsolePassword -> Sensitive Text
localConsolePassword :: Core.Sensitive Prelude.Text
}
deriving (SetLocalConsolePassword -> SetLocalConsolePassword -> Bool
(SetLocalConsolePassword -> SetLocalConsolePassword -> Bool)
-> (SetLocalConsolePassword -> SetLocalConsolePassword -> Bool)
-> Eq SetLocalConsolePassword
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetLocalConsolePassword -> SetLocalConsolePassword -> Bool
$c/= :: SetLocalConsolePassword -> SetLocalConsolePassword -> Bool
== :: SetLocalConsolePassword -> SetLocalConsolePassword -> Bool
$c== :: SetLocalConsolePassword -> SetLocalConsolePassword -> Bool
Prelude.Eq, Int -> SetLocalConsolePassword -> ShowS
[SetLocalConsolePassword] -> ShowS
SetLocalConsolePassword -> String
(Int -> SetLocalConsolePassword -> ShowS)
-> (SetLocalConsolePassword -> String)
-> ([SetLocalConsolePassword] -> ShowS)
-> Show SetLocalConsolePassword
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetLocalConsolePassword] -> ShowS
$cshowList :: [SetLocalConsolePassword] -> ShowS
show :: SetLocalConsolePassword -> String
$cshow :: SetLocalConsolePassword -> String
showsPrec :: Int -> SetLocalConsolePassword -> ShowS
$cshowsPrec :: Int -> SetLocalConsolePassword -> ShowS
Prelude.Show, (forall x.
SetLocalConsolePassword -> Rep SetLocalConsolePassword x)
-> (forall x.
Rep SetLocalConsolePassword x -> SetLocalConsolePassword)
-> Generic SetLocalConsolePassword
forall x. Rep SetLocalConsolePassword x -> SetLocalConsolePassword
forall x. SetLocalConsolePassword -> Rep SetLocalConsolePassword x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetLocalConsolePassword x -> SetLocalConsolePassword
$cfrom :: forall x. SetLocalConsolePassword -> Rep SetLocalConsolePassword x
Prelude.Generic)
newSetLocalConsolePassword ::
Prelude.Text ->
Prelude.Text ->
SetLocalConsolePassword
newSetLocalConsolePassword :: Text -> Text -> SetLocalConsolePassword
newSetLocalConsolePassword
Text
pGatewayARN_
Text
pLocalConsolePassword_ =
SetLocalConsolePassword' :: Text -> Sensitive Text -> SetLocalConsolePassword
SetLocalConsolePassword'
{ $sel:gatewayARN:SetLocalConsolePassword' :: Text
gatewayARN = Text
pGatewayARN_,
$sel:localConsolePassword:SetLocalConsolePassword' :: Sensitive Text
localConsolePassword =
Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pLocalConsolePassword_
}
setLocalConsolePassword_gatewayARN :: Lens.Lens' SetLocalConsolePassword Prelude.Text
setLocalConsolePassword_gatewayARN :: (Text -> f Text)
-> SetLocalConsolePassword -> f SetLocalConsolePassword
setLocalConsolePassword_gatewayARN = (SetLocalConsolePassword -> Text)
-> (SetLocalConsolePassword -> Text -> SetLocalConsolePassword)
-> Lens SetLocalConsolePassword SetLocalConsolePassword Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetLocalConsolePassword' {Text
gatewayARN :: Text
$sel:gatewayARN:SetLocalConsolePassword' :: SetLocalConsolePassword -> Text
gatewayARN} -> Text
gatewayARN) (\s :: SetLocalConsolePassword
s@SetLocalConsolePassword' {} Text
a -> SetLocalConsolePassword
s {$sel:gatewayARN:SetLocalConsolePassword' :: Text
gatewayARN = Text
a} :: SetLocalConsolePassword)
setLocalConsolePassword_localConsolePassword :: Lens.Lens' SetLocalConsolePassword Prelude.Text
setLocalConsolePassword_localConsolePassword :: (Text -> f Text)
-> SetLocalConsolePassword -> f SetLocalConsolePassword
setLocalConsolePassword_localConsolePassword = (SetLocalConsolePassword -> Sensitive Text)
-> (SetLocalConsolePassword
-> Sensitive Text -> SetLocalConsolePassword)
-> Lens
SetLocalConsolePassword
SetLocalConsolePassword
(Sensitive Text)
(Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetLocalConsolePassword' {Sensitive Text
localConsolePassword :: Sensitive Text
$sel:localConsolePassword:SetLocalConsolePassword' :: SetLocalConsolePassword -> Sensitive Text
localConsolePassword} -> Sensitive Text
localConsolePassword) (\s :: SetLocalConsolePassword
s@SetLocalConsolePassword' {} Sensitive Text
a -> SetLocalConsolePassword
s {$sel:localConsolePassword:SetLocalConsolePassword' :: Sensitive Text
localConsolePassword = Sensitive Text
a} :: SetLocalConsolePassword) ((Sensitive Text -> f (Sensitive Text))
-> SetLocalConsolePassword -> f SetLocalConsolePassword)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> SetLocalConsolePassword
-> f SetLocalConsolePassword
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
instance Core.AWSRequest SetLocalConsolePassword where
type
AWSResponse SetLocalConsolePassword =
SetLocalConsolePasswordResponse
request :: SetLocalConsolePassword -> Request SetLocalConsolePassword
request = Service
-> SetLocalConsolePassword -> Request SetLocalConsolePassword
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SetLocalConsolePassword
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetLocalConsolePassword)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse SetLocalConsolePassword))
-> Logger
-> Service
-> Proxy SetLocalConsolePassword
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetLocalConsolePassword)))
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 -> Int -> SetLocalConsolePasswordResponse
SetLocalConsolePasswordResponse'
(Maybe Text -> Int -> SetLocalConsolePasswordResponse)
-> Either String (Maybe Text)
-> Either String (Int -> SetLocalConsolePasswordResponse)
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
"GatewayARN")
Either String (Int -> SetLocalConsolePasswordResponse)
-> Either String Int
-> Either String SetLocalConsolePasswordResponse
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 SetLocalConsolePassword
instance Prelude.NFData SetLocalConsolePassword
instance Core.ToHeaders SetLocalConsolePassword where
toHeaders :: SetLocalConsolePassword -> ResponseHeaders
toHeaders =
ResponseHeaders -> SetLocalConsolePassword -> 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
"StorageGateway_20130630.SetLocalConsolePassword" ::
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 SetLocalConsolePassword where
toJSON :: SetLocalConsolePassword -> Value
toJSON SetLocalConsolePassword' {Text
Sensitive Text
localConsolePassword :: Sensitive Text
gatewayARN :: Text
$sel:localConsolePassword:SetLocalConsolePassword' :: SetLocalConsolePassword -> Sensitive Text
$sel:gatewayARN:SetLocalConsolePassword' :: SetLocalConsolePassword -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GatewayARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
gatewayARN),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"LocalConsolePassword"
Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
localConsolePassword
)
]
)
instance Core.ToPath SetLocalConsolePassword where
toPath :: SetLocalConsolePassword -> ByteString
toPath = ByteString -> SetLocalConsolePassword -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery SetLocalConsolePassword where
toQuery :: SetLocalConsolePassword -> QueryString
toQuery = QueryString -> SetLocalConsolePassword -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SetLocalConsolePasswordResponse = SetLocalConsolePasswordResponse'
{ SetLocalConsolePasswordResponse -> Maybe Text
gatewayARN :: Prelude.Maybe Prelude.Text,
SetLocalConsolePasswordResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SetLocalConsolePasswordResponse
-> SetLocalConsolePasswordResponse -> Bool
(SetLocalConsolePasswordResponse
-> SetLocalConsolePasswordResponse -> Bool)
-> (SetLocalConsolePasswordResponse
-> SetLocalConsolePasswordResponse -> Bool)
-> Eq SetLocalConsolePasswordResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetLocalConsolePasswordResponse
-> SetLocalConsolePasswordResponse -> Bool
$c/= :: SetLocalConsolePasswordResponse
-> SetLocalConsolePasswordResponse -> Bool
== :: SetLocalConsolePasswordResponse
-> SetLocalConsolePasswordResponse -> Bool
$c== :: SetLocalConsolePasswordResponse
-> SetLocalConsolePasswordResponse -> Bool
Prelude.Eq, ReadPrec [SetLocalConsolePasswordResponse]
ReadPrec SetLocalConsolePasswordResponse
Int -> ReadS SetLocalConsolePasswordResponse
ReadS [SetLocalConsolePasswordResponse]
(Int -> ReadS SetLocalConsolePasswordResponse)
-> ReadS [SetLocalConsolePasswordResponse]
-> ReadPrec SetLocalConsolePasswordResponse
-> ReadPrec [SetLocalConsolePasswordResponse]
-> Read SetLocalConsolePasswordResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetLocalConsolePasswordResponse]
$creadListPrec :: ReadPrec [SetLocalConsolePasswordResponse]
readPrec :: ReadPrec SetLocalConsolePasswordResponse
$creadPrec :: ReadPrec SetLocalConsolePasswordResponse
readList :: ReadS [SetLocalConsolePasswordResponse]
$creadList :: ReadS [SetLocalConsolePasswordResponse]
readsPrec :: Int -> ReadS SetLocalConsolePasswordResponse
$creadsPrec :: Int -> ReadS SetLocalConsolePasswordResponse
Prelude.Read, Int -> SetLocalConsolePasswordResponse -> ShowS
[SetLocalConsolePasswordResponse] -> ShowS
SetLocalConsolePasswordResponse -> String
(Int -> SetLocalConsolePasswordResponse -> ShowS)
-> (SetLocalConsolePasswordResponse -> String)
-> ([SetLocalConsolePasswordResponse] -> ShowS)
-> Show SetLocalConsolePasswordResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetLocalConsolePasswordResponse] -> ShowS
$cshowList :: [SetLocalConsolePasswordResponse] -> ShowS
show :: SetLocalConsolePasswordResponse -> String
$cshow :: SetLocalConsolePasswordResponse -> String
showsPrec :: Int -> SetLocalConsolePasswordResponse -> ShowS
$cshowsPrec :: Int -> SetLocalConsolePasswordResponse -> ShowS
Prelude.Show, (forall x.
SetLocalConsolePasswordResponse
-> Rep SetLocalConsolePasswordResponse x)
-> (forall x.
Rep SetLocalConsolePasswordResponse x
-> SetLocalConsolePasswordResponse)
-> Generic SetLocalConsolePasswordResponse
forall x.
Rep SetLocalConsolePasswordResponse x
-> SetLocalConsolePasswordResponse
forall x.
SetLocalConsolePasswordResponse
-> Rep SetLocalConsolePasswordResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetLocalConsolePasswordResponse x
-> SetLocalConsolePasswordResponse
$cfrom :: forall x.
SetLocalConsolePasswordResponse
-> Rep SetLocalConsolePasswordResponse x
Prelude.Generic)
newSetLocalConsolePasswordResponse ::
Prelude.Int ->
SetLocalConsolePasswordResponse
newSetLocalConsolePasswordResponse :: Int -> SetLocalConsolePasswordResponse
newSetLocalConsolePasswordResponse Int
pHttpStatus_ =
SetLocalConsolePasswordResponse' :: Maybe Text -> Int -> SetLocalConsolePasswordResponse
SetLocalConsolePasswordResponse'
{ $sel:gatewayARN:SetLocalConsolePasswordResponse' :: Maybe Text
gatewayARN =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:SetLocalConsolePasswordResponse' :: Int
httpStatus = Int
pHttpStatus_
}
setLocalConsolePasswordResponse_gatewayARN :: Lens.Lens' SetLocalConsolePasswordResponse (Prelude.Maybe Prelude.Text)
setLocalConsolePasswordResponse_gatewayARN :: (Maybe Text -> f (Maybe Text))
-> SetLocalConsolePasswordResponse
-> f SetLocalConsolePasswordResponse
setLocalConsolePasswordResponse_gatewayARN = (SetLocalConsolePasswordResponse -> Maybe Text)
-> (SetLocalConsolePasswordResponse
-> Maybe Text -> SetLocalConsolePasswordResponse)
-> Lens
SetLocalConsolePasswordResponse
SetLocalConsolePasswordResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetLocalConsolePasswordResponse' {Maybe Text
gatewayARN :: Maybe Text
$sel:gatewayARN:SetLocalConsolePasswordResponse' :: SetLocalConsolePasswordResponse -> Maybe Text
gatewayARN} -> Maybe Text
gatewayARN) (\s :: SetLocalConsolePasswordResponse
s@SetLocalConsolePasswordResponse' {} Maybe Text
a -> SetLocalConsolePasswordResponse
s {$sel:gatewayARN:SetLocalConsolePasswordResponse' :: Maybe Text
gatewayARN = Maybe Text
a} :: SetLocalConsolePasswordResponse)
setLocalConsolePasswordResponse_httpStatus :: Lens.Lens' SetLocalConsolePasswordResponse Prelude.Int
setLocalConsolePasswordResponse_httpStatus :: (Int -> f Int)
-> SetLocalConsolePasswordResponse
-> f SetLocalConsolePasswordResponse
setLocalConsolePasswordResponse_httpStatus = (SetLocalConsolePasswordResponse -> Int)
-> (SetLocalConsolePasswordResponse
-> Int -> SetLocalConsolePasswordResponse)
-> Lens
SetLocalConsolePasswordResponse
SetLocalConsolePasswordResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetLocalConsolePasswordResponse' {Int
httpStatus :: Int
$sel:httpStatus:SetLocalConsolePasswordResponse' :: SetLocalConsolePasswordResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SetLocalConsolePasswordResponse
s@SetLocalConsolePasswordResponse' {} Int
a -> SetLocalConsolePasswordResponse
s {$sel:httpStatus:SetLocalConsolePasswordResponse' :: Int
httpStatus = Int
a} :: SetLocalConsolePasswordResponse)
instance
Prelude.NFData
SetLocalConsolePasswordResponse