{-# 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.GetApplicationRevision
(
GetApplicationRevision (..),
newGetApplicationRevision,
getApplicationRevision_applicationName,
getApplicationRevision_revision,
GetApplicationRevisionResponse (..),
newGetApplicationRevisionResponse,
getApplicationRevisionResponse_applicationName,
getApplicationRevisionResponse_revisionInfo,
getApplicationRevisionResponse_revision,
getApplicationRevisionResponse_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 GetApplicationRevision = GetApplicationRevision'
{
GetApplicationRevision -> Text
applicationName :: Prelude.Text,
GetApplicationRevision -> RevisionLocation
revision :: RevisionLocation
}
deriving (GetApplicationRevision -> GetApplicationRevision -> Bool
(GetApplicationRevision -> GetApplicationRevision -> Bool)
-> (GetApplicationRevision -> GetApplicationRevision -> Bool)
-> Eq GetApplicationRevision
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApplicationRevision -> GetApplicationRevision -> Bool
$c/= :: GetApplicationRevision -> GetApplicationRevision -> Bool
== :: GetApplicationRevision -> GetApplicationRevision -> Bool
$c== :: GetApplicationRevision -> GetApplicationRevision -> Bool
Prelude.Eq, ReadPrec [GetApplicationRevision]
ReadPrec GetApplicationRevision
Int -> ReadS GetApplicationRevision
ReadS [GetApplicationRevision]
(Int -> ReadS GetApplicationRevision)
-> ReadS [GetApplicationRevision]
-> ReadPrec GetApplicationRevision
-> ReadPrec [GetApplicationRevision]
-> Read GetApplicationRevision
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApplicationRevision]
$creadListPrec :: ReadPrec [GetApplicationRevision]
readPrec :: ReadPrec GetApplicationRevision
$creadPrec :: ReadPrec GetApplicationRevision
readList :: ReadS [GetApplicationRevision]
$creadList :: ReadS [GetApplicationRevision]
readsPrec :: Int -> ReadS GetApplicationRevision
$creadsPrec :: Int -> ReadS GetApplicationRevision
Prelude.Read, Int -> GetApplicationRevision -> ShowS
[GetApplicationRevision] -> ShowS
GetApplicationRevision -> String
(Int -> GetApplicationRevision -> ShowS)
-> (GetApplicationRevision -> String)
-> ([GetApplicationRevision] -> ShowS)
-> Show GetApplicationRevision
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApplicationRevision] -> ShowS
$cshowList :: [GetApplicationRevision] -> ShowS
show :: GetApplicationRevision -> String
$cshow :: GetApplicationRevision -> String
showsPrec :: Int -> GetApplicationRevision -> ShowS
$cshowsPrec :: Int -> GetApplicationRevision -> ShowS
Prelude.Show, (forall x. GetApplicationRevision -> Rep GetApplicationRevision x)
-> (forall x.
Rep GetApplicationRevision x -> GetApplicationRevision)
-> Generic GetApplicationRevision
forall x. Rep GetApplicationRevision x -> GetApplicationRevision
forall x. GetApplicationRevision -> Rep GetApplicationRevision x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetApplicationRevision x -> GetApplicationRevision
$cfrom :: forall x. GetApplicationRevision -> Rep GetApplicationRevision x
Prelude.Generic)
newGetApplicationRevision ::
Prelude.Text ->
RevisionLocation ->
GetApplicationRevision
newGetApplicationRevision :: Text -> RevisionLocation -> GetApplicationRevision
newGetApplicationRevision
Text
pApplicationName_
RevisionLocation
pRevision_ =
GetApplicationRevision' :: Text -> RevisionLocation -> GetApplicationRevision
GetApplicationRevision'
{ $sel:applicationName:GetApplicationRevision' :: Text
applicationName =
Text
pApplicationName_,
$sel:revision:GetApplicationRevision' :: RevisionLocation
revision = RevisionLocation
pRevision_
}
getApplicationRevision_applicationName :: Lens.Lens' GetApplicationRevision Prelude.Text
getApplicationRevision_applicationName :: (Text -> f Text)
-> GetApplicationRevision -> f GetApplicationRevision
getApplicationRevision_applicationName = (GetApplicationRevision -> Text)
-> (GetApplicationRevision -> Text -> GetApplicationRevision)
-> Lens GetApplicationRevision GetApplicationRevision Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationRevision' {Text
applicationName :: Text
$sel:applicationName:GetApplicationRevision' :: GetApplicationRevision -> Text
applicationName} -> Text
applicationName) (\s :: GetApplicationRevision
s@GetApplicationRevision' {} Text
a -> GetApplicationRevision
s {$sel:applicationName:GetApplicationRevision' :: Text
applicationName = Text
a} :: GetApplicationRevision)
getApplicationRevision_revision :: Lens.Lens' GetApplicationRevision RevisionLocation
getApplicationRevision_revision :: (RevisionLocation -> f RevisionLocation)
-> GetApplicationRevision -> f GetApplicationRevision
getApplicationRevision_revision = (GetApplicationRevision -> RevisionLocation)
-> (GetApplicationRevision
-> RevisionLocation -> GetApplicationRevision)
-> Lens
GetApplicationRevision
GetApplicationRevision
RevisionLocation
RevisionLocation
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationRevision' {RevisionLocation
revision :: RevisionLocation
$sel:revision:GetApplicationRevision' :: GetApplicationRevision -> RevisionLocation
revision} -> RevisionLocation
revision) (\s :: GetApplicationRevision
s@GetApplicationRevision' {} RevisionLocation
a -> GetApplicationRevision
s {$sel:revision:GetApplicationRevision' :: RevisionLocation
revision = RevisionLocation
a} :: GetApplicationRevision)
instance Core.AWSRequest GetApplicationRevision where
type
AWSResponse GetApplicationRevision =
GetApplicationRevisionResponse
request :: GetApplicationRevision -> Request GetApplicationRevision
request = Service -> GetApplicationRevision -> Request GetApplicationRevision
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetApplicationRevision
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetApplicationRevision)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetApplicationRevision))
-> Logger
-> Service
-> Proxy GetApplicationRevision
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetApplicationRevision)))
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 Text
-> Maybe GenericRevisionInfo
-> Maybe RevisionLocation
-> Int
-> GetApplicationRevisionResponse
GetApplicationRevisionResponse'
(Maybe Text
-> Maybe GenericRevisionInfo
-> Maybe RevisionLocation
-> Int
-> GetApplicationRevisionResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe GenericRevisionInfo
-> Maybe RevisionLocation -> Int -> GetApplicationRevisionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"applicationName")
Either
String
(Maybe GenericRevisionInfo
-> Maybe RevisionLocation -> Int -> GetApplicationRevisionResponse)
-> Either String (Maybe GenericRevisionInfo)
-> Either
String
(Maybe RevisionLocation -> Int -> GetApplicationRevisionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe GenericRevisionInfo)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"revisionInfo")
Either
String
(Maybe RevisionLocation -> Int -> GetApplicationRevisionResponse)
-> Either String (Maybe RevisionLocation)
-> Either String (Int -> GetApplicationRevisionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe RevisionLocation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"revision")
Either String (Int -> GetApplicationRevisionResponse)
-> Either String Int
-> Either String GetApplicationRevisionResponse
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 GetApplicationRevision
instance Prelude.NFData GetApplicationRevision
instance Core.ToHeaders GetApplicationRevision where
toHeaders :: GetApplicationRevision -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetApplicationRevision -> 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.GetApplicationRevision" ::
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 GetApplicationRevision where
toJSON :: GetApplicationRevision -> Value
toJSON GetApplicationRevision' {Text
RevisionLocation
revision :: RevisionLocation
applicationName :: Text
$sel:revision:GetApplicationRevision' :: GetApplicationRevision -> RevisionLocation
$sel:applicationName:GetApplicationRevision' :: GetApplicationRevision -> 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
"applicationName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
applicationName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"revision" Text -> RevisionLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RevisionLocation
revision)
]
)
instance Core.ToPath GetApplicationRevision where
toPath :: GetApplicationRevision -> ByteString
toPath = ByteString -> GetApplicationRevision -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetApplicationRevision where
toQuery :: GetApplicationRevision -> QueryString
toQuery = QueryString -> GetApplicationRevision -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetApplicationRevisionResponse = GetApplicationRevisionResponse'
{
GetApplicationRevisionResponse -> Maybe Text
applicationName :: Prelude.Maybe Prelude.Text,
GetApplicationRevisionResponse -> Maybe GenericRevisionInfo
revisionInfo :: Prelude.Maybe GenericRevisionInfo,
GetApplicationRevisionResponse -> Maybe RevisionLocation
revision :: Prelude.Maybe RevisionLocation,
GetApplicationRevisionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetApplicationRevisionResponse
-> GetApplicationRevisionResponse -> Bool
(GetApplicationRevisionResponse
-> GetApplicationRevisionResponse -> Bool)
-> (GetApplicationRevisionResponse
-> GetApplicationRevisionResponse -> Bool)
-> Eq GetApplicationRevisionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApplicationRevisionResponse
-> GetApplicationRevisionResponse -> Bool
$c/= :: GetApplicationRevisionResponse
-> GetApplicationRevisionResponse -> Bool
== :: GetApplicationRevisionResponse
-> GetApplicationRevisionResponse -> Bool
$c== :: GetApplicationRevisionResponse
-> GetApplicationRevisionResponse -> Bool
Prelude.Eq, ReadPrec [GetApplicationRevisionResponse]
ReadPrec GetApplicationRevisionResponse
Int -> ReadS GetApplicationRevisionResponse
ReadS [GetApplicationRevisionResponse]
(Int -> ReadS GetApplicationRevisionResponse)
-> ReadS [GetApplicationRevisionResponse]
-> ReadPrec GetApplicationRevisionResponse
-> ReadPrec [GetApplicationRevisionResponse]
-> Read GetApplicationRevisionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApplicationRevisionResponse]
$creadListPrec :: ReadPrec [GetApplicationRevisionResponse]
readPrec :: ReadPrec GetApplicationRevisionResponse
$creadPrec :: ReadPrec GetApplicationRevisionResponse
readList :: ReadS [GetApplicationRevisionResponse]
$creadList :: ReadS [GetApplicationRevisionResponse]
readsPrec :: Int -> ReadS GetApplicationRevisionResponse
$creadsPrec :: Int -> ReadS GetApplicationRevisionResponse
Prelude.Read, Int -> GetApplicationRevisionResponse -> ShowS
[GetApplicationRevisionResponse] -> ShowS
GetApplicationRevisionResponse -> String
(Int -> GetApplicationRevisionResponse -> ShowS)
-> (GetApplicationRevisionResponse -> String)
-> ([GetApplicationRevisionResponse] -> ShowS)
-> Show GetApplicationRevisionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApplicationRevisionResponse] -> ShowS
$cshowList :: [GetApplicationRevisionResponse] -> ShowS
show :: GetApplicationRevisionResponse -> String
$cshow :: GetApplicationRevisionResponse -> String
showsPrec :: Int -> GetApplicationRevisionResponse -> ShowS
$cshowsPrec :: Int -> GetApplicationRevisionResponse -> ShowS
Prelude.Show, (forall x.
GetApplicationRevisionResponse
-> Rep GetApplicationRevisionResponse x)
-> (forall x.
Rep GetApplicationRevisionResponse x
-> GetApplicationRevisionResponse)
-> Generic GetApplicationRevisionResponse
forall x.
Rep GetApplicationRevisionResponse x
-> GetApplicationRevisionResponse
forall x.
GetApplicationRevisionResponse
-> Rep GetApplicationRevisionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetApplicationRevisionResponse x
-> GetApplicationRevisionResponse
$cfrom :: forall x.
GetApplicationRevisionResponse
-> Rep GetApplicationRevisionResponse x
Prelude.Generic)
newGetApplicationRevisionResponse ::
Prelude.Int ->
GetApplicationRevisionResponse
newGetApplicationRevisionResponse :: Int -> GetApplicationRevisionResponse
newGetApplicationRevisionResponse Int
pHttpStatus_ =
GetApplicationRevisionResponse' :: Maybe Text
-> Maybe GenericRevisionInfo
-> Maybe RevisionLocation
-> Int
-> GetApplicationRevisionResponse
GetApplicationRevisionResponse'
{ $sel:applicationName:GetApplicationRevisionResponse' :: Maybe Text
applicationName =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:revisionInfo:GetApplicationRevisionResponse' :: Maybe GenericRevisionInfo
revisionInfo = Maybe GenericRevisionInfo
forall a. Maybe a
Prelude.Nothing,
$sel:revision:GetApplicationRevisionResponse' :: Maybe RevisionLocation
revision = Maybe RevisionLocation
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetApplicationRevisionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getApplicationRevisionResponse_applicationName :: Lens.Lens' GetApplicationRevisionResponse (Prelude.Maybe Prelude.Text)
getApplicationRevisionResponse_applicationName :: (Maybe Text -> f (Maybe Text))
-> GetApplicationRevisionResponse
-> f GetApplicationRevisionResponse
getApplicationRevisionResponse_applicationName = (GetApplicationRevisionResponse -> Maybe Text)
-> (GetApplicationRevisionResponse
-> Maybe Text -> GetApplicationRevisionResponse)
-> Lens
GetApplicationRevisionResponse
GetApplicationRevisionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationRevisionResponse' {Maybe Text
applicationName :: Maybe Text
$sel:applicationName:GetApplicationRevisionResponse' :: GetApplicationRevisionResponse -> Maybe Text
applicationName} -> Maybe Text
applicationName) (\s :: GetApplicationRevisionResponse
s@GetApplicationRevisionResponse' {} Maybe Text
a -> GetApplicationRevisionResponse
s {$sel:applicationName:GetApplicationRevisionResponse' :: Maybe Text
applicationName = Maybe Text
a} :: GetApplicationRevisionResponse)
getApplicationRevisionResponse_revisionInfo :: Lens.Lens' GetApplicationRevisionResponse (Prelude.Maybe GenericRevisionInfo)
getApplicationRevisionResponse_revisionInfo :: (Maybe GenericRevisionInfo -> f (Maybe GenericRevisionInfo))
-> GetApplicationRevisionResponse
-> f GetApplicationRevisionResponse
getApplicationRevisionResponse_revisionInfo = (GetApplicationRevisionResponse -> Maybe GenericRevisionInfo)
-> (GetApplicationRevisionResponse
-> Maybe GenericRevisionInfo -> GetApplicationRevisionResponse)
-> Lens
GetApplicationRevisionResponse
GetApplicationRevisionResponse
(Maybe GenericRevisionInfo)
(Maybe GenericRevisionInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationRevisionResponse' {Maybe GenericRevisionInfo
revisionInfo :: Maybe GenericRevisionInfo
$sel:revisionInfo:GetApplicationRevisionResponse' :: GetApplicationRevisionResponse -> Maybe GenericRevisionInfo
revisionInfo} -> Maybe GenericRevisionInfo
revisionInfo) (\s :: GetApplicationRevisionResponse
s@GetApplicationRevisionResponse' {} Maybe GenericRevisionInfo
a -> GetApplicationRevisionResponse
s {$sel:revisionInfo:GetApplicationRevisionResponse' :: Maybe GenericRevisionInfo
revisionInfo = Maybe GenericRevisionInfo
a} :: GetApplicationRevisionResponse)
getApplicationRevisionResponse_revision :: Lens.Lens' GetApplicationRevisionResponse (Prelude.Maybe RevisionLocation)
getApplicationRevisionResponse_revision :: (Maybe RevisionLocation -> f (Maybe RevisionLocation))
-> GetApplicationRevisionResponse
-> f GetApplicationRevisionResponse
getApplicationRevisionResponse_revision = (GetApplicationRevisionResponse -> Maybe RevisionLocation)
-> (GetApplicationRevisionResponse
-> Maybe RevisionLocation -> GetApplicationRevisionResponse)
-> Lens
GetApplicationRevisionResponse
GetApplicationRevisionResponse
(Maybe RevisionLocation)
(Maybe RevisionLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationRevisionResponse' {Maybe RevisionLocation
revision :: Maybe RevisionLocation
$sel:revision:GetApplicationRevisionResponse' :: GetApplicationRevisionResponse -> Maybe RevisionLocation
revision} -> Maybe RevisionLocation
revision) (\s :: GetApplicationRevisionResponse
s@GetApplicationRevisionResponse' {} Maybe RevisionLocation
a -> GetApplicationRevisionResponse
s {$sel:revision:GetApplicationRevisionResponse' :: Maybe RevisionLocation
revision = Maybe RevisionLocation
a} :: GetApplicationRevisionResponse)
getApplicationRevisionResponse_httpStatus :: Lens.Lens' GetApplicationRevisionResponse Prelude.Int
getApplicationRevisionResponse_httpStatus :: (Int -> f Int)
-> GetApplicationRevisionResponse
-> f GetApplicationRevisionResponse
getApplicationRevisionResponse_httpStatus = (GetApplicationRevisionResponse -> Int)
-> (GetApplicationRevisionResponse
-> Int -> GetApplicationRevisionResponse)
-> Lens
GetApplicationRevisionResponse
GetApplicationRevisionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationRevisionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetApplicationRevisionResponse' :: GetApplicationRevisionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetApplicationRevisionResponse
s@GetApplicationRevisionResponse' {} Int
a -> GetApplicationRevisionResponse
s {$sel:httpStatus:GetApplicationRevisionResponse' :: Int
httpStatus = Int
a} :: GetApplicationRevisionResponse)
instance
Prelude.NFData
GetApplicationRevisionResponse