{-# 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.OnDeviceServiceConfiguration
-- 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.OnDeviceServiceConfiguration where

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

-- | An object that represents metadata and configuration settings for
-- services on an AWS Snow Family device.
--
-- /See:/ 'newOnDeviceServiceConfiguration' smart constructor.
data OnDeviceServiceConfiguration = OnDeviceServiceConfiguration'
  { -- | Represents the NFS service on a Snow Family device.
    OnDeviceServiceConfiguration
-> Maybe NFSOnDeviceServiceConfiguration
nFSOnDeviceService :: Prelude.Maybe NFSOnDeviceServiceConfiguration
  }
  deriving (OnDeviceServiceConfiguration
-> OnDeviceServiceConfiguration -> Bool
(OnDeviceServiceConfiguration
 -> OnDeviceServiceConfiguration -> Bool)
-> (OnDeviceServiceConfiguration
    -> OnDeviceServiceConfiguration -> Bool)
-> Eq OnDeviceServiceConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OnDeviceServiceConfiguration
-> OnDeviceServiceConfiguration -> Bool
$c/= :: OnDeviceServiceConfiguration
-> OnDeviceServiceConfiguration -> Bool
== :: OnDeviceServiceConfiguration
-> OnDeviceServiceConfiguration -> Bool
$c== :: OnDeviceServiceConfiguration
-> OnDeviceServiceConfiguration -> Bool
Prelude.Eq, ReadPrec [OnDeviceServiceConfiguration]
ReadPrec OnDeviceServiceConfiguration
Int -> ReadS OnDeviceServiceConfiguration
ReadS [OnDeviceServiceConfiguration]
(Int -> ReadS OnDeviceServiceConfiguration)
-> ReadS [OnDeviceServiceConfiguration]
-> ReadPrec OnDeviceServiceConfiguration
-> ReadPrec [OnDeviceServiceConfiguration]
-> Read OnDeviceServiceConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OnDeviceServiceConfiguration]
$creadListPrec :: ReadPrec [OnDeviceServiceConfiguration]
readPrec :: ReadPrec OnDeviceServiceConfiguration
$creadPrec :: ReadPrec OnDeviceServiceConfiguration
readList :: ReadS [OnDeviceServiceConfiguration]
$creadList :: ReadS [OnDeviceServiceConfiguration]
readsPrec :: Int -> ReadS OnDeviceServiceConfiguration
$creadsPrec :: Int -> ReadS OnDeviceServiceConfiguration
Prelude.Read, Int -> OnDeviceServiceConfiguration -> ShowS
[OnDeviceServiceConfiguration] -> ShowS
OnDeviceServiceConfiguration -> String
(Int -> OnDeviceServiceConfiguration -> ShowS)
-> (OnDeviceServiceConfiguration -> String)
-> ([OnDeviceServiceConfiguration] -> ShowS)
-> Show OnDeviceServiceConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OnDeviceServiceConfiguration] -> ShowS
$cshowList :: [OnDeviceServiceConfiguration] -> ShowS
show :: OnDeviceServiceConfiguration -> String
$cshow :: OnDeviceServiceConfiguration -> String
showsPrec :: Int -> OnDeviceServiceConfiguration -> ShowS
$cshowsPrec :: Int -> OnDeviceServiceConfiguration -> ShowS
Prelude.Show, (forall x.
 OnDeviceServiceConfiguration -> Rep OnDeviceServiceConfiguration x)
-> (forall x.
    Rep OnDeviceServiceConfiguration x -> OnDeviceServiceConfiguration)
-> Generic OnDeviceServiceConfiguration
forall x.
Rep OnDeviceServiceConfiguration x -> OnDeviceServiceConfiguration
forall x.
OnDeviceServiceConfiguration -> Rep OnDeviceServiceConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OnDeviceServiceConfiguration x -> OnDeviceServiceConfiguration
$cfrom :: forall x.
OnDeviceServiceConfiguration -> Rep OnDeviceServiceConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'OnDeviceServiceConfiguration' 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:
--
-- 'nFSOnDeviceService', 'onDeviceServiceConfiguration_nFSOnDeviceService' - Represents the NFS service on a Snow Family device.
newOnDeviceServiceConfiguration ::
  OnDeviceServiceConfiguration
newOnDeviceServiceConfiguration :: OnDeviceServiceConfiguration
newOnDeviceServiceConfiguration =
  OnDeviceServiceConfiguration' :: Maybe NFSOnDeviceServiceConfiguration
-> OnDeviceServiceConfiguration
OnDeviceServiceConfiguration'
    { $sel:nFSOnDeviceService:OnDeviceServiceConfiguration' :: Maybe NFSOnDeviceServiceConfiguration
nFSOnDeviceService =
        Maybe NFSOnDeviceServiceConfiguration
forall a. Maybe a
Prelude.Nothing
    }

-- | Represents the NFS service on a Snow Family device.
onDeviceServiceConfiguration_nFSOnDeviceService :: Lens.Lens' OnDeviceServiceConfiguration (Prelude.Maybe NFSOnDeviceServiceConfiguration)
onDeviceServiceConfiguration_nFSOnDeviceService :: (Maybe NFSOnDeviceServiceConfiguration
 -> f (Maybe NFSOnDeviceServiceConfiguration))
-> OnDeviceServiceConfiguration -> f OnDeviceServiceConfiguration
onDeviceServiceConfiguration_nFSOnDeviceService = (OnDeviceServiceConfiguration
 -> Maybe NFSOnDeviceServiceConfiguration)
-> (OnDeviceServiceConfiguration
    -> Maybe NFSOnDeviceServiceConfiguration
    -> OnDeviceServiceConfiguration)
-> Lens
     OnDeviceServiceConfiguration
     OnDeviceServiceConfiguration
     (Maybe NFSOnDeviceServiceConfiguration)
     (Maybe NFSOnDeviceServiceConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OnDeviceServiceConfiguration' {Maybe NFSOnDeviceServiceConfiguration
nFSOnDeviceService :: Maybe NFSOnDeviceServiceConfiguration
$sel:nFSOnDeviceService:OnDeviceServiceConfiguration' :: OnDeviceServiceConfiguration
-> Maybe NFSOnDeviceServiceConfiguration
nFSOnDeviceService} -> Maybe NFSOnDeviceServiceConfiguration
nFSOnDeviceService) (\s :: OnDeviceServiceConfiguration
s@OnDeviceServiceConfiguration' {} Maybe NFSOnDeviceServiceConfiguration
a -> OnDeviceServiceConfiguration
s {$sel:nFSOnDeviceService:OnDeviceServiceConfiguration' :: Maybe NFSOnDeviceServiceConfiguration
nFSOnDeviceService = Maybe NFSOnDeviceServiceConfiguration
a} :: OnDeviceServiceConfiguration)

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

instance
  Prelude.Hashable
    OnDeviceServiceConfiguration

instance Prelude.NFData OnDeviceServiceConfiguration

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