{-# 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.OpsWorks.Types.ReportedOs
-- 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.OpsWorks.Types.ReportedOs where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A registered instance\'s reported operating system.
--
-- /See:/ 'newReportedOs' smart constructor.
data ReportedOs = ReportedOs'
  { -- | The operating system family.
    ReportedOs -> Maybe Text
family :: Prelude.Maybe Prelude.Text,
    -- | The operating system name.
    ReportedOs -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The operating system version.
    ReportedOs -> Maybe Text
version :: Prelude.Maybe Prelude.Text
  }
  deriving (ReportedOs -> ReportedOs -> Bool
(ReportedOs -> ReportedOs -> Bool)
-> (ReportedOs -> ReportedOs -> Bool) -> Eq ReportedOs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReportedOs -> ReportedOs -> Bool
$c/= :: ReportedOs -> ReportedOs -> Bool
== :: ReportedOs -> ReportedOs -> Bool
$c== :: ReportedOs -> ReportedOs -> Bool
Prelude.Eq, ReadPrec [ReportedOs]
ReadPrec ReportedOs
Int -> ReadS ReportedOs
ReadS [ReportedOs]
(Int -> ReadS ReportedOs)
-> ReadS [ReportedOs]
-> ReadPrec ReportedOs
-> ReadPrec [ReportedOs]
-> Read ReportedOs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReportedOs]
$creadListPrec :: ReadPrec [ReportedOs]
readPrec :: ReadPrec ReportedOs
$creadPrec :: ReadPrec ReportedOs
readList :: ReadS [ReportedOs]
$creadList :: ReadS [ReportedOs]
readsPrec :: Int -> ReadS ReportedOs
$creadsPrec :: Int -> ReadS ReportedOs
Prelude.Read, Int -> ReportedOs -> ShowS
[ReportedOs] -> ShowS
ReportedOs -> String
(Int -> ReportedOs -> ShowS)
-> (ReportedOs -> String)
-> ([ReportedOs] -> ShowS)
-> Show ReportedOs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReportedOs] -> ShowS
$cshowList :: [ReportedOs] -> ShowS
show :: ReportedOs -> String
$cshow :: ReportedOs -> String
showsPrec :: Int -> ReportedOs -> ShowS
$cshowsPrec :: Int -> ReportedOs -> ShowS
Prelude.Show, (forall x. ReportedOs -> Rep ReportedOs x)
-> (forall x. Rep ReportedOs x -> ReportedOs) -> Generic ReportedOs
forall x. Rep ReportedOs x -> ReportedOs
forall x. ReportedOs -> Rep ReportedOs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReportedOs x -> ReportedOs
$cfrom :: forall x. ReportedOs -> Rep ReportedOs x
Prelude.Generic)

-- |
-- Create a value of 'ReportedOs' 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:
--
-- 'family', 'reportedOs_family' - The operating system family.
--
-- 'name', 'reportedOs_name' - The operating system name.
--
-- 'version', 'reportedOs_version' - The operating system version.
newReportedOs ::
  ReportedOs
newReportedOs :: ReportedOs
newReportedOs =
  ReportedOs' :: Maybe Text -> Maybe Text -> Maybe Text -> ReportedOs
ReportedOs'
    { $sel:family:ReportedOs' :: Maybe Text
family = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ReportedOs' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:ReportedOs' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The operating system family.
reportedOs_family :: Lens.Lens' ReportedOs (Prelude.Maybe Prelude.Text)
reportedOs_family :: (Maybe Text -> f (Maybe Text)) -> ReportedOs -> f ReportedOs
reportedOs_family = (ReportedOs -> Maybe Text)
-> (ReportedOs -> Maybe Text -> ReportedOs)
-> Lens ReportedOs ReportedOs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportedOs' {Maybe Text
family :: Maybe Text
$sel:family:ReportedOs' :: ReportedOs -> Maybe Text
family} -> Maybe Text
family) (\s :: ReportedOs
s@ReportedOs' {} Maybe Text
a -> ReportedOs
s {$sel:family:ReportedOs' :: Maybe Text
family = Maybe Text
a} :: ReportedOs)

-- | The operating system name.
reportedOs_name :: Lens.Lens' ReportedOs (Prelude.Maybe Prelude.Text)
reportedOs_name :: (Maybe Text -> f (Maybe Text)) -> ReportedOs -> f ReportedOs
reportedOs_name = (ReportedOs -> Maybe Text)
-> (ReportedOs -> Maybe Text -> ReportedOs)
-> Lens ReportedOs ReportedOs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportedOs' {Maybe Text
name :: Maybe Text
$sel:name:ReportedOs' :: ReportedOs -> Maybe Text
name} -> Maybe Text
name) (\s :: ReportedOs
s@ReportedOs' {} Maybe Text
a -> ReportedOs
s {$sel:name:ReportedOs' :: Maybe Text
name = Maybe Text
a} :: ReportedOs)

-- | The operating system version.
reportedOs_version :: Lens.Lens' ReportedOs (Prelude.Maybe Prelude.Text)
reportedOs_version :: (Maybe Text -> f (Maybe Text)) -> ReportedOs -> f ReportedOs
reportedOs_version = (ReportedOs -> Maybe Text)
-> (ReportedOs -> Maybe Text -> ReportedOs)
-> Lens ReportedOs ReportedOs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportedOs' {Maybe Text
version :: Maybe Text
$sel:version:ReportedOs' :: ReportedOs -> Maybe Text
version} -> Maybe Text
version) (\s :: ReportedOs
s@ReportedOs' {} Maybe Text
a -> ReportedOs
s {$sel:version:ReportedOs' :: Maybe Text
version = Maybe Text
a} :: ReportedOs)

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

instance Prelude.Hashable ReportedOs

instance Prelude.NFData ReportedOs