{-# 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.MediaPackage.DeleteOriginEndpoint
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes an existing OriginEndpoint.
module Amazonka.MediaPackage.DeleteOriginEndpoint
  ( -- * Creating a Request
    DeleteOriginEndpoint (..),
    newDeleteOriginEndpoint,

    -- * Request Lenses
    deleteOriginEndpoint_id,

    -- * Destructuring the Response
    DeleteOriginEndpointResponse (..),
    newDeleteOriginEndpointResponse,

    -- * Response Lenses
    deleteOriginEndpointResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaPackage.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'DeleteOriginEndpoint' 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', 'deleteOriginEndpoint_id' - The ID of the OriginEndpoint to delete.
newDeleteOriginEndpoint ::
  -- | 'id'
  Prelude.Text ->
  DeleteOriginEndpoint
newDeleteOriginEndpoint :: Text -> DeleteOriginEndpoint
newDeleteOriginEndpoint Text
pId_ =
  DeleteOriginEndpoint' {$sel:id:DeleteOriginEndpoint' :: Text
id = Text
pId_}

-- | The ID of the OriginEndpoint to delete.
deleteOriginEndpoint_id :: Lens.Lens' DeleteOriginEndpoint Prelude.Text
deleteOriginEndpoint_id :: Lens' DeleteOriginEndpoint Text
deleteOriginEndpoint_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteOriginEndpoint' {Text
id :: Text
$sel:id:DeleteOriginEndpoint' :: DeleteOriginEndpoint -> Text
id} -> Text
id) (\s :: DeleteOriginEndpoint
s@DeleteOriginEndpoint' {} Text
a -> DeleteOriginEndpoint
s {$sel:id:DeleteOriginEndpoint' :: Text
id = Text
a} :: DeleteOriginEndpoint)

instance Core.AWSRequest DeleteOriginEndpoint where
  type
    AWSResponse DeleteOriginEndpoint =
      DeleteOriginEndpointResponse
  request :: (Service -> Service)
-> DeleteOriginEndpoint -> Request DeleteOriginEndpoint
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteOriginEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteOriginEndpoint)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteOriginEndpointResponse
DeleteOriginEndpointResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteOriginEndpoint where
  hashWithSalt :: Int -> DeleteOriginEndpoint -> Int
hashWithSalt Int
_salt DeleteOriginEndpoint' {Text
id :: Text
$sel:id:DeleteOriginEndpoint' :: DeleteOriginEndpoint -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

instance Prelude.NFData DeleteOriginEndpoint where
  rnf :: DeleteOriginEndpoint -> ()
rnf DeleteOriginEndpoint' {Text
id :: Text
$sel:id:DeleteOriginEndpoint' :: DeleteOriginEndpoint -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id

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

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

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

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

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

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

instance Prelude.NFData DeleteOriginEndpointResponse where
  rnf :: DeleteOriginEndpointResponse -> ()
rnf DeleteOriginEndpointResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteOriginEndpointResponse' :: DeleteOriginEndpointResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus