{-# 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.UpdateRulesOfIpGroup
(
UpdateRulesOfIpGroup (..),
newUpdateRulesOfIpGroup,
updateRulesOfIpGroup_groupId,
updateRulesOfIpGroup_userRules,
UpdateRulesOfIpGroupResponse (..),
newUpdateRulesOfIpGroupResponse,
updateRulesOfIpGroupResponse_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 UpdateRulesOfIpGroup = UpdateRulesOfIpGroup'
{
UpdateRulesOfIpGroup -> Text
groupId :: Prelude.Text,
UpdateRulesOfIpGroup -> [IpRuleItem]
userRules :: [IpRuleItem]
}
deriving (UpdateRulesOfIpGroup -> UpdateRulesOfIpGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRulesOfIpGroup -> UpdateRulesOfIpGroup -> Bool
$c/= :: UpdateRulesOfIpGroup -> UpdateRulesOfIpGroup -> Bool
== :: UpdateRulesOfIpGroup -> UpdateRulesOfIpGroup -> Bool
$c== :: UpdateRulesOfIpGroup -> UpdateRulesOfIpGroup -> Bool
Prelude.Eq, ReadPrec [UpdateRulesOfIpGroup]
ReadPrec UpdateRulesOfIpGroup
Int -> ReadS UpdateRulesOfIpGroup
ReadS [UpdateRulesOfIpGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRulesOfIpGroup]
$creadListPrec :: ReadPrec [UpdateRulesOfIpGroup]
readPrec :: ReadPrec UpdateRulesOfIpGroup
$creadPrec :: ReadPrec UpdateRulesOfIpGroup
readList :: ReadS [UpdateRulesOfIpGroup]
$creadList :: ReadS [UpdateRulesOfIpGroup]
readsPrec :: Int -> ReadS UpdateRulesOfIpGroup
$creadsPrec :: Int -> ReadS UpdateRulesOfIpGroup
Prelude.Read, Int -> UpdateRulesOfIpGroup -> ShowS
[UpdateRulesOfIpGroup] -> ShowS
UpdateRulesOfIpGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRulesOfIpGroup] -> ShowS
$cshowList :: [UpdateRulesOfIpGroup] -> ShowS
show :: UpdateRulesOfIpGroup -> String
$cshow :: UpdateRulesOfIpGroup -> String
showsPrec :: Int -> UpdateRulesOfIpGroup -> ShowS
$cshowsPrec :: Int -> UpdateRulesOfIpGroup -> ShowS
Prelude.Show, forall x. Rep UpdateRulesOfIpGroup x -> UpdateRulesOfIpGroup
forall x. UpdateRulesOfIpGroup -> Rep UpdateRulesOfIpGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRulesOfIpGroup x -> UpdateRulesOfIpGroup
$cfrom :: forall x. UpdateRulesOfIpGroup -> Rep UpdateRulesOfIpGroup x
Prelude.Generic)
newUpdateRulesOfIpGroup ::
Prelude.Text ->
UpdateRulesOfIpGroup
newUpdateRulesOfIpGroup :: Text -> UpdateRulesOfIpGroup
newUpdateRulesOfIpGroup Text
pGroupId_ =
UpdateRulesOfIpGroup'
{ $sel:groupId:UpdateRulesOfIpGroup' :: Text
groupId = Text
pGroupId_,
$sel:userRules:UpdateRulesOfIpGroup' :: [IpRuleItem]
userRules = forall a. Monoid a => a
Prelude.mempty
}
updateRulesOfIpGroup_groupId :: Lens.Lens' UpdateRulesOfIpGroup Prelude.Text
updateRulesOfIpGroup_groupId :: Lens' UpdateRulesOfIpGroup Text
updateRulesOfIpGroup_groupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRulesOfIpGroup' {Text
groupId :: Text
$sel:groupId:UpdateRulesOfIpGroup' :: UpdateRulesOfIpGroup -> Text
groupId} -> Text
groupId) (\s :: UpdateRulesOfIpGroup
s@UpdateRulesOfIpGroup' {} Text
a -> UpdateRulesOfIpGroup
s {$sel:groupId:UpdateRulesOfIpGroup' :: Text
groupId = Text
a} :: UpdateRulesOfIpGroup)
updateRulesOfIpGroup_userRules :: Lens.Lens' UpdateRulesOfIpGroup [IpRuleItem]
updateRulesOfIpGroup_userRules :: Lens' UpdateRulesOfIpGroup [IpRuleItem]
updateRulesOfIpGroup_userRules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRulesOfIpGroup' {[IpRuleItem]
userRules :: [IpRuleItem]
$sel:userRules:UpdateRulesOfIpGroup' :: UpdateRulesOfIpGroup -> [IpRuleItem]
userRules} -> [IpRuleItem]
userRules) (\s :: UpdateRulesOfIpGroup
s@UpdateRulesOfIpGroup' {} [IpRuleItem]
a -> UpdateRulesOfIpGroup
s {$sel:userRules:UpdateRulesOfIpGroup' :: [IpRuleItem]
userRules = [IpRuleItem]
a} :: UpdateRulesOfIpGroup) 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 UpdateRulesOfIpGroup where
type
AWSResponse UpdateRulesOfIpGroup =
UpdateRulesOfIpGroupResponse
request :: (Service -> Service)
-> UpdateRulesOfIpGroup -> Request UpdateRulesOfIpGroup
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 UpdateRulesOfIpGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateRulesOfIpGroup)))
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 -> UpdateRulesOfIpGroupResponse
UpdateRulesOfIpGroupResponse'
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 UpdateRulesOfIpGroup where
hashWithSalt :: Int -> UpdateRulesOfIpGroup -> Int
hashWithSalt Int
_salt UpdateRulesOfIpGroup' {[IpRuleItem]
Text
userRules :: [IpRuleItem]
groupId :: Text
$sel:userRules:UpdateRulesOfIpGroup' :: UpdateRulesOfIpGroup -> [IpRuleItem]
$sel:groupId:UpdateRulesOfIpGroup' :: UpdateRulesOfIpGroup -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
groupId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [IpRuleItem]
userRules
instance Prelude.NFData UpdateRulesOfIpGroup where
rnf :: UpdateRulesOfIpGroup -> ()
rnf UpdateRulesOfIpGroup' {[IpRuleItem]
Text
userRules :: [IpRuleItem]
groupId :: Text
$sel:userRules:UpdateRulesOfIpGroup' :: UpdateRulesOfIpGroup -> [IpRuleItem]
$sel:groupId:UpdateRulesOfIpGroup' :: UpdateRulesOfIpGroup -> 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 [IpRuleItem]
userRules
instance Data.ToHeaders UpdateRulesOfIpGroup where
toHeaders :: UpdateRulesOfIpGroup -> 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.UpdateRulesOfIpGroup" ::
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 UpdateRulesOfIpGroup where
toJSON :: UpdateRulesOfIpGroup -> Value
toJSON UpdateRulesOfIpGroup' {[IpRuleItem]
Text
userRules :: [IpRuleItem]
groupId :: Text
$sel:userRules:UpdateRulesOfIpGroup' :: UpdateRulesOfIpGroup -> [IpRuleItem]
$sel:groupId:UpdateRulesOfIpGroup' :: UpdateRulesOfIpGroup -> 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..= [IpRuleItem]
userRules)
]
)
instance Data.ToPath UpdateRulesOfIpGroup where
toPath :: UpdateRulesOfIpGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateRulesOfIpGroup where
toQuery :: UpdateRulesOfIpGroup -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateRulesOfIpGroupResponse = UpdateRulesOfIpGroupResponse'
{
UpdateRulesOfIpGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateRulesOfIpGroupResponse
-> UpdateRulesOfIpGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRulesOfIpGroupResponse
-> UpdateRulesOfIpGroupResponse -> Bool
$c/= :: UpdateRulesOfIpGroupResponse
-> UpdateRulesOfIpGroupResponse -> Bool
== :: UpdateRulesOfIpGroupResponse
-> UpdateRulesOfIpGroupResponse -> Bool
$c== :: UpdateRulesOfIpGroupResponse
-> UpdateRulesOfIpGroupResponse -> Bool
Prelude.Eq, ReadPrec [UpdateRulesOfIpGroupResponse]
ReadPrec UpdateRulesOfIpGroupResponse
Int -> ReadS UpdateRulesOfIpGroupResponse
ReadS [UpdateRulesOfIpGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRulesOfIpGroupResponse]
$creadListPrec :: ReadPrec [UpdateRulesOfIpGroupResponse]
readPrec :: ReadPrec UpdateRulesOfIpGroupResponse
$creadPrec :: ReadPrec UpdateRulesOfIpGroupResponse
readList :: ReadS [UpdateRulesOfIpGroupResponse]
$creadList :: ReadS [UpdateRulesOfIpGroupResponse]
readsPrec :: Int -> ReadS UpdateRulesOfIpGroupResponse
$creadsPrec :: Int -> ReadS UpdateRulesOfIpGroupResponse
Prelude.Read, Int -> UpdateRulesOfIpGroupResponse -> ShowS
[UpdateRulesOfIpGroupResponse] -> ShowS
UpdateRulesOfIpGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRulesOfIpGroupResponse] -> ShowS
$cshowList :: [UpdateRulesOfIpGroupResponse] -> ShowS
show :: UpdateRulesOfIpGroupResponse -> String
$cshow :: UpdateRulesOfIpGroupResponse -> String
showsPrec :: Int -> UpdateRulesOfIpGroupResponse -> ShowS
$cshowsPrec :: Int -> UpdateRulesOfIpGroupResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateRulesOfIpGroupResponse x -> UpdateRulesOfIpGroupResponse
forall x.
UpdateRulesOfIpGroupResponse -> Rep UpdateRulesOfIpGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateRulesOfIpGroupResponse x -> UpdateRulesOfIpGroupResponse
$cfrom :: forall x.
UpdateRulesOfIpGroupResponse -> Rep UpdateRulesOfIpGroupResponse x
Prelude.Generic)
newUpdateRulesOfIpGroupResponse ::
Prelude.Int ->
UpdateRulesOfIpGroupResponse
newUpdateRulesOfIpGroupResponse :: Int -> UpdateRulesOfIpGroupResponse
newUpdateRulesOfIpGroupResponse Int
pHttpStatus_ =
UpdateRulesOfIpGroupResponse'
{ $sel:httpStatus:UpdateRulesOfIpGroupResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateRulesOfIpGroupResponse_httpStatus :: Lens.Lens' UpdateRulesOfIpGroupResponse Prelude.Int
updateRulesOfIpGroupResponse_httpStatus :: Lens' UpdateRulesOfIpGroupResponse Int
updateRulesOfIpGroupResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRulesOfIpGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateRulesOfIpGroupResponse' :: UpdateRulesOfIpGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateRulesOfIpGroupResponse
s@UpdateRulesOfIpGroupResponse' {} Int
a -> UpdateRulesOfIpGroupResponse
s {$sel:httpStatus:UpdateRulesOfIpGroupResponse' :: Int
httpStatus = Int
a} :: UpdateRulesOfIpGroupResponse)
instance Prelude.NFData UpdateRulesOfIpGroupResponse where
rnf :: UpdateRulesOfIpGroupResponse -> ()
rnf UpdateRulesOfIpGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateRulesOfIpGroupResponse' :: UpdateRulesOfIpGroupResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus