{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.ValidateConfiguration
-- 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)
--
-- Uses the validators in a configuration profile to validate a
-- configuration.
module Amazonka.AppConfig.ValidateConfiguration
  ( -- * Creating a Request
    ValidateConfiguration (..),
    newValidateConfiguration,

    -- * Request Lenses
    validateConfiguration_applicationId,
    validateConfiguration_configurationProfileId,
    validateConfiguration_configurationVersion,

    -- * Destructuring the Response
    ValidateConfigurationResponse (..),
    newValidateConfigurationResponse,
  )
where

import Amazonka.AppConfig.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newValidateConfiguration' smart constructor.
data ValidateConfiguration = ValidateConfiguration'
  { -- | The application ID.
    ValidateConfiguration -> Text
applicationId :: Prelude.Text,
    -- | The configuration profile ID.
    ValidateConfiguration -> Text
configurationProfileId :: Prelude.Text,
    -- | The version of the configuration to validate.
    ValidateConfiguration -> Text
configurationVersion :: Prelude.Text
  }
  deriving (ValidateConfiguration -> ValidateConfiguration -> Bool
(ValidateConfiguration -> ValidateConfiguration -> Bool)
-> (ValidateConfiguration -> ValidateConfiguration -> Bool)
-> Eq ValidateConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValidateConfiguration -> ValidateConfiguration -> Bool
$c/= :: ValidateConfiguration -> ValidateConfiguration -> Bool
== :: ValidateConfiguration -> ValidateConfiguration -> Bool
$c== :: ValidateConfiguration -> ValidateConfiguration -> Bool
Prelude.Eq, ReadPrec [ValidateConfiguration]
ReadPrec ValidateConfiguration
Int -> ReadS ValidateConfiguration
ReadS [ValidateConfiguration]
(Int -> ReadS ValidateConfiguration)
-> ReadS [ValidateConfiguration]
-> ReadPrec ValidateConfiguration
-> ReadPrec [ValidateConfiguration]
-> Read ValidateConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ValidateConfiguration]
$creadListPrec :: ReadPrec [ValidateConfiguration]
readPrec :: ReadPrec ValidateConfiguration
$creadPrec :: ReadPrec ValidateConfiguration
readList :: ReadS [ValidateConfiguration]
$creadList :: ReadS [ValidateConfiguration]
readsPrec :: Int -> ReadS ValidateConfiguration
$creadsPrec :: Int -> ReadS ValidateConfiguration
Prelude.Read, Int -> ValidateConfiguration -> ShowS
[ValidateConfiguration] -> ShowS
ValidateConfiguration -> String
(Int -> ValidateConfiguration -> ShowS)
-> (ValidateConfiguration -> String)
-> ([ValidateConfiguration] -> ShowS)
-> Show ValidateConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ValidateConfiguration] -> ShowS
$cshowList :: [ValidateConfiguration] -> ShowS
show :: ValidateConfiguration -> String
$cshow :: ValidateConfiguration -> String
showsPrec :: Int -> ValidateConfiguration -> ShowS
$cshowsPrec :: Int -> ValidateConfiguration -> ShowS
Prelude.Show, (forall x. ValidateConfiguration -> Rep ValidateConfiguration x)
-> (forall x. Rep ValidateConfiguration x -> ValidateConfiguration)
-> Generic ValidateConfiguration
forall x. Rep ValidateConfiguration x -> ValidateConfiguration
forall x. ValidateConfiguration -> Rep ValidateConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ValidateConfiguration x -> ValidateConfiguration
$cfrom :: forall x. ValidateConfiguration -> Rep ValidateConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ValidateConfiguration' 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', 'validateConfiguration_applicationId' - The application ID.
--
-- 'configurationProfileId', 'validateConfiguration_configurationProfileId' - The configuration profile ID.
--
-- 'configurationVersion', 'validateConfiguration_configurationVersion' - The version of the configuration to validate.
newValidateConfiguration ::
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'configurationProfileId'
  Prelude.Text ->
  -- | 'configurationVersion'
  Prelude.Text ->
  ValidateConfiguration
newValidateConfiguration :: Text -> Text -> Text -> ValidateConfiguration
newValidateConfiguration
  Text
pApplicationId_
  Text
pConfigurationProfileId_
  Text
pConfigurationVersion_ =
    ValidateConfiguration' :: Text -> Text -> Text -> ValidateConfiguration
ValidateConfiguration'
      { $sel:applicationId:ValidateConfiguration' :: Text
applicationId =
          Text
pApplicationId_,
        $sel:configurationProfileId:ValidateConfiguration' :: Text
configurationProfileId = Text
pConfigurationProfileId_,
        $sel:configurationVersion:ValidateConfiguration' :: Text
configurationVersion = Text
pConfigurationVersion_
      }

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

-- | The configuration profile ID.
validateConfiguration_configurationProfileId :: Lens.Lens' ValidateConfiguration Prelude.Text
validateConfiguration_configurationProfileId :: (Text -> f Text)
-> ValidateConfiguration -> f ValidateConfiguration
validateConfiguration_configurationProfileId = (ValidateConfiguration -> Text)
-> (ValidateConfiguration -> Text -> ValidateConfiguration)
-> Lens ValidateConfiguration ValidateConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidateConfiguration' {Text
configurationProfileId :: Text
$sel:configurationProfileId:ValidateConfiguration' :: ValidateConfiguration -> Text
configurationProfileId} -> Text
configurationProfileId) (\s :: ValidateConfiguration
s@ValidateConfiguration' {} Text
a -> ValidateConfiguration
s {$sel:configurationProfileId:ValidateConfiguration' :: Text
configurationProfileId = Text
a} :: ValidateConfiguration)

-- | The version of the configuration to validate.
validateConfiguration_configurationVersion :: Lens.Lens' ValidateConfiguration Prelude.Text
validateConfiguration_configurationVersion :: (Text -> f Text)
-> ValidateConfiguration -> f ValidateConfiguration
validateConfiguration_configurationVersion = (ValidateConfiguration -> Text)
-> (ValidateConfiguration -> Text -> ValidateConfiguration)
-> Lens ValidateConfiguration ValidateConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidateConfiguration' {Text
configurationVersion :: Text
$sel:configurationVersion:ValidateConfiguration' :: ValidateConfiguration -> Text
configurationVersion} -> Text
configurationVersion) (\s :: ValidateConfiguration
s@ValidateConfiguration' {} Text
a -> ValidateConfiguration
s {$sel:configurationVersion:ValidateConfiguration' :: Text
configurationVersion = Text
a} :: ValidateConfiguration)

instance Core.AWSRequest ValidateConfiguration where
  type
    AWSResponse ValidateConfiguration =
      ValidateConfigurationResponse
  request :: ValidateConfiguration -> Request ValidateConfiguration
request = Service -> ValidateConfiguration -> Request ValidateConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ValidateConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ValidateConfiguration)))
response =
    AWSResponse ValidateConfiguration
-> Logger
-> Service
-> Proxy ValidateConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ValidateConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse ValidateConfiguration
ValidateConfigurationResponse
ValidateConfigurationResponse'

instance Prelude.Hashable ValidateConfiguration

instance Prelude.NFData ValidateConfiguration

instance Core.ToHeaders ValidateConfiguration where
  toHeaders :: ValidateConfiguration -> [Header]
toHeaders =
    [Header] -> ValidateConfiguration -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ValidateConfiguration where
  toJSON :: ValidateConfiguration -> Value
toJSON = Value -> ValidateConfiguration -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

instance Core.ToPath ValidateConfiguration where
  toPath :: ValidateConfiguration -> ByteString
toPath ValidateConfiguration' {Text
configurationVersion :: Text
configurationProfileId :: Text
applicationId :: Text
$sel:configurationVersion:ValidateConfiguration' :: ValidateConfiguration -> Text
$sel:configurationProfileId:ValidateConfiguration' :: ValidateConfiguration -> Text
$sel:applicationId:ValidateConfiguration' :: ValidateConfiguration -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/applications/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
        ByteString
"/configurationprofiles/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
configurationProfileId,
        ByteString
"/validators"
      ]

instance Core.ToQuery ValidateConfiguration where
  toQuery :: ValidateConfiguration -> QueryString
toQuery ValidateConfiguration' {Text
configurationVersion :: Text
configurationProfileId :: Text
applicationId :: Text
$sel:configurationVersion:ValidateConfiguration' :: ValidateConfiguration -> Text
$sel:configurationProfileId:ValidateConfiguration' :: ValidateConfiguration -> Text
$sel:applicationId:ValidateConfiguration' :: ValidateConfiguration -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"configuration_version"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
configurationVersion
      ]

-- | /See:/ 'newValidateConfigurationResponse' smart constructor.
data ValidateConfigurationResponse = ValidateConfigurationResponse'
  {
  }
  deriving (ValidateConfigurationResponse
-> ValidateConfigurationResponse -> Bool
(ValidateConfigurationResponse
 -> ValidateConfigurationResponse -> Bool)
-> (ValidateConfigurationResponse
    -> ValidateConfigurationResponse -> Bool)
-> Eq ValidateConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValidateConfigurationResponse
-> ValidateConfigurationResponse -> Bool
$c/= :: ValidateConfigurationResponse
-> ValidateConfigurationResponse -> Bool
== :: ValidateConfigurationResponse
-> ValidateConfigurationResponse -> Bool
$c== :: ValidateConfigurationResponse
-> ValidateConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [ValidateConfigurationResponse]
ReadPrec ValidateConfigurationResponse
Int -> ReadS ValidateConfigurationResponse
ReadS [ValidateConfigurationResponse]
(Int -> ReadS ValidateConfigurationResponse)
-> ReadS [ValidateConfigurationResponse]
-> ReadPrec ValidateConfigurationResponse
-> ReadPrec [ValidateConfigurationResponse]
-> Read ValidateConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ValidateConfigurationResponse]
$creadListPrec :: ReadPrec [ValidateConfigurationResponse]
readPrec :: ReadPrec ValidateConfigurationResponse
$creadPrec :: ReadPrec ValidateConfigurationResponse
readList :: ReadS [ValidateConfigurationResponse]
$creadList :: ReadS [ValidateConfigurationResponse]
readsPrec :: Int -> ReadS ValidateConfigurationResponse
$creadsPrec :: Int -> ReadS ValidateConfigurationResponse
Prelude.Read, Int -> ValidateConfigurationResponse -> ShowS
[ValidateConfigurationResponse] -> ShowS
ValidateConfigurationResponse -> String
(Int -> ValidateConfigurationResponse -> ShowS)
-> (ValidateConfigurationResponse -> String)
-> ([ValidateConfigurationResponse] -> ShowS)
-> Show ValidateConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ValidateConfigurationResponse] -> ShowS
$cshowList :: [ValidateConfigurationResponse] -> ShowS
show :: ValidateConfigurationResponse -> String
$cshow :: ValidateConfigurationResponse -> String
showsPrec :: Int -> ValidateConfigurationResponse -> ShowS
$cshowsPrec :: Int -> ValidateConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 ValidateConfigurationResponse
 -> Rep ValidateConfigurationResponse x)
-> (forall x.
    Rep ValidateConfigurationResponse x
    -> ValidateConfigurationResponse)
-> Generic ValidateConfigurationResponse
forall x.
Rep ValidateConfigurationResponse x
-> ValidateConfigurationResponse
forall x.
ValidateConfigurationResponse
-> Rep ValidateConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ValidateConfigurationResponse x
-> ValidateConfigurationResponse
$cfrom :: forall x.
ValidateConfigurationResponse
-> Rep ValidateConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'ValidateConfigurationResponse' 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.
newValidateConfigurationResponse ::
  ValidateConfigurationResponse
newValidateConfigurationResponse :: ValidateConfigurationResponse
newValidateConfigurationResponse =
  ValidateConfigurationResponse
ValidateConfigurationResponse'

instance Prelude.NFData ValidateConfigurationResponse