Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions nuon/api/accounts/create_static_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def sync_detailed(

Creates a long-lived static API token scoped to your current org. Each token gets its own dedicated
service account, and only grants access to the current org. The role param controls the token's
permissions (org_admin, org_support, org_read_only, or org_builder) and defaults to org_read_only.
permissions (any role assignable to API tokens; see GET /v1/roles?context=api_token) and defaults to
org_read_only.

Args:
body (ServiceCreateStaticTokenRequest):
Expand Down Expand Up @@ -100,7 +101,8 @@ def sync(

Creates a long-lived static API token scoped to your current org. Each token gets its own dedicated
service account, and only grants access to the current org. The role param controls the token's
permissions (org_admin, org_support, org_read_only, or org_builder) and defaults to org_read_only.
permissions (any role assignable to API tokens; see GET /v1/roles?context=api_token) and defaults to
org_read_only.

Args:
body (ServiceCreateStaticTokenRequest):
Expand Down Expand Up @@ -128,7 +130,8 @@ async def asyncio_detailed(

Creates a long-lived static API token scoped to your current org. Each token gets its own dedicated
service account, and only grants access to the current org. The role param controls the token's
permissions (org_admin, org_support, org_read_only, or org_builder) and defaults to org_read_only.
permissions (any role assignable to API tokens; see GET /v1/roles?context=api_token) and defaults to
org_read_only.

Args:
body (ServiceCreateStaticTokenRequest):
Expand Down Expand Up @@ -159,7 +162,8 @@ async def asyncio(

Creates a long-lived static API token scoped to your current org. Each token gets its own dedicated
service account, and only grants access to the current org. The role param controls the token's
permissions (org_admin, org_support, org_read_only, or org_builder) and defaults to org_read_only.
permissions (any role assignable to API tokens; see GET /v1/roles?context=api_token) and defaults to
org_read_only.

Args:
body (ServiceCreateStaticTokenRequest):
Expand Down
108 changes: 76 additions & 32 deletions nuon/api/accounts/list_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,39 @@

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.service_role_info import ServiceRoleInfo
from ...models.app_role import AppRole
from ...models.stderr_err_response import StderrErrResponse
from ...types import Response
from ...types import UNSET, Response, Unset


def _get_kwargs() -> dict[str, Any]:
def _get_kwargs(
*,
context: str | Unset = UNSET,
) -> dict[str, Any]:

params: dict[str, Any] = {}

params["context"] = context

params = {k: v for k, v in params.items() if v is not UNSET and v is not None}

_kwargs: dict[str, Any] = {
"method": "get",
"url": "/v1/roles",
"params": params,
}

return _kwargs


def _parse_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> StderrErrResponse | list[ServiceRoleInfo] | None:
) -> StderrErrResponse | list[AppRole] | None:
if response.status_code == 200:
response_200 = []
_response_200 = response.json()
for response_200_item_data in _response_200:
response_200_item = ServiceRoleInfo.from_dict(response_200_item_data)
response_200_item = AppRole.from_dict(response_200_item_data)

response_200.append(response_200_item)

Expand All @@ -51,7 +61,7 @@ def _parse_response(

def _build_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[StderrErrResponse | list[ServiceRoleInfo]]:
) -> Response[StderrErrResponse | list[AppRole]]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand All @@ -63,22 +73,31 @@ def _build_response(
def sync_detailed(
*,
client: AuthenticatedClient,
) -> Response[StderrErrResponse | list[ServiceRoleInfo]]:
"""List assignable roles
context: str | Unset = UNSET,
) -> Response[StderrErrResponse | list[AppRole]]:
"""List your org's roles

List your org's roles. Each role carries its display metadata (`title`,
`description`) and the assignment surfaces it may be offered on via the
`applies_to` field (`team`, `service_account`, `api_token`,
`oidc_trust_policy`). A role with no `applies_to` entries exists and may be
displayed, but cannot be newly assigned. Pass `?context=<surface>` to filter
to the roles assignable on a single surface.

List the roles that can be assigned to members and service accounts in an
organization. Each role indicates which principal types it applies to via the
`applies_to` field (`user`, `service_account`, or both).
Args:
context (str | Unset):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[StderrErrResponse | list[ServiceRoleInfo]]
Response[StderrErrResponse | list[AppRole]]
"""

kwargs = _get_kwargs()
kwargs = _get_kwargs(
context=context,
)

response = client.get_httpx_client().request(
**kwargs,
Expand All @@ -90,45 +109,62 @@ def sync_detailed(
def sync(
*,
client: AuthenticatedClient,
) -> StderrErrResponse | list[ServiceRoleInfo] | None:
"""List assignable roles
context: str | Unset = UNSET,
) -> StderrErrResponse | list[AppRole] | None:
"""List your org's roles

List your org's roles. Each role carries its display metadata (`title`,
`description`) and the assignment surfaces it may be offered on via the
`applies_to` field (`team`, `service_account`, `api_token`,
`oidc_trust_policy`). A role with no `applies_to` entries exists and may be
displayed, but cannot be newly assigned. Pass `?context=<surface>` to filter
to the roles assignable on a single surface.

List the roles that can be assigned to members and service accounts in an
organization. Each role indicates which principal types it applies to via the
`applies_to` field (`user`, `service_account`, or both).
Args:
context (str | Unset):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
StderrErrResponse | list[ServiceRoleInfo]
StderrErrResponse | list[AppRole]
"""

return sync_detailed(
client=client,
context=context,
).parsed


async def asyncio_detailed(
*,
client: AuthenticatedClient,
) -> Response[StderrErrResponse | list[ServiceRoleInfo]]:
"""List assignable roles
context: str | Unset = UNSET,
) -> Response[StderrErrResponse | list[AppRole]]:
"""List your org's roles

List your org's roles. Each role carries its display metadata (`title`,
`description`) and the assignment surfaces it may be offered on via the
`applies_to` field (`team`, `service_account`, `api_token`,
`oidc_trust_policy`). A role with no `applies_to` entries exists and may be
displayed, but cannot be newly assigned. Pass `?context=<surface>` to filter
to the roles assignable on a single surface.

List the roles that can be assigned to members and service accounts in an
organization. Each role indicates which principal types it applies to via the
`applies_to` field (`user`, `service_account`, or both).
Args:
context (str | Unset):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[StderrErrResponse | list[ServiceRoleInfo]]
Response[StderrErrResponse | list[AppRole]]
"""

kwargs = _get_kwargs()
kwargs = _get_kwargs(
context=context,
)

response = await client.get_async_httpx_client().request(**kwargs)

Expand All @@ -138,23 +174,31 @@ async def asyncio_detailed(
async def asyncio(
*,
client: AuthenticatedClient,
) -> StderrErrResponse | list[ServiceRoleInfo] | None:
"""List assignable roles
context: str | Unset = UNSET,
) -> StderrErrResponse | list[AppRole] | None:
"""List your org's roles

List your org's roles. Each role carries its display metadata (`title`,
`description`) and the assignment surfaces it may be offered on via the
`applies_to` field (`team`, `service_account`, `api_token`,
`oidc_trust_policy`). A role with no `applies_to` entries exists and may be
displayed, but cannot be newly assigned. Pass `?context=<surface>` to filter
to the roles assignable on a single surface.

List the roles that can be assigned to members and service accounts in an
organization. Each role indicates which principal types it applies to via the
`applies_to` field (`user`, `service_account`, or both).
Args:
context (str | Unset):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
StderrErrResponse | list[ServiceRoleInfo]
StderrErrResponse | list[AppRole]
"""

return (
await asyncio_detailed(
client=client,
context=context,
)
).parsed
Loading
Loading