{-# 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.Proton.GetEnvironment
(
GetEnvironment (..),
newGetEnvironment,
getEnvironment_name,
GetEnvironmentResponse (..),
newGetEnvironmentResponse,
getEnvironmentResponse_httpStatus,
getEnvironmentResponse_environment,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Proton.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetEnvironment = GetEnvironment'
{
GetEnvironment -> Text
name :: Prelude.Text
}
deriving (GetEnvironment -> GetEnvironment -> Bool
(GetEnvironment -> GetEnvironment -> Bool)
-> (GetEnvironment -> GetEnvironment -> Bool) -> Eq GetEnvironment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetEnvironment -> GetEnvironment -> Bool
$c/= :: GetEnvironment -> GetEnvironment -> Bool
== :: GetEnvironment -> GetEnvironment -> Bool
$c== :: GetEnvironment -> GetEnvironment -> Bool
Prelude.Eq, ReadPrec [GetEnvironment]
ReadPrec GetEnvironment
Int -> ReadS GetEnvironment
ReadS [GetEnvironment]
(Int -> ReadS GetEnvironment)
-> ReadS [GetEnvironment]
-> ReadPrec GetEnvironment
-> ReadPrec [GetEnvironment]
-> Read GetEnvironment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetEnvironment]
$creadListPrec :: ReadPrec [GetEnvironment]
readPrec :: ReadPrec GetEnvironment
$creadPrec :: ReadPrec GetEnvironment
readList :: ReadS [GetEnvironment]
$creadList :: ReadS [GetEnvironment]
readsPrec :: Int -> ReadS GetEnvironment
$creadsPrec :: Int -> ReadS GetEnvironment
Prelude.Read, Int -> GetEnvironment -> ShowS
[GetEnvironment] -> ShowS
GetEnvironment -> String
(Int -> GetEnvironment -> ShowS)
-> (GetEnvironment -> String)
-> ([GetEnvironment] -> ShowS)
-> Show GetEnvironment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetEnvironment] -> ShowS
$cshowList :: [GetEnvironment] -> ShowS
show :: GetEnvironment -> String
$cshow :: GetEnvironment -> String
showsPrec :: Int -> GetEnvironment -> ShowS
$cshowsPrec :: Int -> GetEnvironment -> ShowS
Prelude.Show, (forall x. GetEnvironment -> Rep GetEnvironment x)
-> (forall x. Rep GetEnvironment x -> GetEnvironment)
-> Generic GetEnvironment
forall x. Rep GetEnvironment x -> GetEnvironment
forall x. GetEnvironment -> Rep GetEnvironment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetEnvironment x -> GetEnvironment
$cfrom :: forall x. GetEnvironment -> Rep GetEnvironment x
Prelude.Generic)
newGetEnvironment ::
Prelude.Text ->
GetEnvironment
newGetEnvironment :: Text -> GetEnvironment
newGetEnvironment Text
pName_ =
GetEnvironment' :: Text -> GetEnvironment
GetEnvironment' {$sel:name:GetEnvironment' :: Text
name = Text
pName_}
getEnvironment_name :: Lens.Lens' GetEnvironment Prelude.Text
getEnvironment_name :: (Text -> f Text) -> GetEnvironment -> f GetEnvironment
getEnvironment_name = (GetEnvironment -> Text)
-> (GetEnvironment -> Text -> GetEnvironment)
-> Lens GetEnvironment GetEnvironment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEnvironment' {Text
name :: Text
$sel:name:GetEnvironment' :: GetEnvironment -> Text
name} -> Text
name) (\s :: GetEnvironment
s@GetEnvironment' {} Text
a -> GetEnvironment
s {$sel:name:GetEnvironment' :: Text
name = Text
a} :: GetEnvironment)
instance Core.AWSRequest GetEnvironment where
type
AWSResponse GetEnvironment =
GetEnvironmentResponse
request :: GetEnvironment -> Request GetEnvironment
request = Service -> GetEnvironment -> Request GetEnvironment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetEnvironment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetEnvironment)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetEnvironment))
-> Logger
-> Service
-> Proxy GetEnvironment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetEnvironment)))
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 ->
Int -> Environment -> GetEnvironmentResponse
GetEnvironmentResponse'
(Int -> Environment -> GetEnvironmentResponse)
-> Either String Int
-> Either String (Environment -> GetEnvironmentResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (Environment -> GetEnvironmentResponse)
-> Either String Environment
-> Either String GetEnvironmentResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Environment
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"environment")
)
instance Prelude.Hashable GetEnvironment
instance Prelude.NFData GetEnvironment
instance Core.ToHeaders GetEnvironment where
toHeaders :: GetEnvironment -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetEnvironment -> 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
"AwsProton20200720.GetEnvironment" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetEnvironment where
toJSON :: GetEnvironment -> Value
toJSON GetEnvironment' {Text
name :: Text
$sel:name:GetEnvironment' :: GetEnvironment -> 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
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
)
instance Core.ToPath GetEnvironment where
toPath :: GetEnvironment -> ByteString
toPath = ByteString -> GetEnvironment -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetEnvironment where
toQuery :: GetEnvironment -> QueryString
toQuery = QueryString -> GetEnvironment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetEnvironmentResponse = GetEnvironmentResponse'
{
GetEnvironmentResponse -> Int
httpStatus :: Prelude.Int,
GetEnvironmentResponse -> Environment
environment :: Environment
}
deriving (GetEnvironmentResponse -> GetEnvironmentResponse -> Bool
(GetEnvironmentResponse -> GetEnvironmentResponse -> Bool)
-> (GetEnvironmentResponse -> GetEnvironmentResponse -> Bool)
-> Eq GetEnvironmentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetEnvironmentResponse -> GetEnvironmentResponse -> Bool
$c/= :: GetEnvironmentResponse -> GetEnvironmentResponse -> Bool
== :: GetEnvironmentResponse -> GetEnvironmentResponse -> Bool
$c== :: GetEnvironmentResponse -> GetEnvironmentResponse -> Bool
Prelude.Eq, Int -> GetEnvironmentResponse -> ShowS
[GetEnvironmentResponse] -> ShowS
GetEnvironmentResponse -> String
(Int -> GetEnvironmentResponse -> ShowS)
-> (GetEnvironmentResponse -> String)
-> ([GetEnvironmentResponse] -> ShowS)
-> Show GetEnvironmentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetEnvironmentResponse] -> ShowS
$cshowList :: [GetEnvironmentResponse] -> ShowS
show :: GetEnvironmentResponse -> String
$cshow :: GetEnvironmentResponse -> String
showsPrec :: Int -> GetEnvironmentResponse -> ShowS
$cshowsPrec :: Int -> GetEnvironmentResponse -> ShowS
Prelude.Show, (forall x. GetEnvironmentResponse -> Rep GetEnvironmentResponse x)
-> (forall x.
Rep GetEnvironmentResponse x -> GetEnvironmentResponse)
-> Generic GetEnvironmentResponse
forall x. Rep GetEnvironmentResponse x -> GetEnvironmentResponse
forall x. GetEnvironmentResponse -> Rep GetEnvironmentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetEnvironmentResponse x -> GetEnvironmentResponse
$cfrom :: forall x. GetEnvironmentResponse -> Rep GetEnvironmentResponse x
Prelude.Generic)
newGetEnvironmentResponse ::
Prelude.Int ->
Environment ->
GetEnvironmentResponse
newGetEnvironmentResponse :: Int -> Environment -> GetEnvironmentResponse
newGetEnvironmentResponse Int
pHttpStatus_ Environment
pEnvironment_ =
GetEnvironmentResponse' :: Int -> Environment -> GetEnvironmentResponse
GetEnvironmentResponse'
{ $sel:httpStatus:GetEnvironmentResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:environment:GetEnvironmentResponse' :: Environment
environment = Environment
pEnvironment_
}
getEnvironmentResponse_httpStatus :: Lens.Lens' GetEnvironmentResponse Prelude.Int
getEnvironmentResponse_httpStatus :: (Int -> f Int)
-> GetEnvironmentResponse -> f GetEnvironmentResponse
getEnvironmentResponse_httpStatus = (GetEnvironmentResponse -> Int)
-> (GetEnvironmentResponse -> Int -> GetEnvironmentResponse)
-> Lens GetEnvironmentResponse GetEnvironmentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEnvironmentResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetEnvironmentResponse' :: GetEnvironmentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetEnvironmentResponse
s@GetEnvironmentResponse' {} Int
a -> GetEnvironmentResponse
s {$sel:httpStatus:GetEnvironmentResponse' :: Int
httpStatus = Int
a} :: GetEnvironmentResponse)
getEnvironmentResponse_environment :: Lens.Lens' GetEnvironmentResponse Environment
getEnvironmentResponse_environment :: (Environment -> f Environment)
-> GetEnvironmentResponse -> f GetEnvironmentResponse
getEnvironmentResponse_environment = (GetEnvironmentResponse -> Environment)
-> (GetEnvironmentResponse
-> Environment -> GetEnvironmentResponse)
-> Lens
GetEnvironmentResponse
GetEnvironmentResponse
Environment
Environment
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEnvironmentResponse' {Environment
environment :: Environment
$sel:environment:GetEnvironmentResponse' :: GetEnvironmentResponse -> Environment
environment} -> Environment
environment) (\s :: GetEnvironmentResponse
s@GetEnvironmentResponse' {} Environment
a -> GetEnvironmentResponse
s {$sel:environment:GetEnvironmentResponse' :: Environment
environment = Environment
a} :: GetEnvironmentResponse)
instance Prelude.NFData GetEnvironmentResponse