{-# 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.OpenSearchServerless.ListAccessPolicies
(
ListAccessPolicies (..),
newListAccessPolicies,
listAccessPolicies_maxResults,
listAccessPolicies_nextToken,
listAccessPolicies_resource,
listAccessPolicies_type,
ListAccessPoliciesResponse (..),
newListAccessPoliciesResponse,
listAccessPoliciesResponse_accessPolicySummaries,
listAccessPoliciesResponse_nextToken,
listAccessPoliciesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpenSearchServerless.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListAccessPolicies = ListAccessPolicies'
{
ListAccessPolicies -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListAccessPolicies -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAccessPolicies -> Maybe (NonEmpty Text)
resource :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
ListAccessPolicies -> AccessPolicyType
type' :: AccessPolicyType
}
deriving (ListAccessPolicies -> ListAccessPolicies -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccessPolicies -> ListAccessPolicies -> Bool
$c/= :: ListAccessPolicies -> ListAccessPolicies -> Bool
== :: ListAccessPolicies -> ListAccessPolicies -> Bool
$c== :: ListAccessPolicies -> ListAccessPolicies -> Bool
Prelude.Eq, ReadPrec [ListAccessPolicies]
ReadPrec ListAccessPolicies
Int -> ReadS ListAccessPolicies
ReadS [ListAccessPolicies]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccessPolicies]
$creadListPrec :: ReadPrec [ListAccessPolicies]
readPrec :: ReadPrec ListAccessPolicies
$creadPrec :: ReadPrec ListAccessPolicies
readList :: ReadS [ListAccessPolicies]
$creadList :: ReadS [ListAccessPolicies]
readsPrec :: Int -> ReadS ListAccessPolicies
$creadsPrec :: Int -> ReadS ListAccessPolicies
Prelude.Read, Int -> ListAccessPolicies -> ShowS
[ListAccessPolicies] -> ShowS
ListAccessPolicies -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccessPolicies] -> ShowS
$cshowList :: [ListAccessPolicies] -> ShowS
show :: ListAccessPolicies -> String
$cshow :: ListAccessPolicies -> String
showsPrec :: Int -> ListAccessPolicies -> ShowS
$cshowsPrec :: Int -> ListAccessPolicies -> ShowS
Prelude.Show, forall x. Rep ListAccessPolicies x -> ListAccessPolicies
forall x. ListAccessPolicies -> Rep ListAccessPolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAccessPolicies x -> ListAccessPolicies
$cfrom :: forall x. ListAccessPolicies -> Rep ListAccessPolicies x
Prelude.Generic)
newListAccessPolicies ::
AccessPolicyType ->
ListAccessPolicies
newListAccessPolicies :: AccessPolicyType -> ListAccessPolicies
newListAccessPolicies AccessPolicyType
pType_ =
ListAccessPolicies'
{ $sel:maxResults:ListAccessPolicies' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListAccessPolicies' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:resource:ListAccessPolicies' :: Maybe (NonEmpty Text)
resource = forall a. Maybe a
Prelude.Nothing,
$sel:type':ListAccessPolicies' :: AccessPolicyType
type' = AccessPolicyType
pType_
}
listAccessPolicies_maxResults :: Lens.Lens' ListAccessPolicies (Prelude.Maybe Prelude.Natural)
listAccessPolicies_maxResults :: Lens' ListAccessPolicies (Maybe Natural)
listAccessPolicies_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPolicies' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAccessPolicies' :: ListAccessPolicies -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAccessPolicies
s@ListAccessPolicies' {} Maybe Natural
a -> ListAccessPolicies
s {$sel:maxResults:ListAccessPolicies' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAccessPolicies)
listAccessPolicies_nextToken :: Lens.Lens' ListAccessPolicies (Prelude.Maybe Prelude.Text)
listAccessPolicies_nextToken :: Lens' ListAccessPolicies (Maybe Text)
listAccessPolicies_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPolicies' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccessPolicies
s@ListAccessPolicies' {} Maybe Text
a -> ListAccessPolicies
s {$sel:nextToken:ListAccessPolicies' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccessPolicies)
listAccessPolicies_resource :: Lens.Lens' ListAccessPolicies (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
listAccessPolicies_resource :: Lens' ListAccessPolicies (Maybe (NonEmpty Text))
listAccessPolicies_resource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPolicies' {Maybe (NonEmpty Text)
resource :: Maybe (NonEmpty Text)
$sel:resource:ListAccessPolicies' :: ListAccessPolicies -> Maybe (NonEmpty Text)
resource} -> Maybe (NonEmpty Text)
resource) (\s :: ListAccessPolicies
s@ListAccessPolicies' {} Maybe (NonEmpty Text)
a -> ListAccessPolicies
s {$sel:resource:ListAccessPolicies' :: Maybe (NonEmpty Text)
resource = Maybe (NonEmpty Text)
a} :: ListAccessPolicies) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listAccessPolicies_type :: Lens.Lens' ListAccessPolicies AccessPolicyType
listAccessPolicies_type :: Lens' ListAccessPolicies AccessPolicyType
listAccessPolicies_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPolicies' {AccessPolicyType
type' :: AccessPolicyType
$sel:type':ListAccessPolicies' :: ListAccessPolicies -> AccessPolicyType
type'} -> AccessPolicyType
type') (\s :: ListAccessPolicies
s@ListAccessPolicies' {} AccessPolicyType
a -> ListAccessPolicies
s {$sel:type':ListAccessPolicies' :: AccessPolicyType
type' = AccessPolicyType
a} :: ListAccessPolicies)
instance Core.AWSRequest ListAccessPolicies where
type
AWSResponse ListAccessPolicies =
ListAccessPoliciesResponse
request :: (Service -> Service)
-> ListAccessPolicies -> Request ListAccessPolicies
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 ListAccessPolicies
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListAccessPolicies)))
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 [AccessPolicySummary]
-> Maybe Text -> Int -> ListAccessPoliciesResponse
ListAccessPoliciesResponse'
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
"accessPolicySummaries"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
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 ListAccessPolicies where
hashWithSalt :: Int -> ListAccessPolicies -> Int
hashWithSalt Int
_salt ListAccessPolicies' {Maybe Natural
Maybe (NonEmpty Text)
Maybe Text
AccessPolicyType
type' :: AccessPolicyType
resource :: Maybe (NonEmpty Text)
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:type':ListAccessPolicies' :: ListAccessPolicies -> AccessPolicyType
$sel:resource:ListAccessPolicies' :: ListAccessPolicies -> Maybe (NonEmpty Text)
$sel:nextToken:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
$sel:maxResults:ListAccessPolicies' :: ListAccessPolicies -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
resource
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AccessPolicyType
type'
instance Prelude.NFData ListAccessPolicies where
rnf :: ListAccessPolicies -> ()
rnf ListAccessPolicies' {Maybe Natural
Maybe (NonEmpty Text)
Maybe Text
AccessPolicyType
type' :: AccessPolicyType
resource :: Maybe (NonEmpty Text)
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:type':ListAccessPolicies' :: ListAccessPolicies -> AccessPolicyType
$sel:resource:ListAccessPolicies' :: ListAccessPolicies -> Maybe (NonEmpty Text)
$sel:nextToken:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
$sel:maxResults:ListAccessPolicies' :: ListAccessPolicies -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
resource
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AccessPolicyType
type'
instance Data.ToHeaders ListAccessPolicies where
toHeaders :: ListAccessPolicies -> 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
"OpenSearchServerless.ListAccessPolicies" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListAccessPolicies where
toJSON :: ListAccessPolicies -> Value
toJSON ListAccessPolicies' {Maybe Natural
Maybe (NonEmpty Text)
Maybe Text
AccessPolicyType
type' :: AccessPolicyType
resource :: Maybe (NonEmpty Text)
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:type':ListAccessPolicies' :: ListAccessPolicies -> AccessPolicyType
$sel:resource:ListAccessPolicies' :: ListAccessPolicies -> Maybe (NonEmpty Text)
$sel:nextToken:ListAccessPolicies' :: ListAccessPolicies -> Maybe Text
$sel:maxResults:ListAccessPolicies' :: ListAccessPolicies -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Key
"resource" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
resource,
forall a. a -> Maybe a
Prelude.Just (Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AccessPolicyType
type')
]
)
instance Data.ToPath ListAccessPolicies where
toPath :: ListAccessPolicies -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListAccessPolicies where
toQuery :: ListAccessPolicies -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListAccessPoliciesResponse = ListAccessPoliciesResponse'
{
ListAccessPoliciesResponse -> Maybe [AccessPolicySummary]
accessPolicySummaries :: Prelude.Maybe [AccessPolicySummary],
ListAccessPoliciesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListAccessPoliciesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListAccessPoliciesResponse -> ListAccessPoliciesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccessPoliciesResponse -> ListAccessPoliciesResponse -> Bool
$c/= :: ListAccessPoliciesResponse -> ListAccessPoliciesResponse -> Bool
== :: ListAccessPoliciesResponse -> ListAccessPoliciesResponse -> Bool
$c== :: ListAccessPoliciesResponse -> ListAccessPoliciesResponse -> Bool
Prelude.Eq, ReadPrec [ListAccessPoliciesResponse]
ReadPrec ListAccessPoliciesResponse
Int -> ReadS ListAccessPoliciesResponse
ReadS [ListAccessPoliciesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccessPoliciesResponse]
$creadListPrec :: ReadPrec [ListAccessPoliciesResponse]
readPrec :: ReadPrec ListAccessPoliciesResponse
$creadPrec :: ReadPrec ListAccessPoliciesResponse
readList :: ReadS [ListAccessPoliciesResponse]
$creadList :: ReadS [ListAccessPoliciesResponse]
readsPrec :: Int -> ReadS ListAccessPoliciesResponse
$creadsPrec :: Int -> ReadS ListAccessPoliciesResponse
Prelude.Read, Int -> ListAccessPoliciesResponse -> ShowS
[ListAccessPoliciesResponse] -> ShowS
ListAccessPoliciesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccessPoliciesResponse] -> ShowS
$cshowList :: [ListAccessPoliciesResponse] -> ShowS
show :: ListAccessPoliciesResponse -> String
$cshow :: ListAccessPoliciesResponse -> String
showsPrec :: Int -> ListAccessPoliciesResponse -> ShowS
$cshowsPrec :: Int -> ListAccessPoliciesResponse -> ShowS
Prelude.Show, forall x.
Rep ListAccessPoliciesResponse x -> ListAccessPoliciesResponse
forall x.
ListAccessPoliciesResponse -> Rep ListAccessPoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAccessPoliciesResponse x -> ListAccessPoliciesResponse
$cfrom :: forall x.
ListAccessPoliciesResponse -> Rep ListAccessPoliciesResponse x
Prelude.Generic)
newListAccessPoliciesResponse ::
Prelude.Int ->
ListAccessPoliciesResponse
newListAccessPoliciesResponse :: Int -> ListAccessPoliciesResponse
newListAccessPoliciesResponse Int
pHttpStatus_ =
ListAccessPoliciesResponse'
{ $sel:accessPolicySummaries:ListAccessPoliciesResponse' :: Maybe [AccessPolicySummary]
accessPolicySummaries =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListAccessPoliciesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListAccessPoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listAccessPoliciesResponse_accessPolicySummaries :: Lens.Lens' ListAccessPoliciesResponse (Prelude.Maybe [AccessPolicySummary])
listAccessPoliciesResponse_accessPolicySummaries :: Lens' ListAccessPoliciesResponse (Maybe [AccessPolicySummary])
listAccessPoliciesResponse_accessPolicySummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPoliciesResponse' {Maybe [AccessPolicySummary]
accessPolicySummaries :: Maybe [AccessPolicySummary]
$sel:accessPolicySummaries:ListAccessPoliciesResponse' :: ListAccessPoliciesResponse -> Maybe [AccessPolicySummary]
accessPolicySummaries} -> Maybe [AccessPolicySummary]
accessPolicySummaries) (\s :: ListAccessPoliciesResponse
s@ListAccessPoliciesResponse' {} Maybe [AccessPolicySummary]
a -> ListAccessPoliciesResponse
s {$sel:accessPolicySummaries:ListAccessPoliciesResponse' :: Maybe [AccessPolicySummary]
accessPolicySummaries = Maybe [AccessPolicySummary]
a} :: ListAccessPoliciesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listAccessPoliciesResponse_nextToken :: Lens.Lens' ListAccessPoliciesResponse (Prelude.Maybe Prelude.Text)
listAccessPoliciesResponse_nextToken :: Lens' ListAccessPoliciesResponse (Maybe Text)
listAccessPoliciesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPoliciesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccessPoliciesResponse' :: ListAccessPoliciesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccessPoliciesResponse
s@ListAccessPoliciesResponse' {} Maybe Text
a -> ListAccessPoliciesResponse
s {$sel:nextToken:ListAccessPoliciesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccessPoliciesResponse)
listAccessPoliciesResponse_httpStatus :: Lens.Lens' ListAccessPoliciesResponse Prelude.Int
listAccessPoliciesResponse_httpStatus :: Lens' ListAccessPoliciesResponse Int
listAccessPoliciesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccessPoliciesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListAccessPoliciesResponse' :: ListAccessPoliciesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListAccessPoliciesResponse
s@ListAccessPoliciesResponse' {} Int
a -> ListAccessPoliciesResponse
s {$sel:httpStatus:ListAccessPoliciesResponse' :: Int
httpStatus = Int
a} :: ListAccessPoliciesResponse)
instance Prelude.NFData ListAccessPoliciesResponse where
rnf :: ListAccessPoliciesResponse -> ()
rnf ListAccessPoliciesResponse' {Int
Maybe [AccessPolicySummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
accessPolicySummaries :: Maybe [AccessPolicySummary]
$sel:httpStatus:ListAccessPoliciesResponse' :: ListAccessPoliciesResponse -> Int
$sel:nextToken:ListAccessPoliciesResponse' :: ListAccessPoliciesResponse -> Maybe Text
$sel:accessPolicySummaries:ListAccessPoliciesResponse' :: ListAccessPoliciesResponse -> Maybe [AccessPolicySummary]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [AccessPolicySummary]
accessPolicySummaries
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus