{-# 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.OpenSearchServerless.GetSecurityConfig
(
GetSecurityConfig (..),
newGetSecurityConfig,
getSecurityConfig_id,
GetSecurityConfigResponse (..),
newGetSecurityConfigResponse,
getSecurityConfigResponse_securityConfigDetail,
getSecurityConfigResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpenSearchServerless.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetSecurityConfig = GetSecurityConfig'
{
GetSecurityConfig -> Text
id :: Prelude.Text
}
deriving (GetSecurityConfig -> GetSecurityConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSecurityConfig -> GetSecurityConfig -> Bool
$c/= :: GetSecurityConfig -> GetSecurityConfig -> Bool
== :: GetSecurityConfig -> GetSecurityConfig -> Bool
$c== :: GetSecurityConfig -> GetSecurityConfig -> Bool
Prelude.Eq, ReadPrec [GetSecurityConfig]
ReadPrec GetSecurityConfig
Int -> ReadS GetSecurityConfig
ReadS [GetSecurityConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSecurityConfig]
$creadListPrec :: ReadPrec [GetSecurityConfig]
readPrec :: ReadPrec GetSecurityConfig
$creadPrec :: ReadPrec GetSecurityConfig
readList :: ReadS [GetSecurityConfig]
$creadList :: ReadS [GetSecurityConfig]
readsPrec :: Int -> ReadS GetSecurityConfig
$creadsPrec :: Int -> ReadS GetSecurityConfig
Prelude.Read, Int -> GetSecurityConfig -> ShowS
[GetSecurityConfig] -> ShowS
GetSecurityConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSecurityConfig] -> ShowS
$cshowList :: [GetSecurityConfig] -> ShowS
show :: GetSecurityConfig -> String
$cshow :: GetSecurityConfig -> String
showsPrec :: Int -> GetSecurityConfig -> ShowS
$cshowsPrec :: Int -> GetSecurityConfig -> ShowS
Prelude.Show, forall x. Rep GetSecurityConfig x -> GetSecurityConfig
forall x. GetSecurityConfig -> Rep GetSecurityConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSecurityConfig x -> GetSecurityConfig
$cfrom :: forall x. GetSecurityConfig -> Rep GetSecurityConfig x
Prelude.Generic)
newGetSecurityConfig ::
Prelude.Text ->
GetSecurityConfig
newGetSecurityConfig :: Text -> GetSecurityConfig
newGetSecurityConfig Text
pId_ =
GetSecurityConfig' {$sel:id:GetSecurityConfig' :: Text
id = Text
pId_}
getSecurityConfig_id :: Lens.Lens' GetSecurityConfig Prelude.Text
getSecurityConfig_id :: Lens' GetSecurityConfig Text
getSecurityConfig_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSecurityConfig' {Text
id :: Text
$sel:id:GetSecurityConfig' :: GetSecurityConfig -> Text
id} -> Text
id) (\s :: GetSecurityConfig
s@GetSecurityConfig' {} Text
a -> GetSecurityConfig
s {$sel:id:GetSecurityConfig' :: Text
id = Text
a} :: GetSecurityConfig)
instance Core.AWSRequest GetSecurityConfig where
type
AWSResponse GetSecurityConfig =
GetSecurityConfigResponse
request :: (Service -> Service)
-> GetSecurityConfig -> Request GetSecurityConfig
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 GetSecurityConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSecurityConfig)))
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 SecurityConfigDetail -> Int -> GetSecurityConfigResponse
GetSecurityConfigResponse'
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
"securityConfigDetail")
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 GetSecurityConfig where
hashWithSalt :: Int -> GetSecurityConfig -> Int
hashWithSalt Int
_salt GetSecurityConfig' {Text
id :: Text
$sel:id:GetSecurityConfig' :: GetSecurityConfig -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData GetSecurityConfig where
rnf :: GetSecurityConfig -> ()
rnf GetSecurityConfig' {Text
id :: Text
$sel:id:GetSecurityConfig' :: GetSecurityConfig -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToHeaders GetSecurityConfig where
toHeaders :: GetSecurityConfig -> 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
"OpenSearchServerless.GetSecurityConfig" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetSecurityConfig where
toJSON :: GetSecurityConfig -> Value
toJSON GetSecurityConfig' {Text
id :: Text
$sel:id:GetSecurityConfig' :: GetSecurityConfig -> Text
..} =
[Pair] -> Value
Data.object
(forall a. [Maybe a] -> [a]
Prelude.catMaybes [forall a. a -> Maybe a
Prelude.Just (Key
"id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id)])
instance Data.ToPath GetSecurityConfig where
toPath :: GetSecurityConfig -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetSecurityConfig where
toQuery :: GetSecurityConfig -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetSecurityConfigResponse = GetSecurityConfigResponse'
{
GetSecurityConfigResponse -> Maybe SecurityConfigDetail
securityConfigDetail :: Prelude.Maybe SecurityConfigDetail,
GetSecurityConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetSecurityConfigResponse -> GetSecurityConfigResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSecurityConfigResponse -> GetSecurityConfigResponse -> Bool
$c/= :: GetSecurityConfigResponse -> GetSecurityConfigResponse -> Bool
== :: GetSecurityConfigResponse -> GetSecurityConfigResponse -> Bool
$c== :: GetSecurityConfigResponse -> GetSecurityConfigResponse -> Bool
Prelude.Eq, ReadPrec [GetSecurityConfigResponse]
ReadPrec GetSecurityConfigResponse
Int -> ReadS GetSecurityConfigResponse
ReadS [GetSecurityConfigResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSecurityConfigResponse]
$creadListPrec :: ReadPrec [GetSecurityConfigResponse]
readPrec :: ReadPrec GetSecurityConfigResponse
$creadPrec :: ReadPrec GetSecurityConfigResponse
readList :: ReadS [GetSecurityConfigResponse]
$creadList :: ReadS [GetSecurityConfigResponse]
readsPrec :: Int -> ReadS GetSecurityConfigResponse
$creadsPrec :: Int -> ReadS GetSecurityConfigResponse
Prelude.Read, Int -> GetSecurityConfigResponse -> ShowS
[GetSecurityConfigResponse] -> ShowS
GetSecurityConfigResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSecurityConfigResponse] -> ShowS
$cshowList :: [GetSecurityConfigResponse] -> ShowS
show :: GetSecurityConfigResponse -> String
$cshow :: GetSecurityConfigResponse -> String
showsPrec :: Int -> GetSecurityConfigResponse -> ShowS
$cshowsPrec :: Int -> GetSecurityConfigResponse -> ShowS
Prelude.Show, forall x.
Rep GetSecurityConfigResponse x -> GetSecurityConfigResponse
forall x.
GetSecurityConfigResponse -> Rep GetSecurityConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSecurityConfigResponse x -> GetSecurityConfigResponse
$cfrom :: forall x.
GetSecurityConfigResponse -> Rep GetSecurityConfigResponse x
Prelude.Generic)
newGetSecurityConfigResponse ::
Prelude.Int ->
GetSecurityConfigResponse
newGetSecurityConfigResponse :: Int -> GetSecurityConfigResponse
newGetSecurityConfigResponse Int
pHttpStatus_ =
GetSecurityConfigResponse'
{ $sel:securityConfigDetail:GetSecurityConfigResponse' :: Maybe SecurityConfigDetail
securityConfigDetail =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetSecurityConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getSecurityConfigResponse_securityConfigDetail :: Lens.Lens' GetSecurityConfigResponse (Prelude.Maybe SecurityConfigDetail)
getSecurityConfigResponse_securityConfigDetail :: Lens' GetSecurityConfigResponse (Maybe SecurityConfigDetail)
getSecurityConfigResponse_securityConfigDetail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSecurityConfigResponse' {Maybe SecurityConfigDetail
securityConfigDetail :: Maybe SecurityConfigDetail
$sel:securityConfigDetail:GetSecurityConfigResponse' :: GetSecurityConfigResponse -> Maybe SecurityConfigDetail
securityConfigDetail} -> Maybe SecurityConfigDetail
securityConfigDetail) (\s :: GetSecurityConfigResponse
s@GetSecurityConfigResponse' {} Maybe SecurityConfigDetail
a -> GetSecurityConfigResponse
s {$sel:securityConfigDetail:GetSecurityConfigResponse' :: Maybe SecurityConfigDetail
securityConfigDetail = Maybe SecurityConfigDetail
a} :: GetSecurityConfigResponse)
getSecurityConfigResponse_httpStatus :: Lens.Lens' GetSecurityConfigResponse Prelude.Int
getSecurityConfigResponse_httpStatus :: Lens' GetSecurityConfigResponse Int
getSecurityConfigResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSecurityConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSecurityConfigResponse' :: GetSecurityConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSecurityConfigResponse
s@GetSecurityConfigResponse' {} Int
a -> GetSecurityConfigResponse
s {$sel:httpStatus:GetSecurityConfigResponse' :: Int
httpStatus = Int
a} :: GetSecurityConfigResponse)
instance Prelude.NFData GetSecurityConfigResponse where
rnf :: GetSecurityConfigResponse -> ()
rnf GetSecurityConfigResponse' {Int
Maybe SecurityConfigDetail
httpStatus :: Int
securityConfigDetail :: Maybe SecurityConfigDetail
$sel:httpStatus:GetSecurityConfigResponse' :: GetSecurityConfigResponse -> Int
$sel:securityConfigDetail:GetSecurityConfigResponse' :: GetSecurityConfigResponse -> Maybe SecurityConfigDetail
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe SecurityConfigDetail
securityConfigDetail
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus