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 time
import launchdarkly_api
from launchdarkly_api.api import custom_roles_api
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
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'] = 'YOUR_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 = custom_roles_api.CustomRolesApi(api_client)
custom_role_key = "customRoleKey_example" # str | The custom role key
# example passing only required values which don't have defaults set
try:
# Delete custom role
api_instance.delete_custom_role(custom_role_key)
except launchdarkly_api.ApiException 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 time
import launchdarkly_api
from launchdarkly_api.api import custom_roles_api
from launchdarkly_api.model.custom_role import CustomRole
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
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'] = 'YOUR_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 = custom_roles_api.CustomRolesApi(api_client)
custom_role_key = "customRoleKey_example" # str | The custom role key or ID
# example passing only required values which don't have defaults set
try:
# Get custom role
api_response = api_instance.get_custom_role(custom_role_key)
pprint(api_response)
except launchdarkly_api.ApiException 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()
List custom roles
Get a complete list of custom roles. Custom roles let you create flexible policies providing fine-grained access control to everything in LaunchDarkly, from feature flags to goals, environments, and teams. With custom roles, it's possible to enforce access policies that meet your exact workflow needs. Custom roles are available to customers on our enterprise plans. If you're interested in learning more about our enterprise plans, contact sales@launchdarkly.com.
- Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import custom_roles_api
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.custom_roles import CustomRoles
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
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'] = 'YOUR_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 = custom_roles_api.CustomRolesApi(api_client)
limit = 1 # int | The maximum number of custom roles to return. Defaults to 20. (optional)
offset = 1 # 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)
# example passing only required values which don't have defaults set
# and optional values
try:
# List custom roles
api_response = api_instance.get_custom_roles(limit=limit, offset=offset)
pprint(api_response)
except launchdarkly_api.ApiException 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 time
import launchdarkly_api
from launchdarkly_api.api import custom_roles_api
from launchdarkly_api.model.custom_role import CustomRole
from launchdarkly_api.model.invalid_request_error_rep import InvalidRequestErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.patch_with_comment import PatchWithComment
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from launchdarkly_api.model.status_conflict_error_rep import StatusConflictErrorRep
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'] = 'YOUR_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 = custom_roles_api.CustomRolesApi(api_client)
custom_role_key = "customRoleKey_example" # str | The custom role key
patch_with_comment = PatchWithComment(
patch=JSONPatch([
PatchOperation(
op="replace",
path="/exampleField",
value=None,
),
]),
comment="comment_example",
) # PatchWithComment |
# example passing only required values which don't have defaults set
try:
# Update custom role
api_response = api_instance.patch_custom_role(custom_role_key, patch_with_comment)
pprint(api_response)
except launchdarkly_api.ApiException 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 time
import launchdarkly_api
from launchdarkly_api.api import custom_roles_api
from launchdarkly_api.model.custom_role import CustomRole
from launchdarkly_api.model.invalid_request_error_rep import InvalidRequestErrorRep
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from launchdarkly_api.model.custom_role_post import CustomRolePost
from launchdarkly_api.model.status_conflict_error_rep import StatusConflictErrorRep
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'] = 'YOUR_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 = custom_roles_api.CustomRolesApi(api_client)
custom_role_post = CustomRolePost(
name="Ops team",
key="role-key-123abc",
description="An example role for members of the ops team",
policy=StatementPostList([
StatementPost(
resources=["proj/*:env/*:flag/*;testing-tag"],
not_resources=[
"not_resources_example",
],
actions=["*"],
not_actions=[
"not_actions_example",
],
effect="allow",
),
]),
base_permissions="base_permissions_example",
) # CustomRolePost |
# example passing only required values which don't have defaults set
try:
# Create custom role
api_response = api_instance.post_custom_role(custom_role_post)
pprint(api_response)
except launchdarkly_api.ApiException 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]