{-# 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.CompatibleImage
-- 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.Snowball.Types.CompatibleImage where

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

-- | A JSON-formatted object that describes a compatible Amazon Machine Image
-- (AMI), including the ID and name for a Snow device AMI. This AMI is
-- compatible with the device\'s physical hardware requirements, and it
-- should be able to be run in an SBE1 instance on the device.
--
-- /See:/ 'newCompatibleImage' smart constructor.
data CompatibleImage = CompatibleImage'
  { -- | The unique identifier for an individual Snow device AMI.
    CompatibleImage -> Maybe Text
amiId :: Prelude.Maybe Prelude.Text,
    -- | The optional name of a compatible image.
    CompatibleImage -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (CompatibleImage -> CompatibleImage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompatibleImage -> CompatibleImage -> Bool
$c/= :: CompatibleImage -> CompatibleImage -> Bool
== :: CompatibleImage -> CompatibleImage -> Bool
$c== :: CompatibleImage -> CompatibleImage -> Bool
Prelude.Eq, ReadPrec [CompatibleImage]
ReadPrec CompatibleImage
Int -> ReadS CompatibleImage
ReadS [CompatibleImage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CompatibleImage]
$creadListPrec :: ReadPrec [CompatibleImage]
readPrec :: ReadPrec CompatibleImage
$creadPrec :: ReadPrec CompatibleImage
readList :: ReadS [CompatibleImage]
$creadList :: ReadS [CompatibleImage]
readsPrec :: Int -> ReadS CompatibleImage
$creadsPrec :: Int -> ReadS CompatibleImage
Prelude.Read, Int -> CompatibleImage -> ShowS
[CompatibleImage] -> ShowS
CompatibleImage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompatibleImage] -> ShowS
$cshowList :: [CompatibleImage] -> ShowS
show :: CompatibleImage -> String
$cshow :: CompatibleImage -> String
showsPrec :: Int -> CompatibleImage -> ShowS
$cshowsPrec :: Int -> CompatibleImage -> ShowS
Prelude.Show, forall x. Rep CompatibleImage x -> CompatibleImage
forall x. CompatibleImage -> Rep CompatibleImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CompatibleImage x -> CompatibleImage
$cfrom :: forall x. CompatibleImage -> Rep CompatibleImage x
Prelude.Generic)

-- |
-- Create a value of 'CompatibleImage' 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:
--
-- 'amiId', 'compatibleImage_amiId' - The unique identifier for an individual Snow device AMI.
--
-- 'name', 'compatibleImage_name' - The optional name of a compatible image.
newCompatibleImage ::
  CompatibleImage
newCompatibleImage :: CompatibleImage
newCompatibleImage =
  CompatibleImage'
    { $sel:amiId:CompatibleImage' :: Maybe Text
amiId = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CompatibleImage' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | The unique identifier for an individual Snow device AMI.
compatibleImage_amiId :: Lens.Lens' CompatibleImage (Prelude.Maybe Prelude.Text)
compatibleImage_amiId :: Lens' CompatibleImage (Maybe Text)
compatibleImage_amiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompatibleImage' {Maybe Text
amiId :: Maybe Text
$sel:amiId:CompatibleImage' :: CompatibleImage -> Maybe Text
amiId} -> Maybe Text
amiId) (\s :: CompatibleImage
s@CompatibleImage' {} Maybe Text
a -> CompatibleImage
s {$sel:amiId:CompatibleImage' :: Maybe Text
amiId = Maybe Text
a} :: CompatibleImage)

-- | The optional name of a compatible image.
compatibleImage_name :: Lens.Lens' CompatibleImage (Prelude.Maybe Prelude.Text)
compatibleImage_name :: Lens' CompatibleImage (Maybe Text)
compatibleImage_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompatibleImage' {Maybe Text
name :: Maybe Text
$sel:name:CompatibleImage' :: CompatibleImage -> Maybe Text
name} -> Maybe Text
name) (\s :: CompatibleImage
s@CompatibleImage' {} Maybe Text
a -> CompatibleImage
s {$sel:name:CompatibleImage' :: Maybe Text
name = Maybe Text
a} :: CompatibleImage)

instance Data.FromJSON CompatibleImage where
  parseJSON :: Value -> Parser CompatibleImage
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CompatibleImage"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> CompatibleImage
CompatibleImage'
            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
"AmiId")
            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
"Name")
      )

instance Prelude.Hashable CompatibleImage where
  hashWithSalt :: Int -> CompatibleImage -> Int
hashWithSalt Int
_salt CompatibleImage' {Maybe Text
name :: Maybe Text
amiId :: Maybe Text
$sel:name:CompatibleImage' :: CompatibleImage -> Maybe Text
$sel:amiId:CompatibleImage' :: CompatibleImage -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
amiId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name

instance Prelude.NFData CompatibleImage where
  rnf :: CompatibleImage -> ()
rnf CompatibleImage' {Maybe Text
name :: Maybe Text
amiId :: Maybe Text
$sel:name:CompatibleImage' :: CompatibleImage -> Maybe Text
$sel:amiId:CompatibleImage' :: CompatibleImage -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
amiId seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name