{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Snowball.Types.DeviceConfiguration
-- 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)
module Amazonka.Snowball.Types.DeviceConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Snowball.Types.SnowconeDeviceConfiguration

-- | The container for @SnowconeDeviceConfiguration@.
--
-- /See:/ 'newDeviceConfiguration' smart constructor.
data DeviceConfiguration = DeviceConfiguration'
  { -- | Returns information about the device configuration for an AWS Snowcone
    -- job.
    DeviceConfiguration -> Maybe SnowconeDeviceConfiguration
snowconeDeviceConfiguration :: Prelude.Maybe SnowconeDeviceConfiguration
  }
  deriving (DeviceConfiguration -> DeviceConfiguration -> Bool
(DeviceConfiguration -> DeviceConfiguration -> Bool)
-> (DeviceConfiguration -> DeviceConfiguration -> Bool)
-> Eq DeviceConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceConfiguration -> DeviceConfiguration -> Bool
$c/= :: DeviceConfiguration -> DeviceConfiguration -> Bool
== :: DeviceConfiguration -> DeviceConfiguration -> Bool
$c== :: DeviceConfiguration -> DeviceConfiguration -> Bool
Prelude.Eq, ReadPrec [DeviceConfiguration]
ReadPrec DeviceConfiguration
Int -> ReadS DeviceConfiguration
ReadS [DeviceConfiguration]
(Int -> ReadS DeviceConfiguration)
-> ReadS [DeviceConfiguration]
-> ReadPrec DeviceConfiguration
-> ReadPrec [DeviceConfiguration]
-> Read DeviceConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceConfiguration]
$creadListPrec :: ReadPrec [DeviceConfiguration]
readPrec :: ReadPrec DeviceConfiguration
$creadPrec :: ReadPrec DeviceConfiguration
readList :: ReadS [DeviceConfiguration]
$creadList :: ReadS [DeviceConfiguration]
readsPrec :: Int -> ReadS DeviceConfiguration
$creadsPrec :: Int -> ReadS DeviceConfiguration
Prelude.Read, Int -> DeviceConfiguration -> ShowS
[DeviceConfiguration] -> ShowS
DeviceConfiguration -> String
(Int -> DeviceConfiguration -> ShowS)
-> (DeviceConfiguration -> String)
-> ([DeviceConfiguration] -> ShowS)
-> Show DeviceConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceConfiguration] -> ShowS
$cshowList :: [DeviceConfiguration] -> ShowS
show :: DeviceConfiguration -> String
$cshow :: DeviceConfiguration -> String
showsPrec :: Int -> DeviceConfiguration -> ShowS
$cshowsPrec :: Int -> DeviceConfiguration -> ShowS
Prelude.Show, (forall x. DeviceConfiguration -> Rep DeviceConfiguration x)
-> (forall x. Rep DeviceConfiguration x -> DeviceConfiguration)
-> Generic DeviceConfiguration
forall x. Rep DeviceConfiguration x -> DeviceConfiguration
forall x. DeviceConfiguration -> Rep DeviceConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceConfiguration x -> DeviceConfiguration
$cfrom :: forall x. DeviceConfiguration -> Rep DeviceConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DeviceConfiguration' 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:
--
-- 'snowconeDeviceConfiguration', 'deviceConfiguration_snowconeDeviceConfiguration' - Returns information about the device configuration for an AWS Snowcone
-- job.
newDeviceConfiguration ::
  DeviceConfiguration
newDeviceConfiguration :: DeviceConfiguration
newDeviceConfiguration =
  DeviceConfiguration' :: Maybe SnowconeDeviceConfiguration -> DeviceConfiguration
DeviceConfiguration'
    { $sel:snowconeDeviceConfiguration:DeviceConfiguration' :: Maybe SnowconeDeviceConfiguration
snowconeDeviceConfiguration =
        Maybe SnowconeDeviceConfiguration
forall a. Maybe a
Prelude.Nothing
    }

-- | Returns information about the device configuration for an AWS Snowcone
-- job.
deviceConfiguration_snowconeDeviceConfiguration :: Lens.Lens' DeviceConfiguration (Prelude.Maybe SnowconeDeviceConfiguration)
deviceConfiguration_snowconeDeviceConfiguration :: (Maybe SnowconeDeviceConfiguration
 -> f (Maybe SnowconeDeviceConfiguration))
-> DeviceConfiguration -> f DeviceConfiguration
deviceConfiguration_snowconeDeviceConfiguration = (DeviceConfiguration -> Maybe SnowconeDeviceConfiguration)
-> (DeviceConfiguration
    -> Maybe SnowconeDeviceConfiguration -> DeviceConfiguration)
-> Lens
     DeviceConfiguration
     DeviceConfiguration
     (Maybe SnowconeDeviceConfiguration)
     (Maybe SnowconeDeviceConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceConfiguration' {Maybe SnowconeDeviceConfiguration
snowconeDeviceConfiguration :: Maybe SnowconeDeviceConfiguration
$sel:snowconeDeviceConfiguration:DeviceConfiguration' :: DeviceConfiguration -> Maybe SnowconeDeviceConfiguration
snowconeDeviceConfiguration} -> Maybe SnowconeDeviceConfiguration
snowconeDeviceConfiguration) (\s :: DeviceConfiguration
s@DeviceConfiguration' {} Maybe SnowconeDeviceConfiguration
a -> DeviceConfiguration
s {$sel:snowconeDeviceConfiguration:DeviceConfiguration' :: Maybe SnowconeDeviceConfiguration
snowconeDeviceConfiguration = Maybe SnowconeDeviceConfiguration
a} :: DeviceConfiguration)

instance Core.FromJSON DeviceConfiguration where
  parseJSON :: Value -> Parser DeviceConfiguration
parseJSON =
    String
-> (Object -> Parser DeviceConfiguration)
-> Value
-> Parser DeviceConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeviceConfiguration"
      ( \Object
x ->
          Maybe SnowconeDeviceConfiguration -> DeviceConfiguration
DeviceConfiguration'
            (Maybe SnowconeDeviceConfiguration -> DeviceConfiguration)
-> Parser (Maybe SnowconeDeviceConfiguration)
-> Parser DeviceConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SnowconeDeviceConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SnowconeDeviceConfiguration")
      )

instance Prelude.Hashable DeviceConfiguration

instance Prelude.NFData DeviceConfiguration

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