{-# 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.MediaPackageVOD.DeleteAsset
-- 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 existing MediaPackage VOD Asset resource.
module Amazonka.MediaPackageVOD.DeleteAsset
  ( -- * Creating a Request
    DeleteAsset (..),
    newDeleteAsset,

    -- * Request Lenses
    deleteAsset_id,

    -- * Destructuring the Response
    DeleteAssetResponse (..),
    newDeleteAssetResponse,

    -- * Response Lenses
    deleteAssetResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteAsset' smart constructor.
data DeleteAsset = DeleteAsset'
  { -- | The ID of the MediaPackage VOD Asset resource to delete.
    DeleteAsset -> Text
id :: Prelude.Text
  }
  deriving (DeleteAsset -> DeleteAsset -> Bool
(DeleteAsset -> DeleteAsset -> Bool)
-> (DeleteAsset -> DeleteAsset -> Bool) -> Eq DeleteAsset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAsset -> DeleteAsset -> Bool
$c/= :: DeleteAsset -> DeleteAsset -> Bool
== :: DeleteAsset -> DeleteAsset -> Bool
$c== :: DeleteAsset -> DeleteAsset -> Bool
Prelude.Eq, ReadPrec [DeleteAsset]
ReadPrec DeleteAsset
Int -> ReadS DeleteAsset
ReadS [DeleteAsset]
(Int -> ReadS DeleteAsset)
-> ReadS [DeleteAsset]
-> ReadPrec DeleteAsset
-> ReadPrec [DeleteAsset]
-> Read DeleteAsset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAsset]
$creadListPrec :: ReadPrec [DeleteAsset]
readPrec :: ReadPrec DeleteAsset
$creadPrec :: ReadPrec DeleteAsset
readList :: ReadS [DeleteAsset]
$creadList :: ReadS [DeleteAsset]
readsPrec :: Int -> ReadS DeleteAsset
$creadsPrec :: Int -> ReadS DeleteAsset
Prelude.Read, Int -> DeleteAsset -> ShowS
[DeleteAsset] -> ShowS
DeleteAsset -> String
(Int -> DeleteAsset -> ShowS)
-> (DeleteAsset -> String)
-> ([DeleteAsset] -> ShowS)
-> Show DeleteAsset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAsset] -> ShowS
$cshowList :: [DeleteAsset] -> ShowS
show :: DeleteAsset -> String
$cshow :: DeleteAsset -> String
showsPrec :: Int -> DeleteAsset -> ShowS
$cshowsPrec :: Int -> DeleteAsset -> ShowS
Prelude.Show, (forall x. DeleteAsset -> Rep DeleteAsset x)
-> (forall x. Rep DeleteAsset x -> DeleteAsset)
-> Generic DeleteAsset
forall x. Rep DeleteAsset x -> DeleteAsset
forall x. DeleteAsset -> Rep DeleteAsset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAsset x -> DeleteAsset
$cfrom :: forall x. DeleteAsset -> Rep DeleteAsset x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAsset' 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:
--
-- 'id', 'deleteAsset_id' - The ID of the MediaPackage VOD Asset resource to delete.
newDeleteAsset ::
  -- | 'id'
  Prelude.Text ->
  DeleteAsset
newDeleteAsset :: Text -> DeleteAsset
newDeleteAsset Text
pId_ = DeleteAsset' :: Text -> DeleteAsset
DeleteAsset' {$sel:id:DeleteAsset' :: Text
id = Text
pId_}

-- | The ID of the MediaPackage VOD Asset resource to delete.
deleteAsset_id :: Lens.Lens' DeleteAsset Prelude.Text
deleteAsset_id :: (Text -> f Text) -> DeleteAsset -> f DeleteAsset
deleteAsset_id = (DeleteAsset -> Text)
-> (DeleteAsset -> Text -> DeleteAsset)
-> Lens DeleteAsset DeleteAsset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAsset' {Text
id :: Text
$sel:id:DeleteAsset' :: DeleteAsset -> Text
id} -> Text
id) (\s :: DeleteAsset
s@DeleteAsset' {} Text
a -> DeleteAsset
s {$sel:id:DeleteAsset' :: Text
id = Text
a} :: DeleteAsset)

instance Core.AWSRequest DeleteAsset where
  type AWSResponse DeleteAsset = DeleteAssetResponse
  request :: DeleteAsset -> Request DeleteAsset
request = Service -> DeleteAsset -> Request DeleteAsset
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteAsset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAsset)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteAsset))
-> Logger
-> Service
-> Proxy DeleteAsset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAsset)))
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 -> DeleteAssetResponse
DeleteAssetResponse'
            (Int -> DeleteAssetResponse)
-> Either String Int -> Either String DeleteAssetResponse
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 DeleteAsset

instance Prelude.NFData DeleteAsset

instance Core.ToHeaders DeleteAsset where
  toHeaders :: DeleteAsset -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteAsset -> 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 DeleteAsset where
  toPath :: DeleteAsset -> ByteString
toPath DeleteAsset' {Text
id :: Text
$sel:id:DeleteAsset' :: DeleteAsset -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/assets/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id]

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

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

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

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

instance Prelude.NFData DeleteAssetResponse