{-# 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.MediaTailor.DeleteSourceLocation
-- 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 a source location. A source location is a container for sources.
-- For more information about source locations, see
-- <https://docs.aws.amazon.com/mediatailor/latest/ug/channel-assembly-source-locations.html Working with source locations>
-- in the /MediaTailor User Guide/.
module Amazonka.MediaTailor.DeleteSourceLocation
  ( -- * Creating a Request
    DeleteSourceLocation (..),
    newDeleteSourceLocation,

    -- * Request Lenses
    deleteSourceLocation_sourceLocationName,

    -- * Destructuring the Response
    DeleteSourceLocationResponse (..),
    newDeleteSourceLocationResponse,

    -- * Response Lenses
    deleteSourceLocationResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'DeleteSourceLocation' 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:
--
-- 'sourceLocationName', 'deleteSourceLocation_sourceLocationName' - The name of the source location.
newDeleteSourceLocation ::
  -- | 'sourceLocationName'
  Prelude.Text ->
  DeleteSourceLocation
newDeleteSourceLocation :: Text -> DeleteSourceLocation
newDeleteSourceLocation Text
pSourceLocationName_ =
  DeleteSourceLocation'
    { $sel:sourceLocationName:DeleteSourceLocation' :: Text
sourceLocationName =
        Text
pSourceLocationName_
    }

-- | The name of the source location.
deleteSourceLocation_sourceLocationName :: Lens.Lens' DeleteSourceLocation Prelude.Text
deleteSourceLocation_sourceLocationName :: Lens' DeleteSourceLocation Text
deleteSourceLocation_sourceLocationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSourceLocation' {Text
sourceLocationName :: Text
$sel:sourceLocationName:DeleteSourceLocation' :: DeleteSourceLocation -> Text
sourceLocationName} -> Text
sourceLocationName) (\s :: DeleteSourceLocation
s@DeleteSourceLocation' {} Text
a -> DeleteSourceLocation
s {$sel:sourceLocationName:DeleteSourceLocation' :: Text
sourceLocationName = Text
a} :: DeleteSourceLocation)

instance Core.AWSRequest DeleteSourceLocation where
  type
    AWSResponse DeleteSourceLocation =
      DeleteSourceLocationResponse
  request :: (Service -> Service)
-> DeleteSourceLocation -> Request DeleteSourceLocation
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 DeleteSourceLocation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSourceLocation)))
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 -> DeleteSourceLocationResponse
DeleteSourceLocationResponse'
            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 DeleteSourceLocation where
  hashWithSalt :: Int -> DeleteSourceLocation -> Int
hashWithSalt Int
_salt DeleteSourceLocation' {Text
sourceLocationName :: Text
$sel:sourceLocationName:DeleteSourceLocation' :: DeleteSourceLocation -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceLocationName

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

instance Data.ToHeaders DeleteSourceLocation where
  toHeaders :: DeleteSourceLocation -> 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 DeleteSourceLocation where
  toPath :: DeleteSourceLocation -> ByteString
toPath DeleteSourceLocation' {Text
sourceLocationName :: Text
$sel:sourceLocationName:DeleteSourceLocation' :: DeleteSourceLocation -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/sourceLocation/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
sourceLocationName]

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

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

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

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

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