{-# 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.SSMContacts.CreateContact
(
CreateContact (..),
newCreateContact,
createContact_displayName,
createContact_idempotencyToken,
createContact_tags,
createContact_alias,
createContact_type,
createContact_plan,
CreateContactResponse (..),
newCreateContactResponse,
createContactResponse_httpStatus,
createContactResponse_contactArn,
)
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 qualified Amazonka.Response as Response
import Amazonka.SSMContacts.Types
data CreateContact = CreateContact'
{
CreateContact -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
CreateContact -> Maybe Text
idempotencyToken :: Prelude.Maybe Prelude.Text,
CreateContact -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateContact -> Text
alias :: Prelude.Text,
CreateContact -> ContactType
type' :: ContactType,
CreateContact -> Plan
plan :: Plan
}
deriving (CreateContact -> CreateContact -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateContact -> CreateContact -> Bool
$c/= :: CreateContact -> CreateContact -> Bool
== :: CreateContact -> CreateContact -> Bool
$c== :: CreateContact -> CreateContact -> Bool
Prelude.Eq, ReadPrec [CreateContact]
ReadPrec CreateContact
Int -> ReadS CreateContact
ReadS [CreateContact]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateContact]
$creadListPrec :: ReadPrec [CreateContact]
readPrec :: ReadPrec CreateContact
$creadPrec :: ReadPrec CreateContact
readList :: ReadS [CreateContact]
$creadList :: ReadS [CreateContact]
readsPrec :: Int -> ReadS CreateContact
$creadsPrec :: Int -> ReadS CreateContact
Prelude.Read, Int -> CreateContact -> ShowS
[CreateContact] -> ShowS
CreateContact -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateContact] -> ShowS
$cshowList :: [CreateContact] -> ShowS
show :: CreateContact -> String
$cshow :: CreateContact -> String
showsPrec :: Int -> CreateContact -> ShowS
$cshowsPrec :: Int -> CreateContact -> ShowS
Prelude.Show, forall x. Rep CreateContact x -> CreateContact
forall x. CreateContact -> Rep CreateContact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateContact x -> CreateContact
$cfrom :: forall x. CreateContact -> Rep CreateContact x
Prelude.Generic)
newCreateContact ::
Prelude.Text ->
ContactType ->
Plan ->
CreateContact
newCreateContact :: Text -> ContactType -> Plan -> CreateContact
newCreateContact Text
pAlias_ ContactType
pType_ Plan
pPlan_ =
CreateContact'
{ $sel:displayName:CreateContact' :: Maybe Text
displayName = forall a. Maybe a
Prelude.Nothing,
$sel:idempotencyToken:CreateContact' :: Maybe Text
idempotencyToken = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateContact' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:alias:CreateContact' :: Text
alias = Text
pAlias_,
$sel:type':CreateContact' :: ContactType
type' = ContactType
pType_,
$sel:plan:CreateContact' :: Plan
plan = Plan
pPlan_
}
createContact_displayName :: Lens.Lens' CreateContact (Prelude.Maybe Prelude.Text)
createContact_displayName :: Lens' CreateContact (Maybe Text)
createContact_displayName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {Maybe Text
displayName :: Maybe Text
$sel:displayName:CreateContact' :: CreateContact -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: CreateContact
s@CreateContact' {} Maybe Text
a -> CreateContact
s {$sel:displayName:CreateContact' :: Maybe Text
displayName = Maybe Text
a} :: CreateContact)
createContact_idempotencyToken :: Lens.Lens' CreateContact (Prelude.Maybe Prelude.Text)
createContact_idempotencyToken :: Lens' CreateContact (Maybe Text)
createContact_idempotencyToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {Maybe Text
idempotencyToken :: Maybe Text
$sel:idempotencyToken:CreateContact' :: CreateContact -> Maybe Text
idempotencyToken} -> Maybe Text
idempotencyToken) (\s :: CreateContact
s@CreateContact' {} Maybe Text
a -> CreateContact
s {$sel:idempotencyToken:CreateContact' :: Maybe Text
idempotencyToken = Maybe Text
a} :: CreateContact)
createContact_tags :: Lens.Lens' CreateContact (Prelude.Maybe [Tag])
createContact_tags :: Lens' CreateContact (Maybe [Tag])
createContact_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateContact' :: CreateContact -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateContact
s@CreateContact' {} Maybe [Tag]
a -> CreateContact
s {$sel:tags:CreateContact' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateContact) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createContact_alias :: Lens.Lens' CreateContact Prelude.Text
createContact_alias :: Lens' CreateContact Text
createContact_alias = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {Text
alias :: Text
$sel:alias:CreateContact' :: CreateContact -> Text
alias} -> Text
alias) (\s :: CreateContact
s@CreateContact' {} Text
a -> CreateContact
s {$sel:alias:CreateContact' :: Text
alias = Text
a} :: CreateContact)
createContact_type :: Lens.Lens' CreateContact ContactType
createContact_type :: Lens' CreateContact ContactType
createContact_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {ContactType
type' :: ContactType
$sel:type':CreateContact' :: CreateContact -> ContactType
type'} -> ContactType
type') (\s :: CreateContact
s@CreateContact' {} ContactType
a -> CreateContact
s {$sel:type':CreateContact' :: ContactType
type' = ContactType
a} :: CreateContact)
createContact_plan :: Lens.Lens' CreateContact Plan
createContact_plan :: Lens' CreateContact Plan
createContact_plan = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {Plan
plan :: Plan
$sel:plan:CreateContact' :: CreateContact -> Plan
plan} -> Plan
plan) (\s :: CreateContact
s@CreateContact' {} Plan
a -> CreateContact
s {$sel:plan:CreateContact' :: Plan
plan = Plan
a} :: CreateContact)
instance Core.AWSRequest CreateContact where
type
AWSResponse CreateContact =
CreateContactResponse
request :: (Service -> Service) -> CreateContact -> Request CreateContact
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 CreateContact
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateContact)))
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 -> Text -> CreateContactResponse
CreateContactResponse'
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
"ContactArn")
)
instance Prelude.Hashable CreateContact where
hashWithSalt :: Int -> CreateContact -> Int
hashWithSalt Int
_salt CreateContact' {Maybe [Tag]
Maybe Text
Text
ContactType
Plan
plan :: Plan
type' :: ContactType
alias :: Text
tags :: Maybe [Tag]
idempotencyToken :: Maybe Text
displayName :: Maybe Text
$sel:plan:CreateContact' :: CreateContact -> Plan
$sel:type':CreateContact' :: CreateContact -> ContactType
$sel:alias:CreateContact' :: CreateContact -> Text
$sel:tags:CreateContact' :: CreateContact -> Maybe [Tag]
$sel:idempotencyToken:CreateContact' :: CreateContact -> Maybe Text
$sel:displayName:CreateContact' :: CreateContact -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
displayName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
idempotencyToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
alias
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ContactType
type'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Plan
plan
instance Prelude.NFData CreateContact where
rnf :: CreateContact -> ()
rnf CreateContact' {Maybe [Tag]
Maybe Text
Text
ContactType
Plan
plan :: Plan
type' :: ContactType
alias :: Text
tags :: Maybe [Tag]
idempotencyToken :: Maybe Text
displayName :: Maybe Text
$sel:plan:CreateContact' :: CreateContact -> Plan
$sel:type':CreateContact' :: CreateContact -> ContactType
$sel:alias:CreateContact' :: CreateContact -> Text
$sel:tags:CreateContact' :: CreateContact -> Maybe [Tag]
$sel:idempotencyToken:CreateContact' :: CreateContact -> Maybe Text
$sel:displayName:CreateContact' :: CreateContact -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
displayName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
idempotencyToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
alias
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ContactType
type'
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Plan
plan
instance Data.ToHeaders CreateContact where
toHeaders :: CreateContact -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"SSMContacts.CreateContact" :: Prelude.ByteString),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateContact where
toJSON :: CreateContact -> Value
toJSON CreateContact' {Maybe [Tag]
Maybe Text
Text
ContactType
Plan
plan :: Plan
type' :: ContactType
alias :: Text
tags :: Maybe [Tag]
idempotencyToken :: Maybe Text
displayName :: Maybe Text
$sel:plan:CreateContact' :: CreateContact -> Plan
$sel:type':CreateContact' :: CreateContact -> ContactType
$sel:alias:CreateContact' :: CreateContact -> Text
$sel:tags:CreateContact' :: CreateContact -> Maybe [Tag]
$sel:idempotencyToken:CreateContact' :: CreateContact -> Maybe Text
$sel:displayName:CreateContact' :: CreateContact -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DisplayName" 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
displayName,
(Key
"IdempotencyToken" 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
idempotencyToken,
(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 [Tag]
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"Alias" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
alias),
forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ContactType
type'),
forall a. a -> Maybe a
Prelude.Just (Key
"Plan" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Plan
plan)
]
)
instance Data.ToPath CreateContact where
toPath :: CreateContact -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateContact where
toQuery :: CreateContact -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateContactResponse = CreateContactResponse'
{
CreateContactResponse -> Int
httpStatus :: Prelude.Int,
CreateContactResponse -> Text
contactArn :: Prelude.Text
}
deriving (CreateContactResponse -> CreateContactResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateContactResponse -> CreateContactResponse -> Bool
$c/= :: CreateContactResponse -> CreateContactResponse -> Bool
== :: CreateContactResponse -> CreateContactResponse -> Bool
$c== :: CreateContactResponse -> CreateContactResponse -> Bool
Prelude.Eq, ReadPrec [CreateContactResponse]
ReadPrec CreateContactResponse
Int -> ReadS CreateContactResponse
ReadS [CreateContactResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateContactResponse]
$creadListPrec :: ReadPrec [CreateContactResponse]
readPrec :: ReadPrec CreateContactResponse
$creadPrec :: ReadPrec CreateContactResponse
readList :: ReadS [CreateContactResponse]
$creadList :: ReadS [CreateContactResponse]
readsPrec :: Int -> ReadS CreateContactResponse
$creadsPrec :: Int -> ReadS CreateContactResponse
Prelude.Read, Int -> CreateContactResponse -> ShowS
[CreateContactResponse] -> ShowS
CreateContactResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateContactResponse] -> ShowS
$cshowList :: [CreateContactResponse] -> ShowS
show :: CreateContactResponse -> String
$cshow :: CreateContactResponse -> String
showsPrec :: Int -> CreateContactResponse -> ShowS
$cshowsPrec :: Int -> CreateContactResponse -> ShowS
Prelude.Show, forall x. Rep CreateContactResponse x -> CreateContactResponse
forall x. CreateContactResponse -> Rep CreateContactResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateContactResponse x -> CreateContactResponse
$cfrom :: forall x. CreateContactResponse -> Rep CreateContactResponse x
Prelude.Generic)
newCreateContactResponse ::
Prelude.Int ->
Prelude.Text ->
CreateContactResponse
newCreateContactResponse :: Int -> Text -> CreateContactResponse
newCreateContactResponse Int
pHttpStatus_ Text
pContactArn_ =
CreateContactResponse'
{ $sel:httpStatus:CreateContactResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:contactArn:CreateContactResponse' :: Text
contactArn = Text
pContactArn_
}
createContactResponse_httpStatus :: Lens.Lens' CreateContactResponse Prelude.Int
createContactResponse_httpStatus :: Lens' CreateContactResponse Int
createContactResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContactResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateContactResponse' :: CreateContactResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateContactResponse
s@CreateContactResponse' {} Int
a -> CreateContactResponse
s {$sel:httpStatus:CreateContactResponse' :: Int
httpStatus = Int
a} :: CreateContactResponse)
createContactResponse_contactArn :: Lens.Lens' CreateContactResponse Prelude.Text
createContactResponse_contactArn :: Lens' CreateContactResponse Text
createContactResponse_contactArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContactResponse' {Text
contactArn :: Text
$sel:contactArn:CreateContactResponse' :: CreateContactResponse -> Text
contactArn} -> Text
contactArn) (\s :: CreateContactResponse
s@CreateContactResponse' {} Text
a -> CreateContactResponse
s {$sel:contactArn:CreateContactResponse' :: Text
contactArn = Text
a} :: CreateContactResponse)
instance Prelude.NFData CreateContactResponse where
rnf :: CreateContactResponse -> ()
rnf CreateContactResponse' {Int
Text
contactArn :: Text
httpStatus :: Int
$sel:contactArn:CreateContactResponse' :: CreateContactResponse -> Text
$sel:httpStatus:CreateContactResponse' :: CreateContactResponse -> 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 Text
contactArn