Skip to content

Latest commit

 

History

History
381 lines (297 loc) · 13.3 KB

CustomRolesApi.md

File metadata and controls

381 lines (297 loc) · 13.3 KB

CustomRolesApi

All URIs are relative to https://app.launchdarkly.com

Method HTTP request Description
deleteCustomRole DELETE /api/v2/roles/{customRoleKey} Delete custom role
getCustomRole GET /api/v2/roles/{customRoleKey} Get custom role
getCustomRoles GET /api/v2/roles List custom roles
patchCustomRole PATCH /api/v2/roles/{customRoleKey} Update custom role
postCustomRole POST /api/v2/roles Create custom role

deleteCustomRole

deleteCustomRole(customRoleKey)

Delete custom role

Delete a custom role by key

Example

// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.CustomRolesApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://app.launchdarkly.com");
    
    // Configure API key authorization: ApiKey
    ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
    ApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ApiKey.setApiKeyPrefix("Token");

    CustomRolesApi apiInstance = new CustomRolesApi(defaultClient);
    String customRoleKey = "customRoleKey_example"; // String | The custom role key
    try {
      apiInstance.deleteCustomRole(customRoleKey);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomRolesApi#deleteCustomRole");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
customRoleKey String The custom role key

Return type

null (empty response body)

Authorization

ApiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
204 Action succeeded -
401 Invalid access token -
404 Invalid resource identifier -
429 Rate limited -

getCustomRole

CustomRole getCustomRole(customRoleKey)

Get custom role

Get a single custom role by key or ID

Example

// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.CustomRolesApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://app.launchdarkly.com");
    
    // Configure API key authorization: ApiKey
    ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
    ApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ApiKey.setApiKeyPrefix("Token");

    CustomRolesApi apiInstance = new CustomRolesApi(defaultClient);
    String customRoleKey = "customRoleKey_example"; // String | The custom role key or ID
    try {
      CustomRole result = apiInstance.getCustomRole(customRoleKey);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomRolesApi#getCustomRole");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
customRoleKey String The custom role key or ID

Return type

CustomRole

Authorization

ApiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Custom role response -
401 Invalid access token -
403 Forbidden -
404 Invalid resource identifier -
429 Rate limited -

getCustomRoles

CustomRoles getCustomRoles(limit, offset)

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 [email protected].

Example

// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.CustomRolesApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://app.launchdarkly.com");
    
    // Configure API key authorization: ApiKey
    ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
    ApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ApiKey.setApiKeyPrefix("Token");

    CustomRolesApi apiInstance = new CustomRolesApi(defaultClient);
    Long limit = 56L; // Long | The maximum number of custom roles to return. Defaults to 20.
    Long offset = 56L; // Long | 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`.
    try {
      CustomRoles result = apiInstance.getCustomRoles(limit, offset);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomRolesApi#getCustomRoles");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
limit Long The maximum number of custom roles to return. Defaults to 20. [optional]
offset Long 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]

Return type

CustomRoles

Authorization

ApiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Custom roles collection response -
401 Invalid access token -
403 Forbidden -
429 Rate limited -

patchCustomRole

CustomRole patchCustomRole(customRoleKey, patchWithComment)

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.<br/><br/>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.

Example

// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.CustomRolesApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://app.launchdarkly.com");
    
    // Configure API key authorization: ApiKey
    ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
    ApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ApiKey.setApiKeyPrefix("Token");

    CustomRolesApi apiInstance = new CustomRolesApi(defaultClient);
    String customRoleKey = "customRoleKey_example"; // String | The custom role key
    PatchWithComment patchWithComment = new PatchWithComment(); // PatchWithComment | 
    try {
      CustomRole result = apiInstance.patchCustomRole(customRoleKey, patchWithComment);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomRolesApi#patchCustomRole");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
customRoleKey String The custom role key
patchWithComment PatchWithComment

Return type

CustomRole

Authorization

ApiKey

HTTP request headers

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

HTTP response details

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 -

postCustomRole

CustomRole postCustomRole(customRolePost)

Create custom role

Create a new custom role

Example

// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.CustomRolesApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://app.launchdarkly.com");
    
    // Configure API key authorization: ApiKey
    ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
    ApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ApiKey.setApiKeyPrefix("Token");

    CustomRolesApi apiInstance = new CustomRolesApi(defaultClient);
    CustomRolePost customRolePost = new CustomRolePost(); // CustomRolePost | 
    try {
      CustomRole result = apiInstance.postCustomRole(customRolePost);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomRolesApi#postCustomRole");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
customRolePost CustomRolePost

Return type

CustomRole

Authorization

ApiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 Custom role response -
400 Invalid request -
401 Invalid access token -
403 Forbidden -
409 Status conflict -
429 Rate limited -