{-# 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.Lightsail.CreateContactMethod
(
CreateContactMethod (..),
newCreateContactMethod,
createContactMethod_protocol,
createContactMethod_contactEndpoint,
CreateContactMethodResponse (..),
newCreateContactMethodResponse,
createContactMethodResponse_operations,
createContactMethodResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateContactMethod = CreateContactMethod'
{
CreateContactMethod -> ContactProtocol
protocol :: ContactProtocol,
CreateContactMethod -> Text
contactEndpoint :: Prelude.Text
}
deriving (CreateContactMethod -> CreateContactMethod -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateContactMethod -> CreateContactMethod -> Bool
$c/= :: CreateContactMethod -> CreateContactMethod -> Bool
== :: CreateContactMethod -> CreateContactMethod -> Bool
$c== :: CreateContactMethod -> CreateContactMethod -> Bool
Prelude.Eq, ReadPrec [CreateContactMethod]
ReadPrec CreateContactMethod
Int -> ReadS CreateContactMethod
ReadS [CreateContactMethod]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateContactMethod]
$creadListPrec :: ReadPrec [CreateContactMethod]
readPrec :: ReadPrec CreateContactMethod
$creadPrec :: ReadPrec CreateContactMethod
readList :: ReadS [CreateContactMethod]
$creadList :: ReadS [CreateContactMethod]
readsPrec :: Int -> ReadS CreateContactMethod
$creadsPrec :: Int -> ReadS CreateContactMethod
Prelude.Read, Int -> CreateContactMethod -> ShowS
[CreateContactMethod] -> ShowS
CreateContactMethod -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateContactMethod] -> ShowS
$cshowList :: [CreateContactMethod] -> ShowS
show :: CreateContactMethod -> String
$cshow :: CreateContactMethod -> String
showsPrec :: Int -> CreateContactMethod -> ShowS
$cshowsPrec :: Int -> CreateContactMethod -> ShowS
Prelude.Show, forall x. Rep CreateContactMethod x -> CreateContactMethod
forall x. CreateContactMethod -> Rep CreateContactMethod x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateContactMethod x -> CreateContactMethod
$cfrom :: forall x. CreateContactMethod -> Rep CreateContactMethod x
Prelude.Generic)
newCreateContactMethod ::
ContactProtocol ->
Prelude.Text ->
CreateContactMethod
newCreateContactMethod :: ContactProtocol -> Text -> CreateContactMethod
newCreateContactMethod ContactProtocol
pProtocol_ Text
pContactEndpoint_ =
CreateContactMethod'
{ $sel:protocol:CreateContactMethod' :: ContactProtocol
protocol = ContactProtocol
pProtocol_,
$sel:contactEndpoint:CreateContactMethod' :: Text
contactEndpoint = Text
pContactEndpoint_
}
createContactMethod_protocol :: Lens.Lens' CreateContactMethod ContactProtocol
createContactMethod_protocol :: Lens' CreateContactMethod ContactProtocol
createContactMethod_protocol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContactMethod' {ContactProtocol
protocol :: ContactProtocol
$sel:protocol:CreateContactMethod' :: CreateContactMethod -> ContactProtocol
protocol} -> ContactProtocol
protocol) (\s :: CreateContactMethod
s@CreateContactMethod' {} ContactProtocol
a -> CreateContactMethod
s {$sel:protocol:CreateContactMethod' :: ContactProtocol
protocol = ContactProtocol
a} :: CreateContactMethod)
createContactMethod_contactEndpoint :: Lens.Lens' CreateContactMethod Prelude.Text
createContactMethod_contactEndpoint :: Lens' CreateContactMethod Text
createContactMethod_contactEndpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContactMethod' {Text
contactEndpoint :: Text
$sel:contactEndpoint:CreateContactMethod' :: CreateContactMethod -> Text
contactEndpoint} -> Text
contactEndpoint) (\s :: CreateContactMethod
s@CreateContactMethod' {} Text
a -> CreateContactMethod
s {$sel:contactEndpoint:CreateContactMethod' :: Text
contactEndpoint = Text
a} :: CreateContactMethod)
instance Core.AWSRequest CreateContactMethod where
type
AWSResponse CreateContactMethod =
CreateContactMethodResponse
request :: (Service -> Service)
-> CreateContactMethod -> Request CreateContactMethod
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 CreateContactMethod
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateContactMethod)))
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 ->
Maybe [Operation] -> Int -> CreateContactMethodResponse
CreateContactMethodResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"operations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable CreateContactMethod where
hashWithSalt :: Int -> CreateContactMethod -> Int
hashWithSalt Int
_salt CreateContactMethod' {Text
ContactProtocol
contactEndpoint :: Text
protocol :: ContactProtocol
$sel:contactEndpoint:CreateContactMethod' :: CreateContactMethod -> Text
$sel:protocol:CreateContactMethod' :: CreateContactMethod -> ContactProtocol
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ContactProtocol
protocol
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactEndpoint
instance Prelude.NFData CreateContactMethod where
rnf :: CreateContactMethod -> ()
rnf CreateContactMethod' {Text
ContactProtocol
contactEndpoint :: Text
protocol :: ContactProtocol
$sel:contactEndpoint:CreateContactMethod' :: CreateContactMethod -> Text
$sel:protocol:CreateContactMethod' :: CreateContactMethod -> ContactProtocol
..} =
forall a. NFData a => a -> ()
Prelude.rnf ContactProtocol
protocol
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
contactEndpoint
instance Data.ToHeaders CreateContactMethod where
toHeaders :: CreateContactMethod -> 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
"Lightsail_20161128.CreateContactMethod" ::
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 CreateContactMethod where
toJSON :: CreateContactMethod -> Value
toJSON CreateContactMethod' {Text
ContactProtocol
contactEndpoint :: Text
protocol :: ContactProtocol
$sel:contactEndpoint:CreateContactMethod' :: CreateContactMethod -> Text
$sel:protocol:CreateContactMethod' :: CreateContactMethod -> ContactProtocol
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"protocol" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ContactProtocol
protocol),
forall a. a -> Maybe a
Prelude.Just
(Key
"contactEndpoint" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
contactEndpoint)
]
)
instance Data.ToPath CreateContactMethod where
toPath :: CreateContactMethod -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateContactMethod where
toQuery :: CreateContactMethod -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateContactMethodResponse = CreateContactMethodResponse'
{
CreateContactMethodResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
CreateContactMethodResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateContactMethodResponse -> CreateContactMethodResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateContactMethodResponse -> CreateContactMethodResponse -> Bool
$c/= :: CreateContactMethodResponse -> CreateContactMethodResponse -> Bool
== :: CreateContactMethodResponse -> CreateContactMethodResponse -> Bool
$c== :: CreateContactMethodResponse -> CreateContactMethodResponse -> Bool
Prelude.Eq, ReadPrec [CreateContactMethodResponse]
ReadPrec CreateContactMethodResponse
Int -> ReadS CreateContactMethodResponse
ReadS [CreateContactMethodResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateContactMethodResponse]
$creadListPrec :: ReadPrec [CreateContactMethodResponse]
readPrec :: ReadPrec CreateContactMethodResponse
$creadPrec :: ReadPrec CreateContactMethodResponse
readList :: ReadS [CreateContactMethodResponse]
$creadList :: ReadS [CreateContactMethodResponse]
readsPrec :: Int -> ReadS CreateContactMethodResponse
$creadsPrec :: Int -> ReadS CreateContactMethodResponse
Prelude.Read, Int -> CreateContactMethodResponse -> ShowS
[CreateContactMethodResponse] -> ShowS
CreateContactMethodResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateContactMethodResponse] -> ShowS
$cshowList :: [CreateContactMethodResponse] -> ShowS
show :: CreateContactMethodResponse -> String
$cshow :: CreateContactMethodResponse -> String
showsPrec :: Int -> CreateContactMethodResponse -> ShowS
$cshowsPrec :: Int -> CreateContactMethodResponse -> ShowS
Prelude.Show, forall x.
Rep CreateContactMethodResponse x -> CreateContactMethodResponse
forall x.
CreateContactMethodResponse -> Rep CreateContactMethodResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateContactMethodResponse x -> CreateContactMethodResponse
$cfrom :: forall x.
CreateContactMethodResponse -> Rep CreateContactMethodResponse x
Prelude.Generic)
newCreateContactMethodResponse ::
Prelude.Int ->
CreateContactMethodResponse
newCreateContactMethodResponse :: Int -> CreateContactMethodResponse
newCreateContactMethodResponse Int
pHttpStatus_ =
CreateContactMethodResponse'
{ $sel:operations:CreateContactMethodResponse' :: Maybe [Operation]
operations =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateContactMethodResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createContactMethodResponse_operations :: Lens.Lens' CreateContactMethodResponse (Prelude.Maybe [Operation])
createContactMethodResponse_operations :: Lens' CreateContactMethodResponse (Maybe [Operation])
createContactMethodResponse_operations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContactMethodResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:CreateContactMethodResponse' :: CreateContactMethodResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: CreateContactMethodResponse
s@CreateContactMethodResponse' {} Maybe [Operation]
a -> CreateContactMethodResponse
s {$sel:operations:CreateContactMethodResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: CreateContactMethodResponse) 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
createContactMethodResponse_httpStatus :: Lens.Lens' CreateContactMethodResponse Prelude.Int
createContactMethodResponse_httpStatus :: Lens' CreateContactMethodResponse Int
createContactMethodResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContactMethodResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateContactMethodResponse' :: CreateContactMethodResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateContactMethodResponse
s@CreateContactMethodResponse' {} Int
a -> CreateContactMethodResponse
s {$sel:httpStatus:CreateContactMethodResponse' :: Int
httpStatus = Int
a} :: CreateContactMethodResponse)
instance Prelude.NFData CreateContactMethodResponse where
rnf :: CreateContactMethodResponse -> ()
rnf CreateContactMethodResponse' {Int
Maybe [Operation]
httpStatus :: Int
operations :: Maybe [Operation]
$sel:httpStatus:CreateContactMethodResponse' :: CreateContactMethodResponse -> Int
$sel:operations:CreateContactMethodResponse' :: CreateContactMethodResponse -> Maybe [Operation]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Operation]
operations
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus