{-# 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.MediaLive.ClaimDevice
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Send a request to claim an AWS Elemental device that you have purchased
-- from a third-party vendor. After the request succeeds, you will own the
-- device.
module Amazonka.MediaLive.ClaimDevice
  ( -- * Creating a Request
    ClaimDevice (..),
    newClaimDevice,

    -- * Request Lenses
    claimDevice_id,

    -- * Destructuring the Response
    ClaimDeviceResponse (..),
    newClaimDeviceResponse,

    -- * Response Lenses
    claimDeviceResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | A request to claim an AWS Elemental device that you have purchased from
-- a third-party vendor.
--
-- /See:/ 'newClaimDevice' smart constructor.
data ClaimDevice = ClaimDevice'
  { -- | The id of the device you want to claim.
    ClaimDevice -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (ClaimDevice -> ClaimDevice -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClaimDevice -> ClaimDevice -> Bool
$c/= :: ClaimDevice -> ClaimDevice -> Bool
== :: ClaimDevice -> ClaimDevice -> Bool
$c== :: ClaimDevice -> ClaimDevice -> Bool
Prelude.Eq, ReadPrec [ClaimDevice]
ReadPrec ClaimDevice
Int -> ReadS ClaimDevice
ReadS [ClaimDevice]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClaimDevice]
$creadListPrec :: ReadPrec [ClaimDevice]
readPrec :: ReadPrec ClaimDevice
$creadPrec :: ReadPrec ClaimDevice
readList :: ReadS [ClaimDevice]
$creadList :: ReadS [ClaimDevice]
readsPrec :: Int -> ReadS ClaimDevice
$creadsPrec :: Int -> ReadS ClaimDevice
Prelude.Read, Int -> ClaimDevice -> ShowS
[ClaimDevice] -> ShowS
ClaimDevice -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClaimDevice] -> ShowS
$cshowList :: [ClaimDevice] -> ShowS
show :: ClaimDevice -> String
$cshow :: ClaimDevice -> String
showsPrec :: Int -> ClaimDevice -> ShowS
$cshowsPrec :: Int -> ClaimDevice -> ShowS
Prelude.Show, forall x. Rep ClaimDevice x -> ClaimDevice
forall x. ClaimDevice -> Rep ClaimDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClaimDevice x -> ClaimDevice
$cfrom :: forall x. ClaimDevice -> Rep ClaimDevice x
Prelude.Generic)

-- |
-- Create a value of 'ClaimDevice' 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:
--
-- 'id', 'claimDevice_id' - The id of the device you want to claim.
newClaimDevice ::
  ClaimDevice
newClaimDevice :: ClaimDevice
newClaimDevice = ClaimDevice' {$sel:id:ClaimDevice' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing}

-- | The id of the device you want to claim.
claimDevice_id :: Lens.Lens' ClaimDevice (Prelude.Maybe Prelude.Text)
claimDevice_id :: Lens' ClaimDevice (Maybe Text)
claimDevice_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClaimDevice' {Maybe Text
id :: Maybe Text
$sel:id:ClaimDevice' :: ClaimDevice -> Maybe Text
id} -> Maybe Text
id) (\s :: ClaimDevice
s@ClaimDevice' {} Maybe Text
a -> ClaimDevice
s {$sel:id:ClaimDevice' :: Maybe Text
id = Maybe Text
a} :: ClaimDevice)

instance Core.AWSRequest ClaimDevice where
  type AWSResponse ClaimDevice = ClaimDeviceResponse
  request :: (Service -> Service) -> ClaimDevice -> Request ClaimDevice
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ClaimDevice
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ClaimDevice)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> ClaimDeviceResponse
ClaimDeviceResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ClaimDevice where
  hashWithSalt :: Int -> ClaimDevice -> Int
hashWithSalt Int
_salt ClaimDevice' {Maybe Text
id :: Maybe Text
$sel:id:ClaimDevice' :: ClaimDevice -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id

instance Prelude.NFData ClaimDevice where
  rnf :: ClaimDevice -> ()
rnf ClaimDevice' {Maybe Text
id :: Maybe Text
$sel:id:ClaimDevice' :: ClaimDevice -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id

instance Data.ToHeaders ClaimDevice where
  toHeaders :: ClaimDevice -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON ClaimDevice where
  toJSON :: ClaimDevice -> Value
toJSON ClaimDevice' {Maybe Text
id :: Maybe Text
$sel:id:ClaimDevice' :: ClaimDevice -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      (forall a. [Maybe a] -> [a]
Prelude.catMaybes [(Key
"id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
id])

instance Data.ToPath ClaimDevice where
  toPath :: ClaimDevice -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/prod/claimDevice"

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

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

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

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

instance Prelude.NFData ClaimDeviceResponse where
  rnf :: ClaimDeviceResponse -> ()
rnf ClaimDeviceResponse' {Int
httpStatus :: Int
$sel:httpStatus:ClaimDeviceResponse' :: ClaimDeviceResponse -> Int
..} = forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus