{-# 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 #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Amazonka.Proton.GetEnvironment -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Get detailed data for an environment. module Amazonka.Proton.GetEnvironment ( -- * Creating a Request GetEnvironment (..), newGetEnvironment, -- * Request Lenses getEnvironment_name, -- * Destructuring the Response GetEnvironmentResponse (..), newGetEnvironmentResponse, -- * Response Lenses getEnvironmentResponse_httpStatus, getEnvironmentResponse_environment, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import qualified Amazonka.Prelude as Prelude import Amazonka.Proton.Types import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newGetEnvironment' smart constructor. data GetEnvironment = GetEnvironment' { -- | The name of the environment that you want to get the detailed data for. name :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetEnvironment' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'name', 'getEnvironment_name' - The name of the environment that you want to get the detailed data for. newGetEnvironment :: -- | 'name' Prelude.Text -> GetEnvironment newGetEnvironment pName_ = GetEnvironment' {name = pName_} -- | The name of the environment that you want to get the detailed data for. getEnvironment_name :: Lens.Lens' GetEnvironment Prelude.Text getEnvironment_name = Lens.lens (\GetEnvironment' {name} -> name) (\s@GetEnvironment' {} a -> s {name = a} :: GetEnvironment) instance Core.AWSRequest GetEnvironment where type AWSResponse GetEnvironment = GetEnvironmentResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> GetEnvironmentResponse' Prelude.<$> (Prelude.pure (Prelude.fromEnum s)) Prelude.<*> (x Data..:> "environment") ) instance Prelude.Hashable GetEnvironment where hashWithSalt _salt GetEnvironment' {..} = _salt `Prelude.hashWithSalt` name instance Prelude.NFData GetEnvironment where rnf GetEnvironment' {..} = Prelude.rnf name instance Data.ToHeaders GetEnvironment where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "AwsProton20200720.GetEnvironment" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.0" :: Prelude.ByteString ) ] ) instance Data.ToJSON GetEnvironment where toJSON GetEnvironment' {..} = Data.object ( Prelude.catMaybes [Prelude.Just ("name" Data..= name)] ) instance Data.ToPath GetEnvironment where toPath = Prelude.const "/" instance Data.ToQuery GetEnvironment where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newGetEnvironmentResponse' smart constructor. data GetEnvironmentResponse = GetEnvironmentResponse' { -- | The response's http status code. httpStatus :: Prelude.Int, -- | The detailed data of the requested environment. environment :: Environment } deriving (Prelude.Eq, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetEnvironmentResponse' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'httpStatus', 'getEnvironmentResponse_httpStatus' - The response's http status code. -- -- 'environment', 'getEnvironmentResponse_environment' - The detailed data of the requested environment. newGetEnvironmentResponse :: -- | 'httpStatus' Prelude.Int -> -- | 'environment' Environment -> GetEnvironmentResponse newGetEnvironmentResponse pHttpStatus_ pEnvironment_ = GetEnvironmentResponse' { httpStatus = pHttpStatus_, environment = pEnvironment_ } -- | The response's http status code. getEnvironmentResponse_httpStatus :: Lens.Lens' GetEnvironmentResponse Prelude.Int getEnvironmentResponse_httpStatus = Lens.lens (\GetEnvironmentResponse' {httpStatus} -> httpStatus) (\s@GetEnvironmentResponse' {} a -> s {httpStatus = a} :: GetEnvironmentResponse) -- | The detailed data of the requested environment. getEnvironmentResponse_environment :: Lens.Lens' GetEnvironmentResponse Environment getEnvironmentResponse_environment = Lens.lens (\GetEnvironmentResponse' {environment} -> environment) (\s@GetEnvironmentResponse' {} a -> s {environment = a} :: GetEnvironmentResponse) instance Prelude.NFData GetEnvironmentResponse where rnf GetEnvironmentResponse' {..} = Prelude.rnf httpStatus `Prelude.seq` Prelude.rnf environment