{-# 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.MediaStoreData.DeleteObject
-- 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 an object at the specified path.
module Amazonka.MediaStoreData.DeleteObject
  ( -- * Creating a Request
    DeleteObject (..),
    newDeleteObject,

    -- * Request Lenses
    deleteObject_path,

    -- * Destructuring the Response
    DeleteObjectResponse (..),
    newDeleteObjectResponse,

    -- * Response Lenses
    deleteObjectResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaStoreData.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteObject' smart constructor.
data DeleteObject = DeleteObject'
  { -- | The path (including the file name) where the object is stored in the
    -- container. Format: \<folder name>\/\<folder name>\/\<file name>
    DeleteObject -> Text
path :: Prelude.Text
  }
  deriving (DeleteObject -> DeleteObject -> Bool
(DeleteObject -> DeleteObject -> Bool)
-> (DeleteObject -> DeleteObject -> Bool) -> Eq DeleteObject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteObject -> DeleteObject -> Bool
$c/= :: DeleteObject -> DeleteObject -> Bool
== :: DeleteObject -> DeleteObject -> Bool
$c== :: DeleteObject -> DeleteObject -> Bool
Prelude.Eq, ReadPrec [DeleteObject]
ReadPrec DeleteObject
Int -> ReadS DeleteObject
ReadS [DeleteObject]
(Int -> ReadS DeleteObject)
-> ReadS [DeleteObject]
-> ReadPrec DeleteObject
-> ReadPrec [DeleteObject]
-> Read DeleteObject
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteObject]
$creadListPrec :: ReadPrec [DeleteObject]
readPrec :: ReadPrec DeleteObject
$creadPrec :: ReadPrec DeleteObject
readList :: ReadS [DeleteObject]
$creadList :: ReadS [DeleteObject]
readsPrec :: Int -> ReadS DeleteObject
$creadsPrec :: Int -> ReadS DeleteObject
Prelude.Read, Int -> DeleteObject -> ShowS
[DeleteObject] -> ShowS
DeleteObject -> String
(Int -> DeleteObject -> ShowS)
-> (DeleteObject -> String)
-> ([DeleteObject] -> ShowS)
-> Show DeleteObject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteObject] -> ShowS
$cshowList :: [DeleteObject] -> ShowS
show :: DeleteObject -> String
$cshow :: DeleteObject -> String
showsPrec :: Int -> DeleteObject -> ShowS
$cshowsPrec :: Int -> DeleteObject -> ShowS
Prelude.Show, (forall x. DeleteObject -> Rep DeleteObject x)
-> (forall x. Rep DeleteObject x -> DeleteObject)
-> Generic DeleteObject
forall x. Rep DeleteObject x -> DeleteObject
forall x. DeleteObject -> Rep DeleteObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteObject x -> DeleteObject
$cfrom :: forall x. DeleteObject -> Rep DeleteObject x
Prelude.Generic)

-- |
-- Create a value of 'DeleteObject' 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:
--
-- 'path', 'deleteObject_path' - The path (including the file name) where the object is stored in the
-- container. Format: \<folder name>\/\<folder name>\/\<file name>
newDeleteObject ::
  -- | 'path'
  Prelude.Text ->
  DeleteObject
newDeleteObject :: Text -> DeleteObject
newDeleteObject Text
pPath_ = DeleteObject' :: Text -> DeleteObject
DeleteObject' {$sel:path:DeleteObject' :: Text
path = Text
pPath_}

-- | The path (including the file name) where the object is stored in the
-- container. Format: \<folder name>\/\<folder name>\/\<file name>
deleteObject_path :: Lens.Lens' DeleteObject Prelude.Text
deleteObject_path :: (Text -> f Text) -> DeleteObject -> f DeleteObject
deleteObject_path = (DeleteObject -> Text)
-> (DeleteObject -> Text -> DeleteObject)
-> Lens DeleteObject DeleteObject Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObject' {Text
path :: Text
$sel:path:DeleteObject' :: DeleteObject -> Text
path} -> Text
path) (\s :: DeleteObject
s@DeleteObject' {} Text
a -> DeleteObject
s {$sel:path:DeleteObject' :: Text
path = Text
a} :: DeleteObject)

instance Core.AWSRequest DeleteObject where
  type AWSResponse DeleteObject = DeleteObjectResponse
  request :: DeleteObject -> Request DeleteObject
request = Service -> DeleteObject -> Request DeleteObject
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteObject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteObject)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteObject))
-> Logger
-> Service
-> Proxy DeleteObject
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteObject)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteObjectResponse
DeleteObjectResponse'
            (Int -> DeleteObjectResponse)
-> Either String Int -> Either String DeleteObjectResponse
forall (f :: * -> *) a b. Functor 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 DeleteObject

instance Prelude.NFData DeleteObject

instance Core.ToHeaders DeleteObject where
  toHeaders :: DeleteObject -> ResponseHeaders
toHeaders = ResponseHeaders -> DeleteObject -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DeleteObject where
  toPath :: DeleteObject -> ByteString
toPath DeleteObject' {Text
path :: Text
$sel:path:DeleteObject' :: DeleteObject -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
path]

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

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

-- |
-- Create a value of 'DeleteObjectResponse' 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:
--
-- 'httpStatus', 'deleteObjectResponse_httpStatus' - The response's http status code.
newDeleteObjectResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteObjectResponse
newDeleteObjectResponse :: Int -> DeleteObjectResponse
newDeleteObjectResponse Int
pHttpStatus_ =
  DeleteObjectResponse' :: Int -> DeleteObjectResponse
DeleteObjectResponse' {$sel:httpStatus:DeleteObjectResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData DeleteObjectResponse