{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.Snowball.DescribeJob
(
describeJob
, DescribeJob
, djJobId
, describeJobResponse
, DescribeJobResponse
, djrsJobMetadata
, djrsSubJobMetadata
, djrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.Snowball.Types
import Network.AWS.Snowball.Types.Product
newtype DescribeJob = DescribeJob'
{ _djJobId :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeJob
:: Text
-> DescribeJob
describeJob pJobId_ = DescribeJob' {_djJobId = pJobId_}
djJobId :: Lens' DescribeJob Text
djJobId = lens _djJobId (\ s a -> s{_djJobId = a})
instance AWSRequest DescribeJob where
type Rs DescribeJob = DescribeJobResponse
request = postJSON snowball
response
= receiveJSON
(\ s h x ->
DescribeJobResponse' <$>
(x .?> "JobMetadata") <*>
(x .?> "SubJobMetadata" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable DescribeJob where
instance NFData DescribeJob where
instance ToHeaders DescribeJob where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSIESnowballJobManagementService.DescribeJob" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeJob where
toJSON DescribeJob'{..}
= object (catMaybes [Just ("JobId" .= _djJobId)])
instance ToPath DescribeJob where
toPath = const "/"
instance ToQuery DescribeJob where
toQuery = const mempty
data DescribeJobResponse = DescribeJobResponse'
{ _djrsJobMetadata :: !(Maybe JobMetadata)
, _djrsSubJobMetadata :: !(Maybe [JobMetadata])
, _djrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeJobResponse
:: Int
-> DescribeJobResponse
describeJobResponse pResponseStatus_ =
DescribeJobResponse'
{ _djrsJobMetadata = Nothing
, _djrsSubJobMetadata = Nothing
, _djrsResponseStatus = pResponseStatus_
}
djrsJobMetadata :: Lens' DescribeJobResponse (Maybe JobMetadata)
djrsJobMetadata = lens _djrsJobMetadata (\ s a -> s{_djrsJobMetadata = a})
djrsSubJobMetadata :: Lens' DescribeJobResponse [JobMetadata]
djrsSubJobMetadata = lens _djrsSubJobMetadata (\ s a -> s{_djrsSubJobMetadata = a}) . _Default . _Coerce
djrsResponseStatus :: Lens' DescribeJobResponse Int
djrsResponseStatus = lens _djrsResponseStatus (\ s a -> s{_djrsResponseStatus = a})
instance NFData DescribeJobResponse where