thousandeyes-sdk-python/admin/docs/RolesApi.md

16 KiB

admin.RolesApi

All URIs are relative to https://api.thousandeyes.com

Method HTTP request Description
create_role POST /v7/roles Create role
delete_role DELETE /v7/roles/{id} Delete role
get_role GET /v7/roles/{id} Retrieve role
get_roles GET /v7/roles List roles
update_role PUT /v7/roles/{id} Update role

create_role

CreateRole201Response create_role(role_request_body, aid=aid)

Create role

Creates a new role.

Example

  • Bearer Authentication (BearerAuth):
import admin
from admin.models.create_role201_response import CreateRole201Response
from admin.models.role_request_body import RoleRequestBody
from admin.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.thousandeyes.com
# See configuration.py for a list of all supported configuration parameters.
configuration = admin.Configuration(
    host = "https://api.thousandeyes.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: BearerAuth
configuration = admin.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with admin.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = admin.RolesApi(api_client)
    role_request_body = admin.RoleRequestBody() # RoleRequestBody | 
    aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional)

    try:
        # Create role
        api_response = api_instance.create_role(role_request_body, aid=aid)
        print("The response of RolesApi->create_role:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling RolesApi->create_role: %s\n" % e)

Parameters

Name Type Description Notes
role_request_body RoleRequestBody
aid str A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. [optional]

Return type

CreateRole201Response

Authorization

BearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/hal+json, application/problem+json

HTTP response details

Status code Description Response headers
201 Created * Location -
400 Bad Request -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_role

delete_role(id, aid=aid)

Delete role

Deletes a role using its ID. The user needs appropriate permissions to successfully call this endpoint.

Example

  • Bearer Authentication (BearerAuth):
import admin
from admin.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.thousandeyes.com
# See configuration.py for a list of all supported configuration parameters.
configuration = admin.Configuration(
    host = "https://api.thousandeyes.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: BearerAuth
configuration = admin.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with admin.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = admin.RolesApi(api_client)
    id = '23' # str | The ID of the desired role.
    aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional)

    try:
        # Delete role
        api_instance.delete_role(id, aid=aid)
    except Exception as e:
        print("Exception when calling RolesApi->delete_role: %s\n" % e)

Parameters

Name Type Description Notes
id str The ID of the desired role.
aid str A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. [optional]

Return type

void (empty response body)

Authorization

BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/problem+json

HTTP response details

Status code Description Response headers
204 No content -
400 Bad Request -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_role

CreateRole201Response get_role(id, aid=aid)

Retrieve role

Returns detailed information about a role using its ID.

Example

  • Bearer Authentication (BearerAuth):
import admin
from admin.models.create_role201_response import CreateRole201Response
from admin.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.thousandeyes.com
# See configuration.py for a list of all supported configuration parameters.
configuration = admin.Configuration(
    host = "https://api.thousandeyes.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: BearerAuth
configuration = admin.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with admin.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = admin.RolesApi(api_client)
    id = '23' # str | The ID of the desired role.
    aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional)

    try:
        # Retrieve role
        api_response = api_instance.get_role(id, aid=aid)
        print("The response of RolesApi->get_role:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling RolesApi->get_role: %s\n" % e)

Parameters

Name Type Description Notes
id str The ID of the desired role.
aid str A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. [optional]

Return type

CreateRole201Response

Authorization

BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json, application/problem+json

HTTP response details

Status code Description Response headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_roles

GetRoles200Response get_roles(aid=aid)

List roles

Retrieves a list of defined roles visible to the current user.

Example

  • Bearer Authentication (BearerAuth):
import admin
from admin.models.get_roles200_response import GetRoles200Response
from admin.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.thousandeyes.com
# See configuration.py for a list of all supported configuration parameters.
configuration = admin.Configuration(
    host = "https://api.thousandeyes.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: BearerAuth
configuration = admin.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with admin.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = admin.RolesApi(api_client)
    aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional)

    try:
        # List roles
        api_response = api_instance.get_roles(aid=aid)
        print("The response of RolesApi->get_roles:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling RolesApi->get_roles: %s\n" % e)

Parameters

Name Type Description Notes
aid str A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. [optional]

Return type

GetRoles200Response

Authorization

BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json, application/problem+json

HTTP response details

Status code Description Response headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_role

CreateRole201Response update_role(id, role_request_body, aid=aid)

Update role

Updates a user-defined role using its ID. When updating a role, the following applies: * The full list of permissions must be sent, This endpoint does not support delta-based grant or revoking of permissions. * Permission definitions and details can be obtained from the Permissions endpoint.

Example

  • Bearer Authentication (BearerAuth):
import admin
from admin.models.create_role201_response import CreateRole201Response
from admin.models.role_request_body import RoleRequestBody
from admin.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.thousandeyes.com
# See configuration.py for a list of all supported configuration parameters.
configuration = admin.Configuration(
    host = "https://api.thousandeyes.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: BearerAuth
configuration = admin.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with admin.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = admin.RolesApi(api_client)
    id = '23' # str | The ID of the desired role.
    role_request_body = admin.RoleRequestBody() # RoleRequestBody | 
    aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional)

    try:
        # Update role
        api_response = api_instance.update_role(id, role_request_body, aid=aid)
        print("The response of RolesApi->update_role:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling RolesApi->update_role: %s\n" % e)

Parameters

Name Type Description Notes
id str The ID of the desired role.
role_request_body RoleRequestBody
aid str A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. [optional]

Return type

CreateRole201Response

Authorization

BearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/hal+json, application/problem+json

HTTP response details

Status code Description Response headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]