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(ctx, customRoleKey).Execute()
Delete custom role
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/launchdarkly/api-client-go"
)
func main() {
customRoleKey := "customRoleKey_example" // string | The custom role key
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.CustomRolesApi.DeleteCustomRole(context.Background(), customRoleKey).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CustomRolesApi.DeleteCustomRole``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| customRoleKey | string | The custom role key |
Other parameters are passed through a pointer to a apiDeleteCustomRoleRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
(empty response body)
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CustomRole GetCustomRole(ctx, customRoleKey).Execute()
Get custom role
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/launchdarkly/api-client-go"
)
func main() {
customRoleKey := "customRoleKey_example" // string | The custom role key or ID
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.CustomRolesApi.GetCustomRole(context.Background(), customRoleKey).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CustomRolesApi.GetCustomRole``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetCustomRole`: CustomRole
fmt.Fprintf(os.Stdout, "Response from `CustomRolesApi.GetCustomRole`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| customRoleKey | string | The custom role key or ID |
Other parameters are passed through a pointer to a apiGetCustomRoleRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CustomRoles GetCustomRoles(ctx).Limit(limit).Offset(offset).Execute()
List custom roles
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/launchdarkly/api-client-go"
)
func main() {
limit := int64(789) // int64 | The maximum number of custom roles to return. Defaults to 20. (optional)
offset := int64(789) // int64 | 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)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.CustomRolesApi.GetCustomRoles(context.Background()).Limit(limit).Offset(offset).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CustomRolesApi.GetCustomRoles``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetCustomRoles`: CustomRoles
fmt.Fprintf(os.Stdout, "Response from `CustomRolesApi.GetCustomRoles`: %v\n", resp)
}Other parameters are passed through a pointer to a apiGetCustomRolesRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| limit | int64 | The maximum number of custom roles to return. Defaults to 20. | |
| offset | int64 | 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`. |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CustomRole PatchCustomRole(ctx, customRoleKey).PatchWithComment(patchWithComment).Execute()
Update custom role
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/launchdarkly/api-client-go"
)
func main() {
customRoleKey := "customRoleKey_example" // string | The custom role key
patchWithComment := *openapiclient.NewPatchWithComment([]openapiclient.PatchOperation{*openapiclient.NewPatchOperation("replace", "/exampleField")}) // PatchWithComment |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.CustomRolesApi.PatchCustomRole(context.Background(), customRoleKey).PatchWithComment(patchWithComment).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CustomRolesApi.PatchCustomRole``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PatchCustomRole`: CustomRole
fmt.Fprintf(os.Stdout, "Response from `CustomRolesApi.PatchCustomRole`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| customRoleKey | string | The custom role key |
Other parameters are passed through a pointer to a apiPatchCustomRoleRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
patchWithComment | PatchWithComment | |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CustomRole PostCustomRole(ctx).CustomRolePost(customRolePost).Execute()
Create custom role
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/launchdarkly/api-client-go"
)
func main() {
customRolePost := *openapiclient.NewCustomRolePost("Ops team", "role-key-123abc", []openapiclient.StatementPost{*openapiclient.NewStatementPost("allow")}) // CustomRolePost |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.CustomRolesApi.PostCustomRole(context.Background()).CustomRolePost(customRolePost).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CustomRolesApi.PostCustomRole``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PostCustomRole`: CustomRole
fmt.Fprintf(os.Stdout, "Response from `CustomRolesApi.PostCustomRole`: %v\n", resp)
}Other parameters are passed through a pointer to a apiPostCustomRoleRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| customRolePost | CustomRolePost |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]