Package com.launchdarkly.api.api
Class WorkflowsApi
- java.lang.Object
-
- com.launchdarkly.api.api.WorkflowsApi
-
public class WorkflowsApi extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description WorkflowsApi()WorkflowsApi(ApiClient apiClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteWorkflow(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, java.lang.String workflowId)Delete workflow Delete a workflow from a feature flag.okhttp3.CalldeleteWorkflowAsync(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, java.lang.String workflowId, ApiCallback<java.lang.Void> _callback)Delete workflow (asynchronously) Delete a workflow from a feature flag.okhttp3.CalldeleteWorkflowCall(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, java.lang.String workflowId, ApiCallback _callback)Build call for deleteWorkflowApiResponse<java.lang.Void>deleteWorkflowWithHttpInfo(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, java.lang.String workflowId)Delete workflow Delete a workflow from a feature flag.ApiClientgetApiClient()java.lang.StringgetCustomBaseUrl()CustomWorkflowOutputgetCustomWorkflow(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, java.lang.String workflowId)Get custom workflow Get a specific workflow by ID.okhttp3.CallgetCustomWorkflowAsync(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, java.lang.String workflowId, ApiCallback<CustomWorkflowOutput> _callback)Get custom workflow (asynchronously) Get a specific workflow by ID.okhttp3.CallgetCustomWorkflowCall(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, java.lang.String workflowId, ApiCallback _callback)Build call for getCustomWorkflowApiResponse<CustomWorkflowOutput>getCustomWorkflowWithHttpInfo(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, java.lang.String workflowId)Get custom workflow Get a specific workflow by ID.intgetHostIndex()CustomWorkflowsListingOutputgetWorkflows(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, java.lang.String status, java.lang.String sort, java.lang.Long limit, java.lang.Long offset)Get workflows Display workflows associated with a feature flag.okhttp3.CallgetWorkflowsAsync(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, java.lang.String status, java.lang.String sort, java.lang.Long limit, java.lang.Long offset, ApiCallback<CustomWorkflowsListingOutput> _callback)Get workflows (asynchronously) Display workflows associated with a feature flag.okhttp3.CallgetWorkflowsCall(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, java.lang.String status, java.lang.String sort, java.lang.Long limit, java.lang.Long offset, ApiCallback _callback)Build call for getWorkflowsApiResponse<CustomWorkflowsListingOutput>getWorkflowsWithHttpInfo(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, java.lang.String status, java.lang.String sort, java.lang.Long limit, java.lang.Long offset)Get workflows Display workflows associated with a feature flag.CustomWorkflowOutputpostWorkflow(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, CustomWorkflowInput customWorkflowInput, java.lang.String templateKey, java.lang.Boolean dryRun)Create workflow > ### Workflows are in maintenance mode > > The workflows feature is in maintenance mode, and is planned for future deprecation at a date not yet specified.okhttp3.CallpostWorkflowAsync(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, CustomWorkflowInput customWorkflowInput, java.lang.String templateKey, java.lang.Boolean dryRun, ApiCallback<CustomWorkflowOutput> _callback)Create workflow (asynchronously) > ### Workflows are in maintenance mode > > The workflows feature is in maintenance mode, and is planned for future deprecation at a date not yet specified.okhttp3.CallpostWorkflowCall(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, CustomWorkflowInput customWorkflowInput, java.lang.String templateKey, java.lang.Boolean dryRun, ApiCallback _callback)Build call for postWorkflowApiResponse<CustomWorkflowOutput>postWorkflowWithHttpInfo(java.lang.String projectKey, java.lang.String featureFlagKey, java.lang.String environmentKey, CustomWorkflowInput customWorkflowInput, java.lang.String templateKey, java.lang.Boolean dryRun)Create workflow > ### Workflows are in maintenance mode > > The workflows feature is in maintenance mode, and is planned for future deprecation at a date not yet specified.voidsetApiClient(ApiClient apiClient)voidsetCustomBaseUrl(java.lang.String customBaseUrl)voidsetHostIndex(int hostIndex)
-
-
-
Constructor Detail
-
WorkflowsApi
public WorkflowsApi()
-
WorkflowsApi
public WorkflowsApi(ApiClient apiClient)
-
-
Method Detail
-
getApiClient
public ApiClient getApiClient()
-
setApiClient
public void setApiClient(ApiClient apiClient)
-
getHostIndex
public int getHostIndex()
-
setHostIndex
public void setHostIndex(int hostIndex)
-
getCustomBaseUrl
public java.lang.String getCustomBaseUrl()
-
setCustomBaseUrl
public void setCustomBaseUrl(java.lang.String customBaseUrl)
-
deleteWorkflowCall
public okhttp3.Call deleteWorkflowCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String workflowId, ApiCallback _callback) throws ApiExceptionBuild call for deleteWorkflow- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)workflowId- The workflow id (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
deleteWorkflow
public void deleteWorkflow(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String workflowId) throws ApiExceptionDelete workflow Delete a workflow from a feature flag.- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)workflowId- The workflow id (required)- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
deleteWorkflowWithHttpInfo
public ApiResponse<java.lang.Void> deleteWorkflowWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String workflowId) throws ApiException
Delete workflow Delete a workflow from a feature flag.- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)workflowId- The workflow id (required)- Returns:
- ApiResponse<Void>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
deleteWorkflowAsync
public okhttp3.Call deleteWorkflowAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String workflowId, ApiCallback<java.lang.Void> _callback) throws ApiExceptionDelete workflow (asynchronously) Delete a workflow from a feature flag.- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)workflowId- The workflow id (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
getCustomWorkflowCall
public okhttp3.Call getCustomWorkflowCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String workflowId, ApiCallback _callback) throws ApiExceptionBuild call for getCustomWorkflow- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)workflowId- The workflow ID (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
getCustomWorkflow
public CustomWorkflowOutput getCustomWorkflow(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String workflowId) throws ApiException
Get custom workflow Get a specific workflow by ID.- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)workflowId- The workflow ID (required)- Returns:
- CustomWorkflowOutput
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getCustomWorkflowWithHttpInfo
public ApiResponse<CustomWorkflowOutput> getCustomWorkflowWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String workflowId) throws ApiException
Get custom workflow Get a specific workflow by ID.- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)workflowId- The workflow ID (required)- Returns:
- ApiResponse<CustomWorkflowOutput>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getCustomWorkflowAsync
public okhttp3.Call getCustomWorkflowAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String workflowId, ApiCallback<CustomWorkflowOutput> _callback) throws ApiExceptionGet custom workflow (asynchronously) Get a specific workflow by ID.- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)workflowId- The workflow ID (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
getWorkflowsCall
public okhttp3.Call getWorkflowsCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nullable java.lang.String status, @Nullable java.lang.String sort, @Nullable java.lang.Long limit, @Nullable java.lang.Long offset, ApiCallback _callback) throws ApiExceptionBuild call for getWorkflows- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)status- Filter results by workflow status. Valid status filters are `active`, `completed`, and `failed`. (optional)sort- A field to sort the items by. Prefix field by a dash ( - ) to sort in descending order. This endpoint supports sorting by `creationDate` or `stopDate`. (optional)limit- The maximum number of workflows to return. Defaults to 20. (optional)offset- 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)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
getWorkflows
public CustomWorkflowsListingOutput getWorkflows(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nullable java.lang.String status, @Nullable java.lang.String sort, @Nullable java.lang.Long limit, @Nullable java.lang.Long offset) throws ApiException
Get workflows Display workflows associated with a feature flag.- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)status- Filter results by workflow status. Valid status filters are `active`, `completed`, and `failed`. (optional)sort- A field to sort the items by. Prefix field by a dash ( - ) to sort in descending order. This endpoint supports sorting by `creationDate` or `stopDate`. (optional)limit- The maximum number of workflows to return. Defaults to 20. (optional)offset- 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)- Returns:
- CustomWorkflowsListingOutput
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getWorkflowsWithHttpInfo
public ApiResponse<CustomWorkflowsListingOutput> getWorkflowsWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nullable java.lang.String status, @Nullable java.lang.String sort, @Nullable java.lang.Long limit, @Nullable java.lang.Long offset) throws ApiException
Get workflows Display workflows associated with a feature flag.- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)status- Filter results by workflow status. Valid status filters are `active`, `completed`, and `failed`. (optional)sort- A field to sort the items by. Prefix field by a dash ( - ) to sort in descending order. This endpoint supports sorting by `creationDate` or `stopDate`. (optional)limit- The maximum number of workflows to return. Defaults to 20. (optional)offset- 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)- Returns:
- ApiResponse<CustomWorkflowsListingOutput>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getWorkflowsAsync
public okhttp3.Call getWorkflowsAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nullable java.lang.String status, @Nullable java.lang.String sort, @Nullable java.lang.Long limit, @Nullable java.lang.Long offset, ApiCallback<CustomWorkflowsListingOutput> _callback) throws ApiExceptionGet workflows (asynchronously) Display workflows associated with a feature flag.- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)status- Filter results by workflow status. Valid status filters are `active`, `completed`, and `failed`. (optional)sort- A field to sort the items by. Prefix field by a dash ( - ) to sort in descending order. This endpoint supports sorting by `creationDate` or `stopDate`. (optional)limit- The maximum number of workflows to return. Defaults to 20. (optional)offset- 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)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
postWorkflowCall
public okhttp3.Call postWorkflowCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nonnull CustomWorkflowInput customWorkflowInput, @Nullable java.lang.String templateKey, @Nullable java.lang.Boolean dryRun, ApiCallback _callback) throws ApiExceptionBuild call for postWorkflow- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)customWorkflowInput- (required)templateKey- The template key to apply as a starting point for the new workflow (optional)dryRun- Whether to call the endpoint in dry-run mode (optional)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
postWorkflow
public CustomWorkflowOutput postWorkflow(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nonnull CustomWorkflowInput customWorkflowInput, @Nullable java.lang.String templateKey, @Nullable java.lang.Boolean dryRun) throws ApiException
Create workflow > ### Workflows are in maintenance mode > > The workflows feature is in maintenance mode, and is planned for future deprecation at a date not yet specified. We will work with existing customers using workflows to migrate to a replacement solution when deprecation occurs. Create a workflow for a feature flag. You can create a workflow directly, or you can apply a template to create a new workflow. ### Creating a workflow You can use the create workflow endpoint to create a workflow directly by adding a `stages` array to the request body. For each stage, define the `name`, `conditions` when the stage should be executed, and `action` that describes the stage. For approval stages, only standard LaunchDarkly approvals are permitted. Workflows of `kind` `integration-approval` cannot be used for custom workflows. <details> <summary>Click to expand example</summary> _Example request body_ ```json { \"name\": \"Progressive rollout starting in two days\", \"description\": \"Turn flag targeting on and increase feature rollout in 10% increments each day\", \"stages\": [ { \"name\": \"10% rollout on day 1\", \"conditions\": [ { \"kind\": \"schedule\", \"scheduleKind\": \"relative\", // or \"absolute\" // If \"scheduleKind\" is \"absolute\", set \"executionDate\"; // \"waitDuration\" and \"waitDurationUnit\" will be ignored \"waitDuration\": 2, \"waitDurationUnit\": \"calendarDay\" }, { \"kind\": \"ld-approval\", \"notifyMemberIds\": [ \"507f1f77bcf86cd799439011\" ], \"notifyTeamKeys\": [ \"team-key-123abc\" ] } ], \"action\": { \"instructions\": [ { \"kind\": \"turnFlagOn\" }, { \"kind\": \"updateFallthroughVariationOrRollout\", \"rolloutWeights\": { \"452f5fb5-7320-4ba3-81a1-8f4324f79d49\": 90000, \"fc15f6a4-05d3-4aa4-a997-446be461345d\": 10000 } } ] } } ] } ``` </details> ### Creating a workflow by applying a workflow template You can also create a workflow by applying a workflow template. If you pass a valid workflow template key as the `templateKey` query parameter with the request, the API will attempt to create a new workflow with the stages defined in the workflow template with the corresponding key. #### Applicability of stages Templates are created in the context of a particular flag in a particular environment in a particular project. However, because workflows created from a template can be applied to any project, environment, and flag, some steps of the workflow may need to be updated in order to be applicable for the target resource. You can pass a `dryRun` query parameter to tell the API to return a report of which steps of the workflow template are applicable in the target project/environment/flag, and which will need to be updated. When the `dryRun` query parameter is present the response body includes a `meta` property that holds a list of parameters that could potentially be inapplicable for the target resource. Each of these parameters will include a `valid` field. You will need to update any invalid parameters in order to create the new workflow. You can do this using the `parameters` property, which overrides the workflow template parameters. #### Overriding template parameters You can use the `parameters` property in the request body to tell the API to override the specified workflow template parameters with new values that are specific to your target project/environment/flag. <details> <summary>Click to expand example</summary> _Example request body_ ```json { \"name\": \"workflow created from my-template\", \"description\": \"description of my workflow\", \"parameters\": [ { \"_id\": \"62cf2bc4cadbeb7697943f3b\", \"path\": \"/clauses/0/values\", \"default\": { \"value\": [\"updated-segment\"] } }, { \"_id\": \"62cf2bc4cadbeb7697943f3d\", \"path\": \"/variationId\", \"default\": { \"value\": \"abcd1234-abcd-1234-abcd-1234abcd12\" } } ] } ``` </details> If there are any steps in the template that are not applicable to the target resource, the workflow will not be created, and the `meta` property will be included in the response body detailing which parameters need to be updated.- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)customWorkflowInput- (required)templateKey- The template key to apply as a starting point for the new workflow (optional)dryRun- Whether to call the endpoint in dry-run mode (optional)- Returns:
- CustomWorkflowOutput
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
postWorkflowWithHttpInfo
public ApiResponse<CustomWorkflowOutput> postWorkflowWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nonnull CustomWorkflowInput customWorkflowInput, @Nullable java.lang.String templateKey, @Nullable java.lang.Boolean dryRun) throws ApiException
Create workflow > ### Workflows are in maintenance mode > > The workflows feature is in maintenance mode, and is planned for future deprecation at a date not yet specified. We will work with existing customers using workflows to migrate to a replacement solution when deprecation occurs. Create a workflow for a feature flag. You can create a workflow directly, or you can apply a template to create a new workflow. ### Creating a workflow You can use the create workflow endpoint to create a workflow directly by adding a `stages` array to the request body. For each stage, define the `name`, `conditions` when the stage should be executed, and `action` that describes the stage. For approval stages, only standard LaunchDarkly approvals are permitted. Workflows of `kind` `integration-approval` cannot be used for custom workflows. <details> <summary>Click to expand example</summary> _Example request body_ ```json { \"name\": \"Progressive rollout starting in two days\", \"description\": \"Turn flag targeting on and increase feature rollout in 10% increments each day\", \"stages\": [ { \"name\": \"10% rollout on day 1\", \"conditions\": [ { \"kind\": \"schedule\", \"scheduleKind\": \"relative\", // or \"absolute\" // If \"scheduleKind\" is \"absolute\", set \"executionDate\"; // \"waitDuration\" and \"waitDurationUnit\" will be ignored \"waitDuration\": 2, \"waitDurationUnit\": \"calendarDay\" }, { \"kind\": \"ld-approval\", \"notifyMemberIds\": [ \"507f1f77bcf86cd799439011\" ], \"notifyTeamKeys\": [ \"team-key-123abc\" ] } ], \"action\": { \"instructions\": [ { \"kind\": \"turnFlagOn\" }, { \"kind\": \"updateFallthroughVariationOrRollout\", \"rolloutWeights\": { \"452f5fb5-7320-4ba3-81a1-8f4324f79d49\": 90000, \"fc15f6a4-05d3-4aa4-a997-446be461345d\": 10000 } } ] } } ] } ``` </details> ### Creating a workflow by applying a workflow template You can also create a workflow by applying a workflow template. If you pass a valid workflow template key as the `templateKey` query parameter with the request, the API will attempt to create a new workflow with the stages defined in the workflow template with the corresponding key. #### Applicability of stages Templates are created in the context of a particular flag in a particular environment in a particular project. However, because workflows created from a template can be applied to any project, environment, and flag, some steps of the workflow may need to be updated in order to be applicable for the target resource. You can pass a `dryRun` query parameter to tell the API to return a report of which steps of the workflow template are applicable in the target project/environment/flag, and which will need to be updated. When the `dryRun` query parameter is present the response body includes a `meta` property that holds a list of parameters that could potentially be inapplicable for the target resource. Each of these parameters will include a `valid` field. You will need to update any invalid parameters in order to create the new workflow. You can do this using the `parameters` property, which overrides the workflow template parameters. #### Overriding template parameters You can use the `parameters` property in the request body to tell the API to override the specified workflow template parameters with new values that are specific to your target project/environment/flag. <details> <summary>Click to expand example</summary> _Example request body_ ```json { \"name\": \"workflow created from my-template\", \"description\": \"description of my workflow\", \"parameters\": [ { \"_id\": \"62cf2bc4cadbeb7697943f3b\", \"path\": \"/clauses/0/values\", \"default\": { \"value\": [\"updated-segment\"] } }, { \"_id\": \"62cf2bc4cadbeb7697943f3d\", \"path\": \"/variationId\", \"default\": { \"value\": \"abcd1234-abcd-1234-abcd-1234abcd12\" } } ] } ``` </details> If there are any steps in the template that are not applicable to the target resource, the workflow will not be created, and the `meta` property will be included in the response body detailing which parameters need to be updated.- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)customWorkflowInput- (required)templateKey- The template key to apply as a starting point for the new workflow (optional)dryRun- Whether to call the endpoint in dry-run mode (optional)- Returns:
- ApiResponse<CustomWorkflowOutput>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
postWorkflowAsync
public okhttp3.Call postWorkflowAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String featureFlagKey, @Nonnull java.lang.String environmentKey, @Nonnull CustomWorkflowInput customWorkflowInput, @Nullable java.lang.String templateKey, @Nullable java.lang.Boolean dryRun, ApiCallback<CustomWorkflowOutput> _callback) throws ApiExceptionCreate workflow (asynchronously) > ### Workflows are in maintenance mode > > The workflows feature is in maintenance mode, and is planned for future deprecation at a date not yet specified. We will work with existing customers using workflows to migrate to a replacement solution when deprecation occurs. Create a workflow for a feature flag. You can create a workflow directly, or you can apply a template to create a new workflow. ### Creating a workflow You can use the create workflow endpoint to create a workflow directly by adding a `stages` array to the request body. For each stage, define the `name`, `conditions` when the stage should be executed, and `action` that describes the stage. For approval stages, only standard LaunchDarkly approvals are permitted. Workflows of `kind` `integration-approval` cannot be used for custom workflows. <details> <summary>Click to expand example</summary> _Example request body_ ```json { \"name\": \"Progressive rollout starting in two days\", \"description\": \"Turn flag targeting on and increase feature rollout in 10% increments each day\", \"stages\": [ { \"name\": \"10% rollout on day 1\", \"conditions\": [ { \"kind\": \"schedule\", \"scheduleKind\": \"relative\", // or \"absolute\" // If \"scheduleKind\" is \"absolute\", set \"executionDate\"; // \"waitDuration\" and \"waitDurationUnit\" will be ignored \"waitDuration\": 2, \"waitDurationUnit\": \"calendarDay\" }, { \"kind\": \"ld-approval\", \"notifyMemberIds\": [ \"507f1f77bcf86cd799439011\" ], \"notifyTeamKeys\": [ \"team-key-123abc\" ] } ], \"action\": { \"instructions\": [ { \"kind\": \"turnFlagOn\" }, { \"kind\": \"updateFallthroughVariationOrRollout\", \"rolloutWeights\": { \"452f5fb5-7320-4ba3-81a1-8f4324f79d49\": 90000, \"fc15f6a4-05d3-4aa4-a997-446be461345d\": 10000 } } ] } } ] } ``` </details> ### Creating a workflow by applying a workflow template You can also create a workflow by applying a workflow template. If you pass a valid workflow template key as the `templateKey` query parameter with the request, the API will attempt to create a new workflow with the stages defined in the workflow template with the corresponding key. #### Applicability of stages Templates are created in the context of a particular flag in a particular environment in a particular project. However, because workflows created from a template can be applied to any project, environment, and flag, some steps of the workflow may need to be updated in order to be applicable for the target resource. You can pass a `dryRun` query parameter to tell the API to return a report of which steps of the workflow template are applicable in the target project/environment/flag, and which will need to be updated. When the `dryRun` query parameter is present the response body includes a `meta` property that holds a list of parameters that could potentially be inapplicable for the target resource. Each of these parameters will include a `valid` field. You will need to update any invalid parameters in order to create the new workflow. You can do this using the `parameters` property, which overrides the workflow template parameters. #### Overriding template parameters You can use the `parameters` property in the request body to tell the API to override the specified workflow template parameters with new values that are specific to your target project/environment/flag. <details> <summary>Click to expand example</summary> _Example request body_ ```json { \"name\": \"workflow created from my-template\", \"description\": \"description of my workflow\", \"parameters\": [ { \"_id\": \"62cf2bc4cadbeb7697943f3b\", \"path\": \"/clauses/0/values\", \"default\": { \"value\": [\"updated-segment\"] } }, { \"_id\": \"62cf2bc4cadbeb7697943f3d\", \"path\": \"/variationId\", \"default\": { \"value\": \"abcd1234-abcd-1234-abcd-1234abcd12\" } } ] } ``` </details> If there are any steps in the template that are not applicable to the target resource, the workflow will not be created, and the `meta` property will be included in the response body detailing which parameters need to be updated.- Parameters:
projectKey- The project key (required)featureFlagKey- The feature flag key (required)environmentKey- The environment key (required)customWorkflowInput- (required)templateKey- The template key to apply as a starting point for the new workflow (optional)dryRun- Whether to call the endpoint in dry-run mode (optional)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
-