{-# 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.ImageBuilder.Types.Ami
-- 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.ImageBuilder.Types.Ami where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ImageBuilder.Types.ImageState
import qualified Amazonka.Prelude as Prelude

-- | Details of an Amazon EC2 AMI.
--
-- /See:/ 'newAmi' smart constructor.
data Ami = Ami'
  { -- | The account ID of the owner of the AMI.
    Ami -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The description of the Amazon EC2 AMI. Minimum and maximum length are in
    -- characters.
    Ami -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The AMI ID of the Amazon EC2 AMI.
    Ami -> Maybe Text
image :: Prelude.Maybe Prelude.Text,
    -- | The name of the Amazon EC2 AMI.
    Ami -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services Region of the Amazon EC2 AMI.
    Ami -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
    Ami -> Maybe ImageState
state :: Prelude.Maybe ImageState
  }
  deriving (Ami -> Ami -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Ami -> Ami -> Bool
$c/= :: Ami -> Ami -> Bool
== :: Ami -> Ami -> Bool
$c== :: Ami -> Ami -> Bool
Prelude.Eq, ReadPrec [Ami]
ReadPrec Ami
Int -> ReadS Ami
ReadS [Ami]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Ami]
$creadListPrec :: ReadPrec [Ami]
readPrec :: ReadPrec Ami
$creadPrec :: ReadPrec Ami
readList :: ReadS [Ami]
$creadList :: ReadS [Ami]
readsPrec :: Int -> ReadS Ami
$creadsPrec :: Int -> ReadS Ami
Prelude.Read, Int -> Ami -> ShowS
[Ami] -> ShowS
Ami -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Ami] -> ShowS
$cshowList :: [Ami] -> ShowS
show :: Ami -> String
$cshow :: Ami -> String
showsPrec :: Int -> Ami -> ShowS
$cshowsPrec :: Int -> Ami -> ShowS
Prelude.Show, forall x. Rep Ami x -> Ami
forall x. Ami -> Rep Ami x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Ami x -> Ami
$cfrom :: forall x. Ami -> Rep Ami x
Prelude.Generic)

-- |
-- Create a value of 'Ami' 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:
--
-- 'accountId', 'ami_accountId' - The account ID of the owner of the AMI.
--
-- 'description', 'ami_description' - The description of the Amazon EC2 AMI. Minimum and maximum length are in
-- characters.
--
-- 'image', 'ami_image' - The AMI ID of the Amazon EC2 AMI.
--
-- 'name', 'ami_name' - The name of the Amazon EC2 AMI.
--
-- 'region', 'ami_region' - The Amazon Web Services Region of the Amazon EC2 AMI.
--
-- 'state', 'ami_state' - Undocumented member.
newAmi ::
  Ami
newAmi :: Ami
newAmi =
  Ami'
    { $sel:accountId:Ami' :: Maybe Text
accountId = forall a. Maybe a
Prelude.Nothing,
      $sel:description:Ami' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:image:Ami' :: Maybe Text
image = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Ami' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:region:Ami' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing,
      $sel:state:Ami' :: Maybe ImageState
state = forall a. Maybe a
Prelude.Nothing
    }

-- | The account ID of the owner of the AMI.
ami_accountId :: Lens.Lens' Ami (Prelude.Maybe Prelude.Text)
ami_accountId :: Lens' Ami (Maybe Text)
ami_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ami' {Maybe Text
accountId :: Maybe Text
$sel:accountId:Ami' :: Ami -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: Ami
s@Ami' {} Maybe Text
a -> Ami
s {$sel:accountId:Ami' :: Maybe Text
accountId = Maybe Text
a} :: Ami)

-- | The description of the Amazon EC2 AMI. Minimum and maximum length are in
-- characters.
ami_description :: Lens.Lens' Ami (Prelude.Maybe Prelude.Text)
ami_description :: Lens' Ami (Maybe Text)
ami_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ami' {Maybe Text
description :: Maybe Text
$sel:description:Ami' :: Ami -> Maybe Text
description} -> Maybe Text
description) (\s :: Ami
s@Ami' {} Maybe Text
a -> Ami
s {$sel:description:Ami' :: Maybe Text
description = Maybe Text
a} :: Ami)

-- | The AMI ID of the Amazon EC2 AMI.
ami_image :: Lens.Lens' Ami (Prelude.Maybe Prelude.Text)
ami_image :: Lens' Ami (Maybe Text)
ami_image = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ami' {Maybe Text
image :: Maybe Text
$sel:image:Ami' :: Ami -> Maybe Text
image} -> Maybe Text
image) (\s :: Ami
s@Ami' {} Maybe Text
a -> Ami
s {$sel:image:Ami' :: Maybe Text
image = Maybe Text
a} :: Ami)

-- | The name of the Amazon EC2 AMI.
ami_name :: Lens.Lens' Ami (Prelude.Maybe Prelude.Text)
ami_name :: Lens' Ami (Maybe Text)
ami_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ami' {Maybe Text
name :: Maybe Text
$sel:name:Ami' :: Ami -> Maybe Text
name} -> Maybe Text
name) (\s :: Ami
s@Ami' {} Maybe Text
a -> Ami
s {$sel:name:Ami' :: Maybe Text
name = Maybe Text
a} :: Ami)

-- | The Amazon Web Services Region of the Amazon EC2 AMI.
ami_region :: Lens.Lens' Ami (Prelude.Maybe Prelude.Text)
ami_region :: Lens' Ami (Maybe Text)
ami_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ami' {Maybe Text
region :: Maybe Text
$sel:region:Ami' :: Ami -> Maybe Text
region} -> Maybe Text
region) (\s :: Ami
s@Ami' {} Maybe Text
a -> Ami
s {$sel:region:Ami' :: Maybe Text
region = Maybe Text
a} :: Ami)

-- | Undocumented member.
ami_state :: Lens.Lens' Ami (Prelude.Maybe ImageState)
ami_state :: Lens' Ami (Maybe ImageState)
ami_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Ami' {Maybe ImageState
state :: Maybe ImageState
$sel:state:Ami' :: Ami -> Maybe ImageState
state} -> Maybe ImageState
state) (\s :: Ami
s@Ami' {} Maybe ImageState
a -> Ami
s {$sel:state:Ami' :: Maybe ImageState
state = Maybe ImageState
a} :: Ami)

instance Data.FromJSON Ami where
  parseJSON :: Value -> Parser Ami
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Ami"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ImageState
-> Ami
Ami'
            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
"accountId")
            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
"description")
            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
"image")
            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")
            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
"region")
            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
"state")
      )

instance Prelude.Hashable Ami where
  hashWithSalt :: Int -> Ami -> Int
hashWithSalt Int
_salt Ami' {Maybe Text
Maybe ImageState
state :: Maybe ImageState
region :: Maybe Text
name :: Maybe Text
image :: Maybe Text
description :: Maybe Text
accountId :: Maybe Text
$sel:state:Ami' :: Ami -> Maybe ImageState
$sel:region:Ami' :: Ami -> Maybe Text
$sel:name:Ami' :: Ami -> Maybe Text
$sel:image:Ami' :: Ami -> Maybe Text
$sel:description:Ami' :: Ami -> Maybe Text
$sel:accountId:Ami' :: Ami -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
image
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ImageState
state

instance Prelude.NFData Ami where
  rnf :: Ami -> ()
rnf Ami' {Maybe Text
Maybe ImageState
state :: Maybe ImageState
region :: Maybe Text
name :: Maybe Text
image :: Maybe Text
description :: Maybe Text
accountId :: Maybe Text
$sel:state:Ami' :: Ami -> Maybe ImageState
$sel:region:Ami' :: Ami -> Maybe Text
$sel:name:Ami' :: Ami -> Maybe Text
$sel:image:Ami' :: Ami -> Maybe Text
$sel:description:Ami' :: Ami -> Maybe Text
$sel:accountId:Ami' :: Ami -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
image
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ImageState
state