{-# 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.SageMakerFeatureStoreRuntime.GetRecord
(
GetRecord (..),
newGetRecord,
getRecord_featureNames,
getRecord_featureGroupName,
getRecord_recordIdentifierValueAsString,
GetRecordResponse (..),
newGetRecordResponse,
getRecordResponse_record,
getRecordResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SageMakerFeatureStoreRuntime.Types
data GetRecord = GetRecord'
{
GetRecord -> Maybe (NonEmpty Text)
featureNames :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
GetRecord -> Text
featureGroupName :: Prelude.Text,
GetRecord -> Text
recordIdentifierValueAsString :: Prelude.Text
}
deriving (GetRecord -> GetRecord -> Bool
(GetRecord -> GetRecord -> Bool)
-> (GetRecord -> GetRecord -> Bool) -> Eq GetRecord
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRecord -> GetRecord -> Bool
$c/= :: GetRecord -> GetRecord -> Bool
== :: GetRecord -> GetRecord -> Bool
$c== :: GetRecord -> GetRecord -> Bool
Prelude.Eq, ReadPrec [GetRecord]
ReadPrec GetRecord
Int -> ReadS GetRecord
ReadS [GetRecord]
(Int -> ReadS GetRecord)
-> ReadS [GetRecord]
-> ReadPrec GetRecord
-> ReadPrec [GetRecord]
-> Read GetRecord
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRecord]
$creadListPrec :: ReadPrec [GetRecord]
readPrec :: ReadPrec GetRecord
$creadPrec :: ReadPrec GetRecord
readList :: ReadS [GetRecord]
$creadList :: ReadS [GetRecord]
readsPrec :: Int -> ReadS GetRecord
$creadsPrec :: Int -> ReadS GetRecord
Prelude.Read, Int -> GetRecord -> ShowS
[GetRecord] -> ShowS
GetRecord -> String
(Int -> GetRecord -> ShowS)
-> (GetRecord -> String)
-> ([GetRecord] -> ShowS)
-> Show GetRecord
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRecord] -> ShowS
$cshowList :: [GetRecord] -> ShowS
show :: GetRecord -> String
$cshow :: GetRecord -> String
showsPrec :: Int -> GetRecord -> ShowS
$cshowsPrec :: Int -> GetRecord -> ShowS
Prelude.Show, (forall x. GetRecord -> Rep GetRecord x)
-> (forall x. Rep GetRecord x -> GetRecord) -> Generic GetRecord
forall x. Rep GetRecord x -> GetRecord
forall x. GetRecord -> Rep GetRecord x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRecord x -> GetRecord
$cfrom :: forall x. GetRecord -> Rep GetRecord x
Prelude.Generic)
newGetRecord ::
Prelude.Text ->
Prelude.Text ->
GetRecord
newGetRecord :: Text -> Text -> GetRecord
newGetRecord
Text
pFeatureGroupName_
Text
pRecordIdentifierValueAsString_ =
GetRecord' :: Maybe (NonEmpty Text) -> Text -> Text -> GetRecord
GetRecord'
{ $sel:featureNames:GetRecord' :: Maybe (NonEmpty Text)
featureNames = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:featureGroupName:GetRecord' :: Text
featureGroupName = Text
pFeatureGroupName_,
$sel:recordIdentifierValueAsString:GetRecord' :: Text
recordIdentifierValueAsString =
Text
pRecordIdentifierValueAsString_
}
getRecord_featureNames :: Lens.Lens' GetRecord (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
getRecord_featureNames :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> GetRecord -> f GetRecord
getRecord_featureNames = (GetRecord -> Maybe (NonEmpty Text))
-> (GetRecord -> Maybe (NonEmpty Text) -> GetRecord)
-> Lens
GetRecord GetRecord (Maybe (NonEmpty Text)) (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecord' {Maybe (NonEmpty Text)
featureNames :: Maybe (NonEmpty Text)
$sel:featureNames:GetRecord' :: GetRecord -> Maybe (NonEmpty Text)
featureNames} -> Maybe (NonEmpty Text)
featureNames) (\s :: GetRecord
s@GetRecord' {} Maybe (NonEmpty Text)
a -> GetRecord
s {$sel:featureNames:GetRecord' :: Maybe (NonEmpty Text)
featureNames = Maybe (NonEmpty Text)
a} :: GetRecord) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> GetRecord -> f GetRecord)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> GetRecord
-> f GetRecord
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getRecord_featureGroupName :: Lens.Lens' GetRecord Prelude.Text
getRecord_featureGroupName :: (Text -> f Text) -> GetRecord -> f GetRecord
getRecord_featureGroupName = (GetRecord -> Text)
-> (GetRecord -> Text -> GetRecord)
-> Lens GetRecord GetRecord Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecord' {Text
featureGroupName :: Text
$sel:featureGroupName:GetRecord' :: GetRecord -> Text
featureGroupName} -> Text
featureGroupName) (\s :: GetRecord
s@GetRecord' {} Text
a -> GetRecord
s {$sel:featureGroupName:GetRecord' :: Text
featureGroupName = Text
a} :: GetRecord)
getRecord_recordIdentifierValueAsString :: Lens.Lens' GetRecord Prelude.Text
getRecord_recordIdentifierValueAsString :: (Text -> f Text) -> GetRecord -> f GetRecord
getRecord_recordIdentifierValueAsString = (GetRecord -> Text)
-> (GetRecord -> Text -> GetRecord)
-> Lens GetRecord GetRecord Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecord' {Text
recordIdentifierValueAsString :: Text
$sel:recordIdentifierValueAsString:GetRecord' :: GetRecord -> Text
recordIdentifierValueAsString} -> Text
recordIdentifierValueAsString) (\s :: GetRecord
s@GetRecord' {} Text
a -> GetRecord
s {$sel:recordIdentifierValueAsString:GetRecord' :: Text
recordIdentifierValueAsString = Text
a} :: GetRecord)
instance Core.AWSRequest GetRecord where
type AWSResponse GetRecord = GetRecordResponse
request :: GetRecord -> Request GetRecord
request = Service -> GetRecord -> Request GetRecord
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetRecord
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRecord)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetRecord))
-> Logger
-> Service
-> Proxy GetRecord
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRecord)))
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 (NonEmpty FeatureValue) -> Int -> GetRecordResponse
GetRecordResponse'
(Maybe (NonEmpty FeatureValue) -> Int -> GetRecordResponse)
-> Either String (Maybe (NonEmpty FeatureValue))
-> Either String (Int -> GetRecordResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (NonEmpty FeatureValue))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Record")
Either String (Int -> GetRecordResponse)
-> Either String Int -> Either String GetRecordResponse
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 GetRecord
instance Prelude.NFData GetRecord
instance Core.ToHeaders GetRecord where
toHeaders :: GetRecord -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetRecord -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath GetRecord where
toPath :: GetRecord -> ByteString
toPath GetRecord' {Maybe (NonEmpty Text)
Text
recordIdentifierValueAsString :: Text
featureGroupName :: Text
featureNames :: Maybe (NonEmpty Text)
$sel:recordIdentifierValueAsString:GetRecord' :: GetRecord -> Text
$sel:featureGroupName:GetRecord' :: GetRecord -> Text
$sel:featureNames:GetRecord' :: GetRecord -> Maybe (NonEmpty Text)
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/FeatureGroup/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
featureGroupName]
instance Core.ToQuery GetRecord where
toQuery :: GetRecord -> QueryString
toQuery GetRecord' {Maybe (NonEmpty Text)
Text
recordIdentifierValueAsString :: Text
featureGroupName :: Text
featureNames :: Maybe (NonEmpty Text)
$sel:recordIdentifierValueAsString:GetRecord' :: GetRecord -> Text
$sel:featureGroupName:GetRecord' :: GetRecord -> Text
$sel:featureNames:GetRecord' :: GetRecord -> Maybe (NonEmpty Text)
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"FeatureName"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> NonEmpty Text -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" (NonEmpty Text -> QueryString)
-> Maybe (NonEmpty Text) -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
featureNames),
ByteString
"RecordIdentifierValueAsString"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
recordIdentifierValueAsString
]
data GetRecordResponse = GetRecordResponse'
{
GetRecordResponse -> Maybe (NonEmpty FeatureValue)
record :: Prelude.Maybe (Prelude.NonEmpty FeatureValue),
GetRecordResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetRecordResponse -> GetRecordResponse -> Bool
(GetRecordResponse -> GetRecordResponse -> Bool)
-> (GetRecordResponse -> GetRecordResponse -> Bool)
-> Eq GetRecordResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRecordResponse -> GetRecordResponse -> Bool
$c/= :: GetRecordResponse -> GetRecordResponse -> Bool
== :: GetRecordResponse -> GetRecordResponse -> Bool
$c== :: GetRecordResponse -> GetRecordResponse -> Bool
Prelude.Eq, ReadPrec [GetRecordResponse]
ReadPrec GetRecordResponse
Int -> ReadS GetRecordResponse
ReadS [GetRecordResponse]
(Int -> ReadS GetRecordResponse)
-> ReadS [GetRecordResponse]
-> ReadPrec GetRecordResponse
-> ReadPrec [GetRecordResponse]
-> Read GetRecordResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRecordResponse]
$creadListPrec :: ReadPrec [GetRecordResponse]
readPrec :: ReadPrec GetRecordResponse
$creadPrec :: ReadPrec GetRecordResponse
readList :: ReadS [GetRecordResponse]
$creadList :: ReadS [GetRecordResponse]
readsPrec :: Int -> ReadS GetRecordResponse
$creadsPrec :: Int -> ReadS GetRecordResponse
Prelude.Read, Int -> GetRecordResponse -> ShowS
[GetRecordResponse] -> ShowS
GetRecordResponse -> String
(Int -> GetRecordResponse -> ShowS)
-> (GetRecordResponse -> String)
-> ([GetRecordResponse] -> ShowS)
-> Show GetRecordResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRecordResponse] -> ShowS
$cshowList :: [GetRecordResponse] -> ShowS
show :: GetRecordResponse -> String
$cshow :: GetRecordResponse -> String
showsPrec :: Int -> GetRecordResponse -> ShowS
$cshowsPrec :: Int -> GetRecordResponse -> ShowS
Prelude.Show, (forall x. GetRecordResponse -> Rep GetRecordResponse x)
-> (forall x. Rep GetRecordResponse x -> GetRecordResponse)
-> Generic GetRecordResponse
forall x. Rep GetRecordResponse x -> GetRecordResponse
forall x. GetRecordResponse -> Rep GetRecordResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRecordResponse x -> GetRecordResponse
$cfrom :: forall x. GetRecordResponse -> Rep GetRecordResponse x
Prelude.Generic)
newGetRecordResponse ::
Prelude.Int ->
GetRecordResponse
newGetRecordResponse :: Int -> GetRecordResponse
newGetRecordResponse Int
pHttpStatus_ =
GetRecordResponse' :: Maybe (NonEmpty FeatureValue) -> Int -> GetRecordResponse
GetRecordResponse'
{ $sel:record:GetRecordResponse' :: Maybe (NonEmpty FeatureValue)
record = Maybe (NonEmpty FeatureValue)
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRecordResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getRecordResponse_record :: Lens.Lens' GetRecordResponse (Prelude.Maybe (Prelude.NonEmpty FeatureValue))
getRecordResponse_record :: (Maybe (NonEmpty FeatureValue)
-> f (Maybe (NonEmpty FeatureValue)))
-> GetRecordResponse -> f GetRecordResponse
getRecordResponse_record = (GetRecordResponse -> Maybe (NonEmpty FeatureValue))
-> (GetRecordResponse
-> Maybe (NonEmpty FeatureValue) -> GetRecordResponse)
-> Lens
GetRecordResponse
GetRecordResponse
(Maybe (NonEmpty FeatureValue))
(Maybe (NonEmpty FeatureValue))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecordResponse' {Maybe (NonEmpty FeatureValue)
record :: Maybe (NonEmpty FeatureValue)
$sel:record:GetRecordResponse' :: GetRecordResponse -> Maybe (NonEmpty FeatureValue)
record} -> Maybe (NonEmpty FeatureValue)
record) (\s :: GetRecordResponse
s@GetRecordResponse' {} Maybe (NonEmpty FeatureValue)
a -> GetRecordResponse
s {$sel:record:GetRecordResponse' :: Maybe (NonEmpty FeatureValue)
record = Maybe (NonEmpty FeatureValue)
a} :: GetRecordResponse) ((Maybe (NonEmpty FeatureValue)
-> f (Maybe (NonEmpty FeatureValue)))
-> GetRecordResponse -> f GetRecordResponse)
-> ((Maybe (NonEmpty FeatureValue)
-> f (Maybe (NonEmpty FeatureValue)))
-> Maybe (NonEmpty FeatureValue)
-> f (Maybe (NonEmpty FeatureValue)))
-> (Maybe (NonEmpty FeatureValue)
-> f (Maybe (NonEmpty FeatureValue)))
-> GetRecordResponse
-> f GetRecordResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty FeatureValue)
(NonEmpty FeatureValue)
(NonEmpty FeatureValue)
(NonEmpty FeatureValue)
-> Iso
(Maybe (NonEmpty FeatureValue))
(Maybe (NonEmpty FeatureValue))
(Maybe (NonEmpty FeatureValue))
(Maybe (NonEmpty FeatureValue))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(NonEmpty FeatureValue)
(NonEmpty FeatureValue)
(NonEmpty FeatureValue)
(NonEmpty FeatureValue)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getRecordResponse_httpStatus :: Lens.Lens' GetRecordResponse Prelude.Int
getRecordResponse_httpStatus :: (Int -> f Int) -> GetRecordResponse -> f GetRecordResponse
getRecordResponse_httpStatus = (GetRecordResponse -> Int)
-> (GetRecordResponse -> Int -> GetRecordResponse)
-> Lens GetRecordResponse GetRecordResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecordResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRecordResponse' :: GetRecordResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRecordResponse
s@GetRecordResponse' {} Int
a -> GetRecordResponse
s {$sel:httpStatus:GetRecordResponse' :: Int
httpStatus = Int
a} :: GetRecordResponse)
instance Prelude.NFData GetRecordResponse