{-# 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 #-}
module Amazonka.Personalize.DescribeFilter
(
DescribeFilter (..),
newDescribeFilter,
describeFilter_filterArn,
DescribeFilterResponse (..),
newDescribeFilterResponse,
describeFilterResponse_filter,
describeFilterResponse_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
data DescribeFilter = DescribeFilter'
{
DescribeFilter -> Text
filterArn :: Prelude.Text
}
deriving (DescribeFilter -> DescribeFilter -> Bool
(DescribeFilter -> DescribeFilter -> Bool)
-> (DescribeFilter -> DescribeFilter -> Bool) -> Eq DescribeFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFilter -> DescribeFilter -> Bool
$c/= :: DescribeFilter -> DescribeFilter -> Bool
== :: DescribeFilter -> DescribeFilter -> Bool
$c== :: DescribeFilter -> DescribeFilter -> Bool
Prelude.Eq, ReadPrec [DescribeFilter]
ReadPrec DescribeFilter
Int -> ReadS DescribeFilter
ReadS [DescribeFilter]
(Int -> ReadS DescribeFilter)
-> ReadS [DescribeFilter]
-> ReadPrec DescribeFilter
-> ReadPrec [DescribeFilter]
-> Read DescribeFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFilter]
$creadListPrec :: ReadPrec [DescribeFilter]
readPrec :: ReadPrec DescribeFilter
$creadPrec :: ReadPrec DescribeFilter
readList :: ReadS [DescribeFilter]
$creadList :: ReadS [DescribeFilter]
readsPrec :: Int -> ReadS DescribeFilter
$creadsPrec :: Int -> ReadS DescribeFilter
Prelude.Read, Int -> DescribeFilter -> ShowS
[DescribeFilter] -> ShowS
DescribeFilter -> String
(Int -> DescribeFilter -> ShowS)
-> (DescribeFilter -> String)
-> ([DescribeFilter] -> ShowS)
-> Show DescribeFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFilter] -> ShowS
$cshowList :: [DescribeFilter] -> ShowS
show :: DescribeFilter -> String
$cshow :: DescribeFilter -> String
showsPrec :: Int -> DescribeFilter -> ShowS
$cshowsPrec :: Int -> DescribeFilter -> ShowS
Prelude.Show, (forall x. DescribeFilter -> Rep DescribeFilter x)
-> (forall x. Rep DescribeFilter x -> DescribeFilter)
-> Generic DescribeFilter
forall x. Rep DescribeFilter x -> DescribeFilter
forall x. DescribeFilter -> Rep DescribeFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFilter x -> DescribeFilter
$cfrom :: forall x. DescribeFilter -> Rep DescribeFilter x
Prelude.Generic)
newDescribeFilter ::
Prelude.Text ->
DescribeFilter
newDescribeFilter :: Text -> DescribeFilter
newDescribeFilter Text
pFilterArn_ =
DescribeFilter' :: Text -> DescribeFilter
DescribeFilter' {$sel:filterArn:DescribeFilter' :: Text
filterArn = Text
pFilterArn_}
describeFilter_filterArn :: Lens.Lens' DescribeFilter Prelude.Text
describeFilter_filterArn :: (Text -> f Text) -> DescribeFilter -> f DescribeFilter
describeFilter_filterArn = (DescribeFilter -> Text)
-> (DescribeFilter -> Text -> DescribeFilter)
-> Lens DescribeFilter DescribeFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFilter' {Text
filterArn :: Text
$sel:filterArn:DescribeFilter' :: DescribeFilter -> Text
filterArn} -> Text
filterArn) (\s :: DescribeFilter
s@DescribeFilter' {} Text
a -> DescribeFilter
s {$sel:filterArn:DescribeFilter' :: Text
filterArn = Text
a} :: DescribeFilter)
instance Core.AWSRequest DescribeFilter where
type
AWSResponse DescribeFilter =
DescribeFilterResponse
request :: DescribeFilter -> Request DescribeFilter
request = Service -> DescribeFilter -> Request DescribeFilter
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeFilter
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeFilter)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeFilter))
-> Logger
-> Service
-> Proxy DescribeFilter
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeFilter)))
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 Filter -> Int -> DescribeFilterResponse
DescribeFilterResponse'
(Maybe Filter -> Int -> DescribeFilterResponse)
-> Either String (Maybe Filter)
-> Either String (Int -> DescribeFilterResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Filter)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"filter")
Either String (Int -> DescribeFilterResponse)
-> Either String Int -> Either String DescribeFilterResponse
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 DescribeFilter
instance Prelude.NFData DescribeFilter
instance Core.ToHeaders DescribeFilter where
toHeaders :: DescribeFilter -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeFilter -> 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.DescribeFilter" ::
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 DescribeFilter where
toJSON :: DescribeFilter -> Value
toJSON DescribeFilter' {Text
filterArn :: Text
$sel:filterArn:DescribeFilter' :: DescribeFilter -> 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
"filterArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
filterArn)]
)
instance Core.ToPath DescribeFilter where
toPath :: DescribeFilter -> ByteString
toPath = ByteString -> DescribeFilter -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeFilter where
toQuery :: DescribeFilter -> QueryString
toQuery = QueryString -> DescribeFilter -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeFilterResponse = DescribeFilterResponse'
{
DescribeFilterResponse -> Maybe Filter
filter' :: Prelude.Maybe Filter,
DescribeFilterResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeFilterResponse -> DescribeFilterResponse -> Bool
(DescribeFilterResponse -> DescribeFilterResponse -> Bool)
-> (DescribeFilterResponse -> DescribeFilterResponse -> Bool)
-> Eq DescribeFilterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFilterResponse -> DescribeFilterResponse -> Bool
$c/= :: DescribeFilterResponse -> DescribeFilterResponse -> Bool
== :: DescribeFilterResponse -> DescribeFilterResponse -> Bool
$c== :: DescribeFilterResponse -> DescribeFilterResponse -> Bool
Prelude.Eq, Int -> DescribeFilterResponse -> ShowS
[DescribeFilterResponse] -> ShowS
DescribeFilterResponse -> String
(Int -> DescribeFilterResponse -> ShowS)
-> (DescribeFilterResponse -> String)
-> ([DescribeFilterResponse] -> ShowS)
-> Show DescribeFilterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFilterResponse] -> ShowS
$cshowList :: [DescribeFilterResponse] -> ShowS
show :: DescribeFilterResponse -> String
$cshow :: DescribeFilterResponse -> String
showsPrec :: Int -> DescribeFilterResponse -> ShowS
$cshowsPrec :: Int -> DescribeFilterResponse -> ShowS
Prelude.Show, (forall x. DescribeFilterResponse -> Rep DescribeFilterResponse x)
-> (forall x.
Rep DescribeFilterResponse x -> DescribeFilterResponse)
-> Generic DescribeFilterResponse
forall x. Rep DescribeFilterResponse x -> DescribeFilterResponse
forall x. DescribeFilterResponse -> Rep DescribeFilterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFilterResponse x -> DescribeFilterResponse
$cfrom :: forall x. DescribeFilterResponse -> Rep DescribeFilterResponse x
Prelude.Generic)
newDescribeFilterResponse ::
Prelude.Int ->
DescribeFilterResponse
newDescribeFilterResponse :: Int -> DescribeFilterResponse
newDescribeFilterResponse Int
pHttpStatus_ =
DescribeFilterResponse' :: Maybe Filter -> Int -> DescribeFilterResponse
DescribeFilterResponse'
{ $sel:filter':DescribeFilterResponse' :: Maybe Filter
filter' = Maybe Filter
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeFilterResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeFilterResponse_filter :: Lens.Lens' DescribeFilterResponse (Prelude.Maybe Filter)
describeFilterResponse_filter :: (Maybe Filter -> f (Maybe Filter))
-> DescribeFilterResponse -> f DescribeFilterResponse
describeFilterResponse_filter = (DescribeFilterResponse -> Maybe Filter)
-> (DescribeFilterResponse
-> Maybe Filter -> DescribeFilterResponse)
-> Lens
DescribeFilterResponse
DescribeFilterResponse
(Maybe Filter)
(Maybe Filter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFilterResponse' {Maybe Filter
filter' :: Maybe Filter
$sel:filter':DescribeFilterResponse' :: DescribeFilterResponse -> Maybe Filter
filter'} -> Maybe Filter
filter') (\s :: DescribeFilterResponse
s@DescribeFilterResponse' {} Maybe Filter
a -> DescribeFilterResponse
s {$sel:filter':DescribeFilterResponse' :: Maybe Filter
filter' = Maybe Filter
a} :: DescribeFilterResponse)
describeFilterResponse_httpStatus :: Lens.Lens' DescribeFilterResponse Prelude.Int
describeFilterResponse_httpStatus :: (Int -> f Int)
-> DescribeFilterResponse -> f DescribeFilterResponse
describeFilterResponse_httpStatus = (DescribeFilterResponse -> Int)
-> (DescribeFilterResponse -> Int -> DescribeFilterResponse)
-> Lens DescribeFilterResponse DescribeFilterResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFilterResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeFilterResponse' :: DescribeFilterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeFilterResponse
s@DescribeFilterResponse' {} Int
a -> DescribeFilterResponse
s {$sel:httpStatus:DescribeFilterResponse' :: Int
httpStatus = Int
a} :: DescribeFilterResponse)
instance Prelude.NFData DescribeFilterResponse