{-# 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.Personalize.DescribeSolutionVersion
-- 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 specific version of a solution. For more information on
-- solutions, see CreateSolution.
module Amazonka.Personalize.DescribeSolutionVersion
  ( -- * Creating a Request
    DescribeSolutionVersion (..),
    newDescribeSolutionVersion,

    -- * Request Lenses
    describeSolutionVersion_solutionVersionArn,

    -- * Destructuring the Response
    DescribeSolutionVersionResponse (..),
    newDescribeSolutionVersionResponse,

    -- * Response Lenses
    describeSolutionVersionResponse_solutionVersion,
    describeSolutionVersionResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'DescribeSolutionVersion' 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:
--
-- 'solutionVersionArn', 'describeSolutionVersion_solutionVersionArn' - The Amazon Resource Name (ARN) of the solution version.
newDescribeSolutionVersion ::
  -- | 'solutionVersionArn'
  Prelude.Text ->
  DescribeSolutionVersion
newDescribeSolutionVersion :: Text -> DescribeSolutionVersion
newDescribeSolutionVersion Text
pSolutionVersionArn_ =
  DescribeSolutionVersion' :: Text -> DescribeSolutionVersion
DescribeSolutionVersion'
    { $sel:solutionVersionArn:DescribeSolutionVersion' :: Text
solutionVersionArn =
        Text
pSolutionVersionArn_
    }

-- | The Amazon Resource Name (ARN) of the solution version.
describeSolutionVersion_solutionVersionArn :: Lens.Lens' DescribeSolutionVersion Prelude.Text
describeSolutionVersion_solutionVersionArn :: (Text -> f Text)
-> DescribeSolutionVersion -> f DescribeSolutionVersion
describeSolutionVersion_solutionVersionArn = (DescribeSolutionVersion -> Text)
-> (DescribeSolutionVersion -> Text -> DescribeSolutionVersion)
-> Lens DescribeSolutionVersion DescribeSolutionVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSolutionVersion' {Text
solutionVersionArn :: Text
$sel:solutionVersionArn:DescribeSolutionVersion' :: DescribeSolutionVersion -> Text
solutionVersionArn} -> Text
solutionVersionArn) (\s :: DescribeSolutionVersion
s@DescribeSolutionVersion' {} Text
a -> DescribeSolutionVersion
s {$sel:solutionVersionArn:DescribeSolutionVersion' :: Text
solutionVersionArn = Text
a} :: DescribeSolutionVersion)

instance Core.AWSRequest DescribeSolutionVersion where
  type
    AWSResponse DescribeSolutionVersion =
      DescribeSolutionVersionResponse
  request :: DescribeSolutionVersion -> Request DescribeSolutionVersion
request = Service
-> DescribeSolutionVersion -> Request DescribeSolutionVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeSolutionVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSolutionVersion)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeSolutionVersion))
-> Logger
-> Service
-> Proxy DescribeSolutionVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSolutionVersion)))
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 SolutionVersion -> Int -> DescribeSolutionVersionResponse
DescribeSolutionVersionResponse'
            (Maybe SolutionVersion -> Int -> DescribeSolutionVersionResponse)
-> Either String (Maybe SolutionVersion)
-> Either String (Int -> DescribeSolutionVersionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe SolutionVersion)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"solutionVersion")
            Either String (Int -> DescribeSolutionVersionResponse)
-> Either String Int
-> Either String DescribeSolutionVersionResponse
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 DescribeSolutionVersion

instance Prelude.NFData DescribeSolutionVersion

instance Core.ToHeaders DescribeSolutionVersion where
  toHeaders :: DescribeSolutionVersion -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeSolutionVersion -> 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
"AmazonPersonalize.DescribeSolutionVersion" ::
                          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 DescribeSolutionVersion where
  toJSON :: DescribeSolutionVersion -> Value
toJSON DescribeSolutionVersion' {Text
solutionVersionArn :: Text
$sel:solutionVersionArn:DescribeSolutionVersion' :: DescribeSolutionVersion -> 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
"solutionVersionArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
solutionVersionArn)
          ]
      )

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

instance Core.ToQuery DescribeSolutionVersion where
  toQuery :: DescribeSolutionVersion -> QueryString
toQuery = QueryString -> DescribeSolutionVersion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

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

-- |
-- Create a value of 'DescribeSolutionVersionResponse' 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:
--
-- 'solutionVersion', 'describeSolutionVersionResponse_solutionVersion' - The solution version.
--
-- 'httpStatus', 'describeSolutionVersionResponse_httpStatus' - The response's http status code.
newDescribeSolutionVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeSolutionVersionResponse
newDescribeSolutionVersionResponse :: Int -> DescribeSolutionVersionResponse
newDescribeSolutionVersionResponse Int
pHttpStatus_ =
  DescribeSolutionVersionResponse' :: Maybe SolutionVersion -> Int -> DescribeSolutionVersionResponse
DescribeSolutionVersionResponse'
    { $sel:solutionVersion:DescribeSolutionVersionResponse' :: Maybe SolutionVersion
solutionVersion =
        Maybe SolutionVersion
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeSolutionVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The solution version.
describeSolutionVersionResponse_solutionVersion :: Lens.Lens' DescribeSolutionVersionResponse (Prelude.Maybe SolutionVersion)
describeSolutionVersionResponse_solutionVersion :: (Maybe SolutionVersion -> f (Maybe SolutionVersion))
-> DescribeSolutionVersionResponse
-> f DescribeSolutionVersionResponse
describeSolutionVersionResponse_solutionVersion = (DescribeSolutionVersionResponse -> Maybe SolutionVersion)
-> (DescribeSolutionVersionResponse
    -> Maybe SolutionVersion -> DescribeSolutionVersionResponse)
-> Lens
     DescribeSolutionVersionResponse
     DescribeSolutionVersionResponse
     (Maybe SolutionVersion)
     (Maybe SolutionVersion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSolutionVersionResponse' {Maybe SolutionVersion
solutionVersion :: Maybe SolutionVersion
$sel:solutionVersion:DescribeSolutionVersionResponse' :: DescribeSolutionVersionResponse -> Maybe SolutionVersion
solutionVersion} -> Maybe SolutionVersion
solutionVersion) (\s :: DescribeSolutionVersionResponse
s@DescribeSolutionVersionResponse' {} Maybe SolutionVersion
a -> DescribeSolutionVersionResponse
s {$sel:solutionVersion:DescribeSolutionVersionResponse' :: Maybe SolutionVersion
solutionVersion = Maybe SolutionVersion
a} :: DescribeSolutionVersionResponse)

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

instance
  Prelude.NFData
    DescribeSolutionVersionResponse