diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aa148152..15a9c32a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Added - Switch to Terraform [protocol version 6](https://developer.hashicorp.com/terraform/plugin/terraform-plugin-protocol#protocol-version-6) that is compatible with Terraform CLI version 1.0 and later. - Add 'elasticstack_fleet_package' data source ([#469](https://github.com/elastic/terraform-provider-elasticstack/pull/469)) +- Add `tags` option to Kibana's SLOs ([#495](https://github.com/elastic/terraform-provider-elasticstack/pull/495)) ### Fixed - Rename fleet package objects to `elasticstack_fleet_integration` and `elasticstack_fleet_integration_policy` ([#476](https://github.com/elastic/terraform-provider-elasticstack/pull/476)) diff --git a/Makefile b/Makefile index aea69c3d1..0fad2a50c 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,7 @@ retry = until [ $$(if [ -z "$$attempt" ]; then echo -n "0"; else echo -n "$$atte done # To run specific test (e.g. TestAccResourceActionConnector) execute `make docker-testacc TESTARGS='-run ^TestAccResourceActionConnector$$'` -# To enable tracing (or debugging), execute `make docker-testacc TFLOG=TRACE` +# To enable tracing (or debugging), execute `make docker-testacc TF_LOG=TRACE` .PHONY: docker-testacc docker-testacc: docker-elasticsearch docker-kibana ## Run acceptance tests in the docker container @ docker run --rm \ diff --git a/README.md b/README.md index d244b61ac..9adefc90d 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ If you wish to work on the provider, you'll first need [Go](http://www.golang.or To compile the provider, run `go install`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory. -To install the provider locally into the `~/.terraform.d/plugins/...` directory one can use `make install` command. This will allow to refer this provider dirrecty in the Terraform configuration without needing to download it from the registry. +To install the provider locally into the `~/.terraform.d/plugins/...` directory one can use `make install` command. This will allow to refer this provider directly in the Terraform configuration without needing to download it from the registry. To generate or update documentation, run `make gen`. All the generated docs will have to be committed to the repository as well. diff --git a/docs/resources/kibana_slo.md b/docs/resources/kibana_slo.md index 9f0fe181c..41e543dd6 100644 --- a/docs/resources/kibana_slo.md +++ b/docs/resources/kibana_slo.md @@ -148,6 +148,7 @@ resource "elasticstack_kibana_slo" "custom_histogram" { timeslice_window = "5m" } + tags = ["tag-1", "another_tag"] } //Available from 8.10.0 @@ -214,6 +215,7 @@ resource "elasticstack_kibana_slo" "custom_metric" { - `metric_custom_indicator` (Block List, Max: 1) (see [below for nested schema](#nestedblock--metric_custom_indicator)) - `settings` (Block List, Max: 1) The default settings should be sufficient for most users, but if needed, these properties can be overwritten. (see [below for nested schema](#nestedblock--settings)) - `space_id` (String) An identifier for the space. If space_id is not provided, the default space is used. +- `tags` (List of String) The tags for the SLO. ### Nested Schema for `objective` diff --git a/examples/resources/elasticstack_kibana_slo/resource.tf b/examples/resources/elasticstack_kibana_slo/resource.tf index 28200c08e..be8b94aa3 100644 --- a/examples/resources/elasticstack_kibana_slo/resource.tf +++ b/examples/resources/elasticstack_kibana_slo/resource.tf @@ -133,6 +133,7 @@ resource "elasticstack_kibana_slo" "custom_histogram" { timeslice_window = "5m" } + tags = ["tag-1", "another_tag"] } //Available from 8.10.0 diff --git a/generated/slo-spec.yml b/generated/slo-spec.yml index 34d4b4c7b..5aa20726b 100644 --- a/generated/slo-spec.yml +++ b/generated/slo-spec.yml @@ -17,8 +17,6 @@ security: tags: - name: slo description: SLO APIs enable you to define, manage and track service-level objectives - - name: composite slo - description: Composite SLO APIs enable you to define, manage and track a group of SLOs. paths: /s/{spaceId}/api/observability/slos: post: @@ -99,6 +97,7 @@ paths: schema: type: integer default: 25 + maximum: 5000 example: 25 - name: sortBy in: query @@ -408,6 +407,46 @@ paths: application/json: schema: $ref: '#/components/schemas/403_response' + /s/{spaceId}/api/observability/slos/_delete_instances: + post: + summary: Batch delete rollup and summary data for the matching list of sloId and instanceId + operationId: deleteSloInstancesOp + description: | + You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + tags: + - slo + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/delete_slo_instances_request' + responses: + '204': + description: Successful request + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' + '401': + description: Unauthorized response + content: + application/json: + schema: + $ref: '#/components/schemas/401_response' + '403': + description: Unauthorized response + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' + servers: + - url: https://localhost:5601 components: securitySchemes: basicAuth: @@ -416,7 +455,8 @@ components: apiKeyAuth: type: apiKey in: header - name: ApiKey + name: Authorization + description: 'e.g. Authorization: ApiKey base64AccessApiKey' parameters: kbn_xsrf: schema: @@ -504,6 +544,8 @@ components: required: - index - timestampField + - good + - total properties: index: description: The index or index pattern to use @@ -599,7 +641,6 @@ components: - timestampField - good - total - - filter properties: index: description: The index or index pattern to use @@ -797,6 +838,162 @@ components: description: The type of indicator. type: string example: sli.histogram.custom + timeslice_metric_basic_metric_with_field: + title: Timeslice Metric Basic Metric with Field + required: + - name + - aggregation + - field + type: object + properties: + name: + description: The name of the metric. Only valid options are A-Z + type: string + example: A + pattern: ^[A-Z]$ + aggregation: + description: The aggregation type of the metric. + type: string + example: sum + enum: + - sum + - avg + - min + - max + - std_deviation + - last_value + - cardinality + field: + description: The field of the metric. + type: string + example: processor.processed + filter: + description: The filter to apply to the metric. + type: string + example: 'processor.outcome: "success"' + timeslice_metric_percentile_metric: + title: Timeslice Metric Percentile Metric + required: + - name + - aggregation + - field + - percentile + type: object + properties: + name: + description: The name of the metric. Only valid options are A-Z + type: string + example: A + pattern: ^[A-Z]$ + aggregation: + description: The aggregation type of the metric. Only valid option is "percentile" + type: string + example: percentile + enum: + - percentile + field: + description: The field of the metric. + type: string + example: processor.processed + percentile: + description: The percentile value. + type: number + example: 95 + filter: + description: The filter to apply to the metric. + type: string + example: 'processor.outcome: "success"' + timeslice_metric_doc_count_metric: + title: Timeslice Metric Doc Count Metric + required: + - name + - aggregation + type: object + properties: + name: + description: The name of the metric. Only valid options are A-Z + type: string + example: A + pattern: ^[A-Z]$ + aggregation: + description: The aggregation type of the metric. Only valid option is "doc_count" + type: string + example: doc_count + enum: + - doc_count + filter: + description: The filter to apply to the metric. + type: string + example: 'processor.outcome: "success"' + indicator_properties_timeslice_metric: + title: Timeslice metric + required: + - type + - params + description: Defines properties for a timeslice metric indicator type + type: object + properties: + params: + description: An object containing the indicator parameters. + type: object + nullable: false + required: + - index + - timestampField + - metric + properties: + index: + description: The index or index pattern to use + type: string + example: my-service-* + filter: + description: the KQL query to filter the documents with. + type: string + example: 'field.environment : "production" and service.name : "my-service"' + timestampField: + description: | + The timestamp field used in the source indice. + type: string + example: timestamp + metric: + description: | + An object defining the metrics, equation, and threshold to determine if it's a good slice or not + type: object + required: + - metrics + - equation + - comparator + - threshold + properties: + metrics: + description: List of metrics with their name, aggregation type, and field. + type: array + items: + anyOf: + - $ref: '#/components/schemas/timeslice_metric_basic_metric_with_field' + - $ref: '#/components/schemas/timeslice_metric_percentile_metric' + - $ref: '#/components/schemas/timeslice_metric_doc_count_metric' + equation: + description: The equation to calculate the metric. + type: string + example: A + comparator: + description: The comparator to use to compare the equation to the threshold. + type: string + example: GT + enum: + - GT + - GTE + - LT + - LTE + threshold: + description: The threshold used to determine if the metric is a good slice or not. + type: number + example: 100 + type: + description: The type of indicator. + type: string + example: sli.metric.timeslice time_window: title: Time window required: @@ -923,6 +1120,7 @@ components: - enabled - groupBy - instanceId + - tags - createdAt - updatedAt properties: @@ -947,12 +1145,14 @@ components: sli.apm.transactionDuration: '#/components/schemas/indicator_properties_apm_latency' sli.metric.custom: '#/components/schemas/indicator_properties_custom_metric' sli.histogram.custom: '#/components/schemas/indicator_properties_histogram' + sli.metric.timeslice: '#/components/schemas/indicator_properties_timeslice_metric' oneOf: - $ref: '#/components/schemas/indicator_properties_custom_kql' - $ref: '#/components/schemas/indicator_properties_apm_availability' - $ref: '#/components/schemas/indicator_properties_apm_latency' - $ref: '#/components/schemas/indicator_properties_custom_metric' - $ref: '#/components/schemas/indicator_properties_histogram' + - $ref: '#/components/schemas/indicator_properties_timeslice_metric' timeWindow: $ref: '#/components/schemas/time_window' budgetingMethod: @@ -979,6 +1179,11 @@ components: description: the value derived from the groupBy field, if present, otherwise '*' type: string example: host-abcde + tags: + description: List of tags + type: array + items: + type: string createdAt: description: The creation date type: string @@ -1104,6 +1309,7 @@ components: - $ref: '#/components/schemas/indicator_properties_apm_latency' - $ref: '#/components/schemas/indicator_properties_custom_metric' - $ref: '#/components/schemas/indicator_properties_histogram' + - $ref: '#/components/schemas/indicator_properties_timeslice_metric' timeWindow: $ref: '#/components/schemas/time_window' budgetingMethod: @@ -1116,6 +1322,11 @@ components: description: optional group by field to use to generate an SLO per distinct value type: string example: some.field + tags: + description: List of tags + type: array + items: + type: string create_slo_response: title: Create SLO response type: object @@ -1161,6 +1372,7 @@ components: - $ref: '#/components/schemas/indicator_properties_apm_latency' - $ref: '#/components/schemas/indicator_properties_custom_metric' - $ref: '#/components/schemas/indicator_properties_histogram' + - $ref: '#/components/schemas/indicator_properties_timeslice_metric' timeWindow: $ref: '#/components/schemas/time_window' budgetingMethod: @@ -1169,13 +1381,18 @@ components: $ref: '#/components/schemas/objective' settings: $ref: '#/components/schemas/settings' + tags: + description: List of tags + type: array + items: + type: string historical_summary_request: title: Historical summary request type: object required: - - sloIds + - list properties: - sloIds: + list: description: The list of SLO identifiers to get the historical summary for type: array items: @@ -1199,3 +1416,28 @@ components: example: 0.9836 errorBudget: $ref: '#/components/schemas/error_budget' + delete_slo_instances_request: + title: Delete SLO instances request + description: | + The delete SLO instances request takes a list of SLO id and instance id, then delete the rollup and summary data. This API can be used to remove the staled data of an instance SLO that no longer get updated. + type: object + required: + - list + properties: + list: + description: An array of slo id and instance id + type: array + items: + type: object + required: + - sloId + - instanceId + properties: + sloId: + description: The SLO unique identifier + type: string + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + instanceId: + description: The SLO instance identifier + type: string + example: 8853df00-ae2e-11ed-90af-09bb6422b258 diff --git a/generated/slo/.openapi-generator/FILES b/generated/slo/.openapi-generator/FILES index 5d1ca5c6e..6c78451d1 100644 --- a/generated/slo/.openapi-generator/FILES +++ b/generated/slo/.openapi-generator/FILES @@ -10,6 +10,8 @@ docs/BudgetingMethod.md docs/CreateSloRequest.md docs/CreateSloRequestIndicator.md docs/CreateSloResponse.md +docs/DeleteSloInstancesRequest.md +docs/DeleteSloInstancesRequestListInner.md docs/ErrorBudget.md docs/FindSloResponse.md docs/HistoricalSummaryRequest.md @@ -30,6 +32,10 @@ docs/IndicatorPropertiesHistogram.md docs/IndicatorPropertiesHistogramParams.md docs/IndicatorPropertiesHistogramParamsGood.md docs/IndicatorPropertiesHistogramParamsTotal.md +docs/IndicatorPropertiesTimesliceMetric.md +docs/IndicatorPropertiesTimesliceMetricParams.md +docs/IndicatorPropertiesTimesliceMetricParamsMetric.md +docs/IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner.md docs/Model400Response.md docs/Model401Response.md docs/Model403Response.md @@ -43,6 +49,9 @@ docs/SloResponseIndicator.md docs/Summary.md docs/SummaryStatus.md docs/TimeWindow.md +docs/TimesliceMetricBasicMetricWithField.md +docs/TimesliceMetricDocCountMetric.md +docs/TimesliceMetricPercentileMetric.md docs/UpdateSloRequest.md git_push.sh go.mod @@ -56,6 +65,8 @@ model_budgeting_method.go model_create_slo_request.go model_create_slo_request_indicator.go model_create_slo_response.go +model_delete_slo_instances_request.go +model_delete_slo_instances_request_list_inner.go model_error_budget.go model_find_slo_response.go model_historical_summary_request.go @@ -76,6 +87,10 @@ model_indicator_properties_histogram.go model_indicator_properties_histogram_params.go model_indicator_properties_histogram_params_good.go model_indicator_properties_histogram_params_total.go +model_indicator_properties_timeslice_metric.go +model_indicator_properties_timeslice_metric_params.go +model_indicator_properties_timeslice_metric_params_metric.go +model_indicator_properties_timeslice_metric_params_metric_metrics_inner.go model_objective.go model_settings.go model_slo_response.go @@ -83,6 +98,9 @@ model_slo_response_indicator.go model_summary.go model_summary_status.go model_time_window.go +model_timeslice_metric_basic_metric_with_field.go +model_timeslice_metric_doc_count_metric.go +model_timeslice_metric_percentile_metric.go model_update_slo_request.go response.go test/api_slo_test.go diff --git a/generated/slo/README.md b/generated/slo/README.md index 45d046cce..cea692cc2 100644 --- a/generated/slo/README.md +++ b/generated/slo/README.md @@ -78,6 +78,7 @@ All URIs are relative to *http://localhost:5601* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *SloAPI* | [**CreateSloOp**](docs/SloAPI.md#createsloop) | **Post** /s/{spaceId}/api/observability/slos | Creates an SLO. +*SloAPI* | [**DeleteSloInstancesOp**](docs/SloAPI.md#deletesloinstancesop) | **Post** /s/{spaceId}/api/observability/slos/_delete_instances | Batch delete rollup and summary data for the matching list of sloId and instanceId *SloAPI* | [**DeleteSloOp**](docs/SloAPI.md#deletesloop) | **Delete** /s/{spaceId}/api/observability/slos/{sloId} | Deletes an SLO *SloAPI* | [**DisableSloOp**](docs/SloAPI.md#disablesloop) | **Post** /s/{spaceId}/api/observability/slos/{sloId}/disable | Disables an SLO *SloAPI* | [**EnableSloOp**](docs/SloAPI.md#enablesloop) | **Post** /s/{spaceId}/api/observability/slos/{sloId}/enable | Enables an SLO @@ -93,6 +94,8 @@ Class | Method | HTTP request | Description - [CreateSloRequest](docs/CreateSloRequest.md) - [CreateSloRequestIndicator](docs/CreateSloRequestIndicator.md) - [CreateSloResponse](docs/CreateSloResponse.md) + - [DeleteSloInstancesRequest](docs/DeleteSloInstancesRequest.md) + - [DeleteSloInstancesRequestListInner](docs/DeleteSloInstancesRequestListInner.md) - [ErrorBudget](docs/ErrorBudget.md) - [FindSloResponse](docs/FindSloResponse.md) - [HistoricalSummaryRequest](docs/HistoricalSummaryRequest.md) @@ -113,6 +116,10 @@ Class | Method | HTTP request | Description - [IndicatorPropertiesHistogramParams](docs/IndicatorPropertiesHistogramParams.md) - [IndicatorPropertiesHistogramParamsGood](docs/IndicatorPropertiesHistogramParamsGood.md) - [IndicatorPropertiesHistogramParamsTotal](docs/IndicatorPropertiesHistogramParamsTotal.md) + - [IndicatorPropertiesTimesliceMetric](docs/IndicatorPropertiesTimesliceMetric.md) + - [IndicatorPropertiesTimesliceMetricParams](docs/IndicatorPropertiesTimesliceMetricParams.md) + - [IndicatorPropertiesTimesliceMetricParamsMetric](docs/IndicatorPropertiesTimesliceMetricParamsMetric.md) + - [IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner](docs/IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner.md) - [Model400Response](docs/Model400Response.md) - [Model401Response](docs/Model401Response.md) - [Model403Response](docs/Model403Response.md) @@ -125,6 +132,9 @@ Class | Method | HTTP request | Description - [Summary](docs/Summary.md) - [SummaryStatus](docs/SummaryStatus.md) - [TimeWindow](docs/TimeWindow.md) + - [TimesliceMetricBasicMetricWithField](docs/TimesliceMetricBasicMetricWithField.md) + - [TimesliceMetricDocCountMetric](docs/TimesliceMetricDocCountMetric.md) + - [TimesliceMetricPercentileMetric](docs/TimesliceMetricPercentileMetric.md) - [UpdateSloRequest](docs/UpdateSloRequest.md) @@ -149,10 +159,10 @@ r, err := client.Service.Operation(auth, args) ### apiKeyAuth - **Type**: API key -- **API key parameter name**: ApiKey +- **API key parameter name**: Authorization - **Location**: HTTP header -Note, each API key must be added to a map of `map[string]APIKey` where the key is: ApiKey and passed in as the auth context for each request. +Note, each API key must be added to a map of `map[string]APIKey` where the key is: Authorization and passed in as the auth context for each request. Example @@ -161,7 +171,7 @@ auth := context.WithValue( context.Background(), sw.ContextAPIKeys, map[string]sw.APIKey{ - "ApiKey": {Key: "API_KEY_STRING"}, + "Authorization": {Key: "API_KEY_STRING"}, }, ) r, err := client.Service.Operation(auth, args) diff --git a/generated/slo/api/openapi.yaml b/generated/slo/api/openapi.yaml index a3cd384b2..d2796a419 100644 --- a/generated/slo/api/openapi.yaml +++ b/generated/slo/api/openapi.yaml @@ -17,9 +17,6 @@ security: tags: - description: "SLO APIs enable you to define, manage and track service-level objectives" name: slo -- description: "Composite SLO APIs enable you to define, manage and track a group\ - \ of SLOs." - name: composite slo paths: /s/{spaceId}/api/observability/slos: get: @@ -72,6 +69,7 @@ paths: required: false schema: default: 25 + maximum: 5000 type: integer style: form - description: Sort by field @@ -595,6 +593,63 @@ paths: summary: Retrieves the historical summary for a list of SLOs tags: - slo + /s/{spaceId}/api/observability/slos/_delete_instances: + post: + description: | + You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + operationId: deleteSloInstancesOp + parameters: + - description: Cross-site request forgery protection + explode: false + in: header + name: kbn-xsrf + required: true + schema: + type: string + style: simple + - description: "An identifier for the space. If `/s/` and the identifier are\ + \ omitted from the path, the default space is used." + explode: false + in: path + name: spaceId + required: true + schema: + example: default + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/delete_slo_instances_request' + required: true + responses: + "204": + description: Successful request + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' + description: Bad request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/401_response' + description: Unauthorized response + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' + description: Unauthorized response + servers: + - url: https://localhost:5601 + summary: Batch delete rollup and summary data for the matching list of sloId + and instanceId + tags: + - slo components: parameters: kbn_xsrf: @@ -698,6 +753,107 @@ components: - type title: Histogram indicator type: object + timeslice_metric_basic_metric_with_field: + properties: + name: + description: The name of the metric. Only valid options are A-Z + example: A + pattern: "^[A-Z]$" + type: string + aggregation: + description: The aggregation type of the metric. + enum: + - sum + - avg + - min + - max + - std_deviation + - last_value + - cardinality + example: sum + type: string + field: + description: The field of the metric. + example: processor.processed + type: string + filter: + description: The filter to apply to the metric. + example: "processor.outcome: \"success\"" + type: string + required: + - aggregation + - field + - name + title: Timeslice Metric Basic Metric with Field + type: object + timeslice_metric_percentile_metric: + properties: + name: + description: The name of the metric. Only valid options are A-Z + example: A + pattern: "^[A-Z]$" + type: string + aggregation: + description: The aggregation type of the metric. Only valid option is "percentile" + enum: + - percentile + example: percentile + type: string + field: + description: The field of the metric. + example: processor.processed + type: string + percentile: + description: The percentile value. + example: 95 + type: number + filter: + description: The filter to apply to the metric. + example: "processor.outcome: \"success\"" + type: string + required: + - aggregation + - field + - name + - percentile + title: Timeslice Metric Percentile Metric + type: object + timeslice_metric_doc_count_metric: + properties: + name: + description: The name of the metric. Only valid options are A-Z + example: A + pattern: "^[A-Z]$" + type: string + aggregation: + description: The aggregation type of the metric. Only valid option is "doc_count" + enum: + - doc_count + example: doc_count + type: string + filter: + description: The filter to apply to the metric. + example: "processor.outcome: \"success\"" + type: string + required: + - aggregation + - name + title: Timeslice Metric Doc Count Metric + type: object + indicator_properties_timeslice_metric: + description: Defines properties for a timeslice metric indicator type + properties: + params: + $ref: '#/components/schemas/indicator_properties_timeslice_metric_params' + type: + description: The type of indicator. + example: sli.metric.timeslice + type: string + required: + - params + - type + title: Timeslice metric + type: object time_window: description: Defines properties for the SLO time window example: @@ -863,6 +1019,9 @@ components: timesliceTarget: 0.995 target: 0.99 revision: 2 + tags: + - tags + - tags createdAt: 2023-01-12T10:03:19.000Z instanceId: host-abcde name: My Service SLO @@ -912,6 +1071,11 @@ components: \ '*'" example: host-abcde type: string + tags: + description: List of tags + items: + type: string + type: array createdAt: description: The creation date example: 2023-01-12T10:03:19.000Z @@ -934,6 +1098,7 @@ components: - revision - settings - summary + - tags - timeWindow - updatedAt title: SLO response @@ -969,6 +1134,9 @@ components: timesliceTarget: 0.995 target: 0.99 revision: 2 + tags: + - tags + - tags createdAt: 2023-01-12T10:03:19.000Z instanceId: host-abcde name: My Service SLO @@ -998,6 +1166,9 @@ components: timesliceTarget: 0.995 target: 0.99 revision: 2 + tags: + - tags + - tags createdAt: 2023-01-12T10:03:19.000Z instanceId: host-abcde name: My Service SLO @@ -1122,6 +1293,11 @@ components: value example: some.field type: string + tags: + description: List of tags + items: + type: string + type: array required: - budgetingMethod - description @@ -1179,18 +1355,23 @@ components: $ref: '#/components/schemas/objective' settings: $ref: '#/components/schemas/settings' + tags: + description: List of tags + items: + type: string + type: array title: Update SLO request type: object historical_summary_request: properties: - sloIds: + list: description: The list of SLO identifiers to get the historical summary for items: example: 8853df00-ae2e-11ed-90af-09bb6422b258 type: string type: array required: - - sloIds + - list title: Historical summary request type: object historical_summary_response: @@ -1200,6 +1381,19 @@ components: type: array title: Historical summary response type: object + delete_slo_instances_request: + description: | + The delete SLO instances request takes a list of SLO id and instance id, then delete the rollup and summary data. This API can be used to remove the staled data of an instance SLO that no longer get updated. + properties: + list: + description: An array of slo id and instance id + items: + $ref: '#/components/schemas/delete_slo_instances_request_list_inner' + type: array + required: + - list + title: Delete SLO instances request + type: object indicator_properties_apm_availability_params: description: An object containing the indicator parameters. nullable: false @@ -1261,8 +1455,10 @@ components: example: timestamp type: string required: + - good - index - timestampField + - total type: object indicator_properties_apm_latency_params: description: An object containing the indicator parameters. @@ -1412,7 +1608,6 @@ components: total: $ref: '#/components/schemas/indicator_properties_custom_metric_params_total' required: - - filter - good - index - timestampField @@ -1509,6 +1704,68 @@ components: - timestampField - total type: object + indicator_properties_timeslice_metric_params_metric_metrics_inner: + anyOf: + - $ref: '#/components/schemas/timeslice_metric_basic_metric_with_field' + - $ref: '#/components/schemas/timeslice_metric_percentile_metric' + - $ref: '#/components/schemas/timeslice_metric_doc_count_metric' + indicator_properties_timeslice_metric_params_metric: + description: | + An object defining the metrics, equation, and threshold to determine if it's a good slice or not + properties: + metrics: + description: "List of metrics with their name, aggregation type, and field." + items: + $ref: '#/components/schemas/indicator_properties_timeslice_metric_params_metric_metrics_inner' + type: array + equation: + description: The equation to calculate the metric. + example: A + type: string + comparator: + description: The comparator to use to compare the equation to the threshold. + enum: + - GT + - GTE + - LT + - LTE + example: GT + type: string + threshold: + description: The threshold used to determine if the metric is a good slice + or not. + example: 100 + type: number + required: + - comparator + - equation + - metrics + - threshold + type: object + indicator_properties_timeslice_metric_params: + description: An object containing the indicator parameters. + nullable: false + properties: + index: + description: The index or index pattern to use + example: my-service-* + type: string + filter: + description: the KQL query to filter the documents with. + example: "field.environment : \"production\" and service.name : \"my-service\"" + type: string + timestampField: + description: | + The timestamp field used in the source indice. + example: timestamp + type: string + metric: + $ref: '#/components/schemas/indicator_properties_timeslice_metric_params_metric' + required: + - index + - metric + - timestampField + type: object slo_response_indicator: discriminator: mapping: @@ -1517,6 +1774,7 @@ components: sli.apm.transactionDuration: '#/components/schemas/indicator_properties_apm_latency' sli.metric.custom: '#/components/schemas/indicator_properties_custom_metric' sli.histogram.custom: '#/components/schemas/indicator_properties_histogram' + sli.metric.timeslice: '#/components/schemas/indicator_properties_timeslice_metric' propertyName: type oneOf: - $ref: '#/components/schemas/indicator_properties_custom_kql' @@ -1524,6 +1782,7 @@ components: - $ref: '#/components/schemas/indicator_properties_apm_latency' - $ref: '#/components/schemas/indicator_properties_custom_metric' - $ref: '#/components/schemas/indicator_properties_histogram' + - $ref: '#/components/schemas/indicator_properties_timeslice_metric' create_slo_request_indicator: oneOf: - $ref: '#/components/schemas/indicator_properties_custom_kql' @@ -1531,6 +1790,7 @@ components: - $ref: '#/components/schemas/indicator_properties_apm_latency' - $ref: '#/components/schemas/indicator_properties_custom_metric' - $ref: '#/components/schemas/indicator_properties_histogram' + - $ref: '#/components/schemas/indicator_properties_timeslice_metric' Historical_summary_response_inner: properties: date: @@ -1544,11 +1804,26 @@ components: errorBudget: $ref: '#/components/schemas/error_budget' type: object + delete_slo_instances_request_list_inner: + properties: + sloId: + description: The SLO unique identifier + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + type: string + instanceId: + description: The SLO instance identifier + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + type: string + required: + - instanceId + - sloId + type: object securitySchemes: basicAuth: scheme: basic type: http apiKeyAuth: + description: "e.g. Authorization: ApiKey base64AccessApiKey" in: header name: Authorization type: apiKey diff --git a/generated/slo/api_slo.go b/generated/slo/api_slo.go index 31d8c4ada..bd95b7880 100644 --- a/generated/slo/api_slo.go +++ b/generated/slo/api_slo.go @@ -37,6 +37,21 @@ type SloAPI interface { // @return CreateSloResponse CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloResponse, *http.Response, error) + /* + DeleteSloInstancesOp Batch delete rollup and summary data for the matching list of sloId and instanceId + + You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + @return ApiDeleteSloInstancesOpRequest + */ + DeleteSloInstancesOp(ctx context.Context, spaceId string) ApiDeleteSloInstancesOpRequest + + // DeleteSloInstancesOpExecute executes the request + DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpRequest) (*http.Response, error) + /* DeleteSloOp Deletes an SLO @@ -338,6 +353,166 @@ func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloR return localVarReturnValue, localVarHTTPResponse, nil } +type ApiDeleteSloInstancesOpRequest struct { + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string + deleteSloInstancesRequest *DeleteSloInstancesRequest +} + +// Cross-site request forgery protection +func (r ApiDeleteSloInstancesOpRequest) KbnXsrf(kbnXsrf string) ApiDeleteSloInstancesOpRequest { + r.kbnXsrf = &kbnXsrf + return r +} + +func (r ApiDeleteSloInstancesOpRequest) DeleteSloInstancesRequest(deleteSloInstancesRequest DeleteSloInstancesRequest) ApiDeleteSloInstancesOpRequest { + r.deleteSloInstancesRequest = &deleteSloInstancesRequest + return r +} + +func (r ApiDeleteSloInstancesOpRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteSloInstancesOpExecute(r) +} + +/* +DeleteSloInstancesOp Batch delete rollup and summary data for the matching list of sloId and instanceId + +You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + @return ApiDeleteSloInstancesOpRequest +*/ +func (a *SloAPIService) DeleteSloInstancesOp(ctx context.Context, spaceId string) ApiDeleteSloInstancesOpRequest { + return ApiDeleteSloInstancesOpRequest{ + ApiService: a, + ctx: ctx, + spaceId: spaceId, + } +} + +// Execute executes the request +func (a *SloAPIService) DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.DeleteSloInstancesOp") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/s/{spaceId}/api/observability/slos/_delete_instances" + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.kbnXsrf == nil { + return nil, reportError("kbnXsrf is required and must be specified") + } + if r.deleteSloInstancesRequest == nil { + return nil, reportError("deleteSloInstancesRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") + // body params + localVarPostBody = r.deleteSloInstancesRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Model400Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Model401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Model403Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + type ApiDeleteSloOpRequest struct { ctx context.Context ApiService SloAPI diff --git a/generated/slo/configuration.go b/generated/slo/configuration.go index 2bbd0944a..2df8d268c 100644 --- a/generated/slo/configuration.go +++ b/generated/slo/configuration.go @@ -107,6 +107,12 @@ func NewConfiguration() *Configuration { Description: "No description provided", }, }, + "SloAPIService.DeleteSloInstancesOp": { + { + URL: "https://localhost:5601", + Description: "No description provided", + }, + }, }, } return cfg diff --git a/generated/slo/docs/CreateSloRequest.md b/generated/slo/docs/CreateSloRequest.md index d3d11f2ec..c56190f41 100644 --- a/generated/slo/docs/CreateSloRequest.md +++ b/generated/slo/docs/CreateSloRequest.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **Objective** | [**Objective**](Objective.md) | | **Settings** | Pointer to [**Settings**](Settings.md) | | [optional] **GroupBy** | Pointer to **string** | optional group by field to use to generate an SLO per distinct value | [optional] +**Tags** | Pointer to **[]string** | List of tags | [optional] ## Methods @@ -228,6 +229,31 @@ SetGroupBy sets GroupBy field to given value. HasGroupBy returns a boolean if a field has been set. +### GetTags + +`func (o *CreateSloRequest) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *CreateSloRequest) GetTagsOk() (*[]string, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *CreateSloRequest) SetTags(v []string)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *CreateSloRequest) HasTags() bool` + +HasTags returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/slo/docs/CreateSloRequestIndicator.md b/generated/slo/docs/CreateSloRequestIndicator.md index 1075d6d1e..3be9942bb 100644 --- a/generated/slo/docs/CreateSloRequestIndicator.md +++ b/generated/slo/docs/CreateSloRequestIndicator.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Params** | [**IndicatorPropertiesHistogramParams**](IndicatorPropertiesHistogramParams.md) | | +**Params** | [**IndicatorPropertiesTimesliceMetricParams**](IndicatorPropertiesTimesliceMetricParams.md) | | **Type** | **string** | The type of indicator. | ## Methods ### NewCreateSloRequestIndicator -`func NewCreateSloRequestIndicator(params IndicatorPropertiesHistogramParams, type_ string, ) *CreateSloRequestIndicator` +`func NewCreateSloRequestIndicator(params IndicatorPropertiesTimesliceMetricParams, type_ string, ) *CreateSloRequestIndicator` NewCreateSloRequestIndicator instantiates a new CreateSloRequestIndicator object This constructor will assign default values to properties that have it defined, @@ -28,20 +28,20 @@ but it doesn't guarantee that properties required by API are set ### GetParams -`func (o *CreateSloRequestIndicator) GetParams() IndicatorPropertiesHistogramParams` +`func (o *CreateSloRequestIndicator) GetParams() IndicatorPropertiesTimesliceMetricParams` GetParams returns the Params field if non-nil, zero value otherwise. ### GetParamsOk -`func (o *CreateSloRequestIndicator) GetParamsOk() (*IndicatorPropertiesHistogramParams, bool)` +`func (o *CreateSloRequestIndicator) GetParamsOk() (*IndicatorPropertiesTimesliceMetricParams, bool)` GetParamsOk returns a tuple with the Params field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetParams -`func (o *CreateSloRequestIndicator) SetParams(v IndicatorPropertiesHistogramParams)` +`func (o *CreateSloRequestIndicator) SetParams(v IndicatorPropertiesTimesliceMetricParams)` SetParams sets Params field to given value. diff --git a/generated/slo/docs/DeleteSloInstancesRequest.md b/generated/slo/docs/DeleteSloInstancesRequest.md new file mode 100644 index 000000000..2b6b3636c --- /dev/null +++ b/generated/slo/docs/DeleteSloInstancesRequest.md @@ -0,0 +1,51 @@ +# DeleteSloInstancesRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**List** | [**[]DeleteSloInstancesRequestListInner**](DeleteSloInstancesRequestListInner.md) | An array of slo id and instance id | + +## Methods + +### NewDeleteSloInstancesRequest + +`func NewDeleteSloInstancesRequest(list []DeleteSloInstancesRequestListInner, ) *DeleteSloInstancesRequest` + +NewDeleteSloInstancesRequest instantiates a new DeleteSloInstancesRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewDeleteSloInstancesRequestWithDefaults + +`func NewDeleteSloInstancesRequestWithDefaults() *DeleteSloInstancesRequest` + +NewDeleteSloInstancesRequestWithDefaults instantiates a new DeleteSloInstancesRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetList + +`func (o *DeleteSloInstancesRequest) GetList() []DeleteSloInstancesRequestListInner` + +GetList returns the List field if non-nil, zero value otherwise. + +### GetListOk + +`func (o *DeleteSloInstancesRequest) GetListOk() (*[]DeleteSloInstancesRequestListInner, bool)` + +GetListOk returns a tuple with the List field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetList + +`func (o *DeleteSloInstancesRequest) SetList(v []DeleteSloInstancesRequestListInner)` + +SetList sets List field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/slo/docs/DeleteSloInstancesRequestListInner.md b/generated/slo/docs/DeleteSloInstancesRequestListInner.md new file mode 100644 index 000000000..c639bc6ab --- /dev/null +++ b/generated/slo/docs/DeleteSloInstancesRequestListInner.md @@ -0,0 +1,72 @@ +# DeleteSloInstancesRequestListInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SloId** | **string** | The SLO unique identifier | +**InstanceId** | **string** | The SLO instance identifier | + +## Methods + +### NewDeleteSloInstancesRequestListInner + +`func NewDeleteSloInstancesRequestListInner(sloId string, instanceId string, ) *DeleteSloInstancesRequestListInner` + +NewDeleteSloInstancesRequestListInner instantiates a new DeleteSloInstancesRequestListInner object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewDeleteSloInstancesRequestListInnerWithDefaults + +`func NewDeleteSloInstancesRequestListInnerWithDefaults() *DeleteSloInstancesRequestListInner` + +NewDeleteSloInstancesRequestListInnerWithDefaults instantiates a new DeleteSloInstancesRequestListInner object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetSloId + +`func (o *DeleteSloInstancesRequestListInner) GetSloId() string` + +GetSloId returns the SloId field if non-nil, zero value otherwise. + +### GetSloIdOk + +`func (o *DeleteSloInstancesRequestListInner) GetSloIdOk() (*string, bool)` + +GetSloIdOk returns a tuple with the SloId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSloId + +`func (o *DeleteSloInstancesRequestListInner) SetSloId(v string)` + +SetSloId sets SloId field to given value. + + +### GetInstanceId + +`func (o *DeleteSloInstancesRequestListInner) GetInstanceId() string` + +GetInstanceId returns the InstanceId field if non-nil, zero value otherwise. + +### GetInstanceIdOk + +`func (o *DeleteSloInstancesRequestListInner) GetInstanceIdOk() (*string, bool)` + +GetInstanceIdOk returns a tuple with the InstanceId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInstanceId + +`func (o *DeleteSloInstancesRequestListInner) SetInstanceId(v string)` + +SetInstanceId sets InstanceId field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/slo/docs/HistoricalSummaryRequest.md b/generated/slo/docs/HistoricalSummaryRequest.md index 5419095c5..c63ad83ec 100644 --- a/generated/slo/docs/HistoricalSummaryRequest.md +++ b/generated/slo/docs/HistoricalSummaryRequest.md @@ -4,13 +4,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**SloIds** | **[]string** | The list of SLO identifiers to get the historical summary for | +**List** | **[]string** | The list of SLO identifiers to get the historical summary for | ## Methods ### NewHistoricalSummaryRequest -`func NewHistoricalSummaryRequest(sloIds []string, ) *HistoricalSummaryRequest` +`func NewHistoricalSummaryRequest(list []string, ) *HistoricalSummaryRequest` NewHistoricalSummaryRequest instantiates a new HistoricalSummaryRequest object This constructor will assign default values to properties that have it defined, @@ -25,24 +25,24 @@ NewHistoricalSummaryRequestWithDefaults instantiates a new HistoricalSummaryRequ This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set -### GetSloIds +### GetList -`func (o *HistoricalSummaryRequest) GetSloIds() []string` +`func (o *HistoricalSummaryRequest) GetList() []string` -GetSloIds returns the SloIds field if non-nil, zero value otherwise. +GetList returns the List field if non-nil, zero value otherwise. -### GetSloIdsOk +### GetListOk -`func (o *HistoricalSummaryRequest) GetSloIdsOk() (*[]string, bool)` +`func (o *HistoricalSummaryRequest) GetListOk() (*[]string, bool)` -GetSloIdsOk returns a tuple with the SloIds field if it's non-nil, zero value otherwise +GetListOk returns a tuple with the List field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetSloIds +### SetList -`func (o *HistoricalSummaryRequest) SetSloIds(v []string)` +`func (o *HistoricalSummaryRequest) SetList(v []string)` -SetSloIds sets SloIds field to given value. +SetList sets List field to given value. diff --git a/generated/slo/docs/IndicatorPropertiesCustomKqlParams.md b/generated/slo/docs/IndicatorPropertiesCustomKqlParams.md index 8ddbe1dd1..317db1569 100644 --- a/generated/slo/docs/IndicatorPropertiesCustomKqlParams.md +++ b/generated/slo/docs/IndicatorPropertiesCustomKqlParams.md @@ -6,15 +6,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Index** | **string** | The index or index pattern to use | **Filter** | Pointer to **string** | the KQL query to filter the documents with. | [optional] -**Good** | Pointer to **string** | the KQL query used to define the good events. | [optional] -**Total** | Pointer to **string** | the KQL query used to define all events. | [optional] +**Good** | **string** | the KQL query used to define the good events. | +**Total** | **string** | the KQL query used to define all events. | **TimestampField** | **string** | The timestamp field used in the source indice. | ## Methods ### NewIndicatorPropertiesCustomKqlParams -`func NewIndicatorPropertiesCustomKqlParams(index string, timestampField string, ) *IndicatorPropertiesCustomKqlParams` +`func NewIndicatorPropertiesCustomKqlParams(index string, good string, total string, timestampField string, ) *IndicatorPropertiesCustomKqlParams` NewIndicatorPropertiesCustomKqlParams instantiates a new IndicatorPropertiesCustomKqlParams object This constructor will assign default values to properties that have it defined, @@ -93,11 +93,6 @@ and a boolean to check if the value has been set. SetGood sets Good field to given value. -### HasGood - -`func (o *IndicatorPropertiesCustomKqlParams) HasGood() bool` - -HasGood returns a boolean if a field has been set. ### GetTotal @@ -118,11 +113,6 @@ and a boolean to check if the value has been set. SetTotal sets Total field to given value. -### HasTotal - -`func (o *IndicatorPropertiesCustomKqlParams) HasTotal() bool` - -HasTotal returns a boolean if a field has been set. ### GetTimestampField diff --git a/generated/slo/docs/IndicatorPropertiesCustomMetricParams.md b/generated/slo/docs/IndicatorPropertiesCustomMetricParams.md index 4533a8eec..ea6814410 100644 --- a/generated/slo/docs/IndicatorPropertiesCustomMetricParams.md +++ b/generated/slo/docs/IndicatorPropertiesCustomMetricParams.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Index** | **string** | The index or index pattern to use | -**Filter** | **string** | the KQL query to filter the documents with. | +**Filter** | Pointer to **string** | the KQL query to filter the documents with. | [optional] **TimestampField** | **string** | The timestamp field used in the source indice. | **Good** | [**IndicatorPropertiesCustomMetricParamsGood**](IndicatorPropertiesCustomMetricParamsGood.md) | | **Total** | [**IndicatorPropertiesCustomMetricParamsTotal**](IndicatorPropertiesCustomMetricParamsTotal.md) | | @@ -14,7 +14,7 @@ Name | Type | Description | Notes ### NewIndicatorPropertiesCustomMetricParams -`func NewIndicatorPropertiesCustomMetricParams(index string, filter string, timestampField string, good IndicatorPropertiesCustomMetricParamsGood, total IndicatorPropertiesCustomMetricParamsTotal, ) *IndicatorPropertiesCustomMetricParams` +`func NewIndicatorPropertiesCustomMetricParams(index string, timestampField string, good IndicatorPropertiesCustomMetricParamsGood, total IndicatorPropertiesCustomMetricParamsTotal, ) *IndicatorPropertiesCustomMetricParams` NewIndicatorPropertiesCustomMetricParams instantiates a new IndicatorPropertiesCustomMetricParams object This constructor will assign default values to properties that have it defined, @@ -68,6 +68,11 @@ and a boolean to check if the value has been set. SetFilter sets Filter field to given value. +### HasFilter + +`func (o *IndicatorPropertiesCustomMetricParams) HasFilter() bool` + +HasFilter returns a boolean if a field has been set. ### GetTimestampField diff --git a/generated/slo/docs/IndicatorPropertiesTimesliceMetric.md b/generated/slo/docs/IndicatorPropertiesTimesliceMetric.md new file mode 100644 index 000000000..060553a65 --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesTimesliceMetric.md @@ -0,0 +1,72 @@ +# IndicatorPropertiesTimesliceMetric + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Params** | [**IndicatorPropertiesTimesliceMetricParams**](IndicatorPropertiesTimesliceMetricParams.md) | | +**Type** | **string** | The type of indicator. | + +## Methods + +### NewIndicatorPropertiesTimesliceMetric + +`func NewIndicatorPropertiesTimesliceMetric(params IndicatorPropertiesTimesliceMetricParams, type_ string, ) *IndicatorPropertiesTimesliceMetric` + +NewIndicatorPropertiesTimesliceMetric instantiates a new IndicatorPropertiesTimesliceMetric object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewIndicatorPropertiesTimesliceMetricWithDefaults + +`func NewIndicatorPropertiesTimesliceMetricWithDefaults() *IndicatorPropertiesTimesliceMetric` + +NewIndicatorPropertiesTimesliceMetricWithDefaults instantiates a new IndicatorPropertiesTimesliceMetric object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetParams + +`func (o *IndicatorPropertiesTimesliceMetric) GetParams() IndicatorPropertiesTimesliceMetricParams` + +GetParams returns the Params field if non-nil, zero value otherwise. + +### GetParamsOk + +`func (o *IndicatorPropertiesTimesliceMetric) GetParamsOk() (*IndicatorPropertiesTimesliceMetricParams, bool)` + +GetParamsOk returns a tuple with the Params field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetParams + +`func (o *IndicatorPropertiesTimesliceMetric) SetParams(v IndicatorPropertiesTimesliceMetricParams)` + +SetParams sets Params field to given value. + + +### GetType + +`func (o *IndicatorPropertiesTimesliceMetric) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *IndicatorPropertiesTimesliceMetric) GetTypeOk() (*string, bool)` + +GetTypeOk returns a tuple with the Type field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetType + +`func (o *IndicatorPropertiesTimesliceMetric) SetType(v string)` + +SetType sets Type field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/slo/docs/IndicatorPropertiesTimesliceMetricParams.md b/generated/slo/docs/IndicatorPropertiesTimesliceMetricParams.md new file mode 100644 index 000000000..ad08d9256 --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesTimesliceMetricParams.md @@ -0,0 +1,119 @@ +# IndicatorPropertiesTimesliceMetricParams + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Index** | **string** | The index or index pattern to use | +**Filter** | Pointer to **string** | the KQL query to filter the documents with. | [optional] +**TimestampField** | **string** | The timestamp field used in the source indice. | +**Metric** | [**IndicatorPropertiesTimesliceMetricParamsMetric**](IndicatorPropertiesTimesliceMetricParamsMetric.md) | | + +## Methods + +### NewIndicatorPropertiesTimesliceMetricParams + +`func NewIndicatorPropertiesTimesliceMetricParams(index string, timestampField string, metric IndicatorPropertiesTimesliceMetricParamsMetric, ) *IndicatorPropertiesTimesliceMetricParams` + +NewIndicatorPropertiesTimesliceMetricParams instantiates a new IndicatorPropertiesTimesliceMetricParams object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewIndicatorPropertiesTimesliceMetricParamsWithDefaults + +`func NewIndicatorPropertiesTimesliceMetricParamsWithDefaults() *IndicatorPropertiesTimesliceMetricParams` + +NewIndicatorPropertiesTimesliceMetricParamsWithDefaults instantiates a new IndicatorPropertiesTimesliceMetricParams object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIndex + +`func (o *IndicatorPropertiesTimesliceMetricParams) GetIndex() string` + +GetIndex returns the Index field if non-nil, zero value otherwise. + +### GetIndexOk + +`func (o *IndicatorPropertiesTimesliceMetricParams) GetIndexOk() (*string, bool)` + +GetIndexOk returns a tuple with the Index field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIndex + +`func (o *IndicatorPropertiesTimesliceMetricParams) SetIndex(v string)` + +SetIndex sets Index field to given value. + + +### GetFilter + +`func (o *IndicatorPropertiesTimesliceMetricParams) GetFilter() string` + +GetFilter returns the Filter field if non-nil, zero value otherwise. + +### GetFilterOk + +`func (o *IndicatorPropertiesTimesliceMetricParams) GetFilterOk() (*string, bool)` + +GetFilterOk returns a tuple with the Filter field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilter + +`func (o *IndicatorPropertiesTimesliceMetricParams) SetFilter(v string)` + +SetFilter sets Filter field to given value. + +### HasFilter + +`func (o *IndicatorPropertiesTimesliceMetricParams) HasFilter() bool` + +HasFilter returns a boolean if a field has been set. + +### GetTimestampField + +`func (o *IndicatorPropertiesTimesliceMetricParams) GetTimestampField() string` + +GetTimestampField returns the TimestampField field if non-nil, zero value otherwise. + +### GetTimestampFieldOk + +`func (o *IndicatorPropertiesTimesliceMetricParams) GetTimestampFieldOk() (*string, bool)` + +GetTimestampFieldOk returns a tuple with the TimestampField field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestampField + +`func (o *IndicatorPropertiesTimesliceMetricParams) SetTimestampField(v string)` + +SetTimestampField sets TimestampField field to given value. + + +### GetMetric + +`func (o *IndicatorPropertiesTimesliceMetricParams) GetMetric() IndicatorPropertiesTimesliceMetricParamsMetric` + +GetMetric returns the Metric field if non-nil, zero value otherwise. + +### GetMetricOk + +`func (o *IndicatorPropertiesTimesliceMetricParams) GetMetricOk() (*IndicatorPropertiesTimesliceMetricParamsMetric, bool)` + +GetMetricOk returns a tuple with the Metric field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMetric + +`func (o *IndicatorPropertiesTimesliceMetricParams) SetMetric(v IndicatorPropertiesTimesliceMetricParamsMetric)` + +SetMetric sets Metric field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/slo/docs/IndicatorPropertiesTimesliceMetricParamsMetric.md b/generated/slo/docs/IndicatorPropertiesTimesliceMetricParamsMetric.md new file mode 100644 index 000000000..ef5db5a51 --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesTimesliceMetricParamsMetric.md @@ -0,0 +1,114 @@ +# IndicatorPropertiesTimesliceMetricParamsMetric + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Metrics** | [**[]IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner**](IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner.md) | List of metrics with their name, aggregation type, and field. | +**Equation** | **string** | The equation to calculate the metric. | +**Comparator** | **string** | The comparator to use to compare the equation to the threshold. | +**Threshold** | **float64** | The threshold used to determine if the metric is a good slice or not. | + +## Methods + +### NewIndicatorPropertiesTimesliceMetricParamsMetric + +`func NewIndicatorPropertiesTimesliceMetricParamsMetric(metrics []IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner, equation string, comparator string, threshold float64, ) *IndicatorPropertiesTimesliceMetricParamsMetric` + +NewIndicatorPropertiesTimesliceMetricParamsMetric instantiates a new IndicatorPropertiesTimesliceMetricParamsMetric object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewIndicatorPropertiesTimesliceMetricParamsMetricWithDefaults + +`func NewIndicatorPropertiesTimesliceMetricParamsMetricWithDefaults() *IndicatorPropertiesTimesliceMetricParamsMetric` + +NewIndicatorPropertiesTimesliceMetricParamsMetricWithDefaults instantiates a new IndicatorPropertiesTimesliceMetricParamsMetric object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetMetrics + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetMetrics() []IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner` + +GetMetrics returns the Metrics field if non-nil, zero value otherwise. + +### GetMetricsOk + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetMetricsOk() (*[]IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner, bool)` + +GetMetricsOk returns a tuple with the Metrics field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMetrics + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetric) SetMetrics(v []IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner)` + +SetMetrics sets Metrics field to given value. + + +### GetEquation + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetEquation() string` + +GetEquation returns the Equation field if non-nil, zero value otherwise. + +### GetEquationOk + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetEquationOk() (*string, bool)` + +GetEquationOk returns a tuple with the Equation field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEquation + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetric) SetEquation(v string)` + +SetEquation sets Equation field to given value. + + +### GetComparator + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetComparator() string` + +GetComparator returns the Comparator field if non-nil, zero value otherwise. + +### GetComparatorOk + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetComparatorOk() (*string, bool)` + +GetComparatorOk returns a tuple with the Comparator field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetComparator + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetric) SetComparator(v string)` + +SetComparator sets Comparator field to given value. + + +### GetThreshold + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetThreshold() float64` + +GetThreshold returns the Threshold field if non-nil, zero value otherwise. + +### GetThresholdOk + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetThresholdOk() (*float64, bool)` + +GetThresholdOk returns a tuple with the Threshold field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetThreshold + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetric) SetThreshold(v float64)` + +SetThreshold sets Threshold field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/slo/docs/IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner.md b/generated/slo/docs/IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner.md new file mode 100644 index 000000000..876ee2a52 --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner.md @@ -0,0 +1,140 @@ +# IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | The name of the metric. Only valid options are A-Z | +**Aggregation** | **string** | The aggregation type of the metric. Only valid option is \"doc_count\" | +**Field** | **string** | The field of the metric. | +**Filter** | Pointer to **string** | The filter to apply to the metric. | [optional] +**Percentile** | **float64** | The percentile value. | + +## Methods + +### NewIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner + +`func NewIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner(name string, aggregation string, field string, percentile float64, ) *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner` + +NewIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner instantiates a new IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewIndicatorPropertiesTimesliceMetricParamsMetricMetricsInnerWithDefaults + +`func NewIndicatorPropertiesTimesliceMetricParamsMetricMetricsInnerWithDefaults() *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner` + +NewIndicatorPropertiesTimesliceMetricParamsMetricMetricsInnerWithDefaults instantiates a new IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) SetName(v string)` + +SetName sets Name field to given value. + + +### GetAggregation + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) GetAggregation() string` + +GetAggregation returns the Aggregation field if non-nil, zero value otherwise. + +### GetAggregationOk + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) GetAggregationOk() (*string, bool)` + +GetAggregationOk returns a tuple with the Aggregation field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAggregation + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) SetAggregation(v string)` + +SetAggregation sets Aggregation field to given value. + + +### GetField + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) GetField() string` + +GetField returns the Field field if non-nil, zero value otherwise. + +### GetFieldOk + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) GetFieldOk() (*string, bool)` + +GetFieldOk returns a tuple with the Field field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetField + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) SetField(v string)` + +SetField sets Field field to given value. + + +### GetFilter + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) GetFilter() string` + +GetFilter returns the Filter field if non-nil, zero value otherwise. + +### GetFilterOk + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) GetFilterOk() (*string, bool)` + +GetFilterOk returns a tuple with the Filter field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilter + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) SetFilter(v string)` + +SetFilter sets Filter field to given value. + +### HasFilter + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) HasFilter() bool` + +HasFilter returns a boolean if a field has been set. + +### GetPercentile + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) GetPercentile() float64` + +GetPercentile returns the Percentile field if non-nil, zero value otherwise. + +### GetPercentileOk + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) GetPercentileOk() (*float64, bool)` + +GetPercentileOk returns a tuple with the Percentile field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPercentile + +`func (o *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) SetPercentile(v float64)` + +SetPercentile sets Percentile field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/slo/docs/SloApi.md b/generated/slo/docs/SloApi.md index 1a9803832..7297aeebf 100644 --- a/generated/slo/docs/SloApi.md +++ b/generated/slo/docs/SloApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://localhost:5601* Method | HTTP request | Description ------------- | ------------- | ------------- [**CreateSloOp**](SloAPI.md#CreateSloOp) | **Post** /s/{spaceId}/api/observability/slos | Creates an SLO. +[**DeleteSloInstancesOp**](SloAPI.md#DeleteSloInstancesOp) | **Post** /s/{spaceId}/api/observability/slos/_delete_instances | Batch delete rollup and summary data for the matching list of sloId and instanceId [**DeleteSloOp**](SloAPI.md#DeleteSloOp) | **Delete** /s/{spaceId}/api/observability/slos/{sloId} | Deletes an SLO [**DisableSloOp**](SloAPI.md#DisableSloOp) | **Post** /s/{spaceId}/api/observability/slos/{sloId}/disable | Disables an SLO [**EnableSloOp**](SloAPI.md#EnableSloOp) | **Post** /s/{spaceId}/api/observability/slos/{sloId}/enable | Enables an SLO @@ -89,6 +90,78 @@ Name | Type | Description | Notes [[Back to README]](../README.md) +## DeleteSloInstancesOp + +> DeleteSloInstancesOp(ctx, spaceId).KbnXsrf(kbnXsrf).DeleteSloInstancesRequest(deleteSloInstancesRequest).Execute() + +Batch delete rollup and summary data for the matching list of sloId and instanceId + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/elastic/terraform-provider-elasticstack/slo" +) + +func main() { + kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection + spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + deleteSloInstancesRequest := *openapiclient.NewDeleteSloInstancesRequest([]openapiclient.DeleteSloInstancesRequestListInner{*openapiclient.NewDeleteSloInstancesRequestListInner("8853df00-ae2e-11ed-90af-09bb6422b258", "8853df00-ae2e-11ed-90af-09bb6422b258")}) // DeleteSloInstancesRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.SloAPI.DeleteSloInstancesOp(context.Background(), spaceId).KbnXsrf(kbnXsrf).DeleteSloInstancesRequest(deleteSloInstancesRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.DeleteSloInstancesOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteSloInstancesOpRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **kbnXsrf** | **string** | Cross-site request forgery protection | + + **deleteSloInstancesRequest** | [**DeleteSloInstancesRequest**](DeleteSloInstancesRequest.md) | | + +### Return type + + (empty response body) + +### Authorization + +[basicAuth](../README.md#basicAuth), [apiKeyAuth](../README.md#apiKeyAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## DeleteSloOp > DeleteSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).Execute() diff --git a/generated/slo/docs/SloResponse.md b/generated/slo/docs/SloResponse.md index 18d44159b..b3a1d6bda 100644 --- a/generated/slo/docs/SloResponse.md +++ b/generated/slo/docs/SloResponse.md @@ -17,6 +17,7 @@ Name | Type | Description | Notes **Enabled** | **bool** | Indicate if the SLO is enabled | **GroupBy** | **string** | optional group by field to use to generate an SLO per distinct value | **InstanceId** | **string** | the value derived from the groupBy field, if present, otherwise '*' | +**Tags** | **[]string** | List of tags | **CreatedAt** | **string** | The creation date | **UpdatedAt** | **string** | The last update date | @@ -24,7 +25,7 @@ Name | Type | Description | Notes ### NewSloResponse -`func NewSloResponse(id string, name string, description string, indicator SloResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float64, summary Summary, enabled bool, groupBy string, instanceId string, createdAt string, updatedAt string, ) *SloResponse` +`func NewSloResponse(id string, name string, description string, indicator SloResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float64, summary Summary, enabled bool, groupBy string, instanceId string, tags []string, createdAt string, updatedAt string, ) *SloResponse` NewSloResponse instantiates a new SloResponse object This constructor will assign default values to properties that have it defined, @@ -299,6 +300,26 @@ and a boolean to check if the value has been set. SetInstanceId sets InstanceId field to given value. +### GetTags + +`func (o *SloResponse) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *SloResponse) GetTagsOk() (*[]string, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *SloResponse) SetTags(v []string)` + +SetTags sets Tags field to given value. + + ### GetCreatedAt `func (o *SloResponse) GetCreatedAt() string` diff --git a/generated/slo/docs/SloResponseIndicator.md b/generated/slo/docs/SloResponseIndicator.md index 544a78320..0f3ea7851 100644 --- a/generated/slo/docs/SloResponseIndicator.md +++ b/generated/slo/docs/SloResponseIndicator.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Params** | [**IndicatorPropertiesHistogramParams**](IndicatorPropertiesHistogramParams.md) | | +**Params** | [**IndicatorPropertiesTimesliceMetricParams**](IndicatorPropertiesTimesliceMetricParams.md) | | **Type** | **string** | The type of indicator. | ## Methods ### NewSloResponseIndicator -`func NewSloResponseIndicator(params IndicatorPropertiesHistogramParams, type_ string, ) *SloResponseIndicator` +`func NewSloResponseIndicator(params IndicatorPropertiesTimesliceMetricParams, type_ string, ) *SloResponseIndicator` NewSloResponseIndicator instantiates a new SloResponseIndicator object This constructor will assign default values to properties that have it defined, @@ -28,20 +28,20 @@ but it doesn't guarantee that properties required by API are set ### GetParams -`func (o *SloResponseIndicator) GetParams() IndicatorPropertiesHistogramParams` +`func (o *SloResponseIndicator) GetParams() IndicatorPropertiesTimesliceMetricParams` GetParams returns the Params field if non-nil, zero value otherwise. ### GetParamsOk -`func (o *SloResponseIndicator) GetParamsOk() (*IndicatorPropertiesHistogramParams, bool)` +`func (o *SloResponseIndicator) GetParamsOk() (*IndicatorPropertiesTimesliceMetricParams, bool)` GetParamsOk returns a tuple with the Params field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetParams -`func (o *SloResponseIndicator) SetParams(v IndicatorPropertiesHistogramParams)` +`func (o *SloResponseIndicator) SetParams(v IndicatorPropertiesTimesliceMetricParams)` SetParams sets Params field to given value. diff --git a/generated/slo/docs/TimesliceMetricBasicMetricWithField.md b/generated/slo/docs/TimesliceMetricBasicMetricWithField.md new file mode 100644 index 000000000..8f3b920b4 --- /dev/null +++ b/generated/slo/docs/TimesliceMetricBasicMetricWithField.md @@ -0,0 +1,119 @@ +# TimesliceMetricBasicMetricWithField + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | The name of the metric. Only valid options are A-Z | +**Aggregation** | **string** | The aggregation type of the metric. | +**Field** | **string** | The field of the metric. | +**Filter** | Pointer to **string** | The filter to apply to the metric. | [optional] + +## Methods + +### NewTimesliceMetricBasicMetricWithField + +`func NewTimesliceMetricBasicMetricWithField(name string, aggregation string, field string, ) *TimesliceMetricBasicMetricWithField` + +NewTimesliceMetricBasicMetricWithField instantiates a new TimesliceMetricBasicMetricWithField object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTimesliceMetricBasicMetricWithFieldWithDefaults + +`func NewTimesliceMetricBasicMetricWithFieldWithDefaults() *TimesliceMetricBasicMetricWithField` + +NewTimesliceMetricBasicMetricWithFieldWithDefaults instantiates a new TimesliceMetricBasicMetricWithField object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *TimesliceMetricBasicMetricWithField) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *TimesliceMetricBasicMetricWithField) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *TimesliceMetricBasicMetricWithField) SetName(v string)` + +SetName sets Name field to given value. + + +### GetAggregation + +`func (o *TimesliceMetricBasicMetricWithField) GetAggregation() string` + +GetAggregation returns the Aggregation field if non-nil, zero value otherwise. + +### GetAggregationOk + +`func (o *TimesliceMetricBasicMetricWithField) GetAggregationOk() (*string, bool)` + +GetAggregationOk returns a tuple with the Aggregation field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAggregation + +`func (o *TimesliceMetricBasicMetricWithField) SetAggregation(v string)` + +SetAggregation sets Aggregation field to given value. + + +### GetField + +`func (o *TimesliceMetricBasicMetricWithField) GetField() string` + +GetField returns the Field field if non-nil, zero value otherwise. + +### GetFieldOk + +`func (o *TimesliceMetricBasicMetricWithField) GetFieldOk() (*string, bool)` + +GetFieldOk returns a tuple with the Field field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetField + +`func (o *TimesliceMetricBasicMetricWithField) SetField(v string)` + +SetField sets Field field to given value. + + +### GetFilter + +`func (o *TimesliceMetricBasicMetricWithField) GetFilter() string` + +GetFilter returns the Filter field if non-nil, zero value otherwise. + +### GetFilterOk + +`func (o *TimesliceMetricBasicMetricWithField) GetFilterOk() (*string, bool)` + +GetFilterOk returns a tuple with the Filter field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilter + +`func (o *TimesliceMetricBasicMetricWithField) SetFilter(v string)` + +SetFilter sets Filter field to given value. + +### HasFilter + +`func (o *TimesliceMetricBasicMetricWithField) HasFilter() bool` + +HasFilter returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/slo/docs/TimesliceMetricDocCountMetric.md b/generated/slo/docs/TimesliceMetricDocCountMetric.md new file mode 100644 index 000000000..fec89756e --- /dev/null +++ b/generated/slo/docs/TimesliceMetricDocCountMetric.md @@ -0,0 +1,98 @@ +# TimesliceMetricDocCountMetric + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | The name of the metric. Only valid options are A-Z | +**Aggregation** | **string** | The aggregation type of the metric. Only valid option is \"doc_count\" | +**Filter** | Pointer to **string** | The filter to apply to the metric. | [optional] + +## Methods + +### NewTimesliceMetricDocCountMetric + +`func NewTimesliceMetricDocCountMetric(name string, aggregation string, ) *TimesliceMetricDocCountMetric` + +NewTimesliceMetricDocCountMetric instantiates a new TimesliceMetricDocCountMetric object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTimesliceMetricDocCountMetricWithDefaults + +`func NewTimesliceMetricDocCountMetricWithDefaults() *TimesliceMetricDocCountMetric` + +NewTimesliceMetricDocCountMetricWithDefaults instantiates a new TimesliceMetricDocCountMetric object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *TimesliceMetricDocCountMetric) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *TimesliceMetricDocCountMetric) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *TimesliceMetricDocCountMetric) SetName(v string)` + +SetName sets Name field to given value. + + +### GetAggregation + +`func (o *TimesliceMetricDocCountMetric) GetAggregation() string` + +GetAggregation returns the Aggregation field if non-nil, zero value otherwise. + +### GetAggregationOk + +`func (o *TimesliceMetricDocCountMetric) GetAggregationOk() (*string, bool)` + +GetAggregationOk returns a tuple with the Aggregation field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAggregation + +`func (o *TimesliceMetricDocCountMetric) SetAggregation(v string)` + +SetAggregation sets Aggregation field to given value. + + +### GetFilter + +`func (o *TimesliceMetricDocCountMetric) GetFilter() string` + +GetFilter returns the Filter field if non-nil, zero value otherwise. + +### GetFilterOk + +`func (o *TimesliceMetricDocCountMetric) GetFilterOk() (*string, bool)` + +GetFilterOk returns a tuple with the Filter field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilter + +`func (o *TimesliceMetricDocCountMetric) SetFilter(v string)` + +SetFilter sets Filter field to given value. + +### HasFilter + +`func (o *TimesliceMetricDocCountMetric) HasFilter() bool` + +HasFilter returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/slo/docs/TimesliceMetricPercentileMetric.md b/generated/slo/docs/TimesliceMetricPercentileMetric.md new file mode 100644 index 000000000..2b873b06d --- /dev/null +++ b/generated/slo/docs/TimesliceMetricPercentileMetric.md @@ -0,0 +1,140 @@ +# TimesliceMetricPercentileMetric + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | The name of the metric. Only valid options are A-Z | +**Aggregation** | **string** | The aggregation type of the metric. Only valid option is \"percentile\" | +**Field** | **string** | The field of the metric. | +**Percentile** | **float64** | The percentile value. | +**Filter** | Pointer to **string** | The filter to apply to the metric. | [optional] + +## Methods + +### NewTimesliceMetricPercentileMetric + +`func NewTimesliceMetricPercentileMetric(name string, aggregation string, field string, percentile float64, ) *TimesliceMetricPercentileMetric` + +NewTimesliceMetricPercentileMetric instantiates a new TimesliceMetricPercentileMetric object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTimesliceMetricPercentileMetricWithDefaults + +`func NewTimesliceMetricPercentileMetricWithDefaults() *TimesliceMetricPercentileMetric` + +NewTimesliceMetricPercentileMetricWithDefaults instantiates a new TimesliceMetricPercentileMetric object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetName + +`func (o *TimesliceMetricPercentileMetric) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *TimesliceMetricPercentileMetric) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *TimesliceMetricPercentileMetric) SetName(v string)` + +SetName sets Name field to given value. + + +### GetAggregation + +`func (o *TimesliceMetricPercentileMetric) GetAggregation() string` + +GetAggregation returns the Aggregation field if non-nil, zero value otherwise. + +### GetAggregationOk + +`func (o *TimesliceMetricPercentileMetric) GetAggregationOk() (*string, bool)` + +GetAggregationOk returns a tuple with the Aggregation field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAggregation + +`func (o *TimesliceMetricPercentileMetric) SetAggregation(v string)` + +SetAggregation sets Aggregation field to given value. + + +### GetField + +`func (o *TimesliceMetricPercentileMetric) GetField() string` + +GetField returns the Field field if non-nil, zero value otherwise. + +### GetFieldOk + +`func (o *TimesliceMetricPercentileMetric) GetFieldOk() (*string, bool)` + +GetFieldOk returns a tuple with the Field field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetField + +`func (o *TimesliceMetricPercentileMetric) SetField(v string)` + +SetField sets Field field to given value. + + +### GetPercentile + +`func (o *TimesliceMetricPercentileMetric) GetPercentile() float64` + +GetPercentile returns the Percentile field if non-nil, zero value otherwise. + +### GetPercentileOk + +`func (o *TimesliceMetricPercentileMetric) GetPercentileOk() (*float64, bool)` + +GetPercentileOk returns a tuple with the Percentile field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPercentile + +`func (o *TimesliceMetricPercentileMetric) SetPercentile(v float64)` + +SetPercentile sets Percentile field to given value. + + +### GetFilter + +`func (o *TimesliceMetricPercentileMetric) GetFilter() string` + +GetFilter returns the Filter field if non-nil, zero value otherwise. + +### GetFilterOk + +`func (o *TimesliceMetricPercentileMetric) GetFilterOk() (*string, bool)` + +GetFilterOk returns a tuple with the Filter field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFilter + +`func (o *TimesliceMetricPercentileMetric) SetFilter(v string)` + +SetFilter sets Filter field to given value. + +### HasFilter + +`func (o *TimesliceMetricPercentileMetric) HasFilter() bool` + +HasFilter returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/slo/docs/UpdateSloRequest.md b/generated/slo/docs/UpdateSloRequest.md index e228b7e32..31065689a 100644 --- a/generated/slo/docs/UpdateSloRequest.md +++ b/generated/slo/docs/UpdateSloRequest.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **BudgetingMethod** | Pointer to [**BudgetingMethod**](BudgetingMethod.md) | | [optional] **Objective** | Pointer to [**Objective**](Objective.md) | | [optional] **Settings** | Pointer to [**Settings**](Settings.md) | | [optional] +**Tags** | Pointer to **[]string** | List of tags | [optional] ## Methods @@ -206,6 +207,31 @@ SetSettings sets Settings field to given value. HasSettings returns a boolean if a field has been set. +### GetTags + +`func (o *UpdateSloRequest) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *UpdateSloRequest) GetTagsOk() (*[]string, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *UpdateSloRequest) SetTags(v []string)` + +SetTags sets Tags field to given value. + +### HasTags + +`func (o *UpdateSloRequest) HasTags() bool` + +HasTags returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/generated/slo/model_create_slo_request.go b/generated/slo/model_create_slo_request.go index 9b14cb3fa..b96f904a4 100644 --- a/generated/slo/model_create_slo_request.go +++ b/generated/slo/model_create_slo_request.go @@ -32,6 +32,8 @@ type CreateSloRequest struct { Settings *Settings `json:"settings,omitempty"` // optional group by field to use to generate an SLO per distinct value GroupBy *string `json:"groupBy,omitempty"` + // List of tags + Tags []string `json:"tags,omitempty"` } // NewCreateSloRequest instantiates a new CreateSloRequest object @@ -297,6 +299,38 @@ func (o *CreateSloRequest) SetGroupBy(v string) { o.GroupBy = &v } +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *CreateSloRequest) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSloRequest) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *CreateSloRequest) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *CreateSloRequest) SetTags(v []string) { + o.Tags = v +} + func (o CreateSloRequest) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -322,6 +356,9 @@ func (o CreateSloRequest) ToMap() (map[string]interface{}, error) { if !IsNil(o.GroupBy) { toSerialize["groupBy"] = o.GroupBy } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } return toSerialize, nil } diff --git a/generated/slo/model_create_slo_request_indicator.go b/generated/slo/model_create_slo_request_indicator.go index 1ad246ded..56c4975b2 100644 --- a/generated/slo/model_create_slo_request_indicator.go +++ b/generated/slo/model_create_slo_request_indicator.go @@ -22,6 +22,7 @@ type CreateSloRequestIndicator struct { IndicatorPropertiesCustomKql *IndicatorPropertiesCustomKql IndicatorPropertiesCustomMetric *IndicatorPropertiesCustomMetric IndicatorPropertiesHistogram *IndicatorPropertiesHistogram + IndicatorPropertiesTimesliceMetric *IndicatorPropertiesTimesliceMetric } // IndicatorPropertiesApmAvailabilityAsCreateSloRequestIndicator is a convenience function that returns IndicatorPropertiesApmAvailability wrapped in CreateSloRequestIndicator @@ -59,6 +60,13 @@ func IndicatorPropertiesHistogramAsCreateSloRequestIndicator(v *IndicatorPropert } } +// IndicatorPropertiesTimesliceMetricAsCreateSloRequestIndicator is a convenience function that returns IndicatorPropertiesTimesliceMetric wrapped in CreateSloRequestIndicator +func IndicatorPropertiesTimesliceMetricAsCreateSloRequestIndicator(v *IndicatorPropertiesTimesliceMetric) CreateSloRequestIndicator { + return CreateSloRequestIndicator{ + IndicatorPropertiesTimesliceMetric: v, + } +} + // Unmarshal JSON data into one of the pointers in the struct func (dst *CreateSloRequestIndicator) UnmarshalJSON(data []byte) error { var err error @@ -128,6 +136,19 @@ func (dst *CreateSloRequestIndicator) UnmarshalJSON(data []byte) error { dst.IndicatorPropertiesHistogram = nil } + // try to unmarshal data into IndicatorPropertiesTimesliceMetric + err = json.Unmarshal(data, &dst.IndicatorPropertiesTimesliceMetric) + if err == nil { + jsonIndicatorPropertiesTimesliceMetric, _ := json.Marshal(dst.IndicatorPropertiesTimesliceMetric) + if string(jsonIndicatorPropertiesTimesliceMetric) == "{}" { // empty struct + dst.IndicatorPropertiesTimesliceMetric = nil + } else { + match++ + } + } else { + dst.IndicatorPropertiesTimesliceMetric = nil + } + if match > 1 { // more than 1 match // reset to nil dst.IndicatorPropertiesApmAvailability = nil @@ -135,6 +156,7 @@ func (dst *CreateSloRequestIndicator) UnmarshalJSON(data []byte) error { dst.IndicatorPropertiesCustomKql = nil dst.IndicatorPropertiesCustomMetric = nil dst.IndicatorPropertiesHistogram = nil + dst.IndicatorPropertiesTimesliceMetric = nil return fmt.Errorf("data matches more than one schema in oneOf(CreateSloRequestIndicator)") } else if match == 1 { @@ -166,6 +188,10 @@ func (src CreateSloRequestIndicator) MarshalJSON() ([]byte, error) { return json.Marshal(&src.IndicatorPropertiesHistogram) } + if src.IndicatorPropertiesTimesliceMetric != nil { + return json.Marshal(&src.IndicatorPropertiesTimesliceMetric) + } + return nil, nil // no data in oneOf schemas } @@ -194,6 +220,10 @@ func (obj *CreateSloRequestIndicator) GetActualInstance() interface{} { return obj.IndicatorPropertiesHistogram } + if obj.IndicatorPropertiesTimesliceMetric != nil { + return obj.IndicatorPropertiesTimesliceMetric + } + // all schemas are nil return nil } diff --git a/generated/slo/model_delete_slo_instances_request.go b/generated/slo/model_delete_slo_instances_request.go new file mode 100644 index 000000000..a8a4be95f --- /dev/null +++ b/generated/slo/model_delete_slo_instances_request.go @@ -0,0 +1,116 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the DeleteSloInstancesRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeleteSloInstancesRequest{} + +// DeleteSloInstancesRequest The delete SLO instances request takes a list of SLO id and instance id, then delete the rollup and summary data. This API can be used to remove the staled data of an instance SLO that no longer get updated. +type DeleteSloInstancesRequest struct { + // An array of slo id and instance id + List []DeleteSloInstancesRequestListInner `json:"list"` +} + +// NewDeleteSloInstancesRequest instantiates a new DeleteSloInstancesRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeleteSloInstancesRequest(list []DeleteSloInstancesRequestListInner) *DeleteSloInstancesRequest { + this := DeleteSloInstancesRequest{} + this.List = list + return &this +} + +// NewDeleteSloInstancesRequestWithDefaults instantiates a new DeleteSloInstancesRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeleteSloInstancesRequestWithDefaults() *DeleteSloInstancesRequest { + this := DeleteSloInstancesRequest{} + return &this +} + +// GetList returns the List field value +func (o *DeleteSloInstancesRequest) GetList() []DeleteSloInstancesRequestListInner { + if o == nil { + var ret []DeleteSloInstancesRequestListInner + return ret + } + + return o.List +} + +// GetListOk returns a tuple with the List field value +// and a boolean to check if the value has been set. +func (o *DeleteSloInstancesRequest) GetListOk() ([]DeleteSloInstancesRequestListInner, bool) { + if o == nil { + return nil, false + } + return o.List, true +} + +// SetList sets field value +func (o *DeleteSloInstancesRequest) SetList(v []DeleteSloInstancesRequestListInner) { + o.List = v +} + +func (o DeleteSloInstancesRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeleteSloInstancesRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["list"] = o.List + return toSerialize, nil +} + +type NullableDeleteSloInstancesRequest struct { + value *DeleteSloInstancesRequest + isSet bool +} + +func (v NullableDeleteSloInstancesRequest) Get() *DeleteSloInstancesRequest { + return v.value +} + +func (v *NullableDeleteSloInstancesRequest) Set(val *DeleteSloInstancesRequest) { + v.value = val + v.isSet = true +} + +func (v NullableDeleteSloInstancesRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableDeleteSloInstancesRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeleteSloInstancesRequest(val *DeleteSloInstancesRequest) *NullableDeleteSloInstancesRequest { + return &NullableDeleteSloInstancesRequest{value: val, isSet: true} +} + +func (v NullableDeleteSloInstancesRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeleteSloInstancesRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_delete_slo_instances_request_list_inner.go b/generated/slo/model_delete_slo_instances_request_list_inner.go new file mode 100644 index 000000000..22694c856 --- /dev/null +++ b/generated/slo/model_delete_slo_instances_request_list_inner.go @@ -0,0 +1,144 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the DeleteSloInstancesRequestListInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeleteSloInstancesRequestListInner{} + +// DeleteSloInstancesRequestListInner struct for DeleteSloInstancesRequestListInner +type DeleteSloInstancesRequestListInner struct { + // The SLO unique identifier + SloId string `json:"sloId"` + // The SLO instance identifier + InstanceId string `json:"instanceId"` +} + +// NewDeleteSloInstancesRequestListInner instantiates a new DeleteSloInstancesRequestListInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeleteSloInstancesRequestListInner(sloId string, instanceId string) *DeleteSloInstancesRequestListInner { + this := DeleteSloInstancesRequestListInner{} + this.SloId = sloId + this.InstanceId = instanceId + return &this +} + +// NewDeleteSloInstancesRequestListInnerWithDefaults instantiates a new DeleteSloInstancesRequestListInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeleteSloInstancesRequestListInnerWithDefaults() *DeleteSloInstancesRequestListInner { + this := DeleteSloInstancesRequestListInner{} + return &this +} + +// GetSloId returns the SloId field value +func (o *DeleteSloInstancesRequestListInner) GetSloId() string { + if o == nil { + var ret string + return ret + } + + return o.SloId +} + +// GetSloIdOk returns a tuple with the SloId field value +// and a boolean to check if the value has been set. +func (o *DeleteSloInstancesRequestListInner) GetSloIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SloId, true +} + +// SetSloId sets field value +func (o *DeleteSloInstancesRequestListInner) SetSloId(v string) { + o.SloId = v +} + +// GetInstanceId returns the InstanceId field value +func (o *DeleteSloInstancesRequestListInner) GetInstanceId() string { + if o == nil { + var ret string + return ret + } + + return o.InstanceId +} + +// GetInstanceIdOk returns a tuple with the InstanceId field value +// and a boolean to check if the value has been set. +func (o *DeleteSloInstancesRequestListInner) GetInstanceIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.InstanceId, true +} + +// SetInstanceId sets field value +func (o *DeleteSloInstancesRequestListInner) SetInstanceId(v string) { + o.InstanceId = v +} + +func (o DeleteSloInstancesRequestListInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeleteSloInstancesRequestListInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["sloId"] = o.SloId + toSerialize["instanceId"] = o.InstanceId + return toSerialize, nil +} + +type NullableDeleteSloInstancesRequestListInner struct { + value *DeleteSloInstancesRequestListInner + isSet bool +} + +func (v NullableDeleteSloInstancesRequestListInner) Get() *DeleteSloInstancesRequestListInner { + return v.value +} + +func (v *NullableDeleteSloInstancesRequestListInner) Set(val *DeleteSloInstancesRequestListInner) { + v.value = val + v.isSet = true +} + +func (v NullableDeleteSloInstancesRequestListInner) IsSet() bool { + return v.isSet +} + +func (v *NullableDeleteSloInstancesRequestListInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeleteSloInstancesRequestListInner(val *DeleteSloInstancesRequestListInner) *NullableDeleteSloInstancesRequestListInner { + return &NullableDeleteSloInstancesRequestListInner{value: val, isSet: true} +} + +func (v NullableDeleteSloInstancesRequestListInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeleteSloInstancesRequestListInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_historical_summary_request.go b/generated/slo/model_historical_summary_request.go index 6d522dc18..a06576baa 100644 --- a/generated/slo/model_historical_summary_request.go +++ b/generated/slo/model_historical_summary_request.go @@ -20,16 +20,16 @@ var _ MappedNullable = &HistoricalSummaryRequest{} // HistoricalSummaryRequest struct for HistoricalSummaryRequest type HistoricalSummaryRequest struct { // The list of SLO identifiers to get the historical summary for - SloIds []string `json:"sloIds"` + List []string `json:"list"` } // NewHistoricalSummaryRequest instantiates a new HistoricalSummaryRequest object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewHistoricalSummaryRequest(sloIds []string) *HistoricalSummaryRequest { +func NewHistoricalSummaryRequest(list []string) *HistoricalSummaryRequest { this := HistoricalSummaryRequest{} - this.SloIds = sloIds + this.List = list return &this } @@ -41,28 +41,28 @@ func NewHistoricalSummaryRequestWithDefaults() *HistoricalSummaryRequest { return &this } -// GetSloIds returns the SloIds field value -func (o *HistoricalSummaryRequest) GetSloIds() []string { +// GetList returns the List field value +func (o *HistoricalSummaryRequest) GetList() []string { if o == nil { var ret []string return ret } - return o.SloIds + return o.List } -// GetSloIdsOk returns a tuple with the SloIds field value +// GetListOk returns a tuple with the List field value // and a boolean to check if the value has been set. -func (o *HistoricalSummaryRequest) GetSloIdsOk() ([]string, bool) { +func (o *HistoricalSummaryRequest) GetListOk() ([]string, bool) { if o == nil { return nil, false } - return o.SloIds, true + return o.List, true } -// SetSloIds sets field value -func (o *HistoricalSummaryRequest) SetSloIds(v []string) { - o.SloIds = v +// SetList sets field value +func (o *HistoricalSummaryRequest) SetList(v []string) { + o.List = v } func (o HistoricalSummaryRequest) MarshalJSON() ([]byte, error) { @@ -75,7 +75,7 @@ func (o HistoricalSummaryRequest) MarshalJSON() ([]byte, error) { func (o HistoricalSummaryRequest) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - toSerialize["sloIds"] = o.SloIds + toSerialize["list"] = o.List return toSerialize, nil } diff --git a/generated/slo/model_indicator_properties_custom_kql_params.go b/generated/slo/model_indicator_properties_custom_kql_params.go index 6ca493a4c..e84d0b41d 100644 --- a/generated/slo/model_indicator_properties_custom_kql_params.go +++ b/generated/slo/model_indicator_properties_custom_kql_params.go @@ -24,9 +24,9 @@ type IndicatorPropertiesCustomKqlParams struct { // the KQL query to filter the documents with. Filter *string `json:"filter,omitempty"` // the KQL query used to define the good events. - Good *string `json:"good,omitempty"` + Good string `json:"good"` // the KQL query used to define all events. - Total *string `json:"total,omitempty"` + Total string `json:"total"` // The timestamp field used in the source indice. TimestampField string `json:"timestampField"` } @@ -35,9 +35,11 @@ type IndicatorPropertiesCustomKqlParams struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewIndicatorPropertiesCustomKqlParams(index string, timestampField string) *IndicatorPropertiesCustomKqlParams { +func NewIndicatorPropertiesCustomKqlParams(index string, good string, total string, timestampField string) *IndicatorPropertiesCustomKqlParams { this := IndicatorPropertiesCustomKqlParams{} this.Index = index + this.Good = good + this.Total = total this.TimestampField = timestampField return &this } @@ -106,68 +108,52 @@ func (o *IndicatorPropertiesCustomKqlParams) SetFilter(v string) { o.Filter = &v } -// GetGood returns the Good field value if set, zero value otherwise. +// GetGood returns the Good field value func (o *IndicatorPropertiesCustomKqlParams) GetGood() string { - if o == nil || IsNil(o.Good) { + if o == nil { var ret string return ret } - return *o.Good + + return o.Good } -// GetGoodOk returns a tuple with the Good field value if set, nil otherwise +// GetGoodOk returns a tuple with the Good field value // and a boolean to check if the value has been set. func (o *IndicatorPropertiesCustomKqlParams) GetGoodOk() (*string, bool) { - if o == nil || IsNil(o.Good) { + if o == nil { return nil, false } - return o.Good, true -} - -// HasGood returns a boolean if a field has been set. -func (o *IndicatorPropertiesCustomKqlParams) HasGood() bool { - if o != nil && !IsNil(o.Good) { - return true - } - - return false + return &o.Good, true } -// SetGood gets a reference to the given string and assigns it to the Good field. +// SetGood sets field value func (o *IndicatorPropertiesCustomKqlParams) SetGood(v string) { - o.Good = &v + o.Good = v } -// GetTotal returns the Total field value if set, zero value otherwise. +// GetTotal returns the Total field value func (o *IndicatorPropertiesCustomKqlParams) GetTotal() string { - if o == nil || IsNil(o.Total) { + if o == nil { var ret string return ret } - return *o.Total + + return o.Total } -// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// GetTotalOk returns a tuple with the Total field value // and a boolean to check if the value has been set. func (o *IndicatorPropertiesCustomKqlParams) GetTotalOk() (*string, bool) { - if o == nil || IsNil(o.Total) { + if o == nil { return nil, false } - return o.Total, true -} - -// HasTotal returns a boolean if a field has been set. -func (o *IndicatorPropertiesCustomKqlParams) HasTotal() bool { - if o != nil && !IsNil(o.Total) { - return true - } - - return false + return &o.Total, true } -// SetTotal gets a reference to the given string and assigns it to the Total field. +// SetTotal sets field value func (o *IndicatorPropertiesCustomKqlParams) SetTotal(v string) { - o.Total = &v + o.Total = v } // GetTimestampField returns the TimestampField field value @@ -208,12 +194,8 @@ func (o IndicatorPropertiesCustomKqlParams) ToMap() (map[string]interface{}, err if !IsNil(o.Filter) { toSerialize["filter"] = o.Filter } - if !IsNil(o.Good) { - toSerialize["good"] = o.Good - } - if !IsNil(o.Total) { - toSerialize["total"] = o.Total - } + toSerialize["good"] = o.Good + toSerialize["total"] = o.Total toSerialize["timestampField"] = o.TimestampField return toSerialize, nil } diff --git a/generated/slo/model_indicator_properties_custom_metric_params.go b/generated/slo/model_indicator_properties_custom_metric_params.go index df4355a28..88f7cc8db 100644 --- a/generated/slo/model_indicator_properties_custom_metric_params.go +++ b/generated/slo/model_indicator_properties_custom_metric_params.go @@ -22,7 +22,7 @@ type IndicatorPropertiesCustomMetricParams struct { // The index or index pattern to use Index string `json:"index"` // the KQL query to filter the documents with. - Filter string `json:"filter"` + Filter *string `json:"filter,omitempty"` // The timestamp field used in the source indice. TimestampField string `json:"timestampField"` Good IndicatorPropertiesCustomMetricParamsGood `json:"good"` @@ -33,10 +33,9 @@ type IndicatorPropertiesCustomMetricParams struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewIndicatorPropertiesCustomMetricParams(index string, filter string, timestampField string, good IndicatorPropertiesCustomMetricParamsGood, total IndicatorPropertiesCustomMetricParamsTotal) *IndicatorPropertiesCustomMetricParams { +func NewIndicatorPropertiesCustomMetricParams(index string, timestampField string, good IndicatorPropertiesCustomMetricParamsGood, total IndicatorPropertiesCustomMetricParamsTotal) *IndicatorPropertiesCustomMetricParams { this := IndicatorPropertiesCustomMetricParams{} this.Index = index - this.Filter = filter this.TimestampField = timestampField this.Good = good this.Total = total @@ -75,28 +74,36 @@ func (o *IndicatorPropertiesCustomMetricParams) SetIndex(v string) { o.Index = v } -// GetFilter returns the Filter field value +// GetFilter returns the Filter field value if set, zero value otherwise. func (o *IndicatorPropertiesCustomMetricParams) GetFilter() string { - if o == nil { + if o == nil || IsNil(o.Filter) { var ret string return ret } - - return o.Filter + return *o.Filter } -// GetFilterOk returns a tuple with the Filter field value +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *IndicatorPropertiesCustomMetricParams) GetFilterOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Filter) { return nil, false } - return &o.Filter, true + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *IndicatorPropertiesCustomMetricParams) HasFilter() bool { + if o != nil && !IsNil(o.Filter) { + return true + } + + return false } -// SetFilter sets field value +// SetFilter gets a reference to the given string and assigns it to the Filter field. func (o *IndicatorPropertiesCustomMetricParams) SetFilter(v string) { - o.Filter = v + o.Filter = &v } // GetTimestampField returns the TimestampField field value @@ -182,7 +189,9 @@ func (o IndicatorPropertiesCustomMetricParams) MarshalJSON() ([]byte, error) { func (o IndicatorPropertiesCustomMetricParams) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["index"] = o.Index - toSerialize["filter"] = o.Filter + if !IsNil(o.Filter) { + toSerialize["filter"] = o.Filter + } toSerialize["timestampField"] = o.TimestampField toSerialize["good"] = o.Good toSerialize["total"] = o.Total diff --git a/generated/slo/model_indicator_properties_timeslice_metric.go b/generated/slo/model_indicator_properties_timeslice_metric.go new file mode 100644 index 000000000..bd5e6fde0 --- /dev/null +++ b/generated/slo/model_indicator_properties_timeslice_metric.go @@ -0,0 +1,143 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the IndicatorPropertiesTimesliceMetric type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesTimesliceMetric{} + +// IndicatorPropertiesTimesliceMetric Defines properties for a timeslice metric indicator type +type IndicatorPropertiesTimesliceMetric struct { + Params IndicatorPropertiesTimesliceMetricParams `json:"params"` + // The type of indicator. + Type string `json:"type"` +} + +// NewIndicatorPropertiesTimesliceMetric instantiates a new IndicatorPropertiesTimesliceMetric object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIndicatorPropertiesTimesliceMetric(params IndicatorPropertiesTimesliceMetricParams, type_ string) *IndicatorPropertiesTimesliceMetric { + this := IndicatorPropertiesTimesliceMetric{} + this.Params = params + this.Type = type_ + return &this +} + +// NewIndicatorPropertiesTimesliceMetricWithDefaults instantiates a new IndicatorPropertiesTimesliceMetric object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIndicatorPropertiesTimesliceMetricWithDefaults() *IndicatorPropertiesTimesliceMetric { + this := IndicatorPropertiesTimesliceMetric{} + return &this +} + +// GetParams returns the Params field value +func (o *IndicatorPropertiesTimesliceMetric) GetParams() IndicatorPropertiesTimesliceMetricParams { + if o == nil { + var ret IndicatorPropertiesTimesliceMetricParams + return ret + } + + return o.Params +} + +// GetParamsOk returns a tuple with the Params field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesTimesliceMetric) GetParamsOk() (*IndicatorPropertiesTimesliceMetricParams, bool) { + if o == nil { + return nil, false + } + return &o.Params, true +} + +// SetParams sets field value +func (o *IndicatorPropertiesTimesliceMetric) SetParams(v IndicatorPropertiesTimesliceMetricParams) { + o.Params = v +} + +// GetType returns the Type field value +func (o *IndicatorPropertiesTimesliceMetric) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesTimesliceMetric) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *IndicatorPropertiesTimesliceMetric) SetType(v string) { + o.Type = v +} + +func (o IndicatorPropertiesTimesliceMetric) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesTimesliceMetric) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["params"] = o.Params + toSerialize["type"] = o.Type + return toSerialize, nil +} + +type NullableIndicatorPropertiesTimesliceMetric struct { + value *IndicatorPropertiesTimesliceMetric + isSet bool +} + +func (v NullableIndicatorPropertiesTimesliceMetric) Get() *IndicatorPropertiesTimesliceMetric { + return v.value +} + +func (v *NullableIndicatorPropertiesTimesliceMetric) Set(val *IndicatorPropertiesTimesliceMetric) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesTimesliceMetric) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesTimesliceMetric) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesTimesliceMetric(val *IndicatorPropertiesTimesliceMetric) *NullableIndicatorPropertiesTimesliceMetric { + return &NullableIndicatorPropertiesTimesliceMetric{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesTimesliceMetric) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesTimesliceMetric) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_indicator_properties_timeslice_metric_params.go b/generated/slo/model_indicator_properties_timeslice_metric_params.go new file mode 100644 index 000000000..d702e10b5 --- /dev/null +++ b/generated/slo/model_indicator_properties_timeslice_metric_params.go @@ -0,0 +1,208 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the IndicatorPropertiesTimesliceMetricParams type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesTimesliceMetricParams{} + +// IndicatorPropertiesTimesliceMetricParams An object containing the indicator parameters. +type IndicatorPropertiesTimesliceMetricParams struct { + // The index or index pattern to use + Index string `json:"index"` + // the KQL query to filter the documents with. + Filter *string `json:"filter,omitempty"` + // The timestamp field used in the source indice. + TimestampField string `json:"timestampField"` + Metric IndicatorPropertiesTimesliceMetricParamsMetric `json:"metric"` +} + +// NewIndicatorPropertiesTimesliceMetricParams instantiates a new IndicatorPropertiesTimesliceMetricParams object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIndicatorPropertiesTimesliceMetricParams(index string, timestampField string, metric IndicatorPropertiesTimesliceMetricParamsMetric) *IndicatorPropertiesTimesliceMetricParams { + this := IndicatorPropertiesTimesliceMetricParams{} + this.Index = index + this.TimestampField = timestampField + this.Metric = metric + return &this +} + +// NewIndicatorPropertiesTimesliceMetricParamsWithDefaults instantiates a new IndicatorPropertiesTimesliceMetricParams object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIndicatorPropertiesTimesliceMetricParamsWithDefaults() *IndicatorPropertiesTimesliceMetricParams { + this := IndicatorPropertiesTimesliceMetricParams{} + return &this +} + +// GetIndex returns the Index field value +func (o *IndicatorPropertiesTimesliceMetricParams) GetIndex() string { + if o == nil { + var ret string + return ret + } + + return o.Index +} + +// GetIndexOk returns a tuple with the Index field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesTimesliceMetricParams) GetIndexOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Index, true +} + +// SetIndex sets field value +func (o *IndicatorPropertiesTimesliceMetricParams) SetIndex(v string) { + o.Index = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *IndicatorPropertiesTimesliceMetricParams) GetFilter() string { + if o == nil || IsNil(o.Filter) { + var ret string + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesTimesliceMetricParams) GetFilterOk() (*string, bool) { + if o == nil || IsNil(o.Filter) { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *IndicatorPropertiesTimesliceMetricParams) HasFilter() bool { + if o != nil && !IsNil(o.Filter) { + return true + } + + return false +} + +// SetFilter gets a reference to the given string and assigns it to the Filter field. +func (o *IndicatorPropertiesTimesliceMetricParams) SetFilter(v string) { + o.Filter = &v +} + +// GetTimestampField returns the TimestampField field value +func (o *IndicatorPropertiesTimesliceMetricParams) GetTimestampField() string { + if o == nil { + var ret string + return ret + } + + return o.TimestampField +} + +// GetTimestampFieldOk returns a tuple with the TimestampField field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesTimesliceMetricParams) GetTimestampFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TimestampField, true +} + +// SetTimestampField sets field value +func (o *IndicatorPropertiesTimesliceMetricParams) SetTimestampField(v string) { + o.TimestampField = v +} + +// GetMetric returns the Metric field value +func (o *IndicatorPropertiesTimesliceMetricParams) GetMetric() IndicatorPropertiesTimesliceMetricParamsMetric { + if o == nil { + var ret IndicatorPropertiesTimesliceMetricParamsMetric + return ret + } + + return o.Metric +} + +// GetMetricOk returns a tuple with the Metric field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesTimesliceMetricParams) GetMetricOk() (*IndicatorPropertiesTimesliceMetricParamsMetric, bool) { + if o == nil { + return nil, false + } + return &o.Metric, true +} + +// SetMetric sets field value +func (o *IndicatorPropertiesTimesliceMetricParams) SetMetric(v IndicatorPropertiesTimesliceMetricParamsMetric) { + o.Metric = v +} + +func (o IndicatorPropertiesTimesliceMetricParams) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesTimesliceMetricParams) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["index"] = o.Index + if !IsNil(o.Filter) { + toSerialize["filter"] = o.Filter + } + toSerialize["timestampField"] = o.TimestampField + toSerialize["metric"] = o.Metric + return toSerialize, nil +} + +type NullableIndicatorPropertiesTimesliceMetricParams struct { + value *IndicatorPropertiesTimesliceMetricParams + isSet bool +} + +func (v NullableIndicatorPropertiesTimesliceMetricParams) Get() *IndicatorPropertiesTimesliceMetricParams { + return v.value +} + +func (v *NullableIndicatorPropertiesTimesliceMetricParams) Set(val *IndicatorPropertiesTimesliceMetricParams) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesTimesliceMetricParams) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesTimesliceMetricParams) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesTimesliceMetricParams(val *IndicatorPropertiesTimesliceMetricParams) *NullableIndicatorPropertiesTimesliceMetricParams { + return &NullableIndicatorPropertiesTimesliceMetricParams{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesTimesliceMetricParams) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesTimesliceMetricParams) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_indicator_properties_timeslice_metric_params_metric.go b/generated/slo/model_indicator_properties_timeslice_metric_params_metric.go new file mode 100644 index 000000000..89435056d --- /dev/null +++ b/generated/slo/model_indicator_properties_timeslice_metric_params_metric.go @@ -0,0 +1,200 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the IndicatorPropertiesTimesliceMetricParamsMetric type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesTimesliceMetricParamsMetric{} + +// IndicatorPropertiesTimesliceMetricParamsMetric An object defining the metrics, equation, and threshold to determine if it's a good slice or not +type IndicatorPropertiesTimesliceMetricParamsMetric struct { + // List of metrics with their name, aggregation type, and field. + Metrics []IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner `json:"metrics"` + // The equation to calculate the metric. + Equation string `json:"equation"` + // The comparator to use to compare the equation to the threshold. + Comparator string `json:"comparator"` + // The threshold used to determine if the metric is a good slice or not. + Threshold float64 `json:"threshold"` +} + +// NewIndicatorPropertiesTimesliceMetricParamsMetric instantiates a new IndicatorPropertiesTimesliceMetricParamsMetric object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIndicatorPropertiesTimesliceMetricParamsMetric(metrics []IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner, equation string, comparator string, threshold float64) *IndicatorPropertiesTimesliceMetricParamsMetric { + this := IndicatorPropertiesTimesliceMetricParamsMetric{} + this.Metrics = metrics + this.Equation = equation + this.Comparator = comparator + this.Threshold = threshold + return &this +} + +// NewIndicatorPropertiesTimesliceMetricParamsMetricWithDefaults instantiates a new IndicatorPropertiesTimesliceMetricParamsMetric object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIndicatorPropertiesTimesliceMetricParamsMetricWithDefaults() *IndicatorPropertiesTimesliceMetricParamsMetric { + this := IndicatorPropertiesTimesliceMetricParamsMetric{} + return &this +} + +// GetMetrics returns the Metrics field value +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetMetrics() []IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner { + if o == nil { + var ret []IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner + return ret + } + + return o.Metrics +} + +// GetMetricsOk returns a tuple with the Metrics field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetMetricsOk() ([]IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner, bool) { + if o == nil { + return nil, false + } + return o.Metrics, true +} + +// SetMetrics sets field value +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) SetMetrics(v []IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) { + o.Metrics = v +} + +// GetEquation returns the Equation field value +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetEquation() string { + if o == nil { + var ret string + return ret + } + + return o.Equation +} + +// GetEquationOk returns a tuple with the Equation field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetEquationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Equation, true +} + +// SetEquation sets field value +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) SetEquation(v string) { + o.Equation = v +} + +// GetComparator returns the Comparator field value +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetComparator() string { + if o == nil { + var ret string + return ret + } + + return o.Comparator +} + +// GetComparatorOk returns a tuple with the Comparator field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetComparatorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Comparator, true +} + +// SetComparator sets field value +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) SetComparator(v string) { + o.Comparator = v +} + +// GetThreshold returns the Threshold field value +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetThreshold() float64 { + if o == nil { + var ret float64 + return ret + } + + return o.Threshold +} + +// GetThresholdOk returns a tuple with the Threshold field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetThresholdOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Threshold, true +} + +// SetThreshold sets field value +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) SetThreshold(v float64) { + o.Threshold = v +} + +func (o IndicatorPropertiesTimesliceMetricParamsMetric) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesTimesliceMetricParamsMetric) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["metrics"] = o.Metrics + toSerialize["equation"] = o.Equation + toSerialize["comparator"] = o.Comparator + toSerialize["threshold"] = o.Threshold + return toSerialize, nil +} + +type NullableIndicatorPropertiesTimesliceMetricParamsMetric struct { + value *IndicatorPropertiesTimesliceMetricParamsMetric + isSet bool +} + +func (v NullableIndicatorPropertiesTimesliceMetricParamsMetric) Get() *IndicatorPropertiesTimesliceMetricParamsMetric { + return v.value +} + +func (v *NullableIndicatorPropertiesTimesliceMetricParamsMetric) Set(val *IndicatorPropertiesTimesliceMetricParamsMetric) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesTimesliceMetricParamsMetric) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesTimesliceMetricParamsMetric) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesTimesliceMetricParamsMetric(val *IndicatorPropertiesTimesliceMetricParamsMetric) *NullableIndicatorPropertiesTimesliceMetricParamsMetric { + return &NullableIndicatorPropertiesTimesliceMetricParamsMetric{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesTimesliceMetricParamsMetric) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesTimesliceMetricParamsMetric) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_indicator_properties_timeslice_metric_params_metric_metrics_inner.go b/generated/slo/model_indicator_properties_timeslice_metric_params_metric_metrics_inner.go new file mode 100644 index 000000000..828f796ee --- /dev/null +++ b/generated/slo/model_indicator_properties_timeslice_metric_params_metric_metrics_inner.go @@ -0,0 +1,121 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "fmt" +) + +// IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner struct for IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner +type IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner struct { + TimesliceMetricBasicMetricWithField *TimesliceMetricBasicMetricWithField + TimesliceMetricDocCountMetric *TimesliceMetricDocCountMetric + TimesliceMetricPercentileMetric *TimesliceMetricPercentileMetric +} + +// Unmarshal JSON data into any of the pointers in the struct +func (dst *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) UnmarshalJSON(data []byte) error { + var err error + // try to unmarshal JSON data into TimesliceMetricBasicMetricWithField + err = json.Unmarshal(data, &dst.TimesliceMetricBasicMetricWithField) + if err == nil { + jsonTimesliceMetricBasicMetricWithField, _ := json.Marshal(dst.TimesliceMetricBasicMetricWithField) + if string(jsonTimesliceMetricBasicMetricWithField) == "{}" { // empty struct + dst.TimesliceMetricBasicMetricWithField = nil + } else { + return nil // data stored in dst.TimesliceMetricBasicMetricWithField, return on the first match + } + } else { + dst.TimesliceMetricBasicMetricWithField = nil + } + + // try to unmarshal JSON data into TimesliceMetricDocCountMetric + err = json.Unmarshal(data, &dst.TimesliceMetricDocCountMetric) + if err == nil { + jsonTimesliceMetricDocCountMetric, _ := json.Marshal(dst.TimesliceMetricDocCountMetric) + if string(jsonTimesliceMetricDocCountMetric) == "{}" { // empty struct + dst.TimesliceMetricDocCountMetric = nil + } else { + return nil // data stored in dst.TimesliceMetricDocCountMetric, return on the first match + } + } else { + dst.TimesliceMetricDocCountMetric = nil + } + + // try to unmarshal JSON data into TimesliceMetricPercentileMetric + err = json.Unmarshal(data, &dst.TimesliceMetricPercentileMetric) + if err == nil { + jsonTimesliceMetricPercentileMetric, _ := json.Marshal(dst.TimesliceMetricPercentileMetric) + if string(jsonTimesliceMetricPercentileMetric) == "{}" { // empty struct + dst.TimesliceMetricPercentileMetric = nil + } else { + return nil // data stored in dst.TimesliceMetricPercentileMetric, return on the first match + } + } else { + dst.TimesliceMetricPercentileMetric = nil + } + + return fmt.Errorf("data failed to match schemas in anyOf(IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner)") +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) MarshalJSON() ([]byte, error) { + if src.TimesliceMetricBasicMetricWithField != nil { + return json.Marshal(&src.TimesliceMetricBasicMetricWithField) + } + + if src.TimesliceMetricDocCountMetric != nil { + return json.Marshal(&src.TimesliceMetricDocCountMetric) + } + + if src.TimesliceMetricPercentileMetric != nil { + return json.Marshal(&src.TimesliceMetricPercentileMetric) + } + + return nil, nil // no data in anyOf schemas +} + +type NullableIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner struct { + value *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner + isSet bool +} + +func (v NullableIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) Get() *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner { + return v.value +} + +func (v *NullableIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) Set(val *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner(val *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) *NullableIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner { + return &NullableIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_slo_response.go b/generated/slo/model_slo_response.go index be4584751..91044e65b 100644 --- a/generated/slo/model_slo_response.go +++ b/generated/slo/model_slo_response.go @@ -39,6 +39,8 @@ type SloResponse struct { GroupBy string `json:"groupBy"` // the value derived from the groupBy field, if present, otherwise '*' InstanceId string `json:"instanceId"` + // List of tags + Tags []string `json:"tags"` // The creation date CreatedAt string `json:"createdAt"` // The last update date @@ -49,7 +51,7 @@ type SloResponse struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewSloResponse(id string, name string, description string, indicator SloResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float64, summary Summary, enabled bool, groupBy string, instanceId string, createdAt string, updatedAt string) *SloResponse { +func NewSloResponse(id string, name string, description string, indicator SloResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float64, summary Summary, enabled bool, groupBy string, instanceId string, tags []string, createdAt string, updatedAt string) *SloResponse { this := SloResponse{} this.Id = id this.Name = name @@ -64,6 +66,7 @@ func NewSloResponse(id string, name string, description string, indicator SloRes this.Enabled = enabled this.GroupBy = groupBy this.InstanceId = instanceId + this.Tags = tags this.CreatedAt = createdAt this.UpdatedAt = updatedAt return &this @@ -389,6 +392,30 @@ func (o *SloResponse) SetInstanceId(v string) { o.InstanceId = v } +// GetTags returns the Tags field value +func (o *SloResponse) GetTags() []string { + if o == nil { + var ret []string + return ret + } + + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *SloResponse) GetTagsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Tags, true +} + +// SetTags sets field value +func (o *SloResponse) SetTags(v []string) { + o.Tags = v +} + // GetCreatedAt returns the CreatedAt field value func (o *SloResponse) GetCreatedAt() string { if o == nil { @@ -460,6 +487,7 @@ func (o SloResponse) ToMap() (map[string]interface{}, error) { toSerialize["enabled"] = o.Enabled toSerialize["groupBy"] = o.GroupBy toSerialize["instanceId"] = o.InstanceId + toSerialize["tags"] = o.Tags toSerialize["createdAt"] = o.CreatedAt toSerialize["updatedAt"] = o.UpdatedAt return toSerialize, nil diff --git a/generated/slo/model_slo_response_indicator.go b/generated/slo/model_slo_response_indicator.go index 171d83a6a..e0147a4dd 100644 --- a/generated/slo/model_slo_response_indicator.go +++ b/generated/slo/model_slo_response_indicator.go @@ -22,6 +22,7 @@ type SloResponseIndicator struct { IndicatorPropertiesCustomKql *IndicatorPropertiesCustomKql IndicatorPropertiesCustomMetric *IndicatorPropertiesCustomMetric IndicatorPropertiesHistogram *IndicatorPropertiesHistogram + IndicatorPropertiesTimesliceMetric *IndicatorPropertiesTimesliceMetric } // IndicatorPropertiesApmAvailabilityAsSloResponseIndicator is a convenience function that returns IndicatorPropertiesApmAvailability wrapped in SloResponseIndicator @@ -59,6 +60,13 @@ func IndicatorPropertiesHistogramAsSloResponseIndicator(v *IndicatorPropertiesHi } } +// IndicatorPropertiesTimesliceMetricAsSloResponseIndicator is a convenience function that returns IndicatorPropertiesTimesliceMetric wrapped in SloResponseIndicator +func IndicatorPropertiesTimesliceMetricAsSloResponseIndicator(v *IndicatorPropertiesTimesliceMetric) SloResponseIndicator { + return SloResponseIndicator{ + IndicatorPropertiesTimesliceMetric: v, + } +} + // Unmarshal JSON data into one of the pointers in the struct func (dst *SloResponseIndicator) UnmarshalJSON(data []byte) error { var err error @@ -129,6 +137,18 @@ func (dst *SloResponseIndicator) UnmarshalJSON(data []byte) error { } } + // check if the discriminator value is 'indicator_properties_timeslice_metric' + if jsonDict["type"] == "indicator_properties_timeslice_metric" { + // try to unmarshal JSON data into IndicatorPropertiesTimesliceMetric + err = json.Unmarshal(data, &dst.IndicatorPropertiesTimesliceMetric) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesTimesliceMetric, return on the first match + } else { + dst.IndicatorPropertiesTimesliceMetric = nil + return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesTimesliceMetric: %s", err.Error()) + } + } + // check if the discriminator value is 'sli.apm.transactionDuration' if jsonDict["type"] == "sli.apm.transactionDuration" { // try to unmarshal JSON data into IndicatorPropertiesApmLatency @@ -189,6 +209,18 @@ func (dst *SloResponseIndicator) UnmarshalJSON(data []byte) error { } } + // check if the discriminator value is 'sli.metric.timeslice' + if jsonDict["type"] == "sli.metric.timeslice" { + // try to unmarshal JSON data into IndicatorPropertiesTimesliceMetric + err = json.Unmarshal(data, &dst.IndicatorPropertiesTimesliceMetric) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesTimesliceMetric, return on the first match + } else { + dst.IndicatorPropertiesTimesliceMetric = nil + return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesTimesliceMetric: %s", err.Error()) + } + } + return nil } @@ -214,6 +246,10 @@ func (src SloResponseIndicator) MarshalJSON() ([]byte, error) { return json.Marshal(&src.IndicatorPropertiesHistogram) } + if src.IndicatorPropertiesTimesliceMetric != nil { + return json.Marshal(&src.IndicatorPropertiesTimesliceMetric) + } + return nil, nil // no data in oneOf schemas } @@ -242,6 +278,10 @@ func (obj *SloResponseIndicator) GetActualInstance() interface{} { return obj.IndicatorPropertiesHistogram } + if obj.IndicatorPropertiesTimesliceMetric != nil { + return obj.IndicatorPropertiesTimesliceMetric + } + // all schemas are nil return nil } diff --git a/generated/slo/model_timeslice_metric_basic_metric_with_field.go b/generated/slo/model_timeslice_metric_basic_metric_with_field.go new file mode 100644 index 000000000..6f3e23eda --- /dev/null +++ b/generated/slo/model_timeslice_metric_basic_metric_with_field.go @@ -0,0 +1,209 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the TimesliceMetricBasicMetricWithField type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TimesliceMetricBasicMetricWithField{} + +// TimesliceMetricBasicMetricWithField struct for TimesliceMetricBasicMetricWithField +type TimesliceMetricBasicMetricWithField struct { + // The name of the metric. Only valid options are A-Z + Name string `json:"name"` + // The aggregation type of the metric. + Aggregation string `json:"aggregation"` + // The field of the metric. + Field string `json:"field"` + // The filter to apply to the metric. + Filter *string `json:"filter,omitempty"` +} + +// NewTimesliceMetricBasicMetricWithField instantiates a new TimesliceMetricBasicMetricWithField object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTimesliceMetricBasicMetricWithField(name string, aggregation string, field string) *TimesliceMetricBasicMetricWithField { + this := TimesliceMetricBasicMetricWithField{} + this.Name = name + this.Aggregation = aggregation + this.Field = field + return &this +} + +// NewTimesliceMetricBasicMetricWithFieldWithDefaults instantiates a new TimesliceMetricBasicMetricWithField object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTimesliceMetricBasicMetricWithFieldWithDefaults() *TimesliceMetricBasicMetricWithField { + this := TimesliceMetricBasicMetricWithField{} + return &this +} + +// GetName returns the Name field value +func (o *TimesliceMetricBasicMetricWithField) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *TimesliceMetricBasicMetricWithField) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *TimesliceMetricBasicMetricWithField) SetName(v string) { + o.Name = v +} + +// GetAggregation returns the Aggregation field value +func (o *TimesliceMetricBasicMetricWithField) GetAggregation() string { + if o == nil { + var ret string + return ret + } + + return o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value +// and a boolean to check if the value has been set. +func (o *TimesliceMetricBasicMetricWithField) GetAggregationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value +func (o *TimesliceMetricBasicMetricWithField) SetAggregation(v string) { + o.Aggregation = v +} + +// GetField returns the Field field value +func (o *TimesliceMetricBasicMetricWithField) GetField() string { + if o == nil { + var ret string + return ret + } + + return o.Field +} + +// GetFieldOk returns a tuple with the Field field value +// and a boolean to check if the value has been set. +func (o *TimesliceMetricBasicMetricWithField) GetFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Field, true +} + +// SetField sets field value +func (o *TimesliceMetricBasicMetricWithField) SetField(v string) { + o.Field = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *TimesliceMetricBasicMetricWithField) GetFilter() string { + if o == nil || IsNil(o.Filter) { + var ret string + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimesliceMetricBasicMetricWithField) GetFilterOk() (*string, bool) { + if o == nil || IsNil(o.Filter) { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *TimesliceMetricBasicMetricWithField) HasFilter() bool { + if o != nil && !IsNil(o.Filter) { + return true + } + + return false +} + +// SetFilter gets a reference to the given string and assigns it to the Filter field. +func (o *TimesliceMetricBasicMetricWithField) SetFilter(v string) { + o.Filter = &v +} + +func (o TimesliceMetricBasicMetricWithField) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TimesliceMetricBasicMetricWithField) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["aggregation"] = o.Aggregation + toSerialize["field"] = o.Field + if !IsNil(o.Filter) { + toSerialize["filter"] = o.Filter + } + return toSerialize, nil +} + +type NullableTimesliceMetricBasicMetricWithField struct { + value *TimesliceMetricBasicMetricWithField + isSet bool +} + +func (v NullableTimesliceMetricBasicMetricWithField) Get() *TimesliceMetricBasicMetricWithField { + return v.value +} + +func (v *NullableTimesliceMetricBasicMetricWithField) Set(val *TimesliceMetricBasicMetricWithField) { + v.value = val + v.isSet = true +} + +func (v NullableTimesliceMetricBasicMetricWithField) IsSet() bool { + return v.isSet +} + +func (v *NullableTimesliceMetricBasicMetricWithField) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTimesliceMetricBasicMetricWithField(val *TimesliceMetricBasicMetricWithField) *NullableTimesliceMetricBasicMetricWithField { + return &NullableTimesliceMetricBasicMetricWithField{value: val, isSet: true} +} + +func (v NullableTimesliceMetricBasicMetricWithField) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTimesliceMetricBasicMetricWithField) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_timeslice_metric_doc_count_metric.go b/generated/slo/model_timeslice_metric_doc_count_metric.go new file mode 100644 index 000000000..ac35571c3 --- /dev/null +++ b/generated/slo/model_timeslice_metric_doc_count_metric.go @@ -0,0 +1,181 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the TimesliceMetricDocCountMetric type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TimesliceMetricDocCountMetric{} + +// TimesliceMetricDocCountMetric struct for TimesliceMetricDocCountMetric +type TimesliceMetricDocCountMetric struct { + // The name of the metric. Only valid options are A-Z + Name string `json:"name"` + // The aggregation type of the metric. Only valid option is \"doc_count\" + Aggregation string `json:"aggregation"` + // The filter to apply to the metric. + Filter *string `json:"filter,omitempty"` +} + +// NewTimesliceMetricDocCountMetric instantiates a new TimesliceMetricDocCountMetric object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTimesliceMetricDocCountMetric(name string, aggregation string) *TimesliceMetricDocCountMetric { + this := TimesliceMetricDocCountMetric{} + this.Name = name + this.Aggregation = aggregation + return &this +} + +// NewTimesliceMetricDocCountMetricWithDefaults instantiates a new TimesliceMetricDocCountMetric object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTimesliceMetricDocCountMetricWithDefaults() *TimesliceMetricDocCountMetric { + this := TimesliceMetricDocCountMetric{} + return &this +} + +// GetName returns the Name field value +func (o *TimesliceMetricDocCountMetric) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *TimesliceMetricDocCountMetric) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *TimesliceMetricDocCountMetric) SetName(v string) { + o.Name = v +} + +// GetAggregation returns the Aggregation field value +func (o *TimesliceMetricDocCountMetric) GetAggregation() string { + if o == nil { + var ret string + return ret + } + + return o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value +// and a boolean to check if the value has been set. +func (o *TimesliceMetricDocCountMetric) GetAggregationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value +func (o *TimesliceMetricDocCountMetric) SetAggregation(v string) { + o.Aggregation = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *TimesliceMetricDocCountMetric) GetFilter() string { + if o == nil || IsNil(o.Filter) { + var ret string + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimesliceMetricDocCountMetric) GetFilterOk() (*string, bool) { + if o == nil || IsNil(o.Filter) { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *TimesliceMetricDocCountMetric) HasFilter() bool { + if o != nil && !IsNil(o.Filter) { + return true + } + + return false +} + +// SetFilter gets a reference to the given string and assigns it to the Filter field. +func (o *TimesliceMetricDocCountMetric) SetFilter(v string) { + o.Filter = &v +} + +func (o TimesliceMetricDocCountMetric) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TimesliceMetricDocCountMetric) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["aggregation"] = o.Aggregation + if !IsNil(o.Filter) { + toSerialize["filter"] = o.Filter + } + return toSerialize, nil +} + +type NullableTimesliceMetricDocCountMetric struct { + value *TimesliceMetricDocCountMetric + isSet bool +} + +func (v NullableTimesliceMetricDocCountMetric) Get() *TimesliceMetricDocCountMetric { + return v.value +} + +func (v *NullableTimesliceMetricDocCountMetric) Set(val *TimesliceMetricDocCountMetric) { + v.value = val + v.isSet = true +} + +func (v NullableTimesliceMetricDocCountMetric) IsSet() bool { + return v.isSet +} + +func (v *NullableTimesliceMetricDocCountMetric) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTimesliceMetricDocCountMetric(val *TimesliceMetricDocCountMetric) *NullableTimesliceMetricDocCountMetric { + return &NullableTimesliceMetricDocCountMetric{value: val, isSet: true} +} + +func (v NullableTimesliceMetricDocCountMetric) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTimesliceMetricDocCountMetric) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_timeslice_metric_percentile_metric.go b/generated/slo/model_timeslice_metric_percentile_metric.go new file mode 100644 index 000000000..ada902804 --- /dev/null +++ b/generated/slo/model_timeslice_metric_percentile_metric.go @@ -0,0 +1,237 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the TimesliceMetricPercentileMetric type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TimesliceMetricPercentileMetric{} + +// TimesliceMetricPercentileMetric struct for TimesliceMetricPercentileMetric +type TimesliceMetricPercentileMetric struct { + // The name of the metric. Only valid options are A-Z + Name string `json:"name"` + // The aggregation type of the metric. Only valid option is \"percentile\" + Aggregation string `json:"aggregation"` + // The field of the metric. + Field string `json:"field"` + // The percentile value. + Percentile float64 `json:"percentile"` + // The filter to apply to the metric. + Filter *string `json:"filter,omitempty"` +} + +// NewTimesliceMetricPercentileMetric instantiates a new TimesliceMetricPercentileMetric object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTimesliceMetricPercentileMetric(name string, aggregation string, field string, percentile float64) *TimesliceMetricPercentileMetric { + this := TimesliceMetricPercentileMetric{} + this.Name = name + this.Aggregation = aggregation + this.Field = field + this.Percentile = percentile + return &this +} + +// NewTimesliceMetricPercentileMetricWithDefaults instantiates a new TimesliceMetricPercentileMetric object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTimesliceMetricPercentileMetricWithDefaults() *TimesliceMetricPercentileMetric { + this := TimesliceMetricPercentileMetric{} + return &this +} + +// GetName returns the Name field value +func (o *TimesliceMetricPercentileMetric) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *TimesliceMetricPercentileMetric) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *TimesliceMetricPercentileMetric) SetName(v string) { + o.Name = v +} + +// GetAggregation returns the Aggregation field value +func (o *TimesliceMetricPercentileMetric) GetAggregation() string { + if o == nil { + var ret string + return ret + } + + return o.Aggregation +} + +// GetAggregationOk returns a tuple with the Aggregation field value +// and a boolean to check if the value has been set. +func (o *TimesliceMetricPercentileMetric) GetAggregationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value +func (o *TimesliceMetricPercentileMetric) SetAggregation(v string) { + o.Aggregation = v +} + +// GetField returns the Field field value +func (o *TimesliceMetricPercentileMetric) GetField() string { + if o == nil { + var ret string + return ret + } + + return o.Field +} + +// GetFieldOk returns a tuple with the Field field value +// and a boolean to check if the value has been set. +func (o *TimesliceMetricPercentileMetric) GetFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Field, true +} + +// SetField sets field value +func (o *TimesliceMetricPercentileMetric) SetField(v string) { + o.Field = v +} + +// GetPercentile returns the Percentile field value +func (o *TimesliceMetricPercentileMetric) GetPercentile() float64 { + if o == nil { + var ret float64 + return ret + } + + return o.Percentile +} + +// GetPercentileOk returns a tuple with the Percentile field value +// and a boolean to check if the value has been set. +func (o *TimesliceMetricPercentileMetric) GetPercentileOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Percentile, true +} + +// SetPercentile sets field value +func (o *TimesliceMetricPercentileMetric) SetPercentile(v float64) { + o.Percentile = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *TimesliceMetricPercentileMetric) GetFilter() string { + if o == nil || IsNil(o.Filter) { + var ret string + return ret + } + return *o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TimesliceMetricPercentileMetric) GetFilterOk() (*string, bool) { + if o == nil || IsNil(o.Filter) { + return nil, false + } + return o.Filter, true +} + +// HasFilter returns a boolean if a field has been set. +func (o *TimesliceMetricPercentileMetric) HasFilter() bool { + if o != nil && !IsNil(o.Filter) { + return true + } + + return false +} + +// SetFilter gets a reference to the given string and assigns it to the Filter field. +func (o *TimesliceMetricPercentileMetric) SetFilter(v string) { + o.Filter = &v +} + +func (o TimesliceMetricPercentileMetric) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TimesliceMetricPercentileMetric) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["aggregation"] = o.Aggregation + toSerialize["field"] = o.Field + toSerialize["percentile"] = o.Percentile + if !IsNil(o.Filter) { + toSerialize["filter"] = o.Filter + } + return toSerialize, nil +} + +type NullableTimesliceMetricPercentileMetric struct { + value *TimesliceMetricPercentileMetric + isSet bool +} + +func (v NullableTimesliceMetricPercentileMetric) Get() *TimesliceMetricPercentileMetric { + return v.value +} + +func (v *NullableTimesliceMetricPercentileMetric) Set(val *TimesliceMetricPercentileMetric) { + v.value = val + v.isSet = true +} + +func (v NullableTimesliceMetricPercentileMetric) IsSet() bool { + return v.isSet +} + +func (v *NullableTimesliceMetricPercentileMetric) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTimesliceMetricPercentileMetric(val *TimesliceMetricPercentileMetric) *NullableTimesliceMetricPercentileMetric { + return &NullableTimesliceMetricPercentileMetric{value: val, isSet: true} +} + +func (v NullableTimesliceMetricPercentileMetric) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTimesliceMetricPercentileMetric) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_update_slo_request.go b/generated/slo/model_update_slo_request.go index 45dd68c36..eb975d0a6 100644 --- a/generated/slo/model_update_slo_request.go +++ b/generated/slo/model_update_slo_request.go @@ -28,6 +28,8 @@ type UpdateSloRequest struct { BudgetingMethod *BudgetingMethod `json:"budgetingMethod,omitempty"` Objective *Objective `json:"objective,omitempty"` Settings *Settings `json:"settings,omitempty"` + // List of tags + Tags []string `json:"tags,omitempty"` } // NewUpdateSloRequest instantiates a new UpdateSloRequest object @@ -271,6 +273,38 @@ func (o *UpdateSloRequest) SetSettings(v Settings) { o.Settings = &v } +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *UpdateSloRequest) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateSloRequest) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *UpdateSloRequest) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *UpdateSloRequest) SetTags(v []string) { + o.Tags = v +} + func (o UpdateSloRequest) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -302,6 +336,9 @@ func (o UpdateSloRequest) ToMap() (map[string]interface{}, error) { if !IsNil(o.Settings) { toSerialize["settings"] = o.Settings } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } return toSerialize, nil } diff --git a/internal/clients/kibana/slo.go b/internal/clients/kibana/slo.go index d09c4da40..518513745 100644 --- a/internal/clients/kibana/slo.go +++ b/internal/clients/kibana/slo.go @@ -72,6 +72,7 @@ func UpdateSlo(ctx context.Context, apiClient *clients.ApiClient, s models.Slo) BudgetingMethod: (*slo.BudgetingMethod)(&s.BudgetingMethod), Objective: &s.Objective, Settings: s.Settings, + Tags: s.Tags, } req := client.UpdateSloOp(ctxWithAuth, s.SpaceID, s.ID).KbnXsrf("true").UpdateSloRequest(reqModel) @@ -108,6 +109,8 @@ func CreateSlo(ctx context.Context, apiClient *clients.ApiClient, s models.Slo) BudgetingMethod: slo.BudgetingMethod(s.BudgetingMethod), Objective: s.Objective, Settings: s.Settings, + GroupBy: s.GroupBy, + Tags: s.Tags, } req := client.CreateSloOp(ctxWithAuth, s.SpaceID).KbnXsrf("true").CreateSloRequest(reqModel) sloRes, res, err := req.Execute() @@ -168,5 +171,6 @@ func sloResponseToModel(spaceID string, res *slo.SloResponse) *models.Slo { TimeWindow: res.TimeWindow, Objective: res.Objective, Settings: &res.Settings, + Tags: res.Tags, } } diff --git a/internal/clients/kibana/slo_test.go b/internal/clients/kibana/slo_test.go index 7f72deb57..5076acb8e 100644 --- a/internal/clients/kibana/slo_test.go +++ b/internal/clients/kibana/slo_test.go @@ -78,6 +78,69 @@ func Test_sloResponseToModel(t *testing.T) { }, }, + { + name: "should return tags if available", + spaceId: "space-id", + sloResponse: &slo.SloResponse{ + Id: "slo-id", + Name: "slo-name", + Description: "slo-description", + Indicator: slo.SloResponseIndicator{ + IndicatorPropertiesApmAvailability: &slo.IndicatorPropertiesApmAvailability{ + Type: "sli.apm.transactionErrorRate", + Params: slo.IndicatorPropertiesApmAvailabilityParams{ + Service: "slo-service", + Environment: "slo-environment", + TransactionType: "slo-transaction-type", + TransactionName: "slo-transaction-name", + Index: "slo-index", + }, + }, + }, + TimeWindow: slo.TimeWindow{ + Duration: "7d", + Type: "rolling", + }, + BudgetingMethod: "occurrences", + Settings: slo.Settings{ + SyncDelay: &syncDelay, + }, + Tags: []string{"tag-1", "another_tag"}, + Revision: 5.0, + Enabled: true, + CreatedAt: "2023-08-11T00:05:36.567Z", + UpdatedAt: "2023-08-11T00:05:36.567Z", + }, + expectedModel: &models.Slo{ + ID: "slo-id", + Name: "slo-name", + Description: "slo-description", + Indicator: slo.SloResponseIndicator{ + IndicatorPropertiesApmAvailability: &slo.IndicatorPropertiesApmAvailability{ + Type: "sli.apm.transactionErrorRate", + Params: slo.IndicatorPropertiesApmAvailabilityParams{ + Service: "slo-service", + Environment: "slo-environment", + TransactionType: "slo-transaction-type", + TransactionName: "slo-transaction-name", + Index: "slo-index", + }, + }, + }, + TimeWindow: slo.TimeWindow{ + Duration: "7d", + Type: "rolling", + }, + BudgetingMethod: "occurrences", + Settings: &slo.Settings{ + SyncDelay: &syncDelay, + }, + SpaceID: "space-id", + Tags: []string{"tag-1", "another_tag"}, + GroupBy: nil, + }, + }, + { name: "nil response should return a nil model", spaceId: "space-id", diff --git a/internal/kibana/slo.go b/internal/kibana/slo.go index bbb1eea3d..47ecae535 100644 --- a/internal/kibana/slo.go +++ b/internal/kibana/slo.go @@ -413,6 +413,15 @@ func ResourceSlo() *schema.Resource { Optional: true, ForceNew: false, }, + "tags": { + Description: "The tags for the SLO.", + Type: schema.TypeList, + Optional: true, + ForceNew: false, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, } return &schema.Resource{ @@ -467,8 +476,8 @@ func getSloFromResourceData(d *schema.ResourceData) (models.Slo, diag.Diagnostic Params: slo.IndicatorPropertiesCustomKqlParams{ Index: d.Get(indicatorType + ".0.index").(string), Filter: getOrNilString(indicatorType+".0.filter", d), - Good: getOrNilString(indicatorType+".0.good", d), - Total: getOrNilString(indicatorType+".0.total", d), + Good: d.Get(indicatorType + ".0.good").(string), + Total: d.Get(indicatorType + ".0.total").(string), TimestampField: d.Get(indicatorType + ".0.timestamp_field").(string), }, }, @@ -536,7 +545,7 @@ func getSloFromResourceData(d *schema.ResourceData) (models.Slo, diag.Diagnostic IndicatorPropertiesCustomMetric: &slo.IndicatorPropertiesCustomMetric{ Type: indicatorAddressToType[indicatorType], Params: slo.IndicatorPropertiesCustomMetricParams{ - Filter: d.Get(indicatorType + ".0.filter").(string), + Filter: getOrNilString(indicatorType+".0.filter", d), Index: d.Get(indicatorType + ".0.index").(string), TimestampField: d.Get(indicatorType + ".0.timestamp_field").(string), Total: slo.IndicatorPropertiesCustomMetricParamsTotal{ @@ -599,6 +608,12 @@ func getSloFromResourceData(d *schema.ResourceData) (models.Slo, diag.Diagnostic GroupBy: getOrNilString("group_by", d), } + if tags, ok := d.GetOk("tags"); ok { + for _, t := range tags.([]interface{}) { + slo.Tags = append(slo.Tags, t.(string)) + } + } + return slo, diags } @@ -827,6 +842,9 @@ func resourceSloRead(ctx context.Context, d *schema.ResourceData, meta interface if err := d.Set("budgeting_method", s.BudgetingMethod); err != nil { return diag.FromErr(err) } + if err := d.Set("tags", s.Tags); err != nil { + return diag.FromErr(err) + } return diags } diff --git a/internal/kibana/slo_test.go b/internal/kibana/slo_test.go index ce2187fa3..d32490244 100644 --- a/internal/kibana/slo_test.go +++ b/internal/kibana/slo_test.go @@ -2,6 +2,7 @@ package kibana_test import ( "context" + "encoding/json" "fmt" "regexp" "strings" @@ -28,7 +29,7 @@ func TestAccResourceSlo(t *testing.T) { Steps: []resource.TestStep{ { SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.9.0"))), - Config: getSLOConfig(sloName, "apm_latency_indicator", false), + Config: getSLOConfig(sloName, "apm_latency_indicator", false, []string{}, ""), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "name", sloName), resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "description", "fully sick SLO"), @@ -47,19 +48,18 @@ func TestAccResourceSlo(t *testing.T) { resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "settings.0.sync_delay", "1m"), resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "settings.0.frequency", "1m"), resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "space_id", "default"), - resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "group_by", "some.field"), ), }, { //check that name can be updated SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.9.0"))), - Config: getSLOConfig(fmt.Sprintf("Updated %s", sloName), "apm_latency_indicator", false), + Config: getSLOConfig(fmt.Sprintf("Updated %s", sloName), "apm_latency_indicator", false, []string{}, ""), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "name", fmt.Sprintf("Updated %s", sloName)), ), }, { //check that settings can be updated from api-computed defaults SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.9.0"))), - Config: getSLOConfig(sloName, "apm_latency_indicator", true), + Config: getSLOConfig(sloName, "apm_latency_indicator", true, []string{}, ""), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "settings.0.sync_delay", "5m"), resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "settings.0.frequency", "5m"), @@ -67,7 +67,7 @@ func TestAccResourceSlo(t *testing.T) { }, { SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.9.0"))), - Config: getSLOConfig(sloName, "apm_availability_indicator", true), + Config: getSLOConfig(sloName, "apm_availability_indicator", true, []string{}, ""), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "apm_availability_indicator.0.environment", "production"), resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "apm_availability_indicator.0.service", "my-service"), @@ -78,7 +78,7 @@ func TestAccResourceSlo(t *testing.T) { }, { SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.9.0"))), - Config: getSLOConfig(sloName, "kql_custom_indicator", true), + Config: getSLOConfig(sloName, "kql_custom_indicator", true, []string{}, ""), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "kql_custom_indicator.0.index", "my-index"), resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "kql_custom_indicator.0.good", "latency < 300"), @@ -89,7 +89,7 @@ func TestAccResourceSlo(t *testing.T) { }, { SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.10.0"))), - Config: getSLOConfig(sloName, "histogram_custom_indicator", true), + Config: getSLOConfig(sloName, "histogram_custom_indicator", true, []string{}, ""), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.index", "my-index"), resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.good.0.field", "test"), @@ -103,7 +103,7 @@ func TestAccResourceSlo(t *testing.T) { }, { SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.10.0"))), - Config: getSLOConfig(sloName, "metric_custom_indicator", true), + Config: getSLOConfig(sloName, "metric_custom_indicator", true, []string{}, "some.field"), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "metric_custom_indicator.0.index", "my-index"), resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "metric_custom_indicator.0.good.0.metrics.0.name", "A"), @@ -112,6 +112,15 @@ func TestAccResourceSlo(t *testing.T) { resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "metric_custom_indicator.0.total.0.metrics.0.name", "A"), resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "metric_custom_indicator.0.total.0.metrics.0.aggregation", "sum"), resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "metric_custom_indicator.0.total.0.metrics.0.field", "processor.accepted"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "group_by", "some.field"), + ), + }, + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.10.0"))), + Config: getSLOConfig(sloName, "metric_custom_indicator", true, []string{"tag-1", "another_tag"}, ""), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "tags.0", "tag-1"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "tags.1", "another_tag"), ), }, }, @@ -174,7 +183,7 @@ func TestAccResourceSloErrors(t *testing.T) { }` - budgetingMethodFailConfig := getSLOConfig("budgetingMethodFail", "apm_latency_indicator", false) + budgetingMethodFailConfig := getSLOConfig("budgetingMethodFail", "apm_latency_indicator", false, []string{}, "") budgetingMethodFailConfig = strings.Replace(budgetingMethodFailConfig, "budgeting_method = \"timeslices\"", "budgeting_method = \"supdawg\"", -1) resource.Test(t, resource.TestCase{ @@ -188,7 +197,7 @@ func TestAccResourceSloErrors(t *testing.T) { }, { SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.10.0-SNAPSHOT"))), - Config: getSLOConfig("failwhale", "histogram_custom_indicator_agg_fail", false), + Config: getSLOConfig("failwhale", "histogram_custom_indicator_agg_fail", false, []string{}, ""), ExpectError: regexp.MustCompile(`expected histogram_custom_indicator.0.good.0.aggregation to be one of \["?value_count"? "?range"?\], got supdawg`), }, { @@ -226,7 +235,7 @@ func checkResourceSloDestroy(s *terraform.State) error { return nil } -func getSLOConfig(name string, indicatorType string, settingsEnabled bool) string { +func getSLOConfig(name string, indicatorType string, settingsEnabled bool, tags []string, group_by string) string { var settings string if settingsEnabled { settings = ` @@ -239,6 +248,21 @@ func getSLOConfig(name string, indicatorType string, settingsEnabled bool) strin settings = "" } + var tagsOption string + if len(tags) != 0 { + tagsJson, _ := json.Marshal(tags) + tagsOption = "tags = " + string(tagsJson) + } else { + tagsOption = "" + } + + var groupByOption string + if len(group_by) != 0 { + groupByOption = "group_by = \"" + group_by + "\"" + } else { + groupByOption = "" + } + configTemplate := ` provider "elasticstack" { elasticsearch {} @@ -271,10 +295,11 @@ func getSLOConfig(name string, indicatorType string, settingsEnabled bool) strin %s - group_by = "some.field" + %s depends_on = [elasticstack_elasticsearch_index.my_index] + %s } ` @@ -381,6 +406,6 @@ func getSLOConfig(name string, indicatorType string, settingsEnabled bool) strin return indicator } - config := fmt.Sprintf(configTemplate, name, getIndicator(indicatorType), settings) + config := fmt.Sprintf(configTemplate, name, getIndicator(indicatorType), settings, groupByOption, tagsOption) return config } diff --git a/internal/models/slo.go b/internal/models/slo.go index d1d830729..9bad1a0ff 100644 --- a/internal/models/slo.go +++ b/internal/models/slo.go @@ -15,4 +15,5 @@ type Slo struct { Settings *slo.Settings SpaceID string GroupBy *string + Tags []string }