Skip to content

Latest commit

 

History

History
325 lines (222 loc) · 10.9 KB

CustomRolesApi.md

File metadata and controls

325 lines (222 loc) · 10.9 KB

LaunchDarklyApi\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($custom_role_key)

Delete custom role

Delete a custom role by key

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKey
$config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new LaunchDarklyApi\Api\CustomRolesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$custom_role_key = 'custom_role_key_example'; // string | The custom role key

try {
    $apiInstance->deleteCustomRole($custom_role_key);
} catch (Exception $e) {
    echo 'Exception when calling CustomRolesApi->deleteCustomRole: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
custom_role_key string The custom role key

Return type

void (empty response body)

Authorization

ApiKey

HTTP request headers

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

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

getCustomRole()

getCustomRole($custom_role_key): \LaunchDarklyApi\Model\CustomRole

Get custom role

Get a single custom role by key or ID

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKey
$config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new LaunchDarklyApi\Api\CustomRolesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$custom_role_key = 'custom_role_key_example'; // string | The custom role key or ID

try {
    $result = $apiInstance->getCustomRole($custom_role_key);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CustomRolesApi->getCustomRole: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
custom_role_key string The custom role key or ID

Return type

\LaunchDarklyApi\Model\CustomRole

Authorization

ApiKey

HTTP request headers

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

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

getCustomRoles()

getCustomRoles($limit, $offset): \LaunchDarklyApi\Model\CustomRoles

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

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKey
$config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new LaunchDarklyApi\Api\CustomRolesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$limit = 56; // int | The maximum number of custom roles to return. Defaults to 20.
$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`.

try {
    $result = $apiInstance->getCustomRoles($limit, $offset);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CustomRolesApi->getCustomRoles: ', $e->getMessage(), PHP_EOL;
}

Parameters

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]

Return type

\LaunchDarklyApi\Model\CustomRoles

Authorization

ApiKey

HTTP request headers

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

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

patchCustomRole()

patchCustomRole($custom_role_key, $patch_with_comment): \LaunchDarklyApi\Model\CustomRole

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.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKey
$config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new LaunchDarklyApi\Api\CustomRolesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$custom_role_key = 'custom_role_key_example'; // string | The custom role key
$patch_with_comment = {"patch":[{"op":"add","path":"/policy/0","value":{"actions":["updateOn"],"effect":"allow","resources":["proj/*:env/qa:flag/*"]}}]}; // \LaunchDarklyApi\Model\PatchWithComment

try {
    $result = $apiInstance->patchCustomRole($custom_role_key, $patch_with_comment);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CustomRolesApi->patchCustomRole: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
custom_role_key string The custom role key
patch_with_comment \LaunchDarklyApi\Model\PatchWithComment

Return type

\LaunchDarklyApi\Model\CustomRole

Authorization

ApiKey

HTTP request headers

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

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

postCustomRole()

postCustomRole($custom_role_post): \LaunchDarklyApi\Model\CustomRole

Create custom role

Create a new custom role

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKey
$config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new LaunchDarklyApi\Api\CustomRolesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$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/*"]}]}; // \LaunchDarklyApi\Model\CustomRolePost

try {
    $result = $apiInstance->postCustomRole($custom_role_post);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CustomRolesApi->postCustomRole: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
custom_role_post \LaunchDarklyApi\Model\CustomRolePost

Return type

\LaunchDarklyApi\Model\CustomRole

Authorization

ApiKey

HTTP request headers

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

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