Skip to content

Latest commit

 

History

History
87 lines (60 loc) · 11.1 KB

File metadata and controls

87 lines (60 loc) · 11.1 KB

EffectivePolicies

Overview

Available Operations

  • list - Get effective policies

list

Retrieve all roles (along with their system permission policies) associated with principals, and all custom permission policies directly added to principals, all within a specified scope.

Optionally specify a principal to only include roles and policies associated with that principal.

Example Usage

# Synchronous Example
import cloudinary_account_provisioning
from cloudinary_account_provisioning import CldProvisioning


with CldProvisioning(
    account_id="<id>",
    security=cloudinary_account_provisioning.Security(
        provisioning_api_key="CLOUDINARY_PROVISIONING_API_KEY",
        provisioning_api_secret="CLOUDINARY_PROVISIONING_API_SECRET",
    ),
) as cld_provisioning:

    res = cld_provisioning.effective_policies.list(scope_type=cloudinary_account_provisioning.ScopeTypeEnum.PRODENV, principal_type=cloudinary_account_provisioning.PrincipalTypeEnum.USER)

    # Handle response
    print(res)

An Async SDK client can also be used to make asynchronous requests by importing it and asyncio.

# Asynchronous Example
import asyncio
import cloudinary_account_provisioning
from cloudinary_account_provisioning import AsyncCldProvisioning

async def main():

    async with AsyncCldProvisioning(
        account_id="<id>",
        security=cloudinary_account_provisioning.Security(
            provisioning_api_key="CLOUDINARY_PROVISIONING_API_KEY",
            provisioning_api_secret="CLOUDINARY_PROVISIONING_API_SECRET",
        ),
    ) as cld_provisioning:

        res = await cld_provisioning.effective_policies.list(scope_type=cloudinary_account_provisioning.ScopeTypeEnum.PRODENV, principal_type=cloudinary_account_provisioning.PrincipalTypeEnum.USER)

        # Handle response
        print(res)

asyncio.run(main())

Parameters

Parameter Type Required Description Example
scope_type Optional[models.ScopeTypeEnum] Specifies the level for retrieving policies or roles, either at the account level or within product environments. prodenv
scope_id Optional[str] The ID of a specific product environment where the policy is applied. This parameter is only relevant if scope_type is "prodenv".
- <product_environment_id>
principal_type Optional[models.PrincipalTypeEnum] The type of principal you want to retrieve roles or permission policies for. user
principal_id Optional[str] The unique identifier of the principal you want to retrieve roles or permission policies for.

Notes:

* This parameter is mandatory if principal_type is provided.
* Ensure the specified ID belongs to a principle of the specified type.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.EffectivePoliciesResponse

Errors

Error Type Status Code Content Type
models.PermissionsErrorResponse 400, 401, 403, 404 application/json
models.PermissionsErrorResponse 500 application/json
models.APIError 4XX, 5XX */*