{-# 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.ServiceSetting
-- 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.ServiceSetting 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

-- | The service setting data structure.
--
-- @ServiceSetting@ is an account-level setting for an Amazon Web Services
-- service. This setting defines how a user interacts with or uses a
-- service or a feature of a service. For example, if an Amazon Web
-- Services service charges money to the account based on feature or
-- service usage, then the Amazon Web Services service team might create a
-- default setting of \"false\". This means the user can\'t use this
-- feature unless they change the setting to \"true\" and intentionally opt
-- in for a paid feature.
--
-- Services map a @SettingId@ object to a setting value. Amazon Web
-- Services services teams define the default value for a @SettingId@. You
-- can\'t create a new @SettingId@, but you can overwrite the default value
-- if you have the @ssm:UpdateServiceSetting@ permission for the setting.
-- Use the UpdateServiceSetting API operation to change the default
-- setting. Or, use the ResetServiceSetting to change the value back to the
-- original value defined by the Amazon Web Services service team.
--
-- /See:/ 'newServiceSetting' smart constructor.
data ServiceSetting = ServiceSetting'
  { -- | The ARN of the service setting.
    ServiceSetting -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The last time the service setting was modified.
    ServiceSetting -> Maybe POSIX
lastModifiedDate :: Prelude.Maybe Data.POSIX,
    -- | The ARN of the last modified user. This field is populated only if the
    -- setting value was overwritten.
    ServiceSetting -> Maybe Text
lastModifiedUser :: Prelude.Maybe Prelude.Text,
    -- | The ID of the service setting.
    ServiceSetting -> Maybe Text
settingId :: Prelude.Maybe Prelude.Text,
    -- | The value of the service setting.
    ServiceSetting -> Maybe Text
settingValue :: Prelude.Maybe Prelude.Text,
    -- | The status of the service setting. The value can be Default, Customized
    -- or PendingUpdate.
    --
    -- -   Default: The current setting uses a default value provisioned by the
    --     Amazon Web Services service team.
    --
    -- -   Customized: The current setting use a custom value specified by the
    --     customer.
    --
    -- -   PendingUpdate: The current setting uses a default or custom value,
    --     but a setting change request is pending approval.
    ServiceSetting -> Maybe Text
status :: Prelude.Maybe Prelude.Text
  }
  deriving (ServiceSetting -> ServiceSetting -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceSetting -> ServiceSetting -> Bool
$c/= :: ServiceSetting -> ServiceSetting -> Bool
== :: ServiceSetting -> ServiceSetting -> Bool
$c== :: ServiceSetting -> ServiceSetting -> Bool
Prelude.Eq, ReadPrec [ServiceSetting]
ReadPrec ServiceSetting
Int -> ReadS ServiceSetting
ReadS [ServiceSetting]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceSetting]
$creadListPrec :: ReadPrec [ServiceSetting]
readPrec :: ReadPrec ServiceSetting
$creadPrec :: ReadPrec ServiceSetting
readList :: ReadS [ServiceSetting]
$creadList :: ReadS [ServiceSetting]
readsPrec :: Int -> ReadS ServiceSetting
$creadsPrec :: Int -> ReadS ServiceSetting
Prelude.Read, Int -> ServiceSetting -> ShowS
[ServiceSetting] -> ShowS
ServiceSetting -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceSetting] -> ShowS
$cshowList :: [ServiceSetting] -> ShowS
show :: ServiceSetting -> String
$cshow :: ServiceSetting -> String
showsPrec :: Int -> ServiceSetting -> ShowS
$cshowsPrec :: Int -> ServiceSetting -> ShowS
Prelude.Show, forall x. Rep ServiceSetting x -> ServiceSetting
forall x. ServiceSetting -> Rep ServiceSetting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServiceSetting x -> ServiceSetting
$cfrom :: forall x. ServiceSetting -> Rep ServiceSetting x
Prelude.Generic)

-- |
-- Create a value of 'ServiceSetting' 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', 'serviceSetting_arn' - The ARN of the service setting.
--
-- 'lastModifiedDate', 'serviceSetting_lastModifiedDate' - The last time the service setting was modified.
--
-- 'lastModifiedUser', 'serviceSetting_lastModifiedUser' - The ARN of the last modified user. This field is populated only if the
-- setting value was overwritten.
--
-- 'settingId', 'serviceSetting_settingId' - The ID of the service setting.
--
-- 'settingValue', 'serviceSetting_settingValue' - The value of the service setting.
--
-- 'status', 'serviceSetting_status' - The status of the service setting. The value can be Default, Customized
-- or PendingUpdate.
--
-- -   Default: The current setting uses a default value provisioned by the
--     Amazon Web Services service team.
--
-- -   Customized: The current setting use a custom value specified by the
--     customer.
--
-- -   PendingUpdate: The current setting uses a default or custom value,
--     but a setting change request is pending approval.
newServiceSetting ::
  ServiceSetting
newServiceSetting :: ServiceSetting
newServiceSetting =
  ServiceSetting'
    { $sel:arn:ServiceSetting' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedDate:ServiceSetting' :: Maybe POSIX
lastModifiedDate = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedUser:ServiceSetting' :: Maybe Text
lastModifiedUser = forall a. Maybe a
Prelude.Nothing,
      $sel:settingId:ServiceSetting' :: Maybe Text
settingId = forall a. Maybe a
Prelude.Nothing,
      $sel:settingValue:ServiceSetting' :: Maybe Text
settingValue = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ServiceSetting' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The last time the service setting was modified.
serviceSetting_lastModifiedDate :: Lens.Lens' ServiceSetting (Prelude.Maybe Prelude.UTCTime)
serviceSetting_lastModifiedDate :: Lens' ServiceSetting (Maybe UTCTime)
serviceSetting_lastModifiedDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSetting' {Maybe POSIX
lastModifiedDate :: Maybe POSIX
$sel:lastModifiedDate:ServiceSetting' :: ServiceSetting -> Maybe POSIX
lastModifiedDate} -> Maybe POSIX
lastModifiedDate) (\s :: ServiceSetting
s@ServiceSetting' {} Maybe POSIX
a -> ServiceSetting
s {$sel:lastModifiedDate:ServiceSetting' :: Maybe POSIX
lastModifiedDate = Maybe POSIX
a} :: ServiceSetting) 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

-- | The ARN of the last modified user. This field is populated only if the
-- setting value was overwritten.
serviceSetting_lastModifiedUser :: Lens.Lens' ServiceSetting (Prelude.Maybe Prelude.Text)
serviceSetting_lastModifiedUser :: Lens' ServiceSetting (Maybe Text)
serviceSetting_lastModifiedUser = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSetting' {Maybe Text
lastModifiedUser :: Maybe Text
$sel:lastModifiedUser:ServiceSetting' :: ServiceSetting -> Maybe Text
lastModifiedUser} -> Maybe Text
lastModifiedUser) (\s :: ServiceSetting
s@ServiceSetting' {} Maybe Text
a -> ServiceSetting
s {$sel:lastModifiedUser:ServiceSetting' :: Maybe Text
lastModifiedUser = Maybe Text
a} :: ServiceSetting)

-- | The ID of the service setting.
serviceSetting_settingId :: Lens.Lens' ServiceSetting (Prelude.Maybe Prelude.Text)
serviceSetting_settingId :: Lens' ServiceSetting (Maybe Text)
serviceSetting_settingId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSetting' {Maybe Text
settingId :: Maybe Text
$sel:settingId:ServiceSetting' :: ServiceSetting -> Maybe Text
settingId} -> Maybe Text
settingId) (\s :: ServiceSetting
s@ServiceSetting' {} Maybe Text
a -> ServiceSetting
s {$sel:settingId:ServiceSetting' :: Maybe Text
settingId = Maybe Text
a} :: ServiceSetting)

-- | The value of the service setting.
serviceSetting_settingValue :: Lens.Lens' ServiceSetting (Prelude.Maybe Prelude.Text)
serviceSetting_settingValue :: Lens' ServiceSetting (Maybe Text)
serviceSetting_settingValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSetting' {Maybe Text
settingValue :: Maybe Text
$sel:settingValue:ServiceSetting' :: ServiceSetting -> Maybe Text
settingValue} -> Maybe Text
settingValue) (\s :: ServiceSetting
s@ServiceSetting' {} Maybe Text
a -> ServiceSetting
s {$sel:settingValue:ServiceSetting' :: Maybe Text
settingValue = Maybe Text
a} :: ServiceSetting)

-- | The status of the service setting. The value can be Default, Customized
-- or PendingUpdate.
--
-- -   Default: The current setting uses a default value provisioned by the
--     Amazon Web Services service team.
--
-- -   Customized: The current setting use a custom value specified by the
--     customer.
--
-- -   PendingUpdate: The current setting uses a default or custom value,
--     but a setting change request is pending approval.
serviceSetting_status :: Lens.Lens' ServiceSetting (Prelude.Maybe Prelude.Text)
serviceSetting_status :: Lens' ServiceSetting (Maybe Text)
serviceSetting_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceSetting' {Maybe Text
status :: Maybe Text
$sel:status:ServiceSetting' :: ServiceSetting -> Maybe Text
status} -> Maybe Text
status) (\s :: ServiceSetting
s@ServiceSetting' {} Maybe Text
a -> ServiceSetting
s {$sel:status:ServiceSetting' :: Maybe Text
status = Maybe Text
a} :: ServiceSetting)

instance Data.FromJSON ServiceSetting where
  parseJSON :: Value -> Parser ServiceSetting
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ServiceSetting"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ServiceSetting
ServiceSetting'
            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
"LastModifiedDate")
            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
"LastModifiedUser")
            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
"SettingId")
            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
"SettingValue")
            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
"Status")
      )

instance Prelude.Hashable ServiceSetting where
  hashWithSalt :: Int -> ServiceSetting -> Int
hashWithSalt Int
_salt ServiceSetting' {Maybe Text
Maybe POSIX
status :: Maybe Text
settingValue :: Maybe Text
settingId :: Maybe Text
lastModifiedUser :: Maybe Text
lastModifiedDate :: Maybe POSIX
arn :: Maybe Text
$sel:status:ServiceSetting' :: ServiceSetting -> Maybe Text
$sel:settingValue:ServiceSetting' :: ServiceSetting -> Maybe Text
$sel:settingId:ServiceSetting' :: ServiceSetting -> Maybe Text
$sel:lastModifiedUser:ServiceSetting' :: ServiceSetting -> Maybe Text
$sel:lastModifiedDate:ServiceSetting' :: ServiceSetting -> Maybe POSIX
$sel:arn:ServiceSetting' :: ServiceSetting -> 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 POSIX
lastModifiedDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastModifiedUser
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
settingId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
settingValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status

instance Prelude.NFData ServiceSetting where
  rnf :: ServiceSetting -> ()
rnf ServiceSetting' {Maybe Text
Maybe POSIX
status :: Maybe Text
settingValue :: Maybe Text
settingId :: Maybe Text
lastModifiedUser :: Maybe Text
lastModifiedDate :: Maybe POSIX
arn :: Maybe Text
$sel:status:ServiceSetting' :: ServiceSetting -> Maybe Text
$sel:settingValue:ServiceSetting' :: ServiceSetting -> Maybe Text
$sel:settingId:ServiceSetting' :: ServiceSetting -> Maybe Text
$sel:lastModifiedUser:ServiceSetting' :: ServiceSetting -> Maybe Text
$sel:lastModifiedDate:ServiceSetting' :: ServiceSetting -> Maybe POSIX
$sel:arn:ServiceSetting' :: ServiceSetting -> 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 POSIX
lastModifiedDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastModifiedUser
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
settingId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
settingValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status