Class: LaunchDarklyApi::WorkflowsBetaApi

Inherits:
Object
  • Object
show all
Defined in:
lib/launchdarkly_api/api/workflows_beta_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ WorkflowsBetaApi

Returns a new instance of WorkflowsBetaApi.



19
20
21
# File 'lib/launchdarkly_api/api/workflows_beta_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/launchdarkly_api/api/workflows_beta_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_workflow(project_key, feature_flag_key, environment_key, workflow_id, opts = {}) ⇒ nil

Delete workflow Delete a workflow from a feature flag.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key

  • environment_key (String)

    The environment key

  • workflow_id (String)

    The workflow id

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


30
31
32
33
# File 'lib/launchdarkly_api/api/workflows_beta_api.rb', line 30

def delete_workflow(project_key, feature_flag_key, environment_key, workflow_id, opts = {})
  delete_workflow_with_http_info(project_key, feature_flag_key, environment_key, workflow_id, opts)
  nil
end

#delete_workflow_with_http_info(project_key, feature_flag_key, environment_key, workflow_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete workflow Delete a workflow from a feature flag.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key

  • environment_key (String)

    The environment key

  • workflow_id (String)

    The workflow id

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/launchdarkly_api/api/workflows_beta_api.rb', line 43

def delete_workflow_with_http_info(project_key, feature_flag_key, environment_key, workflow_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsBetaApi.delete_workflow ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling WorkflowsBetaApi.delete_workflow"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling WorkflowsBetaApi.delete_workflow"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling WorkflowsBetaApi.delete_workflow"
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsBetaApi.delete_workflow"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/workflows/{workflowId}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"WorkflowsBetaApi.delete_workflow",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsBetaApi#delete_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_custom_workflow(project_key, feature_flag_key, environment_key, workflow_id, opts = {}) ⇒ CustomWorkflowOutput

Get custom workflow Get a specific workflow by ID.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key

  • environment_key (String)

    The environment key

  • workflow_id (String)

    The workflow ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



111
112
113
114
# File 'lib/launchdarkly_api/api/workflows_beta_api.rb', line 111

def get_custom_workflow(project_key, feature_flag_key, environment_key, workflow_id, opts = {})
  data, _status_code, _headers = get_custom_workflow_with_http_info(project_key, feature_flag_key, environment_key, workflow_id, opts)
  data
end

#get_custom_workflow_with_http_info(project_key, feature_flag_key, environment_key, workflow_id, opts = {}) ⇒ Array<(CustomWorkflowOutput, Integer, Hash)>

Get custom workflow Get a specific workflow by ID.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key

  • environment_key (String)

    The environment key

  • workflow_id (String)

    The workflow ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CustomWorkflowOutput, Integer, Hash)>)

    CustomWorkflowOutput data, response status code and response headers



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/launchdarkly_api/api/workflows_beta_api.rb', line 124

def get_custom_workflow_with_http_info(project_key, feature_flag_key, environment_key, workflow_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsBetaApi.get_custom_workflow ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling WorkflowsBetaApi.get_custom_workflow"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling WorkflowsBetaApi.get_custom_workflow"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling WorkflowsBetaApi.get_custom_workflow"
  end
  # verify the required parameter 'workflow_id' is set
  if @api_client.config.client_side_validation && workflow_id.nil?
    fail ArgumentError, "Missing the required parameter 'workflow_id' when calling WorkflowsBetaApi.get_custom_workflow"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/workflows/{workflowId}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'workflowId' + '}', CGI.escape(workflow_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CustomWorkflowOutput'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"WorkflowsBetaApi.get_custom_workflow",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsBetaApi#get_custom_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_workflows(project_key, feature_flag_key, environment_key, opts = {}) ⇒ CustomWorkflowsListingOutput

Get workflows Display workflows associated with a feature flag.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key

  • environment_key (String)

    The environment key

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)

    Filter results by workflow status. Valid status filters are &#x60;active&#x60;, &#x60;completed&#x60;, and &#x60;failed&#x60;.

  • :sort (String)

    A field to sort the items by. Prefix field by a dash ( - ) to sort in descending order. This endpoint supports sorting by &#x60;creationDate&#x60; or &#x60;stopDate&#x60;.

Returns:



193
194
195
196
# File 'lib/launchdarkly_api/api/workflows_beta_api.rb', line 193

def get_workflows(project_key, feature_flag_key, environment_key, opts = {})
  data, _status_code, _headers = get_workflows_with_http_info(project_key, feature_flag_key, environment_key, opts)
  data
end

#get_workflows_with_http_info(project_key, feature_flag_key, environment_key, opts = {}) ⇒ Array<(CustomWorkflowsListingOutput, Integer, Hash)>

Get workflows Display workflows associated with a feature flag.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key

  • environment_key (String)

    The environment key

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)

    Filter results by workflow status. Valid status filters are &#x60;active&#x60;, &#x60;completed&#x60;, and &#x60;failed&#x60;.

  • :sort (String)

    A field to sort the items by. Prefix field by a dash ( - ) to sort in descending order. This endpoint supports sorting by &#x60;creationDate&#x60; or &#x60;stopDate&#x60;.

Returns:



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/launchdarkly_api/api/workflows_beta_api.rb', line 207

def get_workflows_with_http_info(project_key, feature_flag_key, environment_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsBetaApi.get_workflows ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling WorkflowsBetaApi.get_workflows"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling WorkflowsBetaApi.get_workflows"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling WorkflowsBetaApi.get_workflows"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/workflows'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CustomWorkflowsListingOutput'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"WorkflowsBetaApi.get_workflows",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsBetaApi#get_workflows\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_workflow(project_key, feature_flag_key, environment_key, custom_workflow_input, opts = {}) ⇒ CustomWorkflowOutput

Create workflow 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. <details> <summary>Click to expand example</summary> _Example request body_ “`json { "name": "Progressive rollout starting in two days", "description": "Turn flag on for 10% of customers 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:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key

  • environment_key (String)

    The environment key

  • custom_workflow_input (CustomWorkflowInput)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :template_key (String)

    The template key to apply as a starting point for the new workflow

  • :dry_run (Boolean)

    Whether to call the endpoint in dry-run mode

Returns:



275
276
277
278
# File 'lib/launchdarkly_api/api/workflows_beta_api.rb', line 275

def post_workflow(project_key, feature_flag_key, environment_key, custom_workflow_input, opts = {})
  data, _status_code, _headers = post_workflow_with_http_info(project_key, feature_flag_key, environment_key, custom_workflow_input, opts)
  data
end

#post_workflow_with_http_info(project_key, feature_flag_key, environment_key, custom_workflow_input, opts = {}) ⇒ Array<(CustomWorkflowOutput, Integer, Hash)>

Create workflow 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 &#x60;stages&#x60; array to the request body. For each stage, define the &#x60;name&#x60;, &#x60;conditions&#x60; when the stage should be executed, and &#x60;action&#x60; that describes the stage. &lt;details&gt; &lt;summary&gt;Click to expand example&lt;/summary&gt; _Example request body_ &#x60;&#x60;&#x60;json { &quot;name&quot;: &quot;Progressive rollout starting in two days&quot;, &quot;description&quot;: &quot;Turn flag on for 10% of customers each day&quot;, &quot;stages&quot;: [ { &quot;name&quot;: &quot;10% rollout on day 1&quot;, &quot;conditions&quot;: [ { &quot;kind&quot;: &quot;schedule&quot;, &quot;scheduleKind&quot;: &quot;relative&quot;, // or &quot;absolute&quot; // If &quot;scheduleKind&quot; is &quot;absolute&quot;, set &quot;executionDate&quot;; // &quot;waitDuration&quot; and &quot;waitDurationUnit&quot; will be ignored &quot;waitDuration&quot;: 2, &quot;waitDurationUnit&quot;: &quot;calendarDay&quot; }, { &quot;kind&quot;: &quot;ld-approval&quot;, &quot;notifyMemberIds&quot;: [ &quot;507f1f77bcf86cd799439011&quot; ], &quot;notifyTeamKeys&quot;: [ &quot;team-key-123abc&quot; ] } ], &quot;action&quot;: { &quot;instructions&quot;: [ { &quot;kind&quot;: &quot;turnFlagOn&quot; }, { &quot;kind&quot;: &quot;updateFallthroughVariationOrRollout&quot;, &quot;rolloutWeights&quot;: { &quot;452f5fb5-7320-4ba3-81a1-8f4324f79d49&quot;: 90000, &quot;fc15f6a4-05d3-4aa4-a997-446be461345d&quot;: 10000 } } ] } } ] } &#x60;&#x60;&#x60; &lt;/details&gt; ### 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 &#x60;templateKey&#x60; 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 &#x60;dryRun&#x60; 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 &#x60;dryRun&#x60; query parameter is present the response body includes a &#x60;meta&#x60; property that holds a list of parameters that could potentially be inapplicable for the target resource. Each of these parameters will include a &#x60;valid&#x60; field. You will need to update any invalid parameters in order to create the new workflow. You can do this using the &#x60;parameters&#x60; property, which overrides the workflow template parameters. #### Overriding template parameters You can use the &#x60;parameters&#x60; 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. &lt;details&gt; &lt;summary&gt;Click to expand example&lt;/summary&gt; _Example request body_ &#x60;&#x60;&#x60;json { &quot;name&quot;: &quot;workflow created from my-template&quot;, &quot;description&quot;: &quot;description of my workflow&quot;, &quot;parameters&quot;: [ { &quot;_id&quot;: &quot;62cf2bc4cadbeb7697943f3b&quot;, &quot;path&quot;: &quot;/clauses/0/values&quot;, &quot;default&quot;: { &quot;value&quot;: [&quot;updated-segment&quot;] } }, { &quot;_id&quot;: &quot;62cf2bc4cadbeb7697943f3d&quot;, &quot;path&quot;: &quot;/variationId&quot;, &quot;default&quot;: { &quot;value&quot;: &quot;abcd1234-abcd-1234-abcd-1234abcd12&quot; } } ] } &#x60;&#x60;&#x60; &lt;/details&gt; If there are any steps in the template that are not applicable to the target resource, the workflow will not be created, and the &#x60;meta&#x60; property will be included in the response body detailing which parameters need to be updated.

Parameters:

  • project_key (String)

    The project key

  • feature_flag_key (String)

    The feature flag key

  • environment_key (String)

    The environment key

  • custom_workflow_input (CustomWorkflowInput)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :template_key (String)

    The template key to apply as a starting point for the new workflow

  • :dry_run (Boolean)

    Whether to call the endpoint in dry-run mode

Returns:

  • (Array<(CustomWorkflowOutput, Integer, Hash)>)

    CustomWorkflowOutput data, response status code and response headers



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/launchdarkly_api/api/workflows_beta_api.rb', line 290

def post_workflow_with_http_info(project_key, feature_flag_key, environment_key, custom_workflow_input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WorkflowsBetaApi.post_workflow ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling WorkflowsBetaApi.post_workflow"
  end
  # verify the required parameter 'feature_flag_key' is set
  if @api_client.config.client_side_validation && feature_flag_key.nil?
    fail ArgumentError, "Missing the required parameter 'feature_flag_key' when calling WorkflowsBetaApi.post_workflow"
  end
  # verify the required parameter 'environment_key' is set
  if @api_client.config.client_side_validation && environment_key.nil?
    fail ArgumentError, "Missing the required parameter 'environment_key' when calling WorkflowsBetaApi.post_workflow"
  end
  # verify the required parameter 'custom_workflow_input' is set
  if @api_client.config.client_side_validation && custom_workflow_input.nil?
    fail ArgumentError, "Missing the required parameter 'custom_workflow_input' when calling WorkflowsBetaApi.post_workflow"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/workflows'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'featureFlagKey' + '}', CGI.escape(feature_flag_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'templateKey'] = opts[:'template_key'] if !opts[:'template_key'].nil?
  query_params[:'dryRun'] = opts[:'dry_run'] if !opts[:'dry_run'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(custom_workflow_input)

  # return_type
  return_type = opts[:debug_return_type] || 'CustomWorkflowOutput'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"WorkflowsBetaApi.post_workflow",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkflowsBetaApi#post_workflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end