{-# 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.IoT.DeleteDimension
-- 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)
--
-- Removes the specified dimension from your Amazon Web Services accounts.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DeleteDimension>
-- action.
module Amazonka.IoT.DeleteDimension
  ( -- * Creating a Request
    DeleteDimension (..),
    newDeleteDimension,

    -- * Request Lenses
    deleteDimension_name,

    -- * Destructuring the Response
    DeleteDimensionResponse (..),
    newDeleteDimensionResponse,

    -- * Response Lenses
    deleteDimensionResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteDimension' smart constructor.
data DeleteDimension = DeleteDimension'
  { -- | The unique identifier for the dimension that you want to delete.
    DeleteDimension -> Text
name :: Prelude.Text
  }
  deriving (DeleteDimension -> DeleteDimension -> Bool
(DeleteDimension -> DeleteDimension -> Bool)
-> (DeleteDimension -> DeleteDimension -> Bool)
-> Eq DeleteDimension
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDimension -> DeleteDimension -> Bool
$c/= :: DeleteDimension -> DeleteDimension -> Bool
== :: DeleteDimension -> DeleteDimension -> Bool
$c== :: DeleteDimension -> DeleteDimension -> Bool
Prelude.Eq, ReadPrec [DeleteDimension]
ReadPrec DeleteDimension
Int -> ReadS DeleteDimension
ReadS [DeleteDimension]
(Int -> ReadS DeleteDimension)
-> ReadS [DeleteDimension]
-> ReadPrec DeleteDimension
-> ReadPrec [DeleteDimension]
-> Read DeleteDimension
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDimension]
$creadListPrec :: ReadPrec [DeleteDimension]
readPrec :: ReadPrec DeleteDimension
$creadPrec :: ReadPrec DeleteDimension
readList :: ReadS [DeleteDimension]
$creadList :: ReadS [DeleteDimension]
readsPrec :: Int -> ReadS DeleteDimension
$creadsPrec :: Int -> ReadS DeleteDimension
Prelude.Read, Int -> DeleteDimension -> ShowS
[DeleteDimension] -> ShowS
DeleteDimension -> String
(Int -> DeleteDimension -> ShowS)
-> (DeleteDimension -> String)
-> ([DeleteDimension] -> ShowS)
-> Show DeleteDimension
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDimension] -> ShowS
$cshowList :: [DeleteDimension] -> ShowS
show :: DeleteDimension -> String
$cshow :: DeleteDimension -> String
showsPrec :: Int -> DeleteDimension -> ShowS
$cshowsPrec :: Int -> DeleteDimension -> ShowS
Prelude.Show, (forall x. DeleteDimension -> Rep DeleteDimension x)
-> (forall x. Rep DeleteDimension x -> DeleteDimension)
-> Generic DeleteDimension
forall x. Rep DeleteDimension x -> DeleteDimension
forall x. DeleteDimension -> Rep DeleteDimension x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDimension x -> DeleteDimension
$cfrom :: forall x. DeleteDimension -> Rep DeleteDimension x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDimension' 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:
--
-- 'name', 'deleteDimension_name' - The unique identifier for the dimension that you want to delete.
newDeleteDimension ::
  -- | 'name'
  Prelude.Text ->
  DeleteDimension
newDeleteDimension :: Text -> DeleteDimension
newDeleteDimension Text
pName_ =
  DeleteDimension' :: Text -> DeleteDimension
DeleteDimension' {$sel:name:DeleteDimension' :: Text
name = Text
pName_}

-- | The unique identifier for the dimension that you want to delete.
deleteDimension_name :: Lens.Lens' DeleteDimension Prelude.Text
deleteDimension_name :: (Text -> f Text) -> DeleteDimension -> f DeleteDimension
deleteDimension_name = (DeleteDimension -> Text)
-> (DeleteDimension -> Text -> DeleteDimension)
-> Lens DeleteDimension DeleteDimension Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDimension' {Text
name :: Text
$sel:name:DeleteDimension' :: DeleteDimension -> Text
name} -> Text
name) (\s :: DeleteDimension
s@DeleteDimension' {} Text
a -> DeleteDimension
s {$sel:name:DeleteDimension' :: Text
name = Text
a} :: DeleteDimension)

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

instance Prelude.NFData DeleteDimension

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

instance Core.ToPath DeleteDimension where
  toPath :: DeleteDimension -> ByteString
toPath DeleteDimension' {Text
name :: Text
$sel:name:DeleteDimension' :: DeleteDimension -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/dimensions/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name]

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

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

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

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

instance Prelude.NFData DeleteDimensionResponse