{-# 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.SSM.Types.Activation
-- 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.SSM.Types.Activation 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
import Amazonka.SSM.Types.Tag

-- | An activation registers one or more on-premises servers or virtual
-- machines (VMs) with Amazon Web Services so that you can configure those
-- servers or VMs using Run Command. A server or VM that has been
-- registered with Amazon Web Services Systems Manager is called a managed
-- node.
--
-- /See:/ 'newActivation' smart constructor.
data Activation = Activation'
  { -- | The ID created by Systems Manager when you submitted the activation.
    Activation -> Maybe Text
activationId :: Prelude.Maybe Prelude.Text,
    -- | The date the activation was created.
    Activation -> Maybe POSIX
createdDate :: Prelude.Maybe Data.POSIX,
    -- | A name for the managed node when it is created.
    Activation -> Maybe Text
defaultInstanceName :: Prelude.Maybe Prelude.Text,
    -- | A user defined description of the activation.
    Activation -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The date when this activation can no longer be used to register managed
    -- nodes.
    Activation -> Maybe POSIX
expirationDate :: Prelude.Maybe Data.POSIX,
    -- | Whether or not the activation is expired.
    Activation -> Maybe Bool
expired :: Prelude.Maybe Prelude.Bool,
    -- | The Identity and Access Management (IAM) role to assign to the managed
    -- node.
    Activation -> Maybe Text
iamRole :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of managed nodes that can be registered using this
    -- activation.
    Activation -> Maybe Natural
registrationLimit :: Prelude.Maybe Prelude.Natural,
    -- | The number of managed nodes already registered with this activation.
    Activation -> Maybe Natural
registrationsCount :: Prelude.Maybe Prelude.Natural,
    -- | Tags assigned to the activation.
    Activation -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (Activation -> Activation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Activation -> Activation -> Bool
$c/= :: Activation -> Activation -> Bool
== :: Activation -> Activation -> Bool
$c== :: Activation -> Activation -> Bool
Prelude.Eq, ReadPrec [Activation]
ReadPrec Activation
Int -> ReadS Activation
ReadS [Activation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Activation]
$creadListPrec :: ReadPrec [Activation]
readPrec :: ReadPrec Activation
$creadPrec :: ReadPrec Activation
readList :: ReadS [Activation]
$creadList :: ReadS [Activation]
readsPrec :: Int -> ReadS Activation
$creadsPrec :: Int -> ReadS Activation
Prelude.Read, Int -> Activation -> ShowS
[Activation] -> ShowS
Activation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Activation] -> ShowS
$cshowList :: [Activation] -> ShowS
show :: Activation -> String
$cshow :: Activation -> String
showsPrec :: Int -> Activation -> ShowS
$cshowsPrec :: Int -> Activation -> ShowS
Prelude.Show, forall x. Rep Activation x -> Activation
forall x. Activation -> Rep Activation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Activation x -> Activation
$cfrom :: forall x. Activation -> Rep Activation x
Prelude.Generic)

-- |
-- Create a value of 'Activation' 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:
--
-- 'activationId', 'activation_activationId' - The ID created by Systems Manager when you submitted the activation.
--
-- 'createdDate', 'activation_createdDate' - The date the activation was created.
--
-- 'defaultInstanceName', 'activation_defaultInstanceName' - A name for the managed node when it is created.
--
-- 'description', 'activation_description' - A user defined description of the activation.
--
-- 'expirationDate', 'activation_expirationDate' - The date when this activation can no longer be used to register managed
-- nodes.
--
-- 'expired', 'activation_expired' - Whether or not the activation is expired.
--
-- 'iamRole', 'activation_iamRole' - The Identity and Access Management (IAM) role to assign to the managed
-- node.
--
-- 'registrationLimit', 'activation_registrationLimit' - The maximum number of managed nodes that can be registered using this
-- activation.
--
-- 'registrationsCount', 'activation_registrationsCount' - The number of managed nodes already registered with this activation.
--
-- 'tags', 'activation_tags' - Tags assigned to the activation.
newActivation ::
  Activation
newActivation :: Activation
newActivation =
  Activation'
    { $sel:activationId:Activation' :: Maybe Text
activationId = forall a. Maybe a
Prelude.Nothing,
      $sel:createdDate:Activation' :: Maybe POSIX
createdDate = forall a. Maybe a
Prelude.Nothing,
      $sel:defaultInstanceName:Activation' :: Maybe Text
defaultInstanceName = forall a. Maybe a
Prelude.Nothing,
      $sel:description:Activation' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:expirationDate:Activation' :: Maybe POSIX
expirationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:expired:Activation' :: Maybe Bool
expired = forall a. Maybe a
Prelude.Nothing,
      $sel:iamRole:Activation' :: Maybe Text
iamRole = forall a. Maybe a
Prelude.Nothing,
      $sel:registrationLimit:Activation' :: Maybe Natural
registrationLimit = forall a. Maybe a
Prelude.Nothing,
      $sel:registrationsCount:Activation' :: Maybe Natural
registrationsCount = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:Activation' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID created by Systems Manager when you submitted the activation.
activation_activationId :: Lens.Lens' Activation (Prelude.Maybe Prelude.Text)
activation_activationId :: Lens' Activation (Maybe Text)
activation_activationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Activation' {Maybe Text
activationId :: Maybe Text
$sel:activationId:Activation' :: Activation -> Maybe Text
activationId} -> Maybe Text
activationId) (\s :: Activation
s@Activation' {} Maybe Text
a -> Activation
s {$sel:activationId:Activation' :: Maybe Text
activationId = Maybe Text
a} :: Activation)

-- | The date the activation was created.
activation_createdDate :: Lens.Lens' Activation (Prelude.Maybe Prelude.UTCTime)
activation_createdDate :: Lens' Activation (Maybe UTCTime)
activation_createdDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Activation' {Maybe POSIX
createdDate :: Maybe POSIX
$sel:createdDate:Activation' :: Activation -> Maybe POSIX
createdDate} -> Maybe POSIX
createdDate) (\s :: Activation
s@Activation' {} Maybe POSIX
a -> Activation
s {$sel:createdDate:Activation' :: Maybe POSIX
createdDate = Maybe POSIX
a} :: Activation) 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

-- | A name for the managed node when it is created.
activation_defaultInstanceName :: Lens.Lens' Activation (Prelude.Maybe Prelude.Text)
activation_defaultInstanceName :: Lens' Activation (Maybe Text)
activation_defaultInstanceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Activation' {Maybe Text
defaultInstanceName :: Maybe Text
$sel:defaultInstanceName:Activation' :: Activation -> Maybe Text
defaultInstanceName} -> Maybe Text
defaultInstanceName) (\s :: Activation
s@Activation' {} Maybe Text
a -> Activation
s {$sel:defaultInstanceName:Activation' :: Maybe Text
defaultInstanceName = Maybe Text
a} :: Activation)

-- | A user defined description of the activation.
activation_description :: Lens.Lens' Activation (Prelude.Maybe Prelude.Text)
activation_description :: Lens' Activation (Maybe Text)
activation_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Activation' {Maybe Text
description :: Maybe Text
$sel:description:Activation' :: Activation -> Maybe Text
description} -> Maybe Text
description) (\s :: Activation
s@Activation' {} Maybe Text
a -> Activation
s {$sel:description:Activation' :: Maybe Text
description = Maybe Text
a} :: Activation)

-- | The date when this activation can no longer be used to register managed
-- nodes.
activation_expirationDate :: Lens.Lens' Activation (Prelude.Maybe Prelude.UTCTime)
activation_expirationDate :: Lens' Activation (Maybe UTCTime)
activation_expirationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Activation' {Maybe POSIX
expirationDate :: Maybe POSIX
$sel:expirationDate:Activation' :: Activation -> Maybe POSIX
expirationDate} -> Maybe POSIX
expirationDate) (\s :: Activation
s@Activation' {} Maybe POSIX
a -> Activation
s {$sel:expirationDate:Activation' :: Maybe POSIX
expirationDate = Maybe POSIX
a} :: Activation) 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

-- | Whether or not the activation is expired.
activation_expired :: Lens.Lens' Activation (Prelude.Maybe Prelude.Bool)
activation_expired :: Lens' Activation (Maybe Bool)
activation_expired = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Activation' {Maybe Bool
expired :: Maybe Bool
$sel:expired:Activation' :: Activation -> Maybe Bool
expired} -> Maybe Bool
expired) (\s :: Activation
s@Activation' {} Maybe Bool
a -> Activation
s {$sel:expired:Activation' :: Maybe Bool
expired = Maybe Bool
a} :: Activation)

-- | The Identity and Access Management (IAM) role to assign to the managed
-- node.
activation_iamRole :: Lens.Lens' Activation (Prelude.Maybe Prelude.Text)
activation_iamRole :: Lens' Activation (Maybe Text)
activation_iamRole = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Activation' {Maybe Text
iamRole :: Maybe Text
$sel:iamRole:Activation' :: Activation -> Maybe Text
iamRole} -> Maybe Text
iamRole) (\s :: Activation
s@Activation' {} Maybe Text
a -> Activation
s {$sel:iamRole:Activation' :: Maybe Text
iamRole = Maybe Text
a} :: Activation)

-- | The maximum number of managed nodes that can be registered using this
-- activation.
activation_registrationLimit :: Lens.Lens' Activation (Prelude.Maybe Prelude.Natural)
activation_registrationLimit :: Lens' Activation (Maybe Natural)
activation_registrationLimit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Activation' {Maybe Natural
registrationLimit :: Maybe Natural
$sel:registrationLimit:Activation' :: Activation -> Maybe Natural
registrationLimit} -> Maybe Natural
registrationLimit) (\s :: Activation
s@Activation' {} Maybe Natural
a -> Activation
s {$sel:registrationLimit:Activation' :: Maybe Natural
registrationLimit = Maybe Natural
a} :: Activation)

-- | The number of managed nodes already registered with this activation.
activation_registrationsCount :: Lens.Lens' Activation (Prelude.Maybe Prelude.Natural)
activation_registrationsCount :: Lens' Activation (Maybe Natural)
activation_registrationsCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Activation' {Maybe Natural
registrationsCount :: Maybe Natural
$sel:registrationsCount:Activation' :: Activation -> Maybe Natural
registrationsCount} -> Maybe Natural
registrationsCount) (\s :: Activation
s@Activation' {} Maybe Natural
a -> Activation
s {$sel:registrationsCount:Activation' :: Maybe Natural
registrationsCount = Maybe Natural
a} :: Activation)

-- | Tags assigned to the activation.
activation_tags :: Lens.Lens' Activation (Prelude.Maybe [Tag])
activation_tags :: Lens' Activation (Maybe [Tag])
activation_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Activation' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:Activation' :: Activation -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: Activation
s@Activation' {} Maybe [Tag]
a -> Activation
s {$sel:tags:Activation' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: Activation) 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 Activation where
  parseJSON :: Value -> Parser Activation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Activation"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Bool
-> Maybe Text
-> Maybe Natural
-> Maybe Natural
-> Maybe [Tag]
-> Activation
Activation'
            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
"ActivationId")
            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
"CreatedDate")
            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
"DefaultInstanceName")
            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
"Description")
            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
"ExpirationDate")
            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
"Expired")
            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
"IamRole")
            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
"RegistrationLimit")
            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
"RegistrationsCount")
            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
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Activation where
  hashWithSalt :: Int -> Activation -> Int
hashWithSalt Int
_salt Activation' {Maybe Bool
Maybe Natural
Maybe [Tag]
Maybe Text
Maybe POSIX
tags :: Maybe [Tag]
registrationsCount :: Maybe Natural
registrationLimit :: Maybe Natural
iamRole :: Maybe Text
expired :: Maybe Bool
expirationDate :: Maybe POSIX
description :: Maybe Text
defaultInstanceName :: Maybe Text
createdDate :: Maybe POSIX
activationId :: Maybe Text
$sel:tags:Activation' :: Activation -> Maybe [Tag]
$sel:registrationsCount:Activation' :: Activation -> Maybe Natural
$sel:registrationLimit:Activation' :: Activation -> Maybe Natural
$sel:iamRole:Activation' :: Activation -> Maybe Text
$sel:expired:Activation' :: Activation -> Maybe Bool
$sel:expirationDate:Activation' :: Activation -> Maybe POSIX
$sel:description:Activation' :: Activation -> Maybe Text
$sel:defaultInstanceName:Activation' :: Activation -> Maybe Text
$sel:createdDate:Activation' :: Activation -> Maybe POSIX
$sel:activationId:Activation' :: Activation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
activationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultInstanceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
expirationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
expired
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
iamRole
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
registrationLimit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
registrationsCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags

instance Prelude.NFData Activation where
  rnf :: Activation -> ()
rnf Activation' {Maybe Bool
Maybe Natural
Maybe [Tag]
Maybe Text
Maybe POSIX
tags :: Maybe [Tag]
registrationsCount :: Maybe Natural
registrationLimit :: Maybe Natural
iamRole :: Maybe Text
expired :: Maybe Bool
expirationDate :: Maybe POSIX
description :: Maybe Text
defaultInstanceName :: Maybe Text
createdDate :: Maybe POSIX
activationId :: Maybe Text
$sel:tags:Activation' :: Activation -> Maybe [Tag]
$sel:registrationsCount:Activation' :: Activation -> Maybe Natural
$sel:registrationLimit:Activation' :: Activation -> Maybe Natural
$sel:iamRole:Activation' :: Activation -> Maybe Text
$sel:expired:Activation' :: Activation -> Maybe Bool
$sel:expirationDate:Activation' :: Activation -> Maybe POSIX
$sel:description:Activation' :: Activation -> Maybe Text
$sel:defaultInstanceName:Activation' :: Activation -> Maybe Text
$sel:createdDate:Activation' :: Activation -> Maybe POSIX
$sel:activationId:Activation' :: Activation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
activationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultInstanceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
expirationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
expired
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
iamRole
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
registrationLimit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
registrationsCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags