3434from otcextensions .sdk .apig .v2 import api_auth as _auth
3535from otcextensions .sdk .apig .v2 import acl_policy as _acl
3636from otcextensions .sdk .apig .v2 import acl_api_binding as _acl_api_binding
37+ from otcextensions .sdk .apig .v2 import custom_authorizer as _custom_auth
3738
3839
3940class Proxy (proxy .Proxy ):
@@ -2262,7 +2263,7 @@ def unbind_acls(self, gateway, **attrs):
22622263 """Unbind multiple access control policies from APIs in batch.
22632264
22642265 This method removes bindings between one or more ACL policies
2265- and APIs within the specified API Gateway instance.
2266+ and APIs within the specified API Gateway instance
22662267
22672268 :param gateway: The ID of the API Gateway instance or an instance of
22682269 :class:`~otcextensions.sdk.apig.v2.instance.Instance`
@@ -2279,3 +2280,136 @@ def unbind_acls(self, gateway, **attrs):
22792280 gateway_id = gateway .id ,
22802281 ** attrs
22812282 )
2283+
2284+ # ======== Custom Authorizer Methods ========
2285+
2286+ def custom_authorizers (self , gateway , ** attrs ):
2287+ """List all custom authorizers in an API Gateway instance
2288+
2289+ This method retrieves a list of custom authorizers configured within
2290+ the specified API Gateway instance. Custom authorizers allow you to
2291+ define your own logic for validating access tokens and identities
2292+
2293+ :param gateway: The ID of the API Gateway instance or an instance of
2294+ :class:`~otcextensions.sdk.apig.v2.instance.Instance`
2295+ :param attrs: Additional filters for listing custom authorizers,
2296+ such as name or type
2297+
2298+ :returns: A list of instances of
2299+ :class:`~otcextensions.sdk.apig.v2.custom_authorizer.
2300+ CustomAuthorizer`
2301+ """
2302+ gateway = self ._get_resource (_gateway .Gateway , gateway )
2303+ return self ._list (
2304+ _custom_auth .CustomAuthorizer ,
2305+ paginated = False ,
2306+ gateway_id = gateway .id ,
2307+ ** attrs
2308+ )
2309+
2310+ def get_custom_authorizer (self , gateway , custom_authorizer , ** attrs ):
2311+ """Retrieve details of a specific custom authorizer
2312+
2313+ This method retrieves detailed information about a custom authorizer
2314+ within the specified API Gateway instance
2315+
2316+ :param gateway: The ID of the API Gateway instance or an instance of
2317+ :class:`~otcextensions.sdk.apig.v2.instance.Instance`
2318+ :param custom_authorizer: The ID or an instance of
2319+ :class:`~otcextensions.sdk.apig.v2.custom_authorizer
2320+ CustomAuthorizer`
2321+ :param attrs: Additional parameters for retrieving
2322+ the custom authorizer
2323+
2324+ :returns: An instance of
2325+ :class:`~otcextensions.sdk.apig.v2.custom_authorizer.
2326+ CustomAuthorizer`
2327+ """
2328+ gateway = self ._get_resource (_gateway .Gateway , gateway )
2329+ custom_authorizer = self ._get_resource (_custom_auth .CustomAuthorizer ,
2330+ custom_authorizer )
2331+ return self ._get (
2332+ _custom_auth .CustomAuthorizer ,
2333+ custom_authorizer ,
2334+ gateway_id = gateway .id ,
2335+ ** attrs
2336+ )
2337+
2338+ def create_custom_authorizer (self , gateway , ** attrs ):
2339+ """Create a custom authorizer in an API Gateway instance
2340+
2341+ This method creates a new custom authorizer within the specified
2342+ API Gateway instance. Custom authorizers enable custom
2343+ authentication and authorization logic for APIs
2344+
2345+ :param gateway: The ID of the API Gateway or an instance of
2346+ :class:`~otcextensions.sdk.apig.v2.instance.Instance`
2347+ :param attrs: Attributes required to create the custom authorizer
2348+
2349+ :returns: An instance of
2350+ :class:`~otcextensions.sdk.apig.v2.custom_authorizer.
2351+ CustomAuthorizer`
2352+ """
2353+ gateway = self ._get_resource (_gateway .Gateway , gateway )
2354+ return self ._create (
2355+ _custom_auth .CustomAuthorizer ,
2356+ gateway_id = gateway .id ,
2357+ ** attrs
2358+ )
2359+
2360+ def update_custom_authorizer (self , gateway , custom_authorizer , ** attrs ):
2361+ """Update a custom authorizer
2362+
2363+ This method updates an existing custom authorizer within the specified
2364+ API Gateway instance
2365+
2366+ :param gateway: The ID of the API Gateway instance or an instance of
2367+ :class:`~otcextensions.sdk.apig.v2.instance.Instance`
2368+ :param custom_authorizer: The ID or an instance of
2369+ :class:`~otcextensions.sdk.apig.v2.custom_authorizer.
2370+ CustomAuthorizer`
2371+ :param attrs: Attributes to update
2372+
2373+ :returns: The updated instance of
2374+ :class:`~otcextensions.sdk.apig.v2.custom_authorizer.
2375+ CustomAuthorizer`
2376+ """
2377+ gateway = self ._get_resource (_gateway .Gateway , gateway )
2378+ custom_authorizer = self ._get_resource (_custom_auth .CustomAuthorizer ,
2379+ custom_authorizer )
2380+ return self ._update (
2381+ _custom_auth .CustomAuthorizer ,
2382+ custom_authorizer ,
2383+ gateway_id = gateway .id ,
2384+ ** attrs
2385+ )
2386+
2387+ def delete_custom_authorizer (self , gateway , custom_authorizer ,
2388+ ignore_missing = False ,
2389+ ** attrs ):
2390+ """Delete a custom authorizer
2391+
2392+ This method deletes a custom authorizer from the specified
2393+ API Gateway instance
2394+
2395+ :param gateway: The ID of the API Gateway instance or an instance of
2396+ :class:`~otcextensions.sdk.apig.v2.instance.Instance`
2397+ :param custom_authorizer: The ID or an instance of
2398+ :class:`~otcextensions.sdk.apig.v2.custom_authorizer.
2399+ CustomAuthorizer`
2400+ :param ignore_missing: If True, no exception is raised if
2401+ the authorizer does not exist
2402+ :param attrs: Additional parameters for the delete operation
2403+
2404+ :returns: None
2405+ """
2406+ gateway = self ._get_resource (_gateway .Gateway , gateway )
2407+ custom_authorizer = self ._get_resource (_custom_auth .CustomAuthorizer ,
2408+ custom_authorizer )
2409+ return self ._delete (
2410+ _custom_auth .CustomAuthorizer ,
2411+ custom_authorizer ,
2412+ gateway_id = gateway .id ,
2413+ ignore_missing = ignore_missing ,
2414+ ** attrs
2415+ )
0 commit comments