Class: Shipeasy::Admin::Generated::FlagsApi
- Inherits:
-
Object
- Object
- Shipeasy::Admin::Generated::FlagsApi
- Defined in:
- lib/shipeasy_admin/api/flags_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_gate(create_gate_request, opts = {}) ⇒ CreateGateResponse
Create a feature gate Creates a new gate.
-
#create_gate_with_http_info(create_gate_request, opts = {}) ⇒ Array<(CreateGateResponse, Integer, Hash)>
Create a feature gate Creates a new gate.
-
#delete_gate(id, opts = {}) ⇒ DeleteGateResponse
Delete a feature gate Soft-deletes the gate.
-
#delete_gate_with_http_info(id, opts = {}) ⇒ Array<(DeleteGateResponse, Integer, Hash)>
Delete a feature gate Soft-deletes the gate.
-
#disable_gate(id, opts = {}) ⇒ DisableGateResponse
Disable a gate Sets
enabled: falseso the gate evaluates tofalsefor every caller, regardless ofrollout_pctorrules. -
#disable_gate_with_http_info(id, opts = {}) ⇒ Array<(DisableGateResponse, Integer, Hash)>
Disable a gate Sets `enabled: false` so the gate evaluates to `false` for every caller, regardless of `rollout_pct` or `rules`.
-
#enable_gate(id, opts = {}) ⇒ EnableGateResponse
Enable a gate Sets
enabled: true. -
#enable_gate_with_http_info(id, opts = {}) ⇒ Array<(EnableGateResponse, Integer, Hash)>
Enable a gate Sets `enabled: true`.
-
#initialize(api_client = ApiClient.default) ⇒ FlagsApi
constructor
A new instance of FlagsApi.
-
#list_gates(opts = {}) ⇒ ListGatesResponse
List feature gates Returns a single page of gates ordered by
updated_at desc, id desc. -
#list_gates_with_http_info(opts = {}) ⇒ Array<(ListGatesResponse, Integer, Hash)>
List feature gates Returns a single page of gates ordered by `updated_at desc, id desc`.
-
#update_gate(id, update_gate_request, opts = {}) ⇒ UpdateGateResponse
Update a feature gate Partial update — only supplied fields change.
-
#update_gate_with_http_info(id, update_gate_request, opts = {}) ⇒ Array<(UpdateGateResponse, Integer, Hash)>
Update a feature gate Partial update — only supplied fields change.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/shipeasy_admin/api/flags_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#create_gate(create_gate_request, opts = {}) ⇒ CreateGateResponse
Create a feature gate
Creates a new gate. Default enabled: true at the supplied rollout_pct (0 = fully dark). Only name is required. Request fields use snake_case (owner_email); the GET response returns camelCase (ownerEmail, groupName). Returns 409 if name already exists in the project (case-sensitive). Use cases - Dark create + ramp later — { \"name\": \"checkout_v2\" } at 0% rollout. Ramp via PATCH after deploy validation. - Targeted rollout — supply rules to gate the caller (e.g. only plan = pro users) plus a rollout_pct to bucket within that audience. - Gatekeeper stack — supply stack instead of rules/rollout_pct for internal ∪ beta ∪ public fall-through. Stack entries evaluated top-to-bottom; first match wins. - Dashboard metadata — populate title, description, folder, group, owner_email so the admin UI is self-documenting from day one. - Disabled on create — pre-provision with enabled: false for a future launch; flip on with POST /{id}/enable at go-live.
28 29 30 31 |
# File 'lib/shipeasy_admin/api/flags_api.rb', line 28 def create_gate(create_gate_request, opts = {}) data, _status_code, _headers = create_gate_with_http_info(create_gate_request, opts) data end |
#create_gate_with_http_info(create_gate_request, opts = {}) ⇒ Array<(CreateGateResponse, Integer, Hash)>
Create a feature gate Creates a new gate. Default `enabled: true` at the supplied `rollout_pct` (`0` = fully dark). Only `name` is required. Request fields use snake_case (`owner_email`); the GET response returns camelCase (`ownerEmail`, `groupName`). Returns `409` if `name` already exists in the project (case-sensitive). Use cases - Dark create + ramp later — `{ "name": "checkout_v2" }` at 0% rollout. Ramp via PATCH after deploy validation. - Targeted rollout — supply `rules` to gate the caller (e.g. only `plan = pro` users) plus a `rollout_pct` to bucket within that audience. - Gatekeeper stack — supply `stack` instead of `rules`/`rollout_pct` for `internal ∪ beta ∪ public` fall-through. Stack entries evaluated top-to-bottom; first match wins. - Dashboard metadata — populate `title`, `description`, `folder`, `group`, `owner_email` so the admin UI is self-documenting from day one. - Disabled on create — pre-provision with `enabled: false` for a future launch; flip on with `POST /id/enable` at go-live.
39 40 41 42 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 |
# File 'lib/shipeasy_admin/api/flags_api.rb', line 39 def create_gate_with_http_info(create_gate_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FlagsApi.create_gate ...' end # verify the required parameter 'create_gate_request' is set if @api_client.config.client_side_validation && create_gate_request.nil? fail ArgumentError, "Missing the required parameter 'create_gate_request' when calling FlagsApi.create_gate" end # resource path local_var_path = '/api/admin/gates' # 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']) unless header_params['Accept'] # 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 header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_gate_request) # return_type return_type = opts[:debug_return_type] || 'CreateGateResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearerSdkKey'] = opts.merge( :operation => :"FlagsApi.create_gate", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FlagsApi#create_gate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_gate(id, opts = {}) ⇒ DeleteGateResponse
Delete a feature gate Soft-deletes the gate. Returns 409 if the gate is still referenced by a running experiment as a targeting gate — stop the experiment first. Use case: Tear down a gate after a feature has fully shipped and the rollout flag is no longer needed.
99 100 101 102 |
# File 'lib/shipeasy_admin/api/flags_api.rb', line 99 def delete_gate(id, opts = {}) data, _status_code, _headers = delete_gate_with_http_info(id, opts) data end |
#delete_gate_with_http_info(id, opts = {}) ⇒ Array<(DeleteGateResponse, Integer, Hash)>
Delete a feature gate Soft-deletes the gate. Returns 409 if the gate is still referenced by a running experiment as a targeting gate — stop the experiment first. Use case: Tear down a gate after a feature has fully shipped and the rollout flag is no longer needed.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 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 |
# File 'lib/shipeasy_admin/api/flags_api.rb', line 110 def delete_gate_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FlagsApi.delete_gate ...' end # resource path local_var_path = '/api/admin/gates/{id}'.sub('{id}', CGI.escape(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']) unless header_params['Accept'] header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'DeleteGateResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearerSdkKey'] = opts.merge( :operation => :"FlagsApi.delete_gate", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FlagsApi#delete_gate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#disable_gate(id, opts = {}) ⇒ DisableGateResponse
Disable a gate
Sets enabled: false so the gate evaluates to false for every caller, regardless of rollout_pct or rules. Use as a quick kill switch. Use case: Flip a gate off in production without redeploying — the canonical kill-switch flow.
161 162 163 164 |
# File 'lib/shipeasy_admin/api/flags_api.rb', line 161 def disable_gate(id, opts = {}) data, _status_code, _headers = disable_gate_with_http_info(id, opts) data end |
#disable_gate_with_http_info(id, opts = {}) ⇒ Array<(DisableGateResponse, Integer, Hash)>
Disable a gate Sets `enabled: false` so the gate evaluates to `false` for every caller, regardless of `rollout_pct` or `rules`. Use as a quick kill switch. Use case: Flip a gate off in production without redeploying — the canonical kill-switch flow.
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/shipeasy_admin/api/flags_api.rb', line 172 def disable_gate_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FlagsApi.disable_gate ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling FlagsApi.disable_gate" end # resource path local_var_path = '/api/admin/gates/{id}/disable'.sub('{id}', CGI.escape(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']) unless header_params['Accept'] header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'DisableGateResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearerSdkKey'] = opts.merge( :operation => :"FlagsApi.disable_gate", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FlagsApi#disable_gate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#enable_gate(id, opts = {}) ⇒ EnableGateResponse
Enable a gate
Sets enabled: true. The current rollout_pct is preserved. Use case: Re-enable a previously disabled gate without re-issuing a full update.
227 228 229 230 |
# File 'lib/shipeasy_admin/api/flags_api.rb', line 227 def enable_gate(id, opts = {}) data, _status_code, _headers = enable_gate_with_http_info(id, opts) data end |
#enable_gate_with_http_info(id, opts = {}) ⇒ Array<(EnableGateResponse, Integer, Hash)>
Enable a gate Sets `enabled: true`. The current `rollout_pct` is preserved. Use case: Re-enable a previously disabled gate without re-issuing a full update.
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 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/shipeasy_admin/api/flags_api.rb', line 238 def enable_gate_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FlagsApi.enable_gate ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling FlagsApi.enable_gate" end # resource path local_var_path = '/api/admin/gates/{id}/enable'.sub('{id}', CGI.escape(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']) unless header_params['Accept'] header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'EnableGateResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearerSdkKey'] = opts.merge( :operation => :"FlagsApi.enable_gate", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FlagsApi#enable_gate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_gates(opts = {}) ⇒ ListGatesResponse
List feature gates
Returns a single page of gates ordered by updated_at desc, id desc. Use the cursor query parameter to paginate. Use case: Snapshot every gate in the project — for example to render an admin overview or to drive a CI check that asserts no gate is left at 100% in staging.
294 295 296 297 |
# File 'lib/shipeasy_admin/api/flags_api.rb', line 294 def list_gates(opts = {}) data, _status_code, _headers = list_gates_with_http_info(opts) data end |
#list_gates_with_http_info(opts = {}) ⇒ Array<(ListGatesResponse, Integer, Hash)>
List feature gates Returns a single page of gates ordered by `updated_at desc, id desc`. Use the `cursor` query parameter to paginate. Use case: Snapshot every gate in the project — for example to render an admin overview or to drive a CI check that asserts no gate is left at 100% in staging.
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 356 357 358 359 |
# File 'lib/shipeasy_admin/api/flags_api.rb', line 306 def list_gates_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FlagsApi.list_gates ...' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling FlagsApi.list_gates, must be smaller than or equal to 500.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling FlagsApi.list_gates, must be greater than or equal to 1.' end # resource path local_var_path = '/api/admin/gates' # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListGatesResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearerSdkKey'] = opts.merge( :operation => :"FlagsApi.list_gates", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FlagsApi#list_gates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_gate(id, update_gate_request, opts = {}) ⇒ UpdateGateResponse
Update a feature gate
Partial update — only supplied fields change. Array fields (rules, stack) replace wholesale; there is no merge or append. name and the gate id are immutable. The response carries only { id } — re-fetch via GET /api/admin/gates for the new row. Use cases - Ramp rollout — { \"rollout_pct\": 5000 } for 50%. Basis points (0–10000); 100 = 1%. - Kill switch — { \"enabled\": false }. Forces evaluation to false for every caller regardless of rules/rollout. Re-enable with POST /{id}/enable or { \"enabled\": true }. - Modify a rule's in set — send the full new rules array. To add 'GB' to ['US','CA']: { \"rules\": [{ \"attr\": \"country\", \"op\": \"in\", \"value\": [\"US\",\"CA\",\"GB\"] }] }. No per-rule patch endpoint. - Add targeting from scratch — { \"rules\": [{ \"attr\": \"email\", \"op\": \"regex\", \"value\": \"@acme\\\\.com$\" }] }. - Switch to gatekeeper stack — send a non-null stack. To revert to flat eval, send { \"stack\": null }. - Update metadata — any subset of title, description, folder, group, owner_email.
368 369 370 371 |
# File 'lib/shipeasy_admin/api/flags_api.rb', line 368 def update_gate(id, update_gate_request, opts = {}) data, _status_code, _headers = update_gate_with_http_info(id, update_gate_request, opts) data end |
#update_gate_with_http_info(id, update_gate_request, opts = {}) ⇒ Array<(UpdateGateResponse, Integer, Hash)>
Update a feature gate Partial update — only supplied fields change. Array fields (`rules`, `stack`) replace wholesale; there is no merge or append. `name` and the gate id are immutable. The response carries only `{ id }` — re-fetch via `GET /api/admin/gates` for the new row. Use cases - Ramp rollout — `{ "rollout_pct": 5000 }` for 50%. Basis points (0–10000); `100` = 1%. - Kill switch — `{ "enabled": false }`. Forces evaluation to `false` for every caller regardless of rules/rollout. Re-enable with `POST /id/enable` or `{ "enabled": true }`. - Modify a rule's `in` set — send the full new `rules` array. To add `'GB'` to `['US','CA']`: `{ "rules": [{ "attr": "country", "op": "in", "value": ["US","CA","GB"] }] }`. No per-rule patch endpoint. - Add targeting from scratch — `{ "rules": [{ "attr": "email", "op": "regex", "value": "@acme\\.com$" }] }`. - Switch to gatekeeper stack — send a non-null `stack`. To revert to flat eval, send `{ "stack": null }`. - Update metadata — any subset of `title`, `description`, `folder`, `group`, `owner_email`.
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
# File 'lib/shipeasy_admin/api/flags_api.rb', line 380 def update_gate_with_http_info(id, update_gate_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FlagsApi.update_gate ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling FlagsApi.update_gate" end # verify the required parameter 'update_gate_request' is set if @api_client.config.client_side_validation && update_gate_request.nil? fail ArgumentError, "Missing the required parameter 'update_gate_request' when calling FlagsApi.update_gate" end # resource path local_var_path = '/api/admin/gates/{id}'.sub('{id}', CGI.escape(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']) unless header_params['Accept'] # 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 header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(update_gate_request) # return_type return_type = opts[:debug_return_type] || 'UpdateGateResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearerSdkKey'] = opts.merge( :operation => :"FlagsApi.update_gate", :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(:PATCH, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FlagsApi#update_gate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |