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']) 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

  # 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']) unless header_params['Accept']

  # 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 `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:

  • (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']) unless header_params['Accept']

  # 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 This endpoint does not support response expansion. Although the API accepts an expand query parameter for compatibility reasons, it does not currently modify the response. The parameter is reserved for future use. ### Filtering metric groups The filter parameter supports the following operators: contains, equals, anyOf. #### Supported fields and operators You can only filter certain fields in metrics when using the filter parameter. Additionally, you can only filter some fields with certain operators. When you search for metrics, the filter parameter supports the following fields and operators: |<div style="width:120px">Field

|Description |Supported operators | |---|---|---| | experimentStatus | The experiment's status. One of not_started, running, stopped, started. | equals | | hasConnections | Whether the metric group has connections to experiments or guarded rollouts. One of true, false. | equals | | kind | The metric group kind. One of funnel, standard. | equals | | maintainerIds | The metric maintainer IDs. | anyOf | | maintainerTeamKey | The metric maintainer team key. | equals | | query | A "fuzzy" search across metric group key and name. Supply a string or list of strings to the operator. | equals | ### Sorting metric groups LaunchDarkly supports the following fields for sorting: - name sorts by metric group name. - createdAt sorts by the creation date of the metric group. - connectionCount sorts by the number of connections to experiments the metric group has. By default, the sort is in ascending order. Use - to sort in descending order. For example, ?sort=name sorts the response by metric group name in ascending order, and ?sort=-name sorts in descending order. #### 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 `experimentStatus`, `query`, `kind`, `hasConnections`, `maintainerIds`, and `maintainerTeamKey`. Example: `filter=experimentStatus equals 'running' and query equals 'test'`.

  • :sort (String)

    A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order. Read the endpoint description for a full list of available sort fields.

  • :expand (String)

    This parameter is reserved for future use and is not currently supported on this endpoint.

  • :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 `limit` items.

Returns:



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

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 This endpoint does not support response expansion. Although the API accepts an `expand` query parameter for compatibility reasons, it does not currently modify the response. The parameter is reserved for future use. ### Filtering metric groups The `filter` parameter supports the following operators: `contains`, `equals`, `anyOf`. #### Supported fields and operators You can only filter certain fields in metrics when using the `filter` parameter. Additionally, you can only filter some fields with certain operators. When you search for metrics, the `filter` parameter supports the following fields and operators: |<div style=&quot;width:120px&quot;>Field</div> |Description |Supported operators | |---|---|---| | `experimentStatus` | The experiment's status. One of `not_started`, `running`, `stopped`, `started`. | `equals` | | `hasConnections` | Whether the metric group has connections to experiments or guarded rollouts. One of `true`, `false`. | `equals` | | `kind` | The metric group kind. One of `funnel`, `standard`. | `equals` | | `maintainerIds` | The metric maintainer IDs. | `anyOf` | | `maintainerTeamKey` | The metric maintainer team key. | `equals` | | `query` | A &quot;fuzzy&quot; search across metric group key and name. Supply a string or list of strings to the operator. | `equals` | ### Sorting metric groups LaunchDarkly supports the following fields for sorting: - `name` sorts by metric group name. - `createdAt` sorts by the creation date of the metric group. - `connectionCount` sorts by the number of connections to experiments the metric group has. By default, the sort is in ascending order. Use `-` to sort in descending order. For example, `?sort=name` sorts the response by metric group name in ascending order, and `?sort=-name` sorts in descending order. #### 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 `experimentStatus`, `query`, `kind`, `hasConnections`, `maintainerIds`, and `maintainerTeamKey`. Example: `filter=experimentStatus equals 'running' and query equals 'test'`.

  • :sort (String)

    A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order. Read the endpoint description for a full list of available sort fields.

  • :expand (String)

    This parameter is reserved for future use and is not currently supported on this endpoint.

  • :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 `limit` items.

Returns:

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

    MetricGroupCollectionRep data, response status code and response headers



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
311
312
313
# File 'lib/launchdarkly_api/api/metrics_beta_api.rb', line 262

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[:'sort'] = opts[:'sort'] if !opts[:'sort'].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']) unless header_params['Accept']

  # 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 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:



322
323
324
325
# File 'lib/launchdarkly_api/api/metrics_beta_api.rb', line 322

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 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



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
391
392
393
# File 'lib/launchdarkly_api/api/metrics_beta_api.rb', line 334

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']) 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

  # 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