{-# 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.DescribeChapCredentials
(
DescribeChapCredentials (..),
newDescribeChapCredentials,
describeChapCredentials_targetARN,
DescribeChapCredentialsResponse (..),
newDescribeChapCredentialsResponse,
describeChapCredentialsResponse_chapCredentials,
describeChapCredentialsResponse_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 DescribeChapCredentials = DescribeChapCredentials'
{
DescribeChapCredentials -> Text
targetARN :: Prelude.Text
}
deriving (DescribeChapCredentials -> DescribeChapCredentials -> Bool
(DescribeChapCredentials -> DescribeChapCredentials -> Bool)
-> (DescribeChapCredentials -> DescribeChapCredentials -> Bool)
-> Eq DescribeChapCredentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeChapCredentials -> DescribeChapCredentials -> Bool
$c/= :: DescribeChapCredentials -> DescribeChapCredentials -> Bool
== :: DescribeChapCredentials -> DescribeChapCredentials -> Bool
$c== :: DescribeChapCredentials -> DescribeChapCredentials -> Bool
Prelude.Eq, ReadPrec [DescribeChapCredentials]
ReadPrec DescribeChapCredentials
Int -> ReadS DescribeChapCredentials
ReadS [DescribeChapCredentials]
(Int -> ReadS DescribeChapCredentials)
-> ReadS [DescribeChapCredentials]
-> ReadPrec DescribeChapCredentials
-> ReadPrec [DescribeChapCredentials]
-> Read DescribeChapCredentials
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeChapCredentials]
$creadListPrec :: ReadPrec [DescribeChapCredentials]
readPrec :: ReadPrec DescribeChapCredentials
$creadPrec :: ReadPrec DescribeChapCredentials
readList :: ReadS [DescribeChapCredentials]
$creadList :: ReadS [DescribeChapCredentials]
readsPrec :: Int -> ReadS DescribeChapCredentials
$creadsPrec :: Int -> ReadS DescribeChapCredentials
Prelude.Read, Int -> DescribeChapCredentials -> ShowS
[DescribeChapCredentials] -> ShowS
DescribeChapCredentials -> String
(Int -> DescribeChapCredentials -> ShowS)
-> (DescribeChapCredentials -> String)
-> ([DescribeChapCredentials] -> ShowS)
-> Show DescribeChapCredentials
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeChapCredentials] -> ShowS
$cshowList :: [DescribeChapCredentials] -> ShowS
show :: DescribeChapCredentials -> String
$cshow :: DescribeChapCredentials -> String
showsPrec :: Int -> DescribeChapCredentials -> ShowS
$cshowsPrec :: Int -> DescribeChapCredentials -> ShowS
Prelude.Show, (forall x.
DescribeChapCredentials -> Rep DescribeChapCredentials x)
-> (forall x.
Rep DescribeChapCredentials x -> DescribeChapCredentials)
-> Generic DescribeChapCredentials
forall x. Rep DescribeChapCredentials x -> DescribeChapCredentials
forall x. DescribeChapCredentials -> Rep DescribeChapCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeChapCredentials x -> DescribeChapCredentials
$cfrom :: forall x. DescribeChapCredentials -> Rep DescribeChapCredentials x
Prelude.Generic)
newDescribeChapCredentials ::
Prelude.Text ->
DescribeChapCredentials
newDescribeChapCredentials :: Text -> DescribeChapCredentials
newDescribeChapCredentials Text
pTargetARN_ =
DescribeChapCredentials' :: Text -> DescribeChapCredentials
DescribeChapCredentials' {$sel:targetARN:DescribeChapCredentials' :: Text
targetARN = Text
pTargetARN_}
describeChapCredentials_targetARN :: Lens.Lens' DescribeChapCredentials Prelude.Text
describeChapCredentials_targetARN :: (Text -> f Text)
-> DescribeChapCredentials -> f DescribeChapCredentials
describeChapCredentials_targetARN = (DescribeChapCredentials -> Text)
-> (DescribeChapCredentials -> Text -> DescribeChapCredentials)
-> Lens DescribeChapCredentials DescribeChapCredentials Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChapCredentials' {Text
targetARN :: Text
$sel:targetARN:DescribeChapCredentials' :: DescribeChapCredentials -> Text
targetARN} -> Text
targetARN) (\s :: DescribeChapCredentials
s@DescribeChapCredentials' {} Text
a -> DescribeChapCredentials
s {$sel:targetARN:DescribeChapCredentials' :: Text
targetARN = Text
a} :: DescribeChapCredentials)
instance Core.AWSRequest DescribeChapCredentials where
type
AWSResponse DescribeChapCredentials =
DescribeChapCredentialsResponse
request :: DescribeChapCredentials -> Request DescribeChapCredentials
request = Service
-> DescribeChapCredentials -> Request DescribeChapCredentials
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeChapCredentials
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeChapCredentials)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeChapCredentials))
-> Logger
-> Service
-> Proxy DescribeChapCredentials
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeChapCredentials)))
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 [ChapInfo] -> Int -> DescribeChapCredentialsResponse
DescribeChapCredentialsResponse'
(Maybe [ChapInfo] -> Int -> DescribeChapCredentialsResponse)
-> Either String (Maybe [ChapInfo])
-> Either String (Int -> DescribeChapCredentialsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [ChapInfo]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ChapCredentials"
Either String (Maybe (Maybe [ChapInfo]))
-> Maybe [ChapInfo] -> Either String (Maybe [ChapInfo])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ChapInfo]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> DescribeChapCredentialsResponse)
-> Either String Int
-> Either String DescribeChapCredentialsResponse
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 DescribeChapCredentials
instance Prelude.NFData DescribeChapCredentials
instance Core.ToHeaders DescribeChapCredentials where
toHeaders :: DescribeChapCredentials -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeChapCredentials -> 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.DescribeChapCredentials" ::
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 DescribeChapCredentials where
toJSON :: DescribeChapCredentials -> Value
toJSON DescribeChapCredentials' {Text
targetARN :: Text
$sel:targetARN:DescribeChapCredentials' :: DescribeChapCredentials -> 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
"TargetARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
targetARN)]
)
instance Core.ToPath DescribeChapCredentials where
toPath :: DescribeChapCredentials -> ByteString
toPath = ByteString -> DescribeChapCredentials -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeChapCredentials where
toQuery :: DescribeChapCredentials -> QueryString
toQuery = QueryString -> DescribeChapCredentials -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeChapCredentialsResponse = DescribeChapCredentialsResponse'
{
DescribeChapCredentialsResponse -> Maybe [ChapInfo]
chapCredentials :: Prelude.Maybe [ChapInfo],
DescribeChapCredentialsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeChapCredentialsResponse
-> DescribeChapCredentialsResponse -> Bool
(DescribeChapCredentialsResponse
-> DescribeChapCredentialsResponse -> Bool)
-> (DescribeChapCredentialsResponse
-> DescribeChapCredentialsResponse -> Bool)
-> Eq DescribeChapCredentialsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeChapCredentialsResponse
-> DescribeChapCredentialsResponse -> Bool
$c/= :: DescribeChapCredentialsResponse
-> DescribeChapCredentialsResponse -> Bool
== :: DescribeChapCredentialsResponse
-> DescribeChapCredentialsResponse -> Bool
$c== :: DescribeChapCredentialsResponse
-> DescribeChapCredentialsResponse -> Bool
Prelude.Eq, Int -> DescribeChapCredentialsResponse -> ShowS
[DescribeChapCredentialsResponse] -> ShowS
DescribeChapCredentialsResponse -> String
(Int -> DescribeChapCredentialsResponse -> ShowS)
-> (DescribeChapCredentialsResponse -> String)
-> ([DescribeChapCredentialsResponse] -> ShowS)
-> Show DescribeChapCredentialsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeChapCredentialsResponse] -> ShowS
$cshowList :: [DescribeChapCredentialsResponse] -> ShowS
show :: DescribeChapCredentialsResponse -> String
$cshow :: DescribeChapCredentialsResponse -> String
showsPrec :: Int -> DescribeChapCredentialsResponse -> ShowS
$cshowsPrec :: Int -> DescribeChapCredentialsResponse -> ShowS
Prelude.Show, (forall x.
DescribeChapCredentialsResponse
-> Rep DescribeChapCredentialsResponse x)
-> (forall x.
Rep DescribeChapCredentialsResponse x
-> DescribeChapCredentialsResponse)
-> Generic DescribeChapCredentialsResponse
forall x.
Rep DescribeChapCredentialsResponse x
-> DescribeChapCredentialsResponse
forall x.
DescribeChapCredentialsResponse
-> Rep DescribeChapCredentialsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeChapCredentialsResponse x
-> DescribeChapCredentialsResponse
$cfrom :: forall x.
DescribeChapCredentialsResponse
-> Rep DescribeChapCredentialsResponse x
Prelude.Generic)
newDescribeChapCredentialsResponse ::
Prelude.Int ->
DescribeChapCredentialsResponse
newDescribeChapCredentialsResponse :: Int -> DescribeChapCredentialsResponse
newDescribeChapCredentialsResponse Int
pHttpStatus_ =
DescribeChapCredentialsResponse' :: Maybe [ChapInfo] -> Int -> DescribeChapCredentialsResponse
DescribeChapCredentialsResponse'
{ $sel:chapCredentials:DescribeChapCredentialsResponse' :: Maybe [ChapInfo]
chapCredentials =
Maybe [ChapInfo]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeChapCredentialsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeChapCredentialsResponse_chapCredentials :: Lens.Lens' DescribeChapCredentialsResponse (Prelude.Maybe [ChapInfo])
describeChapCredentialsResponse_chapCredentials :: (Maybe [ChapInfo] -> f (Maybe [ChapInfo]))
-> DescribeChapCredentialsResponse
-> f DescribeChapCredentialsResponse
describeChapCredentialsResponse_chapCredentials = (DescribeChapCredentialsResponse -> Maybe [ChapInfo])
-> (DescribeChapCredentialsResponse
-> Maybe [ChapInfo] -> DescribeChapCredentialsResponse)
-> Lens
DescribeChapCredentialsResponse
DescribeChapCredentialsResponse
(Maybe [ChapInfo])
(Maybe [ChapInfo])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChapCredentialsResponse' {Maybe [ChapInfo]
chapCredentials :: Maybe [ChapInfo]
$sel:chapCredentials:DescribeChapCredentialsResponse' :: DescribeChapCredentialsResponse -> Maybe [ChapInfo]
chapCredentials} -> Maybe [ChapInfo]
chapCredentials) (\s :: DescribeChapCredentialsResponse
s@DescribeChapCredentialsResponse' {} Maybe [ChapInfo]
a -> DescribeChapCredentialsResponse
s {$sel:chapCredentials:DescribeChapCredentialsResponse' :: Maybe [ChapInfo]
chapCredentials = Maybe [ChapInfo]
a} :: DescribeChapCredentialsResponse) ((Maybe [ChapInfo] -> f (Maybe [ChapInfo]))
-> DescribeChapCredentialsResponse
-> f DescribeChapCredentialsResponse)
-> ((Maybe [ChapInfo] -> f (Maybe [ChapInfo]))
-> Maybe [ChapInfo] -> f (Maybe [ChapInfo]))
-> (Maybe [ChapInfo] -> f (Maybe [ChapInfo]))
-> DescribeChapCredentialsResponse
-> f DescribeChapCredentialsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ChapInfo] [ChapInfo] [ChapInfo] [ChapInfo]
-> Iso
(Maybe [ChapInfo])
(Maybe [ChapInfo])
(Maybe [ChapInfo])
(Maybe [ChapInfo])
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 [ChapInfo] [ChapInfo] [ChapInfo] [ChapInfo]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeChapCredentialsResponse_httpStatus :: Lens.Lens' DescribeChapCredentialsResponse Prelude.Int
describeChapCredentialsResponse_httpStatus :: (Int -> f Int)
-> DescribeChapCredentialsResponse
-> f DescribeChapCredentialsResponse
describeChapCredentialsResponse_httpStatus = (DescribeChapCredentialsResponse -> Int)
-> (DescribeChapCredentialsResponse
-> Int -> DescribeChapCredentialsResponse)
-> Lens
DescribeChapCredentialsResponse
DescribeChapCredentialsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChapCredentialsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeChapCredentialsResponse' :: DescribeChapCredentialsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeChapCredentialsResponse
s@DescribeChapCredentialsResponse' {} Int
a -> DescribeChapCredentialsResponse
s {$sel:httpStatus:DescribeChapCredentialsResponse' :: Int
httpStatus = Int
a} :: DescribeChapCredentialsResponse)
instance
Prelude.NFData
DescribeChapCredentialsResponse