Class: Shipeasy::Admin::Generated::KillswitchApi

Inherits:
Object
  • Object
show all
Defined in:
lib/shipeasy_admin/api/killswitch_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ KillswitchApi

Returns a new instance of KillswitchApi.



19
20
21
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_killswitch(create_killswitch_request, opts = {}) ⇒ CreateKillswitchResponse

Create a killswitch Creates a new killswitch with value (default false) applied to every env at version 1. Returns 409 if name already exists in the project. Use cases - Untripped create{ \"name\": \"payments.checkout\" }. Provision the kill ahead of an incident. - Pre-tripped{ \"value\": true } to ship the killswitch already engaged. - With switches — seed switches to carve out per-region/per-tenant kills from day one.

Parameters:

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



28
29
30
31
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 28

def create_killswitch(create_killswitch_request, opts = {})
  data, _status_code, _headers = create_killswitch_with_http_info(create_killswitch_request, opts)
  data
end

#create_killswitch_with_http_info(create_killswitch_request, opts = {}) ⇒ Array<(CreateKillswitchResponse, Integer, Hash)>

Create a killswitch Creates a new killswitch with `value` (default `false`) applied to every env at version 1. Returns `409` if `name` already exists in the project. Use cases - Untripped create — `{ &quot;name&quot;: &quot;payments.checkout&quot; }`. Provision the kill ahead of an incident. - Pre-tripped — `{ &quot;value&quot;: true }` to ship the killswitch already engaged. - With switches — seed `switches` to carve out per-region/per-tenant kills from day one.

Parameters:

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:

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

    CreateKillswitchResponse data, response status code and response headers



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/killswitch_api.rb', line 39

def create_killswitch_with_http_info(create_killswitch_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KillswitchApi.create_killswitch ...'
  end
  # verify the required parameter 'create_killswitch_request' is set
  if @api_client.config.client_side_validation && create_killswitch_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_killswitch_request' when calling KillswitchApi.create_killswitch"
  end
  # resource path
  local_var_path = '/api/admin/killswitches'

  # 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_killswitch_request)

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

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

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

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

#delete_killswitch(id, opts = {}) ⇒ DeleteKillswitchResponse

Delete a killswitch Soft-deletes the killswitch and rebuilds the project's flags KV blob so SDKs stop seeing it. Use case: Tear down a killswitch after the feature it protected has been removed.

Parameters:

  • id (String)

    Stable opaque killswitch id (`ksw_…`) or the killswitch's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



99
100
101
102
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 99

def delete_killswitch(id, opts = {})
  data, _status_code, _headers = delete_killswitch_with_http_info(id, opts)
  data
end

#delete_killswitch_with_http_info(id, opts = {}) ⇒ Array<(DeleteKillswitchResponse, Integer, Hash)>

Delete a killswitch Soft-deletes the killswitch and rebuilds the project's flags KV blob so SDKs stop seeing it. Use case: Tear down a killswitch after the feature it protected has been removed.

Parameters:

  • id (String)

    Stable opaque killswitch id (`ksw_…`) or the killswitch's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:

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

    DeleteKillswitchResponse data, response status code and response headers



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
154
155
156
157
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 110

def delete_killswitch_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KillswitchApi.delete_killswitch ...'
  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 KillswitchApi.delete_killswitch"
  end
  # resource path
  local_var_path = '/api/admin/killswitches/{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] || 'DeleteKillswitchResponse'

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

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

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

#get_killswitch(id, opts = {}) ⇒ GetKillswitchResponse

Get one killswitch Returns the killswitch metadata plus the latest published value/switches/version per env. Use case: Fetch the current state of one killswitch — e.g. to verify a trip propagated before declaring an incident mitigated.

Parameters:

  • id (String)

    Stable opaque killswitch id (`ksw_…`) or the killswitch's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



165
166
167
168
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 165

def get_killswitch(id, opts = {})
  data, _status_code, _headers = get_killswitch_with_http_info(id, opts)
  data
end

#get_killswitch_with_http_info(id, opts = {}) ⇒ Array<(GetKillswitchResponse, Integer, Hash)>

Get one killswitch Returns the killswitch metadata plus the latest published `value`/`switches`/`version` per env. Use case: Fetch the current state of one killswitch — e.g. to verify a trip propagated before declaring an incident mitigated.

Parameters:

  • id (String)

    Stable opaque killswitch id (`ksw_…`) or the killswitch's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:

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

    GetKillswitchResponse data, response status code and response headers



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/killswitch_api.rb', line 176

def get_killswitch_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KillswitchApi.get_killswitch ...'
  end
  # resource path
  local_var_path = '/api/admin/killswitches/{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] || 'GetKillswitchResponse'

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

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

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

#list_killswitches(opts = {}) ⇒ ListKillswitchesResponse

List killswitches Returns a single page of killswitches ordered by updated_at desc, id desc. Each row includes the latest published value/switches/version per env. Use case: Snapshot every killswitch in the project — e.g. to render an incident-response runbook listing every kill and its current trip state.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

  • :limit (Integer)

    Page size (1–500). Defaults to 100. (default to 100)

  • :cursor (String)

    Opaque cursor returned in the previous page's `next_cursor`. Omit for the first page.

Returns:



228
229
230
231
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 228

def list_killswitches(opts = {})
  data, _status_code, _headers = list_killswitches_with_http_info(opts)
  data
end

#list_killswitches_with_http_info(opts = {}) ⇒ Array<(ListKillswitchesResponse, Integer, Hash)>

List killswitches Returns a single page of killswitches ordered by `updated_at desc, id desc`. Each row includes the latest published `value`/`switches`/`version` per env. Use case: Snapshot every killswitch in the project — e.g. to render an incident-response runbook listing every kill and its current trip state.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

  • :limit (Integer)

    Page size (1–500). Defaults to 100. (default to 100)

  • :cursor (String)

    Opaque cursor returned in the previous page's `next_cursor`. Omit for the first page.

Returns:

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

    ListKillswitchesResponse data, response status code and response headers



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
286
287
288
289
290
291
292
293
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 240

def list_killswitches_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KillswitchApi.list_killswitches ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling KillswitchApi.list_killswitches, 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 KillswitchApi.list_killswitches, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/admin/killswitches'

  # 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] || 'ListKillswitchesResponse'

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

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

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

#set_killswitch_switch(id, set_killswitch_switch_request, opts = {}) ⇒ SetKillswitchSwitchResponse

Set one switch entry Sets or updates a single switchKey on a single env. Publishes one new version on that env only — other envs untouched. Use this for surgical per-env, per-key flips during incident response (e.g. trip eu_region on prod without touching the flat value or other envs). Use cases - Trip a region{ \"env\": \"prod\", \"switchKey\": \"eu_region\", \"value\": true }. - Untrip without removing — same payload with value: false. To remove the entry entirely use DELETE /{id}/switch.

Parameters:

  • id (String)

    Stable opaque killswitch id (`ksw_…`) or the killswitch's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



302
303
304
305
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 302

def set_killswitch_switch(id, set_killswitch_switch_request, opts = {})
  data, _status_code, _headers = set_killswitch_switch_with_http_info(id, set_killswitch_switch_request, opts)
  data
end

#set_killswitch_switch_with_http_info(id, set_killswitch_switch_request, opts = {}) ⇒ Array<(SetKillswitchSwitchResponse, Integer, Hash)>

Set one switch entry Sets or updates a single `switchKey` on a single `env`. Publishes one new version on that env only — other envs untouched. Use this for surgical per-env, per-key flips during incident response (e.g. trip `eu_region` on prod without touching the flat `value` or other envs). Use cases - Trip a region — `{ &quot;env&quot;: &quot;prod&quot;, &quot;switchKey&quot;: &quot;eu_region&quot;, &quot;value&quot;: true }`. - Untrip without removing — same payload with `value: false`. To remove the entry entirely use `DELETE /id/switch`.

Parameters:

  • id (String)

    Stable opaque killswitch id (`ksw_…`) or the killswitch's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:

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

    SetKillswitchSwitchResponse data, response status code and response headers



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
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 314

def set_killswitch_switch_with_http_info(id, set_killswitch_switch_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KillswitchApi.set_killswitch_switch ...'
  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 KillswitchApi.set_killswitch_switch"
  end
  # verify the required parameter 'set_killswitch_switch_request' is set
  if @api_client.config.client_side_validation && set_killswitch_switch_request.nil?
    fail ArgumentError, "Missing the required parameter 'set_killswitch_switch_request' when calling KillswitchApi.set_killswitch_switch"
  end
  # resource path
  local_var_path = '/api/admin/killswitches/{id}/switch'.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(set_killswitch_switch_request)

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

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

  new_options = opts.merge(
    :operation => :"KillswitchApi.set_killswitch_switch",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KillswitchApi#set_killswitch_switch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#set_killswitch_value(id, set_killswitch_value_request, opts = {}) ⇒ SetKillswitchValueResponse

Set the flat value on one env Sets the flat value on a single env, publishing one new version on that env only. switches and other envs are untouched. Use this to trip (or untrip) a killswitch on one environment without replacing its per-key overrides. Use cases - Trip on prod{ \"env\": \"prod\", \"value\": true }. - Untrip on prod{ \"env\": \"prod\", \"value\": false }.

Parameters:

  • id (String)

    Stable opaque killswitch id (`ksw_…`) or the killswitch's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



379
380
381
382
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 379

def set_killswitch_value(id, set_killswitch_value_request, opts = {})
  data, _status_code, _headers = set_killswitch_value_with_http_info(id, set_killswitch_value_request, opts)
  data
end

#set_killswitch_value_with_http_info(id, set_killswitch_value_request, opts = {}) ⇒ Array<(SetKillswitchValueResponse, Integer, Hash)>

Set the flat value on one env Sets the flat `value` on a single `env`, publishing one new version on that env only. `switches` and other envs are untouched. Use this to trip (or untrip) a killswitch on one environment without replacing its per-key overrides. Use cases - Trip on prod — `{ &quot;env&quot;: &quot;prod&quot;, &quot;value&quot;: true }`. - Untrip on prod — `{ &quot;env&quot;: &quot;prod&quot;, &quot;value&quot;: false }`.

Parameters:

  • id (String)

    Stable opaque killswitch id (`ksw_…`) or the killswitch's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:

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

    SetKillswitchValueResponse data, response status code and response headers



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
437
438
439
440
441
442
443
444
445
446
447
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 391

def set_killswitch_value_with_http_info(id, set_killswitch_value_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KillswitchApi.set_killswitch_value ...'
  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 KillswitchApi.set_killswitch_value"
  end
  # verify the required parameter 'set_killswitch_value_request' is set
  if @api_client.config.client_side_validation && set_killswitch_value_request.nil?
    fail ArgumentError, "Missing the required parameter 'set_killswitch_value_request' when calling KillswitchApi.set_killswitch_value"
  end
  # resource path
  local_var_path = '/api/admin/killswitches/{id}/value'.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(set_killswitch_value_request)

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

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

  new_options = opts.merge(
    :operation => :"KillswitchApi.set_killswitch_value",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KillswitchApi#set_killswitch_value\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#unset_killswitch_switch(id, unset_killswitch_switch_request, opts = {}) ⇒ UnsetKillswitchSwitchResponse

Remove one switch entry Removes a single switchKey from the switches map on a single env. Publishes a new version on that env. Returns { removed: false } if the entry didn't exist (idempotent no-op). Use case: Clean up a per-region override after the incident is resolved so the flat value governs again.

Parameters:

  • id (String)

    Stable opaque killswitch id (`ksw_…`) or the killswitch's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



456
457
458
459
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 456

def unset_killswitch_switch(id, unset_killswitch_switch_request, opts = {})
  data, _status_code, _headers = unset_killswitch_switch_with_http_info(id, unset_killswitch_switch_request, opts)
  data
end

#unset_killswitch_switch_with_http_info(id, unset_killswitch_switch_request, opts = {}) ⇒ Array<(UnsetKillswitchSwitchResponse, Integer, Hash)>

Remove one switch entry Removes a single `switchKey` from the `switches` map on a single `env`. Publishes a new version on that env. Returns `{ removed: false }` if the entry didn't exist (idempotent no-op). Use case: Clean up a per-region override after the incident is resolved so the flat `value` governs again.

Parameters:

  • id (String)

    Stable opaque killswitch id (`ksw_…`) or the killswitch's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 468

def unset_killswitch_switch_with_http_info(id, unset_killswitch_switch_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KillswitchApi.unset_killswitch_switch ...'
  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 KillswitchApi.unset_killswitch_switch"
  end
  # verify the required parameter 'unset_killswitch_switch_request' is set
  if @api_client.config.client_side_validation && unset_killswitch_switch_request.nil?
    fail ArgumentError, "Missing the required parameter 'unset_killswitch_switch_request' when calling KillswitchApi.unset_killswitch_switch"
  end
  # resource path
  local_var_path = '/api/admin/killswitches/{id}/switch'.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(unset_killswitch_switch_request)

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

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

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

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

#update_killswitch(id, update_killswitch_request, opts = {}) ⇒ UpdateKillswitchResponse

Update a killswitch Partial update applied to every env. Setting value/switches publishes a new version per env. Description-only patches don't bump versions. To change a single switch on a single env, use PUT /{id}/switch instead. Use cases - Trip everywhere{ \"value\": true }. Kills the feature across dev/stage/prod in one call. - Untrip everywhere{ \"value\": false }. - Replace switches — send the full new map; per-key edits use PUT /{id}/switch. - Update description — metadata-only patches don't bump versions.

Parameters:

  • id (String)

    Stable opaque killswitch id (`ksw_…`) or the killswitch's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:



533
534
535
536
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 533

def update_killswitch(id, update_killswitch_request, opts = {})
  data, _status_code, _headers = update_killswitch_with_http_info(id, update_killswitch_request, opts)
  data
end

#update_killswitch_with_http_info(id, update_killswitch_request, opts = {}) ⇒ Array<(UpdateKillswitchResponse, Integer, Hash)>

Update a killswitch Partial update applied to every env. Setting `value`/`switches` publishes a new version per env. Description-only patches don't bump versions. To change a single switch on a single env, use `PUT /id/switch` instead. Use cases - Trip everywhere — `{ &quot;value&quot;: true }`. Kills the feature across dev/stage/prod in one call. - Untrip everywhere — `{ &quot;value&quot;: false }`. - Replace switches — send the full new map; per-key edits use `PUT /id/switch`. - Update description — metadata-only patches don't bump versions.

Parameters:

  • id (String)

    Stable opaque killswitch id (`ksw_…`) or the killswitch's `name`.

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

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).

Returns:

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

    UpdateKillswitchResponse data, response status code and response headers



545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
# File 'lib/shipeasy_admin/api/killswitch_api.rb', line 545

def update_killswitch_with_http_info(id, update_killswitch_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KillswitchApi.update_killswitch ...'
  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 KillswitchApi.update_killswitch"
  end
  # verify the required parameter 'update_killswitch_request' is set
  if @api_client.config.client_side_validation && update_killswitch_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_killswitch_request' when calling KillswitchApi.update_killswitch"
  end
  # resource path
  local_var_path = '/api/admin/killswitches/{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_killswitch_request)

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

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

  new_options = opts.merge(
    :operation => :"KillswitchApi.update_killswitch",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KillswitchApi#update_killswitch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end