{-# 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.AppConfig.GetEnvironment
(
GetEnvironment (..),
newGetEnvironment,
getEnvironment_applicationId,
getEnvironment_environmentId,
Environment (..),
newEnvironment,
environment_state,
environment_monitors,
environment_applicationId,
environment_name,
environment_id,
environment_description,
)
where
import Amazonka.AppConfig.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 GetEnvironment = GetEnvironment'
{
GetEnvironment -> Text
applicationId :: Prelude.Text,
GetEnvironment -> Text
environmentId :: 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 ->
Prelude.Text ->
GetEnvironment
newGetEnvironment :: Text -> Text -> GetEnvironment
newGetEnvironment Text
pApplicationId_ Text
pEnvironmentId_ =
GetEnvironment' :: Text -> Text -> GetEnvironment
GetEnvironment'
{ $sel:applicationId:GetEnvironment' :: Text
applicationId = Text
pApplicationId_,
$sel:environmentId:GetEnvironment' :: Text
environmentId = Text
pEnvironmentId_
}
getEnvironment_applicationId :: Lens.Lens' GetEnvironment Prelude.Text
getEnvironment_applicationId :: (Text -> f Text) -> GetEnvironment -> f GetEnvironment
getEnvironment_applicationId = (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
applicationId :: Text
$sel:applicationId:GetEnvironment' :: GetEnvironment -> Text
applicationId} -> Text
applicationId) (\s :: GetEnvironment
s@GetEnvironment' {} Text
a -> GetEnvironment
s {$sel:applicationId:GetEnvironment' :: Text
applicationId = Text
a} :: GetEnvironment)
getEnvironment_environmentId :: Lens.Lens' GetEnvironment Prelude.Text
getEnvironment_environmentId :: (Text -> f Text) -> GetEnvironment -> f GetEnvironment
getEnvironment_environmentId = (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
environmentId :: Text
$sel:environmentId:GetEnvironment' :: GetEnvironment -> Text
environmentId} -> Text
environmentId) (\s :: GetEnvironment
s@GetEnvironment' {} Text
a -> GetEnvironment
s {$sel:environmentId:GetEnvironment' :: Text
environmentId = Text
a} :: GetEnvironment)
instance Core.AWSRequest GetEnvironment where
type AWSResponse GetEnvironment = Environment
request :: GetEnvironment -> Request GetEnvironment
request = Service -> GetEnvironment -> Request GetEnvironment
forall a. ToRequest a => Service -> a -> Request a
Request.get 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 -> Object -> Either String Environment
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
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
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToPath GetEnvironment where
toPath :: GetEnvironment -> ByteString
toPath GetEnvironment' {Text
environmentId :: Text
applicationId :: Text
$sel:environmentId:GetEnvironment' :: GetEnvironment -> Text
$sel:applicationId:GetEnvironment' :: GetEnvironment -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/applications/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
ByteString
"/environments/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
environmentId
]
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