{-# 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.GetContactPolicy
(
GetContactPolicy (..),
newGetContactPolicy,
getContactPolicy_contactArn,
GetContactPolicyResponse (..),
newGetContactPolicyResponse,
getContactPolicyResponse_contactArn,
getContactPolicyResponse_policy,
getContactPolicyResponse_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 GetContactPolicy = GetContactPolicy'
{
GetContactPolicy -> Text
contactArn :: Prelude.Text
}
deriving (GetContactPolicy -> GetContactPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContactPolicy -> GetContactPolicy -> Bool
$c/= :: GetContactPolicy -> GetContactPolicy -> Bool
== :: GetContactPolicy -> GetContactPolicy -> Bool
$c== :: GetContactPolicy -> GetContactPolicy -> Bool
Prelude.Eq, ReadPrec [GetContactPolicy]
ReadPrec GetContactPolicy
Int -> ReadS GetContactPolicy
ReadS [GetContactPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetContactPolicy]
$creadListPrec :: ReadPrec [GetContactPolicy]
readPrec :: ReadPrec GetContactPolicy
$creadPrec :: ReadPrec GetContactPolicy
readList :: ReadS [GetContactPolicy]
$creadList :: ReadS [GetContactPolicy]
readsPrec :: Int -> ReadS GetContactPolicy
$creadsPrec :: Int -> ReadS GetContactPolicy
Prelude.Read, Int -> GetContactPolicy -> ShowS
[GetContactPolicy] -> ShowS
GetContactPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContactPolicy] -> ShowS
$cshowList :: [GetContactPolicy] -> ShowS
show :: GetContactPolicy -> String
$cshow :: GetContactPolicy -> String
showsPrec :: Int -> GetContactPolicy -> ShowS
$cshowsPrec :: Int -> GetContactPolicy -> ShowS
Prelude.Show, forall x. Rep GetContactPolicy x -> GetContactPolicy
forall x. GetContactPolicy -> Rep GetContactPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetContactPolicy x -> GetContactPolicy
$cfrom :: forall x. GetContactPolicy -> Rep GetContactPolicy x
Prelude.Generic)
newGetContactPolicy ::
Prelude.Text ->
GetContactPolicy
newGetContactPolicy :: Text -> GetContactPolicy
newGetContactPolicy Text
pContactArn_ =
GetContactPolicy' {$sel:contactArn:GetContactPolicy' :: Text
contactArn = Text
pContactArn_}
getContactPolicy_contactArn :: Lens.Lens' GetContactPolicy Prelude.Text
getContactPolicy_contactArn :: Lens' GetContactPolicy Text
getContactPolicy_contactArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContactPolicy' {Text
contactArn :: Text
$sel:contactArn:GetContactPolicy' :: GetContactPolicy -> Text
contactArn} -> Text
contactArn) (\s :: GetContactPolicy
s@GetContactPolicy' {} Text
a -> GetContactPolicy
s {$sel:contactArn:GetContactPolicy' :: Text
contactArn = Text
a} :: GetContactPolicy)
instance Core.AWSRequest GetContactPolicy where
type
AWSResponse GetContactPolicy =
GetContactPolicyResponse
request :: (Service -> Service)
-> GetContactPolicy -> Request GetContactPolicy
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 GetContactPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetContactPolicy)))
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 Text -> Maybe Text -> Int -> GetContactPolicyResponse
GetContactPolicyResponse'
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
"ContactArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Policy")
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 GetContactPolicy where
hashWithSalt :: Int -> GetContactPolicy -> Int
hashWithSalt Int
_salt GetContactPolicy' {Text
contactArn :: Text
$sel:contactArn:GetContactPolicy' :: GetContactPolicy -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactArn
instance Prelude.NFData GetContactPolicy where
rnf :: GetContactPolicy -> ()
rnf GetContactPolicy' {Text
contactArn :: Text
$sel:contactArn:GetContactPolicy' :: GetContactPolicy -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
contactArn
instance Data.ToHeaders GetContactPolicy where
toHeaders :: GetContactPolicy -> 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.GetContactPolicy" ::
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 GetContactPolicy where
toJSON :: GetContactPolicy -> Value
toJSON GetContactPolicy' {Text
contactArn :: Text
$sel:contactArn:GetContactPolicy' :: GetContactPolicy -> 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)]
)
instance Data.ToPath GetContactPolicy where
toPath :: GetContactPolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetContactPolicy where
toQuery :: GetContactPolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetContactPolicyResponse = GetContactPolicyResponse'
{
GetContactPolicyResponse -> Maybe Text
contactArn :: Prelude.Maybe Prelude.Text,
GetContactPolicyResponse -> Maybe Text
policy :: Prelude.Maybe Prelude.Text,
GetContactPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetContactPolicyResponse -> GetContactPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContactPolicyResponse -> GetContactPolicyResponse -> Bool
$c/= :: GetContactPolicyResponse -> GetContactPolicyResponse -> Bool
== :: GetContactPolicyResponse -> GetContactPolicyResponse -> Bool
$c== :: GetContactPolicyResponse -> GetContactPolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetContactPolicyResponse]
ReadPrec GetContactPolicyResponse
Int -> ReadS GetContactPolicyResponse
ReadS [GetContactPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetContactPolicyResponse]
$creadListPrec :: ReadPrec [GetContactPolicyResponse]
readPrec :: ReadPrec GetContactPolicyResponse
$creadPrec :: ReadPrec GetContactPolicyResponse
readList :: ReadS [GetContactPolicyResponse]
$creadList :: ReadS [GetContactPolicyResponse]
readsPrec :: Int -> ReadS GetContactPolicyResponse
$creadsPrec :: Int -> ReadS GetContactPolicyResponse
Prelude.Read, Int -> GetContactPolicyResponse -> ShowS
[GetContactPolicyResponse] -> ShowS
GetContactPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContactPolicyResponse] -> ShowS
$cshowList :: [GetContactPolicyResponse] -> ShowS
show :: GetContactPolicyResponse -> String
$cshow :: GetContactPolicyResponse -> String
showsPrec :: Int -> GetContactPolicyResponse -> ShowS
$cshowsPrec :: Int -> GetContactPolicyResponse -> ShowS
Prelude.Show, forall x.
Rep GetContactPolicyResponse x -> GetContactPolicyResponse
forall x.
GetContactPolicyResponse -> Rep GetContactPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetContactPolicyResponse x -> GetContactPolicyResponse
$cfrom :: forall x.
GetContactPolicyResponse -> Rep GetContactPolicyResponse x
Prelude.Generic)
newGetContactPolicyResponse ::
Prelude.Int ->
GetContactPolicyResponse
newGetContactPolicyResponse :: Int -> GetContactPolicyResponse
newGetContactPolicyResponse Int
pHttpStatus_ =
GetContactPolicyResponse'
{ $sel:contactArn:GetContactPolicyResponse' :: Maybe Text
contactArn =
forall a. Maybe a
Prelude.Nothing,
$sel:policy:GetContactPolicyResponse' :: Maybe Text
policy = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetContactPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getContactPolicyResponse_contactArn :: Lens.Lens' GetContactPolicyResponse (Prelude.Maybe Prelude.Text)
getContactPolicyResponse_contactArn :: Lens' GetContactPolicyResponse (Maybe Text)
getContactPolicyResponse_contactArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContactPolicyResponse' {Maybe Text
contactArn :: Maybe Text
$sel:contactArn:GetContactPolicyResponse' :: GetContactPolicyResponse -> Maybe Text
contactArn} -> Maybe Text
contactArn) (\s :: GetContactPolicyResponse
s@GetContactPolicyResponse' {} Maybe Text
a -> GetContactPolicyResponse
s {$sel:contactArn:GetContactPolicyResponse' :: Maybe Text
contactArn = Maybe Text
a} :: GetContactPolicyResponse)
getContactPolicyResponse_policy :: Lens.Lens' GetContactPolicyResponse (Prelude.Maybe Prelude.Text)
getContactPolicyResponse_policy :: Lens' GetContactPolicyResponse (Maybe Text)
getContactPolicyResponse_policy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContactPolicyResponse' {Maybe Text
policy :: Maybe Text
$sel:policy:GetContactPolicyResponse' :: GetContactPolicyResponse -> Maybe Text
policy} -> Maybe Text
policy) (\s :: GetContactPolicyResponse
s@GetContactPolicyResponse' {} Maybe Text
a -> GetContactPolicyResponse
s {$sel:policy:GetContactPolicyResponse' :: Maybe Text
policy = Maybe Text
a} :: GetContactPolicyResponse)
getContactPolicyResponse_httpStatus :: Lens.Lens' GetContactPolicyResponse Prelude.Int
getContactPolicyResponse_httpStatus :: Lens' GetContactPolicyResponse Int
getContactPolicyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContactPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetContactPolicyResponse' :: GetContactPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetContactPolicyResponse
s@GetContactPolicyResponse' {} Int
a -> GetContactPolicyResponse
s {$sel:httpStatus:GetContactPolicyResponse' :: Int
httpStatus = Int
a} :: GetContactPolicyResponse)
instance Prelude.NFData GetContactPolicyResponse where
rnf :: GetContactPolicyResponse -> ()
rnf GetContactPolicyResponse' {Int
Maybe Text
httpStatus :: Int
policy :: Maybe Text
contactArn :: Maybe Text
$sel:httpStatus:GetContactPolicyResponse' :: GetContactPolicyResponse -> Int
$sel:policy:GetContactPolicyResponse' :: GetContactPolicyResponse -> Maybe Text
$sel:contactArn:GetContactPolicyResponse' :: GetContactPolicyResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contactArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
policy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus