{-# 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.CreateSecurityConfig
(
CreateSecurityConfig (..),
newCreateSecurityConfig,
createSecurityConfig_clientToken,
createSecurityConfig_description,
createSecurityConfig_samlOptions,
createSecurityConfig_name,
createSecurityConfig_type,
CreateSecurityConfigResponse (..),
newCreateSecurityConfigResponse,
createSecurityConfigResponse_securityConfigDetail,
createSecurityConfigResponse_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 CreateSecurityConfig = CreateSecurityConfig'
{
CreateSecurityConfig -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreateSecurityConfig -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateSecurityConfig -> Maybe SamlConfigOptions
samlOptions :: Prelude.Maybe SamlConfigOptions,
CreateSecurityConfig -> Text
name :: Prelude.Text,
CreateSecurityConfig -> SecurityConfigType
type' :: SecurityConfigType
}
deriving (CreateSecurityConfig -> CreateSecurityConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSecurityConfig -> CreateSecurityConfig -> Bool
$c/= :: CreateSecurityConfig -> CreateSecurityConfig -> Bool
== :: CreateSecurityConfig -> CreateSecurityConfig -> Bool
$c== :: CreateSecurityConfig -> CreateSecurityConfig -> Bool
Prelude.Eq, ReadPrec [CreateSecurityConfig]
ReadPrec CreateSecurityConfig
Int -> ReadS CreateSecurityConfig
ReadS [CreateSecurityConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSecurityConfig]
$creadListPrec :: ReadPrec [CreateSecurityConfig]
readPrec :: ReadPrec CreateSecurityConfig
$creadPrec :: ReadPrec CreateSecurityConfig
readList :: ReadS [CreateSecurityConfig]
$creadList :: ReadS [CreateSecurityConfig]
readsPrec :: Int -> ReadS CreateSecurityConfig
$creadsPrec :: Int -> ReadS CreateSecurityConfig
Prelude.Read, Int -> CreateSecurityConfig -> ShowS
[CreateSecurityConfig] -> ShowS
CreateSecurityConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSecurityConfig] -> ShowS
$cshowList :: [CreateSecurityConfig] -> ShowS
show :: CreateSecurityConfig -> String
$cshow :: CreateSecurityConfig -> String
showsPrec :: Int -> CreateSecurityConfig -> ShowS
$cshowsPrec :: Int -> CreateSecurityConfig -> ShowS
Prelude.Show, forall x. Rep CreateSecurityConfig x -> CreateSecurityConfig
forall x. CreateSecurityConfig -> Rep CreateSecurityConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateSecurityConfig x -> CreateSecurityConfig
$cfrom :: forall x. CreateSecurityConfig -> Rep CreateSecurityConfig x
Prelude.Generic)
newCreateSecurityConfig ::
Prelude.Text ->
SecurityConfigType ->
CreateSecurityConfig
newCreateSecurityConfig :: Text -> SecurityConfigType -> CreateSecurityConfig
newCreateSecurityConfig Text
pName_ SecurityConfigType
pType_ =
CreateSecurityConfig'
{ $sel:clientToken:CreateSecurityConfig' :: Maybe Text
clientToken =
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateSecurityConfig' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:samlOptions:CreateSecurityConfig' :: Maybe SamlConfigOptions
samlOptions = forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateSecurityConfig' :: Text
name = Text
pName_,
$sel:type':CreateSecurityConfig' :: SecurityConfigType
type' = SecurityConfigType
pType_
}
createSecurityConfig_clientToken :: Lens.Lens' CreateSecurityConfig (Prelude.Maybe Prelude.Text)
createSecurityConfig_clientToken :: Lens' CreateSecurityConfig (Maybe Text)
createSecurityConfig_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityConfig' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateSecurityConfig' :: CreateSecurityConfig -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateSecurityConfig
s@CreateSecurityConfig' {} Maybe Text
a -> CreateSecurityConfig
s {$sel:clientToken:CreateSecurityConfig' :: Maybe Text
clientToken = Maybe Text
a} :: CreateSecurityConfig)
createSecurityConfig_description :: Lens.Lens' CreateSecurityConfig (Prelude.Maybe Prelude.Text)
createSecurityConfig_description :: Lens' CreateSecurityConfig (Maybe Text)
createSecurityConfig_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityConfig' {Maybe Text
description :: Maybe Text
$sel:description:CreateSecurityConfig' :: CreateSecurityConfig -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateSecurityConfig
s@CreateSecurityConfig' {} Maybe Text
a -> CreateSecurityConfig
s {$sel:description:CreateSecurityConfig' :: Maybe Text
description = Maybe Text
a} :: CreateSecurityConfig)
createSecurityConfig_samlOptions :: Lens.Lens' CreateSecurityConfig (Prelude.Maybe SamlConfigOptions)
createSecurityConfig_samlOptions :: Lens' CreateSecurityConfig (Maybe SamlConfigOptions)
createSecurityConfig_samlOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityConfig' {Maybe SamlConfigOptions
samlOptions :: Maybe SamlConfigOptions
$sel:samlOptions:CreateSecurityConfig' :: CreateSecurityConfig -> Maybe SamlConfigOptions
samlOptions} -> Maybe SamlConfigOptions
samlOptions) (\s :: CreateSecurityConfig
s@CreateSecurityConfig' {} Maybe SamlConfigOptions
a -> CreateSecurityConfig
s {$sel:samlOptions:CreateSecurityConfig' :: Maybe SamlConfigOptions
samlOptions = Maybe SamlConfigOptions
a} :: CreateSecurityConfig)
createSecurityConfig_name :: Lens.Lens' CreateSecurityConfig Prelude.Text
createSecurityConfig_name :: Lens' CreateSecurityConfig Text
createSecurityConfig_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityConfig' {Text
name :: Text
$sel:name:CreateSecurityConfig' :: CreateSecurityConfig -> Text
name} -> Text
name) (\s :: CreateSecurityConfig
s@CreateSecurityConfig' {} Text
a -> CreateSecurityConfig
s {$sel:name:CreateSecurityConfig' :: Text
name = Text
a} :: CreateSecurityConfig)
createSecurityConfig_type :: Lens.Lens' CreateSecurityConfig SecurityConfigType
createSecurityConfig_type :: Lens' CreateSecurityConfig SecurityConfigType
createSecurityConfig_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityConfig' {SecurityConfigType
type' :: SecurityConfigType
$sel:type':CreateSecurityConfig' :: CreateSecurityConfig -> SecurityConfigType
type'} -> SecurityConfigType
type') (\s :: CreateSecurityConfig
s@CreateSecurityConfig' {} SecurityConfigType
a -> CreateSecurityConfig
s {$sel:type':CreateSecurityConfig' :: SecurityConfigType
type' = SecurityConfigType
a} :: CreateSecurityConfig)
instance Core.AWSRequest CreateSecurityConfig where
type
AWSResponse CreateSecurityConfig =
CreateSecurityConfigResponse
request :: (Service -> Service)
-> CreateSecurityConfig -> Request CreateSecurityConfig
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 CreateSecurityConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateSecurityConfig)))
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 -> CreateSecurityConfigResponse
CreateSecurityConfigResponse'
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 CreateSecurityConfig where
hashWithSalt :: Int -> CreateSecurityConfig -> Int
hashWithSalt Int
_salt CreateSecurityConfig' {Maybe Text
Maybe SamlConfigOptions
Text
SecurityConfigType
type' :: SecurityConfigType
name :: Text
samlOptions :: Maybe SamlConfigOptions
description :: Maybe Text
clientToken :: Maybe Text
$sel:type':CreateSecurityConfig' :: CreateSecurityConfig -> SecurityConfigType
$sel:name:CreateSecurityConfig' :: CreateSecurityConfig -> Text
$sel:samlOptions:CreateSecurityConfig' :: CreateSecurityConfig -> Maybe SamlConfigOptions
$sel:description:CreateSecurityConfig' :: CreateSecurityConfig -> Maybe Text
$sel:clientToken:CreateSecurityConfig' :: CreateSecurityConfig -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SamlConfigOptions
samlOptions
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SecurityConfigType
type'
instance Prelude.NFData CreateSecurityConfig where
rnf :: CreateSecurityConfig -> ()
rnf CreateSecurityConfig' {Maybe Text
Maybe SamlConfigOptions
Text
SecurityConfigType
type' :: SecurityConfigType
name :: Text
samlOptions :: Maybe SamlConfigOptions
description :: Maybe Text
clientToken :: Maybe Text
$sel:type':CreateSecurityConfig' :: CreateSecurityConfig -> SecurityConfigType
$sel:name:CreateSecurityConfig' :: CreateSecurityConfig -> Text
$sel:samlOptions:CreateSecurityConfig' :: CreateSecurityConfig -> Maybe SamlConfigOptions
$sel:description:CreateSecurityConfig' :: CreateSecurityConfig -> Maybe Text
$sel:clientToken:CreateSecurityConfig' :: CreateSecurityConfig -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SamlConfigOptions
samlOptions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SecurityConfigType
type'
instance Data.ToHeaders CreateSecurityConfig where
toHeaders :: CreateSecurityConfig -> 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.CreateSecurityConfig" ::
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 CreateSecurityConfig where
toJSON :: CreateSecurityConfig -> Value
toJSON CreateSecurityConfig' {Maybe Text
Maybe SamlConfigOptions
Text
SecurityConfigType
type' :: SecurityConfigType
name :: Text
samlOptions :: Maybe SamlConfigOptions
description :: Maybe Text
clientToken :: Maybe Text
$sel:type':CreateSecurityConfig' :: CreateSecurityConfig -> SecurityConfigType
$sel:name:CreateSecurityConfig' :: CreateSecurityConfig -> Text
$sel:samlOptions:CreateSecurityConfig' :: CreateSecurityConfig -> Maybe SamlConfigOptions
$sel:description:CreateSecurityConfig' :: CreateSecurityConfig -> Maybe Text
$sel:clientToken:CreateSecurityConfig' :: CreateSecurityConfig -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"clientToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
(Key
"description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Key
"samlOptions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SamlConfigOptions
samlOptions,
forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SecurityConfigType
type')
]
)
instance Data.ToPath CreateSecurityConfig where
toPath :: CreateSecurityConfig -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateSecurityConfig where
toQuery :: CreateSecurityConfig -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateSecurityConfigResponse = CreateSecurityConfigResponse'
{
CreateSecurityConfigResponse -> Maybe SecurityConfigDetail
securityConfigDetail :: Prelude.Maybe SecurityConfigDetail,
CreateSecurityConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateSecurityConfigResponse
-> CreateSecurityConfigResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateSecurityConfigResponse
-> CreateSecurityConfigResponse -> Bool
$c/= :: CreateSecurityConfigResponse
-> CreateSecurityConfigResponse -> Bool
== :: CreateSecurityConfigResponse
-> CreateSecurityConfigResponse -> Bool
$c== :: CreateSecurityConfigResponse
-> CreateSecurityConfigResponse -> Bool
Prelude.Eq, ReadPrec [CreateSecurityConfigResponse]
ReadPrec CreateSecurityConfigResponse
Int -> ReadS CreateSecurityConfigResponse
ReadS [CreateSecurityConfigResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateSecurityConfigResponse]
$creadListPrec :: ReadPrec [CreateSecurityConfigResponse]
readPrec :: ReadPrec CreateSecurityConfigResponse
$creadPrec :: ReadPrec CreateSecurityConfigResponse
readList :: ReadS [CreateSecurityConfigResponse]
$creadList :: ReadS [CreateSecurityConfigResponse]
readsPrec :: Int -> ReadS CreateSecurityConfigResponse
$creadsPrec :: Int -> ReadS CreateSecurityConfigResponse
Prelude.Read, Int -> CreateSecurityConfigResponse -> ShowS
[CreateSecurityConfigResponse] -> ShowS
CreateSecurityConfigResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateSecurityConfigResponse] -> ShowS
$cshowList :: [CreateSecurityConfigResponse] -> ShowS
show :: CreateSecurityConfigResponse -> String
$cshow :: CreateSecurityConfigResponse -> String
showsPrec :: Int -> CreateSecurityConfigResponse -> ShowS
$cshowsPrec :: Int -> CreateSecurityConfigResponse -> ShowS
Prelude.Show, forall x.
Rep CreateSecurityConfigResponse x -> CreateSecurityConfigResponse
forall x.
CreateSecurityConfigResponse -> Rep CreateSecurityConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateSecurityConfigResponse x -> CreateSecurityConfigResponse
$cfrom :: forall x.
CreateSecurityConfigResponse -> Rep CreateSecurityConfigResponse x
Prelude.Generic)
newCreateSecurityConfigResponse ::
Prelude.Int ->
CreateSecurityConfigResponse
newCreateSecurityConfigResponse :: Int -> CreateSecurityConfigResponse
newCreateSecurityConfigResponse Int
pHttpStatus_ =
CreateSecurityConfigResponse'
{ $sel:securityConfigDetail:CreateSecurityConfigResponse' :: Maybe SecurityConfigDetail
securityConfigDetail =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateSecurityConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createSecurityConfigResponse_securityConfigDetail :: Lens.Lens' CreateSecurityConfigResponse (Prelude.Maybe SecurityConfigDetail)
createSecurityConfigResponse_securityConfigDetail :: Lens' CreateSecurityConfigResponse (Maybe SecurityConfigDetail)
createSecurityConfigResponse_securityConfigDetail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityConfigResponse' {Maybe SecurityConfigDetail
securityConfigDetail :: Maybe SecurityConfigDetail
$sel:securityConfigDetail:CreateSecurityConfigResponse' :: CreateSecurityConfigResponse -> Maybe SecurityConfigDetail
securityConfigDetail} -> Maybe SecurityConfigDetail
securityConfigDetail) (\s :: CreateSecurityConfigResponse
s@CreateSecurityConfigResponse' {} Maybe SecurityConfigDetail
a -> CreateSecurityConfigResponse
s {$sel:securityConfigDetail:CreateSecurityConfigResponse' :: Maybe SecurityConfigDetail
securityConfigDetail = Maybe SecurityConfigDetail
a} :: CreateSecurityConfigResponse)
createSecurityConfigResponse_httpStatus :: Lens.Lens' CreateSecurityConfigResponse Prelude.Int
createSecurityConfigResponse_httpStatus :: Lens' CreateSecurityConfigResponse Int
createSecurityConfigResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateSecurityConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateSecurityConfigResponse' :: CreateSecurityConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateSecurityConfigResponse
s@CreateSecurityConfigResponse' {} Int
a -> CreateSecurityConfigResponse
s {$sel:httpStatus:CreateSecurityConfigResponse' :: Int
httpStatus = Int
a} :: CreateSecurityConfigResponse)
instance Prelude.NFData CreateSecurityConfigResponse where
rnf :: CreateSecurityConfigResponse -> ()
rnf CreateSecurityConfigResponse' {Int
Maybe SecurityConfigDetail
httpStatus :: Int
securityConfigDetail :: Maybe SecurityConfigDetail
$sel:httpStatus:CreateSecurityConfigResponse' :: CreateSecurityConfigResponse -> Int
$sel:securityConfigDetail:CreateSecurityConfigResponse' :: CreateSecurityConfigResponse -> 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