{-# 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.IoT.AttachSecurityProfile
(
AttachSecurityProfile (..),
newAttachSecurityProfile,
attachSecurityProfile_securityProfileName,
attachSecurityProfile_securityProfileTargetArn,
AttachSecurityProfileResponse (..),
newAttachSecurityProfileResponse,
attachSecurityProfileResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AttachSecurityProfile = AttachSecurityProfile'
{
AttachSecurityProfile -> Text
securityProfileName :: Prelude.Text,
AttachSecurityProfile -> Text
securityProfileTargetArn :: Prelude.Text
}
deriving (AttachSecurityProfile -> AttachSecurityProfile -> Bool
(AttachSecurityProfile -> AttachSecurityProfile -> Bool)
-> (AttachSecurityProfile -> AttachSecurityProfile -> Bool)
-> Eq AttachSecurityProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachSecurityProfile -> AttachSecurityProfile -> Bool
$c/= :: AttachSecurityProfile -> AttachSecurityProfile -> Bool
== :: AttachSecurityProfile -> AttachSecurityProfile -> Bool
$c== :: AttachSecurityProfile -> AttachSecurityProfile -> Bool
Prelude.Eq, ReadPrec [AttachSecurityProfile]
ReadPrec AttachSecurityProfile
Int -> ReadS AttachSecurityProfile
ReadS [AttachSecurityProfile]
(Int -> ReadS AttachSecurityProfile)
-> ReadS [AttachSecurityProfile]
-> ReadPrec AttachSecurityProfile
-> ReadPrec [AttachSecurityProfile]
-> Read AttachSecurityProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachSecurityProfile]
$creadListPrec :: ReadPrec [AttachSecurityProfile]
readPrec :: ReadPrec AttachSecurityProfile
$creadPrec :: ReadPrec AttachSecurityProfile
readList :: ReadS [AttachSecurityProfile]
$creadList :: ReadS [AttachSecurityProfile]
readsPrec :: Int -> ReadS AttachSecurityProfile
$creadsPrec :: Int -> ReadS AttachSecurityProfile
Prelude.Read, Int -> AttachSecurityProfile -> ShowS
[AttachSecurityProfile] -> ShowS
AttachSecurityProfile -> String
(Int -> AttachSecurityProfile -> ShowS)
-> (AttachSecurityProfile -> String)
-> ([AttachSecurityProfile] -> ShowS)
-> Show AttachSecurityProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachSecurityProfile] -> ShowS
$cshowList :: [AttachSecurityProfile] -> ShowS
show :: AttachSecurityProfile -> String
$cshow :: AttachSecurityProfile -> String
showsPrec :: Int -> AttachSecurityProfile -> ShowS
$cshowsPrec :: Int -> AttachSecurityProfile -> ShowS
Prelude.Show, (forall x. AttachSecurityProfile -> Rep AttachSecurityProfile x)
-> (forall x. Rep AttachSecurityProfile x -> AttachSecurityProfile)
-> Generic AttachSecurityProfile
forall x. Rep AttachSecurityProfile x -> AttachSecurityProfile
forall x. AttachSecurityProfile -> Rep AttachSecurityProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachSecurityProfile x -> AttachSecurityProfile
$cfrom :: forall x. AttachSecurityProfile -> Rep AttachSecurityProfile x
Prelude.Generic)
newAttachSecurityProfile ::
Prelude.Text ->
Prelude.Text ->
AttachSecurityProfile
newAttachSecurityProfile :: Text -> Text -> AttachSecurityProfile
newAttachSecurityProfile
Text
pSecurityProfileName_
Text
pSecurityProfileTargetArn_ =
AttachSecurityProfile' :: Text -> Text -> AttachSecurityProfile
AttachSecurityProfile'
{ $sel:securityProfileName:AttachSecurityProfile' :: Text
securityProfileName =
Text
pSecurityProfileName_,
$sel:securityProfileTargetArn:AttachSecurityProfile' :: Text
securityProfileTargetArn =
Text
pSecurityProfileTargetArn_
}
attachSecurityProfile_securityProfileName :: Lens.Lens' AttachSecurityProfile Prelude.Text
attachSecurityProfile_securityProfileName :: (Text -> f Text)
-> AttachSecurityProfile -> f AttachSecurityProfile
attachSecurityProfile_securityProfileName = (AttachSecurityProfile -> Text)
-> (AttachSecurityProfile -> Text -> AttachSecurityProfile)
-> Lens AttachSecurityProfile AttachSecurityProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachSecurityProfile' {Text
securityProfileName :: Text
$sel:securityProfileName:AttachSecurityProfile' :: AttachSecurityProfile -> Text
securityProfileName} -> Text
securityProfileName) (\s :: AttachSecurityProfile
s@AttachSecurityProfile' {} Text
a -> AttachSecurityProfile
s {$sel:securityProfileName:AttachSecurityProfile' :: Text
securityProfileName = Text
a} :: AttachSecurityProfile)
attachSecurityProfile_securityProfileTargetArn :: Lens.Lens' AttachSecurityProfile Prelude.Text
attachSecurityProfile_securityProfileTargetArn :: (Text -> f Text)
-> AttachSecurityProfile -> f AttachSecurityProfile
attachSecurityProfile_securityProfileTargetArn = (AttachSecurityProfile -> Text)
-> (AttachSecurityProfile -> Text -> AttachSecurityProfile)
-> Lens AttachSecurityProfile AttachSecurityProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachSecurityProfile' {Text
securityProfileTargetArn :: Text
$sel:securityProfileTargetArn:AttachSecurityProfile' :: AttachSecurityProfile -> Text
securityProfileTargetArn} -> Text
securityProfileTargetArn) (\s :: AttachSecurityProfile
s@AttachSecurityProfile' {} Text
a -> AttachSecurityProfile
s {$sel:securityProfileTargetArn:AttachSecurityProfile' :: Text
securityProfileTargetArn = Text
a} :: AttachSecurityProfile)
instance Core.AWSRequest AttachSecurityProfile where
type
AWSResponse AttachSecurityProfile =
AttachSecurityProfileResponse
request :: AttachSecurityProfile -> Request AttachSecurityProfile
request = Service -> AttachSecurityProfile -> Request AttachSecurityProfile
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AttachSecurityProfile
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AttachSecurityProfile)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AttachSecurityProfile))
-> Logger
-> Service
-> Proxy AttachSecurityProfile
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AttachSecurityProfile)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AttachSecurityProfileResponse
AttachSecurityProfileResponse'
(Int -> AttachSecurityProfileResponse)
-> Either String Int -> Either String AttachSecurityProfileResponse
forall (f :: * -> *) a b. Functor 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 AttachSecurityProfile
instance Prelude.NFData AttachSecurityProfile
instance Core.ToHeaders AttachSecurityProfile where
toHeaders :: AttachSecurityProfile -> ResponseHeaders
toHeaders = ResponseHeaders -> AttachSecurityProfile -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON AttachSecurityProfile where
toJSON :: AttachSecurityProfile -> Value
toJSON = Value -> AttachSecurityProfile -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath AttachSecurityProfile where
toPath :: AttachSecurityProfile -> ByteString
toPath AttachSecurityProfile' {Text
securityProfileTargetArn :: Text
securityProfileName :: Text
$sel:securityProfileTargetArn:AttachSecurityProfile' :: AttachSecurityProfile -> Text
$sel:securityProfileName:AttachSecurityProfile' :: AttachSecurityProfile -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/security-profiles/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
securityProfileName,
ByteString
"/targets"
]
instance Core.ToQuery AttachSecurityProfile where
toQuery :: AttachSecurityProfile -> QueryString
toQuery AttachSecurityProfile' {Text
securityProfileTargetArn :: Text
securityProfileName :: Text
$sel:securityProfileTargetArn:AttachSecurityProfile' :: AttachSecurityProfile -> Text
$sel:securityProfileName:AttachSecurityProfile' :: AttachSecurityProfile -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"securityProfileTargetArn"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
securityProfileTargetArn
]
data AttachSecurityProfileResponse = AttachSecurityProfileResponse'
{
AttachSecurityProfileResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AttachSecurityProfileResponse
-> AttachSecurityProfileResponse -> Bool
(AttachSecurityProfileResponse
-> AttachSecurityProfileResponse -> Bool)
-> (AttachSecurityProfileResponse
-> AttachSecurityProfileResponse -> Bool)
-> Eq AttachSecurityProfileResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachSecurityProfileResponse
-> AttachSecurityProfileResponse -> Bool
$c/= :: AttachSecurityProfileResponse
-> AttachSecurityProfileResponse -> Bool
== :: AttachSecurityProfileResponse
-> AttachSecurityProfileResponse -> Bool
$c== :: AttachSecurityProfileResponse
-> AttachSecurityProfileResponse -> Bool
Prelude.Eq, ReadPrec [AttachSecurityProfileResponse]
ReadPrec AttachSecurityProfileResponse
Int -> ReadS AttachSecurityProfileResponse
ReadS [AttachSecurityProfileResponse]
(Int -> ReadS AttachSecurityProfileResponse)
-> ReadS [AttachSecurityProfileResponse]
-> ReadPrec AttachSecurityProfileResponse
-> ReadPrec [AttachSecurityProfileResponse]
-> Read AttachSecurityProfileResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachSecurityProfileResponse]
$creadListPrec :: ReadPrec [AttachSecurityProfileResponse]
readPrec :: ReadPrec AttachSecurityProfileResponse
$creadPrec :: ReadPrec AttachSecurityProfileResponse
readList :: ReadS [AttachSecurityProfileResponse]
$creadList :: ReadS [AttachSecurityProfileResponse]
readsPrec :: Int -> ReadS AttachSecurityProfileResponse
$creadsPrec :: Int -> ReadS AttachSecurityProfileResponse
Prelude.Read, Int -> AttachSecurityProfileResponse -> ShowS
[AttachSecurityProfileResponse] -> ShowS
AttachSecurityProfileResponse -> String
(Int -> AttachSecurityProfileResponse -> ShowS)
-> (AttachSecurityProfileResponse -> String)
-> ([AttachSecurityProfileResponse] -> ShowS)
-> Show AttachSecurityProfileResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachSecurityProfileResponse] -> ShowS
$cshowList :: [AttachSecurityProfileResponse] -> ShowS
show :: AttachSecurityProfileResponse -> String
$cshow :: AttachSecurityProfileResponse -> String
showsPrec :: Int -> AttachSecurityProfileResponse -> ShowS
$cshowsPrec :: Int -> AttachSecurityProfileResponse -> ShowS
Prelude.Show, (forall x.
AttachSecurityProfileResponse
-> Rep AttachSecurityProfileResponse x)
-> (forall x.
Rep AttachSecurityProfileResponse x
-> AttachSecurityProfileResponse)
-> Generic AttachSecurityProfileResponse
forall x.
Rep AttachSecurityProfileResponse x
-> AttachSecurityProfileResponse
forall x.
AttachSecurityProfileResponse
-> Rep AttachSecurityProfileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AttachSecurityProfileResponse x
-> AttachSecurityProfileResponse
$cfrom :: forall x.
AttachSecurityProfileResponse
-> Rep AttachSecurityProfileResponse x
Prelude.Generic)
newAttachSecurityProfileResponse ::
Prelude.Int ->
AttachSecurityProfileResponse
newAttachSecurityProfileResponse :: Int -> AttachSecurityProfileResponse
newAttachSecurityProfileResponse Int
pHttpStatus_ =
AttachSecurityProfileResponse' :: Int -> AttachSecurityProfileResponse
AttachSecurityProfileResponse'
{ $sel:httpStatus:AttachSecurityProfileResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
attachSecurityProfileResponse_httpStatus :: Lens.Lens' AttachSecurityProfileResponse Prelude.Int
attachSecurityProfileResponse_httpStatus :: (Int -> f Int)
-> AttachSecurityProfileResponse -> f AttachSecurityProfileResponse
attachSecurityProfileResponse_httpStatus = (AttachSecurityProfileResponse -> Int)
-> (AttachSecurityProfileResponse
-> Int -> AttachSecurityProfileResponse)
-> Lens
AttachSecurityProfileResponse AttachSecurityProfileResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachSecurityProfileResponse' {Int
httpStatus :: Int
$sel:httpStatus:AttachSecurityProfileResponse' :: AttachSecurityProfileResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AttachSecurityProfileResponse
s@AttachSecurityProfileResponse' {} Int
a -> AttachSecurityProfileResponse
s {$sel:httpStatus:AttachSecurityProfileResponse' :: Int
httpStatus = Int
a} :: AttachSecurityProfileResponse)
instance Prelude.NFData AttachSecurityProfileResponse