{-# 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.OAM.Types.ListAttachedLinksItem
-- 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.OAM.Types.ListAttachedLinksItem 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 structure that contains information about one link attached to this
-- monitoring account sink.
--
-- /See:/ 'newListAttachedLinksItem' smart constructor.
data ListAttachedLinksItem = ListAttachedLinksItem'
  { -- | The label that was assigned to this link at creation, with the variables
    -- resolved to their actual values.
    ListAttachedLinksItem -> Maybe Text
label :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the link.
    ListAttachedLinksItem -> Maybe Text
linkArn :: Prelude.Maybe Prelude.Text,
    -- | The resource types supported by this link.
    ListAttachedLinksItem -> Maybe [Text]
resourceTypes :: Prelude.Maybe [Prelude.Text]
  }
  deriving (ListAttachedLinksItem -> ListAttachedLinksItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAttachedLinksItem -> ListAttachedLinksItem -> Bool
$c/= :: ListAttachedLinksItem -> ListAttachedLinksItem -> Bool
== :: ListAttachedLinksItem -> ListAttachedLinksItem -> Bool
$c== :: ListAttachedLinksItem -> ListAttachedLinksItem -> Bool
Prelude.Eq, ReadPrec [ListAttachedLinksItem]
ReadPrec ListAttachedLinksItem
Int -> ReadS ListAttachedLinksItem
ReadS [ListAttachedLinksItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAttachedLinksItem]
$creadListPrec :: ReadPrec [ListAttachedLinksItem]
readPrec :: ReadPrec ListAttachedLinksItem
$creadPrec :: ReadPrec ListAttachedLinksItem
readList :: ReadS [ListAttachedLinksItem]
$creadList :: ReadS [ListAttachedLinksItem]
readsPrec :: Int -> ReadS ListAttachedLinksItem
$creadsPrec :: Int -> ReadS ListAttachedLinksItem
Prelude.Read, Int -> ListAttachedLinksItem -> ShowS
[ListAttachedLinksItem] -> ShowS
ListAttachedLinksItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAttachedLinksItem] -> ShowS
$cshowList :: [ListAttachedLinksItem] -> ShowS
show :: ListAttachedLinksItem -> String
$cshow :: ListAttachedLinksItem -> String
showsPrec :: Int -> ListAttachedLinksItem -> ShowS
$cshowsPrec :: Int -> ListAttachedLinksItem -> ShowS
Prelude.Show, forall x. Rep ListAttachedLinksItem x -> ListAttachedLinksItem
forall x. ListAttachedLinksItem -> Rep ListAttachedLinksItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAttachedLinksItem x -> ListAttachedLinksItem
$cfrom :: forall x. ListAttachedLinksItem -> Rep ListAttachedLinksItem x
Prelude.Generic)

-- |
-- Create a value of 'ListAttachedLinksItem' 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:
--
-- 'label', 'listAttachedLinksItem_label' - The label that was assigned to this link at creation, with the variables
-- resolved to their actual values.
--
-- 'linkArn', 'listAttachedLinksItem_linkArn' - The ARN of the link.
--
-- 'resourceTypes', 'listAttachedLinksItem_resourceTypes' - The resource types supported by this link.
newListAttachedLinksItem ::
  ListAttachedLinksItem
newListAttachedLinksItem :: ListAttachedLinksItem
newListAttachedLinksItem =
  ListAttachedLinksItem'
    { $sel:label:ListAttachedLinksItem' :: Maybe Text
label = forall a. Maybe a
Prelude.Nothing,
      $sel:linkArn:ListAttachedLinksItem' :: Maybe Text
linkArn = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceTypes:ListAttachedLinksItem' :: Maybe [Text]
resourceTypes = forall a. Maybe a
Prelude.Nothing
    }

-- | The label that was assigned to this link at creation, with the variables
-- resolved to their actual values.
listAttachedLinksItem_label :: Lens.Lens' ListAttachedLinksItem (Prelude.Maybe Prelude.Text)
listAttachedLinksItem_label :: Lens' ListAttachedLinksItem (Maybe Text)
listAttachedLinksItem_label = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttachedLinksItem' {Maybe Text
label :: Maybe Text
$sel:label:ListAttachedLinksItem' :: ListAttachedLinksItem -> Maybe Text
label} -> Maybe Text
label) (\s :: ListAttachedLinksItem
s@ListAttachedLinksItem' {} Maybe Text
a -> ListAttachedLinksItem
s {$sel:label:ListAttachedLinksItem' :: Maybe Text
label = Maybe Text
a} :: ListAttachedLinksItem)

-- | The ARN of the link.
listAttachedLinksItem_linkArn :: Lens.Lens' ListAttachedLinksItem (Prelude.Maybe Prelude.Text)
listAttachedLinksItem_linkArn :: Lens' ListAttachedLinksItem (Maybe Text)
listAttachedLinksItem_linkArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttachedLinksItem' {Maybe Text
linkArn :: Maybe Text
$sel:linkArn:ListAttachedLinksItem' :: ListAttachedLinksItem -> Maybe Text
linkArn} -> Maybe Text
linkArn) (\s :: ListAttachedLinksItem
s@ListAttachedLinksItem' {} Maybe Text
a -> ListAttachedLinksItem
s {$sel:linkArn:ListAttachedLinksItem' :: Maybe Text
linkArn = Maybe Text
a} :: ListAttachedLinksItem)

-- | The resource types supported by this link.
listAttachedLinksItem_resourceTypes :: Lens.Lens' ListAttachedLinksItem (Prelude.Maybe [Prelude.Text])
listAttachedLinksItem_resourceTypes :: Lens' ListAttachedLinksItem (Maybe [Text])
listAttachedLinksItem_resourceTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttachedLinksItem' {Maybe [Text]
resourceTypes :: Maybe [Text]
$sel:resourceTypes:ListAttachedLinksItem' :: ListAttachedLinksItem -> Maybe [Text]
resourceTypes} -> Maybe [Text]
resourceTypes) (\s :: ListAttachedLinksItem
s@ListAttachedLinksItem' {} Maybe [Text]
a -> ListAttachedLinksItem
s {$sel:resourceTypes:ListAttachedLinksItem' :: Maybe [Text]
resourceTypes = Maybe [Text]
a} :: ListAttachedLinksItem) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON ListAttachedLinksItem where
  parseJSON :: Value -> Parser ListAttachedLinksItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ListAttachedLinksItem"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe [Text] -> ListAttachedLinksItem
ListAttachedLinksItem'
            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
"Label")
            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
"LinkArn")
            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
"ResourceTypes" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ListAttachedLinksItem where
  hashWithSalt :: Int -> ListAttachedLinksItem -> Int
hashWithSalt Int
_salt ListAttachedLinksItem' {Maybe [Text]
Maybe Text
resourceTypes :: Maybe [Text]
linkArn :: Maybe Text
label :: Maybe Text
$sel:resourceTypes:ListAttachedLinksItem' :: ListAttachedLinksItem -> Maybe [Text]
$sel:linkArn:ListAttachedLinksItem' :: ListAttachedLinksItem -> Maybe Text
$sel:label:ListAttachedLinksItem' :: ListAttachedLinksItem -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
label
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
linkArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
resourceTypes

instance Prelude.NFData ListAttachedLinksItem where
  rnf :: ListAttachedLinksItem -> ()
rnf ListAttachedLinksItem' {Maybe [Text]
Maybe Text
resourceTypes :: Maybe [Text]
linkArn :: Maybe Text
label :: Maybe Text
$sel:resourceTypes:ListAttachedLinksItem' :: ListAttachedLinksItem -> Maybe [Text]
$sel:linkArn:ListAttachedLinksItem' :: ListAttachedLinksItem -> Maybe Text
$sel:label:ListAttachedLinksItem' :: ListAttachedLinksItem -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
label
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
linkArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
resourceTypes