{-# 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.DataSync.DeleteLocation
-- 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 the configuration of a location used by DataSync.
module Amazonka.DataSync.DeleteLocation
  ( -- * Creating a Request
    DeleteLocation (..),
    newDeleteLocation,

    -- * Request Lenses
    deleteLocation_locationArn,

    -- * Destructuring the Response
    DeleteLocationResponse (..),
    newDeleteLocationResponse,

    -- * Response Lenses
    deleteLocationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DataSync.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

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

-- |
-- Create a value of 'DeleteLocation' 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:
--
-- 'locationArn', 'deleteLocation_locationArn' - The Amazon Resource Name (ARN) of the location to delete.
newDeleteLocation ::
  -- | 'locationArn'
  Prelude.Text ->
  DeleteLocation
newDeleteLocation :: Text -> DeleteLocation
newDeleteLocation Text
pLocationArn_ =
  DeleteLocation' :: Text -> DeleteLocation
DeleteLocation' {$sel:locationArn:DeleteLocation' :: Text
locationArn = Text
pLocationArn_}

-- | The Amazon Resource Name (ARN) of the location to delete.
deleteLocation_locationArn :: Lens.Lens' DeleteLocation Prelude.Text
deleteLocation_locationArn :: (Text -> f Text) -> DeleteLocation -> f DeleteLocation
deleteLocation_locationArn = (DeleteLocation -> Text)
-> (DeleteLocation -> Text -> DeleteLocation)
-> Lens DeleteLocation DeleteLocation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLocation' {Text
locationArn :: Text
$sel:locationArn:DeleteLocation' :: DeleteLocation -> Text
locationArn} -> Text
locationArn) (\s :: DeleteLocation
s@DeleteLocation' {} Text
a -> DeleteLocation
s {$sel:locationArn:DeleteLocation' :: Text
locationArn = Text
a} :: DeleteLocation)

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

instance Prelude.NFData DeleteLocation

instance Core.ToHeaders DeleteLocation where
  toHeaders :: DeleteLocation -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteLocation -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"FmrsService.DeleteLocation" :: Prelude.ByteString),
            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.ToJSON DeleteLocation where
  toJSON :: DeleteLocation -> Value
toJSON DeleteLocation' {Text
locationArn :: Text
$sel:locationArn:DeleteLocation' :: DeleteLocation -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LocationArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
locationArn)]
      )

instance Core.ToPath DeleteLocation where
  toPath :: DeleteLocation -> ByteString
toPath = ByteString -> DeleteLocation -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance Prelude.NFData DeleteLocationResponse