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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 optional name of a compatible image.
    CompatibleImage -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for an individual Snow device AMI.
    CompatibleImage -> Maybe Text
amiId :: Prelude.Maybe Prelude.Text
  }
  deriving (CompatibleImage -> CompatibleImage -> Bool
(CompatibleImage -> CompatibleImage -> Bool)
-> (CompatibleImage -> CompatibleImage -> Bool)
-> Eq CompatibleImage
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]
(Int -> ReadS CompatibleImage)
-> ReadS [CompatibleImage]
-> ReadPrec CompatibleImage
-> ReadPrec [CompatibleImage]
-> Read 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
(Int -> CompatibleImage -> ShowS)
-> (CompatibleImage -> String)
-> ([CompatibleImage] -> ShowS)
-> Show CompatibleImage
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. CompatibleImage -> Rep CompatibleImage x)
-> (forall x. Rep CompatibleImage x -> CompatibleImage)
-> Generic CompatibleImage
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:
--
-- 'name', 'compatibleImage_name' - The optional name of a compatible image.
--
-- 'amiId', 'compatibleImage_amiId' - The unique identifier for an individual Snow device AMI.
newCompatibleImage ::
  CompatibleImage
newCompatibleImage :: CompatibleImage
newCompatibleImage =
  CompatibleImage' :: Maybe Text -> Maybe Text -> CompatibleImage
CompatibleImage'
    { $sel:name:CompatibleImage' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:amiId:CompatibleImage' :: Maybe Text
amiId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The optional name of a compatible image.
compatibleImage_name :: Lens.Lens' CompatibleImage (Prelude.Maybe Prelude.Text)
compatibleImage_name :: (Maybe Text -> f (Maybe Text))
-> CompatibleImage -> f CompatibleImage
compatibleImage_name = (CompatibleImage -> Maybe Text)
-> (CompatibleImage -> Maybe Text -> CompatibleImage)
-> Lens CompatibleImage CompatibleImage (Maybe Text) (Maybe Text)
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)

-- | The unique identifier for an individual Snow device AMI.
compatibleImage_amiId :: Lens.Lens' CompatibleImage (Prelude.Maybe Prelude.Text)
compatibleImage_amiId :: (Maybe Text -> f (Maybe Text))
-> CompatibleImage -> f CompatibleImage
compatibleImage_amiId = (CompatibleImage -> Maybe Text)
-> (CompatibleImage -> Maybe Text -> CompatibleImage)
-> Lens CompatibleImage CompatibleImage (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable CompatibleImage

instance Prelude.NFData CompatibleImage