{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes a specific version of a solution. For more information on
-- solutions, see
-- <https://docs.aws.amazon.com/personalize/latest/dg/API_CreateSolution.html 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $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 :: Lens' DescribeSolutionVersion Text
describeSolutionVersion_solutionVersionArn = 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 :: (Service -> Service)
-> DescribeSolutionVersion -> Request DescribeSolutionVersion
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeSolutionVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSolutionVersion)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe SolutionVersion -> Int -> DescribeSolutionVersionResponse
DescribeSolutionVersionResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"solutionVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeSolutionVersion where
  hashWithSalt :: Int -> DescribeSolutionVersion -> Int
hashWithSalt Int
_salt DescribeSolutionVersion' {Text
solutionVersionArn :: Text
$sel:solutionVersionArn:DescribeSolutionVersion' :: DescribeSolutionVersion -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
solutionVersionArn

instance Prelude.NFData DescribeSolutionVersion where
  rnf :: DescribeSolutionVersion -> ()
rnf DescribeSolutionVersion' {Text
solutionVersionArn :: Text
$sel:solutionVersionArn:DescribeSolutionVersion' :: DescribeSolutionVersion -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
solutionVersionArn

instance Data.ToHeaders DescribeSolutionVersion where
  toHeaders :: DescribeSolutionVersion -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonPersonalize.DescribeSolutionVersion" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DescribeSolutionVersion where
  toJSON :: DescribeSolutionVersion -> Value
toJSON DescribeSolutionVersion' {Text
solutionVersionArn :: Text
$sel:solutionVersionArn:DescribeSolutionVersion' :: DescribeSolutionVersion -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"solutionVersionArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
solutionVersionArn)
          ]
      )

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

instance Data.ToQuery DescribeSolutionVersion where
  toQuery :: DescribeSolutionVersion -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:solutionVersion:DescribeSolutionVersionResponse' :: Maybe SolutionVersion
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 :: Lens' DescribeSolutionVersionResponse (Maybe SolutionVersion)
describeSolutionVersionResponse_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 :: Lens' DescribeSolutionVersionResponse Int
describeSolutionVersionResponse_httpStatus = 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
  where
  rnf :: DescribeSolutionVersionResponse -> ()
rnf DescribeSolutionVersionResponse' {Int
Maybe SolutionVersion
httpStatus :: Int
solutionVersion :: Maybe SolutionVersion
$sel:httpStatus:DescribeSolutionVersionResponse' :: DescribeSolutionVersionResponse -> Int
$sel:solutionVersion:DescribeSolutionVersionResponse' :: DescribeSolutionVersionResponse -> Maybe SolutionVersion
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SolutionVersion
solutionVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus