{-# 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.DescribeFeatureTransformation
-- 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 the given feature transformation.
module Amazonka.Personalize.DescribeFeatureTransformation
  ( -- * Creating a Request
    DescribeFeatureTransformation (..),
    newDescribeFeatureTransformation,

    -- * Request Lenses
    describeFeatureTransformation_featureTransformationArn,

    -- * Destructuring the Response
    DescribeFeatureTransformationResponse (..),
    newDescribeFeatureTransformationResponse,

    -- * Response Lenses
    describeFeatureTransformationResponse_featureTransformation,
    describeFeatureTransformationResponse_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:/ 'newDescribeFeatureTransformation' smart constructor.
data DescribeFeatureTransformation = DescribeFeatureTransformation'
  { -- | The Amazon Resource Name (ARN) of the feature transformation to
    -- describe.
    DescribeFeatureTransformation -> Text
featureTransformationArn :: Prelude.Text
  }
  deriving (DescribeFeatureTransformation
-> DescribeFeatureTransformation -> Bool
(DescribeFeatureTransformation
 -> DescribeFeatureTransformation -> Bool)
-> (DescribeFeatureTransformation
    -> DescribeFeatureTransformation -> Bool)
-> Eq DescribeFeatureTransformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFeatureTransformation
-> DescribeFeatureTransformation -> Bool
$c/= :: DescribeFeatureTransformation
-> DescribeFeatureTransformation -> Bool
== :: DescribeFeatureTransformation
-> DescribeFeatureTransformation -> Bool
$c== :: DescribeFeatureTransformation
-> DescribeFeatureTransformation -> Bool
Prelude.Eq, ReadPrec [DescribeFeatureTransformation]
ReadPrec DescribeFeatureTransformation
Int -> ReadS DescribeFeatureTransformation
ReadS [DescribeFeatureTransformation]
(Int -> ReadS DescribeFeatureTransformation)
-> ReadS [DescribeFeatureTransformation]
-> ReadPrec DescribeFeatureTransformation
-> ReadPrec [DescribeFeatureTransformation]
-> Read DescribeFeatureTransformation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFeatureTransformation]
$creadListPrec :: ReadPrec [DescribeFeatureTransformation]
readPrec :: ReadPrec DescribeFeatureTransformation
$creadPrec :: ReadPrec DescribeFeatureTransformation
readList :: ReadS [DescribeFeatureTransformation]
$creadList :: ReadS [DescribeFeatureTransformation]
readsPrec :: Int -> ReadS DescribeFeatureTransformation
$creadsPrec :: Int -> ReadS DescribeFeatureTransformation
Prelude.Read, Int -> DescribeFeatureTransformation -> ShowS
[DescribeFeatureTransformation] -> ShowS
DescribeFeatureTransformation -> String
(Int -> DescribeFeatureTransformation -> ShowS)
-> (DescribeFeatureTransformation -> String)
-> ([DescribeFeatureTransformation] -> ShowS)
-> Show DescribeFeatureTransformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFeatureTransformation] -> ShowS
$cshowList :: [DescribeFeatureTransformation] -> ShowS
show :: DescribeFeatureTransformation -> String
$cshow :: DescribeFeatureTransformation -> String
showsPrec :: Int -> DescribeFeatureTransformation -> ShowS
$cshowsPrec :: Int -> DescribeFeatureTransformation -> ShowS
Prelude.Show, (forall x.
 DescribeFeatureTransformation
 -> Rep DescribeFeatureTransformation x)
-> (forall x.
    Rep DescribeFeatureTransformation x
    -> DescribeFeatureTransformation)
-> Generic DescribeFeatureTransformation
forall x.
Rep DescribeFeatureTransformation x
-> DescribeFeatureTransformation
forall x.
DescribeFeatureTransformation
-> Rep DescribeFeatureTransformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeFeatureTransformation x
-> DescribeFeatureTransformation
$cfrom :: forall x.
DescribeFeatureTransformation
-> Rep DescribeFeatureTransformation x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFeatureTransformation' 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:
--
-- 'featureTransformationArn', 'describeFeatureTransformation_featureTransformationArn' - The Amazon Resource Name (ARN) of the feature transformation to
-- describe.
newDescribeFeatureTransformation ::
  -- | 'featureTransformationArn'
  Prelude.Text ->
  DescribeFeatureTransformation
newDescribeFeatureTransformation :: Text -> DescribeFeatureTransformation
newDescribeFeatureTransformation
  Text
pFeatureTransformationArn_ =
    DescribeFeatureTransformation' :: Text -> DescribeFeatureTransformation
DescribeFeatureTransformation'
      { $sel:featureTransformationArn:DescribeFeatureTransformation' :: Text
featureTransformationArn =
          Text
pFeatureTransformationArn_
      }

-- | The Amazon Resource Name (ARN) of the feature transformation to
-- describe.
describeFeatureTransformation_featureTransformationArn :: Lens.Lens' DescribeFeatureTransformation Prelude.Text
describeFeatureTransformation_featureTransformationArn :: (Text -> f Text)
-> DescribeFeatureTransformation -> f DescribeFeatureTransformation
describeFeatureTransformation_featureTransformationArn = (DescribeFeatureTransformation -> Text)
-> (DescribeFeatureTransformation
    -> Text -> DescribeFeatureTransformation)
-> Lens
     DescribeFeatureTransformation
     DescribeFeatureTransformation
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFeatureTransformation' {Text
featureTransformationArn :: Text
$sel:featureTransformationArn:DescribeFeatureTransformation' :: DescribeFeatureTransformation -> Text
featureTransformationArn} -> Text
featureTransformationArn) (\s :: DescribeFeatureTransformation
s@DescribeFeatureTransformation' {} Text
a -> DescribeFeatureTransformation
s {$sel:featureTransformationArn:DescribeFeatureTransformation' :: Text
featureTransformationArn = Text
a} :: DescribeFeatureTransformation)

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

instance Prelude.NFData DescribeFeatureTransformation

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

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

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

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

-- |
-- Create a value of 'DescribeFeatureTransformationResponse' 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:
--
-- 'featureTransformation', 'describeFeatureTransformationResponse_featureTransformation' - A listing of the FeatureTransformation properties.
--
-- 'httpStatus', 'describeFeatureTransformationResponse_httpStatus' - The response's http status code.
newDescribeFeatureTransformationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeFeatureTransformationResponse
newDescribeFeatureTransformationResponse :: Int -> DescribeFeatureTransformationResponse
newDescribeFeatureTransformationResponse Int
pHttpStatus_ =
  DescribeFeatureTransformationResponse' :: Maybe FeatureTransformation
-> Int -> DescribeFeatureTransformationResponse
DescribeFeatureTransformationResponse'
    { $sel:featureTransformation:DescribeFeatureTransformationResponse' :: Maybe FeatureTransformation
featureTransformation =
        Maybe FeatureTransformation
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeFeatureTransformationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A listing of the FeatureTransformation properties.
describeFeatureTransformationResponse_featureTransformation :: Lens.Lens' DescribeFeatureTransformationResponse (Prelude.Maybe FeatureTransformation)
describeFeatureTransformationResponse_featureTransformation :: (Maybe FeatureTransformation -> f (Maybe FeatureTransformation))
-> DescribeFeatureTransformationResponse
-> f DescribeFeatureTransformationResponse
describeFeatureTransformationResponse_featureTransformation = (DescribeFeatureTransformationResponse
 -> Maybe FeatureTransformation)
-> (DescribeFeatureTransformationResponse
    -> Maybe FeatureTransformation
    -> DescribeFeatureTransformationResponse)
-> Lens
     DescribeFeatureTransformationResponse
     DescribeFeatureTransformationResponse
     (Maybe FeatureTransformation)
     (Maybe FeatureTransformation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFeatureTransformationResponse' {Maybe FeatureTransformation
featureTransformation :: Maybe FeatureTransformation
$sel:featureTransformation:DescribeFeatureTransformationResponse' :: DescribeFeatureTransformationResponse
-> Maybe FeatureTransformation
featureTransformation} -> Maybe FeatureTransformation
featureTransformation) (\s :: DescribeFeatureTransformationResponse
s@DescribeFeatureTransformationResponse' {} Maybe FeatureTransformation
a -> DescribeFeatureTransformationResponse
s {$sel:featureTransformation:DescribeFeatureTransformationResponse' :: Maybe FeatureTransformation
featureTransformation = Maybe FeatureTransformation
a} :: DescribeFeatureTransformationResponse)

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

instance
  Prelude.NFData
    DescribeFeatureTransformationResponse