Skip to content

Latest commit

 

History

History
375 lines (268 loc) · 20.4 KB

README.md

File metadata and controls

375 lines (268 loc) · 20.4 KB

Permissions

(permissions)

Overview

Available Operations

create

Example Usage

import os
from unkey_py import Unkey

s = Unkey(
    bearer_auth=os.getenv("UNKEY_BEARER_AUTH", ""),
)

res = s.permissions.create(request={
    "name": "record.write",
    "description": "record.write can create new dns records for our domains.",
})

if res.object is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
request models.CreatePermissionRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CreatePermissionResponse

Errors

Error Type Status Code Content Type
models.ErrBadRequest 400 application/json
models.ErrUnauthorized 401 application/json
models.ErrForbidden 403 application/json
models.ErrNotFound 404 application/json
models.ErrConflict 409 application/json
models.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*

delete

Example Usage

import os
from unkey_py import Unkey

s = Unkey(
    bearer_auth=os.getenv("UNKEY_BEARER_AUTH", ""),
)

res = s.permissions.delete(request={
    "permission_id": "perm_123",
})

if res.object is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
request models.DeletePermissionRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeletePermissionResponse

Errors

Error Type Status Code Content Type
models.ErrBadRequest 400 application/json
models.ErrUnauthorized 401 application/json
models.ErrForbidden 403 application/json
models.ErrNotFound 404 application/json
models.ErrConflict 409 application/json
models.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*

get

Example Usage

import os
from unkey_py import Unkey

s = Unkey(
    bearer_auth=os.getenv("UNKEY_BEARER_AUTH", ""),
)

res = s.permissions.get(permission_id="perm_123")

if res.object is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description Example
permission_id str ✔️ N/A perm_123
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetPermissionResponse

Errors

Error Type Status Code Content Type
models.ErrBadRequest 400 application/json
models.ErrUnauthorized 401 application/json
models.ErrForbidden 403 application/json
models.ErrNotFound 404 application/json
models.ErrConflict 409 application/json
models.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*

list

Example Usage

import os
from unkey_py import Unkey

s = Unkey(
    bearer_auth=os.getenv("UNKEY_BEARER_AUTH", ""),
)

res = s.permissions.list()

if res.response_bodies is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ListPermissionsResponse

Errors

Error Type Status Code Content Type
models.ErrBadRequest 400 application/json
models.ErrUnauthorized 401 application/json
models.ErrForbidden 403 application/json
models.ErrNotFound 404 application/json
models.ErrConflict 409 application/json
models.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*

create_role

Example Usage

import os
from unkey_py import Unkey

s = Unkey(
    bearer_auth=os.getenv("UNKEY_BEARER_AUTH", ""),
)

res = s.permissions.create_role(request={
    "name": "dns.records.manager",
    "description": "dns.records.manager can read and write dns records for our domains.",
})

if res.object is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
request models.CreateRoleRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CreateRoleResponse

Errors

Error Type Status Code Content Type
models.ErrBadRequest 400 application/json
models.ErrUnauthorized 401 application/json
models.ErrForbidden 403 application/json
models.ErrNotFound 404 application/json
models.ErrConflict 409 application/json
models.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*

delete_role

Example Usage

import os
from unkey_py import Unkey

s = Unkey(
    bearer_auth=os.getenv("UNKEY_BEARER_AUTH", ""),
)

res = s.permissions.delete_role(request={
    "role_id": "role_123",
})

if res.object is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
request models.DeleteRoleRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeleteRoleResponse

Errors

Error Type Status Code Content Type
models.ErrBadRequest 400 application/json
models.ErrUnauthorized 401 application/json
models.ErrForbidden 403 application/json
models.ErrNotFound 404 application/json
models.ErrConflict 409 application/json
models.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*

get_role

Example Usage

import os
from unkey_py import Unkey

s = Unkey(
    bearer_auth=os.getenv("UNKEY_BEARER_AUTH", ""),
)

res = s.permissions.get_role(role_id="role_123")

if res.object is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description Example
role_id str ✔️ N/A role_123
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GetRoleResponse

Errors

Error Type Status Code Content Type
models.ErrBadRequest 400 application/json
models.ErrUnauthorized 401 application/json
models.ErrForbidden 403 application/json
models.ErrNotFound 404 application/json
models.ErrConflict 409 application/json
models.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*

list_roles

Example Usage

import os
from unkey_py import Unkey

s = Unkey(
    bearer_auth=os.getenv("UNKEY_BEARER_AUTH", ""),
)

res = s.permissions.list_roles()

if res.response_bodies is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ListRolesResponse

Errors

Error Type Status Code Content Type
models.ErrBadRequest 400 application/json
models.ErrUnauthorized 401 application/json
models.ErrForbidden 403 application/json
models.ErrNotFound 404 application/json
models.ErrConflict 409 application/json
models.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*