{-# 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.SageMakerFeatureStoreRuntime.DeleteRecord
-- 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)
--
-- Deletes a @Record@ from a @FeatureGroup@. A new record will show up in
-- the @OfflineStore@ when the @DeleteRecord@ API is called. This record
-- will have a value of @True@ in the @is_deleted@ column.
module Amazonka.SageMakerFeatureStoreRuntime.DeleteRecord
  ( -- * Creating a Request
    DeleteRecord (..),
    newDeleteRecord,

    -- * Request Lenses
    deleteRecord_featureGroupName,
    deleteRecord_recordIdentifierValueAsString,
    deleteRecord_eventTime,

    -- * Destructuring the Response
    DeleteRecordResponse (..),
    newDeleteRecordResponse,
  )
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

-- | /See:/ 'newDeleteRecord' smart constructor.
data DeleteRecord = DeleteRecord'
  { -- | The name of the feature group to delete the record from.
    DeleteRecord -> Text
featureGroupName :: Prelude.Text,
    -- | The value for the @RecordIdentifier@ that uniquely identifies the
    -- record, in string format.
    DeleteRecord -> Text
recordIdentifierValueAsString :: Prelude.Text,
    -- | Timestamp indicating when the deletion event occurred. @EventTime@ can
    -- be used to query data at a certain point in time.
    DeleteRecord -> Text
eventTime :: Prelude.Text
  }
  deriving (DeleteRecord -> DeleteRecord -> Bool
(DeleteRecord -> DeleteRecord -> Bool)
-> (DeleteRecord -> DeleteRecord -> Bool) -> Eq DeleteRecord
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRecord -> DeleteRecord -> Bool
$c/= :: DeleteRecord -> DeleteRecord -> Bool
== :: DeleteRecord -> DeleteRecord -> Bool
$c== :: DeleteRecord -> DeleteRecord -> Bool
Prelude.Eq, ReadPrec [DeleteRecord]
ReadPrec DeleteRecord
Int -> ReadS DeleteRecord
ReadS [DeleteRecord]
(Int -> ReadS DeleteRecord)
-> ReadS [DeleteRecord]
-> ReadPrec DeleteRecord
-> ReadPrec [DeleteRecord]
-> Read DeleteRecord
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRecord]
$creadListPrec :: ReadPrec [DeleteRecord]
readPrec :: ReadPrec DeleteRecord
$creadPrec :: ReadPrec DeleteRecord
readList :: ReadS [DeleteRecord]
$creadList :: ReadS [DeleteRecord]
readsPrec :: Int -> ReadS DeleteRecord
$creadsPrec :: Int -> ReadS DeleteRecord
Prelude.Read, Int -> DeleteRecord -> ShowS
[DeleteRecord] -> ShowS
DeleteRecord -> String
(Int -> DeleteRecord -> ShowS)
-> (DeleteRecord -> String)
-> ([DeleteRecord] -> ShowS)
-> Show DeleteRecord
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRecord] -> ShowS
$cshowList :: [DeleteRecord] -> ShowS
show :: DeleteRecord -> String
$cshow :: DeleteRecord -> String
showsPrec :: Int -> DeleteRecord -> ShowS
$cshowsPrec :: Int -> DeleteRecord -> ShowS
Prelude.Show, (forall x. DeleteRecord -> Rep DeleteRecord x)
-> (forall x. Rep DeleteRecord x -> DeleteRecord)
-> Generic DeleteRecord
forall x. Rep DeleteRecord x -> DeleteRecord
forall x. DeleteRecord -> Rep DeleteRecord x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRecord x -> DeleteRecord
$cfrom :: forall x. DeleteRecord -> Rep DeleteRecord x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRecord' 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:
--
-- 'featureGroupName', 'deleteRecord_featureGroupName' - The name of the feature group to delete the record from.
--
-- 'recordIdentifierValueAsString', 'deleteRecord_recordIdentifierValueAsString' - The value for the @RecordIdentifier@ that uniquely identifies the
-- record, in string format.
--
-- 'eventTime', 'deleteRecord_eventTime' - Timestamp indicating when the deletion event occurred. @EventTime@ can
-- be used to query data at a certain point in time.
newDeleteRecord ::
  -- | 'featureGroupName'
  Prelude.Text ->
  -- | 'recordIdentifierValueAsString'
  Prelude.Text ->
  -- | 'eventTime'
  Prelude.Text ->
  DeleteRecord
newDeleteRecord :: Text -> Text -> Text -> DeleteRecord
newDeleteRecord
  Text
pFeatureGroupName_
  Text
pRecordIdentifierValueAsString_
  Text
pEventTime_ =
    DeleteRecord' :: Text -> Text -> Text -> DeleteRecord
DeleteRecord'
      { $sel:featureGroupName:DeleteRecord' :: Text
featureGroupName =
          Text
pFeatureGroupName_,
        $sel:recordIdentifierValueAsString:DeleteRecord' :: Text
recordIdentifierValueAsString =
          Text
pRecordIdentifierValueAsString_,
        $sel:eventTime:DeleteRecord' :: Text
eventTime = Text
pEventTime_
      }

-- | The name of the feature group to delete the record from.
deleteRecord_featureGroupName :: Lens.Lens' DeleteRecord Prelude.Text
deleteRecord_featureGroupName :: (Text -> f Text) -> DeleteRecord -> f DeleteRecord
deleteRecord_featureGroupName = (DeleteRecord -> Text)
-> (DeleteRecord -> Text -> DeleteRecord)
-> Lens DeleteRecord DeleteRecord Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRecord' {Text
featureGroupName :: Text
$sel:featureGroupName:DeleteRecord' :: DeleteRecord -> Text
featureGroupName} -> Text
featureGroupName) (\s :: DeleteRecord
s@DeleteRecord' {} Text
a -> DeleteRecord
s {$sel:featureGroupName:DeleteRecord' :: Text
featureGroupName = Text
a} :: DeleteRecord)

-- | The value for the @RecordIdentifier@ that uniquely identifies the
-- record, in string format.
deleteRecord_recordIdentifierValueAsString :: Lens.Lens' DeleteRecord Prelude.Text
deleteRecord_recordIdentifierValueAsString :: (Text -> f Text) -> DeleteRecord -> f DeleteRecord
deleteRecord_recordIdentifierValueAsString = (DeleteRecord -> Text)
-> (DeleteRecord -> Text -> DeleteRecord)
-> Lens DeleteRecord DeleteRecord Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRecord' {Text
recordIdentifierValueAsString :: Text
$sel:recordIdentifierValueAsString:DeleteRecord' :: DeleteRecord -> Text
recordIdentifierValueAsString} -> Text
recordIdentifierValueAsString) (\s :: DeleteRecord
s@DeleteRecord' {} Text
a -> DeleteRecord
s {$sel:recordIdentifierValueAsString:DeleteRecord' :: Text
recordIdentifierValueAsString = Text
a} :: DeleteRecord)

-- | Timestamp indicating when the deletion event occurred. @EventTime@ can
-- be used to query data at a certain point in time.
deleteRecord_eventTime :: Lens.Lens' DeleteRecord Prelude.Text
deleteRecord_eventTime :: (Text -> f Text) -> DeleteRecord -> f DeleteRecord
deleteRecord_eventTime = (DeleteRecord -> Text)
-> (DeleteRecord -> Text -> DeleteRecord)
-> Lens DeleteRecord DeleteRecord Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRecord' {Text
eventTime :: Text
$sel:eventTime:DeleteRecord' :: DeleteRecord -> Text
eventTime} -> Text
eventTime) (\s :: DeleteRecord
s@DeleteRecord' {} Text
a -> DeleteRecord
s {$sel:eventTime:DeleteRecord' :: Text
eventTime = Text
a} :: DeleteRecord)

instance Core.AWSRequest DeleteRecord where
  type AWSResponse DeleteRecord = DeleteRecordResponse
  request :: DeleteRecord -> Request DeleteRecord
request = Service -> DeleteRecord -> Request DeleteRecord
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteRecord
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteRecord)))
response = AWSResponse DeleteRecord
-> Logger
-> Service
-> Proxy DeleteRecord
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteRecord)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteRecord
DeleteRecordResponse
DeleteRecordResponse'

instance Prelude.Hashable DeleteRecord

instance Prelude.NFData DeleteRecord

instance Core.ToHeaders DeleteRecord where
  toHeaders :: DeleteRecord -> [Header]
toHeaders =
    [Header] -> DeleteRecord -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DeleteRecord where
  toPath :: DeleteRecord -> ByteString
toPath DeleteRecord' {Text
eventTime :: Text
recordIdentifierValueAsString :: Text
featureGroupName :: Text
$sel:eventTime:DeleteRecord' :: DeleteRecord -> Text
$sel:recordIdentifierValueAsString:DeleteRecord' :: DeleteRecord -> Text
$sel:featureGroupName:DeleteRecord' :: DeleteRecord -> 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 DeleteRecord where
  toQuery :: DeleteRecord -> QueryString
toQuery DeleteRecord' {Text
eventTime :: Text
recordIdentifierValueAsString :: Text
featureGroupName :: Text
$sel:eventTime:DeleteRecord' :: DeleteRecord -> Text
$sel:recordIdentifierValueAsString:DeleteRecord' :: DeleteRecord -> Text
$sel:featureGroupName:DeleteRecord' :: DeleteRecord -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"RecordIdentifierValueAsString"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
recordIdentifierValueAsString,
        ByteString
"EventTime" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
eventTime
      ]

-- | /See:/ 'newDeleteRecordResponse' smart constructor.
data DeleteRecordResponse = DeleteRecordResponse'
  {
  }
  deriving (DeleteRecordResponse -> DeleteRecordResponse -> Bool
(DeleteRecordResponse -> DeleteRecordResponse -> Bool)
-> (DeleteRecordResponse -> DeleteRecordResponse -> Bool)
-> Eq DeleteRecordResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRecordResponse -> DeleteRecordResponse -> Bool
$c/= :: DeleteRecordResponse -> DeleteRecordResponse -> Bool
== :: DeleteRecordResponse -> DeleteRecordResponse -> Bool
$c== :: DeleteRecordResponse -> DeleteRecordResponse -> Bool
Prelude.Eq, ReadPrec [DeleteRecordResponse]
ReadPrec DeleteRecordResponse
Int -> ReadS DeleteRecordResponse
ReadS [DeleteRecordResponse]
(Int -> ReadS DeleteRecordResponse)
-> ReadS [DeleteRecordResponse]
-> ReadPrec DeleteRecordResponse
-> ReadPrec [DeleteRecordResponse]
-> Read DeleteRecordResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRecordResponse]
$creadListPrec :: ReadPrec [DeleteRecordResponse]
readPrec :: ReadPrec DeleteRecordResponse
$creadPrec :: ReadPrec DeleteRecordResponse
readList :: ReadS [DeleteRecordResponse]
$creadList :: ReadS [DeleteRecordResponse]
readsPrec :: Int -> ReadS DeleteRecordResponse
$creadsPrec :: Int -> ReadS DeleteRecordResponse
Prelude.Read, Int -> DeleteRecordResponse -> ShowS
[DeleteRecordResponse] -> ShowS
DeleteRecordResponse -> String
(Int -> DeleteRecordResponse -> ShowS)
-> (DeleteRecordResponse -> String)
-> ([DeleteRecordResponse] -> ShowS)
-> Show DeleteRecordResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRecordResponse] -> ShowS
$cshowList :: [DeleteRecordResponse] -> ShowS
show :: DeleteRecordResponse -> String
$cshow :: DeleteRecordResponse -> String
showsPrec :: Int -> DeleteRecordResponse -> ShowS
$cshowsPrec :: Int -> DeleteRecordResponse -> ShowS
Prelude.Show, (forall x. DeleteRecordResponse -> Rep DeleteRecordResponse x)
-> (forall x. Rep DeleteRecordResponse x -> DeleteRecordResponse)
-> Generic DeleteRecordResponse
forall x. Rep DeleteRecordResponse x -> DeleteRecordResponse
forall x. DeleteRecordResponse -> Rep DeleteRecordResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRecordResponse x -> DeleteRecordResponse
$cfrom :: forall x. DeleteRecordResponse -> Rep DeleteRecordResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRecordResponse' 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.
newDeleteRecordResponse ::
  DeleteRecordResponse
newDeleteRecordResponse :: DeleteRecordResponse
newDeleteRecordResponse = DeleteRecordResponse
DeleteRecordResponse'

instance Prelude.NFData DeleteRecordResponse