{-# 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.WorkSpaces.RevokeIpRules
(
RevokeIpRules (..),
newRevokeIpRules,
revokeIpRules_groupId,
revokeIpRules_userRules,
RevokeIpRulesResponse (..),
newRevokeIpRulesResponse,
revokeIpRulesResponse_httpStatus,
)
where
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
import Amazonka.WorkSpaces.Types
data RevokeIpRules = RevokeIpRules'
{
RevokeIpRules -> Text
groupId :: Prelude.Text,
RevokeIpRules -> [Text]
userRules :: [Prelude.Text]
}
deriving (RevokeIpRules -> RevokeIpRules -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevokeIpRules -> RevokeIpRules -> Bool
$c/= :: RevokeIpRules -> RevokeIpRules -> Bool
== :: RevokeIpRules -> RevokeIpRules -> Bool
$c== :: RevokeIpRules -> RevokeIpRules -> Bool
Prelude.Eq, ReadPrec [RevokeIpRules]
ReadPrec RevokeIpRules
Int -> ReadS RevokeIpRules
ReadS [RevokeIpRules]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevokeIpRules]
$creadListPrec :: ReadPrec [RevokeIpRules]
readPrec :: ReadPrec RevokeIpRules
$creadPrec :: ReadPrec RevokeIpRules
readList :: ReadS [RevokeIpRules]
$creadList :: ReadS [RevokeIpRules]
readsPrec :: Int -> ReadS RevokeIpRules
$creadsPrec :: Int -> ReadS RevokeIpRules
Prelude.Read, Int -> RevokeIpRules -> ShowS
[RevokeIpRules] -> ShowS
RevokeIpRules -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevokeIpRules] -> ShowS
$cshowList :: [RevokeIpRules] -> ShowS
show :: RevokeIpRules -> String
$cshow :: RevokeIpRules -> String
showsPrec :: Int -> RevokeIpRules -> ShowS
$cshowsPrec :: Int -> RevokeIpRules -> ShowS
Prelude.Show, forall x. Rep RevokeIpRules x -> RevokeIpRules
forall x. RevokeIpRules -> Rep RevokeIpRules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RevokeIpRules x -> RevokeIpRules
$cfrom :: forall x. RevokeIpRules -> Rep RevokeIpRules x
Prelude.Generic)
newRevokeIpRules ::
Prelude.Text ->
RevokeIpRules
newRevokeIpRules :: Text -> RevokeIpRules
newRevokeIpRules Text
pGroupId_ =
RevokeIpRules'
{ $sel:groupId:RevokeIpRules' :: Text
groupId = Text
pGroupId_,
$sel:userRules:RevokeIpRules' :: [Text]
userRules = forall a. Monoid a => a
Prelude.mempty
}
revokeIpRules_groupId :: Lens.Lens' RevokeIpRules Prelude.Text
revokeIpRules_groupId :: Lens' RevokeIpRules Text
revokeIpRules_groupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeIpRules' {Text
groupId :: Text
$sel:groupId:RevokeIpRules' :: RevokeIpRules -> Text
groupId} -> Text
groupId) (\s :: RevokeIpRules
s@RevokeIpRules' {} Text
a -> RevokeIpRules
s {$sel:groupId:RevokeIpRules' :: Text
groupId = Text
a} :: RevokeIpRules)
revokeIpRules_userRules :: Lens.Lens' RevokeIpRules [Prelude.Text]
revokeIpRules_userRules :: Lens' RevokeIpRules [Text]
revokeIpRules_userRules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeIpRules' {[Text]
userRules :: [Text]
$sel:userRules:RevokeIpRules' :: RevokeIpRules -> [Text]
userRules} -> [Text]
userRules) (\s :: RevokeIpRules
s@RevokeIpRules' {} [Text]
a -> RevokeIpRules
s {$sel:userRules:RevokeIpRules' :: [Text]
userRules = [Text]
a} :: RevokeIpRules) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest RevokeIpRules where
type
AWSResponse RevokeIpRules =
RevokeIpRulesResponse
request :: (Service -> Service) -> RevokeIpRules -> Request RevokeIpRules
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 RevokeIpRules
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RevokeIpRules)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> RevokeIpRulesResponse
RevokeIpRulesResponse'
forall (f :: * -> *) a b. Functor 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 RevokeIpRules where
hashWithSalt :: Int -> RevokeIpRules -> Int
hashWithSalt Int
_salt RevokeIpRules' {[Text]
Text
userRules :: [Text]
groupId :: Text
$sel:userRules:RevokeIpRules' :: RevokeIpRules -> [Text]
$sel:groupId:RevokeIpRules' :: RevokeIpRules -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
groupId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
userRules
instance Prelude.NFData RevokeIpRules where
rnf :: RevokeIpRules -> ()
rnf RevokeIpRules' {[Text]
Text
userRules :: [Text]
groupId :: Text
$sel:userRules:RevokeIpRules' :: RevokeIpRules -> [Text]
$sel:groupId:RevokeIpRules' :: RevokeIpRules -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
groupId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
userRules
instance Data.ToHeaders RevokeIpRules where
toHeaders :: RevokeIpRules -> 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
"WorkspacesService.RevokeIpRules" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON RevokeIpRules where
toJSON :: RevokeIpRules -> Value
toJSON RevokeIpRules' {[Text]
Text
userRules :: [Text]
groupId :: Text
$sel:userRules:RevokeIpRules' :: RevokeIpRules -> [Text]
$sel:groupId:RevokeIpRules' :: RevokeIpRules -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"GroupId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
groupId),
forall a. a -> Maybe a
Prelude.Just (Key
"UserRules" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
userRules)
]
)
instance Data.ToPath RevokeIpRules where
toPath :: RevokeIpRules -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery RevokeIpRules where
toQuery :: RevokeIpRules -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data RevokeIpRulesResponse = RevokeIpRulesResponse'
{
RevokeIpRulesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RevokeIpRulesResponse -> RevokeIpRulesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevokeIpRulesResponse -> RevokeIpRulesResponse -> Bool
$c/= :: RevokeIpRulesResponse -> RevokeIpRulesResponse -> Bool
== :: RevokeIpRulesResponse -> RevokeIpRulesResponse -> Bool
$c== :: RevokeIpRulesResponse -> RevokeIpRulesResponse -> Bool
Prelude.Eq, ReadPrec [RevokeIpRulesResponse]
ReadPrec RevokeIpRulesResponse
Int -> ReadS RevokeIpRulesResponse
ReadS [RevokeIpRulesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevokeIpRulesResponse]
$creadListPrec :: ReadPrec [RevokeIpRulesResponse]
readPrec :: ReadPrec RevokeIpRulesResponse
$creadPrec :: ReadPrec RevokeIpRulesResponse
readList :: ReadS [RevokeIpRulesResponse]
$creadList :: ReadS [RevokeIpRulesResponse]
readsPrec :: Int -> ReadS RevokeIpRulesResponse
$creadsPrec :: Int -> ReadS RevokeIpRulesResponse
Prelude.Read, Int -> RevokeIpRulesResponse -> ShowS
[RevokeIpRulesResponse] -> ShowS
RevokeIpRulesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevokeIpRulesResponse] -> ShowS
$cshowList :: [RevokeIpRulesResponse] -> ShowS
show :: RevokeIpRulesResponse -> String
$cshow :: RevokeIpRulesResponse -> String
showsPrec :: Int -> RevokeIpRulesResponse -> ShowS
$cshowsPrec :: Int -> RevokeIpRulesResponse -> ShowS
Prelude.Show, forall x. Rep RevokeIpRulesResponse x -> RevokeIpRulesResponse
forall x. RevokeIpRulesResponse -> Rep RevokeIpRulesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RevokeIpRulesResponse x -> RevokeIpRulesResponse
$cfrom :: forall x. RevokeIpRulesResponse -> Rep RevokeIpRulesResponse x
Prelude.Generic)
newRevokeIpRulesResponse ::
Prelude.Int ->
RevokeIpRulesResponse
newRevokeIpRulesResponse :: Int -> RevokeIpRulesResponse
newRevokeIpRulesResponse Int
pHttpStatus_ =
RevokeIpRulesResponse' {$sel:httpStatus:RevokeIpRulesResponse' :: Int
httpStatus = Int
pHttpStatus_}
revokeIpRulesResponse_httpStatus :: Lens.Lens' RevokeIpRulesResponse Prelude.Int
revokeIpRulesResponse_httpStatus :: Lens' RevokeIpRulesResponse Int
revokeIpRulesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeIpRulesResponse' {Int
httpStatus :: Int
$sel:httpStatus:RevokeIpRulesResponse' :: RevokeIpRulesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RevokeIpRulesResponse
s@RevokeIpRulesResponse' {} Int
a -> RevokeIpRulesResponse
s {$sel:httpStatus:RevokeIpRulesResponse' :: Int
httpStatus = Int
a} :: RevokeIpRulesResponse)
instance Prelude.NFData RevokeIpRulesResponse where
rnf :: RevokeIpRulesResponse -> ()
rnf RevokeIpRulesResponse' {Int
httpStatus :: Int
$sel:httpStatus:RevokeIpRulesResponse' :: RevokeIpRulesResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus