{-# 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.ElasticBeanstalk.DescribePlatformVersion
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes a platform version. Provides full details. Compare to
-- ListPlatformVersions, which provides summary information about a list of
-- platform versions.
--
-- For definitions of platform version and other platform-related terms,
-- see
-- <https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-glossary.html AWS Elastic Beanstalk Platforms Glossary>.
module Amazonka.ElasticBeanstalk.DescribePlatformVersion
  ( -- * Creating a Request
    DescribePlatformVersion (..),
    newDescribePlatformVersion,

    -- * Request Lenses
    describePlatformVersion_platformArn,

    -- * Destructuring the Response
    DescribePlatformVersionResponse (..),
    newDescribePlatformVersionResponse,

    -- * Response Lenses
    describePlatformVersionResponse_platformDescription,
    describePlatformVersionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ElasticBeanstalk.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribePlatformVersion' smart constructor.
data DescribePlatformVersion = DescribePlatformVersion'
  { -- | The ARN of the platform version.
    DescribePlatformVersion -> Maybe Text
platformArn :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribePlatformVersion -> DescribePlatformVersion -> Bool
(DescribePlatformVersion -> DescribePlatformVersion -> Bool)
-> (DescribePlatformVersion -> DescribePlatformVersion -> Bool)
-> Eq DescribePlatformVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePlatformVersion -> DescribePlatformVersion -> Bool
$c/= :: DescribePlatformVersion -> DescribePlatformVersion -> Bool
== :: DescribePlatformVersion -> DescribePlatformVersion -> Bool
$c== :: DescribePlatformVersion -> DescribePlatformVersion -> Bool
Prelude.Eq, ReadPrec [DescribePlatformVersion]
ReadPrec DescribePlatformVersion
Int -> ReadS DescribePlatformVersion
ReadS [DescribePlatformVersion]
(Int -> ReadS DescribePlatformVersion)
-> ReadS [DescribePlatformVersion]
-> ReadPrec DescribePlatformVersion
-> ReadPrec [DescribePlatformVersion]
-> Read DescribePlatformVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePlatformVersion]
$creadListPrec :: ReadPrec [DescribePlatformVersion]
readPrec :: ReadPrec DescribePlatformVersion
$creadPrec :: ReadPrec DescribePlatformVersion
readList :: ReadS [DescribePlatformVersion]
$creadList :: ReadS [DescribePlatformVersion]
readsPrec :: Int -> ReadS DescribePlatformVersion
$creadsPrec :: Int -> ReadS DescribePlatformVersion
Prelude.Read, Int -> DescribePlatformVersion -> ShowS
[DescribePlatformVersion] -> ShowS
DescribePlatformVersion -> String
(Int -> DescribePlatformVersion -> ShowS)
-> (DescribePlatformVersion -> String)
-> ([DescribePlatformVersion] -> ShowS)
-> Show DescribePlatformVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePlatformVersion] -> ShowS
$cshowList :: [DescribePlatformVersion] -> ShowS
show :: DescribePlatformVersion -> String
$cshow :: DescribePlatformVersion -> String
showsPrec :: Int -> DescribePlatformVersion -> ShowS
$cshowsPrec :: Int -> DescribePlatformVersion -> ShowS
Prelude.Show, (forall x.
 DescribePlatformVersion -> Rep DescribePlatformVersion x)
-> (forall x.
    Rep DescribePlatformVersion x -> DescribePlatformVersion)
-> Generic DescribePlatformVersion
forall x. Rep DescribePlatformVersion x -> DescribePlatformVersion
forall x. DescribePlatformVersion -> Rep DescribePlatformVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribePlatformVersion x -> DescribePlatformVersion
$cfrom :: forall x. DescribePlatformVersion -> Rep DescribePlatformVersion x
Prelude.Generic)

-- |
-- Create a value of 'DescribePlatformVersion' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'platformArn', 'describePlatformVersion_platformArn' - The ARN of the platform version.
newDescribePlatformVersion ::
  DescribePlatformVersion
newDescribePlatformVersion :: DescribePlatformVersion
newDescribePlatformVersion =
  DescribePlatformVersion' :: Maybe Text -> DescribePlatformVersion
DescribePlatformVersion'
    { $sel:platformArn:DescribePlatformVersion' :: Maybe Text
platformArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the platform version.
describePlatformVersion_platformArn :: Lens.Lens' DescribePlatformVersion (Prelude.Maybe Prelude.Text)
describePlatformVersion_platformArn :: (Maybe Text -> f (Maybe Text))
-> DescribePlatformVersion -> f DescribePlatformVersion
describePlatformVersion_platformArn = (DescribePlatformVersion -> Maybe Text)
-> (DescribePlatformVersion
    -> Maybe Text -> DescribePlatformVersion)
-> Lens
     DescribePlatformVersion
     DescribePlatformVersion
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePlatformVersion' {Maybe Text
platformArn :: Maybe Text
$sel:platformArn:DescribePlatformVersion' :: DescribePlatformVersion -> Maybe Text
platformArn} -> Maybe Text
platformArn) (\s :: DescribePlatformVersion
s@DescribePlatformVersion' {} Maybe Text
a -> DescribePlatformVersion
s {$sel:platformArn:DescribePlatformVersion' :: Maybe Text
platformArn = Maybe Text
a} :: DescribePlatformVersion)

instance Core.AWSRequest DescribePlatformVersion where
  type
    AWSResponse DescribePlatformVersion =
      DescribePlatformVersionResponse
  request :: DescribePlatformVersion -> Request DescribePlatformVersion
request = Service
-> DescribePlatformVersion -> Request DescribePlatformVersion
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribePlatformVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribePlatformVersion)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribePlatformVersion))
-> Logger
-> Service
-> Proxy DescribePlatformVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribePlatformVersion)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribePlatformVersionResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe PlatformDescription -> Int -> DescribePlatformVersionResponse
DescribePlatformVersionResponse'
            (Maybe PlatformDescription
 -> Int -> DescribePlatformVersionResponse)
-> Either String (Maybe PlatformDescription)
-> Either String (Int -> DescribePlatformVersionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe PlatformDescription)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PlatformDescription")
            Either String (Int -> DescribePlatformVersionResponse)
-> Either String Int
-> Either String DescribePlatformVersionResponse
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 DescribePlatformVersion

instance Prelude.NFData DescribePlatformVersion

instance Core.ToHeaders DescribePlatformVersion where
  toHeaders :: DescribePlatformVersion -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribePlatformVersion -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DescribePlatformVersion where
  toPath :: DescribePlatformVersion -> ByteString
toPath = ByteString -> DescribePlatformVersion -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DescribePlatformVersion where
  toQuery :: DescribePlatformVersion -> QueryString
toQuery DescribePlatformVersion' {Maybe Text
platformArn :: Maybe Text
$sel:platformArn:DescribePlatformVersion' :: DescribePlatformVersion -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribePlatformVersion" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"PlatformArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
platformArn
      ]

-- | /See:/ 'newDescribePlatformVersionResponse' smart constructor.
data DescribePlatformVersionResponse = DescribePlatformVersionResponse'
  { -- | Detailed information about the platform version.
    DescribePlatformVersionResponse -> Maybe PlatformDescription
platformDescription :: Prelude.Maybe PlatformDescription,
    -- | The response's http status code.
    DescribePlatformVersionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribePlatformVersionResponse
-> DescribePlatformVersionResponse -> Bool
(DescribePlatformVersionResponse
 -> DescribePlatformVersionResponse -> Bool)
-> (DescribePlatformVersionResponse
    -> DescribePlatformVersionResponse -> Bool)
-> Eq DescribePlatformVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePlatformVersionResponse
-> DescribePlatformVersionResponse -> Bool
$c/= :: DescribePlatformVersionResponse
-> DescribePlatformVersionResponse -> Bool
== :: DescribePlatformVersionResponse
-> DescribePlatformVersionResponse -> Bool
$c== :: DescribePlatformVersionResponse
-> DescribePlatformVersionResponse -> Bool
Prelude.Eq, ReadPrec [DescribePlatformVersionResponse]
ReadPrec DescribePlatformVersionResponse
Int -> ReadS DescribePlatformVersionResponse
ReadS [DescribePlatformVersionResponse]
(Int -> ReadS DescribePlatformVersionResponse)
-> ReadS [DescribePlatformVersionResponse]
-> ReadPrec DescribePlatformVersionResponse
-> ReadPrec [DescribePlatformVersionResponse]
-> Read DescribePlatformVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePlatformVersionResponse]
$creadListPrec :: ReadPrec [DescribePlatformVersionResponse]
readPrec :: ReadPrec DescribePlatformVersionResponse
$creadPrec :: ReadPrec DescribePlatformVersionResponse
readList :: ReadS [DescribePlatformVersionResponse]
$creadList :: ReadS [DescribePlatformVersionResponse]
readsPrec :: Int -> ReadS DescribePlatformVersionResponse
$creadsPrec :: Int -> ReadS DescribePlatformVersionResponse
Prelude.Read, Int -> DescribePlatformVersionResponse -> ShowS
[DescribePlatformVersionResponse] -> ShowS
DescribePlatformVersionResponse -> String
(Int -> DescribePlatformVersionResponse -> ShowS)
-> (DescribePlatformVersionResponse -> String)
-> ([DescribePlatformVersionResponse] -> ShowS)
-> Show DescribePlatformVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePlatformVersionResponse] -> ShowS
$cshowList :: [DescribePlatformVersionResponse] -> ShowS
show :: DescribePlatformVersionResponse -> String
$cshow :: DescribePlatformVersionResponse -> String
showsPrec :: Int -> DescribePlatformVersionResponse -> ShowS
$cshowsPrec :: Int -> DescribePlatformVersionResponse -> ShowS
Prelude.Show, (forall x.
 DescribePlatformVersionResponse
 -> Rep DescribePlatformVersionResponse x)
-> (forall x.
    Rep DescribePlatformVersionResponse x
    -> DescribePlatformVersionResponse)
-> Generic DescribePlatformVersionResponse
forall x.
Rep DescribePlatformVersionResponse x
-> DescribePlatformVersionResponse
forall x.
DescribePlatformVersionResponse
-> Rep DescribePlatformVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribePlatformVersionResponse x
-> DescribePlatformVersionResponse
$cfrom :: forall x.
DescribePlatformVersionResponse
-> Rep DescribePlatformVersionResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribePlatformVersionResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'platformDescription', 'describePlatformVersionResponse_platformDescription' - Detailed information about the platform version.
--
-- 'httpStatus', 'describePlatformVersionResponse_httpStatus' - The response's http status code.
newDescribePlatformVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribePlatformVersionResponse
newDescribePlatformVersionResponse :: Int -> DescribePlatformVersionResponse
newDescribePlatformVersionResponse Int
pHttpStatus_ =
  DescribePlatformVersionResponse' :: Maybe PlatformDescription -> Int -> DescribePlatformVersionResponse
DescribePlatformVersionResponse'
    { $sel:platformDescription:DescribePlatformVersionResponse' :: Maybe PlatformDescription
platformDescription =
        Maybe PlatformDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribePlatformVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Detailed information about the platform version.
describePlatformVersionResponse_platformDescription :: Lens.Lens' DescribePlatformVersionResponse (Prelude.Maybe PlatformDescription)
describePlatformVersionResponse_platformDescription :: (Maybe PlatformDescription -> f (Maybe PlatformDescription))
-> DescribePlatformVersionResponse
-> f DescribePlatformVersionResponse
describePlatformVersionResponse_platformDescription = (DescribePlatformVersionResponse -> Maybe PlatformDescription)
-> (DescribePlatformVersionResponse
    -> Maybe PlatformDescription -> DescribePlatformVersionResponse)
-> Lens
     DescribePlatformVersionResponse
     DescribePlatformVersionResponse
     (Maybe PlatformDescription)
     (Maybe PlatformDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePlatformVersionResponse' {Maybe PlatformDescription
platformDescription :: Maybe PlatformDescription
$sel:platformDescription:DescribePlatformVersionResponse' :: DescribePlatformVersionResponse -> Maybe PlatformDescription
platformDescription} -> Maybe PlatformDescription
platformDescription) (\s :: DescribePlatformVersionResponse
s@DescribePlatformVersionResponse' {} Maybe PlatformDescription
a -> DescribePlatformVersionResponse
s {$sel:platformDescription:DescribePlatformVersionResponse' :: Maybe PlatformDescription
platformDescription = Maybe PlatformDescription
a} :: DescribePlatformVersionResponse)

-- | The response's http status code.
describePlatformVersionResponse_httpStatus :: Lens.Lens' DescribePlatformVersionResponse Prelude.Int
describePlatformVersionResponse_httpStatus :: (Int -> f Int)
-> DescribePlatformVersionResponse
-> f DescribePlatformVersionResponse
describePlatformVersionResponse_httpStatus = (DescribePlatformVersionResponse -> Int)
-> (DescribePlatformVersionResponse
    -> Int -> DescribePlatformVersionResponse)
-> Lens
     DescribePlatformVersionResponse
     DescribePlatformVersionResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePlatformVersionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribePlatformVersionResponse' :: DescribePlatformVersionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribePlatformVersionResponse
s@DescribePlatformVersionResponse' {} Int
a -> DescribePlatformVersionResponse
s {$sel:httpStatus:DescribePlatformVersionResponse' :: Int
httpStatus = Int
a} :: DescribePlatformVersionResponse)

instance
  Prelude.NFData
    DescribePlatformVersionResponse