{-# 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.ResilienceHub.CreateApp
(
CreateApp (..),
newCreateApp,
createApp_assessmentSchedule,
createApp_clientToken,
createApp_description,
createApp_policyArn,
createApp_tags,
createApp_name,
CreateAppResponse (..),
newCreateAppResponse,
createAppResponse_httpStatus,
createAppResponse_app,
)
where
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
import qualified Amazonka.Request as Request
import Amazonka.ResilienceHub.Types
import qualified Amazonka.Response as Response
data CreateApp = CreateApp'
{
CreateApp -> Maybe AppAssessmentScheduleType
assessmentSchedule :: Prelude.Maybe AppAssessmentScheduleType,
CreateApp -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreateApp -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateApp -> Maybe Text
policyArn :: Prelude.Maybe Prelude.Text,
CreateApp -> Maybe (Sensitive (HashMap Text Text))
tags :: Prelude.Maybe (Data.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)),
CreateApp -> Text
name :: Prelude.Text
}
deriving (CreateApp -> CreateApp -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateApp -> CreateApp -> Bool
$c/= :: CreateApp -> CreateApp -> Bool
== :: CreateApp -> CreateApp -> Bool
$c== :: CreateApp -> CreateApp -> Bool
Prelude.Eq, Int -> CreateApp -> ShowS
[CreateApp] -> ShowS
CreateApp -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateApp] -> ShowS
$cshowList :: [CreateApp] -> ShowS
show :: CreateApp -> String
$cshow :: CreateApp -> String
showsPrec :: Int -> CreateApp -> ShowS
$cshowsPrec :: Int -> CreateApp -> ShowS
Prelude.Show, forall x. Rep CreateApp x -> CreateApp
forall x. CreateApp -> Rep CreateApp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateApp x -> CreateApp
$cfrom :: forall x. CreateApp -> Rep CreateApp x
Prelude.Generic)
newCreateApp ::
Prelude.Text ->
CreateApp
newCreateApp :: Text -> CreateApp
newCreateApp Text
pName_ =
CreateApp'
{ $sel:assessmentSchedule:CreateApp' :: Maybe AppAssessmentScheduleType
assessmentSchedule = forall a. Maybe a
Prelude.Nothing,
$sel:clientToken:CreateApp' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateApp' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:policyArn:CreateApp' :: Maybe Text
policyArn = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateApp' :: Maybe (Sensitive (HashMap Text Text))
tags = forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateApp' :: Text
name = Text
pName_
}
createApp_assessmentSchedule :: Lens.Lens' CreateApp (Prelude.Maybe AppAssessmentScheduleType)
createApp_assessmentSchedule :: Lens' CreateApp (Maybe AppAssessmentScheduleType)
createApp_assessmentSchedule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe AppAssessmentScheduleType
assessmentSchedule :: Maybe AppAssessmentScheduleType
$sel:assessmentSchedule:CreateApp' :: CreateApp -> Maybe AppAssessmentScheduleType
assessmentSchedule} -> Maybe AppAssessmentScheduleType
assessmentSchedule) (\s :: CreateApp
s@CreateApp' {} Maybe AppAssessmentScheduleType
a -> CreateApp
s {$sel:assessmentSchedule:CreateApp' :: Maybe AppAssessmentScheduleType
assessmentSchedule = Maybe AppAssessmentScheduleType
a} :: CreateApp)
createApp_clientToken :: Lens.Lens' CreateApp (Prelude.Maybe Prelude.Text)
createApp_clientToken :: Lens' CreateApp (Maybe Text)
createApp_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateApp' :: CreateApp -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateApp
s@CreateApp' {} Maybe Text
a -> CreateApp
s {$sel:clientToken:CreateApp' :: Maybe Text
clientToken = Maybe Text
a} :: CreateApp)
createApp_description :: Lens.Lens' CreateApp (Prelude.Maybe Prelude.Text)
createApp_description :: Lens' CreateApp (Maybe Text)
createApp_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe Text
description :: Maybe Text
$sel:description:CreateApp' :: CreateApp -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateApp
s@CreateApp' {} Maybe Text
a -> CreateApp
s {$sel:description:CreateApp' :: Maybe Text
description = Maybe Text
a} :: CreateApp)
createApp_policyArn :: Lens.Lens' CreateApp (Prelude.Maybe Prelude.Text)
createApp_policyArn :: Lens' CreateApp (Maybe Text)
createApp_policyArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe Text
policyArn :: Maybe Text
$sel:policyArn:CreateApp' :: CreateApp -> Maybe Text
policyArn} -> Maybe Text
policyArn) (\s :: CreateApp
s@CreateApp' {} Maybe Text
a -> CreateApp
s {$sel:policyArn:CreateApp' :: Maybe Text
policyArn = Maybe Text
a} :: CreateApp)
createApp_tags :: Lens.Lens' CreateApp (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createApp_tags :: Lens' CreateApp (Maybe (HashMap Text Text))
createApp_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Maybe (Sensitive (HashMap Text Text))
tags :: Maybe (Sensitive (HashMap Text Text))
$sel:tags:CreateApp' :: CreateApp -> Maybe (Sensitive (HashMap Text Text))
tags} -> Maybe (Sensitive (HashMap Text Text))
tags) (\s :: CreateApp
s@CreateApp' {} Maybe (Sensitive (HashMap Text Text))
a -> CreateApp
s {$sel:tags:CreateApp' :: Maybe (Sensitive (HashMap Text Text))
tags = Maybe (Sensitive (HashMap Text Text))
a} :: CreateApp) 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 a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)
createApp_name :: Lens.Lens' CreateApp Prelude.Text
createApp_name :: Lens' CreateApp Text
createApp_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApp' {Text
name :: Text
$sel:name:CreateApp' :: CreateApp -> Text
name} -> Text
name) (\s :: CreateApp
s@CreateApp' {} Text
a -> CreateApp
s {$sel:name:CreateApp' :: Text
name = Text
a} :: CreateApp)
instance Core.AWSRequest CreateApp where
type AWSResponse CreateApp = CreateAppResponse
request :: (Service -> Service) -> CreateApp -> Request CreateApp
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateApp
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateApp)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> App -> CreateAppResponse
CreateAppResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"app")
)
instance Prelude.Hashable CreateApp where
hashWithSalt :: Int -> CreateApp -> Int
hashWithSalt Int
_salt CreateApp' {Maybe Text
Maybe (Sensitive (HashMap Text Text))
Maybe AppAssessmentScheduleType
Text
name :: Text
tags :: Maybe (Sensitive (HashMap Text Text))
policyArn :: Maybe Text
description :: Maybe Text
clientToken :: Maybe Text
assessmentSchedule :: Maybe AppAssessmentScheduleType
$sel:name:CreateApp' :: CreateApp -> Text
$sel:tags:CreateApp' :: CreateApp -> Maybe (Sensitive (HashMap Text Text))
$sel:policyArn:CreateApp' :: CreateApp -> Maybe Text
$sel:description:CreateApp' :: CreateApp -> Maybe Text
$sel:clientToken:CreateApp' :: CreateApp -> Maybe Text
$sel:assessmentSchedule:CreateApp' :: CreateApp -> Maybe AppAssessmentScheduleType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AppAssessmentScheduleType
assessmentSchedule
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
policyArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive (HashMap Text Text))
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData CreateApp where
rnf :: CreateApp -> ()
rnf CreateApp' {Maybe Text
Maybe (Sensitive (HashMap Text Text))
Maybe AppAssessmentScheduleType
Text
name :: Text
tags :: Maybe (Sensitive (HashMap Text Text))
policyArn :: Maybe Text
description :: Maybe Text
clientToken :: Maybe Text
assessmentSchedule :: Maybe AppAssessmentScheduleType
$sel:name:CreateApp' :: CreateApp -> Text
$sel:tags:CreateApp' :: CreateApp -> Maybe (Sensitive (HashMap Text Text))
$sel:policyArn:CreateApp' :: CreateApp -> Maybe Text
$sel:description:CreateApp' :: CreateApp -> Maybe Text
$sel:clientToken:CreateApp' :: CreateApp -> Maybe Text
$sel:assessmentSchedule:CreateApp' :: CreateApp -> Maybe AppAssessmentScheduleType
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe AppAssessmentScheduleType
assessmentSchedule
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
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
policyArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive (HashMap Text Text))
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToHeaders CreateApp where
toHeaders :: CreateApp -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateApp where
toJSON :: CreateApp -> Value
toJSON CreateApp' {Maybe Text
Maybe (Sensitive (HashMap Text Text))
Maybe AppAssessmentScheduleType
Text
name :: Text
tags :: Maybe (Sensitive (HashMap Text Text))
policyArn :: Maybe Text
description :: Maybe Text
clientToken :: Maybe Text
assessmentSchedule :: Maybe AppAssessmentScheduleType
$sel:name:CreateApp' :: CreateApp -> Text
$sel:tags:CreateApp' :: CreateApp -> Maybe (Sensitive (HashMap Text Text))
$sel:policyArn:CreateApp' :: CreateApp -> Maybe Text
$sel:description:CreateApp' :: CreateApp -> Maybe Text
$sel:clientToken:CreateApp' :: CreateApp -> Maybe Text
$sel:assessmentSchedule:CreateApp' :: CreateApp -> Maybe AppAssessmentScheduleType
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"assessmentSchedule" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AppAssessmentScheduleType
assessmentSchedule,
(Key
"clientToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
(Key
"description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Key
"policyArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
policyArn,
(Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive (HashMap Text Text))
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
]
)
instance Data.ToPath CreateApp where
toPath :: CreateApp -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/create-app"
instance Data.ToQuery CreateApp where
toQuery :: CreateApp -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateAppResponse = CreateAppResponse'
{
CreateAppResponse -> Int
httpStatus :: Prelude.Int,
CreateAppResponse -> App
app :: App
}
deriving (CreateAppResponse -> CreateAppResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAppResponse -> CreateAppResponse -> Bool
$c/= :: CreateAppResponse -> CreateAppResponse -> Bool
== :: CreateAppResponse -> CreateAppResponse -> Bool
$c== :: CreateAppResponse -> CreateAppResponse -> Bool
Prelude.Eq, Int -> CreateAppResponse -> ShowS
[CreateAppResponse] -> ShowS
CreateAppResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAppResponse] -> ShowS
$cshowList :: [CreateAppResponse] -> ShowS
show :: CreateAppResponse -> String
$cshow :: CreateAppResponse -> String
showsPrec :: Int -> CreateAppResponse -> ShowS
$cshowsPrec :: Int -> CreateAppResponse -> ShowS
Prelude.Show, forall x. Rep CreateAppResponse x -> CreateAppResponse
forall x. CreateAppResponse -> Rep CreateAppResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAppResponse x -> CreateAppResponse
$cfrom :: forall x. CreateAppResponse -> Rep CreateAppResponse x
Prelude.Generic)
newCreateAppResponse ::
Prelude.Int ->
App ->
CreateAppResponse
newCreateAppResponse :: Int -> App -> CreateAppResponse
newCreateAppResponse Int
pHttpStatus_ App
pApp_ =
CreateAppResponse'
{ $sel:httpStatus:CreateAppResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:app:CreateAppResponse' :: App
app = App
pApp_
}
createAppResponse_httpStatus :: Lens.Lens' CreateAppResponse Prelude.Int
createAppResponse_httpStatus :: Lens' CreateAppResponse Int
createAppResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAppResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateAppResponse' :: CreateAppResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateAppResponse
s@CreateAppResponse' {} Int
a -> CreateAppResponse
s {$sel:httpStatus:CreateAppResponse' :: Int
httpStatus = Int
a} :: CreateAppResponse)
createAppResponse_app :: Lens.Lens' CreateAppResponse App
createAppResponse_app :: Lens' CreateAppResponse App
createAppResponse_app = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAppResponse' {App
app :: App
$sel:app:CreateAppResponse' :: CreateAppResponse -> App
app} -> App
app) (\s :: CreateAppResponse
s@CreateAppResponse' {} App
a -> CreateAppResponse
s {$sel:app:CreateAppResponse' :: App
app = App
a} :: CreateAppResponse)
instance Prelude.NFData CreateAppResponse where
rnf :: CreateAppResponse -> ()
rnf CreateAppResponse' {Int
App
app :: App
httpStatus :: Int
$sel:app:CreateAppResponse' :: CreateAppResponse -> App
$sel:httpStatus:CreateAppResponse' :: CreateAppResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf App
app