{-# 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.DeleteFleetMetric
-- 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 specified fleet metric. Returns successfully with no error
-- if the deletion is successful or you specify a fleet metric that
-- doesn\'t exist.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DeleteFleetMetric>
-- action.
module Amazonka.IoT.DeleteFleetMetric
  ( -- * Creating a Request
    DeleteFleetMetric (..),
    newDeleteFleetMetric,

    -- * Request Lenses
    deleteFleetMetric_expectedVersion,
    deleteFleetMetric_metricName,

    -- * Destructuring the Response
    DeleteFleetMetricResponse (..),
    newDeleteFleetMetricResponse,
  )
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:/ 'newDeleteFleetMetric' smart constructor.
data DeleteFleetMetric = DeleteFleetMetric'
  { -- | The expected version of the fleet metric to delete.
    DeleteFleetMetric -> Maybe Integer
expectedVersion :: Prelude.Maybe Prelude.Integer,
    -- | The name of the fleet metric to delete.
    DeleteFleetMetric -> Text
metricName :: Prelude.Text
  }
  deriving (DeleteFleetMetric -> DeleteFleetMetric -> Bool
(DeleteFleetMetric -> DeleteFleetMetric -> Bool)
-> (DeleteFleetMetric -> DeleteFleetMetric -> Bool)
-> Eq DeleteFleetMetric
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFleetMetric -> DeleteFleetMetric -> Bool
$c/= :: DeleteFleetMetric -> DeleteFleetMetric -> Bool
== :: DeleteFleetMetric -> DeleteFleetMetric -> Bool
$c== :: DeleteFleetMetric -> DeleteFleetMetric -> Bool
Prelude.Eq, ReadPrec [DeleteFleetMetric]
ReadPrec DeleteFleetMetric
Int -> ReadS DeleteFleetMetric
ReadS [DeleteFleetMetric]
(Int -> ReadS DeleteFleetMetric)
-> ReadS [DeleteFleetMetric]
-> ReadPrec DeleteFleetMetric
-> ReadPrec [DeleteFleetMetric]
-> Read DeleteFleetMetric
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFleetMetric]
$creadListPrec :: ReadPrec [DeleteFleetMetric]
readPrec :: ReadPrec DeleteFleetMetric
$creadPrec :: ReadPrec DeleteFleetMetric
readList :: ReadS [DeleteFleetMetric]
$creadList :: ReadS [DeleteFleetMetric]
readsPrec :: Int -> ReadS DeleteFleetMetric
$creadsPrec :: Int -> ReadS DeleteFleetMetric
Prelude.Read, Int -> DeleteFleetMetric -> ShowS
[DeleteFleetMetric] -> ShowS
DeleteFleetMetric -> String
(Int -> DeleteFleetMetric -> ShowS)
-> (DeleteFleetMetric -> String)
-> ([DeleteFleetMetric] -> ShowS)
-> Show DeleteFleetMetric
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFleetMetric] -> ShowS
$cshowList :: [DeleteFleetMetric] -> ShowS
show :: DeleteFleetMetric -> String
$cshow :: DeleteFleetMetric -> String
showsPrec :: Int -> DeleteFleetMetric -> ShowS
$cshowsPrec :: Int -> DeleteFleetMetric -> ShowS
Prelude.Show, (forall x. DeleteFleetMetric -> Rep DeleteFleetMetric x)
-> (forall x. Rep DeleteFleetMetric x -> DeleteFleetMetric)
-> Generic DeleteFleetMetric
forall x. Rep DeleteFleetMetric x -> DeleteFleetMetric
forall x. DeleteFleetMetric -> Rep DeleteFleetMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFleetMetric x -> DeleteFleetMetric
$cfrom :: forall x. DeleteFleetMetric -> Rep DeleteFleetMetric x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFleetMetric' 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:
--
-- 'expectedVersion', 'deleteFleetMetric_expectedVersion' - The expected version of the fleet metric to delete.
--
-- 'metricName', 'deleteFleetMetric_metricName' - The name of the fleet metric to delete.
newDeleteFleetMetric ::
  -- | 'metricName'
  Prelude.Text ->
  DeleteFleetMetric
newDeleteFleetMetric :: Text -> DeleteFleetMetric
newDeleteFleetMetric Text
pMetricName_ =
  DeleteFleetMetric' :: Maybe Integer -> Text -> DeleteFleetMetric
DeleteFleetMetric'
    { $sel:expectedVersion:DeleteFleetMetric' :: Maybe Integer
expectedVersion =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:metricName:DeleteFleetMetric' :: Text
metricName = Text
pMetricName_
    }

-- | The expected version of the fleet metric to delete.
deleteFleetMetric_expectedVersion :: Lens.Lens' DeleteFleetMetric (Prelude.Maybe Prelude.Integer)
deleteFleetMetric_expectedVersion :: (Maybe Integer -> f (Maybe Integer))
-> DeleteFleetMetric -> f DeleteFleetMetric
deleteFleetMetric_expectedVersion = (DeleteFleetMetric -> Maybe Integer)
-> (DeleteFleetMetric -> Maybe Integer -> DeleteFleetMetric)
-> Lens
     DeleteFleetMetric DeleteFleetMetric (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFleetMetric' {Maybe Integer
expectedVersion :: Maybe Integer
$sel:expectedVersion:DeleteFleetMetric' :: DeleteFleetMetric -> Maybe Integer
expectedVersion} -> Maybe Integer
expectedVersion) (\s :: DeleteFleetMetric
s@DeleteFleetMetric' {} Maybe Integer
a -> DeleteFleetMetric
s {$sel:expectedVersion:DeleteFleetMetric' :: Maybe Integer
expectedVersion = Maybe Integer
a} :: DeleteFleetMetric)

-- | The name of the fleet metric to delete.
deleteFleetMetric_metricName :: Lens.Lens' DeleteFleetMetric Prelude.Text
deleteFleetMetric_metricName :: (Text -> f Text) -> DeleteFleetMetric -> f DeleteFleetMetric
deleteFleetMetric_metricName = (DeleteFleetMetric -> Text)
-> (DeleteFleetMetric -> Text -> DeleteFleetMetric)
-> Lens DeleteFleetMetric DeleteFleetMetric Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFleetMetric' {Text
metricName :: Text
$sel:metricName:DeleteFleetMetric' :: DeleteFleetMetric -> Text
metricName} -> Text
metricName) (\s :: DeleteFleetMetric
s@DeleteFleetMetric' {} Text
a -> DeleteFleetMetric
s {$sel:metricName:DeleteFleetMetric' :: Text
metricName = Text
a} :: DeleteFleetMetric)

instance Core.AWSRequest DeleteFleetMetric where
  type
    AWSResponse DeleteFleetMetric =
      DeleteFleetMetricResponse
  request :: DeleteFleetMetric -> Request DeleteFleetMetric
request = Service -> DeleteFleetMetric -> Request DeleteFleetMetric
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteFleetMetric
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteFleetMetric)))
response =
    AWSResponse DeleteFleetMetric
-> Logger
-> Service
-> Proxy DeleteFleetMetric
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteFleetMetric)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteFleetMetric
DeleteFleetMetricResponse
DeleteFleetMetricResponse'

instance Prelude.Hashable DeleteFleetMetric

instance Prelude.NFData DeleteFleetMetric

instance Core.ToHeaders DeleteFleetMetric where
  toHeaders :: DeleteFleetMetric -> [Header]
toHeaders = [Header] -> DeleteFleetMetric -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DeleteFleetMetric where
  toPath :: DeleteFleetMetric -> ByteString
toPath DeleteFleetMetric' {Maybe Integer
Text
metricName :: Text
expectedVersion :: Maybe Integer
$sel:metricName:DeleteFleetMetric' :: DeleteFleetMetric -> Text
$sel:expectedVersion:DeleteFleetMetric' :: DeleteFleetMetric -> Maybe Integer
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/fleet-metric/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
metricName]

instance Core.ToQuery DeleteFleetMetric where
  toQuery :: DeleteFleetMetric -> QueryString
toQuery DeleteFleetMetric' {Maybe Integer
Text
metricName :: Text
expectedVersion :: Maybe Integer
$sel:metricName:DeleteFleetMetric' :: DeleteFleetMetric -> Text
$sel:expectedVersion:DeleteFleetMetric' :: DeleteFleetMetric -> Maybe Integer
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"expectedVersion" ByteString -> Maybe Integer -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Integer
expectedVersion]

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

-- |
-- Create a value of 'DeleteFleetMetricResponse' 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.
newDeleteFleetMetricResponse ::
  DeleteFleetMetricResponse
newDeleteFleetMetricResponse :: DeleteFleetMetricResponse
newDeleteFleetMetricResponse =
  DeleteFleetMetricResponse
DeleteFleetMetricResponse'

instance Prelude.NFData DeleteFleetMetricResponse