{-# 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.CreateConfigurationProfile
-- 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)
--
-- Information that enables AppConfig to access the configuration source.
-- Valid configuration sources include Systems Manager (SSM) documents, SSM
-- Parameter Store parameters, and Amazon S3 objects. A configuration
-- profile includes the following information.
--
-- -   The Uri location of the configuration data.
--
-- -   The AWS Identity and Access Management (IAM) role that provides
--     access to the configuration data.
--
-- -   A validator for the configuration data. Available validators include
--     either a JSON Schema or an AWS Lambda function.
--
-- For more information, see
-- <http://docs.aws.amazon.com/systems-manager/latest/userguide/appconfig-creating-configuration-and-profile.html Create a Configuration and a Configuration Profile>
-- in the /AWS AppConfig User Guide/.
module Amazonka.AppConfig.CreateConfigurationProfile
  ( -- * Creating a Request
    CreateConfigurationProfile (..),
    newCreateConfigurationProfile,

    -- * Request Lenses
    createConfigurationProfile_retrievalRoleArn,
    createConfigurationProfile_validators,
    createConfigurationProfile_description,
    createConfigurationProfile_tags,
    createConfigurationProfile_applicationId,
    createConfigurationProfile_name,
    createConfigurationProfile_locationUri,

    -- * Destructuring the Response
    ConfigurationProfile (..),
    newConfigurationProfile,

    -- * Response Lenses
    configurationProfile_retrievalRoleArn,
    configurationProfile_validators,
    configurationProfile_locationUri,
    configurationProfile_applicationId,
    configurationProfile_name,
    configurationProfile_id,
    configurationProfile_description,
  )
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:/ 'newCreateConfigurationProfile' smart constructor.
data CreateConfigurationProfile = CreateConfigurationProfile'
  { -- | The ARN of an IAM role with permission to access the configuration at
    -- the specified LocationUri.
    CreateConfigurationProfile -> Maybe Text
retrievalRoleArn :: Prelude.Maybe Prelude.Text,
    -- | A list of methods for validating the configuration.
    CreateConfigurationProfile -> Maybe [Validator]
validators :: Prelude.Maybe [Validator],
    -- | A description of the configuration profile.
    CreateConfigurationProfile -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Metadata to assign to the configuration profile. Tags help organize and
    -- categorize your AppConfig resources. Each tag consists of a key and an
    -- optional value, both of which you define.
    CreateConfigurationProfile -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The application ID.
    CreateConfigurationProfile -> Text
applicationId :: Prelude.Text,
    -- | A name for the configuration profile.
    CreateConfigurationProfile -> Text
name :: Prelude.Text,
    -- | A URI to locate the configuration. You can specify a Systems Manager
    -- (SSM) document, an SSM Parameter Store parameter, or an Amazon S3
    -- object. For an SSM document, specify either the document name in the
    -- format @ssm-document:\/\/\<Document_name>@ or the Amazon Resource Name
    -- (ARN). For a parameter, specify either the parameter name in the format
    -- @ssm-parameter:\/\/\<Parameter_name>@ or the ARN. For an Amazon S3
    -- object, specify the URI in the following format:
    -- @s3:\/\/\<bucket>\/\<objectKey> @. Here is an example:
    -- s3:\/\/my-bucket\/my-app\/us-east-1\/my-config.json
    CreateConfigurationProfile -> Text
locationUri :: Prelude.Text
  }
  deriving (CreateConfigurationProfile -> CreateConfigurationProfile -> Bool
(CreateConfigurationProfile -> CreateConfigurationProfile -> Bool)
-> (CreateConfigurationProfile
    -> CreateConfigurationProfile -> Bool)
-> Eq CreateConfigurationProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConfigurationProfile -> CreateConfigurationProfile -> Bool
$c/= :: CreateConfigurationProfile -> CreateConfigurationProfile -> Bool
== :: CreateConfigurationProfile -> CreateConfigurationProfile -> Bool
$c== :: CreateConfigurationProfile -> CreateConfigurationProfile -> Bool
Prelude.Eq, Int -> CreateConfigurationProfile -> ShowS
[CreateConfigurationProfile] -> ShowS
CreateConfigurationProfile -> String
(Int -> CreateConfigurationProfile -> ShowS)
-> (CreateConfigurationProfile -> String)
-> ([CreateConfigurationProfile] -> ShowS)
-> Show CreateConfigurationProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConfigurationProfile] -> ShowS
$cshowList :: [CreateConfigurationProfile] -> ShowS
show :: CreateConfigurationProfile -> String
$cshow :: CreateConfigurationProfile -> String
showsPrec :: Int -> CreateConfigurationProfile -> ShowS
$cshowsPrec :: Int -> CreateConfigurationProfile -> ShowS
Prelude.Show, (forall x.
 CreateConfigurationProfile -> Rep CreateConfigurationProfile x)
-> (forall x.
    Rep CreateConfigurationProfile x -> CreateConfigurationProfile)
-> Generic CreateConfigurationProfile
forall x.
Rep CreateConfigurationProfile x -> CreateConfigurationProfile
forall x.
CreateConfigurationProfile -> Rep CreateConfigurationProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateConfigurationProfile x -> CreateConfigurationProfile
$cfrom :: forall x.
CreateConfigurationProfile -> Rep CreateConfigurationProfile x
Prelude.Generic)

-- |
-- Create a value of 'CreateConfigurationProfile' 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:
--
-- 'retrievalRoleArn', 'createConfigurationProfile_retrievalRoleArn' - The ARN of an IAM role with permission to access the configuration at
-- the specified LocationUri.
--
-- 'validators', 'createConfigurationProfile_validators' - A list of methods for validating the configuration.
--
-- 'description', 'createConfigurationProfile_description' - A description of the configuration profile.
--
-- 'tags', 'createConfigurationProfile_tags' - Metadata to assign to the configuration profile. Tags help organize and
-- categorize your AppConfig resources. Each tag consists of a key and an
-- optional value, both of which you define.
--
-- 'applicationId', 'createConfigurationProfile_applicationId' - The application ID.
--
-- 'name', 'createConfigurationProfile_name' - A name for the configuration profile.
--
-- 'locationUri', 'createConfigurationProfile_locationUri' - A URI to locate the configuration. You can specify a Systems Manager
-- (SSM) document, an SSM Parameter Store parameter, or an Amazon S3
-- object. For an SSM document, specify either the document name in the
-- format @ssm-document:\/\/\<Document_name>@ or the Amazon Resource Name
-- (ARN). For a parameter, specify either the parameter name in the format
-- @ssm-parameter:\/\/\<Parameter_name>@ or the ARN. For an Amazon S3
-- object, specify the URI in the following format:
-- @s3:\/\/\<bucket>\/\<objectKey> @. Here is an example:
-- s3:\/\/my-bucket\/my-app\/us-east-1\/my-config.json
newCreateConfigurationProfile ::
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'locationUri'
  Prelude.Text ->
  CreateConfigurationProfile
newCreateConfigurationProfile :: Text -> Text -> Text -> CreateConfigurationProfile
newCreateConfigurationProfile
  Text
pApplicationId_
  Text
pName_
  Text
pLocationUri_ =
    CreateConfigurationProfile' :: Maybe Text
-> Maybe [Validator]
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Text
-> CreateConfigurationProfile
CreateConfigurationProfile'
      { $sel:retrievalRoleArn:CreateConfigurationProfile' :: Maybe Text
retrievalRoleArn =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:validators:CreateConfigurationProfile' :: Maybe [Validator]
validators = Maybe [Validator]
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateConfigurationProfile' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateConfigurationProfile' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:applicationId:CreateConfigurationProfile' :: Text
applicationId = Text
pApplicationId_,
        $sel:name:CreateConfigurationProfile' :: Text
name = Text
pName_,
        $sel:locationUri:CreateConfigurationProfile' :: Text
locationUri = Text
pLocationUri_
      }

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

-- | A list of methods for validating the configuration.
createConfigurationProfile_validators :: Lens.Lens' CreateConfigurationProfile (Prelude.Maybe [Validator])
createConfigurationProfile_validators :: (Maybe [Validator] -> f (Maybe [Validator]))
-> CreateConfigurationProfile -> f CreateConfigurationProfile
createConfigurationProfile_validators = (CreateConfigurationProfile -> Maybe [Validator])
-> (CreateConfigurationProfile
    -> Maybe [Validator] -> CreateConfigurationProfile)
-> Lens
     CreateConfigurationProfile
     CreateConfigurationProfile
     (Maybe [Validator])
     (Maybe [Validator])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationProfile' {Maybe [Validator]
validators :: Maybe [Validator]
$sel:validators:CreateConfigurationProfile' :: CreateConfigurationProfile -> Maybe [Validator]
validators} -> Maybe [Validator]
validators) (\s :: CreateConfigurationProfile
s@CreateConfigurationProfile' {} Maybe [Validator]
a -> CreateConfigurationProfile
s {$sel:validators:CreateConfigurationProfile' :: Maybe [Validator]
validators = Maybe [Validator]
a} :: CreateConfigurationProfile) ((Maybe [Validator] -> f (Maybe [Validator]))
 -> CreateConfigurationProfile -> f CreateConfigurationProfile)
-> ((Maybe [Validator] -> f (Maybe [Validator]))
    -> Maybe [Validator] -> f (Maybe [Validator]))
-> (Maybe [Validator] -> f (Maybe [Validator]))
-> CreateConfigurationProfile
-> f CreateConfigurationProfile
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Validator] [Validator] [Validator] [Validator]
-> Iso
     (Maybe [Validator])
     (Maybe [Validator])
     (Maybe [Validator])
     (Maybe [Validator])
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 [Validator] [Validator] [Validator] [Validator]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A description of the configuration profile.
createConfigurationProfile_description :: Lens.Lens' CreateConfigurationProfile (Prelude.Maybe Prelude.Text)
createConfigurationProfile_description :: (Maybe Text -> f (Maybe Text))
-> CreateConfigurationProfile -> f CreateConfigurationProfile
createConfigurationProfile_description = (CreateConfigurationProfile -> Maybe Text)
-> (CreateConfigurationProfile
    -> Maybe Text -> CreateConfigurationProfile)
-> Lens
     CreateConfigurationProfile
     CreateConfigurationProfile
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationProfile' {Maybe Text
description :: Maybe Text
$sel:description:CreateConfigurationProfile' :: CreateConfigurationProfile -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateConfigurationProfile
s@CreateConfigurationProfile' {} Maybe Text
a -> CreateConfigurationProfile
s {$sel:description:CreateConfigurationProfile' :: Maybe Text
description = Maybe Text
a} :: CreateConfigurationProfile)

-- | Metadata to assign to the configuration profile. Tags help organize and
-- categorize your AppConfig resources. Each tag consists of a key and an
-- optional value, both of which you define.
createConfigurationProfile_tags :: Lens.Lens' CreateConfigurationProfile (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createConfigurationProfile_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateConfigurationProfile -> f CreateConfigurationProfile
createConfigurationProfile_tags = (CreateConfigurationProfile -> Maybe (HashMap Text Text))
-> (CreateConfigurationProfile
    -> Maybe (HashMap Text Text) -> CreateConfigurationProfile)
-> Lens
     CreateConfigurationProfile
     CreateConfigurationProfile
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationProfile' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateConfigurationProfile' :: CreateConfigurationProfile -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateConfigurationProfile
s@CreateConfigurationProfile' {} Maybe (HashMap Text Text)
a -> CreateConfigurationProfile
s {$sel:tags:CreateConfigurationProfile' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateConfigurationProfile) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateConfigurationProfile -> f CreateConfigurationProfile)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateConfigurationProfile
-> f CreateConfigurationProfile
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | A name for the configuration profile.
createConfigurationProfile_name :: Lens.Lens' CreateConfigurationProfile Prelude.Text
createConfigurationProfile_name :: (Text -> f Text)
-> CreateConfigurationProfile -> f CreateConfigurationProfile
createConfigurationProfile_name = (CreateConfigurationProfile -> Text)
-> (CreateConfigurationProfile
    -> Text -> CreateConfigurationProfile)
-> Lens
     CreateConfigurationProfile CreateConfigurationProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationProfile' {Text
name :: Text
$sel:name:CreateConfigurationProfile' :: CreateConfigurationProfile -> Text
name} -> Text
name) (\s :: CreateConfigurationProfile
s@CreateConfigurationProfile' {} Text
a -> CreateConfigurationProfile
s {$sel:name:CreateConfigurationProfile' :: Text
name = Text
a} :: CreateConfigurationProfile)

-- | A URI to locate the configuration. You can specify a Systems Manager
-- (SSM) document, an SSM Parameter Store parameter, or an Amazon S3
-- object. For an SSM document, specify either the document name in the
-- format @ssm-document:\/\/\<Document_name>@ or the Amazon Resource Name
-- (ARN). For a parameter, specify either the parameter name in the format
-- @ssm-parameter:\/\/\<Parameter_name>@ or the ARN. For an Amazon S3
-- object, specify the URI in the following format:
-- @s3:\/\/\<bucket>\/\<objectKey> @. Here is an example:
-- s3:\/\/my-bucket\/my-app\/us-east-1\/my-config.json
createConfigurationProfile_locationUri :: Lens.Lens' CreateConfigurationProfile Prelude.Text
createConfigurationProfile_locationUri :: (Text -> f Text)
-> CreateConfigurationProfile -> f CreateConfigurationProfile
createConfigurationProfile_locationUri = (CreateConfigurationProfile -> Text)
-> (CreateConfigurationProfile
    -> Text -> CreateConfigurationProfile)
-> Lens
     CreateConfigurationProfile CreateConfigurationProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationProfile' {Text
locationUri :: Text
$sel:locationUri:CreateConfigurationProfile' :: CreateConfigurationProfile -> Text
locationUri} -> Text
locationUri) (\s :: CreateConfigurationProfile
s@CreateConfigurationProfile' {} Text
a -> CreateConfigurationProfile
s {$sel:locationUri:CreateConfigurationProfile' :: Text
locationUri = Text
a} :: CreateConfigurationProfile)

instance Core.AWSRequest CreateConfigurationProfile where
  type
    AWSResponse CreateConfigurationProfile =
      ConfigurationProfile
  request :: CreateConfigurationProfile -> Request CreateConfigurationProfile
request = Service
-> CreateConfigurationProfile -> Request CreateConfigurationProfile
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateConfigurationProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateConfigurationProfile)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateConfigurationProfile))
-> Logger
-> Service
-> Proxy CreateConfigurationProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateConfigurationProfile)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      (\Int
s ResponseHeaders
h Object
x -> Object -> Either String ConfigurationProfile
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable CreateConfigurationProfile

instance Prelude.NFData CreateConfigurationProfile

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

instance Core.ToJSON CreateConfigurationProfile where
  toJSON :: CreateConfigurationProfile -> Value
toJSON CreateConfigurationProfile' {Maybe [Validator]
Maybe Text
Maybe (HashMap Text Text)
Text
locationUri :: Text
name :: Text
applicationId :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
validators :: Maybe [Validator]
retrievalRoleArn :: Maybe Text
$sel:locationUri:CreateConfigurationProfile' :: CreateConfigurationProfile -> Text
$sel:name:CreateConfigurationProfile' :: CreateConfigurationProfile -> Text
$sel:applicationId:CreateConfigurationProfile' :: CreateConfigurationProfile -> Text
$sel:tags:CreateConfigurationProfile' :: CreateConfigurationProfile -> Maybe (HashMap Text Text)
$sel:description:CreateConfigurationProfile' :: CreateConfigurationProfile -> Maybe Text
$sel:validators:CreateConfigurationProfile' :: CreateConfigurationProfile -> Maybe [Validator]
$sel:retrievalRoleArn:CreateConfigurationProfile' :: CreateConfigurationProfile -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RetrievalRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
retrievalRoleArn,
            (Text
"Validators" Text -> [Validator] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Validator] -> Pair) -> Maybe [Validator] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Validator]
validators,
            (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LocationUri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
locationUri)
          ]
      )

instance Core.ToPath CreateConfigurationProfile where
  toPath :: CreateConfigurationProfile -> ByteString
toPath CreateConfigurationProfile' {Maybe [Validator]
Maybe Text
Maybe (HashMap Text Text)
Text
locationUri :: Text
name :: Text
applicationId :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
validators :: Maybe [Validator]
retrievalRoleArn :: Maybe Text
$sel:locationUri:CreateConfigurationProfile' :: CreateConfigurationProfile -> Text
$sel:name:CreateConfigurationProfile' :: CreateConfigurationProfile -> Text
$sel:applicationId:CreateConfigurationProfile' :: CreateConfigurationProfile -> Text
$sel:tags:CreateConfigurationProfile' :: CreateConfigurationProfile -> Maybe (HashMap Text Text)
$sel:description:CreateConfigurationProfile' :: CreateConfigurationProfile -> Maybe Text
$sel:validators:CreateConfigurationProfile' :: CreateConfigurationProfile -> Maybe [Validator]
$sel:retrievalRoleArn:CreateConfigurationProfile' :: CreateConfigurationProfile -> Maybe 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"
      ]

instance Core.ToQuery CreateConfigurationProfile where
  toQuery :: CreateConfigurationProfile -> QueryString
toQuery = QueryString -> CreateConfigurationProfile -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty