{-# 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.Lens as Lens
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
(GetContactPolicy -> GetContactPolicy -> Bool)
-> (GetContactPolicy -> GetContactPolicy -> Bool)
-> Eq GetContactPolicy
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]
(Int -> ReadS GetContactPolicy)
-> ReadS [GetContactPolicy]
-> ReadPrec GetContactPolicy
-> ReadPrec [GetContactPolicy]
-> Read 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
(Int -> GetContactPolicy -> ShowS)
-> (GetContactPolicy -> String)
-> ([GetContactPolicy] -> ShowS)
-> Show GetContactPolicy
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. GetContactPolicy -> Rep GetContactPolicy x)
-> (forall x. Rep GetContactPolicy x -> GetContactPolicy)
-> Generic GetContactPolicy
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' :: Text -> GetContactPolicy
GetContactPolicy' {$sel:contactArn:GetContactPolicy' :: Text
contactArn = Text
pContactArn_}
getContactPolicy_contactArn :: Lens.Lens' GetContactPolicy Prelude.Text
getContactPolicy_contactArn :: (Text -> f Text) -> GetContactPolicy -> f GetContactPolicy
getContactPolicy_contactArn = (GetContactPolicy -> Text)
-> (GetContactPolicy -> Text -> GetContactPolicy)
-> Lens GetContactPolicy GetContactPolicy Text Text
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 :: GetContactPolicy -> Request GetContactPolicy
request = Service -> GetContactPolicy -> Request GetContactPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetContactPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetContactPolicy)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetContactPolicy))
-> Logger
-> Service
-> Proxy GetContactPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetContactPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> 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'
(Maybe Text -> Maybe Text -> Int -> GetContactPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetContactPolicyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ContactArn")
Either String (Maybe Text -> Int -> GetContactPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetContactPolicyResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Policy")
Either String (Int -> GetContactPolicyResponse)
-> Either String Int -> Either String GetContactPolicyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetContactPolicy
instance Prelude.NFData GetContactPolicy
instance Core.ToHeaders GetContactPolicy where
toHeaders :: GetContactPolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetContactPolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"SSMContacts.GetContactPolicy" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetContactPolicy where
toJSON :: GetContactPolicy -> Value
toJSON GetContactPolicy' {Text
contactArn :: Text
$sel:contactArn:GetContactPolicy' :: GetContactPolicy -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ContactArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
contactArn)]
)
instance Core.ToPath GetContactPolicy where
toPath :: GetContactPolicy -> ByteString
toPath = ByteString -> GetContactPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetContactPolicy where
toQuery :: GetContactPolicy -> QueryString
toQuery = QueryString -> GetContactPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetContactPolicyResponse -> GetContactPolicyResponse -> Bool)
-> (GetContactPolicyResponse -> GetContactPolicyResponse -> Bool)
-> Eq GetContactPolicyResponse
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]
(Int -> ReadS GetContactPolicyResponse)
-> ReadS [GetContactPolicyResponse]
-> ReadPrec GetContactPolicyResponse
-> ReadPrec [GetContactPolicyResponse]
-> Read 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
(Int -> GetContactPolicyResponse -> ShowS)
-> (GetContactPolicyResponse -> String)
-> ([GetContactPolicyResponse] -> ShowS)
-> Show GetContactPolicyResponse
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.
GetContactPolicyResponse -> Rep GetContactPolicyResponse x)
-> (forall x.
Rep GetContactPolicyResponse x -> GetContactPolicyResponse)
-> Generic GetContactPolicyResponse
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' :: Maybe Text -> Maybe Text -> Int -> GetContactPolicyResponse
GetContactPolicyResponse'
{ $sel:contactArn:GetContactPolicyResponse' :: Maybe Text
contactArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:policy:GetContactPolicyResponse' :: Maybe Text
policy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetContactPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getContactPolicyResponse_contactArn :: Lens.Lens' GetContactPolicyResponse (Prelude.Maybe Prelude.Text)
getContactPolicyResponse_contactArn :: (Maybe Text -> f (Maybe Text))
-> GetContactPolicyResponse -> f GetContactPolicyResponse
getContactPolicyResponse_contactArn = (GetContactPolicyResponse -> Maybe Text)
-> (GetContactPolicyResponse
-> Maybe Text -> GetContactPolicyResponse)
-> Lens
GetContactPolicyResponse
GetContactPolicyResponse
(Maybe Text)
(Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> GetContactPolicyResponse -> f GetContactPolicyResponse
getContactPolicyResponse_policy = (GetContactPolicyResponse -> Maybe Text)
-> (GetContactPolicyResponse
-> Maybe Text -> GetContactPolicyResponse)
-> Lens
GetContactPolicyResponse
GetContactPolicyResponse
(Maybe Text)
(Maybe Text)
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 :: (Int -> f Int)
-> GetContactPolicyResponse -> f GetContactPolicyResponse
getContactPolicyResponse_httpStatus = (GetContactPolicyResponse -> Int)
-> (GetContactPolicyResponse -> Int -> GetContactPolicyResponse)
-> Lens GetContactPolicyResponse GetContactPolicyResponse Int Int
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