{-# 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.MediaStore.DescribeContainer
(
DescribeContainer (..),
newDescribeContainer,
describeContainer_containerName,
DescribeContainerResponse (..),
newDescribeContainerResponse,
describeContainerResponse_container,
describeContainerResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaStore.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeContainer = DescribeContainer'
{
DescribeContainer -> Maybe Text
containerName :: Prelude.Maybe Prelude.Text
}
deriving (DescribeContainer -> DescribeContainer -> Bool
(DescribeContainer -> DescribeContainer -> Bool)
-> (DescribeContainer -> DescribeContainer -> Bool)
-> Eq DescribeContainer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeContainer -> DescribeContainer -> Bool
$c/= :: DescribeContainer -> DescribeContainer -> Bool
== :: DescribeContainer -> DescribeContainer -> Bool
$c== :: DescribeContainer -> DescribeContainer -> Bool
Prelude.Eq, ReadPrec [DescribeContainer]
ReadPrec DescribeContainer
Int -> ReadS DescribeContainer
ReadS [DescribeContainer]
(Int -> ReadS DescribeContainer)
-> ReadS [DescribeContainer]
-> ReadPrec DescribeContainer
-> ReadPrec [DescribeContainer]
-> Read DescribeContainer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeContainer]
$creadListPrec :: ReadPrec [DescribeContainer]
readPrec :: ReadPrec DescribeContainer
$creadPrec :: ReadPrec DescribeContainer
readList :: ReadS [DescribeContainer]
$creadList :: ReadS [DescribeContainer]
readsPrec :: Int -> ReadS DescribeContainer
$creadsPrec :: Int -> ReadS DescribeContainer
Prelude.Read, Int -> DescribeContainer -> ShowS
[DescribeContainer] -> ShowS
DescribeContainer -> String
(Int -> DescribeContainer -> ShowS)
-> (DescribeContainer -> String)
-> ([DescribeContainer] -> ShowS)
-> Show DescribeContainer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeContainer] -> ShowS
$cshowList :: [DescribeContainer] -> ShowS
show :: DescribeContainer -> String
$cshow :: DescribeContainer -> String
showsPrec :: Int -> DescribeContainer -> ShowS
$cshowsPrec :: Int -> DescribeContainer -> ShowS
Prelude.Show, (forall x. DescribeContainer -> Rep DescribeContainer x)
-> (forall x. Rep DescribeContainer x -> DescribeContainer)
-> Generic DescribeContainer
forall x. Rep DescribeContainer x -> DescribeContainer
forall x. DescribeContainer -> Rep DescribeContainer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeContainer x -> DescribeContainer
$cfrom :: forall x. DescribeContainer -> Rep DescribeContainer x
Prelude.Generic)
newDescribeContainer ::
DescribeContainer
newDescribeContainer :: DescribeContainer
newDescribeContainer =
DescribeContainer' :: Maybe Text -> DescribeContainer
DescribeContainer' {$sel:containerName:DescribeContainer' :: Maybe Text
containerName = Maybe Text
forall a. Maybe a
Prelude.Nothing}
describeContainer_containerName :: Lens.Lens' DescribeContainer (Prelude.Maybe Prelude.Text)
describeContainer_containerName :: (Maybe Text -> f (Maybe Text))
-> DescribeContainer -> f DescribeContainer
describeContainer_containerName = (DescribeContainer -> Maybe Text)
-> (DescribeContainer -> Maybe Text -> DescribeContainer)
-> Lens
DescribeContainer DescribeContainer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContainer' {Maybe Text
containerName :: Maybe Text
$sel:containerName:DescribeContainer' :: DescribeContainer -> Maybe Text
containerName} -> Maybe Text
containerName) (\s :: DescribeContainer
s@DescribeContainer' {} Maybe Text
a -> DescribeContainer
s {$sel:containerName:DescribeContainer' :: Maybe Text
containerName = Maybe Text
a} :: DescribeContainer)
instance Core.AWSRequest DescribeContainer where
type
AWSResponse DescribeContainer =
DescribeContainerResponse
request :: DescribeContainer -> Request DescribeContainer
request = Service -> DescribeContainer -> Request DescribeContainer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeContainer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeContainer)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeContainer))
-> Logger
-> Service
-> Proxy DescribeContainer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeContainer)))
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 Container -> Int -> DescribeContainerResponse
DescribeContainerResponse'
(Maybe Container -> Int -> DescribeContainerResponse)
-> Either String (Maybe Container)
-> Either String (Int -> DescribeContainerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Container)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Container")
Either String (Int -> DescribeContainerResponse)
-> Either String Int -> Either String DescribeContainerResponse
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 DescribeContainer
instance Prelude.NFData DescribeContainer
instance Core.ToHeaders DescribeContainer where
toHeaders :: DescribeContainer -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeContainer -> 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
"MediaStore_20170901.DescribeContainer" ::
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 DescribeContainer where
toJSON :: DescribeContainer -> Value
toJSON DescribeContainer' {Maybe Text
containerName :: Maybe Text
$sel:containerName:DescribeContainer' :: DescribeContainer -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ContainerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
containerName
]
)
instance Core.ToPath DescribeContainer where
toPath :: DescribeContainer -> ByteString
toPath = ByteString -> DescribeContainer -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeContainer where
toQuery :: DescribeContainer -> QueryString
toQuery = QueryString -> DescribeContainer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeContainerResponse = DescribeContainerResponse'
{
DescribeContainerResponse -> Maybe Container
container :: Prelude.Maybe Container,
DescribeContainerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeContainerResponse -> DescribeContainerResponse -> Bool
(DescribeContainerResponse -> DescribeContainerResponse -> Bool)
-> (DescribeContainerResponse -> DescribeContainerResponse -> Bool)
-> Eq DescribeContainerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeContainerResponse -> DescribeContainerResponse -> Bool
$c/= :: DescribeContainerResponse -> DescribeContainerResponse -> Bool
== :: DescribeContainerResponse -> DescribeContainerResponse -> Bool
$c== :: DescribeContainerResponse -> DescribeContainerResponse -> Bool
Prelude.Eq, ReadPrec [DescribeContainerResponse]
ReadPrec DescribeContainerResponse
Int -> ReadS DescribeContainerResponse
ReadS [DescribeContainerResponse]
(Int -> ReadS DescribeContainerResponse)
-> ReadS [DescribeContainerResponse]
-> ReadPrec DescribeContainerResponse
-> ReadPrec [DescribeContainerResponse]
-> Read DescribeContainerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeContainerResponse]
$creadListPrec :: ReadPrec [DescribeContainerResponse]
readPrec :: ReadPrec DescribeContainerResponse
$creadPrec :: ReadPrec DescribeContainerResponse
readList :: ReadS [DescribeContainerResponse]
$creadList :: ReadS [DescribeContainerResponse]
readsPrec :: Int -> ReadS DescribeContainerResponse
$creadsPrec :: Int -> ReadS DescribeContainerResponse
Prelude.Read, Int -> DescribeContainerResponse -> ShowS
[DescribeContainerResponse] -> ShowS
DescribeContainerResponse -> String
(Int -> DescribeContainerResponse -> ShowS)
-> (DescribeContainerResponse -> String)
-> ([DescribeContainerResponse] -> ShowS)
-> Show DescribeContainerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeContainerResponse] -> ShowS
$cshowList :: [DescribeContainerResponse] -> ShowS
show :: DescribeContainerResponse -> String
$cshow :: DescribeContainerResponse -> String
showsPrec :: Int -> DescribeContainerResponse -> ShowS
$cshowsPrec :: Int -> DescribeContainerResponse -> ShowS
Prelude.Show, (forall x.
DescribeContainerResponse -> Rep DescribeContainerResponse x)
-> (forall x.
Rep DescribeContainerResponse x -> DescribeContainerResponse)
-> Generic DescribeContainerResponse
forall x.
Rep DescribeContainerResponse x -> DescribeContainerResponse
forall x.
DescribeContainerResponse -> Rep DescribeContainerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeContainerResponse x -> DescribeContainerResponse
$cfrom :: forall x.
DescribeContainerResponse -> Rep DescribeContainerResponse x
Prelude.Generic)
newDescribeContainerResponse ::
Prelude.Int ->
DescribeContainerResponse
newDescribeContainerResponse :: Int -> DescribeContainerResponse
newDescribeContainerResponse Int
pHttpStatus_ =
DescribeContainerResponse' :: Maybe Container -> Int -> DescribeContainerResponse
DescribeContainerResponse'
{ $sel:container:DescribeContainerResponse' :: Maybe Container
container =
Maybe Container
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeContainerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeContainerResponse_container :: Lens.Lens' DescribeContainerResponse (Prelude.Maybe Container)
describeContainerResponse_container :: (Maybe Container -> f (Maybe Container))
-> DescribeContainerResponse -> f DescribeContainerResponse
describeContainerResponse_container = (DescribeContainerResponse -> Maybe Container)
-> (DescribeContainerResponse
-> Maybe Container -> DescribeContainerResponse)
-> Lens
DescribeContainerResponse
DescribeContainerResponse
(Maybe Container)
(Maybe Container)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContainerResponse' {Maybe Container
container :: Maybe Container
$sel:container:DescribeContainerResponse' :: DescribeContainerResponse -> Maybe Container
container} -> Maybe Container
container) (\s :: DescribeContainerResponse
s@DescribeContainerResponse' {} Maybe Container
a -> DescribeContainerResponse
s {$sel:container:DescribeContainerResponse' :: Maybe Container
container = Maybe Container
a} :: DescribeContainerResponse)
describeContainerResponse_httpStatus :: Lens.Lens' DescribeContainerResponse Prelude.Int
describeContainerResponse_httpStatus :: (Int -> f Int)
-> DescribeContainerResponse -> f DescribeContainerResponse
describeContainerResponse_httpStatus = (DescribeContainerResponse -> Int)
-> (DescribeContainerResponse -> Int -> DescribeContainerResponse)
-> Lens DescribeContainerResponse DescribeContainerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeContainerResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeContainerResponse' :: DescribeContainerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeContainerResponse
s@DescribeContainerResponse' {} Int
a -> DescribeContainerResponse
s {$sel:httpStatus:DescribeContainerResponse' :: Int
httpStatus = Int
a} :: DescribeContainerResponse)
instance Prelude.NFData DescribeContainerResponse