{-# 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.CodeDeploy.GetDeploymentTarget
(
GetDeploymentTarget (..),
newGetDeploymentTarget,
getDeploymentTarget_targetId,
getDeploymentTarget_deploymentId,
GetDeploymentTargetResponse (..),
newGetDeploymentTargetResponse,
getDeploymentTargetResponse_deploymentTarget,
getDeploymentTargetResponse_httpStatus,
)
where
import Amazonka.CodeDeploy.Types
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
data GetDeploymentTarget = GetDeploymentTarget'
{
GetDeploymentTarget -> Maybe Text
targetId :: Prelude.Maybe Prelude.Text,
GetDeploymentTarget -> Maybe Text
deploymentId :: Prelude.Maybe Prelude.Text
}
deriving (GetDeploymentTarget -> GetDeploymentTarget -> Bool
(GetDeploymentTarget -> GetDeploymentTarget -> Bool)
-> (GetDeploymentTarget -> GetDeploymentTarget -> Bool)
-> Eq GetDeploymentTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDeploymentTarget -> GetDeploymentTarget -> Bool
$c/= :: GetDeploymentTarget -> GetDeploymentTarget -> Bool
== :: GetDeploymentTarget -> GetDeploymentTarget -> Bool
$c== :: GetDeploymentTarget -> GetDeploymentTarget -> Bool
Prelude.Eq, ReadPrec [GetDeploymentTarget]
ReadPrec GetDeploymentTarget
Int -> ReadS GetDeploymentTarget
ReadS [GetDeploymentTarget]
(Int -> ReadS GetDeploymentTarget)
-> ReadS [GetDeploymentTarget]
-> ReadPrec GetDeploymentTarget
-> ReadPrec [GetDeploymentTarget]
-> Read GetDeploymentTarget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDeploymentTarget]
$creadListPrec :: ReadPrec [GetDeploymentTarget]
readPrec :: ReadPrec GetDeploymentTarget
$creadPrec :: ReadPrec GetDeploymentTarget
readList :: ReadS [GetDeploymentTarget]
$creadList :: ReadS [GetDeploymentTarget]
readsPrec :: Int -> ReadS GetDeploymentTarget
$creadsPrec :: Int -> ReadS GetDeploymentTarget
Prelude.Read, Int -> GetDeploymentTarget -> ShowS
[GetDeploymentTarget] -> ShowS
GetDeploymentTarget -> String
(Int -> GetDeploymentTarget -> ShowS)
-> (GetDeploymentTarget -> String)
-> ([GetDeploymentTarget] -> ShowS)
-> Show GetDeploymentTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDeploymentTarget] -> ShowS
$cshowList :: [GetDeploymentTarget] -> ShowS
show :: GetDeploymentTarget -> String
$cshow :: GetDeploymentTarget -> String
showsPrec :: Int -> GetDeploymentTarget -> ShowS
$cshowsPrec :: Int -> GetDeploymentTarget -> ShowS
Prelude.Show, (forall x. GetDeploymentTarget -> Rep GetDeploymentTarget x)
-> (forall x. Rep GetDeploymentTarget x -> GetDeploymentTarget)
-> Generic GetDeploymentTarget
forall x. Rep GetDeploymentTarget x -> GetDeploymentTarget
forall x. GetDeploymentTarget -> Rep GetDeploymentTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDeploymentTarget x -> GetDeploymentTarget
$cfrom :: forall x. GetDeploymentTarget -> Rep GetDeploymentTarget x
Prelude.Generic)
newGetDeploymentTarget ::
GetDeploymentTarget
newGetDeploymentTarget :: GetDeploymentTarget
newGetDeploymentTarget =
GetDeploymentTarget' :: Maybe Text -> Maybe Text -> GetDeploymentTarget
GetDeploymentTarget'
{ $sel:targetId:GetDeploymentTarget' :: Maybe Text
targetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:deploymentId:GetDeploymentTarget' :: Maybe Text
deploymentId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
getDeploymentTarget_targetId :: Lens.Lens' GetDeploymentTarget (Prelude.Maybe Prelude.Text)
getDeploymentTarget_targetId :: (Maybe Text -> f (Maybe Text))
-> GetDeploymentTarget -> f GetDeploymentTarget
getDeploymentTarget_targetId = (GetDeploymentTarget -> Maybe Text)
-> (GetDeploymentTarget -> Maybe Text -> GetDeploymentTarget)
-> Lens
GetDeploymentTarget GetDeploymentTarget (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeploymentTarget' {Maybe Text
targetId :: Maybe Text
$sel:targetId:GetDeploymentTarget' :: GetDeploymentTarget -> Maybe Text
targetId} -> Maybe Text
targetId) (\s :: GetDeploymentTarget
s@GetDeploymentTarget' {} Maybe Text
a -> GetDeploymentTarget
s {$sel:targetId:GetDeploymentTarget' :: Maybe Text
targetId = Maybe Text
a} :: GetDeploymentTarget)
getDeploymentTarget_deploymentId :: Lens.Lens' GetDeploymentTarget (Prelude.Maybe Prelude.Text)
getDeploymentTarget_deploymentId :: (Maybe Text -> f (Maybe Text))
-> GetDeploymentTarget -> f GetDeploymentTarget
getDeploymentTarget_deploymentId = (GetDeploymentTarget -> Maybe Text)
-> (GetDeploymentTarget -> Maybe Text -> GetDeploymentTarget)
-> Lens
GetDeploymentTarget GetDeploymentTarget (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeploymentTarget' {Maybe Text
deploymentId :: Maybe Text
$sel:deploymentId:GetDeploymentTarget' :: GetDeploymentTarget -> Maybe Text
deploymentId} -> Maybe Text
deploymentId) (\s :: GetDeploymentTarget
s@GetDeploymentTarget' {} Maybe Text
a -> GetDeploymentTarget
s {$sel:deploymentId:GetDeploymentTarget' :: Maybe Text
deploymentId = Maybe Text
a} :: GetDeploymentTarget)
instance Core.AWSRequest GetDeploymentTarget where
type
AWSResponse GetDeploymentTarget =
GetDeploymentTargetResponse
request :: GetDeploymentTarget -> Request GetDeploymentTarget
request = Service -> GetDeploymentTarget -> Request GetDeploymentTarget
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetDeploymentTarget
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDeploymentTarget)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetDeploymentTarget))
-> Logger
-> Service
-> Proxy GetDeploymentTarget
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDeploymentTarget)))
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 DeploymentTarget -> Int -> GetDeploymentTargetResponse
GetDeploymentTargetResponse'
(Maybe DeploymentTarget -> Int -> GetDeploymentTargetResponse)
-> Either String (Maybe DeploymentTarget)
-> Either String (Int -> GetDeploymentTargetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DeploymentTarget)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"deploymentTarget")
Either String (Int -> GetDeploymentTargetResponse)
-> Either String Int -> Either String GetDeploymentTargetResponse
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 GetDeploymentTarget
instance Prelude.NFData GetDeploymentTarget
instance Core.ToHeaders GetDeploymentTarget where
toHeaders :: GetDeploymentTarget -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetDeploymentTarget -> 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
"CodeDeploy_20141006.GetDeploymentTarget" ::
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 GetDeploymentTarget where
toJSON :: GetDeploymentTarget -> Value
toJSON GetDeploymentTarget' {Maybe Text
deploymentId :: Maybe Text
targetId :: Maybe Text
$sel:deploymentId:GetDeploymentTarget' :: GetDeploymentTarget -> Maybe Text
$sel:targetId:GetDeploymentTarget' :: GetDeploymentTarget -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"targetId" 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
targetId,
(Text
"deploymentId" 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
deploymentId
]
)
instance Core.ToPath GetDeploymentTarget where
toPath :: GetDeploymentTarget -> ByteString
toPath = ByteString -> GetDeploymentTarget -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetDeploymentTarget where
toQuery :: GetDeploymentTarget -> QueryString
toQuery = QueryString -> GetDeploymentTarget -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetDeploymentTargetResponse = GetDeploymentTargetResponse'
{
GetDeploymentTargetResponse -> Maybe DeploymentTarget
deploymentTarget :: Prelude.Maybe DeploymentTarget,
GetDeploymentTargetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDeploymentTargetResponse -> GetDeploymentTargetResponse -> Bool
(GetDeploymentTargetResponse
-> GetDeploymentTargetResponse -> Bool)
-> (GetDeploymentTargetResponse
-> GetDeploymentTargetResponse -> Bool)
-> Eq GetDeploymentTargetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDeploymentTargetResponse -> GetDeploymentTargetResponse -> Bool
$c/= :: GetDeploymentTargetResponse -> GetDeploymentTargetResponse -> Bool
== :: GetDeploymentTargetResponse -> GetDeploymentTargetResponse -> Bool
$c== :: GetDeploymentTargetResponse -> GetDeploymentTargetResponse -> Bool
Prelude.Eq, ReadPrec [GetDeploymentTargetResponse]
ReadPrec GetDeploymentTargetResponse
Int -> ReadS GetDeploymentTargetResponse
ReadS [GetDeploymentTargetResponse]
(Int -> ReadS GetDeploymentTargetResponse)
-> ReadS [GetDeploymentTargetResponse]
-> ReadPrec GetDeploymentTargetResponse
-> ReadPrec [GetDeploymentTargetResponse]
-> Read GetDeploymentTargetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDeploymentTargetResponse]
$creadListPrec :: ReadPrec [GetDeploymentTargetResponse]
readPrec :: ReadPrec GetDeploymentTargetResponse
$creadPrec :: ReadPrec GetDeploymentTargetResponse
readList :: ReadS [GetDeploymentTargetResponse]
$creadList :: ReadS [GetDeploymentTargetResponse]
readsPrec :: Int -> ReadS GetDeploymentTargetResponse
$creadsPrec :: Int -> ReadS GetDeploymentTargetResponse
Prelude.Read, Int -> GetDeploymentTargetResponse -> ShowS
[GetDeploymentTargetResponse] -> ShowS
GetDeploymentTargetResponse -> String
(Int -> GetDeploymentTargetResponse -> ShowS)
-> (GetDeploymentTargetResponse -> String)
-> ([GetDeploymentTargetResponse] -> ShowS)
-> Show GetDeploymentTargetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDeploymentTargetResponse] -> ShowS
$cshowList :: [GetDeploymentTargetResponse] -> ShowS
show :: GetDeploymentTargetResponse -> String
$cshow :: GetDeploymentTargetResponse -> String
showsPrec :: Int -> GetDeploymentTargetResponse -> ShowS
$cshowsPrec :: Int -> GetDeploymentTargetResponse -> ShowS
Prelude.Show, (forall x.
GetDeploymentTargetResponse -> Rep GetDeploymentTargetResponse x)
-> (forall x.
Rep GetDeploymentTargetResponse x -> GetDeploymentTargetResponse)
-> Generic GetDeploymentTargetResponse
forall x.
Rep GetDeploymentTargetResponse x -> GetDeploymentTargetResponse
forall x.
GetDeploymentTargetResponse -> Rep GetDeploymentTargetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDeploymentTargetResponse x -> GetDeploymentTargetResponse
$cfrom :: forall x.
GetDeploymentTargetResponse -> Rep GetDeploymentTargetResponse x
Prelude.Generic)
newGetDeploymentTargetResponse ::
Prelude.Int ->
GetDeploymentTargetResponse
newGetDeploymentTargetResponse :: Int -> GetDeploymentTargetResponse
newGetDeploymentTargetResponse Int
pHttpStatus_ =
GetDeploymentTargetResponse' :: Maybe DeploymentTarget -> Int -> GetDeploymentTargetResponse
GetDeploymentTargetResponse'
{ $sel:deploymentTarget:GetDeploymentTargetResponse' :: Maybe DeploymentTarget
deploymentTarget =
Maybe DeploymentTarget
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDeploymentTargetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDeploymentTargetResponse_deploymentTarget :: Lens.Lens' GetDeploymentTargetResponse (Prelude.Maybe DeploymentTarget)
getDeploymentTargetResponse_deploymentTarget :: (Maybe DeploymentTarget -> f (Maybe DeploymentTarget))
-> GetDeploymentTargetResponse -> f GetDeploymentTargetResponse
getDeploymentTargetResponse_deploymentTarget = (GetDeploymentTargetResponse -> Maybe DeploymentTarget)
-> (GetDeploymentTargetResponse
-> Maybe DeploymentTarget -> GetDeploymentTargetResponse)
-> Lens
GetDeploymentTargetResponse
GetDeploymentTargetResponse
(Maybe DeploymentTarget)
(Maybe DeploymentTarget)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeploymentTargetResponse' {Maybe DeploymentTarget
deploymentTarget :: Maybe DeploymentTarget
$sel:deploymentTarget:GetDeploymentTargetResponse' :: GetDeploymentTargetResponse -> Maybe DeploymentTarget
deploymentTarget} -> Maybe DeploymentTarget
deploymentTarget) (\s :: GetDeploymentTargetResponse
s@GetDeploymentTargetResponse' {} Maybe DeploymentTarget
a -> GetDeploymentTargetResponse
s {$sel:deploymentTarget:GetDeploymentTargetResponse' :: Maybe DeploymentTarget
deploymentTarget = Maybe DeploymentTarget
a} :: GetDeploymentTargetResponse)
getDeploymentTargetResponse_httpStatus :: Lens.Lens' GetDeploymentTargetResponse Prelude.Int
getDeploymentTargetResponse_httpStatus :: (Int -> f Int)
-> GetDeploymentTargetResponse -> f GetDeploymentTargetResponse
getDeploymentTargetResponse_httpStatus = (GetDeploymentTargetResponse -> Int)
-> (GetDeploymentTargetResponse
-> Int -> GetDeploymentTargetResponse)
-> Lens
GetDeploymentTargetResponse GetDeploymentTargetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeploymentTargetResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDeploymentTargetResponse' :: GetDeploymentTargetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDeploymentTargetResponse
s@GetDeploymentTargetResponse' {} Int
a -> GetDeploymentTargetResponse
s {$sel:httpStatus:GetDeploymentTargetResponse' :: Int
httpStatus = Int
a} :: GetDeploymentTargetResponse)
instance Prelude.NFData GetDeploymentTargetResponse