{-# 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.Mobile.DescribeBundle
(
DescribeBundle (..),
newDescribeBundle,
describeBundle_bundleId,
DescribeBundleResponse (..),
newDescribeBundleResponse,
describeBundleResponse_details,
describeBundleResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Mobile.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeBundle = DescribeBundle'
{
DescribeBundle -> Text
bundleId :: Prelude.Text
}
deriving (DescribeBundle -> DescribeBundle -> Bool
(DescribeBundle -> DescribeBundle -> Bool)
-> (DescribeBundle -> DescribeBundle -> Bool) -> Eq DescribeBundle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeBundle -> DescribeBundle -> Bool
$c/= :: DescribeBundle -> DescribeBundle -> Bool
== :: DescribeBundle -> DescribeBundle -> Bool
$c== :: DescribeBundle -> DescribeBundle -> Bool
Prelude.Eq, ReadPrec [DescribeBundle]
ReadPrec DescribeBundle
Int -> ReadS DescribeBundle
ReadS [DescribeBundle]
(Int -> ReadS DescribeBundle)
-> ReadS [DescribeBundle]
-> ReadPrec DescribeBundle
-> ReadPrec [DescribeBundle]
-> Read DescribeBundle
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeBundle]
$creadListPrec :: ReadPrec [DescribeBundle]
readPrec :: ReadPrec DescribeBundle
$creadPrec :: ReadPrec DescribeBundle
readList :: ReadS [DescribeBundle]
$creadList :: ReadS [DescribeBundle]
readsPrec :: Int -> ReadS DescribeBundle
$creadsPrec :: Int -> ReadS DescribeBundle
Prelude.Read, Int -> DescribeBundle -> ShowS
[DescribeBundle] -> ShowS
DescribeBundle -> String
(Int -> DescribeBundle -> ShowS)
-> (DescribeBundle -> String)
-> ([DescribeBundle] -> ShowS)
-> Show DescribeBundle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeBundle] -> ShowS
$cshowList :: [DescribeBundle] -> ShowS
show :: DescribeBundle -> String
$cshow :: DescribeBundle -> String
showsPrec :: Int -> DescribeBundle -> ShowS
$cshowsPrec :: Int -> DescribeBundle -> ShowS
Prelude.Show, (forall x. DescribeBundle -> Rep DescribeBundle x)
-> (forall x. Rep DescribeBundle x -> DescribeBundle)
-> Generic DescribeBundle
forall x. Rep DescribeBundle x -> DescribeBundle
forall x. DescribeBundle -> Rep DescribeBundle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeBundle x -> DescribeBundle
$cfrom :: forall x. DescribeBundle -> Rep DescribeBundle x
Prelude.Generic)
newDescribeBundle ::
Prelude.Text ->
DescribeBundle
newDescribeBundle :: Text -> DescribeBundle
newDescribeBundle Text
pBundleId_ =
DescribeBundle' :: Text -> DescribeBundle
DescribeBundle' {$sel:bundleId:DescribeBundle' :: Text
bundleId = Text
pBundleId_}
describeBundle_bundleId :: Lens.Lens' DescribeBundle Prelude.Text
describeBundle_bundleId :: (Text -> f Text) -> DescribeBundle -> f DescribeBundle
describeBundle_bundleId = (DescribeBundle -> Text)
-> (DescribeBundle -> Text -> DescribeBundle)
-> Lens DescribeBundle DescribeBundle Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeBundle' {Text
bundleId :: Text
$sel:bundleId:DescribeBundle' :: DescribeBundle -> Text
bundleId} -> Text
bundleId) (\s :: DescribeBundle
s@DescribeBundle' {} Text
a -> DescribeBundle
s {$sel:bundleId:DescribeBundle' :: Text
bundleId = Text
a} :: DescribeBundle)
instance Core.AWSRequest DescribeBundle where
type
AWSResponse DescribeBundle =
DescribeBundleResponse
request :: DescribeBundle -> Request DescribeBundle
request = Service -> DescribeBundle -> Request DescribeBundle
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeBundle
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeBundle)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeBundle))
-> Logger
-> Service
-> Proxy DescribeBundle
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeBundle)))
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 BundleDetails -> Int -> DescribeBundleResponse
DescribeBundleResponse'
(Maybe BundleDetails -> Int -> DescribeBundleResponse)
-> Either String (Maybe BundleDetails)
-> Either String (Int -> DescribeBundleResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe BundleDetails)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"details")
Either String (Int -> DescribeBundleResponse)
-> Either String Int -> Either String DescribeBundleResponse
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 DescribeBundle
instance Prelude.NFData DescribeBundle
instance Core.ToHeaders DescribeBundle where
toHeaders :: DescribeBundle -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeBundle -> 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.ToPath DescribeBundle where
toPath :: DescribeBundle -> ByteString
toPath DescribeBundle' {Text
bundleId :: Text
$sel:bundleId:DescribeBundle' :: DescribeBundle -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/bundles/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
bundleId]
instance Core.ToQuery DescribeBundle where
toQuery :: DescribeBundle -> QueryString
toQuery = QueryString -> DescribeBundle -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeBundleResponse = DescribeBundleResponse'
{
DescribeBundleResponse -> Maybe BundleDetails
details :: Prelude.Maybe BundleDetails,
DescribeBundleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeBundleResponse -> DescribeBundleResponse -> Bool
(DescribeBundleResponse -> DescribeBundleResponse -> Bool)
-> (DescribeBundleResponse -> DescribeBundleResponse -> Bool)
-> Eq DescribeBundleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeBundleResponse -> DescribeBundleResponse -> Bool
$c/= :: DescribeBundleResponse -> DescribeBundleResponse -> Bool
== :: DescribeBundleResponse -> DescribeBundleResponse -> Bool
$c== :: DescribeBundleResponse -> DescribeBundleResponse -> Bool
Prelude.Eq, ReadPrec [DescribeBundleResponse]
ReadPrec DescribeBundleResponse
Int -> ReadS DescribeBundleResponse
ReadS [DescribeBundleResponse]
(Int -> ReadS DescribeBundleResponse)
-> ReadS [DescribeBundleResponse]
-> ReadPrec DescribeBundleResponse
-> ReadPrec [DescribeBundleResponse]
-> Read DescribeBundleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeBundleResponse]
$creadListPrec :: ReadPrec [DescribeBundleResponse]
readPrec :: ReadPrec DescribeBundleResponse
$creadPrec :: ReadPrec DescribeBundleResponse
readList :: ReadS [DescribeBundleResponse]
$creadList :: ReadS [DescribeBundleResponse]
readsPrec :: Int -> ReadS DescribeBundleResponse
$creadsPrec :: Int -> ReadS DescribeBundleResponse
Prelude.Read, Int -> DescribeBundleResponse -> ShowS
[DescribeBundleResponse] -> ShowS
DescribeBundleResponse -> String
(Int -> DescribeBundleResponse -> ShowS)
-> (DescribeBundleResponse -> String)
-> ([DescribeBundleResponse] -> ShowS)
-> Show DescribeBundleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeBundleResponse] -> ShowS
$cshowList :: [DescribeBundleResponse] -> ShowS
show :: DescribeBundleResponse -> String
$cshow :: DescribeBundleResponse -> String
showsPrec :: Int -> DescribeBundleResponse -> ShowS
$cshowsPrec :: Int -> DescribeBundleResponse -> ShowS
Prelude.Show, (forall x. DescribeBundleResponse -> Rep DescribeBundleResponse x)
-> (forall x.
Rep DescribeBundleResponse x -> DescribeBundleResponse)
-> Generic DescribeBundleResponse
forall x. Rep DescribeBundleResponse x -> DescribeBundleResponse
forall x. DescribeBundleResponse -> Rep DescribeBundleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeBundleResponse x -> DescribeBundleResponse
$cfrom :: forall x. DescribeBundleResponse -> Rep DescribeBundleResponse x
Prelude.Generic)
newDescribeBundleResponse ::
Prelude.Int ->
DescribeBundleResponse
newDescribeBundleResponse :: Int -> DescribeBundleResponse
newDescribeBundleResponse Int
pHttpStatus_ =
DescribeBundleResponse' :: Maybe BundleDetails -> Int -> DescribeBundleResponse
DescribeBundleResponse'
{ $sel:details:DescribeBundleResponse' :: Maybe BundleDetails
details = Maybe BundleDetails
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeBundleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeBundleResponse_details :: Lens.Lens' DescribeBundleResponse (Prelude.Maybe BundleDetails)
describeBundleResponse_details :: (Maybe BundleDetails -> f (Maybe BundleDetails))
-> DescribeBundleResponse -> f DescribeBundleResponse
describeBundleResponse_details = (DescribeBundleResponse -> Maybe BundleDetails)
-> (DescribeBundleResponse
-> Maybe BundleDetails -> DescribeBundleResponse)
-> Lens
DescribeBundleResponse
DescribeBundleResponse
(Maybe BundleDetails)
(Maybe BundleDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeBundleResponse' {Maybe BundleDetails
details :: Maybe BundleDetails
$sel:details:DescribeBundleResponse' :: DescribeBundleResponse -> Maybe BundleDetails
details} -> Maybe BundleDetails
details) (\s :: DescribeBundleResponse
s@DescribeBundleResponse' {} Maybe BundleDetails
a -> DescribeBundleResponse
s {$sel:details:DescribeBundleResponse' :: Maybe BundleDetails
details = Maybe BundleDetails
a} :: DescribeBundleResponse)
describeBundleResponse_httpStatus :: Lens.Lens' DescribeBundleResponse Prelude.Int
describeBundleResponse_httpStatus :: (Int -> f Int)
-> DescribeBundleResponse -> f DescribeBundleResponse
describeBundleResponse_httpStatus = (DescribeBundleResponse -> Int)
-> (DescribeBundleResponse -> Int -> DescribeBundleResponse)
-> Lens DescribeBundleResponse DescribeBundleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeBundleResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeBundleResponse' :: DescribeBundleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeBundleResponse
s@DescribeBundleResponse' {} Int
a -> DescribeBundleResponse
s {$sel:httpStatus:DescribeBundleResponse' :: Int
httpStatus = Int
a} :: DescribeBundleResponse)
instance Prelude.NFData DescribeBundleResponse