{-# 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-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 a source location on a specific channel.
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.Lens as Lens
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 identifier for the source location you are working on.
    DeleteSourceLocation -> Text
sourceLocationName :: Prelude.Text
  }
  deriving (DeleteSourceLocation -> DeleteSourceLocation -> Bool
(DeleteSourceLocation -> DeleteSourceLocation -> Bool)
-> (DeleteSourceLocation -> DeleteSourceLocation -> Bool)
-> Eq DeleteSourceLocation
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]
(Int -> ReadS DeleteSourceLocation)
-> ReadS [DeleteSourceLocation]
-> ReadPrec DeleteSourceLocation
-> ReadPrec [DeleteSourceLocation]
-> Read 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
(Int -> DeleteSourceLocation -> ShowS)
-> (DeleteSourceLocation -> String)
-> ([DeleteSourceLocation] -> ShowS)
-> Show DeleteSourceLocation
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. DeleteSourceLocation -> Rep DeleteSourceLocation x)
-> (forall x. Rep DeleteSourceLocation x -> DeleteSourceLocation)
-> Generic DeleteSourceLocation
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 identifier for the source location you are working on.
newDeleteSourceLocation ::
  -- | 'sourceLocationName'
  Prelude.Text ->
  DeleteSourceLocation
newDeleteSourceLocation :: Text -> DeleteSourceLocation
newDeleteSourceLocation Text
pSourceLocationName_ =
  DeleteSourceLocation' :: Text -> DeleteSourceLocation
DeleteSourceLocation'
    { $sel:sourceLocationName:DeleteSourceLocation' :: Text
sourceLocationName =
        Text
pSourceLocationName_
    }

-- | The identifier for the source location you are working on.
deleteSourceLocation_sourceLocationName :: Lens.Lens' DeleteSourceLocation Prelude.Text
deleteSourceLocation_sourceLocationName :: (Text -> f Text) -> DeleteSourceLocation -> f DeleteSourceLocation
deleteSourceLocation_sourceLocationName = (DeleteSourceLocation -> Text)
-> (DeleteSourceLocation -> Text -> DeleteSourceLocation)
-> Lens DeleteSourceLocation DeleteSourceLocation Text Text
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 :: DeleteSourceLocation -> Request DeleteSourceLocation
request = Service -> DeleteSourceLocation -> Request DeleteSourceLocation
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteSourceLocation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSourceLocation)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteSourceLocation))
-> Logger
-> Service
-> Proxy DeleteSourceLocation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSourceLocation)))
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 -> DeleteSourceLocationResponse
DeleteSourceLocationResponse'
            (Int -> DeleteSourceLocationResponse)
-> Either String Int -> Either String DeleteSourceLocationResponse
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 DeleteSourceLocation

instance Prelude.NFData DeleteSourceLocation

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

instance Core.ToQuery DeleteSourceLocation where
  toQuery :: DeleteSourceLocation -> QueryString
toQuery = QueryString -> DeleteSourceLocation -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteSourceLocationResponse
 -> DeleteSourceLocationResponse -> Bool)
-> (DeleteSourceLocationResponse
    -> DeleteSourceLocationResponse -> Bool)
-> Eq DeleteSourceLocationResponse
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]
(Int -> ReadS DeleteSourceLocationResponse)
-> ReadS [DeleteSourceLocationResponse]
-> ReadPrec DeleteSourceLocationResponse
-> ReadPrec [DeleteSourceLocationResponse]
-> Read 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
(Int -> DeleteSourceLocationResponse -> ShowS)
-> (DeleteSourceLocationResponse -> String)
-> ([DeleteSourceLocationResponse] -> ShowS)
-> Show DeleteSourceLocationResponse
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.
 DeleteSourceLocationResponse -> Rep DeleteSourceLocationResponse x)
-> (forall x.
    Rep DeleteSourceLocationResponse x -> DeleteSourceLocationResponse)
-> Generic DeleteSourceLocationResponse
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' :: Int -> DeleteSourceLocationResponse
DeleteSourceLocationResponse'
    { $sel:httpStatus:DeleteSourceLocationResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteSourceLocationResponse_httpStatus :: Lens.Lens' DeleteSourceLocationResponse Prelude.Int
deleteSourceLocationResponse_httpStatus :: (Int -> f Int)
-> DeleteSourceLocationResponse -> f DeleteSourceLocationResponse
deleteSourceLocationResponse_httpStatus = (DeleteSourceLocationResponse -> Int)
-> (DeleteSourceLocationResponse
    -> Int -> DeleteSourceLocationResponse)
-> Lens
     DeleteSourceLocationResponse DeleteSourceLocationResponse Int Int
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