{-# 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.DeviceFarm.GetDevice -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Gets information about a unique device type. module Amazonka.DeviceFarm.GetDevice ( -- * Creating a Request GetDevice (..), newGetDevice, -- * Request Lenses getDevice_arn, -- * Destructuring the Response GetDeviceResponse (..), newGetDeviceResponse, -- * Response Lenses getDeviceResponse_device, getDeviceResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.DeviceFarm.Types import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | Represents a request to the get device request. -- -- /See:/ 'newGetDevice' smart constructor. data GetDevice = GetDevice' { -- | The device type\'s ARN. arn :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetDevice' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'arn', 'getDevice_arn' - The device type\'s ARN. newGetDevice :: -- | 'arn' Prelude.Text -> GetDevice newGetDevice pArn_ = GetDevice' {arn = pArn_} -- | The device type\'s ARN. getDevice_arn :: Lens.Lens' GetDevice Prelude.Text getDevice_arn = Lens.lens (\GetDevice' {arn} -> arn) (\s@GetDevice' {} a -> s {arn = a} :: GetDevice) instance Core.AWSRequest GetDevice where type AWSResponse GetDevice = GetDeviceResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> GetDeviceResponse' Prelude.<$> (x Data..?> "device") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable GetDevice where hashWithSalt _salt GetDevice' {..} = _salt `Prelude.hashWithSalt` arn instance Prelude.NFData GetDevice where rnf GetDevice' {..} = Prelude.rnf arn instance Data.ToHeaders GetDevice where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "DeviceFarm_20150623.GetDevice" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON GetDevice where toJSON GetDevice' {..} = Data.object ( Prelude.catMaybes [Prelude.Just ("arn" Data..= arn)] ) instance Data.ToPath GetDevice where toPath = Prelude.const "/" instance Data.ToQuery GetDevice where toQuery = Prelude.const Prelude.mempty -- | Represents the result of a get device request. -- -- /See:/ 'newGetDeviceResponse' smart constructor. data GetDeviceResponse = GetDeviceResponse' { -- | An object that contains information about the requested device. device :: Prelude.Maybe Device, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'GetDeviceResponse' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'device', 'getDeviceResponse_device' - An object that contains information about the requested device. -- -- 'httpStatus', 'getDeviceResponse_httpStatus' - The response's http status code. newGetDeviceResponse :: -- | 'httpStatus' Prelude.Int -> GetDeviceResponse newGetDeviceResponse pHttpStatus_ = GetDeviceResponse' { device = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | An object that contains information about the requested device. getDeviceResponse_device :: Lens.Lens' GetDeviceResponse (Prelude.Maybe Device) getDeviceResponse_device = Lens.lens (\GetDeviceResponse' {device} -> device) (\s@GetDeviceResponse' {} a -> s {device = a} :: GetDeviceResponse) -- | The response's http status code. getDeviceResponse_httpStatus :: Lens.Lens' GetDeviceResponse Prelude.Int getDeviceResponse_httpStatus = Lens.lens (\GetDeviceResponse' {httpStatus} -> httpStatus) (\s@GetDeviceResponse' {} a -> s {httpStatus = a} :: GetDeviceResponse) instance Prelude.NFData GetDeviceResponse where rnf GetDeviceResponse' {..} = Prelude.rnf device `Prelude.seq` Prelude.rnf httpStatus