{-# 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.BillingConductor.Types.ListResourcesAssociatedToCustomLineItemResponseElement
-- 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.BillingConductor.Types.ListResourcesAssociatedToCustomLineItemResponseElement where

import Amazonka.BillingConductor.Types.CustomLineItemRelationship
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 representation of a resource association for a custom line item.
--
-- /See:/ 'newListResourcesAssociatedToCustomLineItemResponseElement' smart constructor.
data ListResourcesAssociatedToCustomLineItemResponseElement = ListResourcesAssociatedToCustomLineItemResponseElement'
  { -- | The ARN of the associated resource.
    ListResourcesAssociatedToCustomLineItemResponseElement
-> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The end billing period of the associated resource.
    ListResourcesAssociatedToCustomLineItemResponseElement
-> Maybe Text
endBillingPeriod :: Prelude.Maybe Prelude.Text,
    -- | The type of relationship between the custom line item and the associated
    -- resource.
    ListResourcesAssociatedToCustomLineItemResponseElement
-> Maybe CustomLineItemRelationship
relationship :: Prelude.Maybe CustomLineItemRelationship
  }
  deriving (ListResourcesAssociatedToCustomLineItemResponseElement
-> ListResourcesAssociatedToCustomLineItemResponseElement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourcesAssociatedToCustomLineItemResponseElement
-> ListResourcesAssociatedToCustomLineItemResponseElement -> Bool
$c/= :: ListResourcesAssociatedToCustomLineItemResponseElement
-> ListResourcesAssociatedToCustomLineItemResponseElement -> Bool
== :: ListResourcesAssociatedToCustomLineItemResponseElement
-> ListResourcesAssociatedToCustomLineItemResponseElement -> Bool
$c== :: ListResourcesAssociatedToCustomLineItemResponseElement
-> ListResourcesAssociatedToCustomLineItemResponseElement -> Bool
Prelude.Eq, ReadPrec [ListResourcesAssociatedToCustomLineItemResponseElement]
ReadPrec ListResourcesAssociatedToCustomLineItemResponseElement
Int -> ReadS ListResourcesAssociatedToCustomLineItemResponseElement
ReadS [ListResourcesAssociatedToCustomLineItemResponseElement]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourcesAssociatedToCustomLineItemResponseElement]
$creadListPrec :: ReadPrec [ListResourcesAssociatedToCustomLineItemResponseElement]
readPrec :: ReadPrec ListResourcesAssociatedToCustomLineItemResponseElement
$creadPrec :: ReadPrec ListResourcesAssociatedToCustomLineItemResponseElement
readList :: ReadS [ListResourcesAssociatedToCustomLineItemResponseElement]
$creadList :: ReadS [ListResourcesAssociatedToCustomLineItemResponseElement]
readsPrec :: Int -> ReadS ListResourcesAssociatedToCustomLineItemResponseElement
$creadsPrec :: Int -> ReadS ListResourcesAssociatedToCustomLineItemResponseElement
Prelude.Read, Int
-> ListResourcesAssociatedToCustomLineItemResponseElement -> ShowS
[ListResourcesAssociatedToCustomLineItemResponseElement] -> ShowS
ListResourcesAssociatedToCustomLineItemResponseElement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourcesAssociatedToCustomLineItemResponseElement] -> ShowS
$cshowList :: [ListResourcesAssociatedToCustomLineItemResponseElement] -> ShowS
show :: ListResourcesAssociatedToCustomLineItemResponseElement -> String
$cshow :: ListResourcesAssociatedToCustomLineItemResponseElement -> String
showsPrec :: Int
-> ListResourcesAssociatedToCustomLineItemResponseElement -> ShowS
$cshowsPrec :: Int
-> ListResourcesAssociatedToCustomLineItemResponseElement -> ShowS
Prelude.Show, forall x.
Rep ListResourcesAssociatedToCustomLineItemResponseElement x
-> ListResourcesAssociatedToCustomLineItemResponseElement
forall x.
ListResourcesAssociatedToCustomLineItemResponseElement
-> Rep ListResourcesAssociatedToCustomLineItemResponseElement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResourcesAssociatedToCustomLineItemResponseElement x
-> ListResourcesAssociatedToCustomLineItemResponseElement
$cfrom :: forall x.
ListResourcesAssociatedToCustomLineItemResponseElement
-> Rep ListResourcesAssociatedToCustomLineItemResponseElement x
Prelude.Generic)

-- |
-- Create a value of 'ListResourcesAssociatedToCustomLineItemResponseElement' 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', 'listResourcesAssociatedToCustomLineItemResponseElement_arn' - The ARN of the associated resource.
--
-- 'endBillingPeriod', 'listResourcesAssociatedToCustomLineItemResponseElement_endBillingPeriod' - The end billing period of the associated resource.
--
-- 'relationship', 'listResourcesAssociatedToCustomLineItemResponseElement_relationship' - The type of relationship between the custom line item and the associated
-- resource.
newListResourcesAssociatedToCustomLineItemResponseElement ::
  ListResourcesAssociatedToCustomLineItemResponseElement
newListResourcesAssociatedToCustomLineItemResponseElement :: ListResourcesAssociatedToCustomLineItemResponseElement
newListResourcesAssociatedToCustomLineItemResponseElement =
  ListResourcesAssociatedToCustomLineItemResponseElement'
    { $sel:arn:ListResourcesAssociatedToCustomLineItemResponseElement' :: Maybe Text
arn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:endBillingPeriod:ListResourcesAssociatedToCustomLineItemResponseElement' :: Maybe Text
endBillingPeriod =
        forall a. Maybe a
Prelude.Nothing,
      $sel:relationship:ListResourcesAssociatedToCustomLineItemResponseElement' :: Maybe CustomLineItemRelationship
relationship =
        forall a. Maybe a
Prelude.Nothing
    }

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

-- | The end billing period of the associated resource.
listResourcesAssociatedToCustomLineItemResponseElement_endBillingPeriod :: Lens.Lens' ListResourcesAssociatedToCustomLineItemResponseElement (Prelude.Maybe Prelude.Text)
listResourcesAssociatedToCustomLineItemResponseElement_endBillingPeriod :: Lens'
  ListResourcesAssociatedToCustomLineItemResponseElement (Maybe Text)
listResourcesAssociatedToCustomLineItemResponseElement_endBillingPeriod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesAssociatedToCustomLineItemResponseElement' {Maybe Text
endBillingPeriod :: Maybe Text
$sel:endBillingPeriod:ListResourcesAssociatedToCustomLineItemResponseElement' :: ListResourcesAssociatedToCustomLineItemResponseElement
-> Maybe Text
endBillingPeriod} -> Maybe Text
endBillingPeriod) (\s :: ListResourcesAssociatedToCustomLineItemResponseElement
s@ListResourcesAssociatedToCustomLineItemResponseElement' {} Maybe Text
a -> ListResourcesAssociatedToCustomLineItemResponseElement
s {$sel:endBillingPeriod:ListResourcesAssociatedToCustomLineItemResponseElement' :: Maybe Text
endBillingPeriod = Maybe Text
a} :: ListResourcesAssociatedToCustomLineItemResponseElement)

-- | The type of relationship between the custom line item and the associated
-- resource.
listResourcesAssociatedToCustomLineItemResponseElement_relationship :: Lens.Lens' ListResourcesAssociatedToCustomLineItemResponseElement (Prelude.Maybe CustomLineItemRelationship)
listResourcesAssociatedToCustomLineItemResponseElement_relationship :: Lens'
  ListResourcesAssociatedToCustomLineItemResponseElement
  (Maybe CustomLineItemRelationship)
listResourcesAssociatedToCustomLineItemResponseElement_relationship = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesAssociatedToCustomLineItemResponseElement' {Maybe CustomLineItemRelationship
relationship :: Maybe CustomLineItemRelationship
$sel:relationship:ListResourcesAssociatedToCustomLineItemResponseElement' :: ListResourcesAssociatedToCustomLineItemResponseElement
-> Maybe CustomLineItemRelationship
relationship} -> Maybe CustomLineItemRelationship
relationship) (\s :: ListResourcesAssociatedToCustomLineItemResponseElement
s@ListResourcesAssociatedToCustomLineItemResponseElement' {} Maybe CustomLineItemRelationship
a -> ListResourcesAssociatedToCustomLineItemResponseElement
s {$sel:relationship:ListResourcesAssociatedToCustomLineItemResponseElement' :: Maybe CustomLineItemRelationship
relationship = Maybe CustomLineItemRelationship
a} :: ListResourcesAssociatedToCustomLineItemResponseElement)

instance
  Data.FromJSON
    ListResourcesAssociatedToCustomLineItemResponseElement
  where
  parseJSON :: Value
-> Parser ListResourcesAssociatedToCustomLineItemResponseElement
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ListResourcesAssociatedToCustomLineItemResponseElement"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe CustomLineItemRelationship
-> ListResourcesAssociatedToCustomLineItemResponseElement
ListResourcesAssociatedToCustomLineItemResponseElement'
            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
"EndBillingPeriod")
            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
"Relationship")
      )

instance
  Prelude.Hashable
    ListResourcesAssociatedToCustomLineItemResponseElement
  where
  hashWithSalt :: Int
-> ListResourcesAssociatedToCustomLineItemResponseElement -> Int
hashWithSalt
    Int
_salt
    ListResourcesAssociatedToCustomLineItemResponseElement' {Maybe Text
Maybe CustomLineItemRelationship
relationship :: Maybe CustomLineItemRelationship
endBillingPeriod :: Maybe Text
arn :: Maybe Text
$sel:relationship:ListResourcesAssociatedToCustomLineItemResponseElement' :: ListResourcesAssociatedToCustomLineItemResponseElement
-> Maybe CustomLineItemRelationship
$sel:endBillingPeriod:ListResourcesAssociatedToCustomLineItemResponseElement' :: ListResourcesAssociatedToCustomLineItemResponseElement
-> Maybe Text
$sel:arn:ListResourcesAssociatedToCustomLineItemResponseElement' :: ListResourcesAssociatedToCustomLineItemResponseElement
-> 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
endBillingPeriod
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CustomLineItemRelationship
relationship

instance
  Prelude.NFData
    ListResourcesAssociatedToCustomLineItemResponseElement
  where
  rnf :: ListResourcesAssociatedToCustomLineItemResponseElement -> ()
rnf
    ListResourcesAssociatedToCustomLineItemResponseElement' {Maybe Text
Maybe CustomLineItemRelationship
relationship :: Maybe CustomLineItemRelationship
endBillingPeriod :: Maybe Text
arn :: Maybe Text
$sel:relationship:ListResourcesAssociatedToCustomLineItemResponseElement' :: ListResourcesAssociatedToCustomLineItemResponseElement
-> Maybe CustomLineItemRelationship
$sel:endBillingPeriod:ListResourcesAssociatedToCustomLineItemResponseElement' :: ListResourcesAssociatedToCustomLineItemResponseElement
-> Maybe Text
$sel:arn:ListResourcesAssociatedToCustomLineItemResponseElement' :: ListResourcesAssociatedToCustomLineItemResponseElement
-> 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
endBillingPeriod
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomLineItemRelationship
relationship