{-# 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.AlexaBusiness.DeleteDeviceUsageData
-- 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)
--
-- When this action is called for a specified shared device, it allows
-- authorized users to delete the device\'s entire previous history of
-- voice input data and associated response data. This action can be called
-- once every 24 hours for a specific shared device.
module Amazonka.AlexaBusiness.DeleteDeviceUsageData
  ( -- * Creating a Request
    DeleteDeviceUsageData (..),
    newDeleteDeviceUsageData,

    -- * Request Lenses
    deleteDeviceUsageData_deviceArn,
    deleteDeviceUsageData_deviceUsageType,

    -- * Destructuring the Response
    DeleteDeviceUsageDataResponse (..),
    newDeleteDeviceUsageDataResponse,

    -- * Response Lenses
    deleteDeviceUsageDataResponse_httpStatus,
  )
where

import Amazonka.AlexaBusiness.Types
import qualified Amazonka.Core as Core
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:/ 'newDeleteDeviceUsageData' smart constructor.
data DeleteDeviceUsageData = DeleteDeviceUsageData'
  { -- | The ARN of the device.
    DeleteDeviceUsageData -> Text
deviceArn :: Prelude.Text,
    -- | The type of usage data to delete.
    DeleteDeviceUsageData -> DeviceUsageType
deviceUsageType :: DeviceUsageType
  }
  deriving (DeleteDeviceUsageData -> DeleteDeviceUsageData -> Bool
(DeleteDeviceUsageData -> DeleteDeviceUsageData -> Bool)
-> (DeleteDeviceUsageData -> DeleteDeviceUsageData -> Bool)
-> Eq DeleteDeviceUsageData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDeviceUsageData -> DeleteDeviceUsageData -> Bool
$c/= :: DeleteDeviceUsageData -> DeleteDeviceUsageData -> Bool
== :: DeleteDeviceUsageData -> DeleteDeviceUsageData -> Bool
$c== :: DeleteDeviceUsageData -> DeleteDeviceUsageData -> Bool
Prelude.Eq, ReadPrec [DeleteDeviceUsageData]
ReadPrec DeleteDeviceUsageData
Int -> ReadS DeleteDeviceUsageData
ReadS [DeleteDeviceUsageData]
(Int -> ReadS DeleteDeviceUsageData)
-> ReadS [DeleteDeviceUsageData]
-> ReadPrec DeleteDeviceUsageData
-> ReadPrec [DeleteDeviceUsageData]
-> Read DeleteDeviceUsageData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDeviceUsageData]
$creadListPrec :: ReadPrec [DeleteDeviceUsageData]
readPrec :: ReadPrec DeleteDeviceUsageData
$creadPrec :: ReadPrec DeleteDeviceUsageData
readList :: ReadS [DeleteDeviceUsageData]
$creadList :: ReadS [DeleteDeviceUsageData]
readsPrec :: Int -> ReadS DeleteDeviceUsageData
$creadsPrec :: Int -> ReadS DeleteDeviceUsageData
Prelude.Read, Int -> DeleteDeviceUsageData -> ShowS
[DeleteDeviceUsageData] -> ShowS
DeleteDeviceUsageData -> String
(Int -> DeleteDeviceUsageData -> ShowS)
-> (DeleteDeviceUsageData -> String)
-> ([DeleteDeviceUsageData] -> ShowS)
-> Show DeleteDeviceUsageData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDeviceUsageData] -> ShowS
$cshowList :: [DeleteDeviceUsageData] -> ShowS
show :: DeleteDeviceUsageData -> String
$cshow :: DeleteDeviceUsageData -> String
showsPrec :: Int -> DeleteDeviceUsageData -> ShowS
$cshowsPrec :: Int -> DeleteDeviceUsageData -> ShowS
Prelude.Show, (forall x. DeleteDeviceUsageData -> Rep DeleteDeviceUsageData x)
-> (forall x. Rep DeleteDeviceUsageData x -> DeleteDeviceUsageData)
-> Generic DeleteDeviceUsageData
forall x. Rep DeleteDeviceUsageData x -> DeleteDeviceUsageData
forall x. DeleteDeviceUsageData -> Rep DeleteDeviceUsageData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDeviceUsageData x -> DeleteDeviceUsageData
$cfrom :: forall x. DeleteDeviceUsageData -> Rep DeleteDeviceUsageData x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDeviceUsageData' 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:
--
-- 'deviceArn', 'deleteDeviceUsageData_deviceArn' - The ARN of the device.
--
-- 'deviceUsageType', 'deleteDeviceUsageData_deviceUsageType' - The type of usage data to delete.
newDeleteDeviceUsageData ::
  -- | 'deviceArn'
  Prelude.Text ->
  -- | 'deviceUsageType'
  DeviceUsageType ->
  DeleteDeviceUsageData
newDeleteDeviceUsageData :: Text -> DeviceUsageType -> DeleteDeviceUsageData
newDeleteDeviceUsageData
  Text
pDeviceArn_
  DeviceUsageType
pDeviceUsageType_ =
    DeleteDeviceUsageData' :: Text -> DeviceUsageType -> DeleteDeviceUsageData
DeleteDeviceUsageData'
      { $sel:deviceArn:DeleteDeviceUsageData' :: Text
deviceArn = Text
pDeviceArn_,
        $sel:deviceUsageType:DeleteDeviceUsageData' :: DeviceUsageType
deviceUsageType = DeviceUsageType
pDeviceUsageType_
      }

-- | The ARN of the device.
deleteDeviceUsageData_deviceArn :: Lens.Lens' DeleteDeviceUsageData Prelude.Text
deleteDeviceUsageData_deviceArn :: (Text -> f Text)
-> DeleteDeviceUsageData -> f DeleteDeviceUsageData
deleteDeviceUsageData_deviceArn = (DeleteDeviceUsageData -> Text)
-> (DeleteDeviceUsageData -> Text -> DeleteDeviceUsageData)
-> Lens DeleteDeviceUsageData DeleteDeviceUsageData Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDeviceUsageData' {Text
deviceArn :: Text
$sel:deviceArn:DeleteDeviceUsageData' :: DeleteDeviceUsageData -> Text
deviceArn} -> Text
deviceArn) (\s :: DeleteDeviceUsageData
s@DeleteDeviceUsageData' {} Text
a -> DeleteDeviceUsageData
s {$sel:deviceArn:DeleteDeviceUsageData' :: Text
deviceArn = Text
a} :: DeleteDeviceUsageData)

-- | The type of usage data to delete.
deleteDeviceUsageData_deviceUsageType :: Lens.Lens' DeleteDeviceUsageData DeviceUsageType
deleteDeviceUsageData_deviceUsageType :: (DeviceUsageType -> f DeviceUsageType)
-> DeleteDeviceUsageData -> f DeleteDeviceUsageData
deleteDeviceUsageData_deviceUsageType = (DeleteDeviceUsageData -> DeviceUsageType)
-> (DeleteDeviceUsageData
    -> DeviceUsageType -> DeleteDeviceUsageData)
-> Lens
     DeleteDeviceUsageData
     DeleteDeviceUsageData
     DeviceUsageType
     DeviceUsageType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDeviceUsageData' {DeviceUsageType
deviceUsageType :: DeviceUsageType
$sel:deviceUsageType:DeleteDeviceUsageData' :: DeleteDeviceUsageData -> DeviceUsageType
deviceUsageType} -> DeviceUsageType
deviceUsageType) (\s :: DeleteDeviceUsageData
s@DeleteDeviceUsageData' {} DeviceUsageType
a -> DeleteDeviceUsageData
s {$sel:deviceUsageType:DeleteDeviceUsageData' :: DeviceUsageType
deviceUsageType = DeviceUsageType
a} :: DeleteDeviceUsageData)

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

instance Prelude.NFData DeleteDeviceUsageData

instance Core.ToHeaders DeleteDeviceUsageData where
  toHeaders :: DeleteDeviceUsageData -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteDeviceUsageData -> 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
"AlexaForBusiness.DeleteDeviceUsageData" ::
                          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 DeleteDeviceUsageData where
  toJSON :: DeleteDeviceUsageData -> Value
toJSON DeleteDeviceUsageData' {Text
DeviceUsageType
deviceUsageType :: DeviceUsageType
deviceArn :: Text
$sel:deviceUsageType:DeleteDeviceUsageData' :: DeleteDeviceUsageData -> DeviceUsageType
$sel:deviceArn:DeleteDeviceUsageData' :: DeleteDeviceUsageData -> 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
"DeviceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deviceArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"DeviceUsageType" Text -> DeviceUsageType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DeviceUsageType
deviceUsageType)
          ]
      )

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

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

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

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

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

instance Prelude.NFData DeleteDeviceUsageDataResponse