{-# 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.Pinpoint.Types.CreateApplicationRequest
-- 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.Pinpoint.Types.CreateApplicationRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies the display name of an application and the tags to associate
-- with the application.
--
-- /See:/ 'newCreateApplicationRequest' smart constructor.
data CreateApplicationRequest = CreateApplicationRequest'
  { -- | A string-to-string map of key-value pairs that defines the tags to
    -- associate with the application. Each tag consists of a required tag key
    -- and an associated tag value.
    CreateApplicationRequest -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The display name of the application. This name is displayed as the
    -- __Project name__ on the Amazon Pinpoint console.
    CreateApplicationRequest -> Text
name :: Prelude.Text
  }
  deriving (CreateApplicationRequest -> CreateApplicationRequest -> Bool
(CreateApplicationRequest -> CreateApplicationRequest -> Bool)
-> (CreateApplicationRequest -> CreateApplicationRequest -> Bool)
-> Eq CreateApplicationRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateApplicationRequest -> CreateApplicationRequest -> Bool
$c/= :: CreateApplicationRequest -> CreateApplicationRequest -> Bool
== :: CreateApplicationRequest -> CreateApplicationRequest -> Bool
$c== :: CreateApplicationRequest -> CreateApplicationRequest -> Bool
Prelude.Eq, ReadPrec [CreateApplicationRequest]
ReadPrec CreateApplicationRequest
Int -> ReadS CreateApplicationRequest
ReadS [CreateApplicationRequest]
(Int -> ReadS CreateApplicationRequest)
-> ReadS [CreateApplicationRequest]
-> ReadPrec CreateApplicationRequest
-> ReadPrec [CreateApplicationRequest]
-> Read CreateApplicationRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateApplicationRequest]
$creadListPrec :: ReadPrec [CreateApplicationRequest]
readPrec :: ReadPrec CreateApplicationRequest
$creadPrec :: ReadPrec CreateApplicationRequest
readList :: ReadS [CreateApplicationRequest]
$creadList :: ReadS [CreateApplicationRequest]
readsPrec :: Int -> ReadS CreateApplicationRequest
$creadsPrec :: Int -> ReadS CreateApplicationRequest
Prelude.Read, Int -> CreateApplicationRequest -> ShowS
[CreateApplicationRequest] -> ShowS
CreateApplicationRequest -> String
(Int -> CreateApplicationRequest -> ShowS)
-> (CreateApplicationRequest -> String)
-> ([CreateApplicationRequest] -> ShowS)
-> Show CreateApplicationRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateApplicationRequest] -> ShowS
$cshowList :: [CreateApplicationRequest] -> ShowS
show :: CreateApplicationRequest -> String
$cshow :: CreateApplicationRequest -> String
showsPrec :: Int -> CreateApplicationRequest -> ShowS
$cshowsPrec :: Int -> CreateApplicationRequest -> ShowS
Prelude.Show, (forall x.
 CreateApplicationRequest -> Rep CreateApplicationRequest x)
-> (forall x.
    Rep CreateApplicationRequest x -> CreateApplicationRequest)
-> Generic CreateApplicationRequest
forall x.
Rep CreateApplicationRequest x -> CreateApplicationRequest
forall x.
CreateApplicationRequest -> Rep CreateApplicationRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateApplicationRequest x -> CreateApplicationRequest
$cfrom :: forall x.
CreateApplicationRequest -> Rep CreateApplicationRequest x
Prelude.Generic)

-- |
-- Create a value of 'CreateApplicationRequest' 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:
--
-- 'tags', 'createApplicationRequest_tags' - A string-to-string map of key-value pairs that defines the tags to
-- associate with the application. Each tag consists of a required tag key
-- and an associated tag value.
--
-- 'name', 'createApplicationRequest_name' - The display name of the application. This name is displayed as the
-- __Project name__ on the Amazon Pinpoint console.
newCreateApplicationRequest ::
  -- | 'name'
  Prelude.Text ->
  CreateApplicationRequest
newCreateApplicationRequest :: Text -> CreateApplicationRequest
newCreateApplicationRequest Text
pName_ =
  CreateApplicationRequest' :: Maybe (HashMap Text Text) -> Text -> CreateApplicationRequest
CreateApplicationRequest'
    { $sel:tags:CreateApplicationRequest' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateApplicationRequest' :: Text
name = Text
pName_
    }

-- | A string-to-string map of key-value pairs that defines the tags to
-- associate with the application. Each tag consists of a required tag key
-- and an associated tag value.
createApplicationRequest_tags :: Lens.Lens' CreateApplicationRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createApplicationRequest_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateApplicationRequest -> f CreateApplicationRequest
createApplicationRequest_tags = (CreateApplicationRequest -> Maybe (HashMap Text Text))
-> (CreateApplicationRequest
    -> Maybe (HashMap Text Text) -> CreateApplicationRequest)
-> Lens
     CreateApplicationRequest
     CreateApplicationRequest
     (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 (\CreateApplicationRequest' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateApplicationRequest' :: CreateApplicationRequest -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateApplicationRequest
s@CreateApplicationRequest' {} Maybe (HashMap Text Text)
a -> CreateApplicationRequest
s {$sel:tags:CreateApplicationRequest' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateApplicationRequest) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateApplicationRequest -> f CreateApplicationRequest)
-> ((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)))
-> CreateApplicationRequest
-> f CreateApplicationRequest
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 display name of the application. This name is displayed as the
-- __Project name__ on the Amazon Pinpoint console.
createApplicationRequest_name :: Lens.Lens' CreateApplicationRequest Prelude.Text
createApplicationRequest_name :: (Text -> f Text)
-> CreateApplicationRequest -> f CreateApplicationRequest
createApplicationRequest_name = (CreateApplicationRequest -> Text)
-> (CreateApplicationRequest -> Text -> CreateApplicationRequest)
-> Lens CreateApplicationRequest CreateApplicationRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationRequest' {Text
name :: Text
$sel:name:CreateApplicationRequest' :: CreateApplicationRequest -> Text
name} -> Text
name) (\s :: CreateApplicationRequest
s@CreateApplicationRequest' {} Text
a -> CreateApplicationRequest
s {$sel:name:CreateApplicationRequest' :: Text
name = Text
a} :: CreateApplicationRequest)

instance Prelude.Hashable CreateApplicationRequest

instance Prelude.NFData CreateApplicationRequest

instance Core.ToJSON CreateApplicationRequest where
  toJSON :: CreateApplicationRequest -> Value
toJSON CreateApplicationRequest' {Maybe (HashMap Text Text)
Text
name :: Text
tags :: Maybe (HashMap Text Text)
$sel:name:CreateApplicationRequest' :: CreateApplicationRequest -> Text
$sel:tags:CreateApplicationRequest' :: CreateApplicationRequest -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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)
          ]
      )