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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | Type of server resource.
    LicenseConfigurationAssociation -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | 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 Core.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
  }
  deriving (LicenseConfigurationAssociation
-> LicenseConfigurationAssociation -> Bool
(LicenseConfigurationAssociation
 -> LicenseConfigurationAssociation -> Bool)
-> (LicenseConfigurationAssociation
    -> LicenseConfigurationAssociation -> Bool)
-> Eq LicenseConfigurationAssociation
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]
(Int -> ReadS LicenseConfigurationAssociation)
-> ReadS [LicenseConfigurationAssociation]
-> ReadPrec LicenseConfigurationAssociation
-> ReadPrec [LicenseConfigurationAssociation]
-> Read 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
(Int -> LicenseConfigurationAssociation -> ShowS)
-> (LicenseConfigurationAssociation -> String)
-> ([LicenseConfigurationAssociation] -> ShowS)
-> Show LicenseConfigurationAssociation
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.
 LicenseConfigurationAssociation
 -> Rep LicenseConfigurationAssociation x)
-> (forall x.
    Rep LicenseConfigurationAssociation x
    -> LicenseConfigurationAssociation)
-> Generic LicenseConfigurationAssociation
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:
--
-- 'resourceType', 'licenseConfigurationAssociation_resourceType' - Type of server resource.
--
-- '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.
newLicenseConfigurationAssociation ::
  LicenseConfigurationAssociation
newLicenseConfigurationAssociation :: LicenseConfigurationAssociation
newLicenseConfigurationAssociation =
  LicenseConfigurationAssociation' :: Maybe ResourceType
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> LicenseConfigurationAssociation
LicenseConfigurationAssociation'
    { $sel:resourceType:LicenseConfigurationAssociation' :: Maybe ResourceType
resourceType =
        Maybe ResourceType
forall a. Maybe a
Prelude.Nothing,
      $sel:amiAssociationScope:LicenseConfigurationAssociation' :: Maybe Text
amiAssociationScope = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:associationTime:LicenseConfigurationAssociation' :: Maybe POSIX
associationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceArn:LicenseConfigurationAssociation' :: Maybe Text
resourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceOwnerId:LicenseConfigurationAssociation' :: Maybe Text
resourceOwnerId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Type of server resource.
licenseConfigurationAssociation_resourceType :: Lens.Lens' LicenseConfigurationAssociation (Prelude.Maybe ResourceType)
licenseConfigurationAssociation_resourceType :: (Maybe ResourceType -> f (Maybe ResourceType))
-> LicenseConfigurationAssociation
-> f LicenseConfigurationAssociation
licenseConfigurationAssociation_resourceType = (LicenseConfigurationAssociation -> Maybe ResourceType)
-> (LicenseConfigurationAssociation
    -> Maybe ResourceType -> LicenseConfigurationAssociation)
-> Lens
     LicenseConfigurationAssociation
     LicenseConfigurationAssociation
     (Maybe ResourceType)
     (Maybe 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)

-- | Scope of AMI associations. The possible value is @cross-account@.
licenseConfigurationAssociation_amiAssociationScope :: Lens.Lens' LicenseConfigurationAssociation (Prelude.Maybe Prelude.Text)
licenseConfigurationAssociation_amiAssociationScope :: (Maybe Text -> f (Maybe Text))
-> LicenseConfigurationAssociation
-> f LicenseConfigurationAssociation
licenseConfigurationAssociation_amiAssociationScope = (LicenseConfigurationAssociation -> Maybe Text)
-> (LicenseConfigurationAssociation
    -> Maybe Text -> LicenseConfigurationAssociation)
-> Lens
     LicenseConfigurationAssociation
     LicenseConfigurationAssociation
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> LicenseConfigurationAssociation
-> f LicenseConfigurationAssociation
licenseConfigurationAssociation_associationTime = (LicenseConfigurationAssociation -> Maybe POSIX)
-> (LicenseConfigurationAssociation
    -> Maybe POSIX -> LicenseConfigurationAssociation)
-> Lens
     LicenseConfigurationAssociation
     LicenseConfigurationAssociation
     (Maybe POSIX)
     (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> LicenseConfigurationAssociation
 -> f LicenseConfigurationAssociation)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> LicenseConfigurationAssociation
-> f LicenseConfigurationAssociation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Amazon Resource Name (ARN) of the resource.
licenseConfigurationAssociation_resourceArn :: Lens.Lens' LicenseConfigurationAssociation (Prelude.Maybe Prelude.Text)
licenseConfigurationAssociation_resourceArn :: (Maybe Text -> f (Maybe Text))
-> LicenseConfigurationAssociation
-> f LicenseConfigurationAssociation
licenseConfigurationAssociation_resourceArn = (LicenseConfigurationAssociation -> Maybe Text)
-> (LicenseConfigurationAssociation
    -> Maybe Text -> LicenseConfigurationAssociation)
-> Lens
     LicenseConfigurationAssociation
     LicenseConfigurationAssociation
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> LicenseConfigurationAssociation
-> f LicenseConfigurationAssociation
licenseConfigurationAssociation_resourceOwnerId = (LicenseConfigurationAssociation -> Maybe Text)
-> (LicenseConfigurationAssociation
    -> Maybe Text -> LicenseConfigurationAssociation)
-> Lens
     LicenseConfigurationAssociation
     LicenseConfigurationAssociation
     (Maybe Text)
     (Maybe Text)
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)

instance
  Core.FromJSON
    LicenseConfigurationAssociation
  where
  parseJSON :: Value -> Parser LicenseConfigurationAssociation
parseJSON =
    String
-> (Object -> Parser LicenseConfigurationAssociation)
-> Value
-> Parser LicenseConfigurationAssociation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LicenseConfigurationAssociation"
      ( \Object
x ->
          Maybe ResourceType
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> LicenseConfigurationAssociation
LicenseConfigurationAssociation'
            (Maybe ResourceType
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> LicenseConfigurationAssociation)
-> Parser (Maybe ResourceType)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> LicenseConfigurationAssociation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ResourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceType")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> LicenseConfigurationAssociation)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe Text -> LicenseConfigurationAssociation)
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
"AmiAssociationScope")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe Text -> LicenseConfigurationAssociation)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe Text -> LicenseConfigurationAssociation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AssociationTime")
            Parser
  (Maybe Text -> Maybe Text -> LicenseConfigurationAssociation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> LicenseConfigurationAssociation)
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
"ResourceArn")
            Parser (Maybe Text -> LicenseConfigurationAssociation)
-> Parser (Maybe Text) -> Parser LicenseConfigurationAssociation
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
"ResourceOwnerId")
      )

instance
  Prelude.Hashable
    LicenseConfigurationAssociation

instance
  Prelude.NFData
    LicenseConfigurationAssociation