{-# 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.AuthorizeIpRules
(
AuthorizeIpRules (..),
newAuthorizeIpRules,
authorizeIpRules_groupId,
authorizeIpRules_userRules,
AuthorizeIpRulesResponse (..),
newAuthorizeIpRulesResponse,
authorizeIpRulesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WorkSpaces.Types
data AuthorizeIpRules = AuthorizeIpRules'
{
AuthorizeIpRules -> Text
groupId :: Prelude.Text,
AuthorizeIpRules -> [IpRuleItem]
userRules :: [IpRuleItem]
}
deriving (AuthorizeIpRules -> AuthorizeIpRules -> Bool
(AuthorizeIpRules -> AuthorizeIpRules -> Bool)
-> (AuthorizeIpRules -> AuthorizeIpRules -> Bool)
-> Eq AuthorizeIpRules
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuthorizeIpRules -> AuthorizeIpRules -> Bool
$c/= :: AuthorizeIpRules -> AuthorizeIpRules -> Bool
== :: AuthorizeIpRules -> AuthorizeIpRules -> Bool
$c== :: AuthorizeIpRules -> AuthorizeIpRules -> Bool
Prelude.Eq, ReadPrec [AuthorizeIpRules]
ReadPrec AuthorizeIpRules
Int -> ReadS AuthorizeIpRules
ReadS [AuthorizeIpRules]
(Int -> ReadS AuthorizeIpRules)
-> ReadS [AuthorizeIpRules]
-> ReadPrec AuthorizeIpRules
-> ReadPrec [AuthorizeIpRules]
-> Read AuthorizeIpRules
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuthorizeIpRules]
$creadListPrec :: ReadPrec [AuthorizeIpRules]
readPrec :: ReadPrec AuthorizeIpRules
$creadPrec :: ReadPrec AuthorizeIpRules
readList :: ReadS [AuthorizeIpRules]
$creadList :: ReadS [AuthorizeIpRules]
readsPrec :: Int -> ReadS AuthorizeIpRules
$creadsPrec :: Int -> ReadS AuthorizeIpRules
Prelude.Read, Int -> AuthorizeIpRules -> ShowS
[AuthorizeIpRules] -> ShowS
AuthorizeIpRules -> String
(Int -> AuthorizeIpRules -> ShowS)
-> (AuthorizeIpRules -> String)
-> ([AuthorizeIpRules] -> ShowS)
-> Show AuthorizeIpRules
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuthorizeIpRules] -> ShowS
$cshowList :: [AuthorizeIpRules] -> ShowS
show :: AuthorizeIpRules -> String
$cshow :: AuthorizeIpRules -> String
showsPrec :: Int -> AuthorizeIpRules -> ShowS
$cshowsPrec :: Int -> AuthorizeIpRules -> ShowS
Prelude.Show, (forall x. AuthorizeIpRules -> Rep AuthorizeIpRules x)
-> (forall x. Rep AuthorizeIpRules x -> AuthorizeIpRules)
-> Generic AuthorizeIpRules
forall x. Rep AuthorizeIpRules x -> AuthorizeIpRules
forall x. AuthorizeIpRules -> Rep AuthorizeIpRules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AuthorizeIpRules x -> AuthorizeIpRules
$cfrom :: forall x. AuthorizeIpRules -> Rep AuthorizeIpRules x
Prelude.Generic)
newAuthorizeIpRules ::
Prelude.Text ->
AuthorizeIpRules
newAuthorizeIpRules :: Text -> AuthorizeIpRules
newAuthorizeIpRules Text
pGroupId_ =
AuthorizeIpRules' :: Text -> [IpRuleItem] -> AuthorizeIpRules
AuthorizeIpRules'
{ $sel:groupId:AuthorizeIpRules' :: Text
groupId = Text
pGroupId_,
$sel:userRules:AuthorizeIpRules' :: [IpRuleItem]
userRules = [IpRuleItem]
forall a. Monoid a => a
Prelude.mempty
}
authorizeIpRules_groupId :: Lens.Lens' AuthorizeIpRules Prelude.Text
authorizeIpRules_groupId :: (Text -> f Text) -> AuthorizeIpRules -> f AuthorizeIpRules
authorizeIpRules_groupId = (AuthorizeIpRules -> Text)
-> (AuthorizeIpRules -> Text -> AuthorizeIpRules)
-> Lens AuthorizeIpRules AuthorizeIpRules Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthorizeIpRules' {Text
groupId :: Text
$sel:groupId:AuthorizeIpRules' :: AuthorizeIpRules -> Text
groupId} -> Text
groupId) (\s :: AuthorizeIpRules
s@AuthorizeIpRules' {} Text
a -> AuthorizeIpRules
s {$sel:groupId:AuthorizeIpRules' :: Text
groupId = Text
a} :: AuthorizeIpRules)
authorizeIpRules_userRules :: Lens.Lens' AuthorizeIpRules [IpRuleItem]
authorizeIpRules_userRules :: ([IpRuleItem] -> f [IpRuleItem])
-> AuthorizeIpRules -> f AuthorizeIpRules
authorizeIpRules_userRules = (AuthorizeIpRules -> [IpRuleItem])
-> (AuthorizeIpRules -> [IpRuleItem] -> AuthorizeIpRules)
-> Lens AuthorizeIpRules AuthorizeIpRules [IpRuleItem] [IpRuleItem]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthorizeIpRules' {[IpRuleItem]
userRules :: [IpRuleItem]
$sel:userRules:AuthorizeIpRules' :: AuthorizeIpRules -> [IpRuleItem]
userRules} -> [IpRuleItem]
userRules) (\s :: AuthorizeIpRules
s@AuthorizeIpRules' {} [IpRuleItem]
a -> AuthorizeIpRules
s {$sel:userRules:AuthorizeIpRules' :: [IpRuleItem]
userRules = [IpRuleItem]
a} :: AuthorizeIpRules) (([IpRuleItem] -> f [IpRuleItem])
-> AuthorizeIpRules -> f AuthorizeIpRules)
-> (([IpRuleItem] -> f [IpRuleItem])
-> [IpRuleItem] -> f [IpRuleItem])
-> ([IpRuleItem] -> f [IpRuleItem])
-> AuthorizeIpRules
-> f AuthorizeIpRules
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([IpRuleItem] -> f [IpRuleItem]) -> [IpRuleItem] -> f [IpRuleItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest AuthorizeIpRules where
type
AWSResponse AuthorizeIpRules =
AuthorizeIpRulesResponse
request :: AuthorizeIpRules -> Request AuthorizeIpRules
request = Service -> AuthorizeIpRules -> Request AuthorizeIpRules
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AuthorizeIpRules
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AuthorizeIpRules)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AuthorizeIpRules))
-> Logger
-> Service
-> Proxy AuthorizeIpRules
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AuthorizeIpRules)))
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 -> AuthorizeIpRulesResponse
AuthorizeIpRulesResponse'
(Int -> AuthorizeIpRulesResponse)
-> Either String Int -> Either String AuthorizeIpRulesResponse
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 AuthorizeIpRules
instance Prelude.NFData AuthorizeIpRules
instance Core.ToHeaders AuthorizeIpRules where
toHeaders :: AuthorizeIpRules -> ResponseHeaders
toHeaders =
ResponseHeaders -> AuthorizeIpRules -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"WorkspacesService.AuthorizeIpRules" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON AuthorizeIpRules where
toJSON :: AuthorizeIpRules -> Value
toJSON AuthorizeIpRules' {[IpRuleItem]
Text
userRules :: [IpRuleItem]
groupId :: Text
$sel:userRules:AuthorizeIpRules' :: AuthorizeIpRules -> [IpRuleItem]
$sel:groupId:AuthorizeIpRules' :: AuthorizeIpRules -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
groupId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserRules" Text -> [IpRuleItem] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [IpRuleItem]
userRules)
]
)
instance Core.ToPath AuthorizeIpRules where
toPath :: AuthorizeIpRules -> ByteString
toPath = ByteString -> AuthorizeIpRules -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AuthorizeIpRules where
toQuery :: AuthorizeIpRules -> QueryString
toQuery = QueryString -> AuthorizeIpRules -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AuthorizeIpRulesResponse = AuthorizeIpRulesResponse'
{
AuthorizeIpRulesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AuthorizeIpRulesResponse -> AuthorizeIpRulesResponse -> Bool
(AuthorizeIpRulesResponse -> AuthorizeIpRulesResponse -> Bool)
-> (AuthorizeIpRulesResponse -> AuthorizeIpRulesResponse -> Bool)
-> Eq AuthorizeIpRulesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuthorizeIpRulesResponse -> AuthorizeIpRulesResponse -> Bool
$c/= :: AuthorizeIpRulesResponse -> AuthorizeIpRulesResponse -> Bool
== :: AuthorizeIpRulesResponse -> AuthorizeIpRulesResponse -> Bool
$c== :: AuthorizeIpRulesResponse -> AuthorizeIpRulesResponse -> Bool
Prelude.Eq, ReadPrec [AuthorizeIpRulesResponse]
ReadPrec AuthorizeIpRulesResponse
Int -> ReadS AuthorizeIpRulesResponse
ReadS [AuthorizeIpRulesResponse]
(Int -> ReadS AuthorizeIpRulesResponse)
-> ReadS [AuthorizeIpRulesResponse]
-> ReadPrec AuthorizeIpRulesResponse
-> ReadPrec [AuthorizeIpRulesResponse]
-> Read AuthorizeIpRulesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuthorizeIpRulesResponse]
$creadListPrec :: ReadPrec [AuthorizeIpRulesResponse]
readPrec :: ReadPrec AuthorizeIpRulesResponse
$creadPrec :: ReadPrec AuthorizeIpRulesResponse
readList :: ReadS [AuthorizeIpRulesResponse]
$creadList :: ReadS [AuthorizeIpRulesResponse]
readsPrec :: Int -> ReadS AuthorizeIpRulesResponse
$creadsPrec :: Int -> ReadS AuthorizeIpRulesResponse
Prelude.Read, Int -> AuthorizeIpRulesResponse -> ShowS
[AuthorizeIpRulesResponse] -> ShowS
AuthorizeIpRulesResponse -> String
(Int -> AuthorizeIpRulesResponse -> ShowS)
-> (AuthorizeIpRulesResponse -> String)
-> ([AuthorizeIpRulesResponse] -> ShowS)
-> Show AuthorizeIpRulesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuthorizeIpRulesResponse] -> ShowS
$cshowList :: [AuthorizeIpRulesResponse] -> ShowS
show :: AuthorizeIpRulesResponse -> String
$cshow :: AuthorizeIpRulesResponse -> String
showsPrec :: Int -> AuthorizeIpRulesResponse -> ShowS
$cshowsPrec :: Int -> AuthorizeIpRulesResponse -> ShowS
Prelude.Show, (forall x.
AuthorizeIpRulesResponse -> Rep AuthorizeIpRulesResponse x)
-> (forall x.
Rep AuthorizeIpRulesResponse x -> AuthorizeIpRulesResponse)
-> Generic AuthorizeIpRulesResponse
forall x.
Rep AuthorizeIpRulesResponse x -> AuthorizeIpRulesResponse
forall x.
AuthorizeIpRulesResponse -> Rep AuthorizeIpRulesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AuthorizeIpRulesResponse x -> AuthorizeIpRulesResponse
$cfrom :: forall x.
AuthorizeIpRulesResponse -> Rep AuthorizeIpRulesResponse x
Prelude.Generic)
newAuthorizeIpRulesResponse ::
Prelude.Int ->
AuthorizeIpRulesResponse
newAuthorizeIpRulesResponse :: Int -> AuthorizeIpRulesResponse
newAuthorizeIpRulesResponse Int
pHttpStatus_ =
AuthorizeIpRulesResponse' :: Int -> AuthorizeIpRulesResponse
AuthorizeIpRulesResponse'
{ $sel:httpStatus:AuthorizeIpRulesResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
authorizeIpRulesResponse_httpStatus :: Lens.Lens' AuthorizeIpRulesResponse Prelude.Int
authorizeIpRulesResponse_httpStatus :: (Int -> f Int)
-> AuthorizeIpRulesResponse -> f AuthorizeIpRulesResponse
authorizeIpRulesResponse_httpStatus = (AuthorizeIpRulesResponse -> Int)
-> (AuthorizeIpRulesResponse -> Int -> AuthorizeIpRulesResponse)
-> Lens AuthorizeIpRulesResponse AuthorizeIpRulesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthorizeIpRulesResponse' {Int
httpStatus :: Int
$sel:httpStatus:AuthorizeIpRulesResponse' :: AuthorizeIpRulesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AuthorizeIpRulesResponse
s@AuthorizeIpRulesResponse' {} Int
a -> AuthorizeIpRulesResponse
s {$sel:httpStatus:AuthorizeIpRulesResponse' :: Int
httpStatus = Int
a} :: AuthorizeIpRulesResponse)
instance Prelude.NFData AuthorizeIpRulesResponse