{-# 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.StorageGateway.Types.DeviceiSCSIAttributes
-- 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.StorageGateway.Types.DeviceiSCSIAttributes where

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

-- | Lists iSCSI information about a VTL device.
--
-- /See:/ 'newDeviceiSCSIAttributes' smart constructor.
data DeviceiSCSIAttributes = DeviceiSCSIAttributes'
  { -- | Specifies the unique Amazon Resource Name (ARN) that encodes the iSCSI
    -- qualified name(iqn) of a tape drive or media changer target.
    DeviceiSCSIAttributes -> Maybe Text
targetARN :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether mutual CHAP is enabled for the iSCSI target.
    DeviceiSCSIAttributes -> Maybe Bool
chapEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The network interface identifier of the VTL device.
    DeviceiSCSIAttributes -> Maybe Text
networkInterfaceId :: Prelude.Maybe Prelude.Text,
    -- | The port used to communicate with iSCSI VTL device targets.
    DeviceiSCSIAttributes -> Maybe Int
networkInterfacePort :: Prelude.Maybe Prelude.Int
  }
  deriving (DeviceiSCSIAttributes -> DeviceiSCSIAttributes -> Bool
(DeviceiSCSIAttributes -> DeviceiSCSIAttributes -> Bool)
-> (DeviceiSCSIAttributes -> DeviceiSCSIAttributes -> Bool)
-> Eq DeviceiSCSIAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceiSCSIAttributes -> DeviceiSCSIAttributes -> Bool
$c/= :: DeviceiSCSIAttributes -> DeviceiSCSIAttributes -> Bool
== :: DeviceiSCSIAttributes -> DeviceiSCSIAttributes -> Bool
$c== :: DeviceiSCSIAttributes -> DeviceiSCSIAttributes -> Bool
Prelude.Eq, ReadPrec [DeviceiSCSIAttributes]
ReadPrec DeviceiSCSIAttributes
Int -> ReadS DeviceiSCSIAttributes
ReadS [DeviceiSCSIAttributes]
(Int -> ReadS DeviceiSCSIAttributes)
-> ReadS [DeviceiSCSIAttributes]
-> ReadPrec DeviceiSCSIAttributes
-> ReadPrec [DeviceiSCSIAttributes]
-> Read DeviceiSCSIAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceiSCSIAttributes]
$creadListPrec :: ReadPrec [DeviceiSCSIAttributes]
readPrec :: ReadPrec DeviceiSCSIAttributes
$creadPrec :: ReadPrec DeviceiSCSIAttributes
readList :: ReadS [DeviceiSCSIAttributes]
$creadList :: ReadS [DeviceiSCSIAttributes]
readsPrec :: Int -> ReadS DeviceiSCSIAttributes
$creadsPrec :: Int -> ReadS DeviceiSCSIAttributes
Prelude.Read, Int -> DeviceiSCSIAttributes -> ShowS
[DeviceiSCSIAttributes] -> ShowS
DeviceiSCSIAttributes -> String
(Int -> DeviceiSCSIAttributes -> ShowS)
-> (DeviceiSCSIAttributes -> String)
-> ([DeviceiSCSIAttributes] -> ShowS)
-> Show DeviceiSCSIAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceiSCSIAttributes] -> ShowS
$cshowList :: [DeviceiSCSIAttributes] -> ShowS
show :: DeviceiSCSIAttributes -> String
$cshow :: DeviceiSCSIAttributes -> String
showsPrec :: Int -> DeviceiSCSIAttributes -> ShowS
$cshowsPrec :: Int -> DeviceiSCSIAttributes -> ShowS
Prelude.Show, (forall x. DeviceiSCSIAttributes -> Rep DeviceiSCSIAttributes x)
-> (forall x. Rep DeviceiSCSIAttributes x -> DeviceiSCSIAttributes)
-> Generic DeviceiSCSIAttributes
forall x. Rep DeviceiSCSIAttributes x -> DeviceiSCSIAttributes
forall x. DeviceiSCSIAttributes -> Rep DeviceiSCSIAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeviceiSCSIAttributes x -> DeviceiSCSIAttributes
$cfrom :: forall x. DeviceiSCSIAttributes -> Rep DeviceiSCSIAttributes x
Prelude.Generic)

-- |
-- Create a value of 'DeviceiSCSIAttributes' 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:
--
-- 'targetARN', 'deviceiSCSIAttributes_targetARN' - Specifies the unique Amazon Resource Name (ARN) that encodes the iSCSI
-- qualified name(iqn) of a tape drive or media changer target.
--
-- 'chapEnabled', 'deviceiSCSIAttributes_chapEnabled' - Indicates whether mutual CHAP is enabled for the iSCSI target.
--
-- 'networkInterfaceId', 'deviceiSCSIAttributes_networkInterfaceId' - The network interface identifier of the VTL device.
--
-- 'networkInterfacePort', 'deviceiSCSIAttributes_networkInterfacePort' - The port used to communicate with iSCSI VTL device targets.
newDeviceiSCSIAttributes ::
  DeviceiSCSIAttributes
newDeviceiSCSIAttributes :: DeviceiSCSIAttributes
newDeviceiSCSIAttributes =
  DeviceiSCSIAttributes' :: Maybe Text
-> Maybe Bool -> Maybe Text -> Maybe Int -> DeviceiSCSIAttributes
DeviceiSCSIAttributes'
    { $sel:targetARN:DeviceiSCSIAttributes' :: Maybe Text
targetARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:chapEnabled:DeviceiSCSIAttributes' :: Maybe Bool
chapEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:networkInterfaceId:DeviceiSCSIAttributes' :: Maybe Text
networkInterfaceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:networkInterfacePort:DeviceiSCSIAttributes' :: Maybe Int
networkInterfacePort = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the unique Amazon Resource Name (ARN) that encodes the iSCSI
-- qualified name(iqn) of a tape drive or media changer target.
deviceiSCSIAttributes_targetARN :: Lens.Lens' DeviceiSCSIAttributes (Prelude.Maybe Prelude.Text)
deviceiSCSIAttributes_targetARN :: (Maybe Text -> f (Maybe Text))
-> DeviceiSCSIAttributes -> f DeviceiSCSIAttributes
deviceiSCSIAttributes_targetARN = (DeviceiSCSIAttributes -> Maybe Text)
-> (DeviceiSCSIAttributes -> Maybe Text -> DeviceiSCSIAttributes)
-> Lens
     DeviceiSCSIAttributes
     DeviceiSCSIAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceiSCSIAttributes' {Maybe Text
targetARN :: Maybe Text
$sel:targetARN:DeviceiSCSIAttributes' :: DeviceiSCSIAttributes -> Maybe Text
targetARN} -> Maybe Text
targetARN) (\s :: DeviceiSCSIAttributes
s@DeviceiSCSIAttributes' {} Maybe Text
a -> DeviceiSCSIAttributes
s {$sel:targetARN:DeviceiSCSIAttributes' :: Maybe Text
targetARN = Maybe Text
a} :: DeviceiSCSIAttributes)

-- | Indicates whether mutual CHAP is enabled for the iSCSI target.
deviceiSCSIAttributes_chapEnabled :: Lens.Lens' DeviceiSCSIAttributes (Prelude.Maybe Prelude.Bool)
deviceiSCSIAttributes_chapEnabled :: (Maybe Bool -> f (Maybe Bool))
-> DeviceiSCSIAttributes -> f DeviceiSCSIAttributes
deviceiSCSIAttributes_chapEnabled = (DeviceiSCSIAttributes -> Maybe Bool)
-> (DeviceiSCSIAttributes -> Maybe Bool -> DeviceiSCSIAttributes)
-> Lens
     DeviceiSCSIAttributes
     DeviceiSCSIAttributes
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceiSCSIAttributes' {Maybe Bool
chapEnabled :: Maybe Bool
$sel:chapEnabled:DeviceiSCSIAttributes' :: DeviceiSCSIAttributes -> Maybe Bool
chapEnabled} -> Maybe Bool
chapEnabled) (\s :: DeviceiSCSIAttributes
s@DeviceiSCSIAttributes' {} Maybe Bool
a -> DeviceiSCSIAttributes
s {$sel:chapEnabled:DeviceiSCSIAttributes' :: Maybe Bool
chapEnabled = Maybe Bool
a} :: DeviceiSCSIAttributes)

-- | The network interface identifier of the VTL device.
deviceiSCSIAttributes_networkInterfaceId :: Lens.Lens' DeviceiSCSIAttributes (Prelude.Maybe Prelude.Text)
deviceiSCSIAttributes_networkInterfaceId :: (Maybe Text -> f (Maybe Text))
-> DeviceiSCSIAttributes -> f DeviceiSCSIAttributes
deviceiSCSIAttributes_networkInterfaceId = (DeviceiSCSIAttributes -> Maybe Text)
-> (DeviceiSCSIAttributes -> Maybe Text -> DeviceiSCSIAttributes)
-> Lens
     DeviceiSCSIAttributes
     DeviceiSCSIAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceiSCSIAttributes' {Maybe Text
networkInterfaceId :: Maybe Text
$sel:networkInterfaceId:DeviceiSCSIAttributes' :: DeviceiSCSIAttributes -> Maybe Text
networkInterfaceId} -> Maybe Text
networkInterfaceId) (\s :: DeviceiSCSIAttributes
s@DeviceiSCSIAttributes' {} Maybe Text
a -> DeviceiSCSIAttributes
s {$sel:networkInterfaceId:DeviceiSCSIAttributes' :: Maybe Text
networkInterfaceId = Maybe Text
a} :: DeviceiSCSIAttributes)

-- | The port used to communicate with iSCSI VTL device targets.
deviceiSCSIAttributes_networkInterfacePort :: Lens.Lens' DeviceiSCSIAttributes (Prelude.Maybe Prelude.Int)
deviceiSCSIAttributes_networkInterfacePort :: (Maybe Int -> f (Maybe Int))
-> DeviceiSCSIAttributes -> f DeviceiSCSIAttributes
deviceiSCSIAttributes_networkInterfacePort = (DeviceiSCSIAttributes -> Maybe Int)
-> (DeviceiSCSIAttributes -> Maybe Int -> DeviceiSCSIAttributes)
-> Lens
     DeviceiSCSIAttributes DeviceiSCSIAttributes (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceiSCSIAttributes' {Maybe Int
networkInterfacePort :: Maybe Int
$sel:networkInterfacePort:DeviceiSCSIAttributes' :: DeviceiSCSIAttributes -> Maybe Int
networkInterfacePort} -> Maybe Int
networkInterfacePort) (\s :: DeviceiSCSIAttributes
s@DeviceiSCSIAttributes' {} Maybe Int
a -> DeviceiSCSIAttributes
s {$sel:networkInterfacePort:DeviceiSCSIAttributes' :: Maybe Int
networkInterfacePort = Maybe Int
a} :: DeviceiSCSIAttributes)

instance Core.FromJSON DeviceiSCSIAttributes where
  parseJSON :: Value -> Parser DeviceiSCSIAttributes
parseJSON =
    String
-> (Object -> Parser DeviceiSCSIAttributes)
-> Value
-> Parser DeviceiSCSIAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeviceiSCSIAttributes"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool -> Maybe Text -> Maybe Int -> DeviceiSCSIAttributes
DeviceiSCSIAttributes'
            (Maybe Text
 -> Maybe Bool -> Maybe Text -> Maybe Int -> DeviceiSCSIAttributes)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool -> Maybe Text -> Maybe Int -> DeviceiSCSIAttributes)
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
"TargetARN")
            Parser
  (Maybe Bool -> Maybe Text -> Maybe Int -> DeviceiSCSIAttributes)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe Int -> DeviceiSCSIAttributes)
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
"ChapEnabled")
            Parser (Maybe Text -> Maybe Int -> DeviceiSCSIAttributes)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> DeviceiSCSIAttributes)
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
"NetworkInterfaceId")
            Parser (Maybe Int -> DeviceiSCSIAttributes)
-> Parser (Maybe Int) -> Parser DeviceiSCSIAttributes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NetworkInterfacePort")
      )

instance Prelude.Hashable DeviceiSCSIAttributes

instance Prelude.NFData DeviceiSCSIAttributes