{-# 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.MigrationHubStrategy.Types.OSInfo
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MigrationHubStrategy.Types.OSInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MigrationHubStrategy.Types.OSType
import qualified Amazonka.Prelude as Prelude

-- | Information about the operating system.
--
-- /See:/ 'newOSInfo' smart constructor.
data OSInfo = OSInfo'
  { -- | Information about the type of operating system.
    OSInfo -> Maybe OSType
type' :: Prelude.Maybe OSType,
    -- | Information about the version of operating system.
    OSInfo -> Maybe Text
version :: Prelude.Maybe Prelude.Text
  }
  deriving (OSInfo -> OSInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OSInfo -> OSInfo -> Bool
$c/= :: OSInfo -> OSInfo -> Bool
== :: OSInfo -> OSInfo -> Bool
$c== :: OSInfo -> OSInfo -> Bool
Prelude.Eq, ReadPrec [OSInfo]
ReadPrec OSInfo
Int -> ReadS OSInfo
ReadS [OSInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OSInfo]
$creadListPrec :: ReadPrec [OSInfo]
readPrec :: ReadPrec OSInfo
$creadPrec :: ReadPrec OSInfo
readList :: ReadS [OSInfo]
$creadList :: ReadS [OSInfo]
readsPrec :: Int -> ReadS OSInfo
$creadsPrec :: Int -> ReadS OSInfo
Prelude.Read, Int -> OSInfo -> ShowS
[OSInfo] -> ShowS
OSInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OSInfo] -> ShowS
$cshowList :: [OSInfo] -> ShowS
show :: OSInfo -> String
$cshow :: OSInfo -> String
showsPrec :: Int -> OSInfo -> ShowS
$cshowsPrec :: Int -> OSInfo -> ShowS
Prelude.Show, forall x. Rep OSInfo x -> OSInfo
forall x. OSInfo -> Rep OSInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OSInfo x -> OSInfo
$cfrom :: forall x. OSInfo -> Rep OSInfo x
Prelude.Generic)

-- |
-- Create a value of 'OSInfo' 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:
--
-- 'type'', 'oSInfo_type' - Information about the type of operating system.
--
-- 'version', 'oSInfo_version' - Information about the version of operating system.
newOSInfo ::
  OSInfo
newOSInfo :: OSInfo
newOSInfo =
  OSInfo'
    { $sel:type':OSInfo' :: Maybe OSType
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:version:OSInfo' :: Maybe Text
version = forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the type of operating system.
oSInfo_type :: Lens.Lens' OSInfo (Prelude.Maybe OSType)
oSInfo_type :: Lens' OSInfo (Maybe OSType)
oSInfo_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OSInfo' {Maybe OSType
type' :: Maybe OSType
$sel:type':OSInfo' :: OSInfo -> Maybe OSType
type'} -> Maybe OSType
type') (\s :: OSInfo
s@OSInfo' {} Maybe OSType
a -> OSInfo
s {$sel:type':OSInfo' :: Maybe OSType
type' = Maybe OSType
a} :: OSInfo)

-- | Information about the version of operating system.
oSInfo_version :: Lens.Lens' OSInfo (Prelude.Maybe Prelude.Text)
oSInfo_version :: Lens' OSInfo (Maybe Text)
oSInfo_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OSInfo' {Maybe Text
version :: Maybe Text
$sel:version:OSInfo' :: OSInfo -> Maybe Text
version} -> Maybe Text
version) (\s :: OSInfo
s@OSInfo' {} Maybe Text
a -> OSInfo
s {$sel:version:OSInfo' :: Maybe Text
version = Maybe Text
a} :: OSInfo)

instance Data.FromJSON OSInfo where
  parseJSON :: Value -> Parser OSInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OSInfo"
      ( \Object
x ->
          Maybe OSType -> Maybe Text -> OSInfo
OSInfo'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"type")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"version")
      )

instance Prelude.Hashable OSInfo where
  hashWithSalt :: Int -> OSInfo -> Int
hashWithSalt Int
_salt OSInfo' {Maybe Text
Maybe OSType
version :: Maybe Text
type' :: Maybe OSType
$sel:version:OSInfo' :: OSInfo -> Maybe Text
$sel:type':OSInfo' :: OSInfo -> Maybe OSType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OSType
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
version

instance Prelude.NFData OSInfo where
  rnf :: OSInfo -> ()
rnf OSInfo' {Maybe Text
Maybe OSType
version :: Maybe Text
type' :: Maybe OSType
$sel:version:OSInfo' :: OSInfo -> Maybe Text
$sel:type':OSInfo' :: OSInfo -> Maybe OSType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe OSType
type' seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
version