{-# 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.ListLinksItem
-- 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.ListLinksItem 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 of this source
-- account\'s links to a monitoring account.
--
-- /See:/ 'newListLinksItem' smart constructor.
data ListLinksItem = ListLinksItem'
  { -- | The ARN of the link.
    ListLinksItem -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The random ID string that Amazon Web Services generated as part of the
    -- link ARN.
    ListLinksItem -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The label that was assigned to this link at creation, with the variables
    -- resolved to their actual values.
    ListLinksItem -> Maybe Text
label :: Prelude.Maybe Prelude.Text,
    -- | The resource types supported by this link.
    ListLinksItem -> Maybe [Text]
resourceTypes :: Prelude.Maybe [Prelude.Text],
    -- | The ARN of the sink that this link is attached to.
    ListLinksItem -> Maybe Text
sinkArn :: Prelude.Maybe Prelude.Text
  }
  deriving (ListLinksItem -> ListLinksItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLinksItem -> ListLinksItem -> Bool
$c/= :: ListLinksItem -> ListLinksItem -> Bool
== :: ListLinksItem -> ListLinksItem -> Bool
$c== :: ListLinksItem -> ListLinksItem -> Bool
Prelude.Eq, ReadPrec [ListLinksItem]
ReadPrec ListLinksItem
Int -> ReadS ListLinksItem
ReadS [ListLinksItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLinksItem]
$creadListPrec :: ReadPrec [ListLinksItem]
readPrec :: ReadPrec ListLinksItem
$creadPrec :: ReadPrec ListLinksItem
readList :: ReadS [ListLinksItem]
$creadList :: ReadS [ListLinksItem]
readsPrec :: Int -> ReadS ListLinksItem
$creadsPrec :: Int -> ReadS ListLinksItem
Prelude.Read, Int -> ListLinksItem -> ShowS
[ListLinksItem] -> ShowS
ListLinksItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLinksItem] -> ShowS
$cshowList :: [ListLinksItem] -> ShowS
show :: ListLinksItem -> String
$cshow :: ListLinksItem -> String
showsPrec :: Int -> ListLinksItem -> ShowS
$cshowsPrec :: Int -> ListLinksItem -> ShowS
Prelude.Show, forall x. Rep ListLinksItem x -> ListLinksItem
forall x. ListLinksItem -> Rep ListLinksItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListLinksItem x -> ListLinksItem
$cfrom :: forall x. ListLinksItem -> Rep ListLinksItem x
Prelude.Generic)

-- |
-- Create a value of 'ListLinksItem' 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:
--
-- 'arn', 'listLinksItem_arn' - The ARN of the link.
--
-- 'id', 'listLinksItem_id' - The random ID string that Amazon Web Services generated as part of the
-- link ARN.
--
-- 'label', 'listLinksItem_label' - The label that was assigned to this link at creation, with the variables
-- resolved to their actual values.
--
-- 'resourceTypes', 'listLinksItem_resourceTypes' - The resource types supported by this link.
--
-- 'sinkArn', 'listLinksItem_sinkArn' - The ARN of the sink that this link is attached to.
newListLinksItem ::
  ListLinksItem
newListLinksItem :: ListLinksItem
newListLinksItem =
  ListLinksItem'
    { $sel:arn:ListLinksItem' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:id:ListLinksItem' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:label:ListLinksItem' :: Maybe Text
label = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceTypes:ListLinksItem' :: Maybe [Text]
resourceTypes = forall a. Maybe a
Prelude.Nothing,
      $sel:sinkArn:ListLinksItem' :: Maybe Text
sinkArn = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The random ID string that Amazon Web Services generated as part of the
-- link ARN.
listLinksItem_id :: Lens.Lens' ListLinksItem (Prelude.Maybe Prelude.Text)
listLinksItem_id :: Lens' ListLinksItem (Maybe Text)
listLinksItem_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLinksItem' {Maybe Text
id :: Maybe Text
$sel:id:ListLinksItem' :: ListLinksItem -> Maybe Text
id} -> Maybe Text
id) (\s :: ListLinksItem
s@ListLinksItem' {} Maybe Text
a -> ListLinksItem
s {$sel:id:ListLinksItem' :: Maybe Text
id = Maybe Text
a} :: ListLinksItem)

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

-- | The resource types supported by this link.
listLinksItem_resourceTypes :: Lens.Lens' ListLinksItem (Prelude.Maybe [Prelude.Text])
listLinksItem_resourceTypes :: Lens' ListLinksItem (Maybe [Text])
listLinksItem_resourceTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLinksItem' {Maybe [Text]
resourceTypes :: Maybe [Text]
$sel:resourceTypes:ListLinksItem' :: ListLinksItem -> Maybe [Text]
resourceTypes} -> Maybe [Text]
resourceTypes) (\s :: ListLinksItem
s@ListLinksItem' {} Maybe [Text]
a -> ListLinksItem
s {$sel:resourceTypes:ListLinksItem' :: Maybe [Text]
resourceTypes = Maybe [Text]
a} :: ListLinksItem) 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

-- | The ARN of the sink that this link is attached to.
listLinksItem_sinkArn :: Lens.Lens' ListLinksItem (Prelude.Maybe Prelude.Text)
listLinksItem_sinkArn :: Lens' ListLinksItem (Maybe Text)
listLinksItem_sinkArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLinksItem' {Maybe Text
sinkArn :: Maybe Text
$sel:sinkArn:ListLinksItem' :: ListLinksItem -> Maybe Text
sinkArn} -> Maybe Text
sinkArn) (\s :: ListLinksItem
s@ListLinksItem' {} Maybe Text
a -> ListLinksItem
s {$sel:sinkArn:ListLinksItem' :: Maybe Text
sinkArn = Maybe Text
a} :: ListLinksItem)

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

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

instance Prelude.NFData ListLinksItem where
  rnf :: ListLinksItem -> ()
rnf ListLinksItem' {Maybe [Text]
Maybe Text
sinkArn :: Maybe Text
resourceTypes :: Maybe [Text]
label :: Maybe Text
id :: Maybe Text
arn :: Maybe Text
$sel:sinkArn:ListLinksItem' :: ListLinksItem -> Maybe Text
$sel:resourceTypes:ListLinksItem' :: ListLinksItem -> Maybe [Text]
$sel:label:ListLinksItem' :: ListLinksItem -> Maybe Text
$sel:id:ListLinksItem' :: ListLinksItem -> Maybe Text
$sel:arn:ListLinksItem' :: ListLinksItem -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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]
resourceTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sinkArn