{-# 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.ElasticTranscoder.DeletePreset
-- 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)
--
-- The DeletePreset operation removes a preset that you\'ve added in an AWS
-- region.
--
-- You can\'t delete the default presets that are included with Elastic
-- Transcoder.
module Amazonka.ElasticTranscoder.DeletePreset
  ( -- * Creating a Request
    DeletePreset (..),
    newDeletePreset,

    -- * Request Lenses
    deletePreset_id,

    -- * Destructuring the Response
    DeletePresetResponse (..),
    newDeletePresetResponse,

    -- * Response Lenses
    deletePresetResponse_httpStatus,
  )
where

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

-- | The @DeletePresetRequest@ structure.
--
-- /See:/ 'newDeletePreset' smart constructor.
data DeletePreset = DeletePreset'
  { -- | The identifier of the preset for which you want to get detailed
    -- information.
    DeletePreset -> Text
id :: Prelude.Text
  }
  deriving (DeletePreset -> DeletePreset -> Bool
(DeletePreset -> DeletePreset -> Bool)
-> (DeletePreset -> DeletePreset -> Bool) -> Eq DeletePreset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePreset -> DeletePreset -> Bool
$c/= :: DeletePreset -> DeletePreset -> Bool
== :: DeletePreset -> DeletePreset -> Bool
$c== :: DeletePreset -> DeletePreset -> Bool
Prelude.Eq, ReadPrec [DeletePreset]
ReadPrec DeletePreset
Int -> ReadS DeletePreset
ReadS [DeletePreset]
(Int -> ReadS DeletePreset)
-> ReadS [DeletePreset]
-> ReadPrec DeletePreset
-> ReadPrec [DeletePreset]
-> Read DeletePreset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePreset]
$creadListPrec :: ReadPrec [DeletePreset]
readPrec :: ReadPrec DeletePreset
$creadPrec :: ReadPrec DeletePreset
readList :: ReadS [DeletePreset]
$creadList :: ReadS [DeletePreset]
readsPrec :: Int -> ReadS DeletePreset
$creadsPrec :: Int -> ReadS DeletePreset
Prelude.Read, Int -> DeletePreset -> ShowS
[DeletePreset] -> ShowS
DeletePreset -> String
(Int -> DeletePreset -> ShowS)
-> (DeletePreset -> String)
-> ([DeletePreset] -> ShowS)
-> Show DeletePreset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePreset] -> ShowS
$cshowList :: [DeletePreset] -> ShowS
show :: DeletePreset -> String
$cshow :: DeletePreset -> String
showsPrec :: Int -> DeletePreset -> ShowS
$cshowsPrec :: Int -> DeletePreset -> ShowS
Prelude.Show, (forall x. DeletePreset -> Rep DeletePreset x)
-> (forall x. Rep DeletePreset x -> DeletePreset)
-> Generic DeletePreset
forall x. Rep DeletePreset x -> DeletePreset
forall x. DeletePreset -> Rep DeletePreset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePreset x -> DeletePreset
$cfrom :: forall x. DeletePreset -> Rep DeletePreset x
Prelude.Generic)

-- |
-- Create a value of 'DeletePreset' 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', 'deletePreset_id' - The identifier of the preset for which you want to get detailed
-- information.
newDeletePreset ::
  -- | 'id'
  Prelude.Text ->
  DeletePreset
newDeletePreset :: Text -> DeletePreset
newDeletePreset Text
pId_ = DeletePreset' :: Text -> DeletePreset
DeletePreset' {$sel:id:DeletePreset' :: Text
id = Text
pId_}

-- | The identifier of the preset for which you want to get detailed
-- information.
deletePreset_id :: Lens.Lens' DeletePreset Prelude.Text
deletePreset_id :: (Text -> f Text) -> DeletePreset -> f DeletePreset
deletePreset_id = (DeletePreset -> Text)
-> (DeletePreset -> Text -> DeletePreset)
-> Lens DeletePreset DeletePreset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePreset' {Text
id :: Text
$sel:id:DeletePreset' :: DeletePreset -> Text
id} -> Text
id) (\s :: DeletePreset
s@DeletePreset' {} Text
a -> DeletePreset
s {$sel:id:DeletePreset' :: Text
id = Text
a} :: DeletePreset)

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

instance Prelude.NFData DeletePreset

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

instance Core.ToPath DeletePreset where
  toPath :: DeletePreset -> ByteString
toPath DeletePreset' {Text
id :: Text
$sel:id:DeletePreset' :: DeletePreset -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/2012-09-25/presets/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id]

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

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

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

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

instance Prelude.NFData DeletePresetResponse