{-# 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.Connect.AssociateSecurityKey
(
AssociateSecurityKey (..),
newAssociateSecurityKey,
associateSecurityKey_instanceId,
associateSecurityKey_key,
AssociateSecurityKeyResponse (..),
newAssociateSecurityKeyResponse,
associateSecurityKeyResponse_associationId,
associateSecurityKeyResponse_httpStatus,
)
where
import Amazonka.Connect.Types
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
data AssociateSecurityKey = AssociateSecurityKey'
{
AssociateSecurityKey -> Text
instanceId :: Prelude.Text,
AssociateSecurityKey -> Text
key :: Prelude.Text
}
deriving (AssociateSecurityKey -> AssociateSecurityKey -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateSecurityKey -> AssociateSecurityKey -> Bool
$c/= :: AssociateSecurityKey -> AssociateSecurityKey -> Bool
== :: AssociateSecurityKey -> AssociateSecurityKey -> Bool
$c== :: AssociateSecurityKey -> AssociateSecurityKey -> Bool
Prelude.Eq, ReadPrec [AssociateSecurityKey]
ReadPrec AssociateSecurityKey
Int -> ReadS AssociateSecurityKey
ReadS [AssociateSecurityKey]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateSecurityKey]
$creadListPrec :: ReadPrec [AssociateSecurityKey]
readPrec :: ReadPrec AssociateSecurityKey
$creadPrec :: ReadPrec AssociateSecurityKey
readList :: ReadS [AssociateSecurityKey]
$creadList :: ReadS [AssociateSecurityKey]
readsPrec :: Int -> ReadS AssociateSecurityKey
$creadsPrec :: Int -> ReadS AssociateSecurityKey
Prelude.Read, Int -> AssociateSecurityKey -> ShowS
[AssociateSecurityKey] -> ShowS
AssociateSecurityKey -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateSecurityKey] -> ShowS
$cshowList :: [AssociateSecurityKey] -> ShowS
show :: AssociateSecurityKey -> String
$cshow :: AssociateSecurityKey -> String
showsPrec :: Int -> AssociateSecurityKey -> ShowS
$cshowsPrec :: Int -> AssociateSecurityKey -> ShowS
Prelude.Show, forall x. Rep AssociateSecurityKey x -> AssociateSecurityKey
forall x. AssociateSecurityKey -> Rep AssociateSecurityKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateSecurityKey x -> AssociateSecurityKey
$cfrom :: forall x. AssociateSecurityKey -> Rep AssociateSecurityKey x
Prelude.Generic)
newAssociateSecurityKey ::
Prelude.Text ->
Prelude.Text ->
AssociateSecurityKey
newAssociateSecurityKey :: Text -> Text -> AssociateSecurityKey
newAssociateSecurityKey Text
pInstanceId_ Text
pKey_ =
AssociateSecurityKey'
{ $sel:instanceId:AssociateSecurityKey' :: Text
instanceId = Text
pInstanceId_,
$sel:key:AssociateSecurityKey' :: Text
key = Text
pKey_
}
associateSecurityKey_instanceId :: Lens.Lens' AssociateSecurityKey Prelude.Text
associateSecurityKey_instanceId :: Lens' AssociateSecurityKey Text
associateSecurityKey_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSecurityKey' {Text
instanceId :: Text
$sel:instanceId:AssociateSecurityKey' :: AssociateSecurityKey -> Text
instanceId} -> Text
instanceId) (\s :: AssociateSecurityKey
s@AssociateSecurityKey' {} Text
a -> AssociateSecurityKey
s {$sel:instanceId:AssociateSecurityKey' :: Text
instanceId = Text
a} :: AssociateSecurityKey)
associateSecurityKey_key :: Lens.Lens' AssociateSecurityKey Prelude.Text
associateSecurityKey_key :: Lens' AssociateSecurityKey Text
associateSecurityKey_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSecurityKey' {Text
key :: Text
$sel:key:AssociateSecurityKey' :: AssociateSecurityKey -> Text
key} -> Text
key) (\s :: AssociateSecurityKey
s@AssociateSecurityKey' {} Text
a -> AssociateSecurityKey
s {$sel:key:AssociateSecurityKey' :: Text
key = Text
a} :: AssociateSecurityKey)
instance Core.AWSRequest AssociateSecurityKey where
type
AWSResponse AssociateSecurityKey =
AssociateSecurityKeyResponse
request :: (Service -> Service)
-> AssociateSecurityKey -> Request AssociateSecurityKey
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AssociateSecurityKey
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateSecurityKey)))
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 -> Int -> AssociateSecurityKeyResponse
AssociateSecurityKeyResponse'
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
"AssociationId")
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 AssociateSecurityKey where
hashWithSalt :: Int -> AssociateSecurityKey -> Int
hashWithSalt Int
_salt AssociateSecurityKey' {Text
key :: Text
instanceId :: Text
$sel:key:AssociateSecurityKey' :: AssociateSecurityKey -> Text
$sel:instanceId:AssociateSecurityKey' :: AssociateSecurityKey -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
key
instance Prelude.NFData AssociateSecurityKey where
rnf :: AssociateSecurityKey -> ()
rnf AssociateSecurityKey' {Text
key :: Text
instanceId :: Text
$sel:key:AssociateSecurityKey' :: AssociateSecurityKey -> Text
$sel:instanceId:AssociateSecurityKey' :: AssociateSecurityKey -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
key
instance Data.ToHeaders AssociateSecurityKey where
toHeaders :: AssociateSecurityKey -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON AssociateSecurityKey where
toJSON :: AssociateSecurityKey -> Value
toJSON AssociateSecurityKey' {Text
key :: Text
instanceId :: Text
$sel:key:AssociateSecurityKey' :: AssociateSecurityKey -> Text
$sel:instanceId:AssociateSecurityKey' :: AssociateSecurityKey -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Key" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
key)]
)
instance Data.ToPath AssociateSecurityKey where
toPath :: AssociateSecurityKey -> ByteString
toPath AssociateSecurityKey' {Text
key :: Text
instanceId :: Text
$sel:key:AssociateSecurityKey' :: AssociateSecurityKey -> Text
$sel:instanceId:AssociateSecurityKey' :: AssociateSecurityKey -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/instance/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId, ByteString
"/security-key"]
instance Data.ToQuery AssociateSecurityKey where
toQuery :: AssociateSecurityKey -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AssociateSecurityKeyResponse = AssociateSecurityKeyResponse'
{
AssociateSecurityKeyResponse -> Maybe Text
associationId :: Prelude.Maybe Prelude.Text,
AssociateSecurityKeyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateSecurityKeyResponse
-> AssociateSecurityKeyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateSecurityKeyResponse
-> AssociateSecurityKeyResponse -> Bool
$c/= :: AssociateSecurityKeyResponse
-> AssociateSecurityKeyResponse -> Bool
== :: AssociateSecurityKeyResponse
-> AssociateSecurityKeyResponse -> Bool
$c== :: AssociateSecurityKeyResponse
-> AssociateSecurityKeyResponse -> Bool
Prelude.Eq, ReadPrec [AssociateSecurityKeyResponse]
ReadPrec AssociateSecurityKeyResponse
Int -> ReadS AssociateSecurityKeyResponse
ReadS [AssociateSecurityKeyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateSecurityKeyResponse]
$creadListPrec :: ReadPrec [AssociateSecurityKeyResponse]
readPrec :: ReadPrec AssociateSecurityKeyResponse
$creadPrec :: ReadPrec AssociateSecurityKeyResponse
readList :: ReadS [AssociateSecurityKeyResponse]
$creadList :: ReadS [AssociateSecurityKeyResponse]
readsPrec :: Int -> ReadS AssociateSecurityKeyResponse
$creadsPrec :: Int -> ReadS AssociateSecurityKeyResponse
Prelude.Read, Int -> AssociateSecurityKeyResponse -> ShowS
[AssociateSecurityKeyResponse] -> ShowS
AssociateSecurityKeyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateSecurityKeyResponse] -> ShowS
$cshowList :: [AssociateSecurityKeyResponse] -> ShowS
show :: AssociateSecurityKeyResponse -> String
$cshow :: AssociateSecurityKeyResponse -> String
showsPrec :: Int -> AssociateSecurityKeyResponse -> ShowS
$cshowsPrec :: Int -> AssociateSecurityKeyResponse -> ShowS
Prelude.Show, forall x.
Rep AssociateSecurityKeyResponse x -> AssociateSecurityKeyResponse
forall x.
AssociateSecurityKeyResponse -> Rep AssociateSecurityKeyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateSecurityKeyResponse x -> AssociateSecurityKeyResponse
$cfrom :: forall x.
AssociateSecurityKeyResponse -> Rep AssociateSecurityKeyResponse x
Prelude.Generic)
newAssociateSecurityKeyResponse ::
Prelude.Int ->
AssociateSecurityKeyResponse
newAssociateSecurityKeyResponse :: Int -> AssociateSecurityKeyResponse
newAssociateSecurityKeyResponse Int
pHttpStatus_ =
AssociateSecurityKeyResponse'
{ $sel:associationId:AssociateSecurityKeyResponse' :: Maybe Text
associationId =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateSecurityKeyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateSecurityKeyResponse_associationId :: Lens.Lens' AssociateSecurityKeyResponse (Prelude.Maybe Prelude.Text)
associateSecurityKeyResponse_associationId :: Lens' AssociateSecurityKeyResponse (Maybe Text)
associateSecurityKeyResponse_associationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSecurityKeyResponse' {Maybe Text
associationId :: Maybe Text
$sel:associationId:AssociateSecurityKeyResponse' :: AssociateSecurityKeyResponse -> Maybe Text
associationId} -> Maybe Text
associationId) (\s :: AssociateSecurityKeyResponse
s@AssociateSecurityKeyResponse' {} Maybe Text
a -> AssociateSecurityKeyResponse
s {$sel:associationId:AssociateSecurityKeyResponse' :: Maybe Text
associationId = Maybe Text
a} :: AssociateSecurityKeyResponse)
associateSecurityKeyResponse_httpStatus :: Lens.Lens' AssociateSecurityKeyResponse Prelude.Int
associateSecurityKeyResponse_httpStatus :: Lens' AssociateSecurityKeyResponse Int
associateSecurityKeyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateSecurityKeyResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateSecurityKeyResponse' :: AssociateSecurityKeyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateSecurityKeyResponse
s@AssociateSecurityKeyResponse' {} Int
a -> AssociateSecurityKeyResponse
s {$sel:httpStatus:AssociateSecurityKeyResponse' :: Int
httpStatus = Int
a} :: AssociateSecurityKeyResponse)
instance Prelude.NFData AssociateSecurityKeyResponse where
rnf :: AssociateSecurityKeyResponse -> ()
rnf AssociateSecurityKeyResponse' {Int
Maybe Text
httpStatus :: Int
associationId :: Maybe Text
$sel:httpStatus:AssociateSecurityKeyResponse' :: AssociateSecurityKeyResponse -> Int
$sel:associationId:AssociateSecurityKeyResponse' :: AssociateSecurityKeyResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
associationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus