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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 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,
    -- | The last time the service setting was modified.
    ServiceSetting -> Maybe POSIX
lastModifiedDate :: Prelude.Maybe Core.POSIX,
    -- | The ARN of the service setting.
    ServiceSetting -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the service setting.
    ServiceSetting -> Maybe Text
settingId :: Prelude.Maybe Prelude.Text,
    -- | 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 value of the service setting.
    ServiceSetting -> Maybe Text
settingValue :: Prelude.Maybe Prelude.Text
  }
  deriving (ServiceSetting -> ServiceSetting -> Bool
(ServiceSetting -> ServiceSetting -> Bool)
-> (ServiceSetting -> ServiceSetting -> Bool) -> Eq ServiceSetting
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]
(Int -> ReadS ServiceSetting)
-> ReadS [ServiceSetting]
-> ReadPrec ServiceSetting
-> ReadPrec [ServiceSetting]
-> Read 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
(Int -> ServiceSetting -> ShowS)
-> (ServiceSetting -> String)
-> ([ServiceSetting] -> ShowS)
-> Show ServiceSetting
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. ServiceSetting -> Rep ServiceSetting x)
-> (forall x. Rep ServiceSetting x -> ServiceSetting)
-> Generic ServiceSetting
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:
--
-- '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.
--
-- 'lastModifiedDate', 'serviceSetting_lastModifiedDate' - The last time the service setting was modified.
--
-- 'arn', 'serviceSetting_arn' - The ARN of the service setting.
--
-- 'settingId', 'serviceSetting_settingId' - The ID of the service setting.
--
-- 'lastModifiedUser', 'serviceSetting_lastModifiedUser' - The ARN of the last modified user. This field is populated only if the
-- setting value was overwritten.
--
-- 'settingValue', 'serviceSetting_settingValue' - The value of the service setting.
newServiceSetting ::
  ServiceSetting
newServiceSetting :: ServiceSetting
newServiceSetting =
  ServiceSetting' :: Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ServiceSetting
ServiceSetting'
    { $sel:status:ServiceSetting' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedDate:ServiceSetting' :: Maybe POSIX
lastModifiedDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:ServiceSetting' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:settingId:ServiceSetting' :: Maybe Text
settingId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedUser:ServiceSetting' :: Maybe Text
lastModifiedUser = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:settingValue:ServiceSetting' :: Maybe Text
settingValue = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> ServiceSetting -> f ServiceSetting
serviceSetting_status = (ServiceSetting -> Maybe Text)
-> (ServiceSetting -> Maybe Text -> ServiceSetting)
-> Lens ServiceSetting ServiceSetting (Maybe Text) (Maybe Text)
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)

-- | The last time the service setting was modified.
serviceSetting_lastModifiedDate :: Lens.Lens' ServiceSetting (Prelude.Maybe Prelude.UTCTime)
serviceSetting_lastModifiedDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ServiceSetting -> f ServiceSetting
serviceSetting_lastModifiedDate = (ServiceSetting -> Maybe POSIX)
-> (ServiceSetting -> Maybe POSIX -> ServiceSetting)
-> Lens ServiceSetting ServiceSetting (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> ServiceSetting -> f ServiceSetting)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ServiceSetting
-> f ServiceSetting
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

-- | The ARN of the service setting.
serviceSetting_arn :: Lens.Lens' ServiceSetting (Prelude.Maybe Prelude.Text)
serviceSetting_arn :: (Maybe Text -> f (Maybe Text))
-> ServiceSetting -> f ServiceSetting
serviceSetting_arn = (ServiceSetting -> Maybe Text)
-> (ServiceSetting -> Maybe Text -> ServiceSetting)
-> Lens ServiceSetting ServiceSetting (Maybe Text) (Maybe Text)
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 ID of the service setting.
serviceSetting_settingId :: Lens.Lens' ServiceSetting (Prelude.Maybe Prelude.Text)
serviceSetting_settingId :: (Maybe Text -> f (Maybe Text))
-> ServiceSetting -> f ServiceSetting
serviceSetting_settingId = (ServiceSetting -> Maybe Text)
-> (ServiceSetting -> Maybe Text -> ServiceSetting)
-> Lens ServiceSetting ServiceSetting (Maybe Text) (Maybe Text)
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 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 :: (Maybe Text -> f (Maybe Text))
-> ServiceSetting -> f ServiceSetting
serviceSetting_lastModifiedUser = (ServiceSetting -> Maybe Text)
-> (ServiceSetting -> Maybe Text -> ServiceSetting)
-> Lens ServiceSetting ServiceSetting (Maybe Text) (Maybe Text)
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 value of the service setting.
serviceSetting_settingValue :: Lens.Lens' ServiceSetting (Prelude.Maybe Prelude.Text)
serviceSetting_settingValue :: (Maybe Text -> f (Maybe Text))
-> ServiceSetting -> f ServiceSetting
serviceSetting_settingValue = (ServiceSetting -> Maybe Text)
-> (ServiceSetting -> Maybe Text -> ServiceSetting)
-> Lens ServiceSetting ServiceSetting (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable ServiceSetting

instance Prelude.NFData ServiceSetting