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