All URIs are relative to https://app.launchdarkly.com
| Method | HTTP request | Description |
|---|---|---|
| delete_custom_role | DELETE /api/v2/roles/{customRoleKey} | Delete custom role |
| get_custom_role | GET /api/v2/roles/{customRoleKey} | Get custom role |
| get_custom_roles | GET /api/v2/roles | List custom roles |
| patch_custom_role | PATCH /api/v2/roles/{customRoleKey} | Update custom role |
| post_custom_role | POST /api/v2/roles | Create custom role |
delete_custom_role(custom_role_key)
Delete custom role
Delete a custom role by key
- Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
host = "https://app.launchdarkly.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 API key authorization: ApiKey
configuration.api_key['ApiKey'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'
# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = launchdarkly_api.CustomRolesApi(api_client)
custom_role_key = 'custom_role_key_example' # str | The custom role key
try:
# Delete custom role
api_instance.delete_custom_role(custom_role_key)
except Exception as e:
print("Exception when calling CustomRolesApi->delete_custom_role: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| custom_role_key | str | The custom role key |
void (empty response body)
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 204 | Action succeeded | - |
| 401 | Invalid access token | - |
| 404 | Invalid resource identifier | - |
| 429 | Rate limited | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CustomRole get_custom_role(custom_role_key)
Get custom role
Get a single custom role by key or ID
- Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.custom_role import CustomRole
from launchdarkly_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
host = "https://app.launchdarkly.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 API key authorization: ApiKey
configuration.api_key['ApiKey'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'
# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = launchdarkly_api.CustomRolesApi(api_client)
custom_role_key = 'custom_role_key_example' # str | The custom role key or ID
try:
# Get custom role
api_response = api_instance.get_custom_role(custom_role_key)
print("The response of CustomRolesApi->get_custom_role:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling CustomRolesApi->get_custom_role: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| custom_role_key | str | The custom role key or ID |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Custom role response | - |
| 401 | Invalid access token | - |
| 403 | Forbidden | - |
| 404 | Invalid resource identifier | - |
| 429 | Rate limited | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CustomRoles get_custom_roles(limit=limit, offset=offset)
List custom roles
Get a complete list of custom roles. This includes project and organization roles that you create, or that are provided as presets by LaunchDarkly. It does not include base roles.
- Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.custom_roles import CustomRoles
from launchdarkly_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
host = "https://app.launchdarkly.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 API key authorization: ApiKey
configuration.api_key['ApiKey'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'
# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = launchdarkly_api.CustomRolesApi(api_client)
limit = 56 # int | The maximum number of custom roles to return. Defaults to 20. (optional)
offset = 56 # int | Where to start in the list. Defaults to 0. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. (optional)
try:
# List custom roles
api_response = api_instance.get_custom_roles(limit=limit, offset=offset)
print("The response of CustomRolesApi->get_custom_roles:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling CustomRolesApi->get_custom_roles: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| limit | int | The maximum number of custom roles to return. Defaults to 20. | [optional] |
| offset | int | Where to start in the list. Defaults to 0. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Custom roles collection response | - |
| 401 | Invalid access token | - |
| 403 | Forbidden | - |
| 429 | Rate limited | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CustomRole patch_custom_role(custom_role_key, patch_with_comment)
Update custom role
Update a single custom role. Updating a custom role uses a JSON patch or JSON merge patch representation of the desired changes. To learn more, read Updates.
To add an element to the policy array, set the path to /policy and then append /<array index>. Use /0 to add to the beginning of the array. Use /- to add to the end of the array.
- Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.custom_role import CustomRole
from launchdarkly_api.models.patch_with_comment import PatchWithComment
from launchdarkly_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
host = "https://app.launchdarkly.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 API key authorization: ApiKey
configuration.api_key['ApiKey'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'
# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = launchdarkly_api.CustomRolesApi(api_client)
custom_role_key = 'custom_role_key_example' # str | The custom role key
patch_with_comment = {"patch":[{"op":"add","path":"/policy/0","value":{"actions":["updateOn"],"effect":"allow","resources":["proj/*:env/qa:flag/*"]}}]} # PatchWithComment |
try:
# Update custom role
api_response = api_instance.patch_custom_role(custom_role_key, patch_with_comment)
print("The response of CustomRolesApi->patch_custom_role:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling CustomRolesApi->patch_custom_role: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| custom_role_key | str | The custom role key | |
| patch_with_comment | PatchWithComment |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Custom role response | - |
| 400 | Invalid request | - |
| 401 | Invalid access token | - |
| 404 | Invalid resource identifier | - |
| 409 | Status conflict | - |
| 429 | Rate limited | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CustomRole post_custom_role(custom_role_post)
Create custom role
Create a new custom role
- Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.custom_role import CustomRole
from launchdarkly_api.models.custom_role_post import CustomRolePost
from launchdarkly_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
host = "https://app.launchdarkly.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 API key authorization: ApiKey
configuration.api_key['ApiKey'] = os.environ["API_KEY"]
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'
# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = launchdarkly_api.CustomRolesApi(api_client)
custom_role_post = {"basePermissions":"reader","description":"An example role for members of the ops team","key":"role-key-123abc","name":"Ops team","policy":[{"actions":["updateOn"],"effect":"allow","resources":["proj/*:env/production:flag/*"]}]} # CustomRolePost |
try:
# Create custom role
api_response = api_instance.post_custom_role(custom_role_post)
print("The response of CustomRolesApi->post_custom_role:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling CustomRolesApi->post_custom_role: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| custom_role_post | CustomRolePost |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 201 | Custom role response | - |
| 400 | Invalid request | - |
| 401 | Invalid access token | - |
| 403 | Forbidden | - |
| 409 | Status conflict | - |
| 429 | Rate limited | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]