{-# 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.PutContactPolicy
(
PutContactPolicy (..),
newPutContactPolicy,
putContactPolicy_contactArn,
putContactPolicy_policy,
PutContactPolicyResponse (..),
newPutContactPolicyResponse,
putContactPolicyResponse_httpStatus,
)
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 PutContactPolicy = PutContactPolicy'
{
PutContactPolicy -> Text
contactArn :: Prelude.Text,
PutContactPolicy -> Text
policy :: Prelude.Text
}
deriving (PutContactPolicy -> PutContactPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutContactPolicy -> PutContactPolicy -> Bool
$c/= :: PutContactPolicy -> PutContactPolicy -> Bool
== :: PutContactPolicy -> PutContactPolicy -> Bool
$c== :: PutContactPolicy -> PutContactPolicy -> Bool
Prelude.Eq, ReadPrec [PutContactPolicy]
ReadPrec PutContactPolicy
Int -> ReadS PutContactPolicy
ReadS [PutContactPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutContactPolicy]
$creadListPrec :: ReadPrec [PutContactPolicy]
readPrec :: ReadPrec PutContactPolicy
$creadPrec :: ReadPrec PutContactPolicy
readList :: ReadS [PutContactPolicy]
$creadList :: ReadS [PutContactPolicy]
readsPrec :: Int -> ReadS PutContactPolicy
$creadsPrec :: Int -> ReadS PutContactPolicy
Prelude.Read, Int -> PutContactPolicy -> ShowS
[PutContactPolicy] -> ShowS
PutContactPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutContactPolicy] -> ShowS
$cshowList :: [PutContactPolicy] -> ShowS
show :: PutContactPolicy -> String
$cshow :: PutContactPolicy -> String
showsPrec :: Int -> PutContactPolicy -> ShowS
$cshowsPrec :: Int -> PutContactPolicy -> ShowS
Prelude.Show, forall x. Rep PutContactPolicy x -> PutContactPolicy
forall x. PutContactPolicy -> Rep PutContactPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutContactPolicy x -> PutContactPolicy
$cfrom :: forall x. PutContactPolicy -> Rep PutContactPolicy x
Prelude.Generic)
newPutContactPolicy ::
Prelude.Text ->
Prelude.Text ->
PutContactPolicy
newPutContactPolicy :: Text -> Text -> PutContactPolicy
newPutContactPolicy Text
pContactArn_ Text
pPolicy_ =
PutContactPolicy'
{ $sel:contactArn:PutContactPolicy' :: Text
contactArn = Text
pContactArn_,
$sel:policy:PutContactPolicy' :: Text
policy = Text
pPolicy_
}
putContactPolicy_contactArn :: Lens.Lens' PutContactPolicy Prelude.Text
putContactPolicy_contactArn :: Lens' PutContactPolicy Text
putContactPolicy_contactArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutContactPolicy' {Text
contactArn :: Text
$sel:contactArn:PutContactPolicy' :: PutContactPolicy -> Text
contactArn} -> Text
contactArn) (\s :: PutContactPolicy
s@PutContactPolicy' {} Text
a -> PutContactPolicy
s {$sel:contactArn:PutContactPolicy' :: Text
contactArn = Text
a} :: PutContactPolicy)
putContactPolicy_policy :: Lens.Lens' PutContactPolicy Prelude.Text
putContactPolicy_policy :: Lens' PutContactPolicy Text
putContactPolicy_policy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutContactPolicy' {Text
policy :: Text
$sel:policy:PutContactPolicy' :: PutContactPolicy -> Text
policy} -> Text
policy) (\s :: PutContactPolicy
s@PutContactPolicy' {} Text
a -> PutContactPolicy
s {$sel:policy:PutContactPolicy' :: Text
policy = Text
a} :: PutContactPolicy)
instance Core.AWSRequest PutContactPolicy where
type
AWSResponse PutContactPolicy =
PutContactPolicyResponse
request :: (Service -> Service)
-> PutContactPolicy -> Request PutContactPolicy
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 PutContactPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutContactPolicy)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> PutContactPolicyResponse
PutContactPolicyResponse'
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))
)
instance Prelude.Hashable PutContactPolicy where
hashWithSalt :: Int -> PutContactPolicy -> Int
hashWithSalt Int
_salt PutContactPolicy' {Text
policy :: Text
contactArn :: Text
$sel:policy:PutContactPolicy' :: PutContactPolicy -> Text
$sel:contactArn:PutContactPolicy' :: PutContactPolicy -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policy
instance Prelude.NFData PutContactPolicy where
rnf :: PutContactPolicy -> ()
rnf PutContactPolicy' {Text
policy :: Text
contactArn :: Text
$sel:policy:PutContactPolicy' :: PutContactPolicy -> Text
$sel:contactArn:PutContactPolicy' :: PutContactPolicy -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
contactArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policy
instance Data.ToHeaders PutContactPolicy where
toHeaders :: PutContactPolicy -> 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.PutContactPolicy" ::
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 PutContactPolicy where
toJSON :: PutContactPolicy -> Value
toJSON PutContactPolicy' {Text
policy :: Text
contactArn :: Text
$sel:policy:PutContactPolicy' :: PutContactPolicy -> Text
$sel:contactArn:PutContactPolicy' :: PutContactPolicy -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"ContactArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
contactArn),
forall a. a -> Maybe a
Prelude.Just (Key
"Policy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
policy)
]
)
instance Data.ToPath PutContactPolicy where
toPath :: PutContactPolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery PutContactPolicy where
toQuery :: PutContactPolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data PutContactPolicyResponse = PutContactPolicyResponse'
{
PutContactPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutContactPolicyResponse -> PutContactPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutContactPolicyResponse -> PutContactPolicyResponse -> Bool
$c/= :: PutContactPolicyResponse -> PutContactPolicyResponse -> Bool
== :: PutContactPolicyResponse -> PutContactPolicyResponse -> Bool
$c== :: PutContactPolicyResponse -> PutContactPolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutContactPolicyResponse]
ReadPrec PutContactPolicyResponse
Int -> ReadS PutContactPolicyResponse
ReadS [PutContactPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutContactPolicyResponse]
$creadListPrec :: ReadPrec [PutContactPolicyResponse]
readPrec :: ReadPrec PutContactPolicyResponse
$creadPrec :: ReadPrec PutContactPolicyResponse
readList :: ReadS [PutContactPolicyResponse]
$creadList :: ReadS [PutContactPolicyResponse]
readsPrec :: Int -> ReadS PutContactPolicyResponse
$creadsPrec :: Int -> ReadS PutContactPolicyResponse
Prelude.Read, Int -> PutContactPolicyResponse -> ShowS
[PutContactPolicyResponse] -> ShowS
PutContactPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutContactPolicyResponse] -> ShowS
$cshowList :: [PutContactPolicyResponse] -> ShowS
show :: PutContactPolicyResponse -> String
$cshow :: PutContactPolicyResponse -> String
showsPrec :: Int -> PutContactPolicyResponse -> ShowS
$cshowsPrec :: Int -> PutContactPolicyResponse -> ShowS
Prelude.Show, forall x.
Rep PutContactPolicyResponse x -> PutContactPolicyResponse
forall x.
PutContactPolicyResponse -> Rep PutContactPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutContactPolicyResponse x -> PutContactPolicyResponse
$cfrom :: forall x.
PutContactPolicyResponse -> Rep PutContactPolicyResponse x
Prelude.Generic)
newPutContactPolicyResponse ::
Prelude.Int ->
PutContactPolicyResponse
newPutContactPolicyResponse :: Int -> PutContactPolicyResponse
newPutContactPolicyResponse Int
pHttpStatus_ =
PutContactPolicyResponse'
{ $sel:httpStatus:PutContactPolicyResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
putContactPolicyResponse_httpStatus :: Lens.Lens' PutContactPolicyResponse Prelude.Int
putContactPolicyResponse_httpStatus :: Lens' PutContactPolicyResponse Int
putContactPolicyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutContactPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutContactPolicyResponse' :: PutContactPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutContactPolicyResponse
s@PutContactPolicyResponse' {} Int
a -> PutContactPolicyResponse
s {$sel:httpStatus:PutContactPolicyResponse' :: Int
httpStatus = Int
a} :: PutContactPolicyResponse)
instance Prelude.NFData PutContactPolicyResponse where
rnf :: PutContactPolicyResponse -> ()
rnf PutContactPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutContactPolicyResponse' :: PutContactPolicyResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus