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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types.OperatingSystemConfigurationManager
import qualified Amazonka.Prelude as Prelude

-- | Describes supported operating systems in AWS OpsWorks Stacks.
--
-- /See:/ 'newOperatingSystem' smart constructor.
data OperatingSystem = OperatingSystem'
  { -- | The version of the operating system, including the release and edition,
    -- if applicable.
    OperatingSystem -> Maybe Text
reportedVersion :: Prelude.Maybe Prelude.Text,
    -- | Indicates that an operating system is not supported for new instances.
    OperatingSystem -> Maybe Bool
supported :: Prelude.Maybe Prelude.Bool,
    -- | The name of the operating system, such as @Amazon Linux 2018.03@.
    OperatingSystem -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ID of a supported operating system, such as @Amazon Linux 2018.03@.
    OperatingSystem -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | Supported configuration manager name and versions for an AWS OpsWorks
    -- Stacks operating system.
    OperatingSystem -> Maybe [OperatingSystemConfigurationManager]
configurationManagers :: Prelude.Maybe [OperatingSystemConfigurationManager],
    -- | The type of a supported operating system, either @Linux@ or @Windows@.
    OperatingSystem -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
    -- | A short name for the operating system manufacturer.
    OperatingSystem -> Maybe Text
reportedName :: Prelude.Maybe Prelude.Text
  }
  deriving (OperatingSystem -> OperatingSystem -> Bool
(OperatingSystem -> OperatingSystem -> Bool)
-> (OperatingSystem -> OperatingSystem -> Bool)
-> Eq OperatingSystem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OperatingSystem -> OperatingSystem -> Bool
$c/= :: OperatingSystem -> OperatingSystem -> Bool
== :: OperatingSystem -> OperatingSystem -> Bool
$c== :: OperatingSystem -> OperatingSystem -> Bool
Prelude.Eq, ReadPrec [OperatingSystem]
ReadPrec OperatingSystem
Int -> ReadS OperatingSystem
ReadS [OperatingSystem]
(Int -> ReadS OperatingSystem)
-> ReadS [OperatingSystem]
-> ReadPrec OperatingSystem
-> ReadPrec [OperatingSystem]
-> Read OperatingSystem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OperatingSystem]
$creadListPrec :: ReadPrec [OperatingSystem]
readPrec :: ReadPrec OperatingSystem
$creadPrec :: ReadPrec OperatingSystem
readList :: ReadS [OperatingSystem]
$creadList :: ReadS [OperatingSystem]
readsPrec :: Int -> ReadS OperatingSystem
$creadsPrec :: Int -> ReadS OperatingSystem
Prelude.Read, Int -> OperatingSystem -> ShowS
[OperatingSystem] -> ShowS
OperatingSystem -> String
(Int -> OperatingSystem -> ShowS)
-> (OperatingSystem -> String)
-> ([OperatingSystem] -> ShowS)
-> Show OperatingSystem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OperatingSystem] -> ShowS
$cshowList :: [OperatingSystem] -> ShowS
show :: OperatingSystem -> String
$cshow :: OperatingSystem -> String
showsPrec :: Int -> OperatingSystem -> ShowS
$cshowsPrec :: Int -> OperatingSystem -> ShowS
Prelude.Show, (forall x. OperatingSystem -> Rep OperatingSystem x)
-> (forall x. Rep OperatingSystem x -> OperatingSystem)
-> Generic OperatingSystem
forall x. Rep OperatingSystem x -> OperatingSystem
forall x. OperatingSystem -> Rep OperatingSystem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OperatingSystem x -> OperatingSystem
$cfrom :: forall x. OperatingSystem -> Rep OperatingSystem x
Prelude.Generic)

-- |
-- Create a value of 'OperatingSystem' 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:
--
-- 'reportedVersion', 'operatingSystem_reportedVersion' - The version of the operating system, including the release and edition,
-- if applicable.
--
-- 'supported', 'operatingSystem_supported' - Indicates that an operating system is not supported for new instances.
--
-- 'name', 'operatingSystem_name' - The name of the operating system, such as @Amazon Linux 2018.03@.
--
-- 'id', 'operatingSystem_id' - The ID of a supported operating system, such as @Amazon Linux 2018.03@.
--
-- 'configurationManagers', 'operatingSystem_configurationManagers' - Supported configuration manager name and versions for an AWS OpsWorks
-- Stacks operating system.
--
-- 'type'', 'operatingSystem_type' - The type of a supported operating system, either @Linux@ or @Windows@.
--
-- 'reportedName', 'operatingSystem_reportedName' - A short name for the operating system manufacturer.
newOperatingSystem ::
  OperatingSystem
newOperatingSystem :: OperatingSystem
newOperatingSystem =
  OperatingSystem' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe [OperatingSystemConfigurationManager]
-> Maybe Text
-> Maybe Text
-> OperatingSystem
OperatingSystem'
    { $sel:reportedVersion:OperatingSystem' :: Maybe Text
reportedVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:supported:OperatingSystem' :: Maybe Bool
supported = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:name:OperatingSystem' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:OperatingSystem' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:configurationManagers:OperatingSystem' :: Maybe [OperatingSystemConfigurationManager]
configurationManagers = Maybe [OperatingSystemConfigurationManager]
forall a. Maybe a
Prelude.Nothing,
      $sel:type':OperatingSystem' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reportedName:OperatingSystem' :: Maybe Text
reportedName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The version of the operating system, including the release and edition,
-- if applicable.
operatingSystem_reportedVersion :: Lens.Lens' OperatingSystem (Prelude.Maybe Prelude.Text)
operatingSystem_reportedVersion :: (Maybe Text -> f (Maybe Text))
-> OperatingSystem -> f OperatingSystem
operatingSystem_reportedVersion = (OperatingSystem -> Maybe Text)
-> (OperatingSystem -> Maybe Text -> OperatingSystem)
-> Lens OperatingSystem OperatingSystem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperatingSystem' {Maybe Text
reportedVersion :: Maybe Text
$sel:reportedVersion:OperatingSystem' :: OperatingSystem -> Maybe Text
reportedVersion} -> Maybe Text
reportedVersion) (\s :: OperatingSystem
s@OperatingSystem' {} Maybe Text
a -> OperatingSystem
s {$sel:reportedVersion:OperatingSystem' :: Maybe Text
reportedVersion = Maybe Text
a} :: OperatingSystem)

-- | Indicates that an operating system is not supported for new instances.
operatingSystem_supported :: Lens.Lens' OperatingSystem (Prelude.Maybe Prelude.Bool)
operatingSystem_supported :: (Maybe Bool -> f (Maybe Bool))
-> OperatingSystem -> f OperatingSystem
operatingSystem_supported = (OperatingSystem -> Maybe Bool)
-> (OperatingSystem -> Maybe Bool -> OperatingSystem)
-> Lens OperatingSystem OperatingSystem (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperatingSystem' {Maybe Bool
supported :: Maybe Bool
$sel:supported:OperatingSystem' :: OperatingSystem -> Maybe Bool
supported} -> Maybe Bool
supported) (\s :: OperatingSystem
s@OperatingSystem' {} Maybe Bool
a -> OperatingSystem
s {$sel:supported:OperatingSystem' :: Maybe Bool
supported = Maybe Bool
a} :: OperatingSystem)

-- | The name of the operating system, such as @Amazon Linux 2018.03@.
operatingSystem_name :: Lens.Lens' OperatingSystem (Prelude.Maybe Prelude.Text)
operatingSystem_name :: (Maybe Text -> f (Maybe Text))
-> OperatingSystem -> f OperatingSystem
operatingSystem_name = (OperatingSystem -> Maybe Text)
-> (OperatingSystem -> Maybe Text -> OperatingSystem)
-> Lens OperatingSystem OperatingSystem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperatingSystem' {Maybe Text
name :: Maybe Text
$sel:name:OperatingSystem' :: OperatingSystem -> Maybe Text
name} -> Maybe Text
name) (\s :: OperatingSystem
s@OperatingSystem' {} Maybe Text
a -> OperatingSystem
s {$sel:name:OperatingSystem' :: Maybe Text
name = Maybe Text
a} :: OperatingSystem)

-- | The ID of a supported operating system, such as @Amazon Linux 2018.03@.
operatingSystem_id :: Lens.Lens' OperatingSystem (Prelude.Maybe Prelude.Text)
operatingSystem_id :: (Maybe Text -> f (Maybe Text))
-> OperatingSystem -> f OperatingSystem
operatingSystem_id = (OperatingSystem -> Maybe Text)
-> (OperatingSystem -> Maybe Text -> OperatingSystem)
-> Lens OperatingSystem OperatingSystem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperatingSystem' {Maybe Text
id :: Maybe Text
$sel:id:OperatingSystem' :: OperatingSystem -> Maybe Text
id} -> Maybe Text
id) (\s :: OperatingSystem
s@OperatingSystem' {} Maybe Text
a -> OperatingSystem
s {$sel:id:OperatingSystem' :: Maybe Text
id = Maybe Text
a} :: OperatingSystem)

-- | Supported configuration manager name and versions for an AWS OpsWorks
-- Stacks operating system.
operatingSystem_configurationManagers :: Lens.Lens' OperatingSystem (Prelude.Maybe [OperatingSystemConfigurationManager])
operatingSystem_configurationManagers :: (Maybe [OperatingSystemConfigurationManager]
 -> f (Maybe [OperatingSystemConfigurationManager]))
-> OperatingSystem -> f OperatingSystem
operatingSystem_configurationManagers = (OperatingSystem -> Maybe [OperatingSystemConfigurationManager])
-> (OperatingSystem
    -> Maybe [OperatingSystemConfigurationManager] -> OperatingSystem)
-> Lens
     OperatingSystem
     OperatingSystem
     (Maybe [OperatingSystemConfigurationManager])
     (Maybe [OperatingSystemConfigurationManager])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperatingSystem' {Maybe [OperatingSystemConfigurationManager]
configurationManagers :: Maybe [OperatingSystemConfigurationManager]
$sel:configurationManagers:OperatingSystem' :: OperatingSystem -> Maybe [OperatingSystemConfigurationManager]
configurationManagers} -> Maybe [OperatingSystemConfigurationManager]
configurationManagers) (\s :: OperatingSystem
s@OperatingSystem' {} Maybe [OperatingSystemConfigurationManager]
a -> OperatingSystem
s {$sel:configurationManagers:OperatingSystem' :: Maybe [OperatingSystemConfigurationManager]
configurationManagers = Maybe [OperatingSystemConfigurationManager]
a} :: OperatingSystem) ((Maybe [OperatingSystemConfigurationManager]
  -> f (Maybe [OperatingSystemConfigurationManager]))
 -> OperatingSystem -> f OperatingSystem)
-> ((Maybe [OperatingSystemConfigurationManager]
     -> f (Maybe [OperatingSystemConfigurationManager]))
    -> Maybe [OperatingSystemConfigurationManager]
    -> f (Maybe [OperatingSystemConfigurationManager]))
-> (Maybe [OperatingSystemConfigurationManager]
    -> f (Maybe [OperatingSystemConfigurationManager]))
-> OperatingSystem
-> f OperatingSystem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OperatingSystemConfigurationManager]
  [OperatingSystemConfigurationManager]
  [OperatingSystemConfigurationManager]
  [OperatingSystemConfigurationManager]
-> Iso
     (Maybe [OperatingSystemConfigurationManager])
     (Maybe [OperatingSystemConfigurationManager])
     (Maybe [OperatingSystemConfigurationManager])
     (Maybe [OperatingSystemConfigurationManager])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [OperatingSystemConfigurationManager]
  [OperatingSystemConfigurationManager]
  [OperatingSystemConfigurationManager]
  [OperatingSystemConfigurationManager]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The type of a supported operating system, either @Linux@ or @Windows@.
operatingSystem_type :: Lens.Lens' OperatingSystem (Prelude.Maybe Prelude.Text)
operatingSystem_type :: (Maybe Text -> f (Maybe Text))
-> OperatingSystem -> f OperatingSystem
operatingSystem_type = (OperatingSystem -> Maybe Text)
-> (OperatingSystem -> Maybe Text -> OperatingSystem)
-> Lens OperatingSystem OperatingSystem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperatingSystem' {Maybe Text
type' :: Maybe Text
$sel:type':OperatingSystem' :: OperatingSystem -> Maybe Text
type'} -> Maybe Text
type') (\s :: OperatingSystem
s@OperatingSystem' {} Maybe Text
a -> OperatingSystem
s {$sel:type':OperatingSystem' :: Maybe Text
type' = Maybe Text
a} :: OperatingSystem)

-- | A short name for the operating system manufacturer.
operatingSystem_reportedName :: Lens.Lens' OperatingSystem (Prelude.Maybe Prelude.Text)
operatingSystem_reportedName :: (Maybe Text -> f (Maybe Text))
-> OperatingSystem -> f OperatingSystem
operatingSystem_reportedName = (OperatingSystem -> Maybe Text)
-> (OperatingSystem -> Maybe Text -> OperatingSystem)
-> Lens OperatingSystem OperatingSystem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperatingSystem' {Maybe Text
reportedName :: Maybe Text
$sel:reportedName:OperatingSystem' :: OperatingSystem -> Maybe Text
reportedName} -> Maybe Text
reportedName) (\s :: OperatingSystem
s@OperatingSystem' {} Maybe Text
a -> OperatingSystem
s {$sel:reportedName:OperatingSystem' :: Maybe Text
reportedName = Maybe Text
a} :: OperatingSystem)

instance Core.FromJSON OperatingSystem where
  parseJSON :: Value -> Parser OperatingSystem
parseJSON =
    String
-> (Object -> Parser OperatingSystem)
-> Value
-> Parser OperatingSystem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OperatingSystem"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe [OperatingSystemConfigurationManager]
-> Maybe Text
-> Maybe Text
-> OperatingSystem
OperatingSystem'
            (Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe [OperatingSystemConfigurationManager]
 -> Maybe Text
 -> Maybe Text
 -> OperatingSystem)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe [OperatingSystemConfigurationManager]
      -> Maybe Text
      -> Maybe Text
      -> OperatingSystem)
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
"ReportedVersion")
            Parser
  (Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe [OperatingSystemConfigurationManager]
   -> Maybe Text
   -> Maybe Text
   -> OperatingSystem)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [OperatingSystemConfigurationManager]
      -> Maybe Text
      -> Maybe Text
      -> OperatingSystem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Supported")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe [OperatingSystemConfigurationManager]
   -> Maybe Text
   -> Maybe Text
   -> OperatingSystem)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [OperatingSystemConfigurationManager]
      -> Maybe Text
      -> Maybe Text
      -> OperatingSystem)
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
   -> Maybe [OperatingSystemConfigurationManager]
   -> Maybe Text
   -> Maybe Text
   -> OperatingSystem)
-> Parser (Maybe Text)
-> Parser
     (Maybe [OperatingSystemConfigurationManager]
      -> Maybe Text -> Maybe Text -> OperatingSystem)
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
"Id")
            Parser
  (Maybe [OperatingSystemConfigurationManager]
   -> Maybe Text -> Maybe Text -> OperatingSystem)
-> Parser (Maybe [OperatingSystemConfigurationManager])
-> Parser (Maybe Text -> Maybe Text -> OperatingSystem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Parser (Maybe (Maybe [OperatingSystemConfigurationManager]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConfigurationManagers"
                            Parser (Maybe (Maybe [OperatingSystemConfigurationManager]))
-> Maybe [OperatingSystemConfigurationManager]
-> Parser (Maybe [OperatingSystemConfigurationManager])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [OperatingSystemConfigurationManager]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> Maybe Text -> OperatingSystem)
-> Parser (Maybe Text) -> Parser (Maybe Text -> OperatingSystem)
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
"Type")
            Parser (Maybe Text -> OperatingSystem)
-> Parser (Maybe Text) -> Parser OperatingSystem
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
"ReportedName")
      )

instance Prelude.Hashable OperatingSystem

instance Prelude.NFData OperatingSystem