{-# 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 #-}
module Amazonka.AppConfig.CreateConfigurationProfile
(
CreateConfigurationProfile (..),
newCreateConfigurationProfile,
createConfigurationProfile_retrievalRoleArn,
createConfigurationProfile_validators,
createConfigurationProfile_description,
createConfigurationProfile_tags,
createConfigurationProfile_applicationId,
createConfigurationProfile_name,
createConfigurationProfile_locationUri,
ConfigurationProfile (..),
newConfigurationProfile,
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
data CreateConfigurationProfile = CreateConfigurationProfile'
{
CreateConfigurationProfile -> Maybe Text
retrievalRoleArn :: Prelude.Maybe Prelude.Text,
CreateConfigurationProfile -> Maybe [Validator]
validators :: Prelude.Maybe [Validator],
CreateConfigurationProfile -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateConfigurationProfile -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateConfigurationProfile -> Text
applicationId :: Prelude.Text,
CreateConfigurationProfile -> Text
name :: Prelude.Text,
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)
newCreateConfigurationProfile ::
Prelude.Text ->
Prelude.Text ->
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_
}
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)
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
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)
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
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)
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)
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