Class: LaunchDarklyApi::MetricsBetaApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MetricsBetaApi

Returns a new instance of MetricsBetaApi.



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

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



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

def api_client
  @api_client
end

Instance Method Details

#create_metric_group(project_key, metric_group_post, opts = {}) ⇒ MetricGroupRep

Create metric group Create a new metric group in the specified project

Parameters:

  • project_key (String)

    The project key

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

    the optional parameters

Returns:



28
29
30
31
# File 'lib/launchdarkly_api/api/metrics_beta_api.rb', line 28

def create_metric_group(project_key, metric_group_post, opts = {})
  data, _status_code, _headers = create_metric_group_with_http_info(project_key, metric_group_post, opts)
  data
end

#create_metric_group_with_http_info(project_key, metric_group_post, opts = {}) ⇒ Array<(MetricGroupRep, Integer, Hash)>

Create metric group Create a new metric group in the specified project

Parameters:

  • project_key (String)

    The project key

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

    the optional parameters

Returns:

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

    MetricGroupRep 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
92
93
94
# File 'lib/launchdarkly_api/api/metrics_beta_api.rb', line 39

def create_metric_group_with_http_info(project_key, metric_group_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsBetaApi.create_metric_group ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsBetaApi.create_metric_group"
  end
  # verify the required parameter 'metric_group_post' is set
  if @api_client.config.client_side_validation && metric_group_post.nil?
    fail ArgumentError, "Missing the required parameter 'metric_group_post' when calling MetricsBetaApi.create_metric_group"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/metric-groups'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.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'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

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

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

  new_options = opts.merge(
    :operation => :"MetricsBetaApi.create_metric_group",
    :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: MetricsBetaApi#create_metric_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_metric_group(project_key, metric_group_key, opts = {}) ⇒ nil

Delete metric group Delete a metric group by key.

Parameters:

  • project_key (String)

    The project key

  • metric_group_key (String)

    The metric group key

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

    the optional parameters

Returns:

  • (nil)


102
103
104
105
# File 'lib/launchdarkly_api/api/metrics_beta_api.rb', line 102

def delete_metric_group(project_key, metric_group_key, opts = {})
  delete_metric_group_with_http_info(project_key, metric_group_key, opts)
  nil
end

#delete_metric_group_with_http_info(project_key, metric_group_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete metric group Delete a metric group by key.

Parameters:

  • project_key (String)

    The project key

  • metric_group_key (String)

    The metric group key

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
158
159
160
161
162
163
# File 'lib/launchdarkly_api/api/metrics_beta_api.rb', line 113

def delete_metric_group_with_http_info(project_key, metric_group_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsBetaApi.delete_metric_group ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsBetaApi.delete_metric_group"
  end
  # verify the required parameter 'metric_group_key' is set
  if @api_client.config.client_side_validation && metric_group_key.nil?
    fail ArgumentError, "Missing the required parameter 'metric_group_key' when calling MetricsBetaApi.delete_metric_group"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/metric-groups/{metricGroupKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'metricGroupKey' + '}', CGI.escape(metric_group_key.to_s))

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

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

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"MetricsBetaApi.delete_metric_group",
    :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: MetricsBetaApi#delete_metric_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_metric_group(project_key, metric_group_key, opts = {}) ⇒ MetricGroupRep

Get metric group Get information for a single metric group from the specific project. ### Expanding the metric group response LaunchDarkly supports two fields for expanding the "Get metric group" response. By default, these fields are not included in the response. To expand the response, append the ‘expand` query parameter and add a comma-separated list with either or both of the following fields: - `experiments` includes all experiments from the specific project that use the metric group - `experimentCount` includes the number of experiments from the specific project that use the metric group For example, `expand=experiments` includes the `experiments` field in the response.

Parameters:

  • project_key (String)

    The project key

  • metric_group_key (String)

    The metric group key

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

    the optional parameters

Options Hash (opts):

  • :expand (String)

    A comma-separated list of properties that can reveal additional information in the response.

Returns:



172
173
174
175
# File 'lib/launchdarkly_api/api/metrics_beta_api.rb', line 172

def get_metric_group(project_key, metric_group_key, opts = {})
  data, _status_code, _headers = get_metric_group_with_http_info(project_key, metric_group_key, opts)
  data
end

#get_metric_group_with_http_info(project_key, metric_group_key, opts = {}) ⇒ Array<(MetricGroupRep, Integer, Hash)>

Get metric group Get information for a single metric group from the specific project. ### Expanding the metric group response LaunchDarkly supports two fields for expanding the &quot;Get metric group&quot; response. By default, these fields are not included in the response. To expand the response, append the &#x60;expand&#x60; query parameter and add a comma-separated list with either or both of the following fields: - &#x60;experiments&#x60; includes all experiments from the specific project that use the metric group - &#x60;experimentCount&#x60; includes the number of experiments from the specific project that use the metric group For example, &#x60;expand&#x3D;experiments&#x60; includes the &#x60;experiments&#x60; field in the response.

Parameters:

  • project_key (String)

    The project key

  • metric_group_key (String)

    The metric group key

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

    the optional parameters

Options Hash (opts):

  • :expand (String)

    A comma-separated list of properties that can reveal additional information in the response.

Returns:

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

    MetricGroupRep data, response status code and response headers



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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/launchdarkly_api/api/metrics_beta_api.rb', line 184

def get_metric_group_with_http_info(project_key, metric_group_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsBetaApi.get_metric_group ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsBetaApi.get_metric_group"
  end
  # verify the required parameter 'metric_group_key' is set
  if @api_client.config.client_side_validation && metric_group_key.nil?
    fail ArgumentError, "Missing the required parameter 'metric_group_key' when calling MetricsBetaApi.get_metric_group"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/metric-groups/{metricGroupKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'metricGroupKey' + '}', CGI.escape(metric_group_key.to_s))

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

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"MetricsBetaApi.get_metric_group",
    :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: MetricsBetaApi#get_metric_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_metric_groups(project_key, opts = {}) ⇒ MetricGroupCollectionRep

List metric groups Get a list of all metric groups for the specified project. ### Expanding the metric groups response LaunchDarkly supports one field for expanding the "Get metric groups" response. By default, these fields are not included in the response. To expand the response, append the ‘expand` query parameter and add a comma-separated list with the following field: - `experiments` includes all experiments from the specific project that use the metric group For example, `expand=experiments` includes the `experiments` field in the response. ### Filtering metric groups The `filter` parameter supports the `equals` operator on the following fields: `experimentStatus`, `query`. The `experimentStatus` field supports the following values: `not_started`, `running`, `stopped`, and `started`. The `query` field is a search query that is compared against the metric group name and key. #### Sample query `filter=experimentStatus equals ’not_started’ and query equals ‘metric name’‘

Parameters:

  • project_key (String)

    The project key

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

    the optional parameters

Options Hash (opts):

  • :filter (String)

    Accepts filter by &#x60;experimentStatus&#x60; and &#x60;query&#x60;. Example: &#x60;filter&#x3D;experimentStatus equals &#39;running&#39; and query equals &#39;test&#39;&#x60;.

  • :expand (String)

    A comma-separated list of properties that can reveal additional information in the response.

  • :limit (Integer)

    The number of metric groups to return in the response. Defaults to 20. Maximum limit is 50.

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and returns the next &#x60;limit&#x60; items.

Returns:



246
247
248
249
# File 'lib/launchdarkly_api/api/metrics_beta_api.rb', line 246

def get_metric_groups(project_key, opts = {})
  data, _status_code, _headers = get_metric_groups_with_http_info(project_key, opts)
  data
end

#get_metric_groups_with_http_info(project_key, opts = {}) ⇒ Array<(MetricGroupCollectionRep, Integer, Hash)>

List metric groups Get a list of all metric groups for the specified project. ### Expanding the metric groups response LaunchDarkly supports one field for expanding the &quot;Get metric groups&quot; response. By default, these fields are not included in the response. To expand the response, append the &#x60;expand&#x60; query parameter and add a comma-separated list with the following field: - &#x60;experiments&#x60; includes all experiments from the specific project that use the metric group For example, &#x60;expand&#x3D;experiments&#x60; includes the &#x60;experiments&#x60; field in the response. ### Filtering metric groups The &#x60;filter&#x60; parameter supports the &#x60;equals&#x60; operator on the following fields: &#x60;experimentStatus&#x60;, &#x60;query&#x60;. The &#x60;experimentStatus&#x60; field supports the following values: &#x60;not_started&#x60;, &#x60;running&#x60;, &#x60;stopped&#x60;, and &#x60;started&#x60;. The &#x60;query&#x60; field is a search query that is compared against the metric group name and key. #### Sample query &#x60;filter&#x3D;experimentStatus equals &#39;not_started&#39; and query equals &#39;metric name&#39;&#x60;

Parameters:

  • project_key (String)

    The project key

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

    the optional parameters

Options Hash (opts):

  • :filter (String)

    Accepts filter by &#x60;experimentStatus&#x60; and &#x60;query&#x60;. Example: &#x60;filter&#x3D;experimentStatus equals &#39;running&#39; and query equals &#39;test&#39;&#x60;.

  • :expand (String)

    A comma-separated list of properties that can reveal additional information in the response.

  • :limit (Integer)

    The number of metric groups to return in the response. Defaults to 20. Maximum limit is 50.

  • :offset (Integer)

    Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and returns the next &#x60;limit&#x60; items.

Returns:

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

    MetricGroupCollectionRep data, response status code and response headers



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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/launchdarkly_api/api/metrics_beta_api.rb', line 260

def get_metric_groups_with_http_info(project_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsBetaApi.get_metric_groups ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsBetaApi.get_metric_groups"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/metric-groups'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
  query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"MetricsBetaApi.get_metric_groups",
    :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: MetricsBetaApi#get_metric_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#patch_metric_group(project_key, metric_group_key, patch_operation, opts = {}) ⇒ MetricGroupRep

Patch metric group Patch a metric group by key. Updating a metric group uses a [JSON patch](datatracker.ietf.org/doc/html/rfc6902) representation of the desired changes.

Parameters:

  • project_key (String)

    The project key

  • metric_group_key (String)

    The metric group key

  • patch_operation (Array<PatchOperation>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



319
320
321
322
# File 'lib/launchdarkly_api/api/metrics_beta_api.rb', line 319

def patch_metric_group(project_key, metric_group_key, patch_operation, opts = {})
  data, _status_code, _headers = patch_metric_group_with_http_info(project_key, metric_group_key, patch_operation, opts)
  data
end

#patch_metric_group_with_http_info(project_key, metric_group_key, patch_operation, opts = {}) ⇒ Array<(MetricGroupRep, Integer, Hash)>

Patch metric group Patch a metric group by key. Updating a metric group uses a [JSON patch](datatracker.ietf.org/doc/html/rfc6902) representation of the desired changes.

Parameters:

  • project_key (String)

    The project key

  • metric_group_key (String)

    The metric group key

  • patch_operation (Array<PatchOperation>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    MetricGroupRep data, response status code and response headers



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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/launchdarkly_api/api/metrics_beta_api.rb', line 331

def patch_metric_group_with_http_info(project_key, metric_group_key, patch_operation, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MetricsBetaApi.patch_metric_group ...'
  end
  # verify the required parameter 'project_key' is set
  if @api_client.config.client_side_validation && project_key.nil?
    fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsBetaApi.patch_metric_group"
  end
  # verify the required parameter 'metric_group_key' is set
  if @api_client.config.client_side_validation && metric_group_key.nil?
    fail ArgumentError, "Missing the required parameter 'metric_group_key' when calling MetricsBetaApi.patch_metric_group"
  end
  # verify the required parameter 'patch_operation' is set
  if @api_client.config.client_side_validation && patch_operation.nil?
    fail ArgumentError, "Missing the required parameter 'patch_operation' when calling MetricsBetaApi.patch_metric_group"
  end
  # resource path
  local_var_path = '/api/v2/projects/{projectKey}/metric-groups/{metricGroupKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'metricGroupKey' + '}', CGI.escape(metric_group_key.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'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

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

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

  new_options = opts.merge(
    :operation => :"MetricsBetaApi.patch_metric_group",
    :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: MetricsBetaApi#patch_metric_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end