Skip to content

Latest commit

 

History

History
494 lines (335 loc) · 15.2 KB

File metadata and controls

494 lines (335 loc) · 15.2 KB

instana_client.RolesApi

All URIs are relative to https://unit-tenant.instana.io

Method HTTP request Description
create_role POST /api/settings/rbac/roles Create role
delete_role DELETE /api/settings/rbac/roles/{id} Delete role
get_role GET /api/settings/rbac/roles/{id} Get role by ID
get_role_mappings GET /api/settings/rbac/roles/{roleId}/mappings Get role mappings
get_roles GET /api/settings/rbac/roles Get all roles
update_role PUT /api/settings/rbac/roles/{id} Update role

create_role

ApiRole create_role(api_create_role)

Create role

Create a new role.

Example

  • Api Key Authentication (ApiKeyAuth):
import instana_client
from instana_client.models.api_create_role import ApiCreateRole
from instana_client.models.api_role import ApiRole
from instana_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://unit-tenant.instana.io
# See configuration.py for a list of all supported configuration parameters.
configuration = instana_client.Configuration(
    host = "https://unit-tenant.instana.io"
)

# 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 API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'

# Enter a context with an instance of the API client
with instana_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = instana_client.RolesApi(api_client)
    api_create_role = {"name":"New Role","description":"optional attribute","members":[{"userId":"user-5","email":"newuser@example.com","name":"New User"}],"permissions":["CAN_VIEW_APPLICATIONS","CAN_VIEW_EVENTS"]} # ApiCreateRole | Role to create

    try:
        # Create role
        api_response = api_instance.create_role(api_create_role)
        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
api_create_role ApiCreateRole Role to create

Return type

ApiRole

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
422 Unprocessable entity. -

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

delete_role

delete_role(id)

Delete role

Delete a role by ID.

Example

  • Api Key Authentication (ApiKeyAuth):
import instana_client
from instana_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://unit-tenant.instana.io
# See configuration.py for a list of all supported configuration parameters.
configuration = instana_client.Configuration(
    host = "https://unit-tenant.instana.io"
)

# 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 API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'

# Enter a context with an instance of the API client
with instana_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = instana_client.RolesApi(api_client)
    id = 'roleId' # str | Id of the role to delete

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

Parameters

Name Type Description Notes
id str Id of the role to delete

Return type

void (empty response body)

Authorization

ApiKeyAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
204 Role successfully deleted -
404 Role not found -
412 Pre-Condition Failed - Returned when attempting to delete protected system roles. -

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

get_role

ApiRole get_role(id, include_team_usage=include_team_usage)

Get role by ID

Retrieve a specific role by its ID.

Example

  • Api Key Authentication (ApiKeyAuth):
import instana_client
from instana_client.models.api_role import ApiRole
from instana_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://unit-tenant.instana.io
# See configuration.py for a list of all supported configuration parameters.
configuration = instana_client.Configuration(
    host = "https://unit-tenant.instana.io"
)

# 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 API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'

# Enter a context with an instance of the API client
with instana_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = instana_client.RolesApi(api_client)
    id = 'roleId' # str | Id of the role for retrieval
    include_team_usage = True # bool |  (optional)

    try:
        # Get role by ID
        api_response = api_instance.get_role(id, include_team_usage=include_team_usage)
        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 Id of the role for retrieval
include_team_usage bool [optional]

Return type

ApiRole

Authorization

ApiKeyAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
404 Role not found -

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

get_role_mappings

List[RoleMappingOverview] get_role_mappings(role_id)

Get role mappings

Retrieve IdP role mappings applicable to a specific role

Example

  • Api Key Authentication (ApiKeyAuth):
import instana_client
from instana_client.models.role_mapping_overview import RoleMappingOverview
from instana_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://unit-tenant.instana.io
# See configuration.py for a list of all supported configuration parameters.
configuration = instana_client.Configuration(
    host = "https://unit-tenant.instana.io"
)

# 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 API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'

# Enter a context with an instance of the API client
with instana_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = instana_client.RolesApi(api_client)
    role_id = 'role_id_example' # str | 

    try:
        # Get role mappings
        api_response = api_instance.get_role_mappings(role_id)
        print("The response of RolesApi->get_role_mappings:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling RolesApi->get_role_mappings: %s\n" % e)

Parameters

Name Type Description Notes
role_id str

Return type

List[RoleMappingOverview]

Authorization

ApiKeyAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
404 role mapping not found -

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

get_roles

List[ApiRole] get_roles()

Get all roles

Retrieve all roles for the current tenant unit.

Example

  • Api Key Authentication (ApiKeyAuth):
import instana_client
from instana_client.models.api_role import ApiRole
from instana_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://unit-tenant.instana.io
# See configuration.py for a list of all supported configuration parameters.
configuration = instana_client.Configuration(
    host = "https://unit-tenant.instana.io"
)

# 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 API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'

# Enter a context with an instance of the API client
with instana_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = instana_client.RolesApi(api_client)

    try:
        # Get all roles
        api_response = api_instance.get_roles()
        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

This endpoint does not need any parameter.

Return type

List[ApiRole]

Authorization

ApiKeyAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 OK -
404 No roles found -

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

update_role

ApiRole update_role(id, api_role)

Update role

Update an existing role by ID.

Example

  • Api Key Authentication (ApiKeyAuth):
import instana_client
from instana_client.models.api_role import ApiRole
from instana_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://unit-tenant.instana.io
# See configuration.py for a list of all supported configuration parameters.
configuration = instana_client.Configuration(
    host = "https://unit-tenant.instana.io"
)

# 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 API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'

# Enter a context with an instance of the API client
with instana_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = instana_client.RolesApi(api_client)
    id = 'roleId' # str | Id of the role to update
    api_role = {"id":"role-2","name":"Updated Developer Role","description":"optional attribute","members":[{"userId":"user-3","email":"dev1@example.com","name":"Developer One"},{"userId":"user-4","email":"dev2@example.com","name":"Developer Two"},{"userId":"user-6","email":"dev3@example.com","name":"Developer Three"}],"permissions":["CAN_VIEW_APPLICATIONS","CAN_VIEW_EVENTS","CAN_VIEW_INFRASTRUCTURE","CAN_CONFIGURE_APPLICATIONS"]} # ApiRole | Updated role data

    try:
        # Update role
        api_response = api_instance.update_role(id, api_role)
        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 Id of the role to update
api_role ApiRole Updated role data

Return type

ApiRole

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
404 Role not found -
412 Pre-Condition Failed - Returned when attempting to modify protected roles in a forbidden way. -

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