{-# 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.EC2.Types.PciId
-- 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.EC2.Types.PciId where

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

-- | Describes the data that identifies an Amazon FPGA image (AFI) on the PCI
-- bus.
--
-- /See:/ 'newPciId' smart constructor.
data PciId = PciId'
  { -- | The ID of the device.
    PciId -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the subsystem.
    PciId -> Maybe Text
subsystemId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the vendor for the subsystem.
    PciId -> Maybe Text
subsystemVendorId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the vendor.
    PciId -> Maybe Text
vendorId :: Prelude.Maybe Prelude.Text
  }
  deriving (PciId -> PciId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PciId -> PciId -> Bool
$c/= :: PciId -> PciId -> Bool
== :: PciId -> PciId -> Bool
$c== :: PciId -> PciId -> Bool
Prelude.Eq, ReadPrec [PciId]
ReadPrec PciId
Int -> ReadS PciId
ReadS [PciId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PciId]
$creadListPrec :: ReadPrec [PciId]
readPrec :: ReadPrec PciId
$creadPrec :: ReadPrec PciId
readList :: ReadS [PciId]
$creadList :: ReadS [PciId]
readsPrec :: Int -> ReadS PciId
$creadsPrec :: Int -> ReadS PciId
Prelude.Read, Int -> PciId -> ShowS
[PciId] -> ShowS
PciId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PciId] -> ShowS
$cshowList :: [PciId] -> ShowS
show :: PciId -> String
$cshow :: PciId -> String
showsPrec :: Int -> PciId -> ShowS
$cshowsPrec :: Int -> PciId -> ShowS
Prelude.Show, forall x. Rep PciId x -> PciId
forall x. PciId -> Rep PciId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PciId x -> PciId
$cfrom :: forall x. PciId -> Rep PciId x
Prelude.Generic)

-- |
-- Create a value of 'PciId' 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:
--
-- 'deviceId', 'pciId_deviceId' - The ID of the device.
--
-- 'subsystemId', 'pciId_subsystemId' - The ID of the subsystem.
--
-- 'subsystemVendorId', 'pciId_subsystemVendorId' - The ID of the vendor for the subsystem.
--
-- 'vendorId', 'pciId_vendorId' - The ID of the vendor.
newPciId ::
  PciId
newPciId :: PciId
newPciId =
  PciId'
    { $sel:deviceId:PciId' :: Maybe Text
deviceId = forall a. Maybe a
Prelude.Nothing,
      $sel:subsystemId:PciId' :: Maybe Text
subsystemId = forall a. Maybe a
Prelude.Nothing,
      $sel:subsystemVendorId:PciId' :: Maybe Text
subsystemVendorId = forall a. Maybe a
Prelude.Nothing,
      $sel:vendorId:PciId' :: Maybe Text
vendorId = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the device.
pciId_deviceId :: Lens.Lens' PciId (Prelude.Maybe Prelude.Text)
pciId_deviceId :: Lens' PciId (Maybe Text)
pciId_deviceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PciId' {Maybe Text
deviceId :: Maybe Text
$sel:deviceId:PciId' :: PciId -> Maybe Text
deviceId} -> Maybe Text
deviceId) (\s :: PciId
s@PciId' {} Maybe Text
a -> PciId
s {$sel:deviceId:PciId' :: Maybe Text
deviceId = Maybe Text
a} :: PciId)

-- | The ID of the subsystem.
pciId_subsystemId :: Lens.Lens' PciId (Prelude.Maybe Prelude.Text)
pciId_subsystemId :: Lens' PciId (Maybe Text)
pciId_subsystemId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PciId' {Maybe Text
subsystemId :: Maybe Text
$sel:subsystemId:PciId' :: PciId -> Maybe Text
subsystemId} -> Maybe Text
subsystemId) (\s :: PciId
s@PciId' {} Maybe Text
a -> PciId
s {$sel:subsystemId:PciId' :: Maybe Text
subsystemId = Maybe Text
a} :: PciId)

-- | The ID of the vendor for the subsystem.
pciId_subsystemVendorId :: Lens.Lens' PciId (Prelude.Maybe Prelude.Text)
pciId_subsystemVendorId :: Lens' PciId (Maybe Text)
pciId_subsystemVendorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PciId' {Maybe Text
subsystemVendorId :: Maybe Text
$sel:subsystemVendorId:PciId' :: PciId -> Maybe Text
subsystemVendorId} -> Maybe Text
subsystemVendorId) (\s :: PciId
s@PciId' {} Maybe Text
a -> PciId
s {$sel:subsystemVendorId:PciId' :: Maybe Text
subsystemVendorId = Maybe Text
a} :: PciId)

-- | The ID of the vendor.
pciId_vendorId :: Lens.Lens' PciId (Prelude.Maybe Prelude.Text)
pciId_vendorId :: Lens' PciId (Maybe Text)
pciId_vendorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PciId' {Maybe Text
vendorId :: Maybe Text
$sel:vendorId:PciId' :: PciId -> Maybe Text
vendorId} -> Maybe Text
vendorId) (\s :: PciId
s@PciId' {} Maybe Text
a -> PciId
s {$sel:vendorId:PciId' :: Maybe Text
vendorId = Maybe Text
a} :: PciId)

instance Data.FromXML PciId where
  parseXML :: [Node] -> Either String PciId
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> PciId
PciId'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DeviceId")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SubsystemId")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SubsystemVendorId")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"VendorId")

instance Prelude.Hashable PciId where
  hashWithSalt :: Int -> PciId -> Int
hashWithSalt Int
_salt PciId' {Maybe Text
vendorId :: Maybe Text
subsystemVendorId :: Maybe Text
subsystemId :: Maybe Text
deviceId :: Maybe Text
$sel:vendorId:PciId' :: PciId -> Maybe Text
$sel:subsystemVendorId:PciId' :: PciId -> Maybe Text
$sel:subsystemId:PciId' :: PciId -> Maybe Text
$sel:deviceId:PciId' :: PciId -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deviceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subsystemId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subsystemVendorId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vendorId

instance Prelude.NFData PciId where
  rnf :: PciId -> ()
rnf PciId' {Maybe Text
vendorId :: Maybe Text
subsystemVendorId :: Maybe Text
subsystemId :: Maybe Text
deviceId :: Maybe Text
$sel:vendorId:PciId' :: PciId -> Maybe Text
$sel:subsystemVendorId:PciId' :: PciId -> Maybe Text
$sel:subsystemId:PciId' :: PciId -> Maybe Text
$sel:deviceId:PciId' :: PciId -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deviceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subsystemId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subsystemVendorId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vendorId