{-# 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.AppConfig.Types.ConfigurationProfile
-- 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.AppConfig.Types.ConfigurationProfile where

import Amazonka.AppConfig.Types.Validator
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

-- | /See:/ 'newConfigurationProfile' smart constructor.
data ConfigurationProfile = ConfigurationProfile'
  { -- | The application ID.
    ConfigurationProfile -> Maybe Text
applicationId :: Prelude.Maybe Prelude.Text,
    -- | The configuration profile description.
    ConfigurationProfile -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The configuration profile ID.
    ConfigurationProfile -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The URI location of the configuration.
    ConfigurationProfile -> Maybe Text
locationUri :: Prelude.Maybe Prelude.Text,
    -- | The name of the configuration profile.
    ConfigurationProfile -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ARN of an IAM role with permission to access the configuration at
    -- the specified @LocationUri@.
    ConfigurationProfile -> Maybe Text
retrievalRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The type of configurations contained in the profile. AppConfig supports
    -- @feature flags@ and @freeform@ configurations. We recommend you create
    -- feature flag configurations to enable or disable new features and
    -- freeform configurations to distribute configurations to an application.
    -- When calling this API, enter one of the following values for @Type@:
    --
    -- @AWS.AppConfig.FeatureFlags@
    --
    -- @AWS.Freeform@
    ConfigurationProfile -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
    -- | A list of methods for validating the configuration.
    ConfigurationProfile -> Maybe [Validator]
validators :: Prelude.Maybe [Validator]
  }
  deriving (ConfigurationProfile -> ConfigurationProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigurationProfile -> ConfigurationProfile -> Bool
$c/= :: ConfigurationProfile -> ConfigurationProfile -> Bool
== :: ConfigurationProfile -> ConfigurationProfile -> Bool
$c== :: ConfigurationProfile -> ConfigurationProfile -> Bool
Prelude.Eq, Int -> ConfigurationProfile -> ShowS
[ConfigurationProfile] -> ShowS
ConfigurationProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigurationProfile] -> ShowS
$cshowList :: [ConfigurationProfile] -> ShowS
show :: ConfigurationProfile -> String
$cshow :: ConfigurationProfile -> String
showsPrec :: Int -> ConfigurationProfile -> ShowS
$cshowsPrec :: Int -> ConfigurationProfile -> ShowS
Prelude.Show, forall x. Rep ConfigurationProfile x -> ConfigurationProfile
forall x. ConfigurationProfile -> Rep ConfigurationProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfigurationProfile x -> ConfigurationProfile
$cfrom :: forall x. ConfigurationProfile -> Rep ConfigurationProfile x
Prelude.Generic)

-- |
-- Create a value of 'ConfigurationProfile' 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:
--
-- 'applicationId', 'configurationProfile_applicationId' - The application ID.
--
-- 'description', 'configurationProfile_description' - The configuration profile description.
--
-- 'id', 'configurationProfile_id' - The configuration profile ID.
--
-- 'locationUri', 'configurationProfile_locationUri' - The URI location of the configuration.
--
-- 'name', 'configurationProfile_name' - The name of the configuration profile.
--
-- 'retrievalRoleArn', 'configurationProfile_retrievalRoleArn' - The ARN of an IAM role with permission to access the configuration at
-- the specified @LocationUri@.
--
-- 'type'', 'configurationProfile_type' - The type of configurations contained in the profile. AppConfig supports
-- @feature flags@ and @freeform@ configurations. We recommend you create
-- feature flag configurations to enable or disable new features and
-- freeform configurations to distribute configurations to an application.
-- When calling this API, enter one of the following values for @Type@:
--
-- @AWS.AppConfig.FeatureFlags@
--
-- @AWS.Freeform@
--
-- 'validators', 'configurationProfile_validators' - A list of methods for validating the configuration.
newConfigurationProfile ::
  ConfigurationProfile
newConfigurationProfile :: ConfigurationProfile
newConfigurationProfile =
  ConfigurationProfile'
    { $sel:applicationId:ConfigurationProfile' :: Maybe Text
applicationId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:description:ConfigurationProfile' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:id:ConfigurationProfile' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:locationUri:ConfigurationProfile' :: Maybe Text
locationUri = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ConfigurationProfile' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:retrievalRoleArn:ConfigurationProfile' :: Maybe Text
retrievalRoleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:type':ConfigurationProfile' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:validators:ConfigurationProfile' :: Maybe [Validator]
validators = forall a. Maybe a
Prelude.Nothing
    }

-- | The application ID.
configurationProfile_applicationId :: Lens.Lens' ConfigurationProfile (Prelude.Maybe Prelude.Text)
configurationProfile_applicationId :: Lens' ConfigurationProfile (Maybe Text)
configurationProfile_applicationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationProfile' {Maybe Text
applicationId :: Maybe Text
$sel:applicationId:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
applicationId} -> Maybe Text
applicationId) (\s :: ConfigurationProfile
s@ConfigurationProfile' {} Maybe Text
a -> ConfigurationProfile
s {$sel:applicationId:ConfigurationProfile' :: Maybe Text
applicationId = Maybe Text
a} :: ConfigurationProfile)

-- | The configuration profile description.
configurationProfile_description :: Lens.Lens' ConfigurationProfile (Prelude.Maybe Prelude.Text)
configurationProfile_description :: Lens' ConfigurationProfile (Maybe Text)
configurationProfile_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationProfile' {Maybe Text
description :: Maybe Text
$sel:description:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
description} -> Maybe Text
description) (\s :: ConfigurationProfile
s@ConfigurationProfile' {} Maybe Text
a -> ConfigurationProfile
s {$sel:description:ConfigurationProfile' :: Maybe Text
description = Maybe Text
a} :: ConfigurationProfile)

-- | The configuration profile ID.
configurationProfile_id :: Lens.Lens' ConfigurationProfile (Prelude.Maybe Prelude.Text)
configurationProfile_id :: Lens' ConfigurationProfile (Maybe Text)
configurationProfile_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationProfile' {Maybe Text
id :: Maybe Text
$sel:id:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
id} -> Maybe Text
id) (\s :: ConfigurationProfile
s@ConfigurationProfile' {} Maybe Text
a -> ConfigurationProfile
s {$sel:id:ConfigurationProfile' :: Maybe Text
id = Maybe Text
a} :: ConfigurationProfile)

-- | The URI location of the configuration.
configurationProfile_locationUri :: Lens.Lens' ConfigurationProfile (Prelude.Maybe Prelude.Text)
configurationProfile_locationUri :: Lens' ConfigurationProfile (Maybe Text)
configurationProfile_locationUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationProfile' {Maybe Text
locationUri :: Maybe Text
$sel:locationUri:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
locationUri} -> Maybe Text
locationUri) (\s :: ConfigurationProfile
s@ConfigurationProfile' {} Maybe Text
a -> ConfigurationProfile
s {$sel:locationUri:ConfigurationProfile' :: Maybe Text
locationUri = Maybe Text
a} :: ConfigurationProfile)

-- | The name of the configuration profile.
configurationProfile_name :: Lens.Lens' ConfigurationProfile (Prelude.Maybe Prelude.Text)
configurationProfile_name :: Lens' ConfigurationProfile (Maybe Text)
configurationProfile_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationProfile' {Maybe Text
name :: Maybe Text
$sel:name:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
name} -> Maybe Text
name) (\s :: ConfigurationProfile
s@ConfigurationProfile' {} Maybe Text
a -> ConfigurationProfile
s {$sel:name:ConfigurationProfile' :: Maybe Text
name = Maybe Text
a} :: ConfigurationProfile)

-- | The ARN of an IAM role with permission to access the configuration at
-- the specified @LocationUri@.
configurationProfile_retrievalRoleArn :: Lens.Lens' ConfigurationProfile (Prelude.Maybe Prelude.Text)
configurationProfile_retrievalRoleArn :: Lens' ConfigurationProfile (Maybe Text)
configurationProfile_retrievalRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationProfile' {Maybe Text
retrievalRoleArn :: Maybe Text
$sel:retrievalRoleArn:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
retrievalRoleArn} -> Maybe Text
retrievalRoleArn) (\s :: ConfigurationProfile
s@ConfigurationProfile' {} Maybe Text
a -> ConfigurationProfile
s {$sel:retrievalRoleArn:ConfigurationProfile' :: Maybe Text
retrievalRoleArn = Maybe Text
a} :: ConfigurationProfile)

-- | The type of configurations contained in the profile. AppConfig supports
-- @feature flags@ and @freeform@ configurations. We recommend you create
-- feature flag configurations to enable or disable new features and
-- freeform configurations to distribute configurations to an application.
-- When calling this API, enter one of the following values for @Type@:
--
-- @AWS.AppConfig.FeatureFlags@
--
-- @AWS.Freeform@
configurationProfile_type :: Lens.Lens' ConfigurationProfile (Prelude.Maybe Prelude.Text)
configurationProfile_type :: Lens' ConfigurationProfile (Maybe Text)
configurationProfile_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationProfile' {Maybe Text
type' :: Maybe Text
$sel:type':ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
type'} -> Maybe Text
type') (\s :: ConfigurationProfile
s@ConfigurationProfile' {} Maybe Text
a -> ConfigurationProfile
s {$sel:type':ConfigurationProfile' :: Maybe Text
type' = Maybe Text
a} :: ConfigurationProfile)

-- | A list of methods for validating the configuration.
configurationProfile_validators :: Lens.Lens' ConfigurationProfile (Prelude.Maybe [Validator])
configurationProfile_validators :: Lens' ConfigurationProfile (Maybe [Validator])
configurationProfile_validators = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationProfile' {Maybe [Validator]
validators :: Maybe [Validator]
$sel:validators:ConfigurationProfile' :: ConfigurationProfile -> Maybe [Validator]
validators} -> Maybe [Validator]
validators) (\s :: ConfigurationProfile
s@ConfigurationProfile' {} Maybe [Validator]
a -> ConfigurationProfile
s {$sel:validators:ConfigurationProfile' :: Maybe [Validator]
validators = Maybe [Validator]
a} :: ConfigurationProfile) 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 ConfigurationProfile where
  parseJSON :: Value -> Parser ConfigurationProfile
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConfigurationProfile"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Validator]
-> ConfigurationProfile
ConfigurationProfile'
            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
"ApplicationId")
            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
"Id")
            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
"LocationUri")
            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
"Name")
            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
"RetrievalRoleArn")
            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
"Type")
            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
"Validators" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ConfigurationProfile where
  hashWithSalt :: Int -> ConfigurationProfile -> Int
hashWithSalt Int
_salt ConfigurationProfile' {Maybe [Validator]
Maybe Text
validators :: Maybe [Validator]
type' :: Maybe Text
retrievalRoleArn :: Maybe Text
name :: Maybe Text
locationUri :: Maybe Text
id :: Maybe Text
description :: Maybe Text
applicationId :: Maybe Text
$sel:validators:ConfigurationProfile' :: ConfigurationProfile -> Maybe [Validator]
$sel:type':ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
$sel:retrievalRoleArn:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
$sel:name:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
$sel:locationUri:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
$sel:id:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
$sel:description:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
$sel:applicationId:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
applicationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
locationUri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
retrievalRoleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Validator]
validators

instance Prelude.NFData ConfigurationProfile where
  rnf :: ConfigurationProfile -> ()
rnf ConfigurationProfile' {Maybe [Validator]
Maybe Text
validators :: Maybe [Validator]
type' :: Maybe Text
retrievalRoleArn :: Maybe Text
name :: Maybe Text
locationUri :: Maybe Text
id :: Maybe Text
description :: Maybe Text
applicationId :: Maybe Text
$sel:validators:ConfigurationProfile' :: ConfigurationProfile -> Maybe [Validator]
$sel:type':ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
$sel:retrievalRoleArn:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
$sel:name:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
$sel:locationUri:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
$sel:id:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
$sel:description:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
$sel:applicationId:ConfigurationProfile' :: ConfigurationProfile -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
applicationId
      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 Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
locationUri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
retrievalRoleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Validator]
validators