{-# 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.LicenseManager.Types.LicenseConfigurationAssociation
-- 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.LicenseManager.Types.LicenseConfigurationAssociation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LicenseManager.Types.ResourceType
import qualified Amazonka.Prelude as Prelude

-- | Describes an association with a license configuration.
--
-- /See:/ 'newLicenseConfigurationAssociation' smart constructor.
data LicenseConfigurationAssociation = LicenseConfigurationAssociation'
  { -- | Scope of AMI associations. The possible value is @cross-account@.
    LicenseConfigurationAssociation -> Maybe Text
amiAssociationScope :: Prelude.Maybe Prelude.Text,
    -- | Time when the license configuration was associated with the resource.
    LicenseConfigurationAssociation -> Maybe POSIX
associationTime :: Prelude.Maybe Data.POSIX,
    -- | Amazon Resource Name (ARN) of the resource.
    LicenseConfigurationAssociation -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
    -- | ID of the Amazon Web Services account that owns the resource consuming
    -- licenses.
    LicenseConfigurationAssociation -> Maybe Text
resourceOwnerId :: Prelude.Maybe Prelude.Text,
    -- | Type of server resource.
    LicenseConfigurationAssociation -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType
  }
  deriving (LicenseConfigurationAssociation
-> LicenseConfigurationAssociation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LicenseConfigurationAssociation
-> LicenseConfigurationAssociation -> Bool
$c/= :: LicenseConfigurationAssociation
-> LicenseConfigurationAssociation -> Bool
== :: LicenseConfigurationAssociation
-> LicenseConfigurationAssociation -> Bool
$c== :: LicenseConfigurationAssociation
-> LicenseConfigurationAssociation -> Bool
Prelude.Eq, ReadPrec [LicenseConfigurationAssociation]
ReadPrec LicenseConfigurationAssociation
Int -> ReadS LicenseConfigurationAssociation
ReadS [LicenseConfigurationAssociation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LicenseConfigurationAssociation]
$creadListPrec :: ReadPrec [LicenseConfigurationAssociation]
readPrec :: ReadPrec LicenseConfigurationAssociation
$creadPrec :: ReadPrec LicenseConfigurationAssociation
readList :: ReadS [LicenseConfigurationAssociation]
$creadList :: ReadS [LicenseConfigurationAssociation]
readsPrec :: Int -> ReadS LicenseConfigurationAssociation
$creadsPrec :: Int -> ReadS LicenseConfigurationAssociation
Prelude.Read, Int -> LicenseConfigurationAssociation -> ShowS
[LicenseConfigurationAssociation] -> ShowS
LicenseConfigurationAssociation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LicenseConfigurationAssociation] -> ShowS
$cshowList :: [LicenseConfigurationAssociation] -> ShowS
show :: LicenseConfigurationAssociation -> String
$cshow :: LicenseConfigurationAssociation -> String
showsPrec :: Int -> LicenseConfigurationAssociation -> ShowS
$cshowsPrec :: Int -> LicenseConfigurationAssociation -> ShowS
Prelude.Show, forall x.
Rep LicenseConfigurationAssociation x
-> LicenseConfigurationAssociation
forall x.
LicenseConfigurationAssociation
-> Rep LicenseConfigurationAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LicenseConfigurationAssociation x
-> LicenseConfigurationAssociation
$cfrom :: forall x.
LicenseConfigurationAssociation
-> Rep LicenseConfigurationAssociation x
Prelude.Generic)

-- |
-- Create a value of 'LicenseConfigurationAssociation' 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:
--
-- 'amiAssociationScope', 'licenseConfigurationAssociation_amiAssociationScope' - Scope of AMI associations. The possible value is @cross-account@.
--
-- 'associationTime', 'licenseConfigurationAssociation_associationTime' - Time when the license configuration was associated with the resource.
--
-- 'resourceArn', 'licenseConfigurationAssociation_resourceArn' - Amazon Resource Name (ARN) of the resource.
--
-- 'resourceOwnerId', 'licenseConfigurationAssociation_resourceOwnerId' - ID of the Amazon Web Services account that owns the resource consuming
-- licenses.
--
-- 'resourceType', 'licenseConfigurationAssociation_resourceType' - Type of server resource.
newLicenseConfigurationAssociation ::
  LicenseConfigurationAssociation
newLicenseConfigurationAssociation :: LicenseConfigurationAssociation
newLicenseConfigurationAssociation =
  LicenseConfigurationAssociation'
    { $sel:amiAssociationScope:LicenseConfigurationAssociation' :: Maybe Text
amiAssociationScope =
        forall a. Maybe a
Prelude.Nothing,
      $sel:associationTime:LicenseConfigurationAssociation' :: Maybe POSIX
associationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceArn:LicenseConfigurationAssociation' :: Maybe Text
resourceArn = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceOwnerId:LicenseConfigurationAssociation' :: Maybe Text
resourceOwnerId = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:LicenseConfigurationAssociation' :: Maybe ResourceType
resourceType = forall a. Maybe a
Prelude.Nothing
    }

-- | Scope of AMI associations. The possible value is @cross-account@.
licenseConfigurationAssociation_amiAssociationScope :: Lens.Lens' LicenseConfigurationAssociation (Prelude.Maybe Prelude.Text)
licenseConfigurationAssociation_amiAssociationScope :: Lens' LicenseConfigurationAssociation (Maybe Text)
licenseConfigurationAssociation_amiAssociationScope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LicenseConfigurationAssociation' {Maybe Text
amiAssociationScope :: Maybe Text
$sel:amiAssociationScope:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe Text
amiAssociationScope} -> Maybe Text
amiAssociationScope) (\s :: LicenseConfigurationAssociation
s@LicenseConfigurationAssociation' {} Maybe Text
a -> LicenseConfigurationAssociation
s {$sel:amiAssociationScope:LicenseConfigurationAssociation' :: Maybe Text
amiAssociationScope = Maybe Text
a} :: LicenseConfigurationAssociation)

-- | Time when the license configuration was associated with the resource.
licenseConfigurationAssociation_associationTime :: Lens.Lens' LicenseConfigurationAssociation (Prelude.Maybe Prelude.UTCTime)
licenseConfigurationAssociation_associationTime :: Lens' LicenseConfigurationAssociation (Maybe UTCTime)
licenseConfigurationAssociation_associationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LicenseConfigurationAssociation' {Maybe POSIX
associationTime :: Maybe POSIX
$sel:associationTime:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe POSIX
associationTime} -> Maybe POSIX
associationTime) (\s :: LicenseConfigurationAssociation
s@LicenseConfigurationAssociation' {} Maybe POSIX
a -> LicenseConfigurationAssociation
s {$sel:associationTime:LicenseConfigurationAssociation' :: Maybe POSIX
associationTime = Maybe POSIX
a} :: LicenseConfigurationAssociation) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Amazon Resource Name (ARN) of the resource.
licenseConfigurationAssociation_resourceArn :: Lens.Lens' LicenseConfigurationAssociation (Prelude.Maybe Prelude.Text)
licenseConfigurationAssociation_resourceArn :: Lens' LicenseConfigurationAssociation (Maybe Text)
licenseConfigurationAssociation_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LicenseConfigurationAssociation' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe Text
resourceArn} -> Maybe Text
resourceArn) (\s :: LicenseConfigurationAssociation
s@LicenseConfigurationAssociation' {} Maybe Text
a -> LicenseConfigurationAssociation
s {$sel:resourceArn:LicenseConfigurationAssociation' :: Maybe Text
resourceArn = Maybe Text
a} :: LicenseConfigurationAssociation)

-- | ID of the Amazon Web Services account that owns the resource consuming
-- licenses.
licenseConfigurationAssociation_resourceOwnerId :: Lens.Lens' LicenseConfigurationAssociation (Prelude.Maybe Prelude.Text)
licenseConfigurationAssociation_resourceOwnerId :: Lens' LicenseConfigurationAssociation (Maybe Text)
licenseConfigurationAssociation_resourceOwnerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LicenseConfigurationAssociation' {Maybe Text
resourceOwnerId :: Maybe Text
$sel:resourceOwnerId:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe Text
resourceOwnerId} -> Maybe Text
resourceOwnerId) (\s :: LicenseConfigurationAssociation
s@LicenseConfigurationAssociation' {} Maybe Text
a -> LicenseConfigurationAssociation
s {$sel:resourceOwnerId:LicenseConfigurationAssociation' :: Maybe Text
resourceOwnerId = Maybe Text
a} :: LicenseConfigurationAssociation)

-- | Type of server resource.
licenseConfigurationAssociation_resourceType :: Lens.Lens' LicenseConfigurationAssociation (Prelude.Maybe ResourceType)
licenseConfigurationAssociation_resourceType :: Lens' LicenseConfigurationAssociation (Maybe ResourceType)
licenseConfigurationAssociation_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LicenseConfigurationAssociation' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: LicenseConfigurationAssociation
s@LicenseConfigurationAssociation' {} Maybe ResourceType
a -> LicenseConfigurationAssociation
s {$sel:resourceType:LicenseConfigurationAssociation' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: LicenseConfigurationAssociation)

instance
  Data.FromJSON
    LicenseConfigurationAssociation
  where
  parseJSON :: Value -> Parser LicenseConfigurationAssociation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LicenseConfigurationAssociation"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe ResourceType
-> LicenseConfigurationAssociation
LicenseConfigurationAssociation'
            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
"AmiAssociationScope")
            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
"AssociationTime")
            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
"ResourceArn")
            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
"ResourceOwnerId")
            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
"ResourceType")
      )

instance
  Prelude.Hashable
    LicenseConfigurationAssociation
  where
  hashWithSalt :: Int -> LicenseConfigurationAssociation -> Int
hashWithSalt
    Int
_salt
    LicenseConfigurationAssociation' {Maybe Text
Maybe POSIX
Maybe ResourceType
resourceType :: Maybe ResourceType
resourceOwnerId :: Maybe Text
resourceArn :: Maybe Text
associationTime :: Maybe POSIX
amiAssociationScope :: Maybe Text
$sel:resourceType:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe ResourceType
$sel:resourceOwnerId:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe Text
$sel:resourceArn:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe Text
$sel:associationTime:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe POSIX
$sel:amiAssociationScope:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
amiAssociationScope
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
associationTime
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceArn
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceOwnerId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceType
resourceType

instance
  Prelude.NFData
    LicenseConfigurationAssociation
  where
  rnf :: LicenseConfigurationAssociation -> ()
rnf LicenseConfigurationAssociation' {Maybe Text
Maybe POSIX
Maybe ResourceType
resourceType :: Maybe ResourceType
resourceOwnerId :: Maybe Text
resourceArn :: Maybe Text
associationTime :: Maybe POSIX
amiAssociationScope :: Maybe Text
$sel:resourceType:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe ResourceType
$sel:resourceOwnerId:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe Text
$sel:resourceArn:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe Text
$sel:associationTime:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe POSIX
$sel:amiAssociationScope:LicenseConfigurationAssociation' :: LicenseConfigurationAssociation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
amiAssociationScope
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
associationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceOwnerId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceType
resourceType