launchdarkly_api 7.0.0 → 7.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -4
  3. data/docs/AccountMembersApi.md +75 -1
  4. data/docs/CodeReferencesApi.md +5 -1
  5. data/docs/CustomRolesRep.md +24 -0
  6. data/docs/ExpandedTeamRep.md +44 -0
  7. data/docs/FeatureFlagsApi.md +1 -3
  8. data/docs/FlagTriggerInput.md +20 -0
  9. data/docs/FlagTriggersApi.md +396 -0
  10. data/docs/Integration.md +40 -0
  11. data/docs/IntegrationAuditLogSubscriptionsApi.md +376 -0
  12. data/docs/IntegrationStatusRep.md +22 -0
  13. data/docs/IntegrationSubscriptionStatusRep.md +26 -0
  14. data/docs/Integrations.md +22 -0
  15. data/docs/MemberImportItemRep.md +22 -0
  16. data/docs/MemberTeamsFormPost.md +18 -0
  17. data/docs/MetricListingRep.md +1 -1
  18. data/docs/MetricPost.md +1 -1
  19. data/docs/MetricRep.md +1 -1
  20. data/docs/MetricSeen.md +2 -2
  21. data/docs/PutBranch.md +3 -1
  22. data/docs/RecentTriggerBody.md +20 -0
  23. data/docs/Rule.md +3 -1
  24. data/docs/ScheduledChangesApi.md +1 -1
  25. data/docs/SegmentsApi.md +2 -2
  26. data/docs/SubscriptionPost.md +30 -0
  27. data/docs/TeamImportsRep.md +18 -0
  28. data/docs/TeamsBetaApi.md +84 -8
  29. data/docs/TriggerPost.md +22 -0
  30. data/docs/TriggerWorkflowCollectionRep.md +20 -0
  31. data/docs/TriggerWorkflowRep.md +42 -0
  32. data/lib/launchdarkly_api/api/account_members_api.rb +76 -2
  33. data/lib/launchdarkly_api/api/code_references_api.rb +6 -0
  34. data/lib/launchdarkly_api/api/feature_flags_api.rb +2 -5
  35. data/lib/launchdarkly_api/api/flag_triggers_api.rb +437 -0
  36. data/lib/launchdarkly_api/api/integration_audit_log_subscriptions_api.rb +377 -0
  37. data/lib/launchdarkly_api/api/scheduled_changes_api.rb +2 -2
  38. data/lib/launchdarkly_api/api/segments_api.rb +4 -4
  39. data/lib/launchdarkly_api/api/teams_beta_api.rb +77 -6
  40. data/lib/launchdarkly_api/models/custom_roles_rep.rb +247 -0
  41. data/lib/launchdarkly_api/models/expanded_team_rep.rb +349 -0
  42. data/lib/launchdarkly_api/models/flag_trigger_input.rb +230 -0
  43. data/lib/launchdarkly_api/models/integration.rb +325 -0
  44. data/lib/launchdarkly_api/models/integration_status_rep.rb +236 -0
  45. data/lib/launchdarkly_api/models/integration_subscription_status_rep.rb +256 -0
  46. data/lib/launchdarkly_api/models/integrations.rb +240 -0
  47. data/lib/launchdarkly_api/models/member_import_item_rep.rb +246 -0
  48. data/lib/launchdarkly_api/models/member_teams_form_post.rb +226 -0
  49. data/lib/launchdarkly_api/models/metric_listing_rep.rb +13 -1
  50. data/lib/launchdarkly_api/models/metric_post.rb +13 -1
  51. data/lib/launchdarkly_api/models/metric_rep.rb +13 -1
  52. data/lib/launchdarkly_api/models/metric_seen.rb +7 -7
  53. data/lib/launchdarkly_api/models/put_branch.rb +13 -4
  54. data/lib/launchdarkly_api/models/recent_trigger_body.rb +229 -0
  55. data/lib/launchdarkly_api/models/rule.rb +13 -4
  56. data/lib/launchdarkly_api/models/subscription_post.rb +293 -0
  57. data/lib/launchdarkly_api/models/team_imports_rep.rb +220 -0
  58. data/lib/launchdarkly_api/models/trigger_post.rb +245 -0
  59. data/lib/launchdarkly_api/models/trigger_workflow_collection_rep.rb +231 -0
  60. data/lib/launchdarkly_api/models/trigger_workflow_rep.rb +332 -0
  61. data/lib/launchdarkly_api/version.rb +1 -1
  62. data/lib/launchdarkly_api.rb +17 -0
  63. data/spec/api/account_members_api_spec.rb +14 -1
  64. data/spec/api/code_references_api_spec.rb +2 -0
  65. data/spec/api/feature_flags_api_spec.rb +1 -2
  66. data/spec/api/flag_triggers_api_spec.rb +110 -0
  67. data/spec/api/integration_audit_log_subscriptions_api_spec.rb +100 -0
  68. data/spec/api/scheduled_changes_api_spec.rb +1 -1
  69. data/spec/api/segments_api_spec.rb +2 -2
  70. data/spec/api/teams_beta_api_spec.rb +15 -2
  71. data/spec/models/custom_roles_rep_spec.rb +52 -0
  72. data/spec/models/expanded_team_rep_spec.rb +112 -0
  73. data/spec/models/flag_trigger_input_spec.rb +40 -0
  74. data/spec/models/integration_spec.rb +100 -0
  75. data/spec/models/integration_status_rep_spec.rb +46 -0
  76. data/spec/models/integration_subscription_status_rep_spec.rb +58 -0
  77. data/spec/models/integrations_spec.rb +46 -0
  78. data/spec/models/member_import_item_rep_spec.rb +46 -0
  79. data/spec/models/member_teams_form_post_spec.rb +34 -0
  80. data/spec/models/metric_listing_rep_spec.rb +4 -0
  81. data/spec/models/metric_post_spec.rb +4 -0
  82. data/spec/models/metric_rep_spec.rb +4 -0
  83. data/spec/models/metric_seen_spec.rb +1 -1
  84. data/spec/models/put_branch_spec.rb +6 -0
  85. data/spec/models/recent_trigger_body_spec.rb +40 -0
  86. data/spec/models/rule_spec.rb +6 -0
  87. data/spec/models/subscription_post_spec.rb +70 -0
  88. data/spec/models/team_imports_rep_spec.rb +34 -0
  89. data/spec/models/trigger_post_spec.rb +46 -0
  90. data/spec/models/trigger_workflow_collection_rep_spec.rb +40 -0
  91. data/spec/models/trigger_workflow_rep_spec.rb +106 -0
  92. metadata +70 -2
data/docs/TeamsBetaApi.md CHANGED
@@ -9,6 +9,7 @@ All URIs are relative to *https://app.launchdarkly.com*
9
9
  | [**get_teams**](TeamsBetaApi.md#get_teams) | **GET** /api/v2/teams | List teams |
10
10
  | [**patch_team**](TeamsBetaApi.md#patch_team) | **PATCH** /api/v2/teams/{key} | Update team |
11
11
  | [**post_team**](TeamsBetaApi.md#post_team) | **POST** /api/v2/teams | Create team |
12
+ | [**post_team_members**](TeamsBetaApi.md#post_team_members) | **POST** /api/v2/teams/{key}/members | Add members to team |
12
13
 
13
14
 
14
15
  ## delete_team
@@ -83,7 +84,7 @@ nil (empty response body)
83
84
 
84
85
  ## get_team
85
86
 
86
- > <TeamRep> get_team(key)
87
+ > <ExpandedTeamRep> get_team(key)
87
88
 
88
89
  Get team
89
90
 
@@ -118,7 +119,7 @@ end
118
119
 
119
120
  This returns an Array which contains the response data, status code and headers.
120
121
 
121
- > <Array(<TeamRep>, Integer, Hash)> get_team_with_http_info(key)
122
+ > <Array(<ExpandedTeamRep>, Integer, Hash)> get_team_with_http_info(key)
122
123
 
123
124
  ```ruby
124
125
  begin
@@ -126,7 +127,7 @@ begin
126
127
  data, status_code, headers = api_instance.get_team_with_http_info(key)
127
128
  p status_code # => 2xx
128
129
  p headers # => { ... }
129
- p data # => <TeamRep>
130
+ p data # => <ExpandedTeamRep>
130
131
  rescue LaunchDarklyApi::ApiError => e
131
132
  puts "Error when calling TeamsBetaApi->get_team_with_http_info: #{e}"
132
133
  end
@@ -140,7 +141,7 @@ end
140
141
 
141
142
  ### Return type
142
143
 
143
- [**TeamRep**](TeamRep.md)
144
+ [**ExpandedTeamRep**](ExpandedTeamRep.md)
144
145
 
145
146
  ### Authorization
146
147
 
@@ -231,7 +232,7 @@ end
231
232
 
232
233
  ## patch_team
233
234
 
234
- > <TeamCollectionRep> patch_team(key, team_patch_input)
235
+ > <ExpandedTeamRep> patch_team(key, team_patch_input)
235
236
 
236
237
  Update team
237
238
 
@@ -267,7 +268,7 @@ end
267
268
 
268
269
  This returns an Array which contains the response data, status code and headers.
269
270
 
270
- > <Array(<TeamCollectionRep>, Integer, Hash)> patch_team_with_http_info(key, team_patch_input)
271
+ > <Array(<ExpandedTeamRep>, Integer, Hash)> patch_team_with_http_info(key, team_patch_input)
271
272
 
272
273
  ```ruby
273
274
  begin
@@ -275,7 +276,7 @@ begin
275
276
  data, status_code, headers = api_instance.patch_team_with_http_info(key, team_patch_input)
276
277
  p status_code # => 2xx
277
278
  p headers # => { ... }
278
- p data # => <TeamCollectionRep>
279
+ p data # => <ExpandedTeamRep>
279
280
  rescue LaunchDarklyApi::ApiError => e
280
281
  puts "Error when calling TeamsBetaApi->patch_team_with_http_info: #{e}"
281
282
  end
@@ -290,7 +291,7 @@ end
290
291
 
291
292
  ### Return type
292
293
 
293
- [**TeamCollectionRep**](TeamCollectionRep.md)
294
+ [**ExpandedTeamRep**](ExpandedTeamRep.md)
294
295
 
295
296
  ### Authorization
296
297
 
@@ -372,3 +373,78 @@ end
372
373
  - **Content-Type**: application/json
373
374
  - **Accept**: application/json
374
375
 
376
+
377
+ ## post_team_members
378
+
379
+ > <TeamImportsRep> post_team_members(key, opts)
380
+
381
+ Add members to team
382
+
383
+ Add multiple members to an existing team by uploading a CSV file of member email addresses. Your CSV file must include email addresses in the first column. You can include data in additional columns, but LaunchDarkly ignores all data outside the first column. Headers are optional. **Members are only added on a `201` response.** A `207` indicates the CSV file contains a combination of valid and invalid entries and will _not_ result in any members being added to the team. On a `207` response, if an entry contains bad user input the `message` field will contain the row number as well as the reason for the error. The `message` field will be omitted if the entry is valid. Example `207` response: ```json { \"items\": [ { \"status\": \"success\", \"value\": \"a-valid-email@launchdarkly.com\" }, { \"message\": \"Line 2: empty row\", \"status\": \"error\", \"value\": \"\" }, { \"message\": \"Line 3: email already exists in the specified team\", \"status\": \"error\", \"value\": \"existing-team-member@launchdarkly.com\" }, { \"message\": \"Line 4: invalid email formatting\", \"status\": \"error\", \"value\": \"invalid email format\" } ] } ``` Message | Resolution --- | --- Empty row | This line is blank. Add an email address and try again. Duplicate entry | This email address appears in the file twice. Remove the email from the file and try again. Email already exists in the specified team | This member is already on your team. Remove the email from the file and try again. Invalid formatting | This email address is not formatted correctly. Fix the formatting and try again. Email does not belong to a LaunchDarkly member | The email address doesn't belong to a LaunchDarkly account member. Invite them to LaunchDarkly, then re-add them to the team. On a `400` response, the `message` field may contain errors specific to this endpoint. Example `400` response: ```json { \"code\": \"invalid_request\", \"message\": \"Unable to process file\" } ``` Message | Resolution --- | --- Unable to process file | LaunchDarkly could not process the file for an unspecified reason. Review your file for errors and try again. File exceeds 25mb | Break up your file into multiple files of less than 25mbs each. All emails have invalid formatting | None of the email addresses in the file are in the correct format. Fix the formatting and try again. All emails belong to existing team members | All listed members are already on this team. Populate the file with member emails that do not belong to the team and try again. File is empty | The CSV file does not contain any email addresses. Populate the file and try again. No emails belong to members of your LaunchDarkly organization | None of the email addresses belong to members of your LaunchDarkly account. Invite these members to LaunchDarkly, then re-add them to the team.
384
+
385
+ ### Examples
386
+
387
+ ```ruby
388
+ require 'time'
389
+ require 'launchdarkly_api'
390
+ # setup authorization
391
+ LaunchDarklyApi.configure do |config|
392
+ # Configure API key authorization: ApiKey
393
+ config.api_key['ApiKey'] = 'YOUR API KEY'
394
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
395
+ # config.api_key_prefix['ApiKey'] = 'Bearer'
396
+ end
397
+
398
+ api_instance = LaunchDarklyApi::TeamsBetaApi.new
399
+ key = 'key_example' # String | The team key
400
+ opts = {
401
+ file: File.new('/path/to/some/file') # File | CSV file containing email addresses
402
+ }
403
+
404
+ begin
405
+ # Add members to team
406
+ result = api_instance.post_team_members(key, opts)
407
+ p result
408
+ rescue LaunchDarklyApi::ApiError => e
409
+ puts "Error when calling TeamsBetaApi->post_team_members: #{e}"
410
+ end
411
+ ```
412
+
413
+ #### Using the post_team_members_with_http_info variant
414
+
415
+ This returns an Array which contains the response data, status code and headers.
416
+
417
+ > <Array(<TeamImportsRep>, Integer, Hash)> post_team_members_with_http_info(key, opts)
418
+
419
+ ```ruby
420
+ begin
421
+ # Add members to team
422
+ data, status_code, headers = api_instance.post_team_members_with_http_info(key, opts)
423
+ p status_code # => 2xx
424
+ p headers # => { ... }
425
+ p data # => <TeamImportsRep>
426
+ rescue LaunchDarklyApi::ApiError => e
427
+ puts "Error when calling TeamsBetaApi->post_team_members_with_http_info: #{e}"
428
+ end
429
+ ```
430
+
431
+ ### Parameters
432
+
433
+ | Name | Type | Description | Notes |
434
+ | ---- | ---- | ----------- | ----- |
435
+ | **key** | **String** | The team key | |
436
+ | **file** | **File** | CSV file containing email addresses | [optional] |
437
+
438
+ ### Return type
439
+
440
+ [**TeamImportsRep**](TeamImportsRep.md)
441
+
442
+ ### Authorization
443
+
444
+ [ApiKey](../README.md#ApiKey)
445
+
446
+ ### HTTP request headers
447
+
448
+ - **Content-Type**: multipart/form-data
449
+ - **Accept**: application/json
450
+
@@ -0,0 +1,22 @@
1
+ # LaunchDarklyApi::TriggerPost
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **comment** | **String** | | [optional] |
8
+ | **instructions** | **Array&lt;Hash&gt;** | The action to perform when triggering. It should pass an array with a single {\&quot;kind\&quot;: &lt;flag_action&gt;} object. Currently supported flag actions are \&quot;turnFlagOn\&quot; and \&quot;turnFlagOff\&quot;. | [optional] |
9
+ | **integration_key** | **String** | The unique identifier of the integration you intend to set your trigger up with. \&quot;generic-trigger\&quot; should be used for integrations not explicitly supported. | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'launchdarkly_api'
15
+
16
+ instance = LaunchDarklyApi::TriggerPost.new(
17
+ comment: null,
18
+ instructions: null,
19
+ integration_key: null
20
+ )
21
+ ```
22
+
@@ -0,0 +1,20 @@
1
+ # LaunchDarklyApi::TriggerWorkflowCollectionRep
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **items** | [**Array&lt;TriggerWorkflowRep&gt;**](TriggerWorkflowRep.md) | | [optional] |
8
+ | **_links** | [**Hash&lt;String, Link&gt;**](Link.md) | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'launchdarkly_api'
14
+
15
+ instance = LaunchDarklyApi::TriggerWorkflowCollectionRep.new(
16
+ items: null,
17
+ _links: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,42 @@
1
+ # LaunchDarklyApi::TriggerWorkflowRep
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **_id** | **String** | | [optional] |
8
+ | **_version** | **Integer** | | [optional] |
9
+ | **_creation_date** | **Integer** | | [optional] |
10
+ | **_maintainer_id** | **String** | | [optional] |
11
+ | **_maintainer** | [**MemberSummaryRep**](MemberSummaryRep.md) | | [optional] |
12
+ | **enabled** | **Boolean** | | [optional] |
13
+ | **_integration_key** | **String** | | [optional] |
14
+ | **instructions** | **Array&lt;Hash&gt;** | | [optional] |
15
+ | **_last_triggered_at** | **Integer** | | [optional] |
16
+ | **_recent_trigger_bodies** | [**Array&lt;RecentTriggerBody&gt;**](RecentTriggerBody.md) | | [optional] |
17
+ | **_trigger_count** | **Integer** | | [optional] |
18
+ | **trigger_url** | **String** | | [optional] |
19
+ | **_links** | [**Hash&lt;String, Link&gt;**](Link.md) | | [optional] |
20
+
21
+ ## Example
22
+
23
+ ```ruby
24
+ require 'launchdarkly_api'
25
+
26
+ instance = LaunchDarklyApi::TriggerWorkflowRep.new(
27
+ _id: null,
28
+ _version: null,
29
+ _creation_date: null,
30
+ _maintainer_id: null,
31
+ _maintainer: null,
32
+ enabled: null,
33
+ _integration_key: null,
34
+ instructions: null,
35
+ _last_triggered_at: null,
36
+ _recent_trigger_bodies: null,
37
+ _trigger_count: null,
38
+ trigger_url: null,
39
+ _links: null
40
+ )
41
+ ```
42
+
@@ -215,7 +215,7 @@ module LaunchDarklyApi
215
215
  end
216
216
 
217
217
  # Modify an account member
218
- # Update a single account member. The request should be a valid JSON Patch document describing the changes to be made to the member. Requests to update account members will not work if SCIM is enabled for the account.
218
+ # Update a single account member. The request should be a valid JSON Patch document describing the changes to be made to the member. To update fields in the account member object that are arrays, set the `path` to the name of the field and then append `/<array index>`. Using `/0` appends to the beginning of the array. For example, to add a new custom role to a member, use the following request body: ``` [ { \"op\": \"add\", \"path\": \"/customRoles/0\", \"value\": \"some-role-id\" } ] ``` Requests to update account members will not work if SCIM is enabled for the account.
219
219
  # @param id [String] The member ID
220
220
  # @param patch_operation [Array<PatchOperation>]
221
221
  # @param [Hash] opts the optional parameters
@@ -226,7 +226,7 @@ module LaunchDarklyApi
226
226
  end
227
227
 
228
228
  # Modify an account member
229
- # Update a single account member. The request should be a valid JSON Patch document describing the changes to be made to the member. Requests to update account members will not work if SCIM is enabled for the account.
229
+ # Update a single account member. The request should be a valid JSON Patch document describing the changes to be made to the member. To update fields in the account member object that are arrays, set the &#x60;path&#x60; to the name of the field and then append &#x60;/&lt;array index&gt;&#x60;. Using &#x60;/0&#x60; appends to the beginning of the array. For example, to add a new custom role to a member, use the following request body: &#x60;&#x60;&#x60; [ { \&quot;op\&quot;: \&quot;add\&quot;, \&quot;path\&quot;: \&quot;/customRoles/0\&quot;, \&quot;value\&quot;: \&quot;some-role-id\&quot; } ] &#x60;&#x60;&#x60; Requests to update account members will not work if SCIM is enabled for the account.
230
230
  # @param id [String] The member ID
231
231
  # @param patch_operation [Array<PatchOperation>]
232
232
  # @param [Hash] opts the optional parameters
@@ -288,6 +288,80 @@ module LaunchDarklyApi
288
288
  return data, status_code, headers
289
289
  end
290
290
 
291
+ # Add member to teams
292
+ # Add member to team(s)
293
+ # @param id [String] The member ID
294
+ # @param member_teams_form_post [MemberTeamsFormPost]
295
+ # @param [Hash] opts the optional parameters
296
+ # @return [Member]
297
+ def post_member_teams(id, member_teams_form_post, opts = {})
298
+ data, _status_code, _headers = post_member_teams_with_http_info(id, member_teams_form_post, opts)
299
+ data
300
+ end
301
+
302
+ # Add member to teams
303
+ # Add member to team(s)
304
+ # @param id [String] The member ID
305
+ # @param member_teams_form_post [MemberTeamsFormPost]
306
+ # @param [Hash] opts the optional parameters
307
+ # @return [Array<(Member, Integer, Hash)>] Member data, response status code and response headers
308
+ def post_member_teams_with_http_info(id, member_teams_form_post, opts = {})
309
+ if @api_client.config.debugging
310
+ @api_client.config.logger.debug 'Calling API: AccountMembersApi.post_member_teams ...'
311
+ end
312
+ # verify the required parameter 'id' is set
313
+ if @api_client.config.client_side_validation && id.nil?
314
+ fail ArgumentError, "Missing the required parameter 'id' when calling AccountMembersApi.post_member_teams"
315
+ end
316
+ # verify the required parameter 'member_teams_form_post' is set
317
+ if @api_client.config.client_side_validation && member_teams_form_post.nil?
318
+ fail ArgumentError, "Missing the required parameter 'member_teams_form_post' when calling AccountMembersApi.post_member_teams"
319
+ end
320
+ # resource path
321
+ local_var_path = '/api/v2/members/{id}/teams'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
322
+
323
+ # query parameters
324
+ query_params = opts[:query_params] || {}
325
+
326
+ # header parameters
327
+ header_params = opts[:header_params] || {}
328
+ # HTTP header 'Accept' (if needed)
329
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
330
+ # HTTP header 'Content-Type'
331
+ content_type = @api_client.select_header_content_type(['application/json'])
332
+ if !content_type.nil?
333
+ header_params['Content-Type'] = content_type
334
+ end
335
+
336
+ # form parameters
337
+ form_params = opts[:form_params] || {}
338
+
339
+ # http body (model)
340
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(member_teams_form_post)
341
+
342
+ # return_type
343
+ return_type = opts[:debug_return_type] || 'Member'
344
+
345
+ # auth_names
346
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
347
+
348
+ new_options = opts.merge(
349
+ :operation => :"AccountMembersApi.post_member_teams",
350
+ :header_params => header_params,
351
+ :query_params => query_params,
352
+ :form_params => form_params,
353
+ :body => post_body,
354
+ :auth_names => auth_names,
355
+ :return_type => return_type
356
+ )
357
+
358
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
359
+ if @api_client.config.debugging
360
+ @api_client.config.logger.debug "API called: AccountMembersApi#post_member_teams\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
361
+ end
362
+ return data, status_code, headers
363
+ end
364
+
291
365
  # Invite new members
292
366
  # > ### Full use of this API resource is only available to accounts with paid subscriptions > > The ability to bulk invite members is a paid feature. Single members may be invited if not on a paid plan. Invite one or more new members to join an account. Each member is sent an invitation. Members with \"admin\" or \"owner\" roles may create new members, as well as anyone with a \"createMember\" permission for \"member/\\*\". If a member cannot be invited, the entire request is rejected and no members are invited from that request. Each member _must_ have an `email` field and either a `role` or a `customRoles` field. If any of the fields are not populated correctly, the request is rejected with the reason specified in the \"message\" field of the response. Requests to create account members will not work if SCIM is enabled for the account. _No more than 50 members may be created per request._ A request may also fail because of conflicts with existing members. These conflicts are reported using the additional `code` and `invalid_emails` response fields with the following possible values for `code`: - **email_already_exists_in_account**: A member with this email address already exists in this account. - **email_taken_in_different_account**: A member with this email address exists in another account. - **duplicate_email**s: This request contains two or more members with the same email address. A request that fails for one of the above reasons returns an HTTP response code of 400 (Bad Request).
293
367
  # @param new_member_form [Array<NewMemberForm>]
@@ -301,6 +301,8 @@ module LaunchDarklyApi
301
301
  # @option opts [String] :branch_name Filter results to a specific branch. By default, only the default branch will be queried for extinctions.
302
302
  # @option opts [String] :proj_key Filter results to a specific project
303
303
  # @option opts [String] :flag_key Filter results to a specific flag key
304
+ # @option opts [Integer] :from Filter results to a specific timeframe based on commit time, expressed as a Unix epoch time in milliseconds. Must be used with &#x60;to&#x60;.
305
+ # @option opts [Integer] :to Filter results to a specific timeframe based on commit time, expressed as a Unix epoch time in milliseconds. Must be used with &#x60;from&#x60;.
304
306
  # @return [ExtinctionCollectionRep]
305
307
  def get_extinctions(opts = {})
306
308
  data, _status_code, _headers = get_extinctions_with_http_info(opts)
@@ -314,6 +316,8 @@ module LaunchDarklyApi
314
316
  # @option opts [String] :branch_name Filter results to a specific branch. By default, only the default branch will be queried for extinctions.
315
317
  # @option opts [String] :proj_key Filter results to a specific project
316
318
  # @option opts [String] :flag_key Filter results to a specific flag key
319
+ # @option opts [Integer] :from Filter results to a specific timeframe based on commit time, expressed as a Unix epoch time in milliseconds. Must be used with &#x60;to&#x60;.
320
+ # @option opts [Integer] :to Filter results to a specific timeframe based on commit time, expressed as a Unix epoch time in milliseconds. Must be used with &#x60;from&#x60;.
317
321
  # @return [Array<(ExtinctionCollectionRep, Integer, Hash)>] ExtinctionCollectionRep data, response status code and response headers
318
322
  def get_extinctions_with_http_info(opts = {})
319
323
  if @api_client.config.debugging
@@ -328,6 +332,8 @@ module LaunchDarklyApi
328
332
  query_params[:'branchName'] = opts[:'branch_name'] if !opts[:'branch_name'].nil?
329
333
  query_params[:'projKey'] = opts[:'proj_key'] if !opts[:'proj_key'].nil?
330
334
  query_params[:'flagKey'] = opts[:'flag_key'] if !opts[:'flag_key'].nil?
335
+ query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
336
+ query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
331
337
 
332
338
  # header parameters
333
339
  header_params = opts[:header_params] || {}
@@ -539,7 +539,6 @@ module LaunchDarklyApi
539
539
  # @option opts [String] :tag Filter feature flags by tag
540
540
  # @option opts [Integer] :limit The number of feature flags to return. Defaults to -1, which returns all flags
541
541
  # @option opts [Integer] :offset Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next limit items
542
- # @option opts [String] :query A string that matches against the flags&#39; keys and names. It is not case sensitive
543
542
  # @option opts [Boolean] :archived A boolean to filter the list to archived flags. When this is absent, only unarchived flags will be returned
544
543
  # @option opts [Boolean] :summary By default in API version &gt;&#x3D; 1, flags will _not_ include their list of prerequisites, targets or rules. Set summary&#x3D;0 to include these fields for each flag returned
545
544
  # @option opts [String] :filter A comma-separated list of filters. Each filter is of the form field:value
@@ -558,7 +557,6 @@ module LaunchDarklyApi
558
557
  # @option opts [String] :tag Filter feature flags by tag
559
558
  # @option opts [Integer] :limit The number of feature flags to return. Defaults to -1, which returns all flags
560
559
  # @option opts [Integer] :offset Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next limit items
561
- # @option opts [String] :query A string that matches against the flags&#39; keys and names. It is not case sensitive
562
560
  # @option opts [Boolean] :archived A boolean to filter the list to archived flags. When this is absent, only unarchived flags will be returned
563
561
  # @option opts [Boolean] :summary By default in API version &gt;&#x3D; 1, flags will _not_ include their list of prerequisites, targets or rules. Set summary&#x3D;0 to include these fields for each flag returned
564
562
  # @option opts [String] :filter A comma-separated list of filters. Each filter is of the form field:value
@@ -581,7 +579,6 @@ module LaunchDarklyApi
581
579
  query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?
582
580
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
583
581
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
584
- query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
585
582
  query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?
586
583
  query_params[:'summary'] = opts[:'summary'] if !opts[:'summary'].nil?
587
584
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
@@ -708,7 +705,7 @@ module LaunchDarklyApi
708
705
  end
709
706
 
710
707
  # Update feature flag
711
- # Perform a partial update to a feature flag. ## Using JSON Patches on a feature flag When using the update feature flag endpoint to add individual users to a specific variation, there are two different patch documents, depending on whether users are already being individually targeted for the variation. If a flag variation already has users individually targeted, the path for the JSON Patch operation is: ```json { \"op\": \"add\", \"path\": \"/environments/devint/targets/0/values/-\", \"value\": \"TestClient10\" } ``` If a flag variation does not already have users individually targeted, the path for the JSON Patch operation is: ```json [ { \"op\": \"add\", \"path\": \"/environments/devint/targets/-\", \"value\": { \"variation\": 0, \"values\": [\"TestClient10\"] } } ] ``` ## Using semantic patches on a feature flag To use a [semantic patch](/#section/Updates/Updates-via-semantic-patches) on a feature flag resource, you must include a header in the request. If you call a semantic patch resource without this header, you receive a `400` response as your semantic patch will be interpreted as a JSON patch. Use this header: ``` Content-Type: application/json; domain-model=launchdarkly.semanticpatch ``` The body of a semantic patch request takes the following three properties: 1. comment `string`: (Optional) A description of the update. 1. environmentKey `string`: (Required) The key of the LaunchDarkly environment. 1. instructions `array`: (Required) The action or list of actions to be performed by the update. Each update action in the list must be an object/hash table with a `kind` property, although depending on the action, other properties may be necessary. Read below for more information on the specific supported semantic patch instructions. If any instruction in the patch encounters an error, the error will be returned and the flag will not be changed. In general, instructions will silently do nothing if the flag is already in the state requested by the patch instruction. For example, `removeUserTargets` does nothing when the targets have already been removed). They will generally error if a parameter refers to something that does not exist, like a variation ID that doesn't correspond to a variation on the flag or a rule ID that doesn't belong to a rule on the flag. Other specific error conditions are noted in the instruction descriptions. ### Instructions #### `turnFlagOn` Sets the flag's targeting state to on. #### `turnFlagOff` Sets the flag's targeting state to off. #### `addUserTargets` Adds the user keys in `values` to the individual user targets for the variation specified by `variationId`. Returns an error if this causes the same user key to be targeted in multiple variations. ##### Parameters - `values`: list of user keys - `variationId`: ID of a variation on the flag #### `removeUserTargets` Removes the user keys in `values` to the individual user targets for the variation specified by `variationId`. Does nothing if the user keys are not targeted. ##### Parameters - `values`: list of user keys - `variationId`: ID of a variation on the flag #### `replaceUserTargets` Completely replaces the existing set of user targeting. All variations must be provided. Example: ```json { \"kind\": \"replaceUserTargets\", \"targets\": [ { \"variationId\": \"variation-1\", \"values\": [\"blah\", \"foo\", \"bar\"] }, { \"variationId\": \"variation-2\", \"values\": [\"abc\", \"def\"] } ] } ``` ##### Parameters - `targets`: a list of user targeting #### `clearUserTargets` Removes all individual user targets from the variation specified by `variationId` ##### Parameters - `variationId`: ID of a variation on the flag #### `addPrerequisite` Adds the flag indicated by `key` with variation `variationId` as a prerequisite to the flag. ##### Parameters - `key`: flag key of another flag - `variationId`: ID of a variation of the flag with key `key` #### `removePrerequisite` Removes the prerequisite indicated by `key`. Does nothing if this prerequisite does not exist. ##### Parameters - `key`: flag key of an existing prerequisite #### `updatePrerequisite` Changes the prerequisite with flag key `key` to the variation indicated by `variationId`. Returns an error if this prerequisite does not exist. ##### Parameters - `key`: flag key of an existing prerequisite - `variationId`: ID of a variation of the flag with key `key` #### `replacePrerequisites` Completely replaces the existing set of prerequisites for a given flag. Example: ```json { \"kind\": \"replacePrerequisites\", \"prerequisites\": [ { \"key\": \"flag-key\", \"variationId\": \"variation-1\" }, { \"key\": \"another-flag\", \"variationId\": \"variation-2\" } ] } ``` ##### Parameters - `prerequisites`: a list of prerequisites #### `addRule` Adds a new rule to the flag with the given `clauses` which serves the variation indicated by `variationId` or the percent rollout indicated by `rolloutWeights` and `rolloutBucketBy`. If `beforeRuleId` is set, the rule will be added in the list of rules before the indicated rule. Otherwise, the rule will be added to the end of the list. ##### Parameters - `clauses`: Array of clauses (see `addClauses`) - `beforeRuleId`: Optional ID of a rule in the flag - `variationId`: ID of a variation of the flag - `rolloutWeights`: Map of variationId to weight in thousandths of a percent (0-100000) - `rolloutBucketBy`: Optional user attribute #### `removeRule` Removes the targeting rule specified by `ruleId`. Does nothing if the rule does not exist. ##### Parameters - `ruleId`: ID of a rule in the flag #### `replaceRules` Completely replaces the existing rules for a given flag. Example: ```json { \"kind\": \"replaceRules\", \"rules\": [ { \"variationId\": \"variation-1\", \"description\": \"myRule\", \"clauses\": [ { \"attribute\": \"segmentMatch\", \"op\": \"segmentMatch\", \"values\": [\"test\"] } ], \"trackEvents\": true } ] } ``` ##### Parameters - `rules`: a list of rules #### `addClauses` Adds the given clauses to the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the flag - `clauses`: Array of clause objects, with `attribute` (string), `op` (string), and `values` (array of strings, numbers, or dates) properties. #### `removeClauses` Removes the clauses specified by `clauseIds` from the rule indicated by `ruleId`. #### Parameters - `ruleId`: ID of a rule in the flag - `clauseIds`: Array of IDs of clauses in the rule #### `updateClause` Replaces the clause indicated by `ruleId` and `clauseId` with `clause`. ##### Parameters - `ruleId`: ID of a rule in the flag - `clauseId`: ID of a clause in that rule - `clause`: Clause object #### `addValuesToClause` Adds `values` to the values of the clause indicated by `ruleId` and `clauseId`. ##### Parameters - `ruleId`: ID of a rule in the flag - `clauseId`: ID of a clause in that rule - `values`: Array of strings #### `removeValuesFromClause` Removes `values` from the values of the clause indicated by `ruleId` and `clauseId`. ##### Parameters `ruleId`: ID of a rule in the flag `clauseId`: ID of a clause in that rule `values`: Array of strings #### `reorderRules` Rearranges the rules to match the order given in `ruleIds`. Will return an error if `ruleIds` does not match the current set of rules on the flag. ##### Parameters - `ruleIds`: Array of IDs of all rules in the flag #### `updateRuleVariationOrRollout` Updates what the rule indicated by `ruleId` serves if its clauses evaluate to true. Can either be a fixed variation indicated by `variationId` or a percent rollout indicated by `rolloutWeights` and `rolloutBucketBy`. ##### Parameters - `ruleId`: ID of a rule in the flag - `variationId`: ID of a variation of the flag or - `rolloutWeights`: Map of variationId to weight in thousandths of a percent (0-100000) - `rolloutBucketBy`: Optional user attribute #### `updateFallthroughVariationOrRollout` Updates the flag's fallthrough, which is served if none of the targeting rules match. Can either be a fixed variation indicated by `variationId` or a percent rollout indicated by `rolloutWeights` and `rolloutBucketBy`. ##### Parameters `variationId`: ID of a variation of the flag or `rolloutWeights`: Map of variationId to weight in thousandths of a percent (0-100000) `rolloutBucketBy`: Optional user attribute #### `updateOffVariation` Updates the variation served when the flag's targeting is off to the variation indicated by `variationId`. ##### Parameters `variationId`: ID of a variation of the flag ### Example ```json { \"environmentKey\": \"production\", \"instructions\": [ { \"kind\": \"turnFlagOn\" }, { \"kind\": \"turnFlagOff\" }, { \"kind\": \"addUserTargets\", \"variationId\": \"8bfb304e-d516-47e5-8727-e7f798e8992d\", \"values\": [\"userId\", \"userId2\"] }, { \"kind\": \"removeUserTargets\", \"variationId\": \"8bfb304e-d516-47e5-8727-e7f798e8992d\", \"values\": [\"userId3\", \"userId4\"] }, { \"kind\": \"updateFallthroughVariationOrRollout\", \"rolloutWeights\": { \"variationId\": 50000, \"variationId2\": 50000 }, \"rolloutBucketBy\": null }, { \"kind\": \"addRule\", \"clauses\": [ { \"attribute\": \"segmentMatch\", \"negate\": false, \"values\": [\"test-segment\"] } ], \"variationId\": null, \"rolloutWeights\": { \"variationId\": 50000, \"variationId2\": 50000 }, \"rolloutBucketBy\": \"key\" }, { \"kind\": \"removeRule\", \"ruleId\": \"99f12464-a429-40fc-86cc-b27612188955\" }, { \"kind\": \"reorderRules\", \"ruleIds\": [\"2f72974e-de68-4243-8dd3-739582147a1f\", \"8bfb304e-d516-47e5-8727-e7f798e8992d\"] }, { \"kind\": \"addClauses\", \"ruleId\": \"1134\", \"clauses\": [ { \"attribute\": \"email\", \"op\": \"in\", \"negate\": false, \"values\": [\"test@test.com\"] } ] }, { \"kind\": \"removeClauses\", \"ruleId\": \"1242529\", \"clauseIds\": [\"8bfb304e-d516-47e5-8727-e7f798e8992d\"] }, { \"kind\": \"updateClause\", \"ruleId\": \"2f72974e-de68-4243-8dd3-739582147a1f\", \"clauseId\": \"309845\", \"clause\": { \"attribute\": \"segmentMatch\", \"negate\": false, \"values\": [\"test-segment\"] } }, { \"kind\": \"updateRuleVariationOrRollout\", \"ruleId\": \"2342\", \"rolloutWeights\": null, \"rolloutBucketBy\": null }, { \"kind\": \"updateOffVariation\", \"variationId\": \"3242453\" }, { \"kind\": \"addPrerequisite\", \"variationId\": \"234235\", \"key\": \"flagKey2\" }, { \"kind\": \"updatePrerequisite\", \"variationId\": \"234235\", \"key\": \"flagKey2\" }, { \"kind\": \"removePrerequisite\", \"key\": \"flagKey\" } ] } ``` ## Using JSON patches on a feature flag If you do not include the header described above, you can use [JSON patch](/#section/Updates/Updates-via-JSON-Patch).
708
+ # Perform a partial update to a feature flag. ## Using JSON Patches on a feature flag When using the update feature flag endpoint to add individual users to a specific variation, there are two different patch documents, depending on whether users are already being individually targeted for the variation. If a flag variation already has users individually targeted, the path for the JSON Patch operation is: ```json { \"op\": \"add\", \"path\": \"/environments/devint/targets/0/values/-\", \"value\": \"TestClient10\" } ``` If a flag variation does not already have users individually targeted, the path for the JSON Patch operation is: ```json [ { \"op\": \"add\", \"path\": \"/environments/devint/targets/-\", \"value\": { \"variation\": 0, \"values\": [\"TestClient10\"] } } ] ``` ## Using semantic patches on a feature flag To use a [semantic patch](/reference#updates-via-semantic-patches) on a feature flag resource, you must include a header in the request. If you call a semantic patch resource without this header, you will receive a `400` response because your semantic patch will be interpreted as a JSON patch. Use this header: ``` Content-Type: application/json; domain-model=launchdarkly.semanticpatch ``` The body of a semantic patch request takes the following three properties: 1. comment `string`: (Optional) A description of the update. 1. environmentKey `string`: (Required) The key of the LaunchDarkly environment. 1. instructions `array`: (Required) The action or list of actions to be performed by the update. Each update action in the list must be an object/hash table with a `kind` property, although depending on the action, other properties may be necessary. Read below for more information on the specific supported semantic patch instructions. If any instruction in the patch encounters an error, the error will be returned and the flag will not be changed. In general, instructions will silently do nothing if the flag is already in the state requested by the patch instruction. For example, `removeUserTargets` does nothing when the targets have already been removed). They will generally error if a parameter refers to something that does not exist, like a variation ID that doesn't correspond to a variation on the flag or a rule ID that doesn't belong to a rule on the flag. Other specific error conditions are noted in the instruction descriptions. ### Instructions #### `turnFlagOn` Sets the flag's targeting state to on. #### `turnFlagOff` Sets the flag's targeting state to off. #### `addUserTargets` Adds the user keys in `values` to the individual user targets for the variation specified by `variationId`. Returns an error if this causes the same user key to be targeted in multiple variations. ##### Parameters - `values`: list of user keys - `variationId`: ID of a variation on the flag #### `removeUserTargets` Removes the user keys in `values` to the individual user targets for the variation specified by `variationId`. Does nothing if the user keys are not targeted. ##### Parameters - `values`: list of user keys - `variationId`: ID of a variation on the flag #### `replaceUserTargets` Completely replaces the existing set of user targeting. All variations must be provided. Example: ```json { \"kind\": \"replaceUserTargets\", \"targets\": [ { \"variationId\": \"variation-1\", \"values\": [\"blah\", \"foo\", \"bar\"] }, { \"variationId\": \"variation-2\", \"values\": [\"abc\", \"def\"] } ] } ``` ##### Parameters - `targets`: a list of user targeting #### `clearUserTargets` Removes all individual user targets from the variation specified by `variationId` ##### Parameters - `variationId`: ID of a variation on the flag #### `addPrerequisite` Adds the flag indicated by `key` with variation `variationId` as a prerequisite to the flag. ##### Parameters - `key`: flag key of another flag - `variationId`: ID of a variation of the flag with key `key` #### `removePrerequisite` Removes the prerequisite indicated by `key`. Does nothing if this prerequisite does not exist. ##### Parameters - `key`: flag key of an existing prerequisite #### `updatePrerequisite` Changes the prerequisite with flag key `key` to the variation indicated by `variationId`. Returns an error if this prerequisite does not exist. ##### Parameters - `key`: flag key of an existing prerequisite - `variationId`: ID of a variation of the flag with key `key` #### `replacePrerequisites` Completely replaces the existing set of prerequisites for a given flag. Example: ```json { \"kind\": \"replacePrerequisites\", \"prerequisites\": [ { \"key\": \"flag-key\", \"variationId\": \"variation-1\" }, { \"key\": \"another-flag\", \"variationId\": \"variation-2\" } ] } ``` ##### Parameters - `prerequisites`: a list of prerequisites #### `addRule` Adds a new rule to the flag with the given `clauses` which serves the variation indicated by `variationId` or the percent rollout indicated by `rolloutWeights` and `rolloutBucketBy`. If `beforeRuleId` is set, the rule will be added in the list of rules before the indicated rule. Otherwise, the rule will be added to the end of the list. ##### Parameters - `clauses`: Array of clauses (see `addClauses`) - `beforeRuleId`: Optional ID of a rule in the flag - `variationId`: ID of a variation of the flag - `rolloutWeights`: Map of variationId to weight in thousandths of a percent (0-100000) - `rolloutBucketBy`: Optional user attribute #### `removeRule` Removes the targeting rule specified by `ruleId`. Does nothing if the rule does not exist. ##### Parameters - `ruleId`: ID of a rule in the flag #### `replaceRules` Completely replaces the existing rules for a given flag. Example: ```json { \"kind\": \"replaceRules\", \"rules\": [ { \"variationId\": \"variation-1\", \"description\": \"myRule\", \"clauses\": [ { \"attribute\": \"segmentMatch\", \"op\": \"segmentMatch\", \"values\": [\"test\"] } ], \"trackEvents\": true } ] } ``` ##### Parameters - `rules`: a list of rules #### `addClauses` Adds the given clauses to the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the flag - `clauses`: Array of clause objects, with `attribute` (string), `op` (string), and `values` (array of strings, numbers, or dates) properties. #### `removeClauses` Removes the clauses specified by `clauseIds` from the rule indicated by `ruleId`. #### Parameters - `ruleId`: ID of a rule in the flag - `clauseIds`: Array of IDs of clauses in the rule #### `updateClause` Replaces the clause indicated by `ruleId` and `clauseId` with `clause`. ##### Parameters - `ruleId`: ID of a rule in the flag - `clauseId`: ID of a clause in that rule - `clause`: Clause object #### `addValuesToClause` Adds `values` to the values of the clause indicated by `ruleId` and `clauseId`. ##### Parameters - `ruleId`: ID of a rule in the flag - `clauseId`: ID of a clause in that rule - `values`: Array of strings #### `removeValuesFromClause` Removes `values` from the values of the clause indicated by `ruleId` and `clauseId`. ##### Parameters `ruleId`: ID of a rule in the flag `clauseId`: ID of a clause in that rule `values`: Array of strings #### `reorderRules` Rearranges the rules to match the order given in `ruleIds`. Will return an error if `ruleIds` does not match the current set of rules on the flag. ##### Parameters - `ruleIds`: Array of IDs of all rules in the flag #### `updateRuleVariationOrRollout` Updates what the rule indicated by `ruleId` serves if its clauses evaluate to true. Can either be a fixed variation indicated by `variationId` or a percent rollout indicated by `rolloutWeights` and `rolloutBucketBy`. ##### Parameters - `ruleId`: ID of a rule in the flag - `variationId`: ID of a variation of the flag or - `rolloutWeights`: Map of variationId to weight in thousandths of a percent (0-100000) - `rolloutBucketBy`: Optional user attribute #### `updateFallthroughVariationOrRollout` Updates the flag's fallthrough, which is served if none of the targeting rules match. Can either be a fixed variation indicated by `variationId` or a percent rollout indicated by `rolloutWeights` and `rolloutBucketBy`. ##### Parameters `variationId`: ID of a variation of the flag or `rolloutWeights`: Map of variationId to weight in thousandths of a percent (0-100000) `rolloutBucketBy`: Optional user attribute #### `updateOffVariation` Updates the variation served when the flag's targeting is off to the variation indicated by `variationId`. ##### Parameters `variationId`: ID of a variation of the flag ### Example ```json { \"environmentKey\": \"production\", \"instructions\": [ { \"kind\": \"turnFlagOn\" }, { \"kind\": \"turnFlagOff\" }, { \"kind\": \"addUserTargets\", \"variationId\": \"8bfb304e-d516-47e5-8727-e7f798e8992d\", \"values\": [\"userId\", \"userId2\"] }, { \"kind\": \"removeUserTargets\", \"variationId\": \"8bfb304e-d516-47e5-8727-e7f798e8992d\", \"values\": [\"userId3\", \"userId4\"] }, { \"kind\": \"updateFallthroughVariationOrRollout\", \"rolloutWeights\": { \"variationId\": 50000, \"variationId2\": 50000 }, \"rolloutBucketBy\": null }, { \"kind\": \"addRule\", \"clauses\": [ { \"attribute\": \"segmentMatch\", \"negate\": false, \"values\": [\"test-segment\"] } ], \"variationId\": null, \"rolloutWeights\": { \"variationId\": 50000, \"variationId2\": 50000 }, \"rolloutBucketBy\": \"key\" }, { \"kind\": \"removeRule\", \"ruleId\": \"99f12464-a429-40fc-86cc-b27612188955\" }, { \"kind\": \"reorderRules\", \"ruleIds\": [\"2f72974e-de68-4243-8dd3-739582147a1f\", \"8bfb304e-d516-47e5-8727-e7f798e8992d\"] }, { \"kind\": \"addClauses\", \"ruleId\": \"1134\", \"clauses\": [ { \"attribute\": \"email\", \"op\": \"in\", \"negate\": false, \"values\": [\"test@test.com\"] } ] }, { \"kind\": \"removeClauses\", \"ruleId\": \"1242529\", \"clauseIds\": [\"8bfb304e-d516-47e5-8727-e7f798e8992d\"] }, { \"kind\": \"updateClause\", \"ruleId\": \"2f72974e-de68-4243-8dd3-739582147a1f\", \"clauseId\": \"309845\", \"clause\": { \"attribute\": \"segmentMatch\", \"negate\": false, \"values\": [\"test-segment\"] } }, { \"kind\": \"updateRuleVariationOrRollout\", \"ruleId\": \"2342\", \"rolloutWeights\": null, \"rolloutBucketBy\": null }, { \"kind\": \"updateOffVariation\", \"variationId\": \"3242453\" }, { \"kind\": \"addPrerequisite\", \"variationId\": \"234235\", \"key\": \"flagKey2\" }, { \"kind\": \"updatePrerequisite\", \"variationId\": \"234235\", \"key\": \"flagKey2\" }, { \"kind\": \"removePrerequisite\", \"key\": \"flagKey\" } ] } ``` ## Using JSON patches on a feature flag If you do not include the header described above, you can use [JSON patch](/reference#updates-via-json-patch).
712
709
  # @param proj_key [String] The project key.
713
710
  # @param key [String] The feature flag&#39;s key. The key identifies the flag in your code.
714
711
  # @param patch_with_comment [PatchWithComment]
@@ -720,7 +717,7 @@ module LaunchDarklyApi
720
717
  end
721
718
 
722
719
  # Update feature flag
723
- # Perform a partial update to a feature flag. ## Using JSON Patches on a feature flag When using the update feature flag endpoint to add individual users to a specific variation, there are two different patch documents, depending on whether users are already being individually targeted for the variation. If a flag variation already has users individually targeted, the path for the JSON Patch operation is: &#x60;&#x60;&#x60;json { \&quot;op\&quot;: \&quot;add\&quot;, \&quot;path\&quot;: \&quot;/environments/devint/targets/0/values/-\&quot;, \&quot;value\&quot;: \&quot;TestClient10\&quot; } &#x60;&#x60;&#x60; If a flag variation does not already have users individually targeted, the path for the JSON Patch operation is: &#x60;&#x60;&#x60;json [ { \&quot;op\&quot;: \&quot;add\&quot;, \&quot;path\&quot;: \&quot;/environments/devint/targets/-\&quot;, \&quot;value\&quot;: { \&quot;variation\&quot;: 0, \&quot;values\&quot;: [\&quot;TestClient10\&quot;] } } ] &#x60;&#x60;&#x60; ## Using semantic patches on a feature flag To use a [semantic patch](/#section/Updates/Updates-via-semantic-patches) on a feature flag resource, you must include a header in the request. If you call a semantic patch resource without this header, you receive a &#x60;400&#x60; response as your semantic patch will be interpreted as a JSON patch. Use this header: &#x60;&#x60;&#x60; Content-Type: application/json; domain-model&#x3D;launchdarkly.semanticpatch &#x60;&#x60;&#x60; The body of a semantic patch request takes the following three properties: 1. comment &#x60;string&#x60;: (Optional) A description of the update. 1. environmentKey &#x60;string&#x60;: (Required) The key of the LaunchDarkly environment. 1. instructions &#x60;array&#x60;: (Required) The action or list of actions to be performed by the update. Each update action in the list must be an object/hash table with a &#x60;kind&#x60; property, although depending on the action, other properties may be necessary. Read below for more information on the specific supported semantic patch instructions. If any instruction in the patch encounters an error, the error will be returned and the flag will not be changed. In general, instructions will silently do nothing if the flag is already in the state requested by the patch instruction. For example, &#x60;removeUserTargets&#x60; does nothing when the targets have already been removed). They will generally error if a parameter refers to something that does not exist, like a variation ID that doesn&#39;t correspond to a variation on the flag or a rule ID that doesn&#39;t belong to a rule on the flag. Other specific error conditions are noted in the instruction descriptions. ### Instructions #### &#x60;turnFlagOn&#x60; Sets the flag&#39;s targeting state to on. #### &#x60;turnFlagOff&#x60; Sets the flag&#39;s targeting state to off. #### &#x60;addUserTargets&#x60; Adds the user keys in &#x60;values&#x60; to the individual user targets for the variation specified by &#x60;variationId&#x60;. Returns an error if this causes the same user key to be targeted in multiple variations. ##### Parameters - &#x60;values&#x60;: list of user keys - &#x60;variationId&#x60;: ID of a variation on the flag #### &#x60;removeUserTargets&#x60; Removes the user keys in &#x60;values&#x60; to the individual user targets for the variation specified by &#x60;variationId&#x60;. Does nothing if the user keys are not targeted. ##### Parameters - &#x60;values&#x60;: list of user keys - &#x60;variationId&#x60;: ID of a variation on the flag #### &#x60;replaceUserTargets&#x60; Completely replaces the existing set of user targeting. All variations must be provided. Example: &#x60;&#x60;&#x60;json { \&quot;kind\&quot;: \&quot;replaceUserTargets\&quot;, \&quot;targets\&quot;: [ { \&quot;variationId\&quot;: \&quot;variation-1\&quot;, \&quot;values\&quot;: [\&quot;blah\&quot;, \&quot;foo\&quot;, \&quot;bar\&quot;] }, { \&quot;variationId\&quot;: \&quot;variation-2\&quot;, \&quot;values\&quot;: [\&quot;abc\&quot;, \&quot;def\&quot;] } ] } &#x60;&#x60;&#x60; ##### Parameters - &#x60;targets&#x60;: a list of user targeting #### &#x60;clearUserTargets&#x60; Removes all individual user targets from the variation specified by &#x60;variationId&#x60; ##### Parameters - &#x60;variationId&#x60;: ID of a variation on the flag #### &#x60;addPrerequisite&#x60; Adds the flag indicated by &#x60;key&#x60; with variation &#x60;variationId&#x60; as a prerequisite to the flag. ##### Parameters - &#x60;key&#x60;: flag key of another flag - &#x60;variationId&#x60;: ID of a variation of the flag with key &#x60;key&#x60; #### &#x60;removePrerequisite&#x60; Removes the prerequisite indicated by &#x60;key&#x60;. Does nothing if this prerequisite does not exist. ##### Parameters - &#x60;key&#x60;: flag key of an existing prerequisite #### &#x60;updatePrerequisite&#x60; Changes the prerequisite with flag key &#x60;key&#x60; to the variation indicated by &#x60;variationId&#x60;. Returns an error if this prerequisite does not exist. ##### Parameters - &#x60;key&#x60;: flag key of an existing prerequisite - &#x60;variationId&#x60;: ID of a variation of the flag with key &#x60;key&#x60; #### &#x60;replacePrerequisites&#x60; Completely replaces the existing set of prerequisites for a given flag. Example: &#x60;&#x60;&#x60;json { \&quot;kind\&quot;: \&quot;replacePrerequisites\&quot;, \&quot;prerequisites\&quot;: [ { \&quot;key\&quot;: \&quot;flag-key\&quot;, \&quot;variationId\&quot;: \&quot;variation-1\&quot; }, { \&quot;key\&quot;: \&quot;another-flag\&quot;, \&quot;variationId\&quot;: \&quot;variation-2\&quot; } ] } &#x60;&#x60;&#x60; ##### Parameters - &#x60;prerequisites&#x60;: a list of prerequisites #### &#x60;addRule&#x60; Adds a new rule to the flag with the given &#x60;clauses&#x60; which serves the variation indicated by &#x60;variationId&#x60; or the percent rollout indicated by &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60;. If &#x60;beforeRuleId&#x60; is set, the rule will be added in the list of rules before the indicated rule. Otherwise, the rule will be added to the end of the list. ##### Parameters - &#x60;clauses&#x60;: Array of clauses (see &#x60;addClauses&#x60;) - &#x60;beforeRuleId&#x60;: Optional ID of a rule in the flag - &#x60;variationId&#x60;: ID of a variation of the flag - &#x60;rolloutWeights&#x60;: Map of variationId to weight in thousandths of a percent (0-100000) - &#x60;rolloutBucketBy&#x60;: Optional user attribute #### &#x60;removeRule&#x60; Removes the targeting rule specified by &#x60;ruleId&#x60;. Does nothing if the rule does not exist. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag #### &#x60;replaceRules&#x60; Completely replaces the existing rules for a given flag. Example: &#x60;&#x60;&#x60;json { \&quot;kind\&quot;: \&quot;replaceRules\&quot;, \&quot;rules\&quot;: [ { \&quot;variationId\&quot;: \&quot;variation-1\&quot;, \&quot;description\&quot;: \&quot;myRule\&quot;, \&quot;clauses\&quot;: [ { \&quot;attribute\&quot;: \&quot;segmentMatch\&quot;, \&quot;op\&quot;: \&quot;segmentMatch\&quot;, \&quot;values\&quot;: [\&quot;test\&quot;] } ], \&quot;trackEvents\&quot;: true } ] } &#x60;&#x60;&#x60; ##### Parameters - &#x60;rules&#x60;: a list of rules #### &#x60;addClauses&#x60; Adds the given clauses to the rule indicated by &#x60;ruleId&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauses&#x60;: Array of clause objects, with &#x60;attribute&#x60; (string), &#x60;op&#x60; (string), and &#x60;values&#x60; (array of strings, numbers, or dates) properties. #### &#x60;removeClauses&#x60; Removes the clauses specified by &#x60;clauseIds&#x60; from the rule indicated by &#x60;ruleId&#x60;. #### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauseIds&#x60;: Array of IDs of clauses in the rule #### &#x60;updateClause&#x60; Replaces the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60; with &#x60;clause&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauseId&#x60;: ID of a clause in that rule - &#x60;clause&#x60;: Clause object #### &#x60;addValuesToClause&#x60; Adds &#x60;values&#x60; to the values of the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauseId&#x60;: ID of a clause in that rule - &#x60;values&#x60;: Array of strings #### &#x60;removeValuesFromClause&#x60; Removes &#x60;values&#x60; from the values of the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60;. ##### Parameters &#x60;ruleId&#x60;: ID of a rule in the flag &#x60;clauseId&#x60;: ID of a clause in that rule &#x60;values&#x60;: Array of strings #### &#x60;reorderRules&#x60; Rearranges the rules to match the order given in &#x60;ruleIds&#x60;. Will return an error if &#x60;ruleIds&#x60; does not match the current set of rules on the flag. ##### Parameters - &#x60;ruleIds&#x60;: Array of IDs of all rules in the flag #### &#x60;updateRuleVariationOrRollout&#x60; Updates what the rule indicated by &#x60;ruleId&#x60; serves if its clauses evaluate to true. Can either be a fixed variation indicated by &#x60;variationId&#x60; or a percent rollout indicated by &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;variationId&#x60;: ID of a variation of the flag or - &#x60;rolloutWeights&#x60;: Map of variationId to weight in thousandths of a percent (0-100000) - &#x60;rolloutBucketBy&#x60;: Optional user attribute #### &#x60;updateFallthroughVariationOrRollout&#x60; Updates the flag&#39;s fallthrough, which is served if none of the targeting rules match. Can either be a fixed variation indicated by &#x60;variationId&#x60; or a percent rollout indicated by &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60;. ##### Parameters &#x60;variationId&#x60;: ID of a variation of the flag or &#x60;rolloutWeights&#x60;: Map of variationId to weight in thousandths of a percent (0-100000) &#x60;rolloutBucketBy&#x60;: Optional user attribute #### &#x60;updateOffVariation&#x60; Updates the variation served when the flag&#39;s targeting is off to the variation indicated by &#x60;variationId&#x60;. ##### Parameters &#x60;variationId&#x60;: ID of a variation of the flag ### Example &#x60;&#x60;&#x60;json { \&quot;environmentKey\&quot;: \&quot;production\&quot;, \&quot;instructions\&quot;: [ { \&quot;kind\&quot;: \&quot;turnFlagOn\&quot; }, { \&quot;kind\&quot;: \&quot;turnFlagOff\&quot; }, { \&quot;kind\&quot;: \&quot;addUserTargets\&quot;, \&quot;variationId\&quot;: \&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;, \&quot;values\&quot;: [\&quot;userId\&quot;, \&quot;userId2\&quot;] }, { \&quot;kind\&quot;: \&quot;removeUserTargets\&quot;, \&quot;variationId\&quot;: \&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;, \&quot;values\&quot;: [\&quot;userId3\&quot;, \&quot;userId4\&quot;] }, { \&quot;kind\&quot;: \&quot;updateFallthroughVariationOrRollout\&quot;, \&quot;rolloutWeights\&quot;: { \&quot;variationId\&quot;: 50000, \&quot;variationId2\&quot;: 50000 }, \&quot;rolloutBucketBy\&quot;: null }, { \&quot;kind\&quot;: \&quot;addRule\&quot;, \&quot;clauses\&quot;: [ { \&quot;attribute\&quot;: \&quot;segmentMatch\&quot;, \&quot;negate\&quot;: false, \&quot;values\&quot;: [\&quot;test-segment\&quot;] } ], \&quot;variationId\&quot;: null, \&quot;rolloutWeights\&quot;: { \&quot;variationId\&quot;: 50000, \&quot;variationId2\&quot;: 50000 }, \&quot;rolloutBucketBy\&quot;: \&quot;key\&quot; }, { \&quot;kind\&quot;: \&quot;removeRule\&quot;, \&quot;ruleId\&quot;: \&quot;99f12464-a429-40fc-86cc-b27612188955\&quot; }, { \&quot;kind\&quot;: \&quot;reorderRules\&quot;, \&quot;ruleIds\&quot;: [\&quot;2f72974e-de68-4243-8dd3-739582147a1f\&quot;, \&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;] }, { \&quot;kind\&quot;: \&quot;addClauses\&quot;, \&quot;ruleId\&quot;: \&quot;1134\&quot;, \&quot;clauses\&quot;: [ { \&quot;attribute\&quot;: \&quot;email\&quot;, \&quot;op\&quot;: \&quot;in\&quot;, \&quot;negate\&quot;: false, \&quot;values\&quot;: [\&quot;test@test.com\&quot;] } ] }, { \&quot;kind\&quot;: \&quot;removeClauses\&quot;, \&quot;ruleId\&quot;: \&quot;1242529\&quot;, \&quot;clauseIds\&quot;: [\&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;] }, { \&quot;kind\&quot;: \&quot;updateClause\&quot;, \&quot;ruleId\&quot;: \&quot;2f72974e-de68-4243-8dd3-739582147a1f\&quot;, \&quot;clauseId\&quot;: \&quot;309845\&quot;, \&quot;clause\&quot;: { \&quot;attribute\&quot;: \&quot;segmentMatch\&quot;, \&quot;negate\&quot;: false, \&quot;values\&quot;: [\&quot;test-segment\&quot;] } }, { \&quot;kind\&quot;: \&quot;updateRuleVariationOrRollout\&quot;, \&quot;ruleId\&quot;: \&quot;2342\&quot;, \&quot;rolloutWeights\&quot;: null, \&quot;rolloutBucketBy\&quot;: null }, { \&quot;kind\&quot;: \&quot;updateOffVariation\&quot;, \&quot;variationId\&quot;: \&quot;3242453\&quot; }, { \&quot;kind\&quot;: \&quot;addPrerequisite\&quot;, \&quot;variationId\&quot;: \&quot;234235\&quot;, \&quot;key\&quot;: \&quot;flagKey2\&quot; }, { \&quot;kind\&quot;: \&quot;updatePrerequisite\&quot;, \&quot;variationId\&quot;: \&quot;234235\&quot;, \&quot;key\&quot;: \&quot;flagKey2\&quot; }, { \&quot;kind\&quot;: \&quot;removePrerequisite\&quot;, \&quot;key\&quot;: \&quot;flagKey\&quot; } ] } &#x60;&#x60;&#x60; ## Using JSON patches on a feature flag If you do not include the header described above, you can use [JSON patch](/#section/Updates/Updates-via-JSON-Patch).
720
+ # Perform a partial update to a feature flag. ## Using JSON Patches on a feature flag When using the update feature flag endpoint to add individual users to a specific variation, there are two different patch documents, depending on whether users are already being individually targeted for the variation. If a flag variation already has users individually targeted, the path for the JSON Patch operation is: &#x60;&#x60;&#x60;json { \&quot;op\&quot;: \&quot;add\&quot;, \&quot;path\&quot;: \&quot;/environments/devint/targets/0/values/-\&quot;, \&quot;value\&quot;: \&quot;TestClient10\&quot; } &#x60;&#x60;&#x60; If a flag variation does not already have users individually targeted, the path for the JSON Patch operation is: &#x60;&#x60;&#x60;json [ { \&quot;op\&quot;: \&quot;add\&quot;, \&quot;path\&quot;: \&quot;/environments/devint/targets/-\&quot;, \&quot;value\&quot;: { \&quot;variation\&quot;: 0, \&quot;values\&quot;: [\&quot;TestClient10\&quot;] } } ] &#x60;&#x60;&#x60; ## Using semantic patches on a feature flag To use a [semantic patch](/reference#updates-via-semantic-patches) on a feature flag resource, you must include a header in the request. If you call a semantic patch resource without this header, you will receive a &#x60;400&#x60; response because your semantic patch will be interpreted as a JSON patch. Use this header: &#x60;&#x60;&#x60; Content-Type: application/json; domain-model&#x3D;launchdarkly.semanticpatch &#x60;&#x60;&#x60; The body of a semantic patch request takes the following three properties: 1. comment &#x60;string&#x60;: (Optional) A description of the update. 1. environmentKey &#x60;string&#x60;: (Required) The key of the LaunchDarkly environment. 1. instructions &#x60;array&#x60;: (Required) The action or list of actions to be performed by the update. Each update action in the list must be an object/hash table with a &#x60;kind&#x60; property, although depending on the action, other properties may be necessary. Read below for more information on the specific supported semantic patch instructions. If any instruction in the patch encounters an error, the error will be returned and the flag will not be changed. In general, instructions will silently do nothing if the flag is already in the state requested by the patch instruction. For example, &#x60;removeUserTargets&#x60; does nothing when the targets have already been removed). They will generally error if a parameter refers to something that does not exist, like a variation ID that doesn&#39;t correspond to a variation on the flag or a rule ID that doesn&#39;t belong to a rule on the flag. Other specific error conditions are noted in the instruction descriptions. ### Instructions #### &#x60;turnFlagOn&#x60; Sets the flag&#39;s targeting state to on. #### &#x60;turnFlagOff&#x60; Sets the flag&#39;s targeting state to off. #### &#x60;addUserTargets&#x60; Adds the user keys in &#x60;values&#x60; to the individual user targets for the variation specified by &#x60;variationId&#x60;. Returns an error if this causes the same user key to be targeted in multiple variations. ##### Parameters - &#x60;values&#x60;: list of user keys - &#x60;variationId&#x60;: ID of a variation on the flag #### &#x60;removeUserTargets&#x60; Removes the user keys in &#x60;values&#x60; to the individual user targets for the variation specified by &#x60;variationId&#x60;. Does nothing if the user keys are not targeted. ##### Parameters - &#x60;values&#x60;: list of user keys - &#x60;variationId&#x60;: ID of a variation on the flag #### &#x60;replaceUserTargets&#x60; Completely replaces the existing set of user targeting. All variations must be provided. Example: &#x60;&#x60;&#x60;json { \&quot;kind\&quot;: \&quot;replaceUserTargets\&quot;, \&quot;targets\&quot;: [ { \&quot;variationId\&quot;: \&quot;variation-1\&quot;, \&quot;values\&quot;: [\&quot;blah\&quot;, \&quot;foo\&quot;, \&quot;bar\&quot;] }, { \&quot;variationId\&quot;: \&quot;variation-2\&quot;, \&quot;values\&quot;: [\&quot;abc\&quot;, \&quot;def\&quot;] } ] } &#x60;&#x60;&#x60; ##### Parameters - &#x60;targets&#x60;: a list of user targeting #### &#x60;clearUserTargets&#x60; Removes all individual user targets from the variation specified by &#x60;variationId&#x60; ##### Parameters - &#x60;variationId&#x60;: ID of a variation on the flag #### &#x60;addPrerequisite&#x60; Adds the flag indicated by &#x60;key&#x60; with variation &#x60;variationId&#x60; as a prerequisite to the flag. ##### Parameters - &#x60;key&#x60;: flag key of another flag - &#x60;variationId&#x60;: ID of a variation of the flag with key &#x60;key&#x60; #### &#x60;removePrerequisite&#x60; Removes the prerequisite indicated by &#x60;key&#x60;. Does nothing if this prerequisite does not exist. ##### Parameters - &#x60;key&#x60;: flag key of an existing prerequisite #### &#x60;updatePrerequisite&#x60; Changes the prerequisite with flag key &#x60;key&#x60; to the variation indicated by &#x60;variationId&#x60;. Returns an error if this prerequisite does not exist. ##### Parameters - &#x60;key&#x60;: flag key of an existing prerequisite - &#x60;variationId&#x60;: ID of a variation of the flag with key &#x60;key&#x60; #### &#x60;replacePrerequisites&#x60; Completely replaces the existing set of prerequisites for a given flag. Example: &#x60;&#x60;&#x60;json { \&quot;kind\&quot;: \&quot;replacePrerequisites\&quot;, \&quot;prerequisites\&quot;: [ { \&quot;key\&quot;: \&quot;flag-key\&quot;, \&quot;variationId\&quot;: \&quot;variation-1\&quot; }, { \&quot;key\&quot;: \&quot;another-flag\&quot;, \&quot;variationId\&quot;: \&quot;variation-2\&quot; } ] } &#x60;&#x60;&#x60; ##### Parameters - &#x60;prerequisites&#x60;: a list of prerequisites #### &#x60;addRule&#x60; Adds a new rule to the flag with the given &#x60;clauses&#x60; which serves the variation indicated by &#x60;variationId&#x60; or the percent rollout indicated by &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60;. If &#x60;beforeRuleId&#x60; is set, the rule will be added in the list of rules before the indicated rule. Otherwise, the rule will be added to the end of the list. ##### Parameters - &#x60;clauses&#x60;: Array of clauses (see &#x60;addClauses&#x60;) - &#x60;beforeRuleId&#x60;: Optional ID of a rule in the flag - &#x60;variationId&#x60;: ID of a variation of the flag - &#x60;rolloutWeights&#x60;: Map of variationId to weight in thousandths of a percent (0-100000) - &#x60;rolloutBucketBy&#x60;: Optional user attribute #### &#x60;removeRule&#x60; Removes the targeting rule specified by &#x60;ruleId&#x60;. Does nothing if the rule does not exist. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag #### &#x60;replaceRules&#x60; Completely replaces the existing rules for a given flag. Example: &#x60;&#x60;&#x60;json { \&quot;kind\&quot;: \&quot;replaceRules\&quot;, \&quot;rules\&quot;: [ { \&quot;variationId\&quot;: \&quot;variation-1\&quot;, \&quot;description\&quot;: \&quot;myRule\&quot;, \&quot;clauses\&quot;: [ { \&quot;attribute\&quot;: \&quot;segmentMatch\&quot;, \&quot;op\&quot;: \&quot;segmentMatch\&quot;, \&quot;values\&quot;: [\&quot;test\&quot;] } ], \&quot;trackEvents\&quot;: true } ] } &#x60;&#x60;&#x60; ##### Parameters - &#x60;rules&#x60;: a list of rules #### &#x60;addClauses&#x60; Adds the given clauses to the rule indicated by &#x60;ruleId&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauses&#x60;: Array of clause objects, with &#x60;attribute&#x60; (string), &#x60;op&#x60; (string), and &#x60;values&#x60; (array of strings, numbers, or dates) properties. #### &#x60;removeClauses&#x60; Removes the clauses specified by &#x60;clauseIds&#x60; from the rule indicated by &#x60;ruleId&#x60;. #### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauseIds&#x60;: Array of IDs of clauses in the rule #### &#x60;updateClause&#x60; Replaces the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60; with &#x60;clause&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauseId&#x60;: ID of a clause in that rule - &#x60;clause&#x60;: Clause object #### &#x60;addValuesToClause&#x60; Adds &#x60;values&#x60; to the values of the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauseId&#x60;: ID of a clause in that rule - &#x60;values&#x60;: Array of strings #### &#x60;removeValuesFromClause&#x60; Removes &#x60;values&#x60; from the values of the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60;. ##### Parameters &#x60;ruleId&#x60;: ID of a rule in the flag &#x60;clauseId&#x60;: ID of a clause in that rule &#x60;values&#x60;: Array of strings #### &#x60;reorderRules&#x60; Rearranges the rules to match the order given in &#x60;ruleIds&#x60;. Will return an error if &#x60;ruleIds&#x60; does not match the current set of rules on the flag. ##### Parameters - &#x60;ruleIds&#x60;: Array of IDs of all rules in the flag #### &#x60;updateRuleVariationOrRollout&#x60; Updates what the rule indicated by &#x60;ruleId&#x60; serves if its clauses evaluate to true. Can either be a fixed variation indicated by &#x60;variationId&#x60; or a percent rollout indicated by &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;variationId&#x60;: ID of a variation of the flag or - &#x60;rolloutWeights&#x60;: Map of variationId to weight in thousandths of a percent (0-100000) - &#x60;rolloutBucketBy&#x60;: Optional user attribute #### &#x60;updateFallthroughVariationOrRollout&#x60; Updates the flag&#39;s fallthrough, which is served if none of the targeting rules match. Can either be a fixed variation indicated by &#x60;variationId&#x60; or a percent rollout indicated by &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60;. ##### Parameters &#x60;variationId&#x60;: ID of a variation of the flag or &#x60;rolloutWeights&#x60;: Map of variationId to weight in thousandths of a percent (0-100000) &#x60;rolloutBucketBy&#x60;: Optional user attribute #### &#x60;updateOffVariation&#x60; Updates the variation served when the flag&#39;s targeting is off to the variation indicated by &#x60;variationId&#x60;. ##### Parameters &#x60;variationId&#x60;: ID of a variation of the flag ### Example &#x60;&#x60;&#x60;json { \&quot;environmentKey\&quot;: \&quot;production\&quot;, \&quot;instructions\&quot;: [ { \&quot;kind\&quot;: \&quot;turnFlagOn\&quot; }, { \&quot;kind\&quot;: \&quot;turnFlagOff\&quot; }, { \&quot;kind\&quot;: \&quot;addUserTargets\&quot;, \&quot;variationId\&quot;: \&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;, \&quot;values\&quot;: [\&quot;userId\&quot;, \&quot;userId2\&quot;] }, { \&quot;kind\&quot;: \&quot;removeUserTargets\&quot;, \&quot;variationId\&quot;: \&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;, \&quot;values\&quot;: [\&quot;userId3\&quot;, \&quot;userId4\&quot;] }, { \&quot;kind\&quot;: \&quot;updateFallthroughVariationOrRollout\&quot;, \&quot;rolloutWeights\&quot;: { \&quot;variationId\&quot;: 50000, \&quot;variationId2\&quot;: 50000 }, \&quot;rolloutBucketBy\&quot;: null }, { \&quot;kind\&quot;: \&quot;addRule\&quot;, \&quot;clauses\&quot;: [ { \&quot;attribute\&quot;: \&quot;segmentMatch\&quot;, \&quot;negate\&quot;: false, \&quot;values\&quot;: [\&quot;test-segment\&quot;] } ], \&quot;variationId\&quot;: null, \&quot;rolloutWeights\&quot;: { \&quot;variationId\&quot;: 50000, \&quot;variationId2\&quot;: 50000 }, \&quot;rolloutBucketBy\&quot;: \&quot;key\&quot; }, { \&quot;kind\&quot;: \&quot;removeRule\&quot;, \&quot;ruleId\&quot;: \&quot;99f12464-a429-40fc-86cc-b27612188955\&quot; }, { \&quot;kind\&quot;: \&quot;reorderRules\&quot;, \&quot;ruleIds\&quot;: [\&quot;2f72974e-de68-4243-8dd3-739582147a1f\&quot;, \&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;] }, { \&quot;kind\&quot;: \&quot;addClauses\&quot;, \&quot;ruleId\&quot;: \&quot;1134\&quot;, \&quot;clauses\&quot;: [ { \&quot;attribute\&quot;: \&quot;email\&quot;, \&quot;op\&quot;: \&quot;in\&quot;, \&quot;negate\&quot;: false, \&quot;values\&quot;: [\&quot;test@test.com\&quot;] } ] }, { \&quot;kind\&quot;: \&quot;removeClauses\&quot;, \&quot;ruleId\&quot;: \&quot;1242529\&quot;, \&quot;clauseIds\&quot;: [\&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;] }, { \&quot;kind\&quot;: \&quot;updateClause\&quot;, \&quot;ruleId\&quot;: \&quot;2f72974e-de68-4243-8dd3-739582147a1f\&quot;, \&quot;clauseId\&quot;: \&quot;309845\&quot;, \&quot;clause\&quot;: { \&quot;attribute\&quot;: \&quot;segmentMatch\&quot;, \&quot;negate\&quot;: false, \&quot;values\&quot;: [\&quot;test-segment\&quot;] } }, { \&quot;kind\&quot;: \&quot;updateRuleVariationOrRollout\&quot;, \&quot;ruleId\&quot;: \&quot;2342\&quot;, \&quot;rolloutWeights\&quot;: null, \&quot;rolloutBucketBy\&quot;: null }, { \&quot;kind\&quot;: \&quot;updateOffVariation\&quot;, \&quot;variationId\&quot;: \&quot;3242453\&quot; }, { \&quot;kind\&quot;: \&quot;addPrerequisite\&quot;, \&quot;variationId\&quot;: \&quot;234235\&quot;, \&quot;key\&quot;: \&quot;flagKey2\&quot; }, { \&quot;kind\&quot;: \&quot;updatePrerequisite\&quot;, \&quot;variationId\&quot;: \&quot;234235\&quot;, \&quot;key\&quot;: \&quot;flagKey2\&quot; }, { \&quot;kind\&quot;: \&quot;removePrerequisite\&quot;, \&quot;key\&quot;: \&quot;flagKey\&quot; } ] } &#x60;&#x60;&#x60; ## Using JSON patches on a feature flag If you do not include the header described above, you can use [JSON patch](/reference#updates-via-json-patch).
724
721
  # @param proj_key [String] The project key.
725
722
  # @param key [String] The feature flag&#39;s key. The key identifies the flag in your code.
726
723
  # @param patch_with_comment [PatchWithComment]