diff --git a/CHANGELOG.md b/CHANGELOG.md index ba896eebb..fe5cd21cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## [Unreleased] +### Added +- Add support for Kibana SLOs ([#385](https://github.com/elastic/terraform-provider-elasticstack/pull/385)) + ## [0.6.2] - 2023-06-19 ### Added diff --git a/Makefile b/Makefile index f921cd304..9a49f6a2e 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ SWAGGER_VERSION ?= 8.7 GOVERSION ?= 1.19 -STACK_VERSION ?= 8.6.0 +STACK_VERSION ?= 8.9.0 ELASTICSEARCH_NAME ?= terraform-elasticstack-es ELASTICSEARCH_ENDPOINTS ?= http://$(ELASTICSEARCH_NAME):9200 @@ -84,6 +84,7 @@ docker-testacc: docker-elasticsearch docker-kibana ## Run acceptance tests in th .PHONY: docker-elasticsearch docker-elasticsearch: docker-network ## Start Elasticsearch single node cluster in docker container + @ docker rm -f $(ELASTICSEARCH_NAME) &> /dev/null || true @ $(call retry, 5, if ! docker ps --format '{{.Names}}' | grep -w $(ELASTICSEARCH_NAME) > /dev/null 2>&1 ; then \ docker run -d \ --memory $(ELASTICSEARCH_MEM) \ @@ -103,6 +104,7 @@ docker-elasticsearch: docker-network ## Start Elasticsearch single node cluster .PHONY: docker-kibana docker-kibana: docker-network docker-elasticsearch set-kibana-password ## Start Kibana node in docker container + @ docker rm -f $(KIBANA_NAME) &> /dev/null || true @ $(call retry, 5, if ! docker ps --format '{{.Names}}' | grep -w $(KIBANA_NAME) > /dev/null 2>&1 ; then \ docker run -d \ -p 5601:5601 \ @@ -256,18 +258,22 @@ generate-connectors-client: tools ## generate Kibana connectors client @ cd tools && go generate @ go fmt ./generated/connectors/... +## -i https://raw.githubusercontent.com/elastic/kibana/main/x-pack/plugins/observability/docs/openapi/slo/bundled.yaml \ + .PHONY: generate-slo-client generate-slo-client: tools ## generate Kibana slo client - @ docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \ - -i https://raw.githubusercontent.com/elastic/kibana/master/x-pack/plugins/observability/docs/openapi/slo/bundled.yaml \ - --skip-validate-spec \ + @ rm -rf generated/slo + @ docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.0.0-beta generate \ + -i /local/generated/slo-spec.yml \ --git-repo-id terraform-provider-elasticstack \ --git-user-id elastic \ -p isGoSubmodule=true \ -p packageName=slo \ -p generateInterfaces=true \ + -p useOneOfDiscriminatorLookup=true \ -g go \ - -o /local/generated/slo + -o /local/generated/slo \ + --type-mappings=float32=float64 @ rm -rf generated/slo/go.mod generated/slo/go.sum generated/slo/test @ go fmt ./generated/... diff --git a/docs/resources/kibana_slo.md b/docs/resources/kibana_slo.md new file mode 100644 index 000000000..9f0fe181c --- /dev/null +++ b/docs/resources/kibana_slo.md @@ -0,0 +1,408 @@ +--- +subcategory: "Kibana" +layout: "" +page_title: "Elasticstack: elasticstack_kibana_slo Resource" +description: |- + Creates or updates a Kibana SLO. +--- + +# Resource: elasticstack_kibana_slo + +Creates or updates a Kibana SLO. See the [Kibana SLO docs](https://www.elastic.co/guide/en/observability/current/slo.html) and [dev docs](https://github.com/elastic/kibana/blob/main/x-pack/plugins/observability/dev_docs/slo.md) for more information. + +## Example Usage + +```terraform +provider "elasticstack" { + elasticsearch {} + kibana {} +} + +resource "elasticstack_kibana_slo" "auth_server_latency" { + name = "Auth server latency" + description = "Ensures auth server is responding in time" + + apm_latency_indicator { + environment = "production" + service = "auth" + transaction_type = "request" + transaction_name = "GET /auth" + index = "metrics-apm*" + threshold = 500 + } + + time_window { + duration = "7d" + type = "rolling" + } + + budgeting_method = "timeslices" + + objective { + target = 0.95 + timeslice_target = 0.95 + timeslice_window = "5m" + } + + settings { + sync_delay = "5m" + frequency = "5m" + } + +} + +resource "elasticstack_kibana_slo" "auth_server_availability" { + name = "Auth server latency" + description = "Ensures auth server is responding in time" + + apm_availability_indicator { + environment = "production" + service = "my-service" + transaction_type = "request" + transaction_name = "GET /sup/dawg" + index = "metrics-apm*" + } + + time_window { + duration = "7d" + type = "rolling" + } + + budgeting_method = "timeslices" + + objective { + target = 0.95 + timeslice_target = 0.95 + timeslice_window = "5m" + } + + settings { + sync_delay = "5m" + frequency = "5m" + } + +} + +resource "elasticstack_kibana_slo" "custom_kql" { + name = "custom kql" + description = "custom kql" + + kql_custom_indicator { + index = "my-index" + good = "latency < 300" + total = "*" + filter = "labels.groupId: group-0" + timestamp_field = "custom_timestamp" + } + + time_window { + duration = "7d" + type = "rolling" + } + + budgeting_method = "timeslices" + + objective { + target = 0.95 + timeslice_target = 0.95 + timeslice_window = "5m" + } + + settings { + sync_delay = "5m" + frequency = "5m" + } + +} + +//Available from 8.10.0 +resource "elasticstack_kibana_slo" "custom_histogram" { + name = "custom histogram" + description = "custom histogram" + + histogram_custom_indicator { + index = "my-index" + good { + field = "test" + aggregation = "value_count" + filter = "latency < 300" + } + total { + field = "test" + aggregation = "value_count" + } + filter = "labels.groupId: group-0" + timestamp_field = "custom_timestamp" + } + + time_window { + duration = "7d" + type = "rolling" + } + + budgeting_method = "timeslices" + + objective { + target = 0.95 + timeslice_target = 0.95 + timeslice_window = "5m" + } + +} + +//Available from 8.10.0 +resource "elasticstack_kibana_slo" "custom_metric" { + name = "custom kql" + description = "custom kql" + + metric_custom_indicator { + index = "my-index" + good { + metrics { + name = "A" + aggregation = "sum" + field = "processor.processed" + } + equation = "A" + } + + total { + metrics { + name = "A" + aggregation = "sum" + field = "processor.accepted" + } + equation = "A" + } + } + + time_window { + duration = "7d" + type = "rolling" + } + + budgeting_method = "timeslices" + + objective { + target = 0.95 + timeslice_target = 0.95 + timeslice_window = "5m" + } + +} +``` + + +## Schema + +### Required + +- `budgeting_method` (String) An `occurrences` budgeting method uses the number of good and total events during the time window. A `timeslices` budgeting method uses the number of good slices and total slices during the time window. A slice is an arbitrary time window (smaller than the overall SLO time window) that is either considered good or bad, calculated from the timeslice threshold and the ratio of good over total events that happened during the slice window. A budgeting method is required and must be either occurrences or timeslices. +- `description` (String) A description for the SLO. +- `name` (String) The name of the SLO. +- `objective` (Block List, Min: 1, Max: 1) The target objective is the value the SLO needs to meet during the time window. If a timeslices budgeting method is used, we also need to define the timesliceTarget which can be different than the overall SLO target. (see [below for nested schema](#nestedblock--objective)) +- `time_window` (Block List, Min: 1, Max: 1) Currently support `calendarAligned` and `rolling` time windows. Any duration greater than 1 day can be used: days, weeks, months, quarters, years. Rolling time window requires a duration, e.g. `1w` for one week, and type: `rolling`. SLOs defined with such time window, will only consider the SLI data from the last duration period as a moving window. Calendar aligned time window requires a duration, limited to `1M` for monthly or `1w` for weekly, and type: `calendarAligned`. (see [below for nested schema](#nestedblock--time_window)) + +### Optional + +- `apm_availability_indicator` (Block List, Max: 1) (see [below for nested schema](#nestedblock--apm_availability_indicator)) +- `apm_latency_indicator` (Block List, Max: 1) (see [below for nested schema](#nestedblock--apm_latency_indicator)) +- `group_by` (String) Optional group by field to use to generate an SLO per distinct value. +- `histogram_custom_indicator` (Block List, Max: 1) (see [below for nested schema](#nestedblock--histogram_custom_indicator)) +- `id` (String) An ID (8 and 36 characters). If omitted, a UUIDv1 will be generated server-side. +- `kql_custom_indicator` (Block List, Max: 1) (see [below for nested schema](#nestedblock--kql_custom_indicator)) +- `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. + + +### Nested Schema for `objective` + +Required: + +- `target` (Number) + +Optional: + +- `timeslice_target` (Number) +- `timeslice_window` (String) + + + +### Nested Schema for `time_window` + +Required: + +- `duration` (String) +- `type` (String) + + + +### Nested Schema for `apm_availability_indicator` + +Required: + +- `environment` (String) +- `index` (String) +- `service` (String) +- `transaction_name` (String) +- `transaction_type` (String) + +Optional: + +- `filter` (String) + + + +### Nested Schema for `apm_latency_indicator` + +Required: + +- `environment` (String) +- `index` (String) +- `service` (String) +- `threshold` (Number) +- `transaction_name` (String) +- `transaction_type` (String) + +Optional: + +- `filter` (String) + + + +### Nested Schema for `histogram_custom_indicator` + +Required: + +- `good` (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--histogram_custom_indicator--good)) +- `index` (String) +- `total` (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--histogram_custom_indicator--total)) + +Optional: + +- `filter` (String) +- `timestamp_field` (String) + + +### Nested Schema for `histogram_custom_indicator.good` + +Required: + +- `aggregation` (String) +- `field` (String) + +Optional: + +- `filter` (String) +- `from` (Number) +- `to` (Number) + + + +### Nested Schema for `histogram_custom_indicator.total` + +Required: + +- `aggregation` (String) +- `field` (String) + +Optional: + +- `filter` (String) +- `from` (Number) +- `to` (Number) + + + + +### Nested Schema for `kql_custom_indicator` + +Required: + +- `index` (String) + +Optional: + +- `filter` (String) +- `good` (String) +- `timestamp_field` (String) +- `total` (String) + + + +### Nested Schema for `metric_custom_indicator` + +Required: + +- `good` (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--metric_custom_indicator--good)) +- `index` (String) +- `total` (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--metric_custom_indicator--total)) + +Optional: + +- `filter` (String) +- `timestamp_field` (String) + + +### Nested Schema for `metric_custom_indicator.good` + +Required: + +- `equation` (String) +- `metrics` (Block List, Min: 1) (see [below for nested schema](#nestedblock--metric_custom_indicator--good--metrics)) + + +### Nested Schema for `metric_custom_indicator.good.metrics` + +Required: + +- `aggregation` (String) +- `field` (String) +- `name` (String) + +Optional: + +- `filter` (String) + + + + +### Nested Schema for `metric_custom_indicator.total` + +Required: + +- `equation` (String) +- `metrics` (Block List, Min: 1) (see [below for nested schema](#nestedblock--metric_custom_indicator--total--metrics)) + + +### Nested Schema for `metric_custom_indicator.total.metrics` + +Required: + +- `aggregation` (String) +- `field` (String) +- `name` (String) + +Optional: + +- `filter` (String) + + + + + +### Nested Schema for `settings` + +Optional: + +- `frequency` (String) +- `sync_delay` (String) + +## Import + +Import is supported using the following syntax: + +```shell +terraform import elasticstack_kibana_slo.my_slo / +``` diff --git a/examples/resources/elasticstack_kibana_slo/import.sh b/examples/resources/elasticstack_kibana_slo/import.sh new file mode 100644 index 000000000..1fefb0e04 --- /dev/null +++ b/examples/resources/elasticstack_kibana_slo/import.sh @@ -0,0 +1 @@ +terraform import elasticstack_kibana_slo.my_slo / diff --git a/examples/resources/elasticstack_kibana_slo/resource.tf b/examples/resources/elasticstack_kibana_slo/resource.tf new file mode 100644 index 000000000..28200c08e --- /dev/null +++ b/examples/resources/elasticstack_kibana_slo/resource.tf @@ -0,0 +1,177 @@ +provider "elasticstack" { + elasticsearch {} + kibana {} +} + +resource "elasticstack_kibana_slo" "auth_server_latency" { + name = "Auth server latency" + description = "Ensures auth server is responding in time" + + apm_latency_indicator { + environment = "production" + service = "auth" + transaction_type = "request" + transaction_name = "GET /auth" + index = "metrics-apm*" + threshold = 500 + } + + time_window { + duration = "7d" + type = "rolling" + } + + budgeting_method = "timeslices" + + objective { + target = 0.95 + timeslice_target = 0.95 + timeslice_window = "5m" + } + + settings { + sync_delay = "5m" + frequency = "5m" + } + +} + +resource "elasticstack_kibana_slo" "auth_server_availability" { + name = "Auth server latency" + description = "Ensures auth server is responding in time" + + apm_availability_indicator { + environment = "production" + service = "my-service" + transaction_type = "request" + transaction_name = "GET /sup/dawg" + index = "metrics-apm*" + } + + time_window { + duration = "7d" + type = "rolling" + } + + budgeting_method = "timeslices" + + objective { + target = 0.95 + timeslice_target = 0.95 + timeslice_window = "5m" + } + + settings { + sync_delay = "5m" + frequency = "5m" + } + +} + +resource "elasticstack_kibana_slo" "custom_kql" { + name = "custom kql" + description = "custom kql" + + kql_custom_indicator { + index = "my-index" + good = "latency < 300" + total = "*" + filter = "labels.groupId: group-0" + timestamp_field = "custom_timestamp" + } + + time_window { + duration = "7d" + type = "rolling" + } + + budgeting_method = "timeslices" + + objective { + target = 0.95 + timeslice_target = 0.95 + timeslice_window = "5m" + } + + settings { + sync_delay = "5m" + frequency = "5m" + } + +} + +//Available from 8.10.0 +resource "elasticstack_kibana_slo" "custom_histogram" { + name = "custom histogram" + description = "custom histogram" + + histogram_custom_indicator { + index = "my-index" + good { + field = "test" + aggregation = "value_count" + filter = "latency < 300" + } + total { + field = "test" + aggregation = "value_count" + } + filter = "labels.groupId: group-0" + timestamp_field = "custom_timestamp" + } + + time_window { + duration = "7d" + type = "rolling" + } + + budgeting_method = "timeslices" + + objective { + target = 0.95 + timeslice_target = 0.95 + timeslice_window = "5m" + } + +} + +//Available from 8.10.0 +resource "elasticstack_kibana_slo" "custom_metric" { + name = "custom kql" + description = "custom kql" + + metric_custom_indicator { + index = "my-index" + good { + metrics { + name = "A" + aggregation = "sum" + field = "processor.processed" + } + equation = "A" + } + + total { + metrics { + name = "A" + aggregation = "sum" + field = "processor.accepted" + } + equation = "A" + } + } + + time_window { + duration = "7d" + type = "rolling" + } + + budgeting_method = "timeslices" + + objective { + target = 0.95 + timeslice_target = 0.95 + timeslice_window = "5m" + } + +} diff --git a/generated/slo-spec.yml b/generated/slo-spec.yml new file mode 100644 index 000000000..34d4b4c7b --- /dev/null +++ b/generated/slo-spec.yml @@ -0,0 +1,1201 @@ +openapi: 3.0.1 +info: + title: SLOs + description: OpenAPI schema for SLOs endpoints + version: '1.0' + contact: + name: Actionable Observability Team + license: + name: Elastic License 2.0 + url: https://www.elastic.co/licensing/elastic-license +servers: + - url: http://localhost:5601 + description: local +security: + - basicAuth: [] + - apiKeyAuth: [] +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: + summary: Creates an SLO. + operationId: createSloOp + 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/create_slo_request' + responses: + '200': + description: Successful request + content: + application/json: + schema: + $ref: '#/components/schemas/create_slo_response' + '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' + '409': + description: Conflict - The SLO id already exists + content: + application/json: + schema: + $ref: '#/components/schemas/409_response' + servers: + - url: https://localhost:5601 + get: + summary: Retrieves a paginated list of SLOs + operationId: findSlosOp + description: | + You must have the `read` 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' + - name: kqlQuery + in: query + description: A valid kql query to filter the SLO with + schema: + type: string + example: 'slo.name:latency* and slo.tags : "prod"' + - name: page + in: query + description: The page number to return + schema: + type: integer + default: 1 + example: 1 + - name: perPage + in: query + description: The number of SLOs to return per page + schema: + type: integer + default: 25 + example: 25 + - name: sortBy + in: query + description: Sort by field + schema: + type: string + enum: + - sli_value + - status + - error_budget_consumed + - error_budget_remaining + default: status + example: status + - name: sortDirection + in: query + description: Sort order + schema: + type: string + enum: + - asc + - desc + default: asc + example: asc + responses: + '200': + description: Successful request + content: + application/json: + schema: + $ref: '#/components/schemas/find_slo_response' + '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' + '404': + description: Not found response + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + /s/{spaceId}/api/observability/slos/{sloId}: + get: + summary: Retrieves a SLO + operationId: getSloOp + description: | + You must have the `read` 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' + - $ref: '#/components/parameters/slo_id' + - name: instanceId + in: query + description: the specific instanceId used by the summary calculation + schema: + type: string + example: host-abcde + responses: + '200': + description: Successful request + content: + application/json: + schema: + $ref: '#/components/schemas/slo_response' + '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' + '404': + description: Not found response + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + put: + summary: Updates an SLO + operationId: updateSloOp + description: | + You must have the `write` 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' + - $ref: '#/components/parameters/slo_id' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/update_slo_request' + responses: + '200': + description: Successful request + content: + application/json: + schema: + $ref: '#/components/schemas/slo_response' + '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' + '404': + description: Not found response + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + delete: + summary: Deletes an SLO + operationId: deleteSloOp + description: | + You must have the `write` 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' + - $ref: '#/components/parameters/slo_id' + 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' + '404': + description: Not found response + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + /s/{spaceId}/api/observability/slos/{sloId}/enable: + post: + summary: Enables an SLO + operationId: enableSloOp + description: | + You must have the `write` 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' + - $ref: '#/components/parameters/slo_id' + 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' + '404': + description: Not found response + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + /s/{spaceId}/api/observability/slos/{sloId}/disable: + post: + summary: Disables an SLO + operationId: disableSloOp + description: | + You must have the `write` 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' + - $ref: '#/components/parameters/slo_id' + responses: + '200': + 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' + '404': + description: Not found response + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + /s/{spaceId}/internal/observability/slos/_historical_summary: + post: + summary: Retrieves the historical summary for a list of SLOs + operationId: historicalSummaryOp + description: | + You must have the `read` 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/historical_summary_request' + responses: + '200': + description: Successful request + content: + application/json: + schema: + $ref: '#/components/schemas/historical_summary_response' + '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' +components: + securitySchemes: + basicAuth: + type: http + scheme: basic + apiKeyAuth: + type: apiKey + in: header + name: ApiKey + parameters: + kbn_xsrf: + schema: + type: string + in: header + name: kbn-xsrf + description: Cross-site request forgery protection + required: true + space_id: + in: path + name: spaceId + description: An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + required: true + schema: + type: string + example: default + slo_id: + in: path + name: sloId + description: An identifier for the slo. + required: true + schema: + type: string + example: 9c235211-6834-11ea-a78c-6feb38a34414 + schemas: + indicator_properties_apm_availability: + title: APM availability + required: + - type + - params + description: Defines properties for the APM availability indicator type + type: object + properties: + params: + description: An object containing the indicator parameters. + type: object + nullable: false + required: + - service + - environment + - transactionType + - transactionName + - index + properties: + service: + description: The APM service name + type: string + example: o11y-app + environment: + description: The APM service environment or "*" + type: string + example: production + transactionType: + description: The APM transaction type or "*" + type: string + example: request + transactionName: + description: The APM transaction name or "*" + type: string + example: GET /my/api + filter: + description: KQL query used for filtering the data + type: string + example: 'service.foo : "bar"' + index: + description: The index used by APM metrics + type: string + example: metrics-apm*,apm* + type: + description: The type of indicator. + type: string + example: sli.apm.transactionDuration + indicator_properties_custom_kql: + title: Custom KQL + required: + - type + - params + description: Defines properties for a custom KQL indicator type + type: object + properties: + params: + description: An object containing the indicator parameters. + type: object + nullable: false + required: + - index + - timestampField + 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"' + good: + description: the KQL query used to define the good events. + type: string + example: 'request.latency <= 150 and request.status_code : "2xx"' + total: + description: the KQL query used to define all events. + type: string + example: '' + timestampField: + description: | + The timestamp field used in the source indice. + type: string + example: timestamp + type: + description: The type of indicator. + type: string + example: sli.kql.custom + indicator_properties_apm_latency: + title: APM latency + required: + - type + - params + description: Defines properties for the APM latency indicator type + type: object + properties: + params: + description: An object containing the indicator parameters. + type: object + nullable: false + required: + - service + - environment + - transactionType + - transactionName + - index + - threshold + properties: + service: + description: The APM service name + type: string + example: o11y-app + environment: + description: The APM service environment or "*" + type: string + example: production + transactionType: + description: The APM transaction type or "*" + type: string + example: request + transactionName: + description: The APM transaction name or "*" + type: string + example: GET /my/api + filter: + description: KQL query used for filtering the data + type: string + example: 'service.foo : "bar"' + index: + description: The index used by APM metrics + type: string + example: metrics-apm*,apm* + threshold: + description: The latency threshold in milliseconds + type: number + example: 250 + type: + description: The type of indicator. + type: string + example: sli.apm.transactionDuration + indicator_properties_custom_metric: + title: Custom metric + required: + - type + - params + description: Defines properties for a custom metric indicator type + type: object + properties: + params: + description: An object containing the indicator parameters. + type: object + nullable: false + required: + - index + - timestampField + - good + - total + - filter + 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 + good: + description: | + An object defining the "good" metrics and equation + type: object + required: + - metrics + - equation + properties: + metrics: + description: List of metrics with their name, aggregation type, and field. + type: array + items: + type: object + required: + - name + - aggregation + - field + 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 "sum" + type: string + example: sum + enum: + - sum + 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"' + equation: + description: The equation to calculate the "good" metric. + type: string + example: A + total: + description: | + An object defining the "total" metrics and equation + type: object + required: + - metrics + - equation + properties: + metrics: + description: List of metrics with their name, aggregation type, and field. + type: array + items: + type: object + required: + - name + - aggregation + - field + 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 "sum" + type: string + example: sum + enum: + - sum + 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: *' + equation: + description: The equation to calculate the "total" metric. + type: string + example: A + type: + description: The type of indicator. + type: string + example: sli.metric.custom + indicator_properties_histogram: + title: Histogram indicator + required: + - type + - params + description: Defines properties for a histogram indicator type + type: object + properties: + params: + description: An object containing the indicator parameters. + type: object + nullable: false + required: + - index + - timestampField + - good + - total + 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 + good: + description: | + An object defining the "good" events + type: object + required: + - aggregation + - field + properties: + field: + description: The field use to aggregate the good events. + type: string + example: processor.latency + aggregation: + description: The type of aggregation to use. + type: string + example: value_count + enum: + - value_count + - range + filter: + description: The filter for good events. + type: string + example: 'processor.outcome: "success"' + from: + description: The starting value of the range. Only required for "range" aggregations. + type: number + example: 0 + to: + description: The ending value of the range. Only required for "range" aggregations. + type: number + example: 100 + total: + description: | + An object defining the "total" events + type: object + required: + - aggregation + - field + properties: + field: + description: The field use to aggregate the good events. + type: string + example: processor.latency + aggregation: + description: The type of aggregation to use. + type: string + example: value_count + enum: + - value_count + - range + filter: + description: The filter for total events. + type: string + example: 'processor.outcome : *' + from: + description: The starting value of the range. Only required for "range" aggregations. + type: number + example: 0 + to: + description: The ending value of the range. Only required for "range" aggregations. + type: number + example: 100 + type: + description: The type of indicator. + type: string + example: sli.histogram.custom + time_window: + title: Time window + required: + - duration + - type + description: Defines properties for the SLO time window + type: object + properties: + duration: + description: 'the duration formatted as {duration}{unit}. Accepted values for rolling: 7d, 30d, 90d. Accepted values for calendar aligned: 1w (weekly) or 1M (monthly)' + type: string + example: 30d + type: + description: Indicates weither the time window is a rolling or a calendar aligned time window. + type: string + example: rolling + enum: + - rolling + - calendarAligned + budgeting_method: + title: Budgeting method + type: string + description: The budgeting method to use when computing the rollup data. + enum: + - occurrences + - timeslices + example: occurrences + objective: + title: Objective + required: + - target + description: Defines properties for the SLO objective + type: object + properties: + target: + description: the target objective between 0 and 1 excluded + type: number + example: 0.99 + timesliceTarget: + description: the target objective for each slice when using a timeslices budgeting method + type: number + example: 0.995 + timesliceWindow: + description: the duration of each slice when using a timeslices budgeting method, as {duraton}{unit} + type: string + example: 5m + settings: + title: Settings + description: Defines properties for SLO settings. + type: object + properties: + syncDelay: + description: The synch delay to apply to the transform. Default 1m + type: string + example: 5m + frequency: + description: Configure how often the transform runs, default 1m + type: string + example: 5m + summary_status: + title: summary status + type: string + enum: + - NO_DATA + - HEALTHY + - DEGRADING + - VIOLATED + example: HEALTHY + error_budget: + title: Error budget + type: object + required: + - initial + - consumed + - remaining + - isEstimated + properties: + initial: + type: number + description: The initial error budget, as 1 - objective + example: 0.02 + consumed: + type: number + description: The error budget consummed, as a percentage of the initial value. + example: 0.8 + remaining: + type: number + description: The error budget remaining, as a percentage of the initial value. + example: 0.2 + isEstimated: + type: boolean + description: Only for SLO defined with occurrences budgeting method and calendar aligned time window. + example: true + summary: + title: Summary + type: object + description: The SLO computed data + required: + - status + - sliValue + - errorBudget + properties: + status: + $ref: '#/components/schemas/summary_status' + sliValue: + type: number + example: 0.9836 + errorBudget: + $ref: '#/components/schemas/error_budget' + slo_response: + title: SLO response + type: object + required: + - id + - name + - description + - indicator + - timeWindow + - budgetingMethod + - objective + - settings + - revision + - summary + - enabled + - groupBy + - instanceId + - createdAt + - updatedAt + properties: + id: + description: The identifier of the SLO. + type: string + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + name: + description: The name of the SLO. + type: string + example: My Service SLO + description: + description: The description of the SLO. + type: string + example: My SLO description + indicator: + discriminator: + propertyName: type + mapping: + sli.apm.transactionErrorRate: '#/components/schemas/indicator_properties_apm_availability' + sli.kql.custom: '#/components/schemas/indicator_properties_custom_kql' + 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' + 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' + timeWindow: + $ref: '#/components/schemas/time_window' + budgetingMethod: + $ref: '#/components/schemas/budgeting_method' + objective: + $ref: '#/components/schemas/objective' + settings: + $ref: '#/components/schemas/settings' + revision: + description: The SLO revision + type: number + example: 2 + summary: + $ref: '#/components/schemas/summary' + enabled: + description: Indicate if the SLO is enabled + type: boolean + example: true + groupBy: + description: optional group by field to use to generate an SLO per distinct value + type: string + example: some.field + instanceId: + description: the value derived from the groupBy field, if present, otherwise '*' + type: string + example: host-abcde + createdAt: + description: The creation date + type: string + example: '2023-01-12T10:03:19.000Z' + updatedAt: + description: The last update date + type: string + example: '2023-01-12T10:03:19.000Z' + find_slo_response: + title: Find SLO response + description: | + A paginated response of SLOs matching the query. + type: object + properties: + page: + type: number + example: 1 + perPage: + type: number + example: 25 + total: + type: number + example: 34 + results: + type: array + items: + $ref: '#/components/schemas/slo_response' + 400_response: + title: Bad request + type: object + required: + - statusCode + - error + - message + properties: + statusCode: + type: number + example: 400 + error: + type: string + example: Bad Request + message: + type: string + example: 'Invalid value ''foo'' supplied to: [...]' + 401_response: + title: Unauthorized + type: object + required: + - statusCode + - error + - message + properties: + statusCode: + type: number + example: 401 + error: + type: string + example: Unauthorized + message: + type: string + example: "[security_exception\n\tRoot causes:\n\t\tsecurity_exception: unable to authenticate user [elastics] for REST request [/_security/_authenticate]]: unable to authenticate user [elastics] for REST request [/_security/_authenticate]" + 403_response: + title: Unauthorized + type: object + required: + - statusCode + - error + - message + properties: + statusCode: + type: number + example: 403 + error: + type: string + example: Unauthorized + message: + type: string + example: "[security_exception\n\tRoot causes:\n\t\tsecurity_exception: unable to authenticate user [elastics] for REST request [/_security/_authenticate]]: unable to authenticate user [elastics] for REST request [/_security/_authenticate]" + 404_response: + title: Not found + type: object + required: + - statusCode + - error + - message + properties: + statusCode: + type: number + example: 404 + error: + type: string + example: Not Found + message: + type: string + example: SLO [3749f390-03a3-11ee-8139-c7ff60a1692d] not found + create_slo_request: + title: Create SLO request + description: | + The create SLO API request body varies depending on the type of indicator, time window and budgeting method. + type: object + required: + - name + - description + - indicator + - timeWindow + - budgetingMethod + - objective + properties: + id: + description: A optional and unique identifier for the SLO. Must be between 8 and 36 chars + type: string + example: my-super-slo-id + name: + description: A name for the SLO. + type: string + description: + description: A description for the SLO. + type: string + indicator: + 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' + timeWindow: + $ref: '#/components/schemas/time_window' + budgetingMethod: + $ref: '#/components/schemas/budgeting_method' + objective: + $ref: '#/components/schemas/objective' + settings: + $ref: '#/components/schemas/settings' + groupBy: + description: optional group by field to use to generate an SLO per distinct value + type: string + example: some.field + create_slo_response: + title: Create SLO response + type: object + required: + - id + properties: + id: + type: string + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + 409_response: + title: Conflict + type: object + required: + - statusCode + - error + - message + properties: + statusCode: + type: number + example: 409 + error: + type: string + example: Conflict + message: + type: string + example: SLO [d077e940-1515-11ee-9c50-9d096392f520] already exists + update_slo_request: + title: Update SLO request + description: | + The update SLO API request body varies depending on the type of indicator, time window and budgeting method. Partial update is handled. + type: object + properties: + name: + description: A name for the SLO. + type: string + description: + description: A description for the SLO. + type: string + indicator: + 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' + timeWindow: + $ref: '#/components/schemas/time_window' + budgetingMethod: + $ref: '#/components/schemas/budgeting_method' + objective: + $ref: '#/components/schemas/objective' + settings: + $ref: '#/components/schemas/settings' + historical_summary_request: + title: Historical summary request + type: object + required: + - sloIds + properties: + sloIds: + description: The list of SLO identifiers to get the historical summary for + type: array + items: + type: string + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + historical_summary_response: + title: Historical summary response + type: object + additionalProperties: + type: array + items: + type: object + properties: + date: + type: string + example: '2022-01-01T00:00:00.000Z' + status: + $ref: '#/components/schemas/summary_status' + sliValue: + type: number + example: 0.9836 + errorBudget: + $ref: '#/components/schemas/error_budget' diff --git a/generated/slo/.openapi-generator/FILES b/generated/slo/.openapi-generator/FILES index 6cae4b11b..5d1ca5c6e 100644 --- a/generated/slo/.openapi-generator/FILES +++ b/generated/slo/.openapi-generator/FILES @@ -1,12 +1,14 @@ .gitignore +.openapi-generator-ignore .travis.yml README.md api/openapi.yaml -api_slos.go +api_slo.go client.go configuration.go docs/BudgetingMethod.md docs/CreateSloRequest.md +docs/CreateSloRequestIndicator.md docs/CreateSloResponse.md docs/ErrorBudget.md docs/FindSloResponse.md @@ -18,24 +20,41 @@ docs/IndicatorPropertiesApmLatency.md docs/IndicatorPropertiesApmLatencyParams.md docs/IndicatorPropertiesCustomKql.md docs/IndicatorPropertiesCustomKqlParams.md -docs/Model4xxResponse.md +docs/IndicatorPropertiesCustomMetric.md +docs/IndicatorPropertiesCustomMetricParams.md +docs/IndicatorPropertiesCustomMetricParamsGood.md +docs/IndicatorPropertiesCustomMetricParamsGoodMetricsInner.md +docs/IndicatorPropertiesCustomMetricParamsTotal.md +docs/IndicatorPropertiesCustomMetricParamsTotalMetricsInner.md +docs/IndicatorPropertiesHistogram.md +docs/IndicatorPropertiesHistogramParams.md +docs/IndicatorPropertiesHistogramParamsGood.md +docs/IndicatorPropertiesHistogramParamsTotal.md +docs/Model400Response.md +docs/Model401Response.md +docs/Model403Response.md +docs/Model404Response.md +docs/Model409Response.md docs/Objective.md docs/Settings.md +docs/SloAPI.md docs/SloResponse.md docs/SloResponseIndicator.md -docs/SloResponseTimeWindow.md -docs/SlosApi.md docs/Summary.md -docs/TimeWindowCalendarAligned.md -docs/TimeWindowCalendarAlignedCalendar.md -docs/TimeWindowRolling.md +docs/SummaryStatus.md +docs/TimeWindow.md docs/UpdateSloRequest.md git_push.sh go.mod go.sum -model_4xx_response.go +model_400_response.go +model_401_response.go +model_403_response.go +model_404_response.go +model_409_response.go model_budgeting_method.go model_create_slo_request.go +model_create_slo_request_indicator.go model_create_slo_response.go model_error_budget.go model_find_slo_response.go @@ -47,16 +66,24 @@ model_indicator_properties_apm_latency.go model_indicator_properties_apm_latency_params.go model_indicator_properties_custom_kql.go model_indicator_properties_custom_kql_params.go +model_indicator_properties_custom_metric.go +model_indicator_properties_custom_metric_params.go +model_indicator_properties_custom_metric_params_good.go +model_indicator_properties_custom_metric_params_good_metrics_inner.go +model_indicator_properties_custom_metric_params_total.go +model_indicator_properties_custom_metric_params_total_metrics_inner.go +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_objective.go model_settings.go model_slo_response.go model_slo_response_indicator.go -model_slo_response_time_window.go model_summary.go -model_time_window_calendar_aligned.go -model_time_window_calendar_aligned_calendar.go -model_time_window_rolling.go +model_summary_status.go +model_time_window.go model_update_slo_request.go response.go -test/api_slos_test.go +test/api_slo_test.go utils.go diff --git a/generated/slo/.openapi-generator/VERSION b/generated/slo/.openapi-generator/VERSION index 4be2c727a..f7667587c 100644 --- a/generated/slo/.openapi-generator/VERSION +++ b/generated/slo/.openapi-generator/VERSION @@ -1 +1 @@ -6.5.0 \ No newline at end of file +7.0.0-beta \ No newline at end of file diff --git a/generated/slo/README.md b/generated/slo/README.md index c3d09c917..45d046cce 100644 --- a/generated/slo/README.md +++ b/generated/slo/README.md @@ -5,7 +5,7 @@ OpenAPI schema for SLOs endpoints ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 0.1 +- API version: 1.0 - Package version: 1.0.0 - Build package: org.openapitools.codegen.languages.GoClientCodegen @@ -77,20 +77,21 @@ All URIs are relative to *http://localhost:5601* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*SlosApi* | [**CreateSlo**](docs/SlosApi.md#createslo) | **Post** /s/{spaceId}/api/observability/slos | Creates an SLO. -*SlosApi* | [**DeleteSlo**](docs/SlosApi.md#deleteslo) | **Delete** /s/{spaceId}/api/observability/slos/{sloId} | Deletes an SLO -*SlosApi* | [**DisableSlo**](docs/SlosApi.md#disableslo) | **Post** /s/{spaceId}/api/observability/slos/{sloId}/disable | Disables an SLO -*SlosApi* | [**EnableSlo**](docs/SlosApi.md#enableslo) | **Post** /s/{spaceId}/api/observability/slos/{sloId}/enable | Enables an SLO -*SlosApi* | [**FindSlos**](docs/SlosApi.md#findslos) | **Get** /s/{spaceId}/api/observability/slos | Retrieves a paginated list of SLOs -*SlosApi* | [**GetSlo**](docs/SlosApi.md#getslo) | **Get** /s/{spaceId}/api/observability/slos/{sloId} | Retrieves a SLO -*SlosApi* | [**HistoricalSummary**](docs/SlosApi.md#historicalsummary) | **Post** /s/{spaceId}/internal/observability/slos/_historical_summary | Retrieves the historical summary for a list of SLOs -*SlosApi* | [**UpdateSlo**](docs/SlosApi.md#updateslo) | **Put** /s/{spaceId}/api/observability/slos/{sloId} | Updates an SLO +*SloAPI* | [**CreateSloOp**](docs/SloAPI.md#createsloop) | **Post** /s/{spaceId}/api/observability/slos | Creates an SLO. +*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 +*SloAPI* | [**FindSlosOp**](docs/SloAPI.md#findslosop) | **Get** /s/{spaceId}/api/observability/slos | Retrieves a paginated list of SLOs +*SloAPI* | [**GetSloOp**](docs/SloAPI.md#getsloop) | **Get** /s/{spaceId}/api/observability/slos/{sloId} | Retrieves a SLO +*SloAPI* | [**HistoricalSummaryOp**](docs/SloAPI.md#historicalsummaryop) | **Post** /s/{spaceId}/internal/observability/slos/_historical_summary | Retrieves the historical summary for a list of SLOs +*SloAPI* | [**UpdateSloOp**](docs/SloAPI.md#updatesloop) | **Put** /s/{spaceId}/api/observability/slos/{sloId} | Updates an SLO ## Documentation For Models - [BudgetingMethod](docs/BudgetingMethod.md) - [CreateSloRequest](docs/CreateSloRequest.md) + - [CreateSloRequestIndicator](docs/CreateSloRequestIndicator.md) - [CreateSloResponse](docs/CreateSloResponse.md) - [ErrorBudget](docs/ErrorBudget.md) - [FindSloResponse](docs/FindSloResponse.md) @@ -102,23 +103,35 @@ Class | Method | HTTP request | Description - [IndicatorPropertiesApmLatencyParams](docs/IndicatorPropertiesApmLatencyParams.md) - [IndicatorPropertiesCustomKql](docs/IndicatorPropertiesCustomKql.md) - [IndicatorPropertiesCustomKqlParams](docs/IndicatorPropertiesCustomKqlParams.md) - - [Model4xxResponse](docs/Model4xxResponse.md) + - [IndicatorPropertiesCustomMetric](docs/IndicatorPropertiesCustomMetric.md) + - [IndicatorPropertiesCustomMetricParams](docs/IndicatorPropertiesCustomMetricParams.md) + - [IndicatorPropertiesCustomMetricParamsGood](docs/IndicatorPropertiesCustomMetricParamsGood.md) + - [IndicatorPropertiesCustomMetricParamsGoodMetricsInner](docs/IndicatorPropertiesCustomMetricParamsGoodMetricsInner.md) + - [IndicatorPropertiesCustomMetricParamsTotal](docs/IndicatorPropertiesCustomMetricParamsTotal.md) + - [IndicatorPropertiesCustomMetricParamsTotalMetricsInner](docs/IndicatorPropertiesCustomMetricParamsTotalMetricsInner.md) + - [IndicatorPropertiesHistogram](docs/IndicatorPropertiesHistogram.md) + - [IndicatorPropertiesHistogramParams](docs/IndicatorPropertiesHistogramParams.md) + - [IndicatorPropertiesHistogramParamsGood](docs/IndicatorPropertiesHistogramParamsGood.md) + - [IndicatorPropertiesHistogramParamsTotal](docs/IndicatorPropertiesHistogramParamsTotal.md) + - [Model400Response](docs/Model400Response.md) + - [Model401Response](docs/Model401Response.md) + - [Model403Response](docs/Model403Response.md) + - [Model404Response](docs/Model404Response.md) + - [Model409Response](docs/Model409Response.md) - [Objective](docs/Objective.md) - [Settings](docs/Settings.md) - [SloResponse](docs/SloResponse.md) - [SloResponseIndicator](docs/SloResponseIndicator.md) - - [SloResponseTimeWindow](docs/SloResponseTimeWindow.md) - [Summary](docs/Summary.md) - - [TimeWindowCalendarAligned](docs/TimeWindowCalendarAligned.md) - - [TimeWindowCalendarAlignedCalendar](docs/TimeWindowCalendarAlignedCalendar.md) - - [TimeWindowRolling](docs/TimeWindowRolling.md) + - [SummaryStatus](docs/SummaryStatus.md) + - [TimeWindow](docs/TimeWindow.md) - [UpdateSloRequest](docs/UpdateSloRequest.md) ## Documentation For Authorization - +Authentication schemes defined for the API: ### basicAuth - **Type**: HTTP basic authentication @@ -133,7 +146,6 @@ auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAut r, err := client.Service.Operation(auth, args) ``` - ### apiKeyAuth - **Type**: API key @@ -142,6 +154,19 @@ r, err := client.Service.Operation(auth, args) 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. +Example + +```golang +auth := context.WithValue( + context.Background(), + sw.ContextAPIKeys, + map[string]sw.APIKey{ + "ApiKey": {Key: "API_KEY_STRING"}, + }, + ) +r, err := client.Service.Operation(auth, args) +``` + ## Documentation for Utility Methods diff --git a/generated/slo/api/openapi.yaml b/generated/slo/api/openapi.yaml index 531f27904..c5477b6b0 100644 --- a/generated/slo/api/openapi.yaml +++ b/generated/slo/api/openapi.yaml @@ -7,7 +7,7 @@ info: name: Elastic License 2.0 url: https://www.elastic.co/licensing/elastic-license title: SLOs - version: "0.1" + version: "1.0" servers: - description: local url: http://localhost:5601 @@ -16,13 +16,16 @@ security: - apiKeyAuth: [] tags: - description: "SLO APIs enable you to define, manage and track service-level objectives" - name: slos + 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: description: | You must have the `read` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. - operationId: findSlos + operationId: findSlosOp parameters: - description: Cross-site request forgery protection explode: false @@ -42,27 +45,15 @@ paths: example: default type: string style: simple - - description: Filter by name - example: awesome-service + - description: A valid kql query to filter the SLO with + example: "slo.name:latency* and slo.tags : \"prod\"" explode: true in: query - name: name + name: kqlQuery required: false schema: type: string style: form - - description: Filter by indicator type - example: - - sli.kql.custom - explode: true - in: query - name: indicatorTypes - required: false - schema: - items: - type: string - type: array - style: form - description: The page number to return example: 1 explode: true @@ -74,7 +65,7 @@ paths: type: integer style: form - description: The number of SLOs to return per page - example: 20 + example: 25 explode: true in: query name: perPage @@ -84,16 +75,18 @@ paths: type: integer style: form - description: Sort by field - example: name + example: status explode: true in: query name: sortBy required: false schema: - default: name + default: status enum: - - creationTime - - indicatorType + - sli_value + - status + - error_budget_consumed + - error_budget_remaining type: string style: form - description: Sort order @@ -120,21 +113,33 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/400_response' description: Bad request "401": content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/401_response' description: Unauthorized response + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' + description: Unauthorized response + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + description: Not found response summary: Retrieves a paginated list of SLOs tags: - - slos + - slo post: description: | You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. - operationId: createSlo + operationId: createSloOp parameters: - description: Cross-site request forgery protection explode: false @@ -171,24 +176,36 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/400_response' description: Bad request "401": content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/401_response' + description: Unauthorized response + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' description: Unauthorized response + "409": + content: + application/json: + schema: + $ref: '#/components/schemas/409_response' + description: Conflict - The SLO id already exists servers: - url: https://localhost:5601 summary: Creates an SLO. tags: - - slos + - slo /s/{spaceId}/api/observability/slos/{sloId}: delete: description: | You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. - operationId: deleteSlo + operationId: deleteSloOp parameters: - description: Cross-site request forgery protection explode: false @@ -224,21 +241,33 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/400_response' description: Bad request "401": content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/401_response' + description: Unauthorized response + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' description: Unauthorized response + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + description: Not found response summary: Deletes an SLO tags: - - slos + - slo get: description: | You must have the `read` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. - operationId: getSlo + operationId: getSloOp parameters: - description: Cross-site request forgery protection explode: false @@ -267,6 +296,15 @@ paths: example: 9c235211-6834-11ea-a78c-6feb38a34414 type: string style: simple + - description: the specific instanceId used by the summary calculation + example: host-abcde + explode: true + in: query + name: instanceId + required: false + schema: + type: string + style: form responses: "200": content: @@ -278,21 +316,33 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/400_response' description: Bad request "401": content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/401_response' + description: Unauthorized response + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' description: Unauthorized response + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + description: Not found response summary: Retrieves a SLO tags: - - slos + - slo put: description: | You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. - operationId: updateSlo + operationId: updateSloOp parameters: - description: Cross-site request forgery protection explode: false @@ -338,22 +388,34 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/400_response' description: Bad request "401": content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/401_response' description: Unauthorized response + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' + description: Unauthorized response + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + description: Not found response summary: Updates an SLO tags: - - slos + - slo /s/{spaceId}/api/observability/slos/{sloId}/enable: post: description: | You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. - operationId: enableSlo + operationId: enableSloOp parameters: - description: Cross-site request forgery protection explode: false @@ -389,22 +451,34 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/400_response' description: Bad request "401": content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/401_response' + description: Unauthorized response + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' description: Unauthorized response + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + description: Not found response summary: Enables an SLO tags: - - slos + - slo /s/{spaceId}/api/observability/slos/{sloId}/disable: post: description: | You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. - operationId: disableSlo + operationId: disableSloOp parameters: - description: Cross-site request forgery protection explode: false @@ -440,22 +514,34 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/400_response' description: Bad request "401": content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/401_response' + description: Unauthorized response + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' description: Unauthorized response + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + description: Not found response summary: Disables an SLO tags: - - slos + - slo /s/{spaceId}/internal/observability/slos/_historical_summary: post: description: | You must have the `read` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. - operationId: historicalSummary + operationId: historicalSummaryOp parameters: - description: Cross-site request forgery protection explode: false @@ -492,17 +578,23 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/400_response' description: Bad request "401": content: application/json: schema: - $ref: '#/components/schemas/4xx_response' + $ref: '#/components/schemas/401_response' + description: Unauthorized response + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' description: Unauthorized response summary: Retrieves the historical summary for a list of SLOs tags: - - slos + - slo components: parameters: kbn_xsrf: @@ -536,6 +628,20 @@ components: type: string style: simple schemas: + indicator_properties_apm_availability: + description: Defines properties for the APM availability indicator type + properties: + params: + $ref: '#/components/schemas/indicator_properties_apm_availability_params' + type: + description: The type of indicator. + example: sli.apm.transactionDuration + type: string + required: + - params + - type + title: APM availability + type: object indicator_properties_custom_kql: description: Defines properties for a custom KQL indicator type properties: @@ -548,13 +654,13 @@ components: required: - params - type - title: Custom KQL indicator type definition + title: Custom KQL type: object - indicator_properties_apm_availability: - description: Defines properties for the APM availability indicator type + indicator_properties_apm_latency: + description: Defines properties for the APM latency indicator type properties: params: - $ref: '#/components/schemas/indicator_properties_apm_availability_params' + $ref: '#/components/schemas/indicator_properties_apm_latency_params' type: description: The type of indicator. example: sli.apm.transactionDuration @@ -562,54 +668,63 @@ components: required: - params - type - title: APM availability indicator type definition + title: APM latency type: object - indicator_properties_apm_latency: - description: Defines properties for the APM latency indicator type + indicator_properties_custom_metric: + description: Defines properties for a custom metric indicator type properties: params: - $ref: '#/components/schemas/indicator_properties_apm_latency_params' + $ref: '#/components/schemas/indicator_properties_custom_metric_params' type: description: The type of indicator. - example: sli.apm.transactionDuration + example: sli.metric.custom type: string required: - params - type - title: APM latency indicator type definition + title: Custom metric type: object - time_window_rolling: - description: Defines properties for rolling time window + indicator_properties_histogram: + description: Defines properties for a histogram indicator type properties: - duration: - description: "the duration formatted as {duration}{unit}" - example: 28d + params: + $ref: '#/components/schemas/indicator_properties_histogram_params' + type: + description: The type of indicator. + example: sli.histogram.custom type: string - isRolling: - description: Indicates a rolling time window - example: true - type: boolean required: - - duration - - isRolling - title: Rolling time window definition + - params + - type + title: Histogram indicator type: object - time_window_calendar_aligned: - description: Defines properties for calendar aligned time window + time_window: + description: Defines properties for the SLO time window + example: + duration: 30d + type: rolling properties: duration: - description: "the duration formatted as {duration}{unit}" - example: 1M + description: "the duration formatted as {duration}{unit}. Accepted values\ + \ for rolling: 7d, 30d, 90d. Accepted values for calendar aligned: 1w\ + \ (weekly) or 1M (monthly)" + example: 30d + type: string + type: + description: Indicates weither the time window is a rolling or a calendar + aligned time window. + enum: + - rolling + - calendarAligned + example: rolling type: string - calendar: - $ref: '#/components/schemas/time_window_calendar_aligned_calendar' required: - - calendar - duration - title: Calendar aligned time window definition + - type + title: Time window type: object budgeting_method: - description: The budgeting method to use + description: The budgeting method to use when computing the rollup data. enum: - occurrences - timeslices @@ -617,32 +732,32 @@ components: title: Budgeting method type: string objective: - description: Defines properties for objective + description: Defines properties for the SLO objective example: - timeslicesTarget: 0.995 - timeslicesWindow: 5m + timesliceWindow: 5m + timesliceTarget: 0.995 target: 0.99 properties: target: description: the target objective between 0 and 1 excluded example: 0.99 type: number - timeslicesTarget: + timesliceTarget: description: the target objective for each slice when using a timeslices budgeting method example: 0.995 type: number - timeslicesWindow: + timesliceWindow: description: "the duration of each slice when using a timeslices budgeting\ \ method, as {duraton}{unit}" example: 5m type: string required: - target - title: Objective definition + title: Objective type: object settings: - description: Defines properties for settings. + description: Defines properties for SLO settings. example: syncDelay: 5m frequency: 5m @@ -655,8 +770,17 @@ components: description: "Configure how often the transform runs, default 1m" example: 5m type: string - title: Settings definition + title: Settings type: object + summary_status: + enum: + - NO_DATA + - HEALTHY + - DEGRADING + - VIOLATED + example: HEALTHY + title: summary status + type: string error_budget: example: consumed: 0.8 @@ -683,9 +807,15 @@ components: calendar aligned time window. example: true type: boolean - title: Error budget definition + required: + - consumed + - initial + - isEstimated + - remaining + title: Error budget type: object summary: + description: The SLO computed data example: errorBudget: consumed: 0.8 @@ -696,19 +826,17 @@ components: sliValue: 0.9836 properties: status: - enum: - - NO_DATA - - HEALTHY - - DEGRADING - - VIOLATED - example: HEALTHY - type: string + $ref: '#/components/schemas/summary_status' sliValue: example: 0.9836 type: number errorBudget: $ref: '#/components/schemas/error_budget' - title: Summary definition + required: + - errorBudget + - sliValue + - status + title: Summary type: object slo_response: example: @@ -724,15 +852,19 @@ components: settings: syncDelay: 5m frequency: 5m - timeWindow: null + timeWindow: + duration: 30d + type: rolling description: My SLO description + groupBy: some.field enabled: true objective: - timeslicesTarget: 0.995 - timeslicesWindow: 5m + timesliceWindow: 5m + timesliceTarget: 0.995 target: 0.99 revision: 2 createdAt: 2023-01-12T10:03:19.000Z + instanceId: host-abcde name: My Service SLO id: 8853df00-ae2e-11ed-90af-09bb6422b258 budgetingMethod: occurrences @@ -753,7 +885,7 @@ components: indicator: $ref: '#/components/schemas/slo_response_indicator' timeWindow: - $ref: '#/components/schemas/slo_response_timeWindow' + $ref: '#/components/schemas/time_window' budgetingMethod: $ref: '#/components/schemas/budgeting_method' objective: @@ -770,6 +902,16 @@ components: description: Indicate if the SLO is enabled example: true type: boolean + groupBy: + description: optional group by field to use to generate an SLO per distinct + value + example: some.field + type: string + instanceId: + description: "the value derived from the groupBy field, if present, otherwise\ + \ '*'" + example: host-abcde + type: string createdAt: description: The creation date example: 2023-01-12T10:03:19.000Z @@ -778,7 +920,23 @@ components: description: The last update date example: 2023-01-12T10:03:19.000Z type: string - title: SLO Response + required: + - budgetingMethod + - createdAt + - description + - enabled + - groupBy + - id + - indicator + - instanceId + - name + - objective + - revision + - settings + - summary + - timeWindow + - updatedAt + title: SLO response type: object find_slo_response: description: | @@ -800,15 +958,19 @@ components: settings: syncDelay: 5m frequency: 5m - timeWindow: null + timeWindow: + duration: 30d + type: rolling description: My SLO description + groupBy: some.field enabled: true objective: - timeslicesTarget: 0.995 - timeslicesWindow: 5m + timesliceWindow: 5m + timesliceTarget: 0.995 target: 0.99 revision: 2 createdAt: 2023-01-12T10:03:19.000Z + instanceId: host-abcde name: My Service SLO id: 8853df00-ae2e-11ed-90af-09bb6422b258 budgetingMethod: occurrences @@ -825,15 +987,19 @@ components: settings: syncDelay: 5m frequency: 5m - timeWindow: null + timeWindow: + duration: 30d + type: rolling description: My SLO description + groupBy: some.field enabled: true objective: - timeslicesTarget: 0.995 - timeslicesWindow: 5m + timesliceWindow: 5m + timesliceTarget: 0.995 target: 0.99 revision: 2 createdAt: 2023-01-12T10:03:19.000Z + instanceId: host-abcde name: My Service SLO id: 8853df00-ae2e-11ed-90af-09bb6422b258 budgetingMethod: occurrences @@ -854,7 +1020,24 @@ components: type: array title: Find SLO response type: object - "4xx_response": + "400_response": + properties: + statusCode: + example: 400 + type: number + error: + example: Bad Request + type: string + message: + example: "Invalid value 'foo' supplied to: [...]" + type: string + required: + - error + - message + - statusCode + title: Bad request + type: object + "401_response": properties: statusCode: example: 401 @@ -871,12 +1054,53 @@ components: - error - message - statusCode - title: Bad response + title: Unauthorized + type: object + "403_response": + properties: + statusCode: + example: 403 + type: number + error: + example: Unauthorized + type: string + message: + example: "[security_exception\n\tRoot causes:\n\t\tsecurity_exception: unable\ + \ to authenticate user [elastics] for REST request [/_security/_authenticate]]:\ + \ unable to authenticate user [elastics] for REST request [/_security/_authenticate]" + type: string + required: + - error + - message + - statusCode + title: Unauthorized + type: object + "404_response": + properties: + statusCode: + example: 404 + type: number + error: + example: Not Found + type: string + message: + example: "SLO [3749f390-03a3-11ee-8139-c7ff60a1692d] not found" + type: string + required: + - error + - message + - statusCode + title: Not found type: object create_slo_request: description: | The create SLO API request body varies depending on the type of indicator, time window and budgeting method. properties: + id: + description: A optional and unique identifier for the SLO. Must be between + 8 and 36 chars + example: my-super-slo-id + type: string name: description: A name for the SLO. type: string @@ -884,15 +1108,20 @@ components: description: A description for the SLO. type: string indicator: - $ref: '#/components/schemas/slo_response_indicator' + $ref: '#/components/schemas/create_slo_request_indicator' timeWindow: - $ref: '#/components/schemas/slo_response_timeWindow' + $ref: '#/components/schemas/time_window' budgetingMethod: $ref: '#/components/schemas/budgeting_method' objective: $ref: '#/components/schemas/objective' settings: $ref: '#/components/schemas/settings' + groupBy: + description: optional group by field to use to generate an SLO per distinct + value + example: some.field + type: string required: - budgetingMethod - description @@ -913,9 +1142,26 @@ components: - id title: Create SLO response type: object + "409_response": + properties: + statusCode: + example: 409 + type: number + error: + example: Conflict + type: string + message: + example: "SLO [d077e940-1515-11ee-9c50-9d096392f520] already exists" + type: string + required: + - error + - message + - statusCode + title: Conflict + type: object update_slo_request: description: | - The update SLO API request body varies depending on the type of indicator, time window and budgeting method. Partial update is handled. + The update SLO API request body varies depending on the type of indicator, time window and budgeting method. Partial update is handled. properties: name: description: A name for the SLO. @@ -924,9 +1170,9 @@ components: description: A description for the SLO. type: string indicator: - $ref: '#/components/schemas/slo_response_indicator' + $ref: '#/components/schemas/create_slo_request_indicator' timeWindow: - $ref: '#/components/schemas/slo_response_timeWindow' + $ref: '#/components/schemas/time_window' budgetingMethod: $ref: '#/components/schemas/budgeting_method' objective: @@ -954,6 +1200,41 @@ components: type: array title: Historical summary response type: object + indicator_properties_apm_availability_params: + description: An object containing the indicator parameters. + nullable: false + properties: + service: + description: The APM service name + example: o11y-app + type: string + environment: + description: The APM service environment or "*" + example: production + type: string + transactionType: + description: The APM transaction type or "*" + example: request + type: string + transactionName: + description: The APM transaction name or "*" + example: GET /my/api + type: string + filter: + description: KQL query used for filtering the data + example: "service.foo : \"bar\"" + type: string + index: + description: The index used by APM metrics + example: "metrics-apm*,apm*" + type: string + required: + - environment + - index + - service + - transactionName + - transactionType + type: object indicator_properties_custom_kql_params: description: An object containing the indicator parameters. nullable: false @@ -976,14 +1257,14 @@ components: type: string timestampField: description: | - The timestamp field used in the source indice. If not specified, @timestamp will be used. + The timestamp field used in the source indice. example: timestamp type: string required: - index - timestampField type: object - indicator_properties_apm_availability_params: + indicator_properties_apm_latency_params: description: An object containing the indicator parameters. nullable: false properties: @@ -1003,16 +1284,6 @@ components: description: The APM transaction name or "*" example: GET /my/api type: string - goodStatusCodes: - description: "The status codes considered as good events. Default to 2xx,\ - \ 3xx and 4xx" - example: - - 2xx - - 3xx - - 4xx - items: - type: string - type: array filter: description: KQL query used for filtering the data example: "service.foo : \"bar\"" @@ -1021,78 +1292,252 @@ components: description: The index used by APM metrics example: "metrics-apm*,apm*" type: string + threshold: + description: The latency threshold in milliseconds + example: 250 + type: number required: - environment - index - service + - threshold - transactionName - transactionType type: object - indicator_properties_apm_latency_params: - description: An object containing the indicator parameters. - nullable: false + indicator_properties_custom_metric_params_good_metrics_inner: properties: - service: - description: The APM service name - example: o11y-app + name: + description: The name of the metric. Only valid options are A-Z + example: A + pattern: "^[A-Z]$" type: string - environment: - description: The APM service environment or "*" - example: production + aggregation: + description: The aggregation type of the metric. Only valid option is "sum" + enum: + - sum + example: sum type: string - transactionType: - description: The APM transaction type or "*" - example: request + field: + description: The field of the metric. + example: processor.processed type: string - transactionName: - description: The APM transaction name or "*" - example: GET /my/api + filter: + description: The filter to apply to the metric. + example: "processor.outcome: \"success\"" + type: string + required: + - aggregation + - field + - name + type: object + indicator_properties_custom_metric_params_good: + description: | + An object defining the "good" metrics and equation + properties: + metrics: + description: "List of metrics with their name, aggregation type, and field." + items: + $ref: '#/components/schemas/indicator_properties_custom_metric_params_good_metrics_inner' + type: array + equation: + description: The equation to calculate the "good" metric. + example: A + type: string + required: + - equation + - metrics + type: object + indicator_properties_custom_metric_params_total_metrics_inner: + 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 "sum" + enum: + - sum + example: sum + type: string + field: + description: The field of the metric. + example: processor.processed type: string filter: - description: KQL query used for filtering the data - example: "service.foo : \"bar\"" + description: The filter to apply to the metric. + example: "processor.outcome: *" type: string + required: + - aggregation + - field + - name + type: object + indicator_properties_custom_metric_params_total: + description: | + An object defining the "total" metrics and equation + properties: + metrics: + description: "List of metrics with their name, aggregation type, and field." + items: + $ref: '#/components/schemas/indicator_properties_custom_metric_params_total_metrics_inner' + type: array + equation: + description: The equation to calculate the "total" metric. + example: A + type: string + required: + - equation + - metrics + type: object + indicator_properties_custom_metric_params: + description: An object containing the indicator parameters. + nullable: false + properties: index: - description: The index used by APM metrics - example: "metrics-apm*,apm*" + 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 + good: + $ref: '#/components/schemas/indicator_properties_custom_metric_params_good' + total: + $ref: '#/components/schemas/indicator_properties_custom_metric_params_total' required: - - environment + - filter + - good - index - - service - - transactionName - - transactionType + - timestampField + - total type: object - time_window_calendar_aligned_calendar: - description: Defines the calendar start date + indicator_properties_histogram_params_good: + description: | + An object defining the "good" events properties: - startTime: - description: The start date to use. - example: 2022-01-01T08:00:00.000Z + field: + description: The field use to aggregate the good events. + example: processor.latency type: string + aggregation: + description: The type of aggregation to use. + enum: + - value_count + - range + example: value_count + type: string + filter: + description: The filter for good events. + example: "processor.outcome: \"success\"" + type: string + from: + description: The starting value of the range. Only required for "range" + aggregations. + example: 0 + type: number + to: + description: The ending value of the range. Only required for "range" aggregations. + example: 100 + type: number + required: + - aggregation + - field + type: object + indicator_properties_histogram_params_total: + description: | + An object defining the "total" events + properties: + field: + description: The field use to aggregate the good events. + example: processor.latency + type: string + aggregation: + description: The type of aggregation to use. + enum: + - value_count + - range + example: value_count + type: string + filter: + description: The filter for total events. + example: "processor.outcome : *" + type: string + from: + description: The starting value of the range. Only required for "range" + aggregations. + example: 0 + type: number + to: + description: The ending value of the range. Only required for "range" aggregations. + example: 100 + type: number + required: + - aggregation + - field + type: object + indicator_properties_histogram_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 + good: + $ref: '#/components/schemas/indicator_properties_histogram_params_good' + total: + $ref: '#/components/schemas/indicator_properties_histogram_params_total' + required: + - good + - index + - timestampField + - total type: object slo_response_indicator: + discriminator: + mapping: + sli.apm.transactionErrorRate: '#/components/schemas/indicator_properties_apm_availability' + sli.kql.custom: '#/components/schemas/indicator_properties_custom_kql' + 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' + propertyName: type oneOf: - $ref: '#/components/schemas/indicator_properties_custom_kql' - $ref: '#/components/schemas/indicator_properties_apm_availability' - $ref: '#/components/schemas/indicator_properties_apm_latency' - slo_response_timeWindow: + - $ref: '#/components/schemas/indicator_properties_custom_metric' + - $ref: '#/components/schemas/indicator_properties_histogram' + create_slo_request_indicator: oneOf: - - $ref: '#/components/schemas/time_window_rolling' - - $ref: '#/components/schemas/time_window_calendar_aligned' + - $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' Historical_summary_response_inner: properties: date: example: 2022-01-01T00:00:00.000Z type: string status: - enum: - - NO_DATA - - HEALTHY - - DEGRADING - - VIOLATED - example: HEALTHY - type: string + $ref: '#/components/schemas/summary_status' sliValue: example: 0.9836 type: number diff --git a/generated/slo/api_slos.go b/generated/slo/api_slo.go similarity index 72% rename from generated/slo/api_slos.go rename to generated/slo/api_slo.go index 6d2aba504..fb518a05d 100644 --- a/generated/slo/api_slos.go +++ b/generated/slo/api_slo.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -16,30 +16,29 @@ import ( "io" "net/http" "net/url" - "reflect" "strings" ) -type SlosApi interface { +type SloAPI interface { /* - CreateSlo Creates an SLO. + CreateSloOp Creates an SLO. 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 ApiCreateSloRequest + @return ApiCreateSloOpRequest */ - CreateSlo(ctx context.Context, spaceId string) ApiCreateSloRequest + CreateSloOp(ctx context.Context, spaceId string) ApiCreateSloOpRequest - // CreateSloExecute executes the request + // CreateSloOpExecute executes the request // @return CreateSloResponse - CreateSloExecute(r ApiCreateSloRequest) (*CreateSloResponse, *http.Response, error) + CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloResponse, *http.Response, error) /* - DeleteSlo Deletes an SLO + DeleteSloOp Deletes an SLO You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. @@ -47,15 +46,15 @@ type SlosApi interface { @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. @param sloId An identifier for the slo. - @return ApiDeleteSloRequest + @return ApiDeleteSloOpRequest */ - DeleteSlo(ctx context.Context, spaceId string, sloId string) ApiDeleteSloRequest + DeleteSloOp(ctx context.Context, spaceId string, sloId string) ApiDeleteSloOpRequest - // DeleteSloExecute executes the request - DeleteSloExecute(r ApiDeleteSloRequest) (*http.Response, error) + // DeleteSloOpExecute executes the request + DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Response, error) /* - DisableSlo Disables an SLO + DisableSloOp Disables an SLO You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. @@ -63,15 +62,15 @@ type SlosApi interface { @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. @param sloId An identifier for the slo. - @return ApiDisableSloRequest + @return ApiDisableSloOpRequest */ - DisableSlo(ctx context.Context, spaceId string, sloId string) ApiDisableSloRequest + DisableSloOp(ctx context.Context, spaceId string, sloId string) ApiDisableSloOpRequest - // DisableSloExecute executes the request - DisableSloExecute(r ApiDisableSloRequest) (*http.Response, error) + // DisableSloOpExecute executes the request + DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Response, error) /* - EnableSlo Enables an SLO + EnableSloOp Enables an SLO You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. @@ -79,31 +78,31 @@ type SlosApi interface { @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. @param sloId An identifier for the slo. - @return ApiEnableSloRequest + @return ApiEnableSloOpRequest */ - EnableSlo(ctx context.Context, spaceId string, sloId string) ApiEnableSloRequest + EnableSloOp(ctx context.Context, spaceId string, sloId string) ApiEnableSloOpRequest - // EnableSloExecute executes the request - EnableSloExecute(r ApiEnableSloRequest) (*http.Response, error) + // EnableSloOpExecute executes the request + EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Response, error) /* - FindSlos Retrieves a paginated list of SLOs + FindSlosOp Retrieves a paginated list of SLOs You must have the `read` 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 ApiFindSlosRequest + @return ApiFindSlosOpRequest */ - FindSlos(ctx context.Context, spaceId string) ApiFindSlosRequest + FindSlosOp(ctx context.Context, spaceId string) ApiFindSlosOpRequest - // FindSlosExecute executes the request + // FindSlosOpExecute executes the request // @return FindSloResponse - FindSlosExecute(r ApiFindSlosRequest) (*FindSloResponse, *http.Response, error) + FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloResponse, *http.Response, error) /* - GetSlo Retrieves a SLO + GetSloOp Retrieves a SLO You must have the `read` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. @@ -111,32 +110,32 @@ type SlosApi interface { @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. @param sloId An identifier for the slo. - @return ApiGetSloRequest + @return ApiGetSloOpRequest */ - GetSlo(ctx context.Context, spaceId string, sloId string) ApiGetSloRequest + GetSloOp(ctx context.Context, spaceId string, sloId string) ApiGetSloOpRequest - // GetSloExecute executes the request + // GetSloOpExecute executes the request // @return SloResponse - GetSloExecute(r ApiGetSloRequest) (*SloResponse, *http.Response, error) + GetSloOpExecute(r ApiGetSloOpRequest) (*SloResponse, *http.Response, error) /* - HistoricalSummary Retrieves the historical summary for a list of SLOs + HistoricalSummaryOp Retrieves the historical summary for a list of SLOs You must have the `read` 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 ApiHistoricalSummaryRequest + @return ApiHistoricalSummaryOpRequest */ - HistoricalSummary(ctx context.Context, spaceId string) ApiHistoricalSummaryRequest + HistoricalSummaryOp(ctx context.Context, spaceId string) ApiHistoricalSummaryOpRequest - // HistoricalSummaryExecute executes the request + // HistoricalSummaryOpExecute executes the request // @return map[string][]HistoricalSummaryResponseInner - HistoricalSummaryExecute(r ApiHistoricalSummaryRequest) (*map[string][]HistoricalSummaryResponseInner, *http.Response, error) + HistoricalSummaryOpExecute(r ApiHistoricalSummaryOpRequest) (*map[string][]HistoricalSummaryResponseInner, *http.Response, error) /* - UpdateSlo Updates an SLO + UpdateSloOp Updates an SLO You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. @@ -144,52 +143,52 @@ type SlosApi interface { @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. @param sloId An identifier for the slo. - @return ApiUpdateSloRequest + @return ApiUpdateSloOpRequest */ - UpdateSlo(ctx context.Context, spaceId string, sloId string) ApiUpdateSloRequest + UpdateSloOp(ctx context.Context, spaceId string, sloId string) ApiUpdateSloOpRequest - // UpdateSloExecute executes the request + // UpdateSloOpExecute executes the request // @return SloResponse - UpdateSloExecute(r ApiUpdateSloRequest) (*SloResponse, *http.Response, error) + UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloResponse, *http.Response, error) } -// SlosApiService SlosApi service -type SlosApiService service +// SloAPIService SloAPI service +type SloAPIService service -type ApiCreateSloRequest struct { +type ApiCreateSloOpRequest struct { ctx context.Context - ApiService SlosApi + ApiService SloAPI kbnXsrf *string spaceId string createSloRequest *CreateSloRequest } // Cross-site request forgery protection -func (r ApiCreateSloRequest) KbnXsrf(kbnXsrf string) ApiCreateSloRequest { +func (r ApiCreateSloOpRequest) KbnXsrf(kbnXsrf string) ApiCreateSloOpRequest { r.kbnXsrf = &kbnXsrf return r } -func (r ApiCreateSloRequest) CreateSloRequest(createSloRequest CreateSloRequest) ApiCreateSloRequest { +func (r ApiCreateSloOpRequest) CreateSloRequest(createSloRequest CreateSloRequest) ApiCreateSloOpRequest { r.createSloRequest = &createSloRequest return r } -func (r ApiCreateSloRequest) Execute() (*CreateSloResponse, *http.Response, error) { - return r.ApiService.CreateSloExecute(r) +func (r ApiCreateSloOpRequest) Execute() (*CreateSloResponse, *http.Response, error) { + return r.ApiService.CreateSloOpExecute(r) } /* -CreateSlo Creates an SLO. +CreateSloOp Creates an SLO. 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 ApiCreateSloRequest + @return ApiCreateSloOpRequest */ -func (a *SlosApiService) CreateSlo(ctx context.Context, spaceId string) ApiCreateSloRequest { - return ApiCreateSloRequest{ +func (a *SloAPIService) CreateSloOp(ctx context.Context, spaceId string) ApiCreateSloOpRequest { + return ApiCreateSloOpRequest{ ApiService: a, ctx: ctx, spaceId: spaceId, @@ -199,7 +198,7 @@ func (a *SlosApiService) CreateSlo(ctx context.Context, spaceId string) ApiCreat // Execute executes the request // // @return CreateSloResponse -func (a *SlosApiService) CreateSloExecute(r ApiCreateSloRequest) (*CreateSloResponse, *http.Response, error) { +func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} @@ -207,7 +206,7 @@ func (a *SlosApiService) CreateSloExecute(r ApiCreateSloRequest) (*CreateSloResp localVarReturnValue *CreateSloResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlosApiService.CreateSlo") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.CreateSloOp") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -282,7 +281,7 @@ func (a *SlosApiService) CreateSloExecute(r ApiCreateSloRequest) (*CreateSloResp error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v Model4xxResponse + var v Model400Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -293,7 +292,29 @@ func (a *SlosApiService) CreateSloExecute(r ApiCreateSloRequest) (*CreateSloResp return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { - var v Model4xxResponse + var v Model401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, 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 localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Model409Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -317,36 +338,36 @@ func (a *SlosApiService) CreateSloExecute(r ApiCreateSloRequest) (*CreateSloResp return localVarReturnValue, localVarHTTPResponse, nil } -type ApiDeleteSloRequest struct { +type ApiDeleteSloOpRequest struct { ctx context.Context - ApiService SlosApi + ApiService SloAPI kbnXsrf *string spaceId string sloId string } // Cross-site request forgery protection -func (r ApiDeleteSloRequest) KbnXsrf(kbnXsrf string) ApiDeleteSloRequest { +func (r ApiDeleteSloOpRequest) KbnXsrf(kbnXsrf string) ApiDeleteSloOpRequest { r.kbnXsrf = &kbnXsrf return r } -func (r ApiDeleteSloRequest) Execute() (*http.Response, error) { - return r.ApiService.DeleteSloExecute(r) +func (r ApiDeleteSloOpRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteSloOpExecute(r) } /* -DeleteSlo Deletes an SLO +DeleteSloOp Deletes an SLO You must have the `write` 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. @param sloId An identifier for the slo. - @return ApiDeleteSloRequest + @return ApiDeleteSloOpRequest */ -func (a *SlosApiService) DeleteSlo(ctx context.Context, spaceId string, sloId string) ApiDeleteSloRequest { - return ApiDeleteSloRequest{ +func (a *SloAPIService) DeleteSloOp(ctx context.Context, spaceId string, sloId string) ApiDeleteSloOpRequest { + return ApiDeleteSloOpRequest{ ApiService: a, ctx: ctx, spaceId: spaceId, @@ -355,14 +376,14 @@ func (a *SlosApiService) DeleteSlo(ctx context.Context, spaceId string, sloId st } // Execute executes the request -func (a *SlosApiService) DeleteSloExecute(r ApiDeleteSloRequest) (*http.Response, error) { +func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlosApiService.DeleteSlo") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.DeleteSloOp") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } @@ -433,7 +454,7 @@ func (a *SlosApiService) DeleteSloExecute(r ApiDeleteSloRequest) (*http.Response error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v Model4xxResponse + var v Model400Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -444,7 +465,29 @@ func (a *SlosApiService) DeleteSloExecute(r ApiDeleteSloRequest) (*http.Response return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { - var v Model4xxResponse + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Model404Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -459,36 +502,36 @@ func (a *SlosApiService) DeleteSloExecute(r ApiDeleteSloRequest) (*http.Response return localVarHTTPResponse, nil } -type ApiDisableSloRequest struct { +type ApiDisableSloOpRequest struct { ctx context.Context - ApiService SlosApi + ApiService SloAPI kbnXsrf *string spaceId string sloId string } // Cross-site request forgery protection -func (r ApiDisableSloRequest) KbnXsrf(kbnXsrf string) ApiDisableSloRequest { +func (r ApiDisableSloOpRequest) KbnXsrf(kbnXsrf string) ApiDisableSloOpRequest { r.kbnXsrf = &kbnXsrf return r } -func (r ApiDisableSloRequest) Execute() (*http.Response, error) { - return r.ApiService.DisableSloExecute(r) +func (r ApiDisableSloOpRequest) Execute() (*http.Response, error) { + return r.ApiService.DisableSloOpExecute(r) } /* -DisableSlo Disables an SLO +DisableSloOp Disables an SLO You must have the `write` 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. @param sloId An identifier for the slo. - @return ApiDisableSloRequest + @return ApiDisableSloOpRequest */ -func (a *SlosApiService) DisableSlo(ctx context.Context, spaceId string, sloId string) ApiDisableSloRequest { - return ApiDisableSloRequest{ +func (a *SloAPIService) DisableSloOp(ctx context.Context, spaceId string, sloId string) ApiDisableSloOpRequest { + return ApiDisableSloOpRequest{ ApiService: a, ctx: ctx, spaceId: spaceId, @@ -497,14 +540,14 @@ func (a *SlosApiService) DisableSlo(ctx context.Context, spaceId string, sloId s } // Execute executes the request -func (a *SlosApiService) DisableSloExecute(r ApiDisableSloRequest) (*http.Response, error) { +func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlosApiService.DisableSlo") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.DisableSloOp") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } @@ -575,7 +618,7 @@ func (a *SlosApiService) DisableSloExecute(r ApiDisableSloRequest) (*http.Respon error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v Model4xxResponse + var v Model400Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -586,7 +629,29 @@ func (a *SlosApiService) DisableSloExecute(r ApiDisableSloRequest) (*http.Respon return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { - var v Model4xxResponse + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Model404Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -601,36 +666,36 @@ func (a *SlosApiService) DisableSloExecute(r ApiDisableSloRequest) (*http.Respon return localVarHTTPResponse, nil } -type ApiEnableSloRequest struct { +type ApiEnableSloOpRequest struct { ctx context.Context - ApiService SlosApi + ApiService SloAPI kbnXsrf *string spaceId string sloId string } // Cross-site request forgery protection -func (r ApiEnableSloRequest) KbnXsrf(kbnXsrf string) ApiEnableSloRequest { +func (r ApiEnableSloOpRequest) KbnXsrf(kbnXsrf string) ApiEnableSloOpRequest { r.kbnXsrf = &kbnXsrf return r } -func (r ApiEnableSloRequest) Execute() (*http.Response, error) { - return r.ApiService.EnableSloExecute(r) +func (r ApiEnableSloOpRequest) Execute() (*http.Response, error) { + return r.ApiService.EnableSloOpExecute(r) } /* -EnableSlo Enables an SLO +EnableSloOp Enables an SLO You must have the `write` 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. @param sloId An identifier for the slo. - @return ApiEnableSloRequest + @return ApiEnableSloOpRequest */ -func (a *SlosApiService) EnableSlo(ctx context.Context, spaceId string, sloId string) ApiEnableSloRequest { - return ApiEnableSloRequest{ +func (a *SloAPIService) EnableSloOp(ctx context.Context, spaceId string, sloId string) ApiEnableSloOpRequest { + return ApiEnableSloOpRequest{ ApiService: a, ctx: ctx, spaceId: spaceId, @@ -639,14 +704,14 @@ func (a *SlosApiService) EnableSlo(ctx context.Context, spaceId string, sloId st } // Execute executes the request -func (a *SlosApiService) EnableSloExecute(r ApiEnableSloRequest) (*http.Response, error) { +func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlosApiService.EnableSlo") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.EnableSloOp") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } @@ -717,7 +782,7 @@ func (a *SlosApiService) EnableSloExecute(r ApiEnableSloRequest) (*http.Response error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v Model4xxResponse + var v Model400Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -728,7 +793,29 @@ func (a *SlosApiService) EnableSloExecute(r ApiEnableSloRequest) (*http.Response return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { - var v Model4xxResponse + 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v Model404Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -743,76 +830,69 @@ func (a *SlosApiService) EnableSloExecute(r ApiEnableSloRequest) (*http.Response return localVarHTTPResponse, nil } -type ApiFindSlosRequest struct { - ctx context.Context - ApiService SlosApi - kbnXsrf *string - spaceId string - name *string - indicatorTypes *[]string - page *int32 - perPage *int32 - sortBy *string - sortDirection *string +type ApiFindSlosOpRequest struct { + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string + kqlQuery *string + page *int32 + perPage *int32 + sortBy *string + sortDirection *string } // Cross-site request forgery protection -func (r ApiFindSlosRequest) KbnXsrf(kbnXsrf string) ApiFindSlosRequest { +func (r ApiFindSlosOpRequest) KbnXsrf(kbnXsrf string) ApiFindSlosOpRequest { r.kbnXsrf = &kbnXsrf return r } -// Filter by name -func (r ApiFindSlosRequest) Name(name string) ApiFindSlosRequest { - r.name = &name - return r -} - -// Filter by indicator type -func (r ApiFindSlosRequest) IndicatorTypes(indicatorTypes []string) ApiFindSlosRequest { - r.indicatorTypes = &indicatorTypes +// A valid kql query to filter the SLO with +func (r ApiFindSlosOpRequest) KqlQuery(kqlQuery string) ApiFindSlosOpRequest { + r.kqlQuery = &kqlQuery return r } // The page number to return -func (r ApiFindSlosRequest) Page(page int32) ApiFindSlosRequest { +func (r ApiFindSlosOpRequest) Page(page int32) ApiFindSlosOpRequest { r.page = &page return r } // The number of SLOs to return per page -func (r ApiFindSlosRequest) PerPage(perPage int32) ApiFindSlosRequest { +func (r ApiFindSlosOpRequest) PerPage(perPage int32) ApiFindSlosOpRequest { r.perPage = &perPage return r } // Sort by field -func (r ApiFindSlosRequest) SortBy(sortBy string) ApiFindSlosRequest { +func (r ApiFindSlosOpRequest) SortBy(sortBy string) ApiFindSlosOpRequest { r.sortBy = &sortBy return r } // Sort order -func (r ApiFindSlosRequest) SortDirection(sortDirection string) ApiFindSlosRequest { +func (r ApiFindSlosOpRequest) SortDirection(sortDirection string) ApiFindSlosOpRequest { r.sortDirection = &sortDirection return r } -func (r ApiFindSlosRequest) Execute() (*FindSloResponse, *http.Response, error) { - return r.ApiService.FindSlosExecute(r) +func (r ApiFindSlosOpRequest) Execute() (*FindSloResponse, *http.Response, error) { + return r.ApiService.FindSlosOpExecute(r) } /* -FindSlos Retrieves a paginated list of SLOs +FindSlosOp Retrieves a paginated list of SLOs You must have the `read` 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 ApiFindSlosRequest + @return ApiFindSlosOpRequest */ -func (a *SlosApiService) FindSlos(ctx context.Context, spaceId string) ApiFindSlosRequest { - return ApiFindSlosRequest{ +func (a *SloAPIService) FindSlosOp(ctx context.Context, spaceId string) ApiFindSlosOpRequest { + return ApiFindSlosOpRequest{ ApiService: a, ctx: ctx, spaceId: spaceId, @@ -822,7 +902,7 @@ func (a *SlosApiService) FindSlos(ctx context.Context, spaceId string) ApiFindSl // Execute executes the request // // @return FindSloResponse -func (a *SlosApiService) FindSlosExecute(r ApiFindSlosRequest) (*FindSloResponse, *http.Response, error) { +func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -830,7 +910,7 @@ func (a *SlosApiService) FindSlosExecute(r ApiFindSlosRequest) (*FindSloResponse localVarReturnValue *FindSloResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlosApiService.FindSlos") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.FindSlosOp") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -845,19 +925,8 @@ func (a *SlosApiService) FindSlosExecute(r ApiFindSlosRequest) (*FindSloResponse return localVarReturnValue, nil, reportError("kbnXsrf is required and must be specified") } - if r.name != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "") - } - if r.indicatorTypes != nil { - t := *r.indicatorTypes - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - parameterAddToHeaderOrQuery(localVarQueryParams, "indicatorTypes", s.Index(i), "multi") - } - } else { - parameterAddToHeaderOrQuery(localVarQueryParams, "indicatorTypes", t, "multi") - } + if r.kqlQuery != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "kqlQuery", r.kqlQuery, "") } if r.page != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") @@ -926,7 +995,7 @@ func (a *SlosApiService) FindSlosExecute(r ApiFindSlosRequest) (*FindSloResponse error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v Model4xxResponse + var v Model400Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -937,7 +1006,29 @@ func (a *SlosApiService) FindSlosExecute(r ApiFindSlosRequest) (*FindSloResponse return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { - var v Model4xxResponse + var v Model401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, 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 localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Model404Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -961,36 +1052,43 @@ func (a *SlosApiService) FindSlosExecute(r ApiFindSlosRequest) (*FindSloResponse return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetSloRequest struct { +type ApiGetSloOpRequest struct { ctx context.Context - ApiService SlosApi + ApiService SloAPI kbnXsrf *string spaceId string sloId string + instanceId *string } // Cross-site request forgery protection -func (r ApiGetSloRequest) KbnXsrf(kbnXsrf string) ApiGetSloRequest { +func (r ApiGetSloOpRequest) KbnXsrf(kbnXsrf string) ApiGetSloOpRequest { r.kbnXsrf = &kbnXsrf return r } -func (r ApiGetSloRequest) Execute() (*SloResponse, *http.Response, error) { - return r.ApiService.GetSloExecute(r) +// the specific instanceId used by the summary calculation +func (r ApiGetSloOpRequest) InstanceId(instanceId string) ApiGetSloOpRequest { + r.instanceId = &instanceId + return r +} + +func (r ApiGetSloOpRequest) Execute() (*SloResponse, *http.Response, error) { + return r.ApiService.GetSloOpExecute(r) } /* -GetSlo Retrieves a SLO +GetSloOp Retrieves a SLO You must have the `read` 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. @param sloId An identifier for the slo. - @return ApiGetSloRequest + @return ApiGetSloOpRequest */ -func (a *SlosApiService) GetSlo(ctx context.Context, spaceId string, sloId string) ApiGetSloRequest { - return ApiGetSloRequest{ +func (a *SloAPIService) GetSloOp(ctx context.Context, spaceId string, sloId string) ApiGetSloOpRequest { + return ApiGetSloOpRequest{ ApiService: a, ctx: ctx, spaceId: spaceId, @@ -1001,7 +1099,7 @@ func (a *SlosApiService) GetSlo(ctx context.Context, spaceId string, sloId strin // Execute executes the request // // @return SloResponse -func (a *SlosApiService) GetSloExecute(r ApiGetSloRequest) (*SloResponse, *http.Response, error) { +func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -1009,7 +1107,7 @@ func (a *SlosApiService) GetSloExecute(r ApiGetSloRequest) (*SloResponse, *http. localVarReturnValue *SloResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlosApiService.GetSlo") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.GetSloOp") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -1025,6 +1123,9 @@ func (a *SlosApiService) GetSloExecute(r ApiGetSloRequest) (*SloResponse, *http. return localVarReturnValue, nil, reportError("kbnXsrf is required and must be specified") } + if r.instanceId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "instanceId", r.instanceId, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1080,7 +1181,7 @@ func (a *SlosApiService) GetSloExecute(r ApiGetSloRequest) (*SloResponse, *http. error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v Model4xxResponse + var v Model400Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -1091,7 +1192,29 @@ func (a *SlosApiService) GetSloExecute(r ApiGetSloRequest) (*SloResponse, *http. return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { - var v Model4xxResponse + var v Model401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, 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 localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Model404Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -1115,40 +1238,40 @@ func (a *SlosApiService) GetSloExecute(r ApiGetSloRequest) (*SloResponse, *http. return localVarReturnValue, localVarHTTPResponse, nil } -type ApiHistoricalSummaryRequest struct { +type ApiHistoricalSummaryOpRequest struct { ctx context.Context - ApiService SlosApi + ApiService SloAPI kbnXsrf *string spaceId string historicalSummaryRequest *HistoricalSummaryRequest } // Cross-site request forgery protection -func (r ApiHistoricalSummaryRequest) KbnXsrf(kbnXsrf string) ApiHistoricalSummaryRequest { +func (r ApiHistoricalSummaryOpRequest) KbnXsrf(kbnXsrf string) ApiHistoricalSummaryOpRequest { r.kbnXsrf = &kbnXsrf return r } -func (r ApiHistoricalSummaryRequest) HistoricalSummaryRequest(historicalSummaryRequest HistoricalSummaryRequest) ApiHistoricalSummaryRequest { +func (r ApiHistoricalSummaryOpRequest) HistoricalSummaryRequest(historicalSummaryRequest HistoricalSummaryRequest) ApiHistoricalSummaryOpRequest { r.historicalSummaryRequest = &historicalSummaryRequest return r } -func (r ApiHistoricalSummaryRequest) Execute() (*map[string][]HistoricalSummaryResponseInner, *http.Response, error) { - return r.ApiService.HistoricalSummaryExecute(r) +func (r ApiHistoricalSummaryOpRequest) Execute() (*map[string][]HistoricalSummaryResponseInner, *http.Response, error) { + return r.ApiService.HistoricalSummaryOpExecute(r) } /* -HistoricalSummary Retrieves the historical summary for a list of SLOs +HistoricalSummaryOp Retrieves the historical summary for a list of SLOs You must have the `read` 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 ApiHistoricalSummaryRequest + @return ApiHistoricalSummaryOpRequest */ -func (a *SlosApiService) HistoricalSummary(ctx context.Context, spaceId string) ApiHistoricalSummaryRequest { - return ApiHistoricalSummaryRequest{ +func (a *SloAPIService) HistoricalSummaryOp(ctx context.Context, spaceId string) ApiHistoricalSummaryOpRequest { + return ApiHistoricalSummaryOpRequest{ ApiService: a, ctx: ctx, spaceId: spaceId, @@ -1158,7 +1281,7 @@ func (a *SlosApiService) HistoricalSummary(ctx context.Context, spaceId string) // Execute executes the request // // @return map[string][]HistoricalSummaryResponseInner -func (a *SlosApiService) HistoricalSummaryExecute(r ApiHistoricalSummaryRequest) (*map[string][]HistoricalSummaryResponseInner, *http.Response, error) { +func (a *SloAPIService) HistoricalSummaryOpExecute(r ApiHistoricalSummaryOpRequest) (*map[string][]HistoricalSummaryResponseInner, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} @@ -1166,7 +1289,7 @@ func (a *SlosApiService) HistoricalSummaryExecute(r ApiHistoricalSummaryRequest) localVarReturnValue *map[string][]HistoricalSummaryResponseInner ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlosApiService.HistoricalSummary") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.HistoricalSummaryOp") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -1241,7 +1364,7 @@ func (a *SlosApiService) HistoricalSummaryExecute(r ApiHistoricalSummaryRequest) error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v Model4xxResponse + var v Model400Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -1252,7 +1375,18 @@ func (a *SlosApiService) HistoricalSummaryExecute(r ApiHistoricalSummaryRequest) return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { - var v Model4xxResponse + var v Model401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, 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() @@ -1276,9 +1410,9 @@ func (a *SlosApiService) HistoricalSummaryExecute(r ApiHistoricalSummaryRequest) return localVarReturnValue, localVarHTTPResponse, nil } -type ApiUpdateSloRequest struct { +type ApiUpdateSloOpRequest struct { ctx context.Context - ApiService SlosApi + ApiService SloAPI kbnXsrf *string spaceId string sloId string @@ -1286,32 +1420,32 @@ type ApiUpdateSloRequest struct { } // Cross-site request forgery protection -func (r ApiUpdateSloRequest) KbnXsrf(kbnXsrf string) ApiUpdateSloRequest { +func (r ApiUpdateSloOpRequest) KbnXsrf(kbnXsrf string) ApiUpdateSloOpRequest { r.kbnXsrf = &kbnXsrf return r } -func (r ApiUpdateSloRequest) UpdateSloRequest(updateSloRequest UpdateSloRequest) ApiUpdateSloRequest { +func (r ApiUpdateSloOpRequest) UpdateSloRequest(updateSloRequest UpdateSloRequest) ApiUpdateSloOpRequest { r.updateSloRequest = &updateSloRequest return r } -func (r ApiUpdateSloRequest) Execute() (*SloResponse, *http.Response, error) { - return r.ApiService.UpdateSloExecute(r) +func (r ApiUpdateSloOpRequest) Execute() (*SloResponse, *http.Response, error) { + return r.ApiService.UpdateSloOpExecute(r) } /* -UpdateSlo Updates an SLO +UpdateSloOp Updates an SLO You must have the `write` 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. @param sloId An identifier for the slo. - @return ApiUpdateSloRequest + @return ApiUpdateSloOpRequest */ -func (a *SlosApiService) UpdateSlo(ctx context.Context, spaceId string, sloId string) ApiUpdateSloRequest { - return ApiUpdateSloRequest{ +func (a *SloAPIService) UpdateSloOp(ctx context.Context, spaceId string, sloId string) ApiUpdateSloOpRequest { + return ApiUpdateSloOpRequest{ ApiService: a, ctx: ctx, spaceId: spaceId, @@ -1322,7 +1456,7 @@ func (a *SlosApiService) UpdateSlo(ctx context.Context, spaceId string, sloId st // Execute executes the request // // @return SloResponse -func (a *SlosApiService) UpdateSloExecute(r ApiUpdateSloRequest) (*SloResponse, *http.Response, error) { +func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPut localVarPostBody interface{} @@ -1330,7 +1464,7 @@ func (a *SlosApiService) UpdateSloExecute(r ApiUpdateSloRequest) (*SloResponse, localVarReturnValue *SloResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SlosApiService.UpdateSlo") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.UpdateSloOp") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -1406,7 +1540,7 @@ func (a *SlosApiService) UpdateSloExecute(r ApiUpdateSloRequest) (*SloResponse, error: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v Model4xxResponse + var v Model400Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -1417,7 +1551,29 @@ func (a *SlosApiService) UpdateSloExecute(r ApiUpdateSloRequest) (*SloResponse, return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { - var v Model4xxResponse + var v Model401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, 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 localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Model404Response err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() diff --git a/generated/slo/client.go b/generated/slo/client.go index 1433aa568..1adb7840b 100644 --- a/generated/slo/client.go +++ b/generated/slo/client.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -40,7 +40,7 @@ var ( queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") ) -// APIClient manages communication with the SLOs API v0.1 +// APIClient manages communication with the SLOs API v1.0 // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration @@ -48,7 +48,7 @@ type APIClient struct { // API Services - SlosApi SlosApi + SloAPI SloAPI } type service struct { @@ -67,7 +67,7 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.common.client = c // API Services - c.SlosApi = (*SlosApiService)(&c.common) + c.SloAPI = (*SloAPIService)(&c.common) return c } @@ -644,16 +644,17 @@ func formatErrorMessage(status string, v interface{}) string { str := "" metaValue := reflect.ValueOf(v).Elem() - field := metaValue.FieldByName("Title") - if field != (reflect.Value{}) { - str = fmt.Sprintf("%s", field.Interface()) - } + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } - field = metaValue.FieldByName("Detail") - if field != (reflect.Value{}) { - str = fmt.Sprintf("%s (%s)", str, field.Interface()) + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } } - // status title (detail) return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) } diff --git a/generated/slo/configuration.go b/generated/slo/configuration.go index c411c75b1..2bbd0944a 100644 --- a/generated/slo/configuration.go +++ b/generated/slo/configuration.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -101,7 +101,7 @@ func NewConfiguration() *Configuration { }, }, OperationServers: map[string]ServerConfigurations{ - "SlosApiService.CreateSlo": { + "SloAPIService.CreateSloOp": { { URL: "https://localhost:5601", Description: "No description provided", diff --git a/generated/slo/docs/CreateSloRequest.md b/generated/slo/docs/CreateSloRequest.md index 9fefdf99b..d3d11f2ec 100644 --- a/generated/slo/docs/CreateSloRequest.md +++ b/generated/slo/docs/CreateSloRequest.md @@ -4,19 +4,21 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **string** | A optional and unique identifier for the SLO. Must be between 8 and 36 chars | [optional] **Name** | **string** | A name for the SLO. | **Description** | **string** | A description for the SLO. | -**Indicator** | [**SloResponseIndicator**](SloResponseIndicator.md) | | -**TimeWindow** | [**SloResponseTimeWindow**](SloResponseTimeWindow.md) | | +**Indicator** | [**CreateSloRequestIndicator**](CreateSloRequestIndicator.md) | | +**TimeWindow** | [**TimeWindow**](TimeWindow.md) | | **BudgetingMethod** | [**BudgetingMethod**](BudgetingMethod.md) | | **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] ## Methods ### NewCreateSloRequest -`func NewCreateSloRequest(name string, description string, indicator SloResponseIndicator, timeWindow SloResponseTimeWindow, budgetingMethod BudgetingMethod, objective Objective, ) *CreateSloRequest` +`func NewCreateSloRequest(name string, description string, indicator CreateSloRequestIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, ) *CreateSloRequest` NewCreateSloRequest instantiates a new CreateSloRequest object This constructor will assign default values to properties that have it defined, @@ -31,6 +33,31 @@ NewCreateSloRequestWithDefaults instantiates a new CreateSloRequest 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 +### GetId + +`func (o *CreateSloRequest) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *CreateSloRequest) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *CreateSloRequest) SetId(v string)` + +SetId sets Id field to given value. + +### HasId + +`func (o *CreateSloRequest) HasId() bool` + +HasId returns a boolean if a field has been set. + ### GetName `func (o *CreateSloRequest) GetName() string` @@ -73,40 +100,40 @@ SetDescription sets Description field to given value. ### GetIndicator -`func (o *CreateSloRequest) GetIndicator() SloResponseIndicator` +`func (o *CreateSloRequest) GetIndicator() CreateSloRequestIndicator` GetIndicator returns the Indicator field if non-nil, zero value otherwise. ### GetIndicatorOk -`func (o *CreateSloRequest) GetIndicatorOk() (*SloResponseIndicator, bool)` +`func (o *CreateSloRequest) GetIndicatorOk() (*CreateSloRequestIndicator, bool)` GetIndicatorOk returns a tuple with the Indicator field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetIndicator -`func (o *CreateSloRequest) SetIndicator(v SloResponseIndicator)` +`func (o *CreateSloRequest) SetIndicator(v CreateSloRequestIndicator)` SetIndicator sets Indicator field to given value. ### GetTimeWindow -`func (o *CreateSloRequest) GetTimeWindow() SloResponseTimeWindow` +`func (o *CreateSloRequest) GetTimeWindow() TimeWindow` GetTimeWindow returns the TimeWindow field if non-nil, zero value otherwise. ### GetTimeWindowOk -`func (o *CreateSloRequest) GetTimeWindowOk() (*SloResponseTimeWindow, bool)` +`func (o *CreateSloRequest) GetTimeWindowOk() (*TimeWindow, bool)` GetTimeWindowOk returns a tuple with the TimeWindow field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTimeWindow -`func (o *CreateSloRequest) SetTimeWindow(v SloResponseTimeWindow)` +`func (o *CreateSloRequest) SetTimeWindow(v TimeWindow)` SetTimeWindow sets TimeWindow field to given value. @@ -176,6 +203,31 @@ SetSettings sets Settings field to given value. HasSettings returns a boolean if a field has been set. +### GetGroupBy + +`func (o *CreateSloRequest) GetGroupBy() string` + +GetGroupBy returns the GroupBy field if non-nil, zero value otherwise. + +### GetGroupByOk + +`func (o *CreateSloRequest) GetGroupByOk() (*string, bool)` + +GetGroupByOk returns a tuple with the GroupBy field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGroupBy + +`func (o *CreateSloRequest) SetGroupBy(v string)` + +SetGroupBy sets GroupBy field to given value. + +### HasGroupBy + +`func (o *CreateSloRequest) HasGroupBy() bool` + +HasGroupBy 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 new file mode 100644 index 000000000..1075d6d1e --- /dev/null +++ b/generated/slo/docs/CreateSloRequestIndicator.md @@ -0,0 +1,72 @@ +# CreateSloRequestIndicator + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Params** | [**IndicatorPropertiesHistogramParams**](IndicatorPropertiesHistogramParams.md) | | +**Type** | **string** | The type of indicator. | + +## Methods + +### NewCreateSloRequestIndicator + +`func NewCreateSloRequestIndicator(params IndicatorPropertiesHistogramParams, type_ string, ) *CreateSloRequestIndicator` + +NewCreateSloRequestIndicator instantiates a new CreateSloRequestIndicator 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 + +### NewCreateSloRequestIndicatorWithDefaults + +`func NewCreateSloRequestIndicatorWithDefaults() *CreateSloRequestIndicator` + +NewCreateSloRequestIndicatorWithDefaults instantiates a new CreateSloRequestIndicator 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 *CreateSloRequestIndicator) GetParams() IndicatorPropertiesHistogramParams` + +GetParams returns the Params field if non-nil, zero value otherwise. + +### GetParamsOk + +`func (o *CreateSloRequestIndicator) GetParamsOk() (*IndicatorPropertiesHistogramParams, 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)` + +SetParams sets Params field to given value. + + +### GetType + +`func (o *CreateSloRequestIndicator) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *CreateSloRequestIndicator) 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 *CreateSloRequestIndicator) 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/ErrorBudget.md b/generated/slo/docs/ErrorBudget.md index 90573d36b..480bc5915 100644 --- a/generated/slo/docs/ErrorBudget.md +++ b/generated/slo/docs/ErrorBudget.md @@ -4,16 +4,16 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Initial** | Pointer to **float32** | The initial error budget, as 1 - objective | [optional] -**Consumed** | Pointer to **float32** | The error budget consummed, as a percentage of the initial value. | [optional] -**Remaining** | Pointer to **float32** | The error budget remaining, as a percentage of the initial value. | [optional] -**IsEstimated** | Pointer to **bool** | Only for SLO defined with occurrences budgeting method and calendar aligned time window. | [optional] +**Initial** | **float64** | The initial error budget, as 1 - objective | +**Consumed** | **float64** | The error budget consummed, as a percentage of the initial value. | +**Remaining** | **float64** | The error budget remaining, as a percentage of the initial value. | +**IsEstimated** | **bool** | Only for SLO defined with occurrences budgeting method and calendar aligned time window. | ## Methods ### NewErrorBudget -`func NewErrorBudget() *ErrorBudget` +`func NewErrorBudget(initial float64, consumed float64, remaining float64, isEstimated bool, ) *ErrorBudget` NewErrorBudget instantiates a new ErrorBudget object This constructor will assign default values to properties that have it defined, @@ -30,78 +30,63 @@ but it doesn't guarantee that properties required by API are set ### GetInitial -`func (o *ErrorBudget) GetInitial() float32` +`func (o *ErrorBudget) GetInitial() float64` GetInitial returns the Initial field if non-nil, zero value otherwise. ### GetInitialOk -`func (o *ErrorBudget) GetInitialOk() (*float32, bool)` +`func (o *ErrorBudget) GetInitialOk() (*float64, bool)` GetInitialOk returns a tuple with the Initial field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetInitial -`func (o *ErrorBudget) SetInitial(v float32)` +`func (o *ErrorBudget) SetInitial(v float64)` SetInitial sets Initial field to given value. -### HasInitial - -`func (o *ErrorBudget) HasInitial() bool` - -HasInitial returns a boolean if a field has been set. ### GetConsumed -`func (o *ErrorBudget) GetConsumed() float32` +`func (o *ErrorBudget) GetConsumed() float64` GetConsumed returns the Consumed field if non-nil, zero value otherwise. ### GetConsumedOk -`func (o *ErrorBudget) GetConsumedOk() (*float32, bool)` +`func (o *ErrorBudget) GetConsumedOk() (*float64, bool)` GetConsumedOk returns a tuple with the Consumed field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetConsumed -`func (o *ErrorBudget) SetConsumed(v float32)` +`func (o *ErrorBudget) SetConsumed(v float64)` SetConsumed sets Consumed field to given value. -### HasConsumed - -`func (o *ErrorBudget) HasConsumed() bool` - -HasConsumed returns a boolean if a field has been set. ### GetRemaining -`func (o *ErrorBudget) GetRemaining() float32` +`func (o *ErrorBudget) GetRemaining() float64` GetRemaining returns the Remaining field if non-nil, zero value otherwise. ### GetRemainingOk -`func (o *ErrorBudget) GetRemainingOk() (*float32, bool)` +`func (o *ErrorBudget) GetRemainingOk() (*float64, bool)` GetRemainingOk returns a tuple with the Remaining field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetRemaining -`func (o *ErrorBudget) SetRemaining(v float32)` +`func (o *ErrorBudget) SetRemaining(v float64)` SetRemaining sets Remaining field to given value. -### HasRemaining - -`func (o *ErrorBudget) HasRemaining() bool` - -HasRemaining returns a boolean if a field has been set. ### GetIsEstimated @@ -122,11 +107,6 @@ and a boolean to check if the value has been set. SetIsEstimated sets IsEstimated field to given value. -### HasIsEstimated - -`func (o *ErrorBudget) HasIsEstimated() bool` - -HasIsEstimated 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/FindSloResponse.md b/generated/slo/docs/FindSloResponse.md index b216ebab6..f881cfaf7 100644 --- a/generated/slo/docs/FindSloResponse.md +++ b/generated/slo/docs/FindSloResponse.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Page** | Pointer to **float32** | | [optional] -**PerPage** | Pointer to **float32** | | [optional] -**Total** | Pointer to **float32** | | [optional] +**Page** | Pointer to **float64** | | [optional] +**PerPage** | Pointer to **float64** | | [optional] +**Total** | Pointer to **float64** | | [optional] **Results** | Pointer to [**[]SloResponse**](SloResponse.md) | | [optional] ## Methods @@ -30,20 +30,20 @@ but it doesn't guarantee that properties required by API are set ### GetPage -`func (o *FindSloResponse) GetPage() float32` +`func (o *FindSloResponse) GetPage() float64` GetPage returns the Page field if non-nil, zero value otherwise. ### GetPageOk -`func (o *FindSloResponse) GetPageOk() (*float32, bool)` +`func (o *FindSloResponse) GetPageOk() (*float64, bool)` GetPageOk returns a tuple with the Page field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetPage -`func (o *FindSloResponse) SetPage(v float32)` +`func (o *FindSloResponse) SetPage(v float64)` SetPage sets Page field to given value. @@ -55,20 +55,20 @@ HasPage returns a boolean if a field has been set. ### GetPerPage -`func (o *FindSloResponse) GetPerPage() float32` +`func (o *FindSloResponse) GetPerPage() float64` GetPerPage returns the PerPage field if non-nil, zero value otherwise. ### GetPerPageOk -`func (o *FindSloResponse) GetPerPageOk() (*float32, bool)` +`func (o *FindSloResponse) GetPerPageOk() (*float64, bool)` GetPerPageOk returns a tuple with the PerPage field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetPerPage -`func (o *FindSloResponse) SetPerPage(v float32)` +`func (o *FindSloResponse) SetPerPage(v float64)` SetPerPage sets PerPage field to given value. @@ -80,20 +80,20 @@ HasPerPage returns a boolean if a field has been set. ### GetTotal -`func (o *FindSloResponse) GetTotal() float32` +`func (o *FindSloResponse) GetTotal() float64` GetTotal returns the Total field if non-nil, zero value otherwise. ### GetTotalOk -`func (o *FindSloResponse) GetTotalOk() (*float32, bool)` +`func (o *FindSloResponse) GetTotalOk() (*float64, bool)` GetTotalOk returns a tuple with the Total field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTotal -`func (o *FindSloResponse) SetTotal(v float32)` +`func (o *FindSloResponse) SetTotal(v float64)` SetTotal sets Total field to given value. diff --git a/generated/slo/docs/HistoricalSummaryResponseInner.md b/generated/slo/docs/HistoricalSummaryResponseInner.md index 3d49a7e08..ea3c738b3 100644 --- a/generated/slo/docs/HistoricalSummaryResponseInner.md +++ b/generated/slo/docs/HistoricalSummaryResponseInner.md @@ -5,8 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Date** | Pointer to **string** | | [optional] -**Status** | Pointer to **string** | | [optional] -**SliValue** | Pointer to **float32** | | [optional] +**Status** | Pointer to [**SummaryStatus**](SummaryStatus.md) | | [optional] +**SliValue** | Pointer to **float64** | | [optional] **ErrorBudget** | Pointer to [**ErrorBudget**](ErrorBudget.md) | | [optional] ## Methods @@ -55,20 +55,20 @@ HasDate returns a boolean if a field has been set. ### GetStatus -`func (o *HistoricalSummaryResponseInner) GetStatus() string` +`func (o *HistoricalSummaryResponseInner) GetStatus() SummaryStatus` GetStatus returns the Status field if non-nil, zero value otherwise. ### GetStatusOk -`func (o *HistoricalSummaryResponseInner) GetStatusOk() (*string, bool)` +`func (o *HistoricalSummaryResponseInner) GetStatusOk() (*SummaryStatus, bool)` GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetStatus -`func (o *HistoricalSummaryResponseInner) SetStatus(v string)` +`func (o *HistoricalSummaryResponseInner) SetStatus(v SummaryStatus)` SetStatus sets Status field to given value. @@ -80,20 +80,20 @@ HasStatus returns a boolean if a field has been set. ### GetSliValue -`func (o *HistoricalSummaryResponseInner) GetSliValue() float32` +`func (o *HistoricalSummaryResponseInner) GetSliValue() float64` GetSliValue returns the SliValue field if non-nil, zero value otherwise. ### GetSliValueOk -`func (o *HistoricalSummaryResponseInner) GetSliValueOk() (*float32, bool)` +`func (o *HistoricalSummaryResponseInner) GetSliValueOk() (*float64, bool)` GetSliValueOk returns a tuple with the SliValue field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetSliValue -`func (o *HistoricalSummaryResponseInner) SetSliValue(v float32)` +`func (o *HistoricalSummaryResponseInner) SetSliValue(v float64)` SetSliValue sets SliValue field to given value. diff --git a/generated/slo/docs/IndicatorPropertiesApmAvailabilityParams.md b/generated/slo/docs/IndicatorPropertiesApmAvailabilityParams.md index 9b52a26a5..0a63acf31 100644 --- a/generated/slo/docs/IndicatorPropertiesApmAvailabilityParams.md +++ b/generated/slo/docs/IndicatorPropertiesApmAvailabilityParams.md @@ -8,7 +8,6 @@ Name | Type | Description | Notes **Environment** | **string** | The APM service environment or \"*\" | **TransactionType** | **string** | The APM transaction type or \"*\" | **TransactionName** | **string** | The APM transaction name or \"*\" | -**GoodStatusCodes** | Pointer to **[]string** | The status codes considered as good events. Default to 2xx, 3xx and 4xx | [optional] **Filter** | Pointer to **string** | KQL query used for filtering the data | [optional] **Index** | **string** | The index used by APM metrics | @@ -111,31 +110,6 @@ and a boolean to check if the value has been set. SetTransactionName sets TransactionName field to given value. -### GetGoodStatusCodes - -`func (o *IndicatorPropertiesApmAvailabilityParams) GetGoodStatusCodes() []string` - -GetGoodStatusCodes returns the GoodStatusCodes field if non-nil, zero value otherwise. - -### GetGoodStatusCodesOk - -`func (o *IndicatorPropertiesApmAvailabilityParams) GetGoodStatusCodesOk() (*[]string, bool)` - -GetGoodStatusCodesOk returns a tuple with the GoodStatusCodes field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetGoodStatusCodes - -`func (o *IndicatorPropertiesApmAvailabilityParams) SetGoodStatusCodes(v []string)` - -SetGoodStatusCodes sets GoodStatusCodes field to given value. - -### HasGoodStatusCodes - -`func (o *IndicatorPropertiesApmAvailabilityParams) HasGoodStatusCodes() bool` - -HasGoodStatusCodes returns a boolean if a field has been set. - ### GetFilter `func (o *IndicatorPropertiesApmAvailabilityParams) GetFilter() string` diff --git a/generated/slo/docs/IndicatorPropertiesApmLatencyParams.md b/generated/slo/docs/IndicatorPropertiesApmLatencyParams.md index 5facd6598..b545aa06e 100644 --- a/generated/slo/docs/IndicatorPropertiesApmLatencyParams.md +++ b/generated/slo/docs/IndicatorPropertiesApmLatencyParams.md @@ -10,12 +10,13 @@ Name | Type | Description | Notes **TransactionName** | **string** | The APM transaction name or \"*\" | **Filter** | Pointer to **string** | KQL query used for filtering the data | [optional] **Index** | **string** | The index used by APM metrics | +**Threshold** | **float64** | The latency threshold in milliseconds | ## Methods ### NewIndicatorPropertiesApmLatencyParams -`func NewIndicatorPropertiesApmLatencyParams(service string, environment string, transactionType string, transactionName string, index string, ) *IndicatorPropertiesApmLatencyParams` +`func NewIndicatorPropertiesApmLatencyParams(service string, environment string, transactionType string, transactionName string, index string, threshold float64, ) *IndicatorPropertiesApmLatencyParams` NewIndicatorPropertiesApmLatencyParams instantiates a new IndicatorPropertiesApmLatencyParams object This constructor will assign default values to properties that have it defined, @@ -155,6 +156,26 @@ and a boolean to check if the value has been set. SetIndex sets Index field to given value. +### GetThreshold + +`func (o *IndicatorPropertiesApmLatencyParams) GetThreshold() float64` + +GetThreshold returns the Threshold field if non-nil, zero value otherwise. + +### GetThresholdOk + +`func (o *IndicatorPropertiesApmLatencyParams) 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 *IndicatorPropertiesApmLatencyParams) 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/IndicatorPropertiesCustomKqlParams.md b/generated/slo/docs/IndicatorPropertiesCustomKqlParams.md index 896951f6b..8ddbe1dd1 100644 --- a/generated/slo/docs/IndicatorPropertiesCustomKqlParams.md +++ b/generated/slo/docs/IndicatorPropertiesCustomKqlParams.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **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] -**TimestampField** | **string** | The timestamp field used in the source indice. If not specified, @timestamp will be used. | +**TimestampField** | **string** | The timestamp field used in the source indice. | ## Methods diff --git a/generated/slo/docs/IndicatorPropertiesCustomMetric.md b/generated/slo/docs/IndicatorPropertiesCustomMetric.md new file mode 100644 index 000000000..4509a621c --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesCustomMetric.md @@ -0,0 +1,72 @@ +# IndicatorPropertiesCustomMetric + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Params** | [**IndicatorPropertiesCustomMetricParams**](IndicatorPropertiesCustomMetricParams.md) | | +**Type** | **string** | The type of indicator. | + +## Methods + +### NewIndicatorPropertiesCustomMetric + +`func NewIndicatorPropertiesCustomMetric(params IndicatorPropertiesCustomMetricParams, type_ string, ) *IndicatorPropertiesCustomMetric` + +NewIndicatorPropertiesCustomMetric instantiates a new IndicatorPropertiesCustomMetric 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 + +### NewIndicatorPropertiesCustomMetricWithDefaults + +`func NewIndicatorPropertiesCustomMetricWithDefaults() *IndicatorPropertiesCustomMetric` + +NewIndicatorPropertiesCustomMetricWithDefaults instantiates a new IndicatorPropertiesCustomMetric 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 *IndicatorPropertiesCustomMetric) GetParams() IndicatorPropertiesCustomMetricParams` + +GetParams returns the Params field if non-nil, zero value otherwise. + +### GetParamsOk + +`func (o *IndicatorPropertiesCustomMetric) GetParamsOk() (*IndicatorPropertiesCustomMetricParams, 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 *IndicatorPropertiesCustomMetric) SetParams(v IndicatorPropertiesCustomMetricParams)` + +SetParams sets Params field to given value. + + +### GetType + +`func (o *IndicatorPropertiesCustomMetric) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *IndicatorPropertiesCustomMetric) 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 *IndicatorPropertiesCustomMetric) 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/IndicatorPropertiesCustomMetricParams.md b/generated/slo/docs/IndicatorPropertiesCustomMetricParams.md new file mode 100644 index 000000000..4533a8eec --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesCustomMetricParams.md @@ -0,0 +1,135 @@ +# IndicatorPropertiesCustomMetricParams + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Index** | **string** | The index or index pattern to use | +**Filter** | **string** | the KQL query to filter the documents with. | +**TimestampField** | **string** | The timestamp field used in the source indice. | +**Good** | [**IndicatorPropertiesCustomMetricParamsGood**](IndicatorPropertiesCustomMetricParamsGood.md) | | +**Total** | [**IndicatorPropertiesCustomMetricParamsTotal**](IndicatorPropertiesCustomMetricParamsTotal.md) | | + +## Methods + +### NewIndicatorPropertiesCustomMetricParams + +`func NewIndicatorPropertiesCustomMetricParams(index string, filter 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, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewIndicatorPropertiesCustomMetricParamsWithDefaults + +`func NewIndicatorPropertiesCustomMetricParamsWithDefaults() *IndicatorPropertiesCustomMetricParams` + +NewIndicatorPropertiesCustomMetricParamsWithDefaults instantiates a new IndicatorPropertiesCustomMetricParams 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 *IndicatorPropertiesCustomMetricParams) GetIndex() string` + +GetIndex returns the Index field if non-nil, zero value otherwise. + +### GetIndexOk + +`func (o *IndicatorPropertiesCustomMetricParams) 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 *IndicatorPropertiesCustomMetricParams) SetIndex(v string)` + +SetIndex sets Index field to given value. + + +### GetFilter + +`func (o *IndicatorPropertiesCustomMetricParams) GetFilter() string` + +GetFilter returns the Filter field if non-nil, zero value otherwise. + +### GetFilterOk + +`func (o *IndicatorPropertiesCustomMetricParams) 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 *IndicatorPropertiesCustomMetricParams) SetFilter(v string)` + +SetFilter sets Filter field to given value. + + +### GetTimestampField + +`func (o *IndicatorPropertiesCustomMetricParams) GetTimestampField() string` + +GetTimestampField returns the TimestampField field if non-nil, zero value otherwise. + +### GetTimestampFieldOk + +`func (o *IndicatorPropertiesCustomMetricParams) 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 *IndicatorPropertiesCustomMetricParams) SetTimestampField(v string)` + +SetTimestampField sets TimestampField field to given value. + + +### GetGood + +`func (o *IndicatorPropertiesCustomMetricParams) GetGood() IndicatorPropertiesCustomMetricParamsGood` + +GetGood returns the Good field if non-nil, zero value otherwise. + +### GetGoodOk + +`func (o *IndicatorPropertiesCustomMetricParams) GetGoodOk() (*IndicatorPropertiesCustomMetricParamsGood, bool)` + +GetGoodOk returns a tuple with the Good field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGood + +`func (o *IndicatorPropertiesCustomMetricParams) SetGood(v IndicatorPropertiesCustomMetricParamsGood)` + +SetGood sets Good field to given value. + + +### GetTotal + +`func (o *IndicatorPropertiesCustomMetricParams) GetTotal() IndicatorPropertiesCustomMetricParamsTotal` + +GetTotal returns the Total field if non-nil, zero value otherwise. + +### GetTotalOk + +`func (o *IndicatorPropertiesCustomMetricParams) GetTotalOk() (*IndicatorPropertiesCustomMetricParamsTotal, bool)` + +GetTotalOk returns a tuple with the Total field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotal + +`func (o *IndicatorPropertiesCustomMetricParams) SetTotal(v IndicatorPropertiesCustomMetricParamsTotal)` + +SetTotal sets Total 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/IndicatorPropertiesCustomMetricParamsGood.md b/generated/slo/docs/IndicatorPropertiesCustomMetricParamsGood.md new file mode 100644 index 000000000..978150bca --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesCustomMetricParamsGood.md @@ -0,0 +1,72 @@ +# IndicatorPropertiesCustomMetricParamsGood + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Metrics** | [**[]IndicatorPropertiesCustomMetricParamsGoodMetricsInner**](IndicatorPropertiesCustomMetricParamsGoodMetricsInner.md) | List of metrics with their name, aggregation type, and field. | +**Equation** | **string** | The equation to calculate the \"good\" metric. | + +## Methods + +### NewIndicatorPropertiesCustomMetricParamsGood + +`func NewIndicatorPropertiesCustomMetricParamsGood(metrics []IndicatorPropertiesCustomMetricParamsGoodMetricsInner, equation string, ) *IndicatorPropertiesCustomMetricParamsGood` + +NewIndicatorPropertiesCustomMetricParamsGood instantiates a new IndicatorPropertiesCustomMetricParamsGood 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 + +### NewIndicatorPropertiesCustomMetricParamsGoodWithDefaults + +`func NewIndicatorPropertiesCustomMetricParamsGoodWithDefaults() *IndicatorPropertiesCustomMetricParamsGood` + +NewIndicatorPropertiesCustomMetricParamsGoodWithDefaults instantiates a new IndicatorPropertiesCustomMetricParamsGood 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 *IndicatorPropertiesCustomMetricParamsGood) GetMetrics() []IndicatorPropertiesCustomMetricParamsGoodMetricsInner` + +GetMetrics returns the Metrics field if non-nil, zero value otherwise. + +### GetMetricsOk + +`func (o *IndicatorPropertiesCustomMetricParamsGood) GetMetricsOk() (*[]IndicatorPropertiesCustomMetricParamsGoodMetricsInner, 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 *IndicatorPropertiesCustomMetricParamsGood) SetMetrics(v []IndicatorPropertiesCustomMetricParamsGoodMetricsInner)` + +SetMetrics sets Metrics field to given value. + + +### GetEquation + +`func (o *IndicatorPropertiesCustomMetricParamsGood) GetEquation() string` + +GetEquation returns the Equation field if non-nil, zero value otherwise. + +### GetEquationOk + +`func (o *IndicatorPropertiesCustomMetricParamsGood) 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 *IndicatorPropertiesCustomMetricParamsGood) SetEquation(v string)` + +SetEquation sets Equation 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/IndicatorPropertiesCustomMetricParamsGoodMetricsInner.md b/generated/slo/docs/IndicatorPropertiesCustomMetricParamsGoodMetricsInner.md new file mode 100644 index 000000000..3d485fa6c --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesCustomMetricParamsGoodMetricsInner.md @@ -0,0 +1,119 @@ +# IndicatorPropertiesCustomMetricParamsGoodMetricsInner + +## 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 \"sum\" | +**Field** | **string** | The field of the metric. | +**Filter** | Pointer to **string** | The filter to apply to the metric. | [optional] + +## Methods + +### NewIndicatorPropertiesCustomMetricParamsGoodMetricsInner + +`func NewIndicatorPropertiesCustomMetricParamsGoodMetricsInner(name string, aggregation string, field string, ) *IndicatorPropertiesCustomMetricParamsGoodMetricsInner` + +NewIndicatorPropertiesCustomMetricParamsGoodMetricsInner instantiates a new IndicatorPropertiesCustomMetricParamsGoodMetricsInner 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 + +### NewIndicatorPropertiesCustomMetricParamsGoodMetricsInnerWithDefaults + +`func NewIndicatorPropertiesCustomMetricParamsGoodMetricsInnerWithDefaults() *IndicatorPropertiesCustomMetricParamsGoodMetricsInner` + +NewIndicatorPropertiesCustomMetricParamsGoodMetricsInnerWithDefaults instantiates a new IndicatorPropertiesCustomMetricParamsGoodMetricsInner 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) SetName(v string)` + +SetName sets Name field to given value. + + +### GetAggregation + +`func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) GetAggregation() string` + +GetAggregation returns the Aggregation field if non-nil, zero value otherwise. + +### GetAggregationOk + +`func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) SetAggregation(v string)` + +SetAggregation sets Aggregation field to given value. + + +### GetField + +`func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) GetField() string` + +GetField returns the Field field if non-nil, zero value otherwise. + +### GetFieldOk + +`func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) SetField(v string)` + +SetField sets Field field to given value. + + +### GetFilter + +`func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) GetFilter() string` + +GetFilter returns the Filter field if non-nil, zero value otherwise. + +### GetFilterOk + +`func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) SetFilter(v string)` + +SetFilter sets Filter field to given value. + +### HasFilter + +`func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) 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/IndicatorPropertiesCustomMetricParamsTotal.md b/generated/slo/docs/IndicatorPropertiesCustomMetricParamsTotal.md new file mode 100644 index 000000000..9b33ee2fe --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesCustomMetricParamsTotal.md @@ -0,0 +1,72 @@ +# IndicatorPropertiesCustomMetricParamsTotal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Metrics** | [**[]IndicatorPropertiesCustomMetricParamsTotalMetricsInner**](IndicatorPropertiesCustomMetricParamsTotalMetricsInner.md) | List of metrics with their name, aggregation type, and field. | +**Equation** | **string** | The equation to calculate the \"total\" metric. | + +## Methods + +### NewIndicatorPropertiesCustomMetricParamsTotal + +`func NewIndicatorPropertiesCustomMetricParamsTotal(metrics []IndicatorPropertiesCustomMetricParamsTotalMetricsInner, equation string, ) *IndicatorPropertiesCustomMetricParamsTotal` + +NewIndicatorPropertiesCustomMetricParamsTotal instantiates a new IndicatorPropertiesCustomMetricParamsTotal 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 + +### NewIndicatorPropertiesCustomMetricParamsTotalWithDefaults + +`func NewIndicatorPropertiesCustomMetricParamsTotalWithDefaults() *IndicatorPropertiesCustomMetricParamsTotal` + +NewIndicatorPropertiesCustomMetricParamsTotalWithDefaults instantiates a new IndicatorPropertiesCustomMetricParamsTotal 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 *IndicatorPropertiesCustomMetricParamsTotal) GetMetrics() []IndicatorPropertiesCustomMetricParamsTotalMetricsInner` + +GetMetrics returns the Metrics field if non-nil, zero value otherwise. + +### GetMetricsOk + +`func (o *IndicatorPropertiesCustomMetricParamsTotal) GetMetricsOk() (*[]IndicatorPropertiesCustomMetricParamsTotalMetricsInner, 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 *IndicatorPropertiesCustomMetricParamsTotal) SetMetrics(v []IndicatorPropertiesCustomMetricParamsTotalMetricsInner)` + +SetMetrics sets Metrics field to given value. + + +### GetEquation + +`func (o *IndicatorPropertiesCustomMetricParamsTotal) GetEquation() string` + +GetEquation returns the Equation field if non-nil, zero value otherwise. + +### GetEquationOk + +`func (o *IndicatorPropertiesCustomMetricParamsTotal) 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 *IndicatorPropertiesCustomMetricParamsTotal) SetEquation(v string)` + +SetEquation sets Equation 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/IndicatorPropertiesCustomMetricParamsTotalMetricsInner.md b/generated/slo/docs/IndicatorPropertiesCustomMetricParamsTotalMetricsInner.md new file mode 100644 index 000000000..6f528a370 --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesCustomMetricParamsTotalMetricsInner.md @@ -0,0 +1,119 @@ +# IndicatorPropertiesCustomMetricParamsTotalMetricsInner + +## 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 \"sum\" | +**Field** | **string** | The field of the metric. | +**Filter** | Pointer to **string** | The filter to apply to the metric. | [optional] + +## Methods + +### NewIndicatorPropertiesCustomMetricParamsTotalMetricsInner + +`func NewIndicatorPropertiesCustomMetricParamsTotalMetricsInner(name string, aggregation string, field string, ) *IndicatorPropertiesCustomMetricParamsTotalMetricsInner` + +NewIndicatorPropertiesCustomMetricParamsTotalMetricsInner instantiates a new IndicatorPropertiesCustomMetricParamsTotalMetricsInner 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 + +### NewIndicatorPropertiesCustomMetricParamsTotalMetricsInnerWithDefaults + +`func NewIndicatorPropertiesCustomMetricParamsTotalMetricsInnerWithDefaults() *IndicatorPropertiesCustomMetricParamsTotalMetricsInner` + +NewIndicatorPropertiesCustomMetricParamsTotalMetricsInnerWithDefaults instantiates a new IndicatorPropertiesCustomMetricParamsTotalMetricsInner 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 *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) SetName(v string)` + +SetName sets Name field to given value. + + +### GetAggregation + +`func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) GetAggregation() string` + +GetAggregation returns the Aggregation field if non-nil, zero value otherwise. + +### GetAggregationOk + +`func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) SetAggregation(v string)` + +SetAggregation sets Aggregation field to given value. + + +### GetField + +`func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) GetField() string` + +GetField returns the Field field if non-nil, zero value otherwise. + +### GetFieldOk + +`func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) SetField(v string)` + +SetField sets Field field to given value. + + +### GetFilter + +`func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) GetFilter() string` + +GetFilter returns the Filter field if non-nil, zero value otherwise. + +### GetFilterOk + +`func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) SetFilter(v string)` + +SetFilter sets Filter field to given value. + +### HasFilter + +`func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) 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/IndicatorPropertiesHistogram.md b/generated/slo/docs/IndicatorPropertiesHistogram.md new file mode 100644 index 000000000..002eb9c96 --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesHistogram.md @@ -0,0 +1,72 @@ +# IndicatorPropertiesHistogram + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Params** | [**IndicatorPropertiesHistogramParams**](IndicatorPropertiesHistogramParams.md) | | +**Type** | **string** | The type of indicator. | + +## Methods + +### NewIndicatorPropertiesHistogram + +`func NewIndicatorPropertiesHistogram(params IndicatorPropertiesHistogramParams, type_ string, ) *IndicatorPropertiesHistogram` + +NewIndicatorPropertiesHistogram instantiates a new IndicatorPropertiesHistogram 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 + +### NewIndicatorPropertiesHistogramWithDefaults + +`func NewIndicatorPropertiesHistogramWithDefaults() *IndicatorPropertiesHistogram` + +NewIndicatorPropertiesHistogramWithDefaults instantiates a new IndicatorPropertiesHistogram 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 *IndicatorPropertiesHistogram) GetParams() IndicatorPropertiesHistogramParams` + +GetParams returns the Params field if non-nil, zero value otherwise. + +### GetParamsOk + +`func (o *IndicatorPropertiesHistogram) GetParamsOk() (*IndicatorPropertiesHistogramParams, 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 *IndicatorPropertiesHistogram) SetParams(v IndicatorPropertiesHistogramParams)` + +SetParams sets Params field to given value. + + +### GetType + +`func (o *IndicatorPropertiesHistogram) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *IndicatorPropertiesHistogram) 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 *IndicatorPropertiesHistogram) 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/IndicatorPropertiesHistogramParams.md b/generated/slo/docs/IndicatorPropertiesHistogramParams.md new file mode 100644 index 000000000..89263c048 --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesHistogramParams.md @@ -0,0 +1,140 @@ +# IndicatorPropertiesHistogramParams + +## 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. | +**Good** | [**IndicatorPropertiesHistogramParamsGood**](IndicatorPropertiesHistogramParamsGood.md) | | +**Total** | [**IndicatorPropertiesHistogramParamsTotal**](IndicatorPropertiesHistogramParamsTotal.md) | | + +## Methods + +### NewIndicatorPropertiesHistogramParams + +`func NewIndicatorPropertiesHistogramParams(index string, timestampField string, good IndicatorPropertiesHistogramParamsGood, total IndicatorPropertiesHistogramParamsTotal, ) *IndicatorPropertiesHistogramParams` + +NewIndicatorPropertiesHistogramParams instantiates a new IndicatorPropertiesHistogramParams 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 + +### NewIndicatorPropertiesHistogramParamsWithDefaults + +`func NewIndicatorPropertiesHistogramParamsWithDefaults() *IndicatorPropertiesHistogramParams` + +NewIndicatorPropertiesHistogramParamsWithDefaults instantiates a new IndicatorPropertiesHistogramParams 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 *IndicatorPropertiesHistogramParams) GetIndex() string` + +GetIndex returns the Index field if non-nil, zero value otherwise. + +### GetIndexOk + +`func (o *IndicatorPropertiesHistogramParams) 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 *IndicatorPropertiesHistogramParams) SetIndex(v string)` + +SetIndex sets Index field to given value. + + +### GetFilter + +`func (o *IndicatorPropertiesHistogramParams) GetFilter() string` + +GetFilter returns the Filter field if non-nil, zero value otherwise. + +### GetFilterOk + +`func (o *IndicatorPropertiesHistogramParams) 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 *IndicatorPropertiesHistogramParams) SetFilter(v string)` + +SetFilter sets Filter field to given value. + +### HasFilter + +`func (o *IndicatorPropertiesHistogramParams) HasFilter() bool` + +HasFilter returns a boolean if a field has been set. + +### GetTimestampField + +`func (o *IndicatorPropertiesHistogramParams) GetTimestampField() string` + +GetTimestampField returns the TimestampField field if non-nil, zero value otherwise. + +### GetTimestampFieldOk + +`func (o *IndicatorPropertiesHistogramParams) 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 *IndicatorPropertiesHistogramParams) SetTimestampField(v string)` + +SetTimestampField sets TimestampField field to given value. + + +### GetGood + +`func (o *IndicatorPropertiesHistogramParams) GetGood() IndicatorPropertiesHistogramParamsGood` + +GetGood returns the Good field if non-nil, zero value otherwise. + +### GetGoodOk + +`func (o *IndicatorPropertiesHistogramParams) GetGoodOk() (*IndicatorPropertiesHistogramParamsGood, bool)` + +GetGoodOk returns a tuple with the Good field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGood + +`func (o *IndicatorPropertiesHistogramParams) SetGood(v IndicatorPropertiesHistogramParamsGood)` + +SetGood sets Good field to given value. + + +### GetTotal + +`func (o *IndicatorPropertiesHistogramParams) GetTotal() IndicatorPropertiesHistogramParamsTotal` + +GetTotal returns the Total field if non-nil, zero value otherwise. + +### GetTotalOk + +`func (o *IndicatorPropertiesHistogramParams) GetTotalOk() (*IndicatorPropertiesHistogramParamsTotal, bool)` + +GetTotalOk returns a tuple with the Total field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotal + +`func (o *IndicatorPropertiesHistogramParams) SetTotal(v IndicatorPropertiesHistogramParamsTotal)` + +SetTotal sets Total 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/IndicatorPropertiesHistogramParamsGood.md b/generated/slo/docs/IndicatorPropertiesHistogramParamsGood.md new file mode 100644 index 000000000..e17bdad51 --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesHistogramParamsGood.md @@ -0,0 +1,150 @@ +# IndicatorPropertiesHistogramParamsGood + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Field** | **string** | The field use to aggregate the good events. | +**Aggregation** | **string** | The type of aggregation to use. | +**Filter** | Pointer to **string** | The filter for good events. | [optional] +**From** | Pointer to **float64** | The starting value of the range. Only required for \"range\" aggregations. | [optional] +**To** | Pointer to **float64** | The ending value of the range. Only required for \"range\" aggregations. | [optional] + +## Methods + +### NewIndicatorPropertiesHistogramParamsGood + +`func NewIndicatorPropertiesHistogramParamsGood(field string, aggregation string, ) *IndicatorPropertiesHistogramParamsGood` + +NewIndicatorPropertiesHistogramParamsGood instantiates a new IndicatorPropertiesHistogramParamsGood 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 + +### NewIndicatorPropertiesHistogramParamsGoodWithDefaults + +`func NewIndicatorPropertiesHistogramParamsGoodWithDefaults() *IndicatorPropertiesHistogramParamsGood` + +NewIndicatorPropertiesHistogramParamsGoodWithDefaults instantiates a new IndicatorPropertiesHistogramParamsGood 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 + +### GetField + +`func (o *IndicatorPropertiesHistogramParamsGood) GetField() string` + +GetField returns the Field field if non-nil, zero value otherwise. + +### GetFieldOk + +`func (o *IndicatorPropertiesHistogramParamsGood) 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 *IndicatorPropertiesHistogramParamsGood) SetField(v string)` + +SetField sets Field field to given value. + + +### GetAggregation + +`func (o *IndicatorPropertiesHistogramParamsGood) GetAggregation() string` + +GetAggregation returns the Aggregation field if non-nil, zero value otherwise. + +### GetAggregationOk + +`func (o *IndicatorPropertiesHistogramParamsGood) 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 *IndicatorPropertiesHistogramParamsGood) SetAggregation(v string)` + +SetAggregation sets Aggregation field to given value. + + +### GetFilter + +`func (o *IndicatorPropertiesHistogramParamsGood) GetFilter() string` + +GetFilter returns the Filter field if non-nil, zero value otherwise. + +### GetFilterOk + +`func (o *IndicatorPropertiesHistogramParamsGood) 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 *IndicatorPropertiesHistogramParamsGood) SetFilter(v string)` + +SetFilter sets Filter field to given value. + +### HasFilter + +`func (o *IndicatorPropertiesHistogramParamsGood) HasFilter() bool` + +HasFilter returns a boolean if a field has been set. + +### GetFrom + +`func (o *IndicatorPropertiesHistogramParamsGood) GetFrom() float64` + +GetFrom returns the From field if non-nil, zero value otherwise. + +### GetFromOk + +`func (o *IndicatorPropertiesHistogramParamsGood) GetFromOk() (*float64, bool)` + +GetFromOk returns a tuple with the From field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFrom + +`func (o *IndicatorPropertiesHistogramParamsGood) SetFrom(v float64)` + +SetFrom sets From field to given value. + +### HasFrom + +`func (o *IndicatorPropertiesHistogramParamsGood) HasFrom() bool` + +HasFrom returns a boolean if a field has been set. + +### GetTo + +`func (o *IndicatorPropertiesHistogramParamsGood) GetTo() float64` + +GetTo returns the To field if non-nil, zero value otherwise. + +### GetToOk + +`func (o *IndicatorPropertiesHistogramParamsGood) GetToOk() (*float64, bool)` + +GetToOk returns a tuple with the To field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTo + +`func (o *IndicatorPropertiesHistogramParamsGood) SetTo(v float64)` + +SetTo sets To field to given value. + +### HasTo + +`func (o *IndicatorPropertiesHistogramParamsGood) HasTo() bool` + +HasTo 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/IndicatorPropertiesHistogramParamsTotal.md b/generated/slo/docs/IndicatorPropertiesHistogramParamsTotal.md new file mode 100644 index 000000000..f33982c7f --- /dev/null +++ b/generated/slo/docs/IndicatorPropertiesHistogramParamsTotal.md @@ -0,0 +1,150 @@ +# IndicatorPropertiesHistogramParamsTotal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Field** | **string** | The field use to aggregate the good events. | +**Aggregation** | **string** | The type of aggregation to use. | +**Filter** | Pointer to **string** | The filter for total events. | [optional] +**From** | Pointer to **float64** | The starting value of the range. Only required for \"range\" aggregations. | [optional] +**To** | Pointer to **float64** | The ending value of the range. Only required for \"range\" aggregations. | [optional] + +## Methods + +### NewIndicatorPropertiesHistogramParamsTotal + +`func NewIndicatorPropertiesHistogramParamsTotal(field string, aggregation string, ) *IndicatorPropertiesHistogramParamsTotal` + +NewIndicatorPropertiesHistogramParamsTotal instantiates a new IndicatorPropertiesHistogramParamsTotal 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 + +### NewIndicatorPropertiesHistogramParamsTotalWithDefaults + +`func NewIndicatorPropertiesHistogramParamsTotalWithDefaults() *IndicatorPropertiesHistogramParamsTotal` + +NewIndicatorPropertiesHistogramParamsTotalWithDefaults instantiates a new IndicatorPropertiesHistogramParamsTotal 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 + +### GetField + +`func (o *IndicatorPropertiesHistogramParamsTotal) GetField() string` + +GetField returns the Field field if non-nil, zero value otherwise. + +### GetFieldOk + +`func (o *IndicatorPropertiesHistogramParamsTotal) 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 *IndicatorPropertiesHistogramParamsTotal) SetField(v string)` + +SetField sets Field field to given value. + + +### GetAggregation + +`func (o *IndicatorPropertiesHistogramParamsTotal) GetAggregation() string` + +GetAggregation returns the Aggregation field if non-nil, zero value otherwise. + +### GetAggregationOk + +`func (o *IndicatorPropertiesHistogramParamsTotal) 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 *IndicatorPropertiesHistogramParamsTotal) SetAggregation(v string)` + +SetAggregation sets Aggregation field to given value. + + +### GetFilter + +`func (o *IndicatorPropertiesHistogramParamsTotal) GetFilter() string` + +GetFilter returns the Filter field if non-nil, zero value otherwise. + +### GetFilterOk + +`func (o *IndicatorPropertiesHistogramParamsTotal) 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 *IndicatorPropertiesHistogramParamsTotal) SetFilter(v string)` + +SetFilter sets Filter field to given value. + +### HasFilter + +`func (o *IndicatorPropertiesHistogramParamsTotal) HasFilter() bool` + +HasFilter returns a boolean if a field has been set. + +### GetFrom + +`func (o *IndicatorPropertiesHistogramParamsTotal) GetFrom() float64` + +GetFrom returns the From field if non-nil, zero value otherwise. + +### GetFromOk + +`func (o *IndicatorPropertiesHistogramParamsTotal) GetFromOk() (*float64, bool)` + +GetFromOk returns a tuple with the From field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFrom + +`func (o *IndicatorPropertiesHistogramParamsTotal) SetFrom(v float64)` + +SetFrom sets From field to given value. + +### HasFrom + +`func (o *IndicatorPropertiesHistogramParamsTotal) HasFrom() bool` + +HasFrom returns a boolean if a field has been set. + +### GetTo + +`func (o *IndicatorPropertiesHistogramParamsTotal) GetTo() float64` + +GetTo returns the To field if non-nil, zero value otherwise. + +### GetToOk + +`func (o *IndicatorPropertiesHistogramParamsTotal) GetToOk() (*float64, bool)` + +GetToOk returns a tuple with the To field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTo + +`func (o *IndicatorPropertiesHistogramParamsTotal) SetTo(v float64)` + +SetTo sets To field to given value. + +### HasTo + +`func (o *IndicatorPropertiesHistogramParamsTotal) HasTo() bool` + +HasTo 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/Model4xxResponse.md b/generated/slo/docs/Model400Response.md similarity index 65% rename from generated/slo/docs/Model4xxResponse.md rename to generated/slo/docs/Model400Response.md index 88b487b31..301419793 100644 --- a/generated/slo/docs/Model4xxResponse.md +++ b/generated/slo/docs/Model400Response.md @@ -1,88 +1,88 @@ -# Model4xxResponse +# Model400Response ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**StatusCode** | **float32** | | +**StatusCode** | **float64** | | **Error** | **string** | | **Message** | **string** | | ## Methods -### NewModel4xxResponse +### NewModel400Response -`func NewModel4xxResponse(statusCode float32, error_ string, message string, ) *Model4xxResponse` +`func NewModel400Response(statusCode float64, error_ string, message string, ) *Model400Response` -NewModel4xxResponse instantiates a new Model4xxResponse object +NewModel400Response instantiates a new Model400Response 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 -### NewModel4xxResponseWithDefaults +### NewModel400ResponseWithDefaults -`func NewModel4xxResponseWithDefaults() *Model4xxResponse` +`func NewModel400ResponseWithDefaults() *Model400Response` -NewModel4xxResponseWithDefaults instantiates a new Model4xxResponse object +NewModel400ResponseWithDefaults instantiates a new Model400Response 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 ### GetStatusCode -`func (o *Model4xxResponse) GetStatusCode() float32` +`func (o *Model400Response) GetStatusCode() float64` GetStatusCode returns the StatusCode field if non-nil, zero value otherwise. ### GetStatusCodeOk -`func (o *Model4xxResponse) GetStatusCodeOk() (*float32, bool)` +`func (o *Model400Response) GetStatusCodeOk() (*float64, bool)` GetStatusCodeOk returns a tuple with the StatusCode field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetStatusCode -`func (o *Model4xxResponse) SetStatusCode(v float32)` +`func (o *Model400Response) SetStatusCode(v float64)` SetStatusCode sets StatusCode field to given value. ### GetError -`func (o *Model4xxResponse) GetError() string` +`func (o *Model400Response) GetError() string` GetError returns the Error field if non-nil, zero value otherwise. ### GetErrorOk -`func (o *Model4xxResponse) GetErrorOk() (*string, bool)` +`func (o *Model400Response) GetErrorOk() (*string, bool)` GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetError -`func (o *Model4xxResponse) SetError(v string)` +`func (o *Model400Response) SetError(v string)` SetError sets Error field to given value. ### GetMessage -`func (o *Model4xxResponse) GetMessage() string` +`func (o *Model400Response) GetMessage() string` GetMessage returns the Message field if non-nil, zero value otherwise. ### GetMessageOk -`func (o *Model4xxResponse) GetMessageOk() (*string, bool)` +`func (o *Model400Response) GetMessageOk() (*string, bool)` GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetMessage -`func (o *Model4xxResponse) SetMessage(v string)` +`func (o *Model400Response) SetMessage(v string)` SetMessage sets Message field to given value. diff --git a/generated/slo/docs/Model401Response.md b/generated/slo/docs/Model401Response.md new file mode 100644 index 000000000..3bc3fead6 --- /dev/null +++ b/generated/slo/docs/Model401Response.md @@ -0,0 +1,93 @@ +# Model401Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**StatusCode** | **float64** | | +**Error** | **string** | | +**Message** | **string** | | + +## Methods + +### NewModel401Response + +`func NewModel401Response(statusCode float64, error_ string, message string, ) *Model401Response` + +NewModel401Response instantiates a new Model401Response 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 + +### NewModel401ResponseWithDefaults + +`func NewModel401ResponseWithDefaults() *Model401Response` + +NewModel401ResponseWithDefaults instantiates a new Model401Response 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 + +### GetStatusCode + +`func (o *Model401Response) GetStatusCode() float64` + +GetStatusCode returns the StatusCode field if non-nil, zero value otherwise. + +### GetStatusCodeOk + +`func (o *Model401Response) GetStatusCodeOk() (*float64, bool)` + +GetStatusCodeOk returns a tuple with the StatusCode field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatusCode + +`func (o *Model401Response) SetStatusCode(v float64)` + +SetStatusCode sets StatusCode field to given value. + + +### GetError + +`func (o *Model401Response) GetError() string` + +GetError returns the Error field if non-nil, zero value otherwise. + +### GetErrorOk + +`func (o *Model401Response) GetErrorOk() (*string, bool)` + +GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetError + +`func (o *Model401Response) SetError(v string)` + +SetError sets Error field to given value. + + +### GetMessage + +`func (o *Model401Response) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *Model401Response) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *Model401Response) SetMessage(v string)` + +SetMessage sets Message 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/Model403Response.md b/generated/slo/docs/Model403Response.md new file mode 100644 index 000000000..38a48c5e2 --- /dev/null +++ b/generated/slo/docs/Model403Response.md @@ -0,0 +1,93 @@ +# Model403Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**StatusCode** | **float64** | | +**Error** | **string** | | +**Message** | **string** | | + +## Methods + +### NewModel403Response + +`func NewModel403Response(statusCode float64, error_ string, message string, ) *Model403Response` + +NewModel403Response instantiates a new Model403Response 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 + +### NewModel403ResponseWithDefaults + +`func NewModel403ResponseWithDefaults() *Model403Response` + +NewModel403ResponseWithDefaults instantiates a new Model403Response 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 + +### GetStatusCode + +`func (o *Model403Response) GetStatusCode() float64` + +GetStatusCode returns the StatusCode field if non-nil, zero value otherwise. + +### GetStatusCodeOk + +`func (o *Model403Response) GetStatusCodeOk() (*float64, bool)` + +GetStatusCodeOk returns a tuple with the StatusCode field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatusCode + +`func (o *Model403Response) SetStatusCode(v float64)` + +SetStatusCode sets StatusCode field to given value. + + +### GetError + +`func (o *Model403Response) GetError() string` + +GetError returns the Error field if non-nil, zero value otherwise. + +### GetErrorOk + +`func (o *Model403Response) GetErrorOk() (*string, bool)` + +GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetError + +`func (o *Model403Response) SetError(v string)` + +SetError sets Error field to given value. + + +### GetMessage + +`func (o *Model403Response) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *Model403Response) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *Model403Response) SetMessage(v string)` + +SetMessage sets Message 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/Model404Response.md b/generated/slo/docs/Model404Response.md new file mode 100644 index 000000000..7882dd60b --- /dev/null +++ b/generated/slo/docs/Model404Response.md @@ -0,0 +1,93 @@ +# Model404Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**StatusCode** | **float64** | | +**Error** | **string** | | +**Message** | **string** | | + +## Methods + +### NewModel404Response + +`func NewModel404Response(statusCode float64, error_ string, message string, ) *Model404Response` + +NewModel404Response instantiates a new Model404Response 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 + +### NewModel404ResponseWithDefaults + +`func NewModel404ResponseWithDefaults() *Model404Response` + +NewModel404ResponseWithDefaults instantiates a new Model404Response 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 + +### GetStatusCode + +`func (o *Model404Response) GetStatusCode() float64` + +GetStatusCode returns the StatusCode field if non-nil, zero value otherwise. + +### GetStatusCodeOk + +`func (o *Model404Response) GetStatusCodeOk() (*float64, bool)` + +GetStatusCodeOk returns a tuple with the StatusCode field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatusCode + +`func (o *Model404Response) SetStatusCode(v float64)` + +SetStatusCode sets StatusCode field to given value. + + +### GetError + +`func (o *Model404Response) GetError() string` + +GetError returns the Error field if non-nil, zero value otherwise. + +### GetErrorOk + +`func (o *Model404Response) GetErrorOk() (*string, bool)` + +GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetError + +`func (o *Model404Response) SetError(v string)` + +SetError sets Error field to given value. + + +### GetMessage + +`func (o *Model404Response) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *Model404Response) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *Model404Response) SetMessage(v string)` + +SetMessage sets Message 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/Model409Response.md b/generated/slo/docs/Model409Response.md new file mode 100644 index 000000000..a47a243e4 --- /dev/null +++ b/generated/slo/docs/Model409Response.md @@ -0,0 +1,93 @@ +# Model409Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**StatusCode** | **float64** | | +**Error** | **string** | | +**Message** | **string** | | + +## Methods + +### NewModel409Response + +`func NewModel409Response(statusCode float64, error_ string, message string, ) *Model409Response` + +NewModel409Response instantiates a new Model409Response 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 + +### NewModel409ResponseWithDefaults + +`func NewModel409ResponseWithDefaults() *Model409Response` + +NewModel409ResponseWithDefaults instantiates a new Model409Response 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 + +### GetStatusCode + +`func (o *Model409Response) GetStatusCode() float64` + +GetStatusCode returns the StatusCode field if non-nil, zero value otherwise. + +### GetStatusCodeOk + +`func (o *Model409Response) GetStatusCodeOk() (*float64, bool)` + +GetStatusCodeOk returns a tuple with the StatusCode field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStatusCode + +`func (o *Model409Response) SetStatusCode(v float64)` + +SetStatusCode sets StatusCode field to given value. + + +### GetError + +`func (o *Model409Response) GetError() string` + +GetError returns the Error field if non-nil, zero value otherwise. + +### GetErrorOk + +`func (o *Model409Response) GetErrorOk() (*string, bool)` + +GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetError + +`func (o *Model409Response) SetError(v string)` + +SetError sets Error field to given value. + + +### GetMessage + +`func (o *Model409Response) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *Model409Response) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *Model409Response) SetMessage(v string)` + +SetMessage sets Message 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/Objective.md b/generated/slo/docs/Objective.md index ef30668b7..82a8fd57d 100644 --- a/generated/slo/docs/Objective.md +++ b/generated/slo/docs/Objective.md @@ -4,15 +4,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Target** | **float32** | the target objective between 0 and 1 excluded | -**TimeslicesTarget** | Pointer to **float32** | the target objective for each slice when using a timeslices budgeting method | [optional] -**TimeslicesWindow** | Pointer to **string** | the duration of each slice when using a timeslices budgeting method, as {duraton}{unit} | [optional] +**Target** | **float64** | the target objective between 0 and 1 excluded | +**TimesliceTarget** | Pointer to **float64** | the target objective for each slice when using a timeslices budgeting method | [optional] +**TimesliceWindow** | Pointer to **string** | the duration of each slice when using a timeslices budgeting method, as {duraton}{unit} | [optional] ## Methods ### NewObjective -`func NewObjective(target float32, ) *Objective` +`func NewObjective(target float64, ) *Objective` NewObjective instantiates a new Objective object This constructor will assign default values to properties that have it defined, @@ -29,73 +29,73 @@ but it doesn't guarantee that properties required by API are set ### GetTarget -`func (o *Objective) GetTarget() float32` +`func (o *Objective) GetTarget() float64` GetTarget returns the Target field if non-nil, zero value otherwise. ### GetTargetOk -`func (o *Objective) GetTargetOk() (*float32, bool)` +`func (o *Objective) GetTargetOk() (*float64, bool)` GetTargetOk returns a tuple with the Target field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTarget -`func (o *Objective) SetTarget(v float32)` +`func (o *Objective) SetTarget(v float64)` SetTarget sets Target field to given value. -### GetTimeslicesTarget +### GetTimesliceTarget -`func (o *Objective) GetTimeslicesTarget() float32` +`func (o *Objective) GetTimesliceTarget() float64` -GetTimeslicesTarget returns the TimeslicesTarget field if non-nil, zero value otherwise. +GetTimesliceTarget returns the TimesliceTarget field if non-nil, zero value otherwise. -### GetTimeslicesTargetOk +### GetTimesliceTargetOk -`func (o *Objective) GetTimeslicesTargetOk() (*float32, bool)` +`func (o *Objective) GetTimesliceTargetOk() (*float64, bool)` -GetTimeslicesTargetOk returns a tuple with the TimeslicesTarget field if it's non-nil, zero value otherwise +GetTimesliceTargetOk returns a tuple with the TimesliceTarget field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetTimeslicesTarget +### SetTimesliceTarget -`func (o *Objective) SetTimeslicesTarget(v float32)` +`func (o *Objective) SetTimesliceTarget(v float64)` -SetTimeslicesTarget sets TimeslicesTarget field to given value. +SetTimesliceTarget sets TimesliceTarget field to given value. -### HasTimeslicesTarget +### HasTimesliceTarget -`func (o *Objective) HasTimeslicesTarget() bool` +`func (o *Objective) HasTimesliceTarget() bool` -HasTimeslicesTarget returns a boolean if a field has been set. +HasTimesliceTarget returns a boolean if a field has been set. -### GetTimeslicesWindow +### GetTimesliceWindow -`func (o *Objective) GetTimeslicesWindow() string` +`func (o *Objective) GetTimesliceWindow() string` -GetTimeslicesWindow returns the TimeslicesWindow field if non-nil, zero value otherwise. +GetTimesliceWindow returns the TimesliceWindow field if non-nil, zero value otherwise. -### GetTimeslicesWindowOk +### GetTimesliceWindowOk -`func (o *Objective) GetTimeslicesWindowOk() (*string, bool)` +`func (o *Objective) GetTimesliceWindowOk() (*string, bool)` -GetTimeslicesWindowOk returns a tuple with the TimeslicesWindow field if it's non-nil, zero value otherwise +GetTimesliceWindowOk returns a tuple with the TimesliceWindow field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. -### SetTimeslicesWindow +### SetTimesliceWindow -`func (o *Objective) SetTimeslicesWindow(v string)` +`func (o *Objective) SetTimesliceWindow(v string)` -SetTimeslicesWindow sets TimeslicesWindow field to given value. +SetTimesliceWindow sets TimesliceWindow field to given value. -### HasTimeslicesWindow +### HasTimesliceWindow -`func (o *Objective) HasTimeslicesWindow() bool` +`func (o *Objective) HasTimesliceWindow() bool` -HasTimeslicesWindow returns a boolean if a field has been set. +HasTimesliceWindow 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/SlosApi.md b/generated/slo/docs/SloApi.md similarity index 71% rename from generated/slo/docs/SlosApi.md rename to generated/slo/docs/SloApi.md index b4f800b00..1a9803832 100644 --- a/generated/slo/docs/SlosApi.md +++ b/generated/slo/docs/SloApi.md @@ -1,23 +1,23 @@ -# \SlosApi +# \SloAPI All URIs are relative to *http://localhost:5601* Method | HTTP request | Description ------------- | ------------- | ------------- -[**CreateSlo**](SlosApi.md#CreateSlo) | **Post** /s/{spaceId}/api/observability/slos | Creates an SLO. -[**DeleteSlo**](SlosApi.md#DeleteSlo) | **Delete** /s/{spaceId}/api/observability/slos/{sloId} | Deletes an SLO -[**DisableSlo**](SlosApi.md#DisableSlo) | **Post** /s/{spaceId}/api/observability/slos/{sloId}/disable | Disables an SLO -[**EnableSlo**](SlosApi.md#EnableSlo) | **Post** /s/{spaceId}/api/observability/slos/{sloId}/enable | Enables an SLO -[**FindSlos**](SlosApi.md#FindSlos) | **Get** /s/{spaceId}/api/observability/slos | Retrieves a paginated list of SLOs -[**GetSlo**](SlosApi.md#GetSlo) | **Get** /s/{spaceId}/api/observability/slos/{sloId} | Retrieves a SLO -[**HistoricalSummary**](SlosApi.md#HistoricalSummary) | **Post** /s/{spaceId}/internal/observability/slos/_historical_summary | Retrieves the historical summary for a list of SLOs -[**UpdateSlo**](SlosApi.md#UpdateSlo) | **Put** /s/{spaceId}/api/observability/slos/{sloId} | Updates an SLO +[**CreateSloOp**](SloAPI.md#CreateSloOp) | **Post** /s/{spaceId}/api/observability/slos | Creates an SLO. +[**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 +[**FindSlosOp**](SloAPI.md#FindSlosOp) | **Get** /s/{spaceId}/api/observability/slos | Retrieves a paginated list of SLOs +[**GetSloOp**](SloAPI.md#GetSloOp) | **Get** /s/{spaceId}/api/observability/slos/{sloId} | Retrieves a SLO +[**HistoricalSummaryOp**](SloAPI.md#HistoricalSummaryOp) | **Post** /s/{spaceId}/internal/observability/slos/_historical_summary | Retrieves the historical summary for a list of SLOs +[**UpdateSloOp**](SloAPI.md#UpdateSloOp) | **Put** /s/{spaceId}/api/observability/slos/{sloId} | Updates an SLO -## CreateSlo +## CreateSloOp -> CreateSloResponse CreateSlo(ctx, spaceId).KbnXsrf(kbnXsrf).CreateSloRequest(createSloRequest).Execute() +> CreateSloResponse CreateSloOp(ctx, spaceId).KbnXsrf(kbnXsrf).CreateSloRequest(createSloRequest).Execute() Creates an SLO. @@ -38,17 +38,17 @@ import ( 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. - createSloRequest := *openapiclient.NewCreateSloRequest("Name_example", "Description_example", openapiclient.slo_response_indicator{IndicatorPropertiesApmAvailability: openapiclient.NewIndicatorPropertiesApmAvailability(*openapiclient.NewIndicatorPropertiesApmAvailabilityParams("o11y-app", "production", "request", "GET /my/api", "metrics-apm*,apm*"), "sli.apm.transactionDuration")}, openapiclient.slo_response_timeWindow{TimeWindowCalendarAligned: openapiclient.NewTimeWindowCalendarAligned("1M", *openapiclient.NewTimeWindowCalendarAlignedCalendar())}, openapiclient.budgeting_method("occurrences"), *openapiclient.NewObjective(float32(0.99))) // CreateSloRequest | + createSloRequest := *openapiclient.NewCreateSloRequest("Name_example", "Description_example", openapiclient.create_slo_request_indicator{IndicatorPropertiesApmAvailability: openapiclient.NewIndicatorPropertiesApmAvailability(*openapiclient.NewIndicatorPropertiesApmAvailabilityParams("o11y-app", "production", "request", "GET /my/api", "metrics-apm*,apm*"), "sli.apm.transactionDuration")}, *openapiclient.NewTimeWindow("30d", "rolling"), openapiclient.budgeting_method("occurrences"), *openapiclient.NewObjective(float64(0.99))) // CreateSloRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.SlosApi.CreateSlo(context.Background(), spaceId).KbnXsrf(kbnXsrf).CreateSloRequest(createSloRequest).Execute() + resp, r, err := apiClient.SloAPI.CreateSloOp(context.Background(), spaceId).KbnXsrf(kbnXsrf).CreateSloRequest(createSloRequest).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SlosApi.CreateSlo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.CreateSloOp``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `CreateSlo`: CreateSloResponse - fmt.Fprintf(os.Stdout, "Response from `SlosApi.CreateSlo`: %v\n", resp) + // response from `CreateSloOp`: CreateSloResponse + fmt.Fprintf(os.Stdout, "Response from `SloAPI.CreateSloOp`: %v\n", resp) } ``` @@ -62,7 +62,7 @@ Name | Type | Description | Notes ### Other Parameters -Other parameters are passed through a pointer to a apiCreateSloRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiCreateSloOpRequest struct via the builder pattern Name | Type | Description | Notes @@ -89,9 +89,9 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## DeleteSlo +## DeleteSloOp -> DeleteSlo(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).Execute() +> DeleteSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).Execute() Deletes an SLO @@ -116,9 +116,9 @@ func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.SlosApi.DeleteSlo(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() + r, err := apiClient.SloAPI.DeleteSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SlosApi.DeleteSlo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.DeleteSloOp``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } } @@ -135,7 +135,7 @@ Name | Type | Description | Notes ### Other Parameters -Other parameters are passed through a pointer to a apiDeleteSloRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiDeleteSloOpRequest struct via the builder pattern Name | Type | Description | Notes @@ -162,9 +162,9 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## DisableSlo +## DisableSloOp -> DisableSlo(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).Execute() +> DisableSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).Execute() Disables an SLO @@ -189,9 +189,9 @@ func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.SlosApi.DisableSlo(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() + r, err := apiClient.SloAPI.DisableSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SlosApi.DisableSlo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.DisableSloOp``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } } @@ -208,7 +208,7 @@ Name | Type | Description | Notes ### Other Parameters -Other parameters are passed through a pointer to a apiDisableSloRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiDisableSloOpRequest struct via the builder pattern Name | Type | Description | Notes @@ -235,9 +235,9 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## EnableSlo +## EnableSloOp -> EnableSlo(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).Execute() +> EnableSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).Execute() Enables an SLO @@ -262,9 +262,9 @@ func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.SlosApi.EnableSlo(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() + r, err := apiClient.SloAPI.EnableSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SlosApi.EnableSlo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.EnableSloOp``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } } @@ -281,7 +281,7 @@ Name | Type | Description | Notes ### Other Parameters -Other parameters are passed through a pointer to a apiEnableSloRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiEnableSloOpRequest struct via the builder pattern Name | Type | Description | Notes @@ -308,9 +308,9 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## FindSlos +## FindSlosOp -> FindSloResponse FindSlos(ctx, spaceId).KbnXsrf(kbnXsrf).Name(name).IndicatorTypes(indicatorTypes).Page(page).PerPage(perPage).SortBy(sortBy).SortDirection(sortDirection).Execute() +> FindSloResponse FindSlosOp(ctx, spaceId).KbnXsrf(kbnXsrf).KqlQuery(kqlQuery).Page(page).PerPage(perPage).SortBy(sortBy).SortDirection(sortDirection).Execute() Retrieves a paginated list of SLOs @@ -331,22 +331,21 @@ import ( 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. - name := "awesome-service" // string | Filter by name (optional) - indicatorTypes := []string{"Inner_example"} // []string | Filter by indicator type (optional) + kqlQuery := "slo.name:latency* and slo.tags : "prod"" // string | A valid kql query to filter the SLO with (optional) page := int32(1) // int32 | The page number to return (optional) (default to 1) - perPage := int32(20) // int32 | The number of SLOs to return per page (optional) (default to 25) - sortBy := "name" // string | Sort by field (optional) (default to "name") + perPage := int32(25) // int32 | The number of SLOs to return per page (optional) (default to 25) + sortBy := "status" // string | Sort by field (optional) (default to "status") sortDirection := "asc" // string | Sort order (optional) (default to "asc") configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.SlosApi.FindSlos(context.Background(), spaceId).KbnXsrf(kbnXsrf).Name(name).IndicatorTypes(indicatorTypes).Page(page).PerPage(perPage).SortBy(sortBy).SortDirection(sortDirection).Execute() + resp, r, err := apiClient.SloAPI.FindSlosOp(context.Background(), spaceId).KbnXsrf(kbnXsrf).KqlQuery(kqlQuery).Page(page).PerPage(perPage).SortBy(sortBy).SortDirection(sortDirection).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SlosApi.FindSlos``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.FindSlosOp``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `FindSlos`: FindSloResponse - fmt.Fprintf(os.Stdout, "Response from `SlosApi.FindSlos`: %v\n", resp) + // response from `FindSlosOp`: FindSloResponse + fmt.Fprintf(os.Stdout, "Response from `SloAPI.FindSlosOp`: %v\n", resp) } ``` @@ -360,18 +359,17 @@ Name | Type | Description | Notes ### Other Parameters -Other parameters are passed through a pointer to a apiFindSlosRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiFindSlosOpRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **kbnXsrf** | **string** | Cross-site request forgery protection | - **name** | **string** | Filter by name | - **indicatorTypes** | **[]string** | Filter by indicator type | + **kqlQuery** | **string** | A valid kql query to filter the SLO with | **page** | **int32** | The page number to return | [default to 1] **perPage** | **int32** | The number of SLOs to return per page | [default to 25] - **sortBy** | **string** | Sort by field | [default to "name"] + **sortBy** | **string** | Sort by field | [default to "status"] **sortDirection** | **string** | Sort order | [default to "asc"] ### Return type @@ -392,9 +390,9 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## GetSlo +## GetSloOp -> SloResponse GetSlo(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).Execute() +> SloResponse GetSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).InstanceId(instanceId).Execute() Retrieves a SLO @@ -416,16 +414,17 @@ 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. sloId := "9c235211-6834-11ea-a78c-6feb38a34414" // string | An identifier for the slo. + instanceId := "host-abcde" // string | the specific instanceId used by the summary calculation (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.SlosApi.GetSlo(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() + resp, r, err := apiClient.SloAPI.GetSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).InstanceId(instanceId).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SlosApi.GetSlo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.GetSloOp``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `GetSlo`: SloResponse - fmt.Fprintf(os.Stdout, "Response from `SlosApi.GetSlo`: %v\n", resp) + // response from `GetSloOp`: SloResponse + fmt.Fprintf(os.Stdout, "Response from `SloAPI.GetSloOp`: %v\n", resp) } ``` @@ -440,7 +439,7 @@ Name | Type | Description | Notes ### Other Parameters -Other parameters are passed through a pointer to a apiGetSloRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiGetSloOpRequest struct via the builder pattern Name | Type | Description | Notes @@ -448,6 +447,7 @@ Name | Type | Description | Notes **kbnXsrf** | **string** | Cross-site request forgery protection | + **instanceId** | **string** | the specific instanceId used by the summary calculation | ### Return type @@ -467,9 +467,9 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## HistoricalSummary +## HistoricalSummaryOp -> map[string][]HistoricalSummaryResponseInner HistoricalSummary(ctx, spaceId).KbnXsrf(kbnXsrf).HistoricalSummaryRequest(historicalSummaryRequest).Execute() +> map[string][]HistoricalSummaryResponseInner HistoricalSummaryOp(ctx, spaceId).KbnXsrf(kbnXsrf).HistoricalSummaryRequest(historicalSummaryRequest).Execute() Retrieves the historical summary for a list of SLOs @@ -494,13 +494,13 @@ func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.SlosApi.HistoricalSummary(context.Background(), spaceId).KbnXsrf(kbnXsrf).HistoricalSummaryRequest(historicalSummaryRequest).Execute() + resp, r, err := apiClient.SloAPI.HistoricalSummaryOp(context.Background(), spaceId).KbnXsrf(kbnXsrf).HistoricalSummaryRequest(historicalSummaryRequest).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SlosApi.HistoricalSummary``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.HistoricalSummaryOp``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `HistoricalSummary`: map[string][]HistoricalSummaryResponseInner - fmt.Fprintf(os.Stdout, "Response from `SlosApi.HistoricalSummary`: %v\n", resp) + // response from `HistoricalSummaryOp`: map[string][]HistoricalSummaryResponseInner + fmt.Fprintf(os.Stdout, "Response from `SloAPI.HistoricalSummaryOp`: %v\n", resp) } ``` @@ -514,7 +514,7 @@ Name | Type | Description | Notes ### Other Parameters -Other parameters are passed through a pointer to a apiHistoricalSummaryRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiHistoricalSummaryOpRequest struct via the builder pattern Name | Type | Description | Notes @@ -541,9 +541,9 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## UpdateSlo +## UpdateSloOp -> SloResponse UpdateSlo(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).UpdateSloRequest(updateSloRequest).Execute() +> SloResponse UpdateSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).UpdateSloRequest(updateSloRequest).Execute() Updates an SLO @@ -569,13 +569,13 @@ func main() { configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.SlosApi.UpdateSlo(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).UpdateSloRequest(updateSloRequest).Execute() + resp, r, err := apiClient.SloAPI.UpdateSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).UpdateSloRequest(updateSloRequest).Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SlosApi.UpdateSlo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.UpdateSloOp``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `UpdateSlo`: SloResponse - fmt.Fprintf(os.Stdout, "Response from `SlosApi.UpdateSlo`: %v\n", resp) + // response from `UpdateSloOp`: SloResponse + fmt.Fprintf(os.Stdout, "Response from `SloAPI.UpdateSloOp`: %v\n", resp) } ``` @@ -590,7 +590,7 @@ Name | Type | Description | Notes ### Other Parameters -Other parameters are passed through a pointer to a apiUpdateSloRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiUpdateSloOpRequest struct via the builder pattern Name | Type | Description | Notes diff --git a/generated/slo/docs/SloResponse.md b/generated/slo/docs/SloResponse.md index 4cd6701dd..18d44159b 100644 --- a/generated/slo/docs/SloResponse.md +++ b/generated/slo/docs/SloResponse.md @@ -4,25 +4,27 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | Pointer to **string** | The identifier of the SLO. | [optional] -**Name** | Pointer to **string** | The name of the SLO. | [optional] -**Description** | Pointer to **string** | The description of the SLO. | [optional] -**Indicator** | Pointer to [**SloResponseIndicator**](SloResponseIndicator.md) | | [optional] -**TimeWindow** | Pointer to [**SloResponseTimeWindow**](SloResponseTimeWindow.md) | | [optional] -**BudgetingMethod** | Pointer to [**BudgetingMethod**](BudgetingMethod.md) | | [optional] -**Objective** | Pointer to [**Objective**](Objective.md) | | [optional] -**Settings** | Pointer to [**Settings**](Settings.md) | | [optional] -**Revision** | Pointer to **float32** | The SLO revision | [optional] -**Summary** | Pointer to [**Summary**](Summary.md) | | [optional] -**Enabled** | Pointer to **bool** | Indicate if the SLO is enabled | [optional] -**CreatedAt** | Pointer to **string** | The creation date | [optional] -**UpdatedAt** | Pointer to **string** | The last update date | [optional] +**Id** | **string** | The identifier of the SLO. | +**Name** | **string** | The name of the SLO. | +**Description** | **string** | The description of the SLO. | +**Indicator** | [**SloResponseIndicator**](SloResponseIndicator.md) | | +**TimeWindow** | [**TimeWindow**](TimeWindow.md) | | +**BudgetingMethod** | [**BudgetingMethod**](BudgetingMethod.md) | | +**Objective** | [**Objective**](Objective.md) | | +**Settings** | [**Settings**](Settings.md) | | +**Revision** | **float64** | The SLO revision | +**Summary** | [**Summary**](Summary.md) | | +**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 '*' | +**CreatedAt** | **string** | The creation date | +**UpdatedAt** | **string** | The last update date | ## Methods ### NewSloResponse -`func NewSloResponse() *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, createdAt string, updatedAt string, ) *SloResponse` NewSloResponse instantiates a new SloResponse object This constructor will assign default values to properties that have it defined, @@ -56,11 +58,6 @@ and a boolean to check if the value has been set. SetId sets Id field to given value. -### HasId - -`func (o *SloResponse) HasId() bool` - -HasId returns a boolean if a field has been set. ### GetName @@ -81,11 +78,6 @@ and a boolean to check if the value has been set. SetName sets Name field to given value. -### HasName - -`func (o *SloResponse) HasName() bool` - -HasName returns a boolean if a field has been set. ### GetDescription @@ -106,11 +98,6 @@ and a boolean to check if the value has been set. SetDescription sets Description field to given value. -### HasDescription - -`func (o *SloResponse) HasDescription() bool` - -HasDescription returns a boolean if a field has been set. ### GetIndicator @@ -131,36 +118,26 @@ and a boolean to check if the value has been set. SetIndicator sets Indicator field to given value. -### HasIndicator - -`func (o *SloResponse) HasIndicator() bool` - -HasIndicator returns a boolean if a field has been set. ### GetTimeWindow -`func (o *SloResponse) GetTimeWindow() SloResponseTimeWindow` +`func (o *SloResponse) GetTimeWindow() TimeWindow` GetTimeWindow returns the TimeWindow field if non-nil, zero value otherwise. ### GetTimeWindowOk -`func (o *SloResponse) GetTimeWindowOk() (*SloResponseTimeWindow, bool)` +`func (o *SloResponse) GetTimeWindowOk() (*TimeWindow, bool)` GetTimeWindowOk returns a tuple with the TimeWindow field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTimeWindow -`func (o *SloResponse) SetTimeWindow(v SloResponseTimeWindow)` +`func (o *SloResponse) SetTimeWindow(v TimeWindow)` SetTimeWindow sets TimeWindow field to given value. -### HasTimeWindow - -`func (o *SloResponse) HasTimeWindow() bool` - -HasTimeWindow returns a boolean if a field has been set. ### GetBudgetingMethod @@ -181,11 +158,6 @@ and a boolean to check if the value has been set. SetBudgetingMethod sets BudgetingMethod field to given value. -### HasBudgetingMethod - -`func (o *SloResponse) HasBudgetingMethod() bool` - -HasBudgetingMethod returns a boolean if a field has been set. ### GetObjective @@ -206,11 +178,6 @@ and a boolean to check if the value has been set. SetObjective sets Objective field to given value. -### HasObjective - -`func (o *SloResponse) HasObjective() bool` - -HasObjective returns a boolean if a field has been set. ### GetSettings @@ -231,36 +198,26 @@ and a boolean to check if the value has been set. SetSettings sets Settings field to given value. -### HasSettings - -`func (o *SloResponse) HasSettings() bool` - -HasSettings returns a boolean if a field has been set. ### GetRevision -`func (o *SloResponse) GetRevision() float32` +`func (o *SloResponse) GetRevision() float64` GetRevision returns the Revision field if non-nil, zero value otherwise. ### GetRevisionOk -`func (o *SloResponse) GetRevisionOk() (*float32, bool)` +`func (o *SloResponse) GetRevisionOk() (*float64, bool)` GetRevisionOk returns a tuple with the Revision field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetRevision -`func (o *SloResponse) SetRevision(v float32)` +`func (o *SloResponse) SetRevision(v float64)` SetRevision sets Revision field to given value. -### HasRevision - -`func (o *SloResponse) HasRevision() bool` - -HasRevision returns a boolean if a field has been set. ### GetSummary @@ -281,11 +238,6 @@ and a boolean to check if the value has been set. SetSummary sets Summary field to given value. -### HasSummary - -`func (o *SloResponse) HasSummary() bool` - -HasSummary returns a boolean if a field has been set. ### GetEnabled @@ -306,11 +258,46 @@ and a boolean to check if the value has been set. SetEnabled sets Enabled field to given value. -### HasEnabled -`func (o *SloResponse) HasEnabled() bool` +### GetGroupBy + +`func (o *SloResponse) GetGroupBy() string` + +GetGroupBy returns the GroupBy field if non-nil, zero value otherwise. + +### GetGroupByOk + +`func (o *SloResponse) GetGroupByOk() (*string, bool)` + +GetGroupByOk returns a tuple with the GroupBy field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGroupBy + +`func (o *SloResponse) SetGroupBy(v string)` + +SetGroupBy sets GroupBy field to given value. + + +### GetInstanceId + +`func (o *SloResponse) GetInstanceId() string` + +GetInstanceId returns the InstanceId field if non-nil, zero value otherwise. + +### GetInstanceIdOk + +`func (o *SloResponse) 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 *SloResponse) SetInstanceId(v string)` + +SetInstanceId sets InstanceId field to given value. -HasEnabled returns a boolean if a field has been set. ### GetCreatedAt @@ -331,11 +318,6 @@ and a boolean to check if the value has been set. SetCreatedAt sets CreatedAt field to given value. -### HasCreatedAt - -`func (o *SloResponse) HasCreatedAt() bool` - -HasCreatedAt returns a boolean if a field has been set. ### GetUpdatedAt @@ -356,11 +338,6 @@ and a boolean to check if the value has been set. SetUpdatedAt sets UpdatedAt field to given value. -### HasUpdatedAt - -`func (o *SloResponse) HasUpdatedAt() bool` - -HasUpdatedAt 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/SloResponseIndicator.md b/generated/slo/docs/SloResponseIndicator.md index d5cf488c3..544a78320 100644 --- a/generated/slo/docs/SloResponseIndicator.md +++ b/generated/slo/docs/SloResponseIndicator.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Params** | [**IndicatorPropertiesApmLatencyParams**](IndicatorPropertiesApmLatencyParams.md) | | +**Params** | [**IndicatorPropertiesHistogramParams**](IndicatorPropertiesHistogramParams.md) | | **Type** | **string** | The type of indicator. | ## Methods ### NewSloResponseIndicator -`func NewSloResponseIndicator(params IndicatorPropertiesApmLatencyParams, type_ string, ) *SloResponseIndicator` +`func NewSloResponseIndicator(params IndicatorPropertiesHistogramParams, 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() IndicatorPropertiesApmLatencyParams` +`func (o *SloResponseIndicator) GetParams() IndicatorPropertiesHistogramParams` GetParams returns the Params field if non-nil, zero value otherwise. ### GetParamsOk -`func (o *SloResponseIndicator) GetParamsOk() (*IndicatorPropertiesApmLatencyParams, bool)` +`func (o *SloResponseIndicator) GetParamsOk() (*IndicatorPropertiesHistogramParams, 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 IndicatorPropertiesApmLatencyParams)` +`func (o *SloResponseIndicator) SetParams(v IndicatorPropertiesHistogramParams)` SetParams sets Params field to given value. diff --git a/generated/slo/docs/SloResponseTimeWindow.md b/generated/slo/docs/SloResponseTimeWindow.md deleted file mode 100644 index 298927849..000000000 --- a/generated/slo/docs/SloResponseTimeWindow.md +++ /dev/null @@ -1,93 +0,0 @@ -# SloResponseTimeWindow - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Duration** | **string** | the duration formatted as {duration}{unit} | -**IsRolling** | **bool** | Indicates a rolling time window | -**Calendar** | [**TimeWindowCalendarAlignedCalendar**](TimeWindowCalendarAlignedCalendar.md) | | - -## Methods - -### NewSloResponseTimeWindow - -`func NewSloResponseTimeWindow(duration string, isRolling bool, calendar TimeWindowCalendarAlignedCalendar, ) *SloResponseTimeWindow` - -NewSloResponseTimeWindow instantiates a new SloResponseTimeWindow 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 - -### NewSloResponseTimeWindowWithDefaults - -`func NewSloResponseTimeWindowWithDefaults() *SloResponseTimeWindow` - -NewSloResponseTimeWindowWithDefaults instantiates a new SloResponseTimeWindow 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 - -### GetDuration - -`func (o *SloResponseTimeWindow) GetDuration() string` - -GetDuration returns the Duration field if non-nil, zero value otherwise. - -### GetDurationOk - -`func (o *SloResponseTimeWindow) GetDurationOk() (*string, bool)` - -GetDurationOk returns a tuple with the Duration field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetDuration - -`func (o *SloResponseTimeWindow) SetDuration(v string)` - -SetDuration sets Duration field to given value. - - -### GetIsRolling - -`func (o *SloResponseTimeWindow) GetIsRolling() bool` - -GetIsRolling returns the IsRolling field if non-nil, zero value otherwise. - -### GetIsRollingOk - -`func (o *SloResponseTimeWindow) GetIsRollingOk() (*bool, bool)` - -GetIsRollingOk returns a tuple with the IsRolling field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetIsRolling - -`func (o *SloResponseTimeWindow) SetIsRolling(v bool)` - -SetIsRolling sets IsRolling field to given value. - - -### GetCalendar - -`func (o *SloResponseTimeWindow) GetCalendar() TimeWindowCalendarAlignedCalendar` - -GetCalendar returns the Calendar field if non-nil, zero value otherwise. - -### GetCalendarOk - -`func (o *SloResponseTimeWindow) GetCalendarOk() (*TimeWindowCalendarAlignedCalendar, bool)` - -GetCalendarOk returns a tuple with the Calendar field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetCalendar - -`func (o *SloResponseTimeWindow) SetCalendar(v TimeWindowCalendarAlignedCalendar)` - -SetCalendar sets Calendar 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/Summary.md b/generated/slo/docs/Summary.md index 6c4330f46..56b7e11c7 100644 --- a/generated/slo/docs/Summary.md +++ b/generated/slo/docs/Summary.md @@ -4,15 +4,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Status** | Pointer to **string** | | [optional] -**SliValue** | Pointer to **float32** | | [optional] -**ErrorBudget** | Pointer to [**ErrorBudget**](ErrorBudget.md) | | [optional] +**Status** | [**SummaryStatus**](SummaryStatus.md) | | +**SliValue** | **float64** | | +**ErrorBudget** | [**ErrorBudget**](ErrorBudget.md) | | ## Methods ### NewSummary -`func NewSummary() *Summary` +`func NewSummary(status SummaryStatus, sliValue float64, errorBudget ErrorBudget, ) *Summary` NewSummary instantiates a new Summary object This constructor will assign default values to properties that have it defined, @@ -29,53 +29,43 @@ but it doesn't guarantee that properties required by API are set ### GetStatus -`func (o *Summary) GetStatus() string` +`func (o *Summary) GetStatus() SummaryStatus` GetStatus returns the Status field if non-nil, zero value otherwise. ### GetStatusOk -`func (o *Summary) GetStatusOk() (*string, bool)` +`func (o *Summary) GetStatusOk() (*SummaryStatus, bool)` GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetStatus -`func (o *Summary) SetStatus(v string)` +`func (o *Summary) SetStatus(v SummaryStatus)` SetStatus sets Status field to given value. -### HasStatus - -`func (o *Summary) HasStatus() bool` - -HasStatus returns a boolean if a field has been set. ### GetSliValue -`func (o *Summary) GetSliValue() float32` +`func (o *Summary) GetSliValue() float64` GetSliValue returns the SliValue field if non-nil, zero value otherwise. ### GetSliValueOk -`func (o *Summary) GetSliValueOk() (*float32, bool)` +`func (o *Summary) GetSliValueOk() (*float64, bool)` GetSliValueOk returns a tuple with the SliValue field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetSliValue -`func (o *Summary) SetSliValue(v float32)` +`func (o *Summary) SetSliValue(v float64)` SetSliValue sets SliValue field to given value. -### HasSliValue - -`func (o *Summary) HasSliValue() bool` - -HasSliValue returns a boolean if a field has been set. ### GetErrorBudget @@ -96,11 +86,6 @@ and a boolean to check if the value has been set. SetErrorBudget sets ErrorBudget field to given value. -### HasErrorBudget - -`func (o *Summary) HasErrorBudget() bool` - -HasErrorBudget 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/SummaryStatus.md b/generated/slo/docs/SummaryStatus.md new file mode 100644 index 000000000..d59b446d9 --- /dev/null +++ b/generated/slo/docs/SummaryStatus.md @@ -0,0 +1,17 @@ +# SummaryStatus + +## Enum + + +* `NO_DATA` (value: `"NO_DATA"`) + +* `HEALTHY` (value: `"HEALTHY"`) + +* `DEGRADING` (value: `"DEGRADING"`) + +* `VIOLATED` (value: `"VIOLATED"`) + + +[[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/TimeWindowRolling.md b/generated/slo/docs/TimeWindow.md similarity index 51% rename from generated/slo/docs/TimeWindowRolling.md rename to generated/slo/docs/TimeWindow.md index d9813cf9f..97988361b 100644 --- a/generated/slo/docs/TimeWindowRolling.md +++ b/generated/slo/docs/TimeWindow.md @@ -1,69 +1,69 @@ -# TimeWindowRolling +# TimeWindow ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Duration** | **string** | the duration formatted as {duration}{unit} | -**IsRolling** | **bool** | Indicates a rolling time window | +**Duration** | **string** | the duration formatted as {duration}{unit}. Accepted values for rolling: 7d, 30d, 90d. Accepted values for calendar aligned: 1w (weekly) or 1M (monthly) | +**Type** | **string** | Indicates weither the time window is a rolling or a calendar aligned time window. | ## Methods -### NewTimeWindowRolling +### NewTimeWindow -`func NewTimeWindowRolling(duration string, isRolling bool, ) *TimeWindowRolling` +`func NewTimeWindow(duration string, type_ string, ) *TimeWindow` -NewTimeWindowRolling instantiates a new TimeWindowRolling object +NewTimeWindow instantiates a new TimeWindow 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 -### NewTimeWindowRollingWithDefaults +### NewTimeWindowWithDefaults -`func NewTimeWindowRollingWithDefaults() *TimeWindowRolling` +`func NewTimeWindowWithDefaults() *TimeWindow` -NewTimeWindowRollingWithDefaults instantiates a new TimeWindowRolling object +NewTimeWindowWithDefaults instantiates a new TimeWindow 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 ### GetDuration -`func (o *TimeWindowRolling) GetDuration() string` +`func (o *TimeWindow) GetDuration() string` GetDuration returns the Duration field if non-nil, zero value otherwise. ### GetDurationOk -`func (o *TimeWindowRolling) GetDurationOk() (*string, bool)` +`func (o *TimeWindow) GetDurationOk() (*string, bool)` GetDurationOk returns a tuple with the Duration field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetDuration -`func (o *TimeWindowRolling) SetDuration(v string)` +`func (o *TimeWindow) SetDuration(v string)` SetDuration sets Duration field to given value. -### GetIsRolling +### GetType -`func (o *TimeWindowRolling) GetIsRolling() bool` +`func (o *TimeWindow) GetType() string` -GetIsRolling returns the IsRolling field if non-nil, zero value otherwise. +GetType returns the Type field if non-nil, zero value otherwise. -### GetIsRollingOk +### GetTypeOk -`func (o *TimeWindowRolling) GetIsRollingOk() (*bool, bool)` +`func (o *TimeWindow) GetTypeOk() (*string, bool)` -GetIsRollingOk returns a tuple with the IsRolling field if it's non-nil, zero value otherwise +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. -### SetIsRolling +### SetType -`func (o *TimeWindowRolling) SetIsRolling(v bool)` +`func (o *TimeWindow) SetType(v string)` -SetIsRolling sets IsRolling field to given value. +SetType sets Type field to given value. diff --git a/generated/slo/docs/TimeWindowCalendarAligned.md b/generated/slo/docs/TimeWindowCalendarAligned.md deleted file mode 100644 index 47c999942..000000000 --- a/generated/slo/docs/TimeWindowCalendarAligned.md +++ /dev/null @@ -1,72 +0,0 @@ -# TimeWindowCalendarAligned - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Duration** | **string** | the duration formatted as {duration}{unit} | -**Calendar** | [**TimeWindowCalendarAlignedCalendar**](TimeWindowCalendarAlignedCalendar.md) | | - -## Methods - -### NewTimeWindowCalendarAligned - -`func NewTimeWindowCalendarAligned(duration string, calendar TimeWindowCalendarAlignedCalendar, ) *TimeWindowCalendarAligned` - -NewTimeWindowCalendarAligned instantiates a new TimeWindowCalendarAligned 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 - -### NewTimeWindowCalendarAlignedWithDefaults - -`func NewTimeWindowCalendarAlignedWithDefaults() *TimeWindowCalendarAligned` - -NewTimeWindowCalendarAlignedWithDefaults instantiates a new TimeWindowCalendarAligned 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 - -### GetDuration - -`func (o *TimeWindowCalendarAligned) GetDuration() string` - -GetDuration returns the Duration field if non-nil, zero value otherwise. - -### GetDurationOk - -`func (o *TimeWindowCalendarAligned) GetDurationOk() (*string, bool)` - -GetDurationOk returns a tuple with the Duration field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetDuration - -`func (o *TimeWindowCalendarAligned) SetDuration(v string)` - -SetDuration sets Duration field to given value. - - -### GetCalendar - -`func (o *TimeWindowCalendarAligned) GetCalendar() TimeWindowCalendarAlignedCalendar` - -GetCalendar returns the Calendar field if non-nil, zero value otherwise. - -### GetCalendarOk - -`func (o *TimeWindowCalendarAligned) GetCalendarOk() (*TimeWindowCalendarAlignedCalendar, bool)` - -GetCalendarOk returns a tuple with the Calendar field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetCalendar - -`func (o *TimeWindowCalendarAligned) SetCalendar(v TimeWindowCalendarAlignedCalendar)` - -SetCalendar sets Calendar 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/TimeWindowCalendarAlignedCalendar.md b/generated/slo/docs/TimeWindowCalendarAlignedCalendar.md deleted file mode 100644 index 836666742..000000000 --- a/generated/slo/docs/TimeWindowCalendarAlignedCalendar.md +++ /dev/null @@ -1,56 +0,0 @@ -# TimeWindowCalendarAlignedCalendar - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**StartTime** | Pointer to **string** | The start date to use. | [optional] - -## Methods - -### NewTimeWindowCalendarAlignedCalendar - -`func NewTimeWindowCalendarAlignedCalendar() *TimeWindowCalendarAlignedCalendar` - -NewTimeWindowCalendarAlignedCalendar instantiates a new TimeWindowCalendarAlignedCalendar 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 - -### NewTimeWindowCalendarAlignedCalendarWithDefaults - -`func NewTimeWindowCalendarAlignedCalendarWithDefaults() *TimeWindowCalendarAlignedCalendar` - -NewTimeWindowCalendarAlignedCalendarWithDefaults instantiates a new TimeWindowCalendarAlignedCalendar 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 - -### GetStartTime - -`func (o *TimeWindowCalendarAlignedCalendar) GetStartTime() string` - -GetStartTime returns the StartTime field if non-nil, zero value otherwise. - -### GetStartTimeOk - -`func (o *TimeWindowCalendarAlignedCalendar) GetStartTimeOk() (*string, bool)` - -GetStartTimeOk returns a tuple with the StartTime field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetStartTime - -`func (o *TimeWindowCalendarAlignedCalendar) SetStartTime(v string)` - -SetStartTime sets StartTime field to given value. - -### HasStartTime - -`func (o *TimeWindowCalendarAlignedCalendar) HasStartTime() bool` - -HasStartTime 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 f8fca4104..e228b7e32 100644 --- a/generated/slo/docs/UpdateSloRequest.md +++ b/generated/slo/docs/UpdateSloRequest.md @@ -6,8 +6,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Name** | Pointer to **string** | A name for the SLO. | [optional] **Description** | Pointer to **string** | A description for the SLO. | [optional] -**Indicator** | Pointer to [**SloResponseIndicator**](SloResponseIndicator.md) | | [optional] -**TimeWindow** | Pointer to [**SloResponseTimeWindow**](SloResponseTimeWindow.md) | | [optional] +**Indicator** | Pointer to [**CreateSloRequestIndicator**](CreateSloRequestIndicator.md) | | [optional] +**TimeWindow** | Pointer to [**TimeWindow**](TimeWindow.md) | | [optional] **BudgetingMethod** | Pointer to [**BudgetingMethod**](BudgetingMethod.md) | | [optional] **Objective** | Pointer to [**Objective**](Objective.md) | | [optional] **Settings** | Pointer to [**Settings**](Settings.md) | | [optional] @@ -83,20 +83,20 @@ HasDescription returns a boolean if a field has been set. ### GetIndicator -`func (o *UpdateSloRequest) GetIndicator() SloResponseIndicator` +`func (o *UpdateSloRequest) GetIndicator() CreateSloRequestIndicator` GetIndicator returns the Indicator field if non-nil, zero value otherwise. ### GetIndicatorOk -`func (o *UpdateSloRequest) GetIndicatorOk() (*SloResponseIndicator, bool)` +`func (o *UpdateSloRequest) GetIndicatorOk() (*CreateSloRequestIndicator, bool)` GetIndicatorOk returns a tuple with the Indicator field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetIndicator -`func (o *UpdateSloRequest) SetIndicator(v SloResponseIndicator)` +`func (o *UpdateSloRequest) SetIndicator(v CreateSloRequestIndicator)` SetIndicator sets Indicator field to given value. @@ -108,20 +108,20 @@ HasIndicator returns a boolean if a field has been set. ### GetTimeWindow -`func (o *UpdateSloRequest) GetTimeWindow() SloResponseTimeWindow` +`func (o *UpdateSloRequest) GetTimeWindow() TimeWindow` GetTimeWindow returns the TimeWindow field if non-nil, zero value otherwise. ### GetTimeWindowOk -`func (o *UpdateSloRequest) GetTimeWindowOk() (*SloResponseTimeWindow, bool)` +`func (o *UpdateSloRequest) GetTimeWindowOk() (*TimeWindow, bool)` GetTimeWindowOk returns a tuple with the TimeWindow field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetTimeWindow -`func (o *UpdateSloRequest) SetTimeWindow(v SloResponseTimeWindow)` +`func (o *UpdateSloRequest) SetTimeWindow(v TimeWindow)` SetTimeWindow sets TimeWindow field to given value. diff --git a/generated/slo/model_400_response.go b/generated/slo/model_400_response.go new file mode 100644 index 000000000..1965ef831 --- /dev/null +++ b/generated/slo/model_400_response.go @@ -0,0 +1,169 @@ +/* +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 Model400Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Model400Response{} + +// Model400Response struct for Model400Response +type Model400Response struct { + StatusCode float64 `json:"statusCode"` + Error string `json:"error"` + Message string `json:"message"` +} + +// NewModel400Response instantiates a new Model400Response 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 NewModel400Response(statusCode float64, error_ string, message string) *Model400Response { + this := Model400Response{} + this.StatusCode = statusCode + this.Error = error_ + this.Message = message + return &this +} + +// NewModel400ResponseWithDefaults instantiates a new Model400Response 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 NewModel400ResponseWithDefaults() *Model400Response { + this := Model400Response{} + return &this +} + +// GetStatusCode returns the StatusCode field value +func (o *Model400Response) GetStatusCode() float64 { + if o == nil { + var ret float64 + return ret + } + + return o.StatusCode +} + +// GetStatusCodeOk returns a tuple with the StatusCode field value +// and a boolean to check if the value has been set. +func (o *Model400Response) GetStatusCodeOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.StatusCode, true +} + +// SetStatusCode sets field value +func (o *Model400Response) SetStatusCode(v float64) { + o.StatusCode = v +} + +// GetError returns the Error field value +func (o *Model400Response) GetError() string { + if o == nil { + var ret string + return ret + } + + return o.Error +} + +// GetErrorOk returns a tuple with the Error field value +// and a boolean to check if the value has been set. +func (o *Model400Response) GetErrorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Error, true +} + +// SetError sets field value +func (o *Model400Response) SetError(v string) { + o.Error = v +} + +// GetMessage returns the Message field value +func (o *Model400Response) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *Model400Response) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *Model400Response) SetMessage(v string) { + o.Message = v +} + +func (o Model400Response) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Model400Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["statusCode"] = o.StatusCode + toSerialize["error"] = o.Error + toSerialize["message"] = o.Message + return toSerialize, nil +} + +type NullableModel400Response struct { + value *Model400Response + isSet bool +} + +func (v NullableModel400Response) Get() *Model400Response { + return v.value +} + +func (v *NullableModel400Response) Set(val *Model400Response) { + v.value = val + v.isSet = true +} + +func (v NullableModel400Response) IsSet() bool { + return v.isSet +} + +func (v *NullableModel400Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModel400Response(val *Model400Response) *NullableModel400Response { + return &NullableModel400Response{value: val, isSet: true} +} + +func (v NullableModel400Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModel400Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_401_response.go b/generated/slo/model_401_response.go new file mode 100644 index 000000000..b4f7f83e7 --- /dev/null +++ b/generated/slo/model_401_response.go @@ -0,0 +1,169 @@ +/* +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 Model401Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Model401Response{} + +// Model401Response struct for Model401Response +type Model401Response struct { + StatusCode float64 `json:"statusCode"` + Error string `json:"error"` + Message string `json:"message"` +} + +// NewModel401Response instantiates a new Model401Response 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 NewModel401Response(statusCode float64, error_ string, message string) *Model401Response { + this := Model401Response{} + this.StatusCode = statusCode + this.Error = error_ + this.Message = message + return &this +} + +// NewModel401ResponseWithDefaults instantiates a new Model401Response 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 NewModel401ResponseWithDefaults() *Model401Response { + this := Model401Response{} + return &this +} + +// GetStatusCode returns the StatusCode field value +func (o *Model401Response) GetStatusCode() float64 { + if o == nil { + var ret float64 + return ret + } + + return o.StatusCode +} + +// GetStatusCodeOk returns a tuple with the StatusCode field value +// and a boolean to check if the value has been set. +func (o *Model401Response) GetStatusCodeOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.StatusCode, true +} + +// SetStatusCode sets field value +func (o *Model401Response) SetStatusCode(v float64) { + o.StatusCode = v +} + +// GetError returns the Error field value +func (o *Model401Response) GetError() string { + if o == nil { + var ret string + return ret + } + + return o.Error +} + +// GetErrorOk returns a tuple with the Error field value +// and a boolean to check if the value has been set. +func (o *Model401Response) GetErrorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Error, true +} + +// SetError sets field value +func (o *Model401Response) SetError(v string) { + o.Error = v +} + +// GetMessage returns the Message field value +func (o *Model401Response) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *Model401Response) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *Model401Response) SetMessage(v string) { + o.Message = v +} + +func (o Model401Response) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Model401Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["statusCode"] = o.StatusCode + toSerialize["error"] = o.Error + toSerialize["message"] = o.Message + return toSerialize, nil +} + +type NullableModel401Response struct { + value *Model401Response + isSet bool +} + +func (v NullableModel401Response) Get() *Model401Response { + return v.value +} + +func (v *NullableModel401Response) Set(val *Model401Response) { + v.value = val + v.isSet = true +} + +func (v NullableModel401Response) IsSet() bool { + return v.isSet +} + +func (v *NullableModel401Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModel401Response(val *Model401Response) *NullableModel401Response { + return &NullableModel401Response{value: val, isSet: true} +} + +func (v NullableModel401Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModel401Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_4xx_response.go b/generated/slo/model_403_response.go similarity index 58% rename from generated/slo/model_4xx_response.go rename to generated/slo/model_403_response.go index 139ebe8c1..4ccd57a9a 100644 --- a/generated/slo/model_4xx_response.go +++ b/generated/slo/model_403_response.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -14,40 +14,40 @@ import ( "encoding/json" ) -// checks if the Model4xxResponse type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &Model4xxResponse{} +// checks if the Model403Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Model403Response{} -// Model4xxResponse struct for Model4xxResponse -type Model4xxResponse struct { - StatusCode float32 `json:"statusCode"` +// Model403Response struct for Model403Response +type Model403Response struct { + StatusCode float64 `json:"statusCode"` Error string `json:"error"` Message string `json:"message"` } -// NewModel4xxResponse instantiates a new Model4xxResponse object +// NewModel403Response instantiates a new Model403Response 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 NewModel4xxResponse(statusCode float32, error_ string, message string) *Model4xxResponse { - this := Model4xxResponse{} +func NewModel403Response(statusCode float64, error_ string, message string) *Model403Response { + this := Model403Response{} this.StatusCode = statusCode this.Error = error_ this.Message = message return &this } -// NewModel4xxResponseWithDefaults instantiates a new Model4xxResponse object +// NewModel403ResponseWithDefaults instantiates a new Model403Response 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 NewModel4xxResponseWithDefaults() *Model4xxResponse { - this := Model4xxResponse{} +func NewModel403ResponseWithDefaults() *Model403Response { + this := Model403Response{} return &this } // GetStatusCode returns the StatusCode field value -func (o *Model4xxResponse) GetStatusCode() float32 { +func (o *Model403Response) GetStatusCode() float64 { if o == nil { - var ret float32 + var ret float64 return ret } @@ -56,7 +56,7 @@ func (o *Model4xxResponse) GetStatusCode() float32 { // GetStatusCodeOk returns a tuple with the StatusCode field value // and a boolean to check if the value has been set. -func (o *Model4xxResponse) GetStatusCodeOk() (*float32, bool) { +func (o *Model403Response) GetStatusCodeOk() (*float64, bool) { if o == nil { return nil, false } @@ -64,12 +64,12 @@ func (o *Model4xxResponse) GetStatusCodeOk() (*float32, bool) { } // SetStatusCode sets field value -func (o *Model4xxResponse) SetStatusCode(v float32) { +func (o *Model403Response) SetStatusCode(v float64) { o.StatusCode = v } // GetError returns the Error field value -func (o *Model4xxResponse) GetError() string { +func (o *Model403Response) GetError() string { if o == nil { var ret string return ret @@ -80,7 +80,7 @@ func (o *Model4xxResponse) GetError() string { // GetErrorOk returns a tuple with the Error field value // and a boolean to check if the value has been set. -func (o *Model4xxResponse) GetErrorOk() (*string, bool) { +func (o *Model403Response) GetErrorOk() (*string, bool) { if o == nil { return nil, false } @@ -88,12 +88,12 @@ func (o *Model4xxResponse) GetErrorOk() (*string, bool) { } // SetError sets field value -func (o *Model4xxResponse) SetError(v string) { +func (o *Model403Response) SetError(v string) { o.Error = v } // GetMessage returns the Message field value -func (o *Model4xxResponse) GetMessage() string { +func (o *Model403Response) GetMessage() string { if o == nil { var ret string return ret @@ -104,7 +104,7 @@ func (o *Model4xxResponse) GetMessage() string { // GetMessageOk returns a tuple with the Message field value // and a boolean to check if the value has been set. -func (o *Model4xxResponse) GetMessageOk() (*string, bool) { +func (o *Model403Response) GetMessageOk() (*string, bool) { if o == nil { return nil, false } @@ -112,11 +112,11 @@ func (o *Model4xxResponse) GetMessageOk() (*string, bool) { } // SetMessage sets field value -func (o *Model4xxResponse) SetMessage(v string) { +func (o *Model403Response) SetMessage(v string) { o.Message = v } -func (o Model4xxResponse) MarshalJSON() ([]byte, error) { +func (o Model403Response) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { return []byte{}, err @@ -124,7 +124,7 @@ func (o Model4xxResponse) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -func (o Model4xxResponse) ToMap() (map[string]interface{}, error) { +func (o Model403Response) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["statusCode"] = o.StatusCode toSerialize["error"] = o.Error @@ -132,38 +132,38 @@ func (o Model4xxResponse) ToMap() (map[string]interface{}, error) { return toSerialize, nil } -type NullableModel4xxResponse struct { - value *Model4xxResponse +type NullableModel403Response struct { + value *Model403Response isSet bool } -func (v NullableModel4xxResponse) Get() *Model4xxResponse { +func (v NullableModel403Response) Get() *Model403Response { return v.value } -func (v *NullableModel4xxResponse) Set(val *Model4xxResponse) { +func (v *NullableModel403Response) Set(val *Model403Response) { v.value = val v.isSet = true } -func (v NullableModel4xxResponse) IsSet() bool { +func (v NullableModel403Response) IsSet() bool { return v.isSet } -func (v *NullableModel4xxResponse) Unset() { +func (v *NullableModel403Response) Unset() { v.value = nil v.isSet = false } -func NewNullableModel4xxResponse(val *Model4xxResponse) *NullableModel4xxResponse { - return &NullableModel4xxResponse{value: val, isSet: true} +func NewNullableModel403Response(val *Model403Response) *NullableModel403Response { + return &NullableModel403Response{value: val, isSet: true} } -func (v NullableModel4xxResponse) MarshalJSON() ([]byte, error) { +func (v NullableModel403Response) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableModel4xxResponse) UnmarshalJSON(src []byte) error { +func (v *NullableModel403Response) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } diff --git a/generated/slo/model_404_response.go b/generated/slo/model_404_response.go new file mode 100644 index 000000000..a52e5d6e3 --- /dev/null +++ b/generated/slo/model_404_response.go @@ -0,0 +1,169 @@ +/* +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 Model404Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Model404Response{} + +// Model404Response struct for Model404Response +type Model404Response struct { + StatusCode float64 `json:"statusCode"` + Error string `json:"error"` + Message string `json:"message"` +} + +// NewModel404Response instantiates a new Model404Response 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 NewModel404Response(statusCode float64, error_ string, message string) *Model404Response { + this := Model404Response{} + this.StatusCode = statusCode + this.Error = error_ + this.Message = message + return &this +} + +// NewModel404ResponseWithDefaults instantiates a new Model404Response 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 NewModel404ResponseWithDefaults() *Model404Response { + this := Model404Response{} + return &this +} + +// GetStatusCode returns the StatusCode field value +func (o *Model404Response) GetStatusCode() float64 { + if o == nil { + var ret float64 + return ret + } + + return o.StatusCode +} + +// GetStatusCodeOk returns a tuple with the StatusCode field value +// and a boolean to check if the value has been set. +func (o *Model404Response) GetStatusCodeOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.StatusCode, true +} + +// SetStatusCode sets field value +func (o *Model404Response) SetStatusCode(v float64) { + o.StatusCode = v +} + +// GetError returns the Error field value +func (o *Model404Response) GetError() string { + if o == nil { + var ret string + return ret + } + + return o.Error +} + +// GetErrorOk returns a tuple with the Error field value +// and a boolean to check if the value has been set. +func (o *Model404Response) GetErrorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Error, true +} + +// SetError sets field value +func (o *Model404Response) SetError(v string) { + o.Error = v +} + +// GetMessage returns the Message field value +func (o *Model404Response) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *Model404Response) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *Model404Response) SetMessage(v string) { + o.Message = v +} + +func (o Model404Response) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Model404Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["statusCode"] = o.StatusCode + toSerialize["error"] = o.Error + toSerialize["message"] = o.Message + return toSerialize, nil +} + +type NullableModel404Response struct { + value *Model404Response + isSet bool +} + +func (v NullableModel404Response) Get() *Model404Response { + return v.value +} + +func (v *NullableModel404Response) Set(val *Model404Response) { + v.value = val + v.isSet = true +} + +func (v NullableModel404Response) IsSet() bool { + return v.isSet +} + +func (v *NullableModel404Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModel404Response(val *Model404Response) *NullableModel404Response { + return &NullableModel404Response{value: val, isSet: true} +} + +func (v NullableModel404Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModel404Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_409_response.go b/generated/slo/model_409_response.go new file mode 100644 index 000000000..8d3405b68 --- /dev/null +++ b/generated/slo/model_409_response.go @@ -0,0 +1,169 @@ +/* +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 Model409Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Model409Response{} + +// Model409Response struct for Model409Response +type Model409Response struct { + StatusCode float64 `json:"statusCode"` + Error string `json:"error"` + Message string `json:"message"` +} + +// NewModel409Response instantiates a new Model409Response 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 NewModel409Response(statusCode float64, error_ string, message string) *Model409Response { + this := Model409Response{} + this.StatusCode = statusCode + this.Error = error_ + this.Message = message + return &this +} + +// NewModel409ResponseWithDefaults instantiates a new Model409Response 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 NewModel409ResponseWithDefaults() *Model409Response { + this := Model409Response{} + return &this +} + +// GetStatusCode returns the StatusCode field value +func (o *Model409Response) GetStatusCode() float64 { + if o == nil { + var ret float64 + return ret + } + + return o.StatusCode +} + +// GetStatusCodeOk returns a tuple with the StatusCode field value +// and a boolean to check if the value has been set. +func (o *Model409Response) GetStatusCodeOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.StatusCode, true +} + +// SetStatusCode sets field value +func (o *Model409Response) SetStatusCode(v float64) { + o.StatusCode = v +} + +// GetError returns the Error field value +func (o *Model409Response) GetError() string { + if o == nil { + var ret string + return ret + } + + return o.Error +} + +// GetErrorOk returns a tuple with the Error field value +// and a boolean to check if the value has been set. +func (o *Model409Response) GetErrorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Error, true +} + +// SetError sets field value +func (o *Model409Response) SetError(v string) { + o.Error = v +} + +// GetMessage returns the Message field value +func (o *Model409Response) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *Model409Response) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *Model409Response) SetMessage(v string) { + o.Message = v +} + +func (o Model409Response) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Model409Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["statusCode"] = o.StatusCode + toSerialize["error"] = o.Error + toSerialize["message"] = o.Message + return toSerialize, nil +} + +type NullableModel409Response struct { + value *Model409Response + isSet bool +} + +func (v NullableModel409Response) Get() *Model409Response { + return v.value +} + +func (v *NullableModel409Response) Set(val *Model409Response) { + v.value = val + v.isSet = true +} + +func (v NullableModel409Response) IsSet() bool { + return v.isSet +} + +func (v *NullableModel409Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModel409Response(val *Model409Response) *NullableModel409Response { + return &NullableModel409Response{value: val, isSet: true} +} + +func (v NullableModel409Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModel409Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_budgeting_method.go b/generated/slo/model_budgeting_method.go index 551f07bdd..b22d09e1c 100644 --- a/generated/slo/model_budgeting_method.go +++ b/generated/slo/model_budgeting_method.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,7 +15,7 @@ import ( "fmt" ) -// BudgetingMethod The budgeting method to use +// BudgetingMethod The budgeting method to use when computing the rollup data. type BudgetingMethod string // List of budgeting_method diff --git a/generated/slo/model_create_slo_request.go b/generated/slo/model_create_slo_request.go index 27cbf7b14..9b14cb3fa 100644 --- a/generated/slo/model_create_slo_request.go +++ b/generated/slo/model_create_slo_request.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,22 +19,26 @@ var _ MappedNullable = &CreateSloRequest{} // CreateSloRequest The create SLO API request body varies depending on the type of indicator, time window and budgeting method. type CreateSloRequest struct { + // A optional and unique identifier for the SLO. Must be between 8 and 36 chars + Id *string `json:"id,omitempty"` // A name for the SLO. Name string `json:"name"` // A description for the SLO. - Description string `json:"description"` - Indicator SloResponseIndicator `json:"indicator"` - TimeWindow SloResponseTimeWindow `json:"timeWindow"` - BudgetingMethod BudgetingMethod `json:"budgetingMethod"` - Objective Objective `json:"objective"` - Settings *Settings `json:"settings,omitempty"` + Description string `json:"description"` + Indicator CreateSloRequestIndicator `json:"indicator"` + TimeWindow TimeWindow `json:"timeWindow"` + BudgetingMethod BudgetingMethod `json:"budgetingMethod"` + Objective Objective `json:"objective"` + Settings *Settings `json:"settings,omitempty"` + // optional group by field to use to generate an SLO per distinct value + GroupBy *string `json:"groupBy,omitempty"` } // NewCreateSloRequest instantiates a new CreateSloRequest 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 NewCreateSloRequest(name string, description string, indicator SloResponseIndicator, timeWindow SloResponseTimeWindow, budgetingMethod BudgetingMethod, objective Objective) *CreateSloRequest { +func NewCreateSloRequest(name string, description string, indicator CreateSloRequestIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective) *CreateSloRequest { this := CreateSloRequest{} this.Name = name this.Description = description @@ -53,6 +57,38 @@ func NewCreateSloRequestWithDefaults() *CreateSloRequest { return &this } +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateSloRequest) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSloRequest) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreateSloRequest) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateSloRequest) SetId(v string) { + o.Id = &v +} + // GetName returns the Name field value func (o *CreateSloRequest) GetName() string { if o == nil { @@ -102,9 +138,9 @@ func (o *CreateSloRequest) SetDescription(v string) { } // GetIndicator returns the Indicator field value -func (o *CreateSloRequest) GetIndicator() SloResponseIndicator { +func (o *CreateSloRequest) GetIndicator() CreateSloRequestIndicator { if o == nil { - var ret SloResponseIndicator + var ret CreateSloRequestIndicator return ret } @@ -113,7 +149,7 @@ func (o *CreateSloRequest) GetIndicator() SloResponseIndicator { // GetIndicatorOk returns a tuple with the Indicator field value // and a boolean to check if the value has been set. -func (o *CreateSloRequest) GetIndicatorOk() (*SloResponseIndicator, bool) { +func (o *CreateSloRequest) GetIndicatorOk() (*CreateSloRequestIndicator, bool) { if o == nil { return nil, false } @@ -121,14 +157,14 @@ func (o *CreateSloRequest) GetIndicatorOk() (*SloResponseIndicator, bool) { } // SetIndicator sets field value -func (o *CreateSloRequest) SetIndicator(v SloResponseIndicator) { +func (o *CreateSloRequest) SetIndicator(v CreateSloRequestIndicator) { o.Indicator = v } // GetTimeWindow returns the TimeWindow field value -func (o *CreateSloRequest) GetTimeWindow() SloResponseTimeWindow { +func (o *CreateSloRequest) GetTimeWindow() TimeWindow { if o == nil { - var ret SloResponseTimeWindow + var ret TimeWindow return ret } @@ -137,7 +173,7 @@ func (o *CreateSloRequest) GetTimeWindow() SloResponseTimeWindow { // GetTimeWindowOk returns a tuple with the TimeWindow field value // and a boolean to check if the value has been set. -func (o *CreateSloRequest) GetTimeWindowOk() (*SloResponseTimeWindow, bool) { +func (o *CreateSloRequest) GetTimeWindowOk() (*TimeWindow, bool) { if o == nil { return nil, false } @@ -145,7 +181,7 @@ func (o *CreateSloRequest) GetTimeWindowOk() (*SloResponseTimeWindow, bool) { } // SetTimeWindow sets field value -func (o *CreateSloRequest) SetTimeWindow(v SloResponseTimeWindow) { +func (o *CreateSloRequest) SetTimeWindow(v TimeWindow) { o.TimeWindow = v } @@ -229,6 +265,38 @@ func (o *CreateSloRequest) SetSettings(v Settings) { o.Settings = &v } +// GetGroupBy returns the GroupBy field value if set, zero value otherwise. +func (o *CreateSloRequest) GetGroupBy() string { + if o == nil || IsNil(o.GroupBy) { + var ret string + return ret + } + return *o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSloRequest) GetGroupByOk() (*string, bool) { + if o == nil || IsNil(o.GroupBy) { + return nil, false + } + return o.GroupBy, true +} + +// HasGroupBy returns a boolean if a field has been set. +func (o *CreateSloRequest) HasGroupBy() bool { + if o != nil && !IsNil(o.GroupBy) { + return true + } + + return false +} + +// SetGroupBy gets a reference to the given string and assigns it to the GroupBy field. +func (o *CreateSloRequest) SetGroupBy(v string) { + o.GroupBy = &v +} + func (o CreateSloRequest) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -239,6 +307,9 @@ func (o CreateSloRequest) MarshalJSON() ([]byte, error) { func (o CreateSloRequest) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } toSerialize["name"] = o.Name toSerialize["description"] = o.Description toSerialize["indicator"] = o.Indicator @@ -248,6 +319,9 @@ func (o CreateSloRequest) ToMap() (map[string]interface{}, error) { if !IsNil(o.Settings) { toSerialize["settings"] = o.Settings } + if !IsNil(o.GroupBy) { + toSerialize["groupBy"] = o.GroupBy + } return toSerialize, nil } diff --git a/generated/slo/model_create_slo_request_indicator.go b/generated/slo/model_create_slo_request_indicator.go new file mode 100644 index 000000000..1ad246ded --- /dev/null +++ b/generated/slo/model_create_slo_request_indicator.go @@ -0,0 +1,235 @@ +/* +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" +) + +// CreateSloRequestIndicator - struct for CreateSloRequestIndicator +type CreateSloRequestIndicator struct { + IndicatorPropertiesApmAvailability *IndicatorPropertiesApmAvailability + IndicatorPropertiesApmLatency *IndicatorPropertiesApmLatency + IndicatorPropertiesCustomKql *IndicatorPropertiesCustomKql + IndicatorPropertiesCustomMetric *IndicatorPropertiesCustomMetric + IndicatorPropertiesHistogram *IndicatorPropertiesHistogram +} + +// IndicatorPropertiesApmAvailabilityAsCreateSloRequestIndicator is a convenience function that returns IndicatorPropertiesApmAvailability wrapped in CreateSloRequestIndicator +func IndicatorPropertiesApmAvailabilityAsCreateSloRequestIndicator(v *IndicatorPropertiesApmAvailability) CreateSloRequestIndicator { + return CreateSloRequestIndicator{ + IndicatorPropertiesApmAvailability: v, + } +} + +// IndicatorPropertiesApmLatencyAsCreateSloRequestIndicator is a convenience function that returns IndicatorPropertiesApmLatency wrapped in CreateSloRequestIndicator +func IndicatorPropertiesApmLatencyAsCreateSloRequestIndicator(v *IndicatorPropertiesApmLatency) CreateSloRequestIndicator { + return CreateSloRequestIndicator{ + IndicatorPropertiesApmLatency: v, + } +} + +// IndicatorPropertiesCustomKqlAsCreateSloRequestIndicator is a convenience function that returns IndicatorPropertiesCustomKql wrapped in CreateSloRequestIndicator +func IndicatorPropertiesCustomKqlAsCreateSloRequestIndicator(v *IndicatorPropertiesCustomKql) CreateSloRequestIndicator { + return CreateSloRequestIndicator{ + IndicatorPropertiesCustomKql: v, + } +} + +// IndicatorPropertiesCustomMetricAsCreateSloRequestIndicator is a convenience function that returns IndicatorPropertiesCustomMetric wrapped in CreateSloRequestIndicator +func IndicatorPropertiesCustomMetricAsCreateSloRequestIndicator(v *IndicatorPropertiesCustomMetric) CreateSloRequestIndicator { + return CreateSloRequestIndicator{ + IndicatorPropertiesCustomMetric: v, + } +} + +// IndicatorPropertiesHistogramAsCreateSloRequestIndicator is a convenience function that returns IndicatorPropertiesHistogram wrapped in CreateSloRequestIndicator +func IndicatorPropertiesHistogramAsCreateSloRequestIndicator(v *IndicatorPropertiesHistogram) CreateSloRequestIndicator { + return CreateSloRequestIndicator{ + IndicatorPropertiesHistogram: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateSloRequestIndicator) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into IndicatorPropertiesApmAvailability + err = json.Unmarshal(data, &dst.IndicatorPropertiesApmAvailability) + if err == nil { + jsonIndicatorPropertiesApmAvailability, _ := json.Marshal(dst.IndicatorPropertiesApmAvailability) + if string(jsonIndicatorPropertiesApmAvailability) == "{}" { // empty struct + dst.IndicatorPropertiesApmAvailability = nil + } else { + match++ + } + } else { + dst.IndicatorPropertiesApmAvailability = nil + } + + // try to unmarshal data into IndicatorPropertiesApmLatency + err = json.Unmarshal(data, &dst.IndicatorPropertiesApmLatency) + if err == nil { + jsonIndicatorPropertiesApmLatency, _ := json.Marshal(dst.IndicatorPropertiesApmLatency) + if string(jsonIndicatorPropertiesApmLatency) == "{}" { // empty struct + dst.IndicatorPropertiesApmLatency = nil + } else { + match++ + } + } else { + dst.IndicatorPropertiesApmLatency = nil + } + + // try to unmarshal data into IndicatorPropertiesCustomKql + err = json.Unmarshal(data, &dst.IndicatorPropertiesCustomKql) + if err == nil { + jsonIndicatorPropertiesCustomKql, _ := json.Marshal(dst.IndicatorPropertiesCustomKql) + if string(jsonIndicatorPropertiesCustomKql) == "{}" { // empty struct + dst.IndicatorPropertiesCustomKql = nil + } else { + match++ + } + } else { + dst.IndicatorPropertiesCustomKql = nil + } + + // try to unmarshal data into IndicatorPropertiesCustomMetric + err = json.Unmarshal(data, &dst.IndicatorPropertiesCustomMetric) + if err == nil { + jsonIndicatorPropertiesCustomMetric, _ := json.Marshal(dst.IndicatorPropertiesCustomMetric) + if string(jsonIndicatorPropertiesCustomMetric) == "{}" { // empty struct + dst.IndicatorPropertiesCustomMetric = nil + } else { + match++ + } + } else { + dst.IndicatorPropertiesCustomMetric = nil + } + + // try to unmarshal data into IndicatorPropertiesHistogram + err = json.Unmarshal(data, &dst.IndicatorPropertiesHistogram) + if err == nil { + jsonIndicatorPropertiesHistogram, _ := json.Marshal(dst.IndicatorPropertiesHistogram) + if string(jsonIndicatorPropertiesHistogram) == "{}" { // empty struct + dst.IndicatorPropertiesHistogram = nil + } else { + match++ + } + } else { + dst.IndicatorPropertiesHistogram = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.IndicatorPropertiesApmAvailability = nil + dst.IndicatorPropertiesApmLatency = nil + dst.IndicatorPropertiesCustomKql = nil + dst.IndicatorPropertiesCustomMetric = nil + dst.IndicatorPropertiesHistogram = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateSloRequestIndicator)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateSloRequestIndicator)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateSloRequestIndicator) MarshalJSON() ([]byte, error) { + if src.IndicatorPropertiesApmAvailability != nil { + return json.Marshal(&src.IndicatorPropertiesApmAvailability) + } + + if src.IndicatorPropertiesApmLatency != nil { + return json.Marshal(&src.IndicatorPropertiesApmLatency) + } + + if src.IndicatorPropertiesCustomKql != nil { + return json.Marshal(&src.IndicatorPropertiesCustomKql) + } + + if src.IndicatorPropertiesCustomMetric != nil { + return json.Marshal(&src.IndicatorPropertiesCustomMetric) + } + + if src.IndicatorPropertiesHistogram != nil { + return json.Marshal(&src.IndicatorPropertiesHistogram) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *CreateSloRequestIndicator) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.IndicatorPropertiesApmAvailability != nil { + return obj.IndicatorPropertiesApmAvailability + } + + if obj.IndicatorPropertiesApmLatency != nil { + return obj.IndicatorPropertiesApmLatency + } + + if obj.IndicatorPropertiesCustomKql != nil { + return obj.IndicatorPropertiesCustomKql + } + + if obj.IndicatorPropertiesCustomMetric != nil { + return obj.IndicatorPropertiesCustomMetric + } + + if obj.IndicatorPropertiesHistogram != nil { + return obj.IndicatorPropertiesHistogram + } + + // all schemas are nil + return nil +} + +type NullableCreateSloRequestIndicator struct { + value *CreateSloRequestIndicator + isSet bool +} + +func (v NullableCreateSloRequestIndicator) Get() *CreateSloRequestIndicator { + return v.value +} + +func (v *NullableCreateSloRequestIndicator) Set(val *CreateSloRequestIndicator) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSloRequestIndicator) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSloRequestIndicator) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSloRequestIndicator(val *CreateSloRequestIndicator) *NullableCreateSloRequestIndicator { + return &NullableCreateSloRequestIndicator{value: val, isSet: true} +} + +func (v NullableCreateSloRequestIndicator) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSloRequestIndicator) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_create_slo_response.go b/generated/slo/model_create_slo_response.go index 76f71ad71..53d6c95db 100644 --- a/generated/slo/model_create_slo_response.go +++ b/generated/slo/model_create_slo_response.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/slo/model_error_budget.go b/generated/slo/model_error_budget.go index 95cb72628..d7d8e6b6d 100644 --- a/generated/slo/model_error_budget.go +++ b/generated/slo/model_error_budget.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -20,21 +20,25 @@ var _ MappedNullable = &ErrorBudget{} // ErrorBudget struct for ErrorBudget type ErrorBudget struct { // The initial error budget, as 1 - objective - Initial *float32 `json:"initial,omitempty"` + Initial float64 `json:"initial"` // The error budget consummed, as a percentage of the initial value. - Consumed *float32 `json:"consumed,omitempty"` + Consumed float64 `json:"consumed"` // The error budget remaining, as a percentage of the initial value. - Remaining *float32 `json:"remaining,omitempty"` + Remaining float64 `json:"remaining"` // Only for SLO defined with occurrences budgeting method and calendar aligned time window. - IsEstimated *bool `json:"isEstimated,omitempty"` + IsEstimated bool `json:"isEstimated"` } // NewErrorBudget instantiates a new ErrorBudget 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 NewErrorBudget() *ErrorBudget { +func NewErrorBudget(initial float64, consumed float64, remaining float64, isEstimated bool) *ErrorBudget { this := ErrorBudget{} + this.Initial = initial + this.Consumed = consumed + this.Remaining = remaining + this.IsEstimated = isEstimated return &this } @@ -46,132 +50,100 @@ func NewErrorBudgetWithDefaults() *ErrorBudget { return &this } -// GetInitial returns the Initial field value if set, zero value otherwise. -func (o *ErrorBudget) GetInitial() float32 { - if o == nil || IsNil(o.Initial) { - var ret float32 +// GetInitial returns the Initial field value +func (o *ErrorBudget) GetInitial() float64 { + if o == nil { + var ret float64 return ret } - return *o.Initial + + return o.Initial } -// GetInitialOk returns a tuple with the Initial field value if set, nil otherwise +// GetInitialOk returns a tuple with the Initial field value // and a boolean to check if the value has been set. -func (o *ErrorBudget) GetInitialOk() (*float32, bool) { - if o == nil || IsNil(o.Initial) { +func (o *ErrorBudget) GetInitialOk() (*float64, bool) { + if o == nil { return nil, false } - return o.Initial, true -} - -// HasInitial returns a boolean if a field has been set. -func (o *ErrorBudget) HasInitial() bool { - if o != nil && !IsNil(o.Initial) { - return true - } - - return false + return &o.Initial, true } -// SetInitial gets a reference to the given float32 and assigns it to the Initial field. -func (o *ErrorBudget) SetInitial(v float32) { - o.Initial = &v +// SetInitial sets field value +func (o *ErrorBudget) SetInitial(v float64) { + o.Initial = v } -// GetConsumed returns the Consumed field value if set, zero value otherwise. -func (o *ErrorBudget) GetConsumed() float32 { - if o == nil || IsNil(o.Consumed) { - var ret float32 +// GetConsumed returns the Consumed field value +func (o *ErrorBudget) GetConsumed() float64 { + if o == nil { + var ret float64 return ret } - return *o.Consumed + + return o.Consumed } -// GetConsumedOk returns a tuple with the Consumed field value if set, nil otherwise +// GetConsumedOk returns a tuple with the Consumed field value // and a boolean to check if the value has been set. -func (o *ErrorBudget) GetConsumedOk() (*float32, bool) { - if o == nil || IsNil(o.Consumed) { +func (o *ErrorBudget) GetConsumedOk() (*float64, bool) { + if o == nil { return nil, false } - return o.Consumed, true + return &o.Consumed, true } -// HasConsumed returns a boolean if a field has been set. -func (o *ErrorBudget) HasConsumed() bool { - if o != nil && !IsNil(o.Consumed) { - return true - } - - return false -} - -// SetConsumed gets a reference to the given float32 and assigns it to the Consumed field. -func (o *ErrorBudget) SetConsumed(v float32) { - o.Consumed = &v +// SetConsumed sets field value +func (o *ErrorBudget) SetConsumed(v float64) { + o.Consumed = v } -// GetRemaining returns the Remaining field value if set, zero value otherwise. -func (o *ErrorBudget) GetRemaining() float32 { - if o == nil || IsNil(o.Remaining) { - var ret float32 +// GetRemaining returns the Remaining field value +func (o *ErrorBudget) GetRemaining() float64 { + if o == nil { + var ret float64 return ret } - return *o.Remaining + + return o.Remaining } -// GetRemainingOk returns a tuple with the Remaining field value if set, nil otherwise +// GetRemainingOk returns a tuple with the Remaining field value // and a boolean to check if the value has been set. -func (o *ErrorBudget) GetRemainingOk() (*float32, bool) { - if o == nil || IsNil(o.Remaining) { +func (o *ErrorBudget) GetRemainingOk() (*float64, bool) { + if o == nil { return nil, false } - return o.Remaining, true -} - -// HasRemaining returns a boolean if a field has been set. -func (o *ErrorBudget) HasRemaining() bool { - if o != nil && !IsNil(o.Remaining) { - return true - } - - return false + return &o.Remaining, true } -// SetRemaining gets a reference to the given float32 and assigns it to the Remaining field. -func (o *ErrorBudget) SetRemaining(v float32) { - o.Remaining = &v +// SetRemaining sets field value +func (o *ErrorBudget) SetRemaining(v float64) { + o.Remaining = v } -// GetIsEstimated returns the IsEstimated field value if set, zero value otherwise. +// GetIsEstimated returns the IsEstimated field value func (o *ErrorBudget) GetIsEstimated() bool { - if o == nil || IsNil(o.IsEstimated) { + if o == nil { var ret bool return ret } - return *o.IsEstimated + + return o.IsEstimated } -// GetIsEstimatedOk returns a tuple with the IsEstimated field value if set, nil otherwise +// GetIsEstimatedOk returns a tuple with the IsEstimated field value // and a boolean to check if the value has been set. func (o *ErrorBudget) GetIsEstimatedOk() (*bool, bool) { - if o == nil || IsNil(o.IsEstimated) { + if o == nil { return nil, false } - return o.IsEstimated, true -} - -// HasIsEstimated returns a boolean if a field has been set. -func (o *ErrorBudget) HasIsEstimated() bool { - if o != nil && !IsNil(o.IsEstimated) { - return true - } - - return false + return &o.IsEstimated, true } -// SetIsEstimated gets a reference to the given bool and assigns it to the IsEstimated field. +// SetIsEstimated sets field value func (o *ErrorBudget) SetIsEstimated(v bool) { - o.IsEstimated = &v + o.IsEstimated = v } func (o ErrorBudget) MarshalJSON() ([]byte, error) { @@ -184,18 +156,10 @@ func (o ErrorBudget) MarshalJSON() ([]byte, error) { func (o ErrorBudget) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Initial) { - toSerialize["initial"] = o.Initial - } - if !IsNil(o.Consumed) { - toSerialize["consumed"] = o.Consumed - } - if !IsNil(o.Remaining) { - toSerialize["remaining"] = o.Remaining - } - if !IsNil(o.IsEstimated) { - toSerialize["isEstimated"] = o.IsEstimated - } + toSerialize["initial"] = o.Initial + toSerialize["consumed"] = o.Consumed + toSerialize["remaining"] = o.Remaining + toSerialize["isEstimated"] = o.IsEstimated return toSerialize, nil } diff --git a/generated/slo/model_find_slo_response.go b/generated/slo/model_find_slo_response.go index 536e053a6..fe90673e2 100644 --- a/generated/slo/model_find_slo_response.go +++ b/generated/slo/model_find_slo_response.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,9 +19,9 @@ var _ MappedNullable = &FindSloResponse{} // FindSloResponse A paginated response of SLOs matching the query. type FindSloResponse struct { - Page *float32 `json:"page,omitempty"` - PerPage *float32 `json:"perPage,omitempty"` - Total *float32 `json:"total,omitempty"` + Page *float64 `json:"page,omitempty"` + PerPage *float64 `json:"perPage,omitempty"` + Total *float64 `json:"total,omitempty"` Results []SloResponse `json:"results,omitempty"` } @@ -43,9 +43,9 @@ func NewFindSloResponseWithDefaults() *FindSloResponse { } // GetPage returns the Page field value if set, zero value otherwise. -func (o *FindSloResponse) GetPage() float32 { +func (o *FindSloResponse) GetPage() float64 { if o == nil || IsNil(o.Page) { - var ret float32 + var ret float64 return ret } return *o.Page @@ -53,7 +53,7 @@ func (o *FindSloResponse) GetPage() float32 { // GetPageOk returns a tuple with the Page field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *FindSloResponse) GetPageOk() (*float32, bool) { +func (o *FindSloResponse) GetPageOk() (*float64, bool) { if o == nil || IsNil(o.Page) { return nil, false } @@ -69,15 +69,15 @@ func (o *FindSloResponse) HasPage() bool { return false } -// SetPage gets a reference to the given float32 and assigns it to the Page field. -func (o *FindSloResponse) SetPage(v float32) { +// SetPage gets a reference to the given float64 and assigns it to the Page field. +func (o *FindSloResponse) SetPage(v float64) { o.Page = &v } // GetPerPage returns the PerPage field value if set, zero value otherwise. -func (o *FindSloResponse) GetPerPage() float32 { +func (o *FindSloResponse) GetPerPage() float64 { if o == nil || IsNil(o.PerPage) { - var ret float32 + var ret float64 return ret } return *o.PerPage @@ -85,7 +85,7 @@ func (o *FindSloResponse) GetPerPage() float32 { // GetPerPageOk returns a tuple with the PerPage field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *FindSloResponse) GetPerPageOk() (*float32, bool) { +func (o *FindSloResponse) GetPerPageOk() (*float64, bool) { if o == nil || IsNil(o.PerPage) { return nil, false } @@ -101,15 +101,15 @@ func (o *FindSloResponse) HasPerPage() bool { return false } -// SetPerPage gets a reference to the given float32 and assigns it to the PerPage field. -func (o *FindSloResponse) SetPerPage(v float32) { +// SetPerPage gets a reference to the given float64 and assigns it to the PerPage field. +func (o *FindSloResponse) SetPerPage(v float64) { o.PerPage = &v } // GetTotal returns the Total field value if set, zero value otherwise. -func (o *FindSloResponse) GetTotal() float32 { +func (o *FindSloResponse) GetTotal() float64 { if o == nil || IsNil(o.Total) { - var ret float32 + var ret float64 return ret } return *o.Total @@ -117,7 +117,7 @@ func (o *FindSloResponse) GetTotal() float32 { // GetTotalOk returns a tuple with the Total field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *FindSloResponse) GetTotalOk() (*float32, bool) { +func (o *FindSloResponse) GetTotalOk() (*float64, bool) { if o == nil || IsNil(o.Total) { return nil, false } @@ -133,8 +133,8 @@ func (o *FindSloResponse) HasTotal() bool { return false } -// SetTotal gets a reference to the given float32 and assigns it to the Total field. -func (o *FindSloResponse) SetTotal(v float32) { +// SetTotal gets a reference to the given float64 and assigns it to the Total field. +func (o *FindSloResponse) SetTotal(v float64) { o.Total = &v } diff --git a/generated/slo/model_historical_summary_request.go b/generated/slo/model_historical_summary_request.go index 4a59055cf..6d522dc18 100644 --- a/generated/slo/model_historical_summary_request.go +++ b/generated/slo/model_historical_summary_request.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/slo/model_historical_summary_response_inner.go b/generated/slo/model_historical_summary_response_inner.go index 5e3b93cbc..6a87116d2 100644 --- a/generated/slo/model_historical_summary_response_inner.go +++ b/generated/slo/model_historical_summary_response_inner.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,10 +19,10 @@ var _ MappedNullable = &HistoricalSummaryResponseInner{} // HistoricalSummaryResponseInner struct for HistoricalSummaryResponseInner type HistoricalSummaryResponseInner struct { - Date *string `json:"date,omitempty"` - Status *string `json:"status,omitempty"` - SliValue *float32 `json:"sliValue,omitempty"` - ErrorBudget *ErrorBudget `json:"errorBudget,omitempty"` + Date *string `json:"date,omitempty"` + Status *SummaryStatus `json:"status,omitempty"` + SliValue *float64 `json:"sliValue,omitempty"` + ErrorBudget *ErrorBudget `json:"errorBudget,omitempty"` } // NewHistoricalSummaryResponseInner instantiates a new HistoricalSummaryResponseInner object @@ -75,9 +75,9 @@ func (o *HistoricalSummaryResponseInner) SetDate(v string) { } // GetStatus returns the Status field value if set, zero value otherwise. -func (o *HistoricalSummaryResponseInner) GetStatus() string { +func (o *HistoricalSummaryResponseInner) GetStatus() SummaryStatus { if o == nil || IsNil(o.Status) { - var ret string + var ret SummaryStatus return ret } return *o.Status @@ -85,7 +85,7 @@ func (o *HistoricalSummaryResponseInner) GetStatus() string { // GetStatusOk returns a tuple with the Status field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *HistoricalSummaryResponseInner) GetStatusOk() (*string, bool) { +func (o *HistoricalSummaryResponseInner) GetStatusOk() (*SummaryStatus, bool) { if o == nil || IsNil(o.Status) { return nil, false } @@ -101,15 +101,15 @@ func (o *HistoricalSummaryResponseInner) HasStatus() bool { return false } -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *HistoricalSummaryResponseInner) SetStatus(v string) { +// SetStatus gets a reference to the given SummaryStatus and assigns it to the Status field. +func (o *HistoricalSummaryResponseInner) SetStatus(v SummaryStatus) { o.Status = &v } // GetSliValue returns the SliValue field value if set, zero value otherwise. -func (o *HistoricalSummaryResponseInner) GetSliValue() float32 { +func (o *HistoricalSummaryResponseInner) GetSliValue() float64 { if o == nil || IsNil(o.SliValue) { - var ret float32 + var ret float64 return ret } return *o.SliValue @@ -117,7 +117,7 @@ func (o *HistoricalSummaryResponseInner) GetSliValue() float32 { // GetSliValueOk returns a tuple with the SliValue field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *HistoricalSummaryResponseInner) GetSliValueOk() (*float32, bool) { +func (o *HistoricalSummaryResponseInner) GetSliValueOk() (*float64, bool) { if o == nil || IsNil(o.SliValue) { return nil, false } @@ -133,8 +133,8 @@ func (o *HistoricalSummaryResponseInner) HasSliValue() bool { return false } -// SetSliValue gets a reference to the given float32 and assigns it to the SliValue field. -func (o *HistoricalSummaryResponseInner) SetSliValue(v float32) { +// SetSliValue gets a reference to the given float64 and assigns it to the SliValue field. +func (o *HistoricalSummaryResponseInner) SetSliValue(v float64) { o.SliValue = &v } diff --git a/generated/slo/model_indicator_properties_apm_availability.go b/generated/slo/model_indicator_properties_apm_availability.go index c7a82757b..a449183cc 100644 --- a/generated/slo/model_indicator_properties_apm_availability.go +++ b/generated/slo/model_indicator_properties_apm_availability.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/slo/model_indicator_properties_apm_availability_params.go b/generated/slo/model_indicator_properties_apm_availability_params.go index c32808a46..5872135c1 100644 --- a/generated/slo/model_indicator_properties_apm_availability_params.go +++ b/generated/slo/model_indicator_properties_apm_availability_params.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -27,8 +27,6 @@ type IndicatorPropertiesApmAvailabilityParams struct { TransactionType string `json:"transactionType"` // The APM transaction name or \"*\" TransactionName string `json:"transactionName"` - // The status codes considered as good events. Default to 2xx, 3xx and 4xx - GoodStatusCodes []string `json:"goodStatusCodes,omitempty"` // KQL query used for filtering the data Filter *string `json:"filter,omitempty"` // The index used by APM metrics @@ -153,38 +151,6 @@ func (o *IndicatorPropertiesApmAvailabilityParams) SetTransactionName(v string) o.TransactionName = v } -// GetGoodStatusCodes returns the GoodStatusCodes field value if set, zero value otherwise. -func (o *IndicatorPropertiesApmAvailabilityParams) GetGoodStatusCodes() []string { - if o == nil || IsNil(o.GoodStatusCodes) { - var ret []string - return ret - } - return o.GoodStatusCodes -} - -// GetGoodStatusCodesOk returns a tuple with the GoodStatusCodes field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IndicatorPropertiesApmAvailabilityParams) GetGoodStatusCodesOk() ([]string, bool) { - if o == nil || IsNil(o.GoodStatusCodes) { - return nil, false - } - return o.GoodStatusCodes, true -} - -// HasGoodStatusCodes returns a boolean if a field has been set. -func (o *IndicatorPropertiesApmAvailabilityParams) HasGoodStatusCodes() bool { - if o != nil && !IsNil(o.GoodStatusCodes) { - return true - } - - return false -} - -// SetGoodStatusCodes gets a reference to the given []string and assigns it to the GoodStatusCodes field. -func (o *IndicatorPropertiesApmAvailabilityParams) SetGoodStatusCodes(v []string) { - o.GoodStatusCodes = v -} - // GetFilter returns the Filter field value if set, zero value otherwise. func (o *IndicatorPropertiesApmAvailabilityParams) GetFilter() string { if o == nil || IsNil(o.Filter) { @@ -255,9 +221,6 @@ func (o IndicatorPropertiesApmAvailabilityParams) ToMap() (map[string]interface{ toSerialize["environment"] = o.Environment toSerialize["transactionType"] = o.TransactionType toSerialize["transactionName"] = o.TransactionName - if !IsNil(o.GoodStatusCodes) { - toSerialize["goodStatusCodes"] = o.GoodStatusCodes - } if !IsNil(o.Filter) { toSerialize["filter"] = o.Filter } diff --git a/generated/slo/model_indicator_properties_apm_latency.go b/generated/slo/model_indicator_properties_apm_latency.go index 1a31981d9..5876d056a 100644 --- a/generated/slo/model_indicator_properties_apm_latency.go +++ b/generated/slo/model_indicator_properties_apm_latency.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/slo/model_indicator_properties_apm_latency_params.go b/generated/slo/model_indicator_properties_apm_latency_params.go index d36eb19b7..74c484f39 100644 --- a/generated/slo/model_indicator_properties_apm_latency_params.go +++ b/generated/slo/model_indicator_properties_apm_latency_params.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -31,19 +31,22 @@ type IndicatorPropertiesApmLatencyParams struct { Filter *string `json:"filter,omitempty"` // The index used by APM metrics Index string `json:"index"` + // The latency threshold in milliseconds + Threshold float64 `json:"threshold"` } // NewIndicatorPropertiesApmLatencyParams instantiates a new IndicatorPropertiesApmLatencyParams 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 NewIndicatorPropertiesApmLatencyParams(service string, environment string, transactionType string, transactionName string, index string) *IndicatorPropertiesApmLatencyParams { +func NewIndicatorPropertiesApmLatencyParams(service string, environment string, transactionType string, transactionName string, index string, threshold float64) *IndicatorPropertiesApmLatencyParams { this := IndicatorPropertiesApmLatencyParams{} this.Service = service this.Environment = environment this.TransactionType = transactionType this.TransactionName = transactionName this.Index = index + this.Threshold = threshold return &this } @@ -207,6 +210,30 @@ func (o *IndicatorPropertiesApmLatencyParams) SetIndex(v string) { o.Index = v } +// GetThreshold returns the Threshold field value +func (o *IndicatorPropertiesApmLatencyParams) 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 *IndicatorPropertiesApmLatencyParams) GetThresholdOk() (*float64, bool) { + if o == nil { + return nil, false + } + return &o.Threshold, true +} + +// SetThreshold sets field value +func (o *IndicatorPropertiesApmLatencyParams) SetThreshold(v float64) { + o.Threshold = v +} + func (o IndicatorPropertiesApmLatencyParams) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { @@ -225,6 +252,7 @@ func (o IndicatorPropertiesApmLatencyParams) ToMap() (map[string]interface{}, er toSerialize["filter"] = o.Filter } toSerialize["index"] = o.Index + toSerialize["threshold"] = o.Threshold return toSerialize, nil } diff --git a/generated/slo/model_indicator_properties_custom_kql.go b/generated/slo/model_indicator_properties_custom_kql.go index ba957e8be..657856d3f 100644 --- a/generated/slo/model_indicator_properties_custom_kql.go +++ b/generated/slo/model_indicator_properties_custom_kql.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/slo/model_indicator_properties_custom_kql_params.go b/generated/slo/model_indicator_properties_custom_kql_params.go index 207f7a8a9..6ca493a4c 100644 --- a/generated/slo/model_indicator_properties_custom_kql_params.go +++ b/generated/slo/model_indicator_properties_custom_kql_params.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -27,7 +27,7 @@ type IndicatorPropertiesCustomKqlParams struct { Good *string `json:"good,omitempty"` // the KQL query used to define all events. Total *string `json:"total,omitempty"` - // The timestamp field used in the source indice. If not specified, @timestamp will be used. + // The timestamp field used in the source indice. TimestampField string `json:"timestampField"` } diff --git a/generated/slo/model_indicator_properties_custom_metric.go b/generated/slo/model_indicator_properties_custom_metric.go new file mode 100644 index 000000000..80b194643 --- /dev/null +++ b/generated/slo/model_indicator_properties_custom_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 IndicatorPropertiesCustomMetric type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesCustomMetric{} + +// IndicatorPropertiesCustomMetric Defines properties for a custom metric indicator type +type IndicatorPropertiesCustomMetric struct { + Params IndicatorPropertiesCustomMetricParams `json:"params"` + // The type of indicator. + Type string `json:"type"` +} + +// NewIndicatorPropertiesCustomMetric instantiates a new IndicatorPropertiesCustomMetric 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 NewIndicatorPropertiesCustomMetric(params IndicatorPropertiesCustomMetricParams, type_ string) *IndicatorPropertiesCustomMetric { + this := IndicatorPropertiesCustomMetric{} + this.Params = params + this.Type = type_ + return &this +} + +// NewIndicatorPropertiesCustomMetricWithDefaults instantiates a new IndicatorPropertiesCustomMetric 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 NewIndicatorPropertiesCustomMetricWithDefaults() *IndicatorPropertiesCustomMetric { + this := IndicatorPropertiesCustomMetric{} + return &this +} + +// GetParams returns the Params field value +func (o *IndicatorPropertiesCustomMetric) GetParams() IndicatorPropertiesCustomMetricParams { + if o == nil { + var ret IndicatorPropertiesCustomMetricParams + 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 *IndicatorPropertiesCustomMetric) GetParamsOk() (*IndicatorPropertiesCustomMetricParams, bool) { + if o == nil { + return nil, false + } + return &o.Params, true +} + +// SetParams sets field value +func (o *IndicatorPropertiesCustomMetric) SetParams(v IndicatorPropertiesCustomMetricParams) { + o.Params = v +} + +// GetType returns the Type field value +func (o *IndicatorPropertiesCustomMetric) 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 *IndicatorPropertiesCustomMetric) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *IndicatorPropertiesCustomMetric) SetType(v string) { + o.Type = v +} + +func (o IndicatorPropertiesCustomMetric) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesCustomMetric) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["params"] = o.Params + toSerialize["type"] = o.Type + return toSerialize, nil +} + +type NullableIndicatorPropertiesCustomMetric struct { + value *IndicatorPropertiesCustomMetric + isSet bool +} + +func (v NullableIndicatorPropertiesCustomMetric) Get() *IndicatorPropertiesCustomMetric { + return v.value +} + +func (v *NullableIndicatorPropertiesCustomMetric) Set(val *IndicatorPropertiesCustomMetric) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesCustomMetric) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesCustomMetric) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesCustomMetric(val *IndicatorPropertiesCustomMetric) *NullableIndicatorPropertiesCustomMetric { + return &NullableIndicatorPropertiesCustomMetric{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesCustomMetric) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesCustomMetric) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_indicator_properties_custom_metric_params.go b/generated/slo/model_indicator_properties_custom_metric_params.go new file mode 100644 index 000000000..df4355a28 --- /dev/null +++ b/generated/slo/model_indicator_properties_custom_metric_params.go @@ -0,0 +1,226 @@ +/* +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 IndicatorPropertiesCustomMetricParams type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesCustomMetricParams{} + +// IndicatorPropertiesCustomMetricParams An object containing the indicator parameters. +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"` + // The timestamp field used in the source indice. + TimestampField string `json:"timestampField"` + Good IndicatorPropertiesCustomMetricParamsGood `json:"good"` + Total IndicatorPropertiesCustomMetricParamsTotal `json:"total"` +} + +// NewIndicatorPropertiesCustomMetricParams instantiates a new IndicatorPropertiesCustomMetricParams 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 NewIndicatorPropertiesCustomMetricParams(index string, filter 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 + return &this +} + +// NewIndicatorPropertiesCustomMetricParamsWithDefaults instantiates a new IndicatorPropertiesCustomMetricParams 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 NewIndicatorPropertiesCustomMetricParamsWithDefaults() *IndicatorPropertiesCustomMetricParams { + this := IndicatorPropertiesCustomMetricParams{} + return &this +} + +// GetIndex returns the Index field value +func (o *IndicatorPropertiesCustomMetricParams) 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 *IndicatorPropertiesCustomMetricParams) GetIndexOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Index, true +} + +// SetIndex sets field value +func (o *IndicatorPropertiesCustomMetricParams) SetIndex(v string) { + o.Index = v +} + +// GetFilter returns the Filter field value +func (o *IndicatorPropertiesCustomMetricParams) GetFilter() string { + if o == nil { + var ret string + return ret + } + + return o.Filter +} + +// GetFilterOk returns a tuple with the Filter field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesCustomMetricParams) GetFilterOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Filter, true +} + +// SetFilter sets field value +func (o *IndicatorPropertiesCustomMetricParams) SetFilter(v string) { + o.Filter = v +} + +// GetTimestampField returns the TimestampField field value +func (o *IndicatorPropertiesCustomMetricParams) 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 *IndicatorPropertiesCustomMetricParams) GetTimestampFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TimestampField, true +} + +// SetTimestampField sets field value +func (o *IndicatorPropertiesCustomMetricParams) SetTimestampField(v string) { + o.TimestampField = v +} + +// GetGood returns the Good field value +func (o *IndicatorPropertiesCustomMetricParams) GetGood() IndicatorPropertiesCustomMetricParamsGood { + if o == nil { + var ret IndicatorPropertiesCustomMetricParamsGood + return ret + } + + return o.Good +} + +// GetGoodOk returns a tuple with the Good field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesCustomMetricParams) GetGoodOk() (*IndicatorPropertiesCustomMetricParamsGood, bool) { + if o == nil { + return nil, false + } + return &o.Good, true +} + +// SetGood sets field value +func (o *IndicatorPropertiesCustomMetricParams) SetGood(v IndicatorPropertiesCustomMetricParamsGood) { + o.Good = v +} + +// GetTotal returns the Total field value +func (o *IndicatorPropertiesCustomMetricParams) GetTotal() IndicatorPropertiesCustomMetricParamsTotal { + if o == nil { + var ret IndicatorPropertiesCustomMetricParamsTotal + return ret + } + + return o.Total +} + +// GetTotalOk returns a tuple with the Total field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesCustomMetricParams) GetTotalOk() (*IndicatorPropertiesCustomMetricParamsTotal, bool) { + if o == nil { + return nil, false + } + return &o.Total, true +} + +// SetTotal sets field value +func (o *IndicatorPropertiesCustomMetricParams) SetTotal(v IndicatorPropertiesCustomMetricParamsTotal) { + o.Total = v +} + +func (o IndicatorPropertiesCustomMetricParams) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesCustomMetricParams) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["index"] = o.Index + toSerialize["filter"] = o.Filter + toSerialize["timestampField"] = o.TimestampField + toSerialize["good"] = o.Good + toSerialize["total"] = o.Total + return toSerialize, nil +} + +type NullableIndicatorPropertiesCustomMetricParams struct { + value *IndicatorPropertiesCustomMetricParams + isSet bool +} + +func (v NullableIndicatorPropertiesCustomMetricParams) Get() *IndicatorPropertiesCustomMetricParams { + return v.value +} + +func (v *NullableIndicatorPropertiesCustomMetricParams) Set(val *IndicatorPropertiesCustomMetricParams) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesCustomMetricParams) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesCustomMetricParams) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesCustomMetricParams(val *IndicatorPropertiesCustomMetricParams) *NullableIndicatorPropertiesCustomMetricParams { + return &NullableIndicatorPropertiesCustomMetricParams{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesCustomMetricParams) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesCustomMetricParams) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_indicator_properties_custom_metric_params_good.go b/generated/slo/model_indicator_properties_custom_metric_params_good.go new file mode 100644 index 000000000..ada18b405 --- /dev/null +++ b/generated/slo/model_indicator_properties_custom_metric_params_good.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 IndicatorPropertiesCustomMetricParamsGood type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesCustomMetricParamsGood{} + +// IndicatorPropertiesCustomMetricParamsGood An object defining the \"good\" metrics and equation +type IndicatorPropertiesCustomMetricParamsGood struct { + // List of metrics with their name, aggregation type, and field. + Metrics []IndicatorPropertiesCustomMetricParamsGoodMetricsInner `json:"metrics"` + // The equation to calculate the \"good\" metric. + Equation string `json:"equation"` +} + +// NewIndicatorPropertiesCustomMetricParamsGood instantiates a new IndicatorPropertiesCustomMetricParamsGood 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 NewIndicatorPropertiesCustomMetricParamsGood(metrics []IndicatorPropertiesCustomMetricParamsGoodMetricsInner, equation string) *IndicatorPropertiesCustomMetricParamsGood { + this := IndicatorPropertiesCustomMetricParamsGood{} + this.Metrics = metrics + this.Equation = equation + return &this +} + +// NewIndicatorPropertiesCustomMetricParamsGoodWithDefaults instantiates a new IndicatorPropertiesCustomMetricParamsGood 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 NewIndicatorPropertiesCustomMetricParamsGoodWithDefaults() *IndicatorPropertiesCustomMetricParamsGood { + this := IndicatorPropertiesCustomMetricParamsGood{} + return &this +} + +// GetMetrics returns the Metrics field value +func (o *IndicatorPropertiesCustomMetricParamsGood) GetMetrics() []IndicatorPropertiesCustomMetricParamsGoodMetricsInner { + if o == nil { + var ret []IndicatorPropertiesCustomMetricParamsGoodMetricsInner + 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 *IndicatorPropertiesCustomMetricParamsGood) GetMetricsOk() ([]IndicatorPropertiesCustomMetricParamsGoodMetricsInner, bool) { + if o == nil { + return nil, false + } + return o.Metrics, true +} + +// SetMetrics sets field value +func (o *IndicatorPropertiesCustomMetricParamsGood) SetMetrics(v []IndicatorPropertiesCustomMetricParamsGoodMetricsInner) { + o.Metrics = v +} + +// GetEquation returns the Equation field value +func (o *IndicatorPropertiesCustomMetricParamsGood) 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 *IndicatorPropertiesCustomMetricParamsGood) GetEquationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Equation, true +} + +// SetEquation sets field value +func (o *IndicatorPropertiesCustomMetricParamsGood) SetEquation(v string) { + o.Equation = v +} + +func (o IndicatorPropertiesCustomMetricParamsGood) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesCustomMetricParamsGood) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["metrics"] = o.Metrics + toSerialize["equation"] = o.Equation + return toSerialize, nil +} + +type NullableIndicatorPropertiesCustomMetricParamsGood struct { + value *IndicatorPropertiesCustomMetricParamsGood + isSet bool +} + +func (v NullableIndicatorPropertiesCustomMetricParamsGood) Get() *IndicatorPropertiesCustomMetricParamsGood { + return v.value +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsGood) Set(val *IndicatorPropertiesCustomMetricParamsGood) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesCustomMetricParamsGood) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsGood) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesCustomMetricParamsGood(val *IndicatorPropertiesCustomMetricParamsGood) *NullableIndicatorPropertiesCustomMetricParamsGood { + return &NullableIndicatorPropertiesCustomMetricParamsGood{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesCustomMetricParamsGood) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsGood) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_indicator_properties_custom_metric_params_good_metrics_inner.go b/generated/slo/model_indicator_properties_custom_metric_params_good_metrics_inner.go new file mode 100644 index 000000000..59c91d2fb --- /dev/null +++ b/generated/slo/model_indicator_properties_custom_metric_params_good_metrics_inner.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 IndicatorPropertiesCustomMetricParamsGoodMetricsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesCustomMetricParamsGoodMetricsInner{} + +// IndicatorPropertiesCustomMetricParamsGoodMetricsInner struct for IndicatorPropertiesCustomMetricParamsGoodMetricsInner +type IndicatorPropertiesCustomMetricParamsGoodMetricsInner 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 \"sum\" + 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"` +} + +// NewIndicatorPropertiesCustomMetricParamsGoodMetricsInner instantiates a new IndicatorPropertiesCustomMetricParamsGoodMetricsInner 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 NewIndicatorPropertiesCustomMetricParamsGoodMetricsInner(name string, aggregation string, field string) *IndicatorPropertiesCustomMetricParamsGoodMetricsInner { + this := IndicatorPropertiesCustomMetricParamsGoodMetricsInner{} + this.Name = name + this.Aggregation = aggregation + this.Field = field + return &this +} + +// NewIndicatorPropertiesCustomMetricParamsGoodMetricsInnerWithDefaults instantiates a new IndicatorPropertiesCustomMetricParamsGoodMetricsInner 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 NewIndicatorPropertiesCustomMetricParamsGoodMetricsInnerWithDefaults() *IndicatorPropertiesCustomMetricParamsGoodMetricsInner { + this := IndicatorPropertiesCustomMetricParamsGoodMetricsInner{} + return &this +} + +// GetName returns the Name field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) SetName(v string) { + o.Name = v +} + +// GetAggregation returns the Aggregation field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) GetAggregationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) SetAggregation(v string) { + o.Aggregation = v +} + +// GetField returns the Field field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) GetFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Field, true +} + +// SetField sets field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) SetField(v string) { + o.Field = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) SetFilter(v string) { + o.Filter = &v +} + +func (o IndicatorPropertiesCustomMetricParamsGoodMetricsInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesCustomMetricParamsGoodMetricsInner) 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 NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInner struct { + value *IndicatorPropertiesCustomMetricParamsGoodMetricsInner + isSet bool +} + +func (v NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInner) Get() *IndicatorPropertiesCustomMetricParamsGoodMetricsInner { + return v.value +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInner) Set(val *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInner) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesCustomMetricParamsGoodMetricsInner(val *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) *NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInner { + return &NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInner{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_indicator_properties_custom_metric_params_total.go b/generated/slo/model_indicator_properties_custom_metric_params_total.go new file mode 100644 index 000000000..58d6d255b --- /dev/null +++ b/generated/slo/model_indicator_properties_custom_metric_params_total.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 IndicatorPropertiesCustomMetricParamsTotal type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesCustomMetricParamsTotal{} + +// IndicatorPropertiesCustomMetricParamsTotal An object defining the \"total\" metrics and equation +type IndicatorPropertiesCustomMetricParamsTotal struct { + // List of metrics with their name, aggregation type, and field. + Metrics []IndicatorPropertiesCustomMetricParamsTotalMetricsInner `json:"metrics"` + // The equation to calculate the \"total\" metric. + Equation string `json:"equation"` +} + +// NewIndicatorPropertiesCustomMetricParamsTotal instantiates a new IndicatorPropertiesCustomMetricParamsTotal 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 NewIndicatorPropertiesCustomMetricParamsTotal(metrics []IndicatorPropertiesCustomMetricParamsTotalMetricsInner, equation string) *IndicatorPropertiesCustomMetricParamsTotal { + this := IndicatorPropertiesCustomMetricParamsTotal{} + this.Metrics = metrics + this.Equation = equation + return &this +} + +// NewIndicatorPropertiesCustomMetricParamsTotalWithDefaults instantiates a new IndicatorPropertiesCustomMetricParamsTotal 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 NewIndicatorPropertiesCustomMetricParamsTotalWithDefaults() *IndicatorPropertiesCustomMetricParamsTotal { + this := IndicatorPropertiesCustomMetricParamsTotal{} + return &this +} + +// GetMetrics returns the Metrics field value +func (o *IndicatorPropertiesCustomMetricParamsTotal) GetMetrics() []IndicatorPropertiesCustomMetricParamsTotalMetricsInner { + if o == nil { + var ret []IndicatorPropertiesCustomMetricParamsTotalMetricsInner + 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 *IndicatorPropertiesCustomMetricParamsTotal) GetMetricsOk() ([]IndicatorPropertiesCustomMetricParamsTotalMetricsInner, bool) { + if o == nil { + return nil, false + } + return o.Metrics, true +} + +// SetMetrics sets field value +func (o *IndicatorPropertiesCustomMetricParamsTotal) SetMetrics(v []IndicatorPropertiesCustomMetricParamsTotalMetricsInner) { + o.Metrics = v +} + +// GetEquation returns the Equation field value +func (o *IndicatorPropertiesCustomMetricParamsTotal) 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 *IndicatorPropertiesCustomMetricParamsTotal) GetEquationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Equation, true +} + +// SetEquation sets field value +func (o *IndicatorPropertiesCustomMetricParamsTotal) SetEquation(v string) { + o.Equation = v +} + +func (o IndicatorPropertiesCustomMetricParamsTotal) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesCustomMetricParamsTotal) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["metrics"] = o.Metrics + toSerialize["equation"] = o.Equation + return toSerialize, nil +} + +type NullableIndicatorPropertiesCustomMetricParamsTotal struct { + value *IndicatorPropertiesCustomMetricParamsTotal + isSet bool +} + +func (v NullableIndicatorPropertiesCustomMetricParamsTotal) Get() *IndicatorPropertiesCustomMetricParamsTotal { + return v.value +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsTotal) Set(val *IndicatorPropertiesCustomMetricParamsTotal) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesCustomMetricParamsTotal) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsTotal) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesCustomMetricParamsTotal(val *IndicatorPropertiesCustomMetricParamsTotal) *NullableIndicatorPropertiesCustomMetricParamsTotal { + return &NullableIndicatorPropertiesCustomMetricParamsTotal{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesCustomMetricParamsTotal) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsTotal) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_indicator_properties_custom_metric_params_total_metrics_inner.go b/generated/slo/model_indicator_properties_custom_metric_params_total_metrics_inner.go new file mode 100644 index 000000000..59a0aa676 --- /dev/null +++ b/generated/slo/model_indicator_properties_custom_metric_params_total_metrics_inner.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 IndicatorPropertiesCustomMetricParamsTotalMetricsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesCustomMetricParamsTotalMetricsInner{} + +// IndicatorPropertiesCustomMetricParamsTotalMetricsInner struct for IndicatorPropertiesCustomMetricParamsTotalMetricsInner +type IndicatorPropertiesCustomMetricParamsTotalMetricsInner 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 \"sum\" + 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"` +} + +// NewIndicatorPropertiesCustomMetricParamsTotalMetricsInner instantiates a new IndicatorPropertiesCustomMetricParamsTotalMetricsInner 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 NewIndicatorPropertiesCustomMetricParamsTotalMetricsInner(name string, aggregation string, field string) *IndicatorPropertiesCustomMetricParamsTotalMetricsInner { + this := IndicatorPropertiesCustomMetricParamsTotalMetricsInner{} + this.Name = name + this.Aggregation = aggregation + this.Field = field + return &this +} + +// NewIndicatorPropertiesCustomMetricParamsTotalMetricsInnerWithDefaults instantiates a new IndicatorPropertiesCustomMetricParamsTotalMetricsInner 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 NewIndicatorPropertiesCustomMetricParamsTotalMetricsInnerWithDefaults() *IndicatorPropertiesCustomMetricParamsTotalMetricsInner { + this := IndicatorPropertiesCustomMetricParamsTotalMetricsInner{} + return &this +} + +// GetName returns the Name field value +func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) SetName(v string) { + o.Name = v +} + +// GetAggregation returns the Aggregation field value +func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) GetAggregationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value +func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) SetAggregation(v string) { + o.Aggregation = v +} + +// GetField returns the Field field value +func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) GetFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Field, true +} + +// SetField sets field value +func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) SetField(v string) { + o.Field = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) 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 *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) SetFilter(v string) { + o.Filter = &v +} + +func (o IndicatorPropertiesCustomMetricParamsTotalMetricsInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesCustomMetricParamsTotalMetricsInner) 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 NullableIndicatorPropertiesCustomMetricParamsTotalMetricsInner struct { + value *IndicatorPropertiesCustomMetricParamsTotalMetricsInner + isSet bool +} + +func (v NullableIndicatorPropertiesCustomMetricParamsTotalMetricsInner) Get() *IndicatorPropertiesCustomMetricParamsTotalMetricsInner { + return v.value +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsTotalMetricsInner) Set(val *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesCustomMetricParamsTotalMetricsInner) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsTotalMetricsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesCustomMetricParamsTotalMetricsInner(val *IndicatorPropertiesCustomMetricParamsTotalMetricsInner) *NullableIndicatorPropertiesCustomMetricParamsTotalMetricsInner { + return &NullableIndicatorPropertiesCustomMetricParamsTotalMetricsInner{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesCustomMetricParamsTotalMetricsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsTotalMetricsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_indicator_properties_histogram.go b/generated/slo/model_indicator_properties_histogram.go new file mode 100644 index 000000000..1ac522fc6 --- /dev/null +++ b/generated/slo/model_indicator_properties_histogram.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 IndicatorPropertiesHistogram type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesHistogram{} + +// IndicatorPropertiesHistogram Defines properties for a histogram indicator type +type IndicatorPropertiesHistogram struct { + Params IndicatorPropertiesHistogramParams `json:"params"` + // The type of indicator. + Type string `json:"type"` +} + +// NewIndicatorPropertiesHistogram instantiates a new IndicatorPropertiesHistogram 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 NewIndicatorPropertiesHistogram(params IndicatorPropertiesHistogramParams, type_ string) *IndicatorPropertiesHistogram { + this := IndicatorPropertiesHistogram{} + this.Params = params + this.Type = type_ + return &this +} + +// NewIndicatorPropertiesHistogramWithDefaults instantiates a new IndicatorPropertiesHistogram 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 NewIndicatorPropertiesHistogramWithDefaults() *IndicatorPropertiesHistogram { + this := IndicatorPropertiesHistogram{} + return &this +} + +// GetParams returns the Params field value +func (o *IndicatorPropertiesHistogram) GetParams() IndicatorPropertiesHistogramParams { + if o == nil { + var ret IndicatorPropertiesHistogramParams + 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 *IndicatorPropertiesHistogram) GetParamsOk() (*IndicatorPropertiesHistogramParams, bool) { + if o == nil { + return nil, false + } + return &o.Params, true +} + +// SetParams sets field value +func (o *IndicatorPropertiesHistogram) SetParams(v IndicatorPropertiesHistogramParams) { + o.Params = v +} + +// GetType returns the Type field value +func (o *IndicatorPropertiesHistogram) 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 *IndicatorPropertiesHistogram) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *IndicatorPropertiesHistogram) SetType(v string) { + o.Type = v +} + +func (o IndicatorPropertiesHistogram) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesHistogram) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["params"] = o.Params + toSerialize["type"] = o.Type + return toSerialize, nil +} + +type NullableIndicatorPropertiesHistogram struct { + value *IndicatorPropertiesHistogram + isSet bool +} + +func (v NullableIndicatorPropertiesHistogram) Get() *IndicatorPropertiesHistogram { + return v.value +} + +func (v *NullableIndicatorPropertiesHistogram) Set(val *IndicatorPropertiesHistogram) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesHistogram) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesHistogram) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesHistogram(val *IndicatorPropertiesHistogram) *NullableIndicatorPropertiesHistogram { + return &NullableIndicatorPropertiesHistogram{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesHistogram) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesHistogram) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_indicator_properties_histogram_params.go b/generated/slo/model_indicator_properties_histogram_params.go new file mode 100644 index 000000000..5d9348681 --- /dev/null +++ b/generated/slo/model_indicator_properties_histogram_params.go @@ -0,0 +1,235 @@ +/* +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 IndicatorPropertiesHistogramParams type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesHistogramParams{} + +// IndicatorPropertiesHistogramParams An object containing the indicator parameters. +type IndicatorPropertiesHistogramParams 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"` + Good IndicatorPropertiesHistogramParamsGood `json:"good"` + Total IndicatorPropertiesHistogramParamsTotal `json:"total"` +} + +// NewIndicatorPropertiesHistogramParams instantiates a new IndicatorPropertiesHistogramParams 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 NewIndicatorPropertiesHistogramParams(index string, timestampField string, good IndicatorPropertiesHistogramParamsGood, total IndicatorPropertiesHistogramParamsTotal) *IndicatorPropertiesHistogramParams { + this := IndicatorPropertiesHistogramParams{} + this.Index = index + this.TimestampField = timestampField + this.Good = good + this.Total = total + return &this +} + +// NewIndicatorPropertiesHistogramParamsWithDefaults instantiates a new IndicatorPropertiesHistogramParams 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 NewIndicatorPropertiesHistogramParamsWithDefaults() *IndicatorPropertiesHistogramParams { + this := IndicatorPropertiesHistogramParams{} + return &this +} + +// GetIndex returns the Index field value +func (o *IndicatorPropertiesHistogramParams) 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 *IndicatorPropertiesHistogramParams) GetIndexOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Index, true +} + +// SetIndex sets field value +func (o *IndicatorPropertiesHistogramParams) SetIndex(v string) { + o.Index = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *IndicatorPropertiesHistogramParams) 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 *IndicatorPropertiesHistogramParams) 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 *IndicatorPropertiesHistogramParams) 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 *IndicatorPropertiesHistogramParams) SetFilter(v string) { + o.Filter = &v +} + +// GetTimestampField returns the TimestampField field value +func (o *IndicatorPropertiesHistogramParams) 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 *IndicatorPropertiesHistogramParams) GetTimestampFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TimestampField, true +} + +// SetTimestampField sets field value +func (o *IndicatorPropertiesHistogramParams) SetTimestampField(v string) { + o.TimestampField = v +} + +// GetGood returns the Good field value +func (o *IndicatorPropertiesHistogramParams) GetGood() IndicatorPropertiesHistogramParamsGood { + if o == nil { + var ret IndicatorPropertiesHistogramParamsGood + return ret + } + + return o.Good +} + +// GetGoodOk returns a tuple with the Good field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesHistogramParams) GetGoodOk() (*IndicatorPropertiesHistogramParamsGood, bool) { + if o == nil { + return nil, false + } + return &o.Good, true +} + +// SetGood sets field value +func (o *IndicatorPropertiesHistogramParams) SetGood(v IndicatorPropertiesHistogramParamsGood) { + o.Good = v +} + +// GetTotal returns the Total field value +func (o *IndicatorPropertiesHistogramParams) GetTotal() IndicatorPropertiesHistogramParamsTotal { + if o == nil { + var ret IndicatorPropertiesHistogramParamsTotal + return ret + } + + return o.Total +} + +// GetTotalOk returns a tuple with the Total field value +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesHistogramParams) GetTotalOk() (*IndicatorPropertiesHistogramParamsTotal, bool) { + if o == nil { + return nil, false + } + return &o.Total, true +} + +// SetTotal sets field value +func (o *IndicatorPropertiesHistogramParams) SetTotal(v IndicatorPropertiesHistogramParamsTotal) { + o.Total = v +} + +func (o IndicatorPropertiesHistogramParams) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesHistogramParams) 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["good"] = o.Good + toSerialize["total"] = o.Total + return toSerialize, nil +} + +type NullableIndicatorPropertiesHistogramParams struct { + value *IndicatorPropertiesHistogramParams + isSet bool +} + +func (v NullableIndicatorPropertiesHistogramParams) Get() *IndicatorPropertiesHistogramParams { + return v.value +} + +func (v *NullableIndicatorPropertiesHistogramParams) Set(val *IndicatorPropertiesHistogramParams) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesHistogramParams) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesHistogramParams) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesHistogramParams(val *IndicatorPropertiesHistogramParams) *NullableIndicatorPropertiesHistogramParams { + return &NullableIndicatorPropertiesHistogramParams{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesHistogramParams) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesHistogramParams) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_indicator_properties_histogram_params_good.go b/generated/slo/model_indicator_properties_histogram_params_good.go new file mode 100644 index 000000000..2d4f845f6 --- /dev/null +++ b/generated/slo/model_indicator_properties_histogram_params_good.go @@ -0,0 +1,255 @@ +/* +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 IndicatorPropertiesHistogramParamsGood type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesHistogramParamsGood{} + +// IndicatorPropertiesHistogramParamsGood An object defining the \"good\" events +type IndicatorPropertiesHistogramParamsGood struct { + // The field use to aggregate the good events. + Field string `json:"field"` + // The type of aggregation to use. + Aggregation string `json:"aggregation"` + // The filter for good events. + Filter *string `json:"filter,omitempty"` + // The starting value of the range. Only required for \"range\" aggregations. + From *float64 `json:"from,omitempty"` + // The ending value of the range. Only required for \"range\" aggregations. + To *float64 `json:"to,omitempty"` +} + +// NewIndicatorPropertiesHistogramParamsGood instantiates a new IndicatorPropertiesHistogramParamsGood 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 NewIndicatorPropertiesHistogramParamsGood(field string, aggregation string) *IndicatorPropertiesHistogramParamsGood { + this := IndicatorPropertiesHistogramParamsGood{} + this.Field = field + this.Aggregation = aggregation + return &this +} + +// NewIndicatorPropertiesHistogramParamsGoodWithDefaults instantiates a new IndicatorPropertiesHistogramParamsGood 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 NewIndicatorPropertiesHistogramParamsGoodWithDefaults() *IndicatorPropertiesHistogramParamsGood { + this := IndicatorPropertiesHistogramParamsGood{} + return &this +} + +// GetField returns the Field field value +func (o *IndicatorPropertiesHistogramParamsGood) 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 *IndicatorPropertiesHistogramParamsGood) GetFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Field, true +} + +// SetField sets field value +func (o *IndicatorPropertiesHistogramParamsGood) SetField(v string) { + o.Field = v +} + +// GetAggregation returns the Aggregation field value +func (o *IndicatorPropertiesHistogramParamsGood) 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 *IndicatorPropertiesHistogramParamsGood) GetAggregationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value +func (o *IndicatorPropertiesHistogramParamsGood) SetAggregation(v string) { + o.Aggregation = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *IndicatorPropertiesHistogramParamsGood) 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 *IndicatorPropertiesHistogramParamsGood) 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 *IndicatorPropertiesHistogramParamsGood) 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 *IndicatorPropertiesHistogramParamsGood) SetFilter(v string) { + o.Filter = &v +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *IndicatorPropertiesHistogramParamsGood) GetFrom() float64 { + if o == nil || IsNil(o.From) { + var ret float64 + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesHistogramParamsGood) GetFromOk() (*float64, bool) { + if o == nil || IsNil(o.From) { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *IndicatorPropertiesHistogramParamsGood) HasFrom() bool { + if o != nil && !IsNil(o.From) { + return true + } + + return false +} + +// SetFrom gets a reference to the given float64 and assigns it to the From field. +func (o *IndicatorPropertiesHistogramParamsGood) SetFrom(v float64) { + o.From = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *IndicatorPropertiesHistogramParamsGood) GetTo() float64 { + if o == nil || IsNil(o.To) { + var ret float64 + return ret + } + return *o.To +} + +// GetToOk returns a tuple with the To field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesHistogramParamsGood) GetToOk() (*float64, bool) { + if o == nil || IsNil(o.To) { + return nil, false + } + return o.To, true +} + +// HasTo returns a boolean if a field has been set. +func (o *IndicatorPropertiesHistogramParamsGood) HasTo() bool { + if o != nil && !IsNil(o.To) { + return true + } + + return false +} + +// SetTo gets a reference to the given float64 and assigns it to the To field. +func (o *IndicatorPropertiesHistogramParamsGood) SetTo(v float64) { + o.To = &v +} + +func (o IndicatorPropertiesHistogramParamsGood) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesHistogramParamsGood) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["field"] = o.Field + toSerialize["aggregation"] = o.Aggregation + if !IsNil(o.Filter) { + toSerialize["filter"] = o.Filter + } + if !IsNil(o.From) { + toSerialize["from"] = o.From + } + if !IsNil(o.To) { + toSerialize["to"] = o.To + } + return toSerialize, nil +} + +type NullableIndicatorPropertiesHistogramParamsGood struct { + value *IndicatorPropertiesHistogramParamsGood + isSet bool +} + +func (v NullableIndicatorPropertiesHistogramParamsGood) Get() *IndicatorPropertiesHistogramParamsGood { + return v.value +} + +func (v *NullableIndicatorPropertiesHistogramParamsGood) Set(val *IndicatorPropertiesHistogramParamsGood) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesHistogramParamsGood) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesHistogramParamsGood) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesHistogramParamsGood(val *IndicatorPropertiesHistogramParamsGood) *NullableIndicatorPropertiesHistogramParamsGood { + return &NullableIndicatorPropertiesHistogramParamsGood{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesHistogramParamsGood) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesHistogramParamsGood) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_indicator_properties_histogram_params_total.go b/generated/slo/model_indicator_properties_histogram_params_total.go new file mode 100644 index 000000000..7581231f4 --- /dev/null +++ b/generated/slo/model_indicator_properties_histogram_params_total.go @@ -0,0 +1,255 @@ +/* +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 IndicatorPropertiesHistogramParamsTotal type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesHistogramParamsTotal{} + +// IndicatorPropertiesHistogramParamsTotal An object defining the \"total\" events +type IndicatorPropertiesHistogramParamsTotal struct { + // The field use to aggregate the good events. + Field string `json:"field"` + // The type of aggregation to use. + Aggregation string `json:"aggregation"` + // The filter for total events. + Filter *string `json:"filter,omitempty"` + // The starting value of the range. Only required for \"range\" aggregations. + From *float64 `json:"from,omitempty"` + // The ending value of the range. Only required for \"range\" aggregations. + To *float64 `json:"to,omitempty"` +} + +// NewIndicatorPropertiesHistogramParamsTotal instantiates a new IndicatorPropertiesHistogramParamsTotal 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 NewIndicatorPropertiesHistogramParamsTotal(field string, aggregation string) *IndicatorPropertiesHistogramParamsTotal { + this := IndicatorPropertiesHistogramParamsTotal{} + this.Field = field + this.Aggregation = aggregation + return &this +} + +// NewIndicatorPropertiesHistogramParamsTotalWithDefaults instantiates a new IndicatorPropertiesHistogramParamsTotal 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 NewIndicatorPropertiesHistogramParamsTotalWithDefaults() *IndicatorPropertiesHistogramParamsTotal { + this := IndicatorPropertiesHistogramParamsTotal{} + return &this +} + +// GetField returns the Field field value +func (o *IndicatorPropertiesHistogramParamsTotal) 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 *IndicatorPropertiesHistogramParamsTotal) GetFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Field, true +} + +// SetField sets field value +func (o *IndicatorPropertiesHistogramParamsTotal) SetField(v string) { + o.Field = v +} + +// GetAggregation returns the Aggregation field value +func (o *IndicatorPropertiesHistogramParamsTotal) 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 *IndicatorPropertiesHistogramParamsTotal) GetAggregationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value +func (o *IndicatorPropertiesHistogramParamsTotal) SetAggregation(v string) { + o.Aggregation = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *IndicatorPropertiesHistogramParamsTotal) 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 *IndicatorPropertiesHistogramParamsTotal) 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 *IndicatorPropertiesHistogramParamsTotal) 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 *IndicatorPropertiesHistogramParamsTotal) SetFilter(v string) { + o.Filter = &v +} + +// GetFrom returns the From field value if set, zero value otherwise. +func (o *IndicatorPropertiesHistogramParamsTotal) GetFrom() float64 { + if o == nil || IsNil(o.From) { + var ret float64 + return ret + } + return *o.From +} + +// GetFromOk returns a tuple with the From field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesHistogramParamsTotal) GetFromOk() (*float64, bool) { + if o == nil || IsNil(o.From) { + return nil, false + } + return o.From, true +} + +// HasFrom returns a boolean if a field has been set. +func (o *IndicatorPropertiesHistogramParamsTotal) HasFrom() bool { + if o != nil && !IsNil(o.From) { + return true + } + + return false +} + +// SetFrom gets a reference to the given float64 and assigns it to the From field. +func (o *IndicatorPropertiesHistogramParamsTotal) SetFrom(v float64) { + o.From = &v +} + +// GetTo returns the To field value if set, zero value otherwise. +func (o *IndicatorPropertiesHistogramParamsTotal) GetTo() float64 { + if o == nil || IsNil(o.To) { + var ret float64 + return ret + } + return *o.To +} + +// GetToOk returns a tuple with the To field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesHistogramParamsTotal) GetToOk() (*float64, bool) { + if o == nil || IsNil(o.To) { + return nil, false + } + return o.To, true +} + +// HasTo returns a boolean if a field has been set. +func (o *IndicatorPropertiesHistogramParamsTotal) HasTo() bool { + if o != nil && !IsNil(o.To) { + return true + } + + return false +} + +// SetTo gets a reference to the given float64 and assigns it to the To field. +func (o *IndicatorPropertiesHistogramParamsTotal) SetTo(v float64) { + o.To = &v +} + +func (o IndicatorPropertiesHistogramParamsTotal) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesHistogramParamsTotal) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["field"] = o.Field + toSerialize["aggregation"] = o.Aggregation + if !IsNil(o.Filter) { + toSerialize["filter"] = o.Filter + } + if !IsNil(o.From) { + toSerialize["from"] = o.From + } + if !IsNil(o.To) { + toSerialize["to"] = o.To + } + return toSerialize, nil +} + +type NullableIndicatorPropertiesHistogramParamsTotal struct { + value *IndicatorPropertiesHistogramParamsTotal + isSet bool +} + +func (v NullableIndicatorPropertiesHistogramParamsTotal) Get() *IndicatorPropertiesHistogramParamsTotal { + return v.value +} + +func (v *NullableIndicatorPropertiesHistogramParamsTotal) Set(val *IndicatorPropertiesHistogramParamsTotal) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesHistogramParamsTotal) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesHistogramParamsTotal) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesHistogramParamsTotal(val *IndicatorPropertiesHistogramParamsTotal) *NullableIndicatorPropertiesHistogramParamsTotal { + return &NullableIndicatorPropertiesHistogramParamsTotal{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesHistogramParamsTotal) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesHistogramParamsTotal) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_objective.go b/generated/slo/model_objective.go index 3d143ec96..cad95abd2 100644 --- a/generated/slo/model_objective.go +++ b/generated/slo/model_objective.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,21 +17,21 @@ import ( // checks if the Objective type satisfies the MappedNullable interface at compile time var _ MappedNullable = &Objective{} -// Objective Defines properties for objective +// Objective Defines properties for the SLO objective type Objective struct { // the target objective between 0 and 1 excluded - Target float32 `json:"target"` + Target float64 `json:"target"` // the target objective for each slice when using a timeslices budgeting method - TimeslicesTarget *float32 `json:"timeslicesTarget,omitempty"` + TimesliceTarget *float64 `json:"timesliceTarget,omitempty"` // the duration of each slice when using a timeslices budgeting method, as {duraton}{unit} - TimeslicesWindow *string `json:"timeslicesWindow,omitempty"` + TimesliceWindow *string `json:"timesliceWindow,omitempty"` } // NewObjective instantiates a new Objective 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 NewObjective(target float32) *Objective { +func NewObjective(target float64) *Objective { this := Objective{} this.Target = target return &this @@ -46,9 +46,9 @@ func NewObjectiveWithDefaults() *Objective { } // GetTarget returns the Target field value -func (o *Objective) GetTarget() float32 { +func (o *Objective) GetTarget() float64 { if o == nil { - var ret float32 + var ret float64 return ret } @@ -57,7 +57,7 @@ func (o *Objective) GetTarget() float32 { // GetTargetOk returns a tuple with the Target field value // and a boolean to check if the value has been set. -func (o *Objective) GetTargetOk() (*float32, bool) { +func (o *Objective) GetTargetOk() (*float64, bool) { if o == nil { return nil, false } @@ -65,72 +65,72 @@ func (o *Objective) GetTargetOk() (*float32, bool) { } // SetTarget sets field value -func (o *Objective) SetTarget(v float32) { +func (o *Objective) SetTarget(v float64) { o.Target = v } -// GetTimeslicesTarget returns the TimeslicesTarget field value if set, zero value otherwise. -func (o *Objective) GetTimeslicesTarget() float32 { - if o == nil || IsNil(o.TimeslicesTarget) { - var ret float32 +// GetTimesliceTarget returns the TimesliceTarget field value if set, zero value otherwise. +func (o *Objective) GetTimesliceTarget() float64 { + if o == nil || IsNil(o.TimesliceTarget) { + var ret float64 return ret } - return *o.TimeslicesTarget + return *o.TimesliceTarget } -// GetTimeslicesTargetOk returns a tuple with the TimeslicesTarget field value if set, nil otherwise +// GetTimesliceTargetOk returns a tuple with the TimesliceTarget field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *Objective) GetTimeslicesTargetOk() (*float32, bool) { - if o == nil || IsNil(o.TimeslicesTarget) { +func (o *Objective) GetTimesliceTargetOk() (*float64, bool) { + if o == nil || IsNil(o.TimesliceTarget) { return nil, false } - return o.TimeslicesTarget, true + return o.TimesliceTarget, true } -// HasTimeslicesTarget returns a boolean if a field has been set. -func (o *Objective) HasTimeslicesTarget() bool { - if o != nil && !IsNil(o.TimeslicesTarget) { +// HasTimesliceTarget returns a boolean if a field has been set. +func (o *Objective) HasTimesliceTarget() bool { + if o != nil && !IsNil(o.TimesliceTarget) { return true } return false } -// SetTimeslicesTarget gets a reference to the given float32 and assigns it to the TimeslicesTarget field. -func (o *Objective) SetTimeslicesTarget(v float32) { - o.TimeslicesTarget = &v +// SetTimesliceTarget gets a reference to the given float64 and assigns it to the TimesliceTarget field. +func (o *Objective) SetTimesliceTarget(v float64) { + o.TimesliceTarget = &v } -// GetTimeslicesWindow returns the TimeslicesWindow field value if set, zero value otherwise. -func (o *Objective) GetTimeslicesWindow() string { - if o == nil || IsNil(o.TimeslicesWindow) { +// GetTimesliceWindow returns the TimesliceWindow field value if set, zero value otherwise. +func (o *Objective) GetTimesliceWindow() string { + if o == nil || IsNil(o.TimesliceWindow) { var ret string return ret } - return *o.TimeslicesWindow + return *o.TimesliceWindow } -// GetTimeslicesWindowOk returns a tuple with the TimeslicesWindow field value if set, nil otherwise +// GetTimesliceWindowOk returns a tuple with the TimesliceWindow field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *Objective) GetTimeslicesWindowOk() (*string, bool) { - if o == nil || IsNil(o.TimeslicesWindow) { +func (o *Objective) GetTimesliceWindowOk() (*string, bool) { + if o == nil || IsNil(o.TimesliceWindow) { return nil, false } - return o.TimeslicesWindow, true + return o.TimesliceWindow, true } -// HasTimeslicesWindow returns a boolean if a field has been set. -func (o *Objective) HasTimeslicesWindow() bool { - if o != nil && !IsNil(o.TimeslicesWindow) { +// HasTimesliceWindow returns a boolean if a field has been set. +func (o *Objective) HasTimesliceWindow() bool { + if o != nil && !IsNil(o.TimesliceWindow) { return true } return false } -// SetTimeslicesWindow gets a reference to the given string and assigns it to the TimeslicesWindow field. -func (o *Objective) SetTimeslicesWindow(v string) { - o.TimeslicesWindow = &v +// SetTimesliceWindow gets a reference to the given string and assigns it to the TimesliceWindow field. +func (o *Objective) SetTimesliceWindow(v string) { + o.TimesliceWindow = &v } func (o Objective) MarshalJSON() ([]byte, error) { @@ -144,11 +144,11 @@ func (o Objective) MarshalJSON() ([]byte, error) { func (o Objective) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["target"] = o.Target - if !IsNil(o.TimeslicesTarget) { - toSerialize["timeslicesTarget"] = o.TimeslicesTarget + if !IsNil(o.TimesliceTarget) { + toSerialize["timesliceTarget"] = o.TimesliceTarget } - if !IsNil(o.TimeslicesWindow) { - toSerialize["timeslicesWindow"] = o.TimeslicesWindow + if !IsNil(o.TimesliceWindow) { + toSerialize["timesliceWindow"] = o.TimesliceWindow } return toSerialize, nil } diff --git a/generated/slo/model_settings.go b/generated/slo/model_settings.go index 69f701df9..f7cc30ba7 100644 --- a/generated/slo/model_settings.go +++ b/generated/slo/model_settings.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,7 +17,7 @@ import ( // checks if the Settings type satisfies the MappedNullable interface at compile time var _ MappedNullable = &Settings{} -// Settings Defines properties for settings. +// Settings Defines properties for SLO settings. type Settings struct { // The synch delay to apply to the transform. Default 1m SyncDelay *string `json:"syncDelay,omitempty"` diff --git a/generated/slo/model_slo_response.go b/generated/slo/model_slo_response.go index 85c1ee6ef..be4584751 100644 --- a/generated/slo/model_slo_response.go +++ b/generated/slo/model_slo_response.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -20,33 +20,52 @@ var _ MappedNullable = &SloResponse{} // SloResponse struct for SloResponse type SloResponse struct { // The identifier of the SLO. - Id *string `json:"id,omitempty"` + Id string `json:"id"` // The name of the SLO. - Name *string `json:"name,omitempty"` + Name string `json:"name"` // The description of the SLO. - Description *string `json:"description,omitempty"` - Indicator *SloResponseIndicator `json:"indicator,omitempty"` - TimeWindow *SloResponseTimeWindow `json:"timeWindow,omitempty"` - BudgetingMethod *BudgetingMethod `json:"budgetingMethod,omitempty"` - Objective *Objective `json:"objective,omitempty"` - Settings *Settings `json:"settings,omitempty"` + Description string `json:"description"` + Indicator SloResponseIndicator `json:"indicator"` + TimeWindow TimeWindow `json:"timeWindow"` + BudgetingMethod BudgetingMethod `json:"budgetingMethod"` + Objective Objective `json:"objective"` + Settings Settings `json:"settings"` // The SLO revision - Revision *float32 `json:"revision,omitempty"` - Summary *Summary `json:"summary,omitempty"` + Revision float64 `json:"revision"` + Summary Summary `json:"summary"` // Indicate if the SLO is enabled - Enabled *bool `json:"enabled,omitempty"` + Enabled bool `json:"enabled"` + // optional group by field to use to generate an SLO per distinct value + GroupBy string `json:"groupBy"` + // the value derived from the groupBy field, if present, otherwise '*' + InstanceId string `json:"instanceId"` // The creation date - CreatedAt *string `json:"createdAt,omitempty"` + CreatedAt string `json:"createdAt"` // The last update date - UpdatedAt *string `json:"updatedAt,omitempty"` + UpdatedAt string `json:"updatedAt"` } // NewSloResponse instantiates a new SloResponse 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 NewSloResponse() *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, createdAt string, updatedAt string) *SloResponse { this := SloResponse{} + this.Id = id + this.Name = name + this.Description = description + this.Indicator = indicator + this.TimeWindow = timeWindow + this.BudgetingMethod = budgetingMethod + this.Objective = objective + this.Settings = settings + this.Revision = revision + this.Summary = summary + this.Enabled = enabled + this.GroupBy = groupBy + this.InstanceId = instanceId + this.CreatedAt = createdAt + this.UpdatedAt = updatedAt return &this } @@ -58,420 +77,364 @@ func NewSloResponseWithDefaults() *SloResponse { return &this } -// GetId returns the Id field value if set, zero value otherwise. +// GetId returns the Id field value func (o *SloResponse) GetId() string { - if o == nil || IsNil(o.Id) { + if o == nil { var ret string return ret } - return *o.Id + + return o.Id } -// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. func (o *SloResponse) GetIdOk() (*string, bool) { - if o == nil || IsNil(o.Id) { + if o == nil { return nil, false } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *SloResponse) HasId() bool { - if o != nil && !IsNil(o.Id) { - return true - } - - return false + return &o.Id, true } -// SetId gets a reference to the given string and assigns it to the Id field. +// SetId sets field value func (o *SloResponse) SetId(v string) { - o.Id = &v + o.Id = v } -// GetName returns the Name field value if set, zero value otherwise. +// GetName returns the Name field value func (o *SloResponse) GetName() string { - if o == nil || IsNil(o.Name) { + if o == nil { var ret string return ret } - return *o.Name + + return o.Name } -// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. func (o *SloResponse) GetNameOk() (*string, bool) { - if o == nil || IsNil(o.Name) { + if o == nil { return nil, false } - return o.Name, true + return &o.Name, true } -// HasName returns a boolean if a field has been set. -func (o *SloResponse) HasName() bool { - if o != nil && !IsNil(o.Name) { - return true - } - - return false -} - -// SetName gets a reference to the given string and assigns it to the Name field. +// SetName sets field value func (o *SloResponse) SetName(v string) { - o.Name = &v + o.Name = v } -// GetDescription returns the Description field value if set, zero value otherwise. +// GetDescription returns the Description field value func (o *SloResponse) GetDescription() string { - if o == nil || IsNil(o.Description) { + if o == nil { var ret string return ret } - return *o.Description + + return o.Description } -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// GetDescriptionOk returns a tuple with the Description field value // and a boolean to check if the value has been set. func (o *SloResponse) GetDescriptionOk() (*string, bool) { - if o == nil || IsNil(o.Description) { + if o == nil { return nil, false } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *SloResponse) HasDescription() bool { - if o != nil && !IsNil(o.Description) { - return true - } - - return false + return &o.Description, true } -// SetDescription gets a reference to the given string and assigns it to the Description field. +// SetDescription sets field value func (o *SloResponse) SetDescription(v string) { - o.Description = &v + o.Description = v } -// GetIndicator returns the Indicator field value if set, zero value otherwise. +// GetIndicator returns the Indicator field value func (o *SloResponse) GetIndicator() SloResponseIndicator { - if o == nil || IsNil(o.Indicator) { + if o == nil { var ret SloResponseIndicator return ret } - return *o.Indicator + + return o.Indicator } -// GetIndicatorOk returns a tuple with the Indicator field value if set, nil otherwise +// GetIndicatorOk returns a tuple with the Indicator field value // and a boolean to check if the value has been set. func (o *SloResponse) GetIndicatorOk() (*SloResponseIndicator, bool) { - if o == nil || IsNil(o.Indicator) { + if o == nil { return nil, false } - return o.Indicator, true -} - -// HasIndicator returns a boolean if a field has been set. -func (o *SloResponse) HasIndicator() bool { - if o != nil && !IsNil(o.Indicator) { - return true - } - - return false + return &o.Indicator, true } -// SetIndicator gets a reference to the given SloResponseIndicator and assigns it to the Indicator field. +// SetIndicator sets field value func (o *SloResponse) SetIndicator(v SloResponseIndicator) { - o.Indicator = &v + o.Indicator = v } -// GetTimeWindow returns the TimeWindow field value if set, zero value otherwise. -func (o *SloResponse) GetTimeWindow() SloResponseTimeWindow { - if o == nil || IsNil(o.TimeWindow) { - var ret SloResponseTimeWindow +// GetTimeWindow returns the TimeWindow field value +func (o *SloResponse) GetTimeWindow() TimeWindow { + if o == nil { + var ret TimeWindow return ret } - return *o.TimeWindow + + return o.TimeWindow } -// GetTimeWindowOk returns a tuple with the TimeWindow field value if set, nil otherwise +// GetTimeWindowOk returns a tuple with the TimeWindow field value // and a boolean to check if the value has been set. -func (o *SloResponse) GetTimeWindowOk() (*SloResponseTimeWindow, bool) { - if o == nil || IsNil(o.TimeWindow) { +func (o *SloResponse) GetTimeWindowOk() (*TimeWindow, bool) { + if o == nil { return nil, false } - return o.TimeWindow, true + return &o.TimeWindow, true } -// HasTimeWindow returns a boolean if a field has been set. -func (o *SloResponse) HasTimeWindow() bool { - if o != nil && !IsNil(o.TimeWindow) { - return true - } - - return false +// SetTimeWindow sets field value +func (o *SloResponse) SetTimeWindow(v TimeWindow) { + o.TimeWindow = v } -// SetTimeWindow gets a reference to the given SloResponseTimeWindow and assigns it to the TimeWindow field. -func (o *SloResponse) SetTimeWindow(v SloResponseTimeWindow) { - o.TimeWindow = &v -} - -// GetBudgetingMethod returns the BudgetingMethod field value if set, zero value otherwise. +// GetBudgetingMethod returns the BudgetingMethod field value func (o *SloResponse) GetBudgetingMethod() BudgetingMethod { - if o == nil || IsNil(o.BudgetingMethod) { + if o == nil { var ret BudgetingMethod return ret } - return *o.BudgetingMethod + + return o.BudgetingMethod } -// GetBudgetingMethodOk returns a tuple with the BudgetingMethod field value if set, nil otherwise +// GetBudgetingMethodOk returns a tuple with the BudgetingMethod field value // and a boolean to check if the value has been set. func (o *SloResponse) GetBudgetingMethodOk() (*BudgetingMethod, bool) { - if o == nil || IsNil(o.BudgetingMethod) { + if o == nil { return nil, false } - return o.BudgetingMethod, true -} - -// HasBudgetingMethod returns a boolean if a field has been set. -func (o *SloResponse) HasBudgetingMethod() bool { - if o != nil && !IsNil(o.BudgetingMethod) { - return true - } - - return false + return &o.BudgetingMethod, true } -// SetBudgetingMethod gets a reference to the given BudgetingMethod and assigns it to the BudgetingMethod field. +// SetBudgetingMethod sets field value func (o *SloResponse) SetBudgetingMethod(v BudgetingMethod) { - o.BudgetingMethod = &v + o.BudgetingMethod = v } -// GetObjective returns the Objective field value if set, zero value otherwise. +// GetObjective returns the Objective field value func (o *SloResponse) GetObjective() Objective { - if o == nil || IsNil(o.Objective) { + if o == nil { var ret Objective return ret } - return *o.Objective + + return o.Objective } -// GetObjectiveOk returns a tuple with the Objective field value if set, nil otherwise +// GetObjectiveOk returns a tuple with the Objective field value // and a boolean to check if the value has been set. func (o *SloResponse) GetObjectiveOk() (*Objective, bool) { - if o == nil || IsNil(o.Objective) { + if o == nil { return nil, false } - return o.Objective, true -} - -// HasObjective returns a boolean if a field has been set. -func (o *SloResponse) HasObjective() bool { - if o != nil && !IsNil(o.Objective) { - return true - } - - return false + return &o.Objective, true } -// SetObjective gets a reference to the given Objective and assigns it to the Objective field. +// SetObjective sets field value func (o *SloResponse) SetObjective(v Objective) { - o.Objective = &v + o.Objective = v } -// GetSettings returns the Settings field value if set, zero value otherwise. +// GetSettings returns the Settings field value func (o *SloResponse) GetSettings() Settings { - if o == nil || IsNil(o.Settings) { + if o == nil { var ret Settings return ret } - return *o.Settings + + return o.Settings } -// GetSettingsOk returns a tuple with the Settings field value if set, nil otherwise +// GetSettingsOk returns a tuple with the Settings field value // and a boolean to check if the value has been set. func (o *SloResponse) GetSettingsOk() (*Settings, bool) { - if o == nil || IsNil(o.Settings) { + if o == nil { return nil, false } - return o.Settings, true + return &o.Settings, true } -// HasSettings returns a boolean if a field has been set. -func (o *SloResponse) HasSettings() bool { - if o != nil && !IsNil(o.Settings) { - return true - } - - return false -} - -// SetSettings gets a reference to the given Settings and assigns it to the Settings field. +// SetSettings sets field value func (o *SloResponse) SetSettings(v Settings) { - o.Settings = &v + o.Settings = v } -// GetRevision returns the Revision field value if set, zero value otherwise. -func (o *SloResponse) GetRevision() float32 { - if o == nil || IsNil(o.Revision) { - var ret float32 +// GetRevision returns the Revision field value +func (o *SloResponse) GetRevision() float64 { + if o == nil { + var ret float64 return ret } - return *o.Revision + + return o.Revision } -// GetRevisionOk returns a tuple with the Revision field value if set, nil otherwise +// GetRevisionOk returns a tuple with the Revision field value // and a boolean to check if the value has been set. -func (o *SloResponse) GetRevisionOk() (*float32, bool) { - if o == nil || IsNil(o.Revision) { +func (o *SloResponse) GetRevisionOk() (*float64, bool) { + if o == nil { return nil, false } - return o.Revision, true + return &o.Revision, true } -// HasRevision returns a boolean if a field has been set. -func (o *SloResponse) HasRevision() bool { - if o != nil && !IsNil(o.Revision) { - return true - } - - return false -} - -// SetRevision gets a reference to the given float32 and assigns it to the Revision field. -func (o *SloResponse) SetRevision(v float32) { - o.Revision = &v +// SetRevision sets field value +func (o *SloResponse) SetRevision(v float64) { + o.Revision = v } -// GetSummary returns the Summary field value if set, zero value otherwise. +// GetSummary returns the Summary field value func (o *SloResponse) GetSummary() Summary { - if o == nil || IsNil(o.Summary) { + if o == nil { var ret Summary return ret } - return *o.Summary + + return o.Summary } -// GetSummaryOk returns a tuple with the Summary field value if set, nil otherwise +// GetSummaryOk returns a tuple with the Summary field value // and a boolean to check if the value has been set. func (o *SloResponse) GetSummaryOk() (*Summary, bool) { - if o == nil || IsNil(o.Summary) { + if o == nil { return nil, false } - return o.Summary, true -} - -// HasSummary returns a boolean if a field has been set. -func (o *SloResponse) HasSummary() bool { - if o != nil && !IsNil(o.Summary) { - return true - } - - return false + return &o.Summary, true } -// SetSummary gets a reference to the given Summary and assigns it to the Summary field. +// SetSummary sets field value func (o *SloResponse) SetSummary(v Summary) { - o.Summary = &v + o.Summary = v } -// GetEnabled returns the Enabled field value if set, zero value otherwise. +// GetEnabled returns the Enabled field value func (o *SloResponse) GetEnabled() bool { - if o == nil || IsNil(o.Enabled) { + if o == nil { var ret bool return ret } - return *o.Enabled + + return o.Enabled } -// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// GetEnabledOk returns a tuple with the Enabled field value // and a boolean to check if the value has been set. func (o *SloResponse) GetEnabledOk() (*bool, bool) { - if o == nil || IsNil(o.Enabled) { + if o == nil { return nil, false } - return o.Enabled, true + return &o.Enabled, true +} + +// SetEnabled sets field value +func (o *SloResponse) SetEnabled(v bool) { + o.Enabled = v } -// HasEnabled returns a boolean if a field has been set. -func (o *SloResponse) HasEnabled() bool { - if o != nil && !IsNil(o.Enabled) { - return true +// GetGroupBy returns the GroupBy field value +func (o *SloResponse) GetGroupBy() string { + if o == nil { + var ret string + return ret } - return false + return o.GroupBy } -// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. -func (o *SloResponse) SetEnabled(v bool) { - o.Enabled = &v +// GetGroupByOk returns a tuple with the GroupBy field value +// and a boolean to check if the value has been set. +func (o *SloResponse) GetGroupByOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GroupBy, true } -// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. -func (o *SloResponse) GetCreatedAt() string { - if o == nil || IsNil(o.CreatedAt) { +// SetGroupBy sets field value +func (o *SloResponse) SetGroupBy(v string) { + o.GroupBy = v +} + +// GetInstanceId returns the InstanceId field value +func (o *SloResponse) GetInstanceId() string { + if o == nil { var ret string return ret } - return *o.CreatedAt + + return o.InstanceId } -// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// GetInstanceIdOk returns a tuple with the InstanceId field value // and a boolean to check if the value has been set. -func (o *SloResponse) GetCreatedAtOk() (*string, bool) { - if o == nil || IsNil(o.CreatedAt) { +func (o *SloResponse) GetInstanceIdOk() (*string, bool) { + if o == nil { return nil, false } - return o.CreatedAt, true + return &o.InstanceId, true } -// HasCreatedAt returns a boolean if a field has been set. -func (o *SloResponse) HasCreatedAt() bool { - if o != nil && !IsNil(o.CreatedAt) { - return true +// SetInstanceId sets field value +func (o *SloResponse) SetInstanceId(v string) { + o.InstanceId = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *SloResponse) GetCreatedAt() string { + if o == nil { + var ret string + return ret } - return false + return o.CreatedAt } -// SetCreatedAt gets a reference to the given string and assigns it to the CreatedAt field. +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *SloResponse) GetCreatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value func (o *SloResponse) SetCreatedAt(v string) { - o.CreatedAt = &v + o.CreatedAt = v } -// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +// GetUpdatedAt returns the UpdatedAt field value func (o *SloResponse) GetUpdatedAt() string { - if o == nil || IsNil(o.UpdatedAt) { + if o == nil { var ret string return ret } - return *o.UpdatedAt + + return o.UpdatedAt } -// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value // and a boolean to check if the value has been set. func (o *SloResponse) GetUpdatedAtOk() (*string, bool) { - if o == nil || IsNil(o.UpdatedAt) { + if o == nil { return nil, false } - return o.UpdatedAt, true + return &o.UpdatedAt, true } -// HasUpdatedAt returns a boolean if a field has been set. -func (o *SloResponse) HasUpdatedAt() bool { - if o != nil && !IsNil(o.UpdatedAt) { - return true - } - - return false -} - -// SetUpdatedAt gets a reference to the given string and assigns it to the UpdatedAt field. +// SetUpdatedAt sets field value func (o *SloResponse) SetUpdatedAt(v string) { - o.UpdatedAt = &v + o.UpdatedAt = v } func (o SloResponse) MarshalJSON() ([]byte, error) { @@ -484,45 +447,21 @@ func (o SloResponse) MarshalJSON() ([]byte, error) { func (o SloResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Id) { - toSerialize["id"] = o.Id - } - if !IsNil(o.Name) { - toSerialize["name"] = o.Name - } - if !IsNil(o.Description) { - toSerialize["description"] = o.Description - } - if !IsNil(o.Indicator) { - toSerialize["indicator"] = o.Indicator - } - if !IsNil(o.TimeWindow) { - toSerialize["timeWindow"] = o.TimeWindow - } - if !IsNil(o.BudgetingMethod) { - toSerialize["budgetingMethod"] = o.BudgetingMethod - } - if !IsNil(o.Objective) { - toSerialize["objective"] = o.Objective - } - if !IsNil(o.Settings) { - toSerialize["settings"] = o.Settings - } - if !IsNil(o.Revision) { - toSerialize["revision"] = o.Revision - } - if !IsNil(o.Summary) { - toSerialize["summary"] = o.Summary - } - if !IsNil(o.Enabled) { - toSerialize["enabled"] = o.Enabled - } - if !IsNil(o.CreatedAt) { - toSerialize["createdAt"] = o.CreatedAt - } - if !IsNil(o.UpdatedAt) { - toSerialize["updatedAt"] = o.UpdatedAt - } + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["description"] = o.Description + toSerialize["indicator"] = o.Indicator + toSerialize["timeWindow"] = o.TimeWindow + toSerialize["budgetingMethod"] = o.BudgetingMethod + toSerialize["objective"] = o.Objective + toSerialize["settings"] = o.Settings + toSerialize["revision"] = o.Revision + toSerialize["summary"] = o.Summary + toSerialize["enabled"] = o.Enabled + toSerialize["groupBy"] = o.GroupBy + toSerialize["instanceId"] = o.InstanceId + 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 69339f690..171d83a6a 100644 --- a/generated/slo/model_slo_response_indicator.go +++ b/generated/slo/model_slo_response_indicator.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -20,6 +20,8 @@ type SloResponseIndicator struct { IndicatorPropertiesApmAvailability *IndicatorPropertiesApmAvailability IndicatorPropertiesApmLatency *IndicatorPropertiesApmLatency IndicatorPropertiesCustomKql *IndicatorPropertiesCustomKql + IndicatorPropertiesCustomMetric *IndicatorPropertiesCustomMetric + IndicatorPropertiesHistogram *IndicatorPropertiesHistogram } // IndicatorPropertiesApmAvailabilityAsSloResponseIndicator is a convenience function that returns IndicatorPropertiesApmAvailability wrapped in SloResponseIndicator @@ -43,61 +45,151 @@ func IndicatorPropertiesCustomKqlAsSloResponseIndicator(v *IndicatorPropertiesCu } } +// IndicatorPropertiesCustomMetricAsSloResponseIndicator is a convenience function that returns IndicatorPropertiesCustomMetric wrapped in SloResponseIndicator +func IndicatorPropertiesCustomMetricAsSloResponseIndicator(v *IndicatorPropertiesCustomMetric) SloResponseIndicator { + return SloResponseIndicator{ + IndicatorPropertiesCustomMetric: v, + } +} + +// IndicatorPropertiesHistogramAsSloResponseIndicator is a convenience function that returns IndicatorPropertiesHistogram wrapped in SloResponseIndicator +func IndicatorPropertiesHistogramAsSloResponseIndicator(v *IndicatorPropertiesHistogram) SloResponseIndicator { + return SloResponseIndicator{ + IndicatorPropertiesHistogram: v, + } +} + // Unmarshal JSON data into one of the pointers in the struct func (dst *SloResponseIndicator) UnmarshalJSON(data []byte) error { var err error - match := 0 - // try to unmarshal data into IndicatorPropertiesApmAvailability - err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesApmAvailability) - if err == nil { - jsonIndicatorPropertiesApmAvailability, _ := json.Marshal(dst.IndicatorPropertiesApmAvailability) - if string(jsonIndicatorPropertiesApmAvailability) == "{}" { // empty struct + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'indicator_properties_apm_availability' + if jsonDict["type"] == "indicator_properties_apm_availability" { + // try to unmarshal JSON data into IndicatorPropertiesApmAvailability + err = json.Unmarshal(data, &dst.IndicatorPropertiesApmAvailability) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesApmAvailability, return on the first match + } else { dst.IndicatorPropertiesApmAvailability = nil + return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesApmAvailability: %s", err.Error()) + } + } + + // check if the discriminator value is 'indicator_properties_apm_latency' + if jsonDict["type"] == "indicator_properties_apm_latency" { + // try to unmarshal JSON data into IndicatorPropertiesApmLatency + err = json.Unmarshal(data, &dst.IndicatorPropertiesApmLatency) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesApmLatency, return on the first match + } else { + dst.IndicatorPropertiesApmLatency = nil + return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesApmLatency: %s", err.Error()) + } + } + + // check if the discriminator value is 'indicator_properties_custom_kql' + if jsonDict["type"] == "indicator_properties_custom_kql" { + // try to unmarshal JSON data into IndicatorPropertiesCustomKql + err = json.Unmarshal(data, &dst.IndicatorPropertiesCustomKql) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesCustomKql, return on the first match + } else { + dst.IndicatorPropertiesCustomKql = nil + return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesCustomKql: %s", err.Error()) + } + } + + // check if the discriminator value is 'indicator_properties_custom_metric' + if jsonDict["type"] == "indicator_properties_custom_metric" { + // try to unmarshal JSON data into IndicatorPropertiesCustomMetric + err = json.Unmarshal(data, &dst.IndicatorPropertiesCustomMetric) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesCustomMetric, return on the first match + } else { + dst.IndicatorPropertiesCustomMetric = nil + return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesCustomMetric: %s", err.Error()) + } + } + + // check if the discriminator value is 'indicator_properties_histogram' + if jsonDict["type"] == "indicator_properties_histogram" { + // try to unmarshal JSON data into IndicatorPropertiesHistogram + err = json.Unmarshal(data, &dst.IndicatorPropertiesHistogram) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesHistogram, return on the first match } else { - match++ + dst.IndicatorPropertiesHistogram = nil + return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesHistogram: %s", err.Error()) } - } else { - dst.IndicatorPropertiesApmAvailability = nil } - // try to unmarshal data into IndicatorPropertiesApmLatency - err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesApmLatency) - if err == nil { - jsonIndicatorPropertiesApmLatency, _ := json.Marshal(dst.IndicatorPropertiesApmLatency) - if string(jsonIndicatorPropertiesApmLatency) == "{}" { // empty struct + // check if the discriminator value is 'sli.apm.transactionDuration' + if jsonDict["type"] == "sli.apm.transactionDuration" { + // try to unmarshal JSON data into IndicatorPropertiesApmLatency + err = json.Unmarshal(data, &dst.IndicatorPropertiesApmLatency) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesApmLatency, return on the first match + } else { dst.IndicatorPropertiesApmLatency = nil + return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesApmLatency: %s", err.Error()) + } + } + + // check if the discriminator value is 'sli.apm.transactionErrorRate' + if jsonDict["type"] == "sli.apm.transactionErrorRate" { + // try to unmarshal JSON data into IndicatorPropertiesApmAvailability + err = json.Unmarshal(data, &dst.IndicatorPropertiesApmAvailability) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesApmAvailability, return on the first match } else { - match++ + dst.IndicatorPropertiesApmAvailability = nil + return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesApmAvailability: %s", err.Error()) } - } else { - dst.IndicatorPropertiesApmLatency = nil } - // try to unmarshal data into IndicatorPropertiesCustomKql - err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesCustomKql) - if err == nil { - jsonIndicatorPropertiesCustomKql, _ := json.Marshal(dst.IndicatorPropertiesCustomKql) - if string(jsonIndicatorPropertiesCustomKql) == "{}" { // empty struct - dst.IndicatorPropertiesCustomKql = nil + // check if the discriminator value is 'sli.histogram.custom' + if jsonDict["type"] == "sli.histogram.custom" { + // try to unmarshal JSON data into IndicatorPropertiesHistogram + err = json.Unmarshal(data, &dst.IndicatorPropertiesHistogram) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesHistogram, return on the first match } else { - match++ + dst.IndicatorPropertiesHistogram = nil + return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesHistogram: %s", err.Error()) } - } else { - dst.IndicatorPropertiesCustomKql = nil } - if match > 1 { // more than 1 match - // reset to nil - dst.IndicatorPropertiesApmAvailability = nil - dst.IndicatorPropertiesApmLatency = nil - dst.IndicatorPropertiesCustomKql = nil + // check if the discriminator value is 'sli.kql.custom' + if jsonDict["type"] == "sli.kql.custom" { + // try to unmarshal JSON data into IndicatorPropertiesCustomKql + err = json.Unmarshal(data, &dst.IndicatorPropertiesCustomKql) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesCustomKql, return on the first match + } else { + dst.IndicatorPropertiesCustomKql = nil + return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesCustomKql: %s", err.Error()) + } + } - return fmt.Errorf("data matches more than one schema in oneOf(SloResponseIndicator)") - } else if match == 1 { - return nil // exactly one match - } else { // no match - return fmt.Errorf("data failed to match schemas in oneOf(SloResponseIndicator)") + // check if the discriminator value is 'sli.metric.custom' + if jsonDict["type"] == "sli.metric.custom" { + // try to unmarshal JSON data into IndicatorPropertiesCustomMetric + err = json.Unmarshal(data, &dst.IndicatorPropertiesCustomMetric) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesCustomMetric, return on the first match + } else { + dst.IndicatorPropertiesCustomMetric = nil + return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesCustomMetric: %s", err.Error()) + } } + + return nil } // Marshal data from the first non-nil pointers in the struct to JSON @@ -114,6 +206,14 @@ func (src SloResponseIndicator) MarshalJSON() ([]byte, error) { return json.Marshal(&src.IndicatorPropertiesCustomKql) } + if src.IndicatorPropertiesCustomMetric != nil { + return json.Marshal(&src.IndicatorPropertiesCustomMetric) + } + + if src.IndicatorPropertiesHistogram != nil { + return json.Marshal(&src.IndicatorPropertiesHistogram) + } + return nil, nil // no data in oneOf schemas } @@ -134,6 +234,14 @@ func (obj *SloResponseIndicator) GetActualInstance() interface{} { return obj.IndicatorPropertiesCustomKql } + if obj.IndicatorPropertiesCustomMetric != nil { + return obj.IndicatorPropertiesCustomMetric + } + + if obj.IndicatorPropertiesHistogram != nil { + return obj.IndicatorPropertiesHistogram + } + // all schemas are nil return nil } diff --git a/generated/slo/model_slo_response_time_window.go b/generated/slo/model_slo_response_time_window.go deleted file mode 100644 index d6ecbd3a0..000000000 --- a/generated/slo/model_slo_response_time_window.go +++ /dev/null @@ -1,145 +0,0 @@ -/* -SLOs - -OpenAPI schema for SLOs endpoints - -API version: 0.1 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package slo - -import ( - "encoding/json" - "fmt" -) - -// SloResponseTimeWindow - struct for SloResponseTimeWindow -type SloResponseTimeWindow struct { - TimeWindowCalendarAligned *TimeWindowCalendarAligned - TimeWindowRolling *TimeWindowRolling -} - -// TimeWindowCalendarAlignedAsSloResponseTimeWindow is a convenience function that returns TimeWindowCalendarAligned wrapped in SloResponseTimeWindow -func TimeWindowCalendarAlignedAsSloResponseTimeWindow(v *TimeWindowCalendarAligned) SloResponseTimeWindow { - return SloResponseTimeWindow{ - TimeWindowCalendarAligned: v, - } -} - -// TimeWindowRollingAsSloResponseTimeWindow is a convenience function that returns TimeWindowRolling wrapped in SloResponseTimeWindow -func TimeWindowRollingAsSloResponseTimeWindow(v *TimeWindowRolling) SloResponseTimeWindow { - return SloResponseTimeWindow{ - TimeWindowRolling: v, - } -} - -// Unmarshal JSON data into one of the pointers in the struct -func (dst *SloResponseTimeWindow) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into TimeWindowCalendarAligned - err = newStrictDecoder(data).Decode(&dst.TimeWindowCalendarAligned) - if err == nil { - jsonTimeWindowCalendarAligned, _ := json.Marshal(dst.TimeWindowCalendarAligned) - if string(jsonTimeWindowCalendarAligned) == "{}" { // empty struct - dst.TimeWindowCalendarAligned = nil - } else { - match++ - } - } else { - dst.TimeWindowCalendarAligned = nil - } - - // try to unmarshal data into TimeWindowRolling - err = newStrictDecoder(data).Decode(&dst.TimeWindowRolling) - if err == nil { - jsonTimeWindowRolling, _ := json.Marshal(dst.TimeWindowRolling) - if string(jsonTimeWindowRolling) == "{}" { // empty struct - dst.TimeWindowRolling = nil - } else { - match++ - } - } else { - dst.TimeWindowRolling = nil - } - - if match > 1 { // more than 1 match - // reset to nil - dst.TimeWindowCalendarAligned = nil - dst.TimeWindowRolling = nil - - return fmt.Errorf("data matches more than one schema in oneOf(SloResponseTimeWindow)") - } else if match == 1 { - return nil // exactly one match - } else { // no match - return fmt.Errorf("data failed to match schemas in oneOf(SloResponseTimeWindow)") - } -} - -// Marshal data from the first non-nil pointers in the struct to JSON -func (src SloResponseTimeWindow) MarshalJSON() ([]byte, error) { - if src.TimeWindowCalendarAligned != nil { - return json.Marshal(&src.TimeWindowCalendarAligned) - } - - if src.TimeWindowRolling != nil { - return json.Marshal(&src.TimeWindowRolling) - } - - return nil, nil // no data in oneOf schemas -} - -// Get the actual instance -func (obj *SloResponseTimeWindow) GetActualInstance() interface{} { - if obj == nil { - return nil - } - if obj.TimeWindowCalendarAligned != nil { - return obj.TimeWindowCalendarAligned - } - - if obj.TimeWindowRolling != nil { - return obj.TimeWindowRolling - } - - // all schemas are nil - return nil -} - -type NullableSloResponseTimeWindow struct { - value *SloResponseTimeWindow - isSet bool -} - -func (v NullableSloResponseTimeWindow) Get() *SloResponseTimeWindow { - return v.value -} - -func (v *NullableSloResponseTimeWindow) Set(val *SloResponseTimeWindow) { - v.value = val - v.isSet = true -} - -func (v NullableSloResponseTimeWindow) IsSet() bool { - return v.isSet -} - -func (v *NullableSloResponseTimeWindow) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableSloResponseTimeWindow(val *SloResponseTimeWindow) *NullableSloResponseTimeWindow { - return &NullableSloResponseTimeWindow{value: val, isSet: true} -} - -func (v NullableSloResponseTimeWindow) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableSloResponseTimeWindow) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/generated/slo/model_summary.go b/generated/slo/model_summary.go index 05cf3b32e..e04aea289 100644 --- a/generated/slo/model_summary.go +++ b/generated/slo/model_summary.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,19 +17,22 @@ import ( // checks if the Summary type satisfies the MappedNullable interface at compile time var _ MappedNullable = &Summary{} -// Summary struct for Summary +// Summary The SLO computed data type Summary struct { - Status *string `json:"status,omitempty"` - SliValue *float32 `json:"sliValue,omitempty"` - ErrorBudget *ErrorBudget `json:"errorBudget,omitempty"` + Status SummaryStatus `json:"status"` + SliValue float64 `json:"sliValue"` + ErrorBudget ErrorBudget `json:"errorBudget"` } // NewSummary instantiates a new Summary 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 NewSummary() *Summary { +func NewSummary(status SummaryStatus, sliValue float64, errorBudget ErrorBudget) *Summary { this := Summary{} + this.Status = status + this.SliValue = sliValue + this.ErrorBudget = errorBudget return &this } @@ -41,100 +44,76 @@ func NewSummaryWithDefaults() *Summary { return &this } -// GetStatus returns the Status field value if set, zero value otherwise. -func (o *Summary) GetStatus() string { - if o == nil || IsNil(o.Status) { - var ret string +// GetStatus returns the Status field value +func (o *Summary) GetStatus() SummaryStatus { + if o == nil { + var ret SummaryStatus return ret } - return *o.Status + + return o.Status } -// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// GetStatusOk returns a tuple with the Status field value // and a boolean to check if the value has been set. -func (o *Summary) GetStatusOk() (*string, bool) { - if o == nil || IsNil(o.Status) { +func (o *Summary) GetStatusOk() (*SummaryStatus, bool) { + if o == nil { return nil, false } - return o.Status, true -} - -// HasStatus returns a boolean if a field has been set. -func (o *Summary) HasStatus() bool { - if o != nil && !IsNil(o.Status) { - return true - } - - return false + return &o.Status, true } -// SetStatus gets a reference to the given string and assigns it to the Status field. -func (o *Summary) SetStatus(v string) { - o.Status = &v +// SetStatus sets field value +func (o *Summary) SetStatus(v SummaryStatus) { + o.Status = v } -// GetSliValue returns the SliValue field value if set, zero value otherwise. -func (o *Summary) GetSliValue() float32 { - if o == nil || IsNil(o.SliValue) { - var ret float32 +// GetSliValue returns the SliValue field value +func (o *Summary) GetSliValue() float64 { + if o == nil { + var ret float64 return ret } - return *o.SliValue + + return o.SliValue } -// GetSliValueOk returns a tuple with the SliValue field value if set, nil otherwise +// GetSliValueOk returns a tuple with the SliValue field value // and a boolean to check if the value has been set. -func (o *Summary) GetSliValueOk() (*float32, bool) { - if o == nil || IsNil(o.SliValue) { +func (o *Summary) GetSliValueOk() (*float64, bool) { + if o == nil { return nil, false } - return o.SliValue, true -} - -// HasSliValue returns a boolean if a field has been set. -func (o *Summary) HasSliValue() bool { - if o != nil && !IsNil(o.SliValue) { - return true - } - - return false + return &o.SliValue, true } -// SetSliValue gets a reference to the given float32 and assigns it to the SliValue field. -func (o *Summary) SetSliValue(v float32) { - o.SliValue = &v +// SetSliValue sets field value +func (o *Summary) SetSliValue(v float64) { + o.SliValue = v } -// GetErrorBudget returns the ErrorBudget field value if set, zero value otherwise. +// GetErrorBudget returns the ErrorBudget field value func (o *Summary) GetErrorBudget() ErrorBudget { - if o == nil || IsNil(o.ErrorBudget) { + if o == nil { var ret ErrorBudget return ret } - return *o.ErrorBudget + + return o.ErrorBudget } -// GetErrorBudgetOk returns a tuple with the ErrorBudget field value if set, nil otherwise +// GetErrorBudgetOk returns a tuple with the ErrorBudget field value // and a boolean to check if the value has been set. func (o *Summary) GetErrorBudgetOk() (*ErrorBudget, bool) { - if o == nil || IsNil(o.ErrorBudget) { + if o == nil { return nil, false } - return o.ErrorBudget, true + return &o.ErrorBudget, true } -// HasErrorBudget returns a boolean if a field has been set. -func (o *Summary) HasErrorBudget() bool { - if o != nil && !IsNil(o.ErrorBudget) { - return true - } - - return false -} - -// SetErrorBudget gets a reference to the given ErrorBudget and assigns it to the ErrorBudget field. +// SetErrorBudget sets field value func (o *Summary) SetErrorBudget(v ErrorBudget) { - o.ErrorBudget = &v + o.ErrorBudget = v } func (o Summary) MarshalJSON() ([]byte, error) { @@ -147,15 +126,9 @@ func (o Summary) MarshalJSON() ([]byte, error) { func (o Summary) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.Status) { - toSerialize["status"] = o.Status - } - if !IsNil(o.SliValue) { - toSerialize["sliValue"] = o.SliValue - } - if !IsNil(o.ErrorBudget) { - toSerialize["errorBudget"] = o.ErrorBudget - } + toSerialize["status"] = o.Status + toSerialize["sliValue"] = o.SliValue + toSerialize["errorBudget"] = o.ErrorBudget return toSerialize, nil } diff --git a/generated/slo/model_summary_status.go b/generated/slo/model_summary_status.go new file mode 100644 index 000000000..4ebe3d0f5 --- /dev/null +++ b/generated/slo/model_summary_status.go @@ -0,0 +1,114 @@ +/* +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" +) + +// SummaryStatus the model 'SummaryStatus' +type SummaryStatus string + +// List of summary_status +const ( + NO_DATA SummaryStatus = "NO_DATA" + HEALTHY SummaryStatus = "HEALTHY" + DEGRADING SummaryStatus = "DEGRADING" + VIOLATED SummaryStatus = "VIOLATED" +) + +// All allowed values of SummaryStatus enum +var AllowedSummaryStatusEnumValues = []SummaryStatus{ + "NO_DATA", + "HEALTHY", + "DEGRADING", + "VIOLATED", +} + +func (v *SummaryStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := SummaryStatus(value) + for _, existing := range AllowedSummaryStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid SummaryStatus", value) +} + +// NewSummaryStatusFromValue returns a pointer to a valid SummaryStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSummaryStatusFromValue(v string) (*SummaryStatus, error) { + ev := SummaryStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SummaryStatus: valid values are %v", v, AllowedSummaryStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SummaryStatus) IsValid() bool { + for _, existing := range AllowedSummaryStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to summary_status value +func (v SummaryStatus) Ptr() *SummaryStatus { + return &v +} + +type NullableSummaryStatus struct { + value *SummaryStatus + isSet bool +} + +func (v NullableSummaryStatus) Get() *SummaryStatus { + return v.value +} + +func (v *NullableSummaryStatus) Set(val *SummaryStatus) { + v.value = val + v.isSet = true +} + +func (v NullableSummaryStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableSummaryStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSummaryStatus(val *SummaryStatus) *NullableSummaryStatus { + return &NullableSummaryStatus{value: val, isSet: true} +} + +func (v NullableSummaryStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSummaryStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_time_window.go b/generated/slo/model_time_window.go new file mode 100644 index 000000000..e7ca20150 --- /dev/null +++ b/generated/slo/model_time_window.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 TimeWindow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TimeWindow{} + +// TimeWindow Defines properties for the SLO time window +type TimeWindow struct { + // the duration formatted as {duration}{unit}. Accepted values for rolling: 7d, 30d, 90d. Accepted values for calendar aligned: 1w (weekly) or 1M (monthly) + Duration string `json:"duration"` + // Indicates weither the time window is a rolling or a calendar aligned time window. + Type string `json:"type"` +} + +// NewTimeWindow instantiates a new TimeWindow 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 NewTimeWindow(duration string, type_ string) *TimeWindow { + this := TimeWindow{} + this.Duration = duration + this.Type = type_ + return &this +} + +// NewTimeWindowWithDefaults instantiates a new TimeWindow 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 NewTimeWindowWithDefaults() *TimeWindow { + this := TimeWindow{} + return &this +} + +// GetDuration returns the Duration field value +func (o *TimeWindow) GetDuration() string { + if o == nil { + var ret string + return ret + } + + return o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value +// and a boolean to check if the value has been set. +func (o *TimeWindow) GetDurationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Duration, true +} + +// SetDuration sets field value +func (o *TimeWindow) SetDuration(v string) { + o.Duration = v +} + +// GetType returns the Type field value +func (o *TimeWindow) 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 *TimeWindow) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *TimeWindow) SetType(v string) { + o.Type = v +} + +func (o TimeWindow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TimeWindow) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["duration"] = o.Duration + toSerialize["type"] = o.Type + return toSerialize, nil +} + +type NullableTimeWindow struct { + value *TimeWindow + isSet bool +} + +func (v NullableTimeWindow) Get() *TimeWindow { + return v.value +} + +func (v *NullableTimeWindow) Set(val *TimeWindow) { + v.value = val + v.isSet = true +} + +func (v NullableTimeWindow) IsSet() bool { + return v.isSet +} + +func (v *NullableTimeWindow) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTimeWindow(val *TimeWindow) *NullableTimeWindow { + return &NullableTimeWindow{value: val, isSet: true} +} + +func (v NullableTimeWindow) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTimeWindow) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/generated/slo/model_time_window_calendar_aligned.go b/generated/slo/model_time_window_calendar_aligned.go deleted file mode 100644 index 81e5bcbbc..000000000 --- a/generated/slo/model_time_window_calendar_aligned.go +++ /dev/null @@ -1,143 +0,0 @@ -/* -SLOs - -OpenAPI schema for SLOs endpoints - -API version: 0.1 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package slo - -import ( - "encoding/json" -) - -// checks if the TimeWindowCalendarAligned type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &TimeWindowCalendarAligned{} - -// TimeWindowCalendarAligned Defines properties for calendar aligned time window -type TimeWindowCalendarAligned struct { - // the duration formatted as {duration}{unit} - Duration string `json:"duration"` - Calendar TimeWindowCalendarAlignedCalendar `json:"calendar"` -} - -// NewTimeWindowCalendarAligned instantiates a new TimeWindowCalendarAligned 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 NewTimeWindowCalendarAligned(duration string, calendar TimeWindowCalendarAlignedCalendar) *TimeWindowCalendarAligned { - this := TimeWindowCalendarAligned{} - this.Duration = duration - this.Calendar = calendar - return &this -} - -// NewTimeWindowCalendarAlignedWithDefaults instantiates a new TimeWindowCalendarAligned 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 NewTimeWindowCalendarAlignedWithDefaults() *TimeWindowCalendarAligned { - this := TimeWindowCalendarAligned{} - return &this -} - -// GetDuration returns the Duration field value -func (o *TimeWindowCalendarAligned) GetDuration() string { - if o == nil { - var ret string - return ret - } - - return o.Duration -} - -// GetDurationOk returns a tuple with the Duration field value -// and a boolean to check if the value has been set. -func (o *TimeWindowCalendarAligned) GetDurationOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Duration, true -} - -// SetDuration sets field value -func (o *TimeWindowCalendarAligned) SetDuration(v string) { - o.Duration = v -} - -// GetCalendar returns the Calendar field value -func (o *TimeWindowCalendarAligned) GetCalendar() TimeWindowCalendarAlignedCalendar { - if o == nil { - var ret TimeWindowCalendarAlignedCalendar - return ret - } - - return o.Calendar -} - -// GetCalendarOk returns a tuple with the Calendar field value -// and a boolean to check if the value has been set. -func (o *TimeWindowCalendarAligned) GetCalendarOk() (*TimeWindowCalendarAlignedCalendar, bool) { - if o == nil { - return nil, false - } - return &o.Calendar, true -} - -// SetCalendar sets field value -func (o *TimeWindowCalendarAligned) SetCalendar(v TimeWindowCalendarAlignedCalendar) { - o.Calendar = v -} - -func (o TimeWindowCalendarAligned) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o TimeWindowCalendarAligned) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["duration"] = o.Duration - toSerialize["calendar"] = o.Calendar - return toSerialize, nil -} - -type NullableTimeWindowCalendarAligned struct { - value *TimeWindowCalendarAligned - isSet bool -} - -func (v NullableTimeWindowCalendarAligned) Get() *TimeWindowCalendarAligned { - return v.value -} - -func (v *NullableTimeWindowCalendarAligned) Set(val *TimeWindowCalendarAligned) { - v.value = val - v.isSet = true -} - -func (v NullableTimeWindowCalendarAligned) IsSet() bool { - return v.isSet -} - -func (v *NullableTimeWindowCalendarAligned) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTimeWindowCalendarAligned(val *TimeWindowCalendarAligned) *NullableTimeWindowCalendarAligned { - return &NullableTimeWindowCalendarAligned{value: val, isSet: true} -} - -func (v NullableTimeWindowCalendarAligned) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableTimeWindowCalendarAligned) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/generated/slo/model_time_window_calendar_aligned_calendar.go b/generated/slo/model_time_window_calendar_aligned_calendar.go deleted file mode 100644 index bf582cd78..000000000 --- a/generated/slo/model_time_window_calendar_aligned_calendar.go +++ /dev/null @@ -1,125 +0,0 @@ -/* -SLOs - -OpenAPI schema for SLOs endpoints - -API version: 0.1 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package slo - -import ( - "encoding/json" -) - -// checks if the TimeWindowCalendarAlignedCalendar type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &TimeWindowCalendarAlignedCalendar{} - -// TimeWindowCalendarAlignedCalendar Defines the calendar start date -type TimeWindowCalendarAlignedCalendar struct { - // The start date to use. - StartTime *string `json:"startTime,omitempty"` -} - -// NewTimeWindowCalendarAlignedCalendar instantiates a new TimeWindowCalendarAlignedCalendar 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 NewTimeWindowCalendarAlignedCalendar() *TimeWindowCalendarAlignedCalendar { - this := TimeWindowCalendarAlignedCalendar{} - return &this -} - -// NewTimeWindowCalendarAlignedCalendarWithDefaults instantiates a new TimeWindowCalendarAlignedCalendar 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 NewTimeWindowCalendarAlignedCalendarWithDefaults() *TimeWindowCalendarAlignedCalendar { - this := TimeWindowCalendarAlignedCalendar{} - return &this -} - -// GetStartTime returns the StartTime field value if set, zero value otherwise. -func (o *TimeWindowCalendarAlignedCalendar) GetStartTime() string { - if o == nil || IsNil(o.StartTime) { - var ret string - return ret - } - return *o.StartTime -} - -// GetStartTimeOk returns a tuple with the StartTime field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *TimeWindowCalendarAlignedCalendar) GetStartTimeOk() (*string, bool) { - if o == nil || IsNil(o.StartTime) { - return nil, false - } - return o.StartTime, true -} - -// HasStartTime returns a boolean if a field has been set. -func (o *TimeWindowCalendarAlignedCalendar) HasStartTime() bool { - if o != nil && !IsNil(o.StartTime) { - return true - } - - return false -} - -// SetStartTime gets a reference to the given string and assigns it to the StartTime field. -func (o *TimeWindowCalendarAlignedCalendar) SetStartTime(v string) { - o.StartTime = &v -} - -func (o TimeWindowCalendarAlignedCalendar) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o TimeWindowCalendarAlignedCalendar) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.StartTime) { - toSerialize["startTime"] = o.StartTime - } - return toSerialize, nil -} - -type NullableTimeWindowCalendarAlignedCalendar struct { - value *TimeWindowCalendarAlignedCalendar - isSet bool -} - -func (v NullableTimeWindowCalendarAlignedCalendar) Get() *TimeWindowCalendarAlignedCalendar { - return v.value -} - -func (v *NullableTimeWindowCalendarAlignedCalendar) Set(val *TimeWindowCalendarAlignedCalendar) { - v.value = val - v.isSet = true -} - -func (v NullableTimeWindowCalendarAlignedCalendar) IsSet() bool { - return v.isSet -} - -func (v *NullableTimeWindowCalendarAlignedCalendar) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTimeWindowCalendarAlignedCalendar(val *TimeWindowCalendarAlignedCalendar) *NullableTimeWindowCalendarAlignedCalendar { - return &NullableTimeWindowCalendarAlignedCalendar{value: val, isSet: true} -} - -func (v NullableTimeWindowCalendarAlignedCalendar) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableTimeWindowCalendarAlignedCalendar) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/generated/slo/model_time_window_rolling.go b/generated/slo/model_time_window_rolling.go deleted file mode 100644 index 86b2d4040..000000000 --- a/generated/slo/model_time_window_rolling.go +++ /dev/null @@ -1,144 +0,0 @@ -/* -SLOs - -OpenAPI schema for SLOs endpoints - -API version: 0.1 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package slo - -import ( - "encoding/json" -) - -// checks if the TimeWindowRolling type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &TimeWindowRolling{} - -// TimeWindowRolling Defines properties for rolling time window -type TimeWindowRolling struct { - // the duration formatted as {duration}{unit} - Duration string `json:"duration"` - // Indicates a rolling time window - IsRolling bool `json:"isRolling"` -} - -// NewTimeWindowRolling instantiates a new TimeWindowRolling 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 NewTimeWindowRolling(duration string, isRolling bool) *TimeWindowRolling { - this := TimeWindowRolling{} - this.Duration = duration - this.IsRolling = isRolling - return &this -} - -// NewTimeWindowRollingWithDefaults instantiates a new TimeWindowRolling 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 NewTimeWindowRollingWithDefaults() *TimeWindowRolling { - this := TimeWindowRolling{} - return &this -} - -// GetDuration returns the Duration field value -func (o *TimeWindowRolling) GetDuration() string { - if o == nil { - var ret string - return ret - } - - return o.Duration -} - -// GetDurationOk returns a tuple with the Duration field value -// and a boolean to check if the value has been set. -func (o *TimeWindowRolling) GetDurationOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Duration, true -} - -// SetDuration sets field value -func (o *TimeWindowRolling) SetDuration(v string) { - o.Duration = v -} - -// GetIsRolling returns the IsRolling field value -func (o *TimeWindowRolling) GetIsRolling() bool { - if o == nil { - var ret bool - return ret - } - - return o.IsRolling -} - -// GetIsRollingOk returns a tuple with the IsRolling field value -// and a boolean to check if the value has been set. -func (o *TimeWindowRolling) GetIsRollingOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.IsRolling, true -} - -// SetIsRolling sets field value -func (o *TimeWindowRolling) SetIsRolling(v bool) { - o.IsRolling = v -} - -func (o TimeWindowRolling) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o TimeWindowRolling) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["duration"] = o.Duration - toSerialize["isRolling"] = o.IsRolling - return toSerialize, nil -} - -type NullableTimeWindowRolling struct { - value *TimeWindowRolling - isSet bool -} - -func (v NullableTimeWindowRolling) Get() *TimeWindowRolling { - return v.value -} - -func (v *NullableTimeWindowRolling) Set(val *TimeWindowRolling) { - v.value = val - v.isSet = true -} - -func (v NullableTimeWindowRolling) IsSet() bool { - return v.isSet -} - -func (v *NullableTimeWindowRolling) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTimeWindowRolling(val *TimeWindowRolling) *NullableTimeWindowRolling { - return &NullableTimeWindowRolling{value: val, isSet: true} -} - -func (v NullableTimeWindowRolling) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableTimeWindowRolling) 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 4a78238f0..45dd68c36 100644 --- a/generated/slo/model_update_slo_request.go +++ b/generated/slo/model_update_slo_request.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,17 +17,17 @@ import ( // checks if the UpdateSloRequest type satisfies the MappedNullable interface at compile time var _ MappedNullable = &UpdateSloRequest{} -// UpdateSloRequest The update SLO API request body varies depending on the type of indicator, time window and budgeting method. Partial update is handled. +// UpdateSloRequest The update SLO API request body varies depending on the type of indicator, time window and budgeting method. Partial update is handled. type UpdateSloRequest struct { // A name for the SLO. Name *string `json:"name,omitempty"` // A description for the SLO. - Description *string `json:"description,omitempty"` - Indicator *SloResponseIndicator `json:"indicator,omitempty"` - TimeWindow *SloResponseTimeWindow `json:"timeWindow,omitempty"` - BudgetingMethod *BudgetingMethod `json:"budgetingMethod,omitempty"` - Objective *Objective `json:"objective,omitempty"` - Settings *Settings `json:"settings,omitempty"` + Description *string `json:"description,omitempty"` + Indicator *CreateSloRequestIndicator `json:"indicator,omitempty"` + TimeWindow *TimeWindow `json:"timeWindow,omitempty"` + BudgetingMethod *BudgetingMethod `json:"budgetingMethod,omitempty"` + Objective *Objective `json:"objective,omitempty"` + Settings *Settings `json:"settings,omitempty"` } // NewUpdateSloRequest instantiates a new UpdateSloRequest object @@ -112,9 +112,9 @@ func (o *UpdateSloRequest) SetDescription(v string) { } // GetIndicator returns the Indicator field value if set, zero value otherwise. -func (o *UpdateSloRequest) GetIndicator() SloResponseIndicator { +func (o *UpdateSloRequest) GetIndicator() CreateSloRequestIndicator { if o == nil || IsNil(o.Indicator) { - var ret SloResponseIndicator + var ret CreateSloRequestIndicator return ret } return *o.Indicator @@ -122,7 +122,7 @@ func (o *UpdateSloRequest) GetIndicator() SloResponseIndicator { // GetIndicatorOk returns a tuple with the Indicator field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *UpdateSloRequest) GetIndicatorOk() (*SloResponseIndicator, bool) { +func (o *UpdateSloRequest) GetIndicatorOk() (*CreateSloRequestIndicator, bool) { if o == nil || IsNil(o.Indicator) { return nil, false } @@ -138,15 +138,15 @@ func (o *UpdateSloRequest) HasIndicator() bool { return false } -// SetIndicator gets a reference to the given SloResponseIndicator and assigns it to the Indicator field. -func (o *UpdateSloRequest) SetIndicator(v SloResponseIndicator) { +// SetIndicator gets a reference to the given CreateSloRequestIndicator and assigns it to the Indicator field. +func (o *UpdateSloRequest) SetIndicator(v CreateSloRequestIndicator) { o.Indicator = &v } // GetTimeWindow returns the TimeWindow field value if set, zero value otherwise. -func (o *UpdateSloRequest) GetTimeWindow() SloResponseTimeWindow { +func (o *UpdateSloRequest) GetTimeWindow() TimeWindow { if o == nil || IsNil(o.TimeWindow) { - var ret SloResponseTimeWindow + var ret TimeWindow return ret } return *o.TimeWindow @@ -154,7 +154,7 @@ func (o *UpdateSloRequest) GetTimeWindow() SloResponseTimeWindow { // GetTimeWindowOk returns a tuple with the TimeWindow field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *UpdateSloRequest) GetTimeWindowOk() (*SloResponseTimeWindow, bool) { +func (o *UpdateSloRequest) GetTimeWindowOk() (*TimeWindow, bool) { if o == nil || IsNil(o.TimeWindow) { return nil, false } @@ -170,8 +170,8 @@ func (o *UpdateSloRequest) HasTimeWindow() bool { return false } -// SetTimeWindow gets a reference to the given SloResponseTimeWindow and assigns it to the TimeWindow field. -func (o *UpdateSloRequest) SetTimeWindow(v SloResponseTimeWindow) { +// SetTimeWindow gets a reference to the given TimeWindow and assigns it to the TimeWindow field. +func (o *UpdateSloRequest) SetTimeWindow(v TimeWindow) { o.TimeWindow = &v } diff --git a/generated/slo/response.go b/generated/slo/response.go index f412cca44..2875928ac 100644 --- a/generated/slo/response.go +++ b/generated/slo/response.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/slo/utils.go b/generated/slo/utils.go index 388fc4ea3..7907b693f 100644 --- a/generated/slo/utils.go +++ b/generated/slo/utils.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 0.1 +API version: 1.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/internal/clients/api_client.go b/internal/clients/api_client.go index 87a930816..3329ff7ae 100644 --- a/internal/clients/api_client.go +++ b/internal/clients/api_client.go @@ -16,6 +16,7 @@ import ( "github.com/elastic/go-elasticsearch/v7" "github.com/elastic/terraform-provider-elasticstack/generated/alerting" "github.com/elastic/terraform-provider-elasticstack/generated/connectors" + "github.com/elastic/terraform-provider-elasticstack/generated/slo" "github.com/elastic/terraform-provider-elasticstack/internal/clients/fleet" "github.com/elastic/terraform-provider-elasticstack/internal/models" "github.com/elastic/terraform-provider-elasticstack/internal/utils" @@ -67,6 +68,7 @@ type ApiClient struct { kibana *kibana.Client alerting alerting.AlertingApi connectors *connectors.Client + slo slo.SloAPI kibanaConfig kibana.Config fleet *fleet.Client version string @@ -162,6 +164,7 @@ func NewAcceptanceTestingClient() (*ApiClient, error) { elasticsearch: es, kibana: kib, alerting: buildAlertingClient(baseConfig, kibanaConfig).AlertingApi, + slo: buildSloClient(baseConfig, kibanaConfig).SloAPI, connectors: actionConnectors, kibanaConfig: kibanaConfig, fleet: fleetClient, @@ -238,6 +241,14 @@ func (a *ApiClient) GetKibanaConnectorsClient(ctx context.Context) (*connectors. return a.connectors, nil } +func (a *ApiClient) GetSloClient() (slo.SloAPI, error) { + if a.slo == nil { + return nil, errors.New("slo client not found") + } + + return a.slo, nil +} + func (a *ApiClient) GetFleetClient() (*fleet.Client, error) { if a.fleet == nil { return nil, errors.New("fleet client not found") @@ -246,6 +257,13 @@ func (a *ApiClient) GetFleetClient() (*fleet.Client, error) { return a.fleet, nil } +func (a *ApiClient) SetSloAuthContext(ctx context.Context) context.Context { + return context.WithValue(ctx, slo.ContextBasicAuth, slo.BasicAuth{ + UserName: a.kibanaConfig.Username, + Password: a.kibanaConfig.Password, + }) +} + func (a *ApiClient) SetAlertingAuthContext(ctx context.Context) context.Context { return context.WithValue(ctx, alerting.ContextBasicAuth, alerting.BasicAuth{ UserName: a.kibanaConfig.Username, @@ -586,6 +604,19 @@ func buildConnectorsClient(baseConfig BaseConfig, config kibana.Config) (*connec ) } +func buildSloClient(baseConfig BaseConfig, config kibana.Config) *slo.APIClient { + sloConfig := slo.Configuration{ + UserAgent: baseConfig.UserAgent, + Servers: slo.ServerConfigurations{ + { + URL: config.Address, + }, + }, + Debug: logging.IsDebugOrHigher(), + } + return slo.NewAPIClient(&sloConfig) +} + func buildFleetClient(d *schema.ResourceData, kibanaCfg kibana.Config) (*fleet.Client, diag.Diagnostics) { var diags diag.Diagnostics @@ -677,6 +708,7 @@ func newApiClient(d *schema.ResourceData, version string) (*ApiClient, diag.Diag } alertingClient := buildAlertingClient(baseConfig, kibanaConfig) + sloClient := buildSloClient(baseConfig, kibanaConfig) connectorsClient, err := buildConnectorsClient(baseConfig, kibanaConfig) if err != nil { @@ -695,6 +727,7 @@ func newApiClient(d *schema.ResourceData, version string) (*ApiClient, diag.Diag kibanaConfig: kibanaConfig, alerting: alertingClient.AlertingApi, connectors: connectorsClient, + slo: sloClient.SloAPI, fleet: fleetClient, version: version, }, nil diff --git a/internal/clients/kibana/alerting.go b/internal/clients/kibana/alerting.go index 8f03306fe..3c8efb6af 100644 --- a/internal/clients/kibana/alerting.go +++ b/internal/clients/kibana/alerting.go @@ -11,15 +11,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" ) -func unwrapOptionalField[T any](field *T) T { - var value T - if field != nil { - value = *field - } - - return value -} - func ruleResponseToModel(spaceID string, res *alerting.RuleResponseProperties) *models.AlertingRule { if res == nil { return nil diff --git a/internal/clients/kibana/alerting_test.go b/internal/clients/kibana/alerting_test.go index 707ccaff8..27d85c4b3 100644 --- a/internal/clients/kibana/alerting_test.go +++ b/internal/clients/kibana/alerting_test.go @@ -9,10 +9,6 @@ import ( "github.com/stretchr/testify/require" ) -func makePtr[T any](v T) *T { - return &v -} - func Test_ruleResponseToModel(t *testing.T) { now := time.Now() tests := []struct { diff --git a/internal/clients/kibana/common.go b/internal/clients/kibana/common.go new file mode 100644 index 000000000..cf89af5f4 --- /dev/null +++ b/internal/clients/kibana/common.go @@ -0,0 +1,14 @@ +package kibana + +func unwrapOptionalField[T any](field *T) T { + var value T + if field != nil { + value = *field + } + + return value +} + +func makePtr[T any](v T) *T { + return &v +} diff --git a/internal/clients/kibana/slo.go b/internal/clients/kibana/slo.go new file mode 100644 index 000000000..6b45ae79b --- /dev/null +++ b/internal/clients/kibana/slo.go @@ -0,0 +1,172 @@ +package kibana + +import ( + "context" + "fmt" + "net/http" + + "github.com/elastic/terraform-provider-elasticstack/generated/slo" + "github.com/elastic/terraform-provider-elasticstack/internal/clients" + "github.com/elastic/terraform-provider-elasticstack/internal/models" + "github.com/elastic/terraform-provider-elasticstack/internal/utils" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" +) + +func GetSlo(ctx context.Context, apiClient *clients.ApiClient, id, spaceID string) (*models.Slo, diag.Diagnostics) { + client, err := apiClient.GetSloClient() + if err != nil { + return nil, diag.FromErr(err) + } + + ctxWithAuth := apiClient.SetSloAuthContext(ctx) + req := client.GetSloOp(ctxWithAuth, "default", id).KbnXsrf("true") + sloRes, res, err := req.Execute() + if res == nil { + return nil, diag.FromErr(err) + } + if res.StatusCode == http.StatusNotFound { + return nil, nil + } + if err != nil { + return nil, diag.FromErr(err) + } + + defer res.Body.Close() + + return sloResponseToModel("default", sloRes), utils.CheckHttpError(res, "Unable to get slo with ID "+string(id)) +} + +func DeleteSlo(ctx context.Context, apiClient *clients.ApiClient, sloId string, spaceId string) diag.Diagnostics { + client, err := apiClient.GetSloClient() + if err != nil { + return diag.FromErr(err) + } + + ctxWithAuth := apiClient.SetSloAuthContext(ctx) + req := client.DeleteSloOp(ctxWithAuth, sloId, spaceId).KbnXsrf("true") + res, err := req.Execute() + if err != nil && res == nil { + return diag.FromErr(err) + } + + defer res.Body.Close() + return utils.CheckHttpError(res, "Unabled to delete slo with ID "+string(sloId)) +} + +func UpdateSlo(ctx context.Context, apiClient *clients.ApiClient, s models.Slo) (*models.Slo, diag.Diagnostics) { + client, err := apiClient.GetSloClient() + if err != nil { + return nil, diag.FromErr(err) + } + + ctxWithAuth := apiClient.SetSloAuthContext(ctx) + indicator, err := responseIndicatorToCreateSloRequestIndicator(s.Indicator) + if err != nil { + return nil, diag.FromErr(err) + } + reqModel := slo.UpdateSloRequest{ + Name: &s.Name, + Description: &s.Description, + Indicator: &indicator, + TimeWindow: &s.TimeWindow, + BudgetingMethod: (*slo.BudgetingMethod)(&s.BudgetingMethod), + Objective: &s.Objective, + Settings: s.Settings, + } + + req := client.UpdateSloOp(ctxWithAuth, s.SpaceID, s.ID).KbnXsrf("true").UpdateSloRequest(reqModel) + slo, res, err := req.Execute() + + if err != nil { + return nil, diag.FromErr(err) + } + + defer res.Body.Close() + if diags := utils.CheckHttpError(res, "unable to update slo with id "+s.ID); diags.HasError() { + return nil, diags + } + + return sloResponseToModel(s.SpaceID, slo), diag.Diagnostics{} +} + +func CreateSlo(ctx context.Context, apiClient *clients.ApiClient, s models.Slo) (*models.Slo, diag.Diagnostics) { + client, err := apiClient.GetSloClient() + if err != nil { + return nil, diag.FromErr(err) + } + + ctxWithAuth := apiClient.SetSloAuthContext(ctx) + indicator, err := responseIndicatorToCreateSloRequestIndicator(s.Indicator) + if err != nil { + return nil, diag.FromErr(err) + } + reqModel := slo.CreateSloRequest{ + Name: s.Name, + Description: s.Description, + Indicator: indicator, + TimeWindow: s.TimeWindow, + BudgetingMethod: slo.BudgetingMethod(s.BudgetingMethod), + Objective: s.Objective, + Settings: s.Settings, + } + req := client.CreateSloOp(ctxWithAuth, s.SpaceID).KbnXsrf("true").CreateSloRequest(reqModel) + sloRes, res, err := req.Execute() + if err != nil { + return nil, diag.FromErr(err) + } + defer res.Body.Close() + + if diags := utils.CheckHttpError(res, "unable to create slo with id "+s.ID); diags.HasError() { + return nil, diags + } + + s.ID = sloRes.Id + + return &s, diag.Diagnostics{} +} + +func responseIndicatorToCreateSloRequestIndicator(s slo.SloResponseIndicator) (slo.CreateSloRequestIndicator, error) { + var ret slo.CreateSloRequestIndicator + + ind := s.GetActualInstance() + switch ind := ind.(type) { + + case *slo.IndicatorPropertiesApmAvailability: + ret.IndicatorPropertiesApmAvailability = ind + + case *slo.IndicatorPropertiesApmLatency: + ret.IndicatorPropertiesApmLatency = ind + + case *slo.IndicatorPropertiesCustomKql: + ret.IndicatorPropertiesCustomKql = ind + + case *slo.IndicatorPropertiesCustomMetric: + ret.IndicatorPropertiesCustomMetric = ind + + case *slo.IndicatorPropertiesHistogram: + ret.IndicatorPropertiesHistogram = ind + + default: + return ret, fmt.Errorf("unknown indicator type: %T", ind) + } + + return ret, nil +} + +func sloResponseToModel(spaceID string, res *slo.SloResponse) *models.Slo { + if res == nil { + return nil + } + + return &models.Slo{ + ID: res.Id, + SpaceID: spaceID, + Name: res.Name, + Description: res.Description, + BudgetingMethod: res.BudgetingMethod, + Indicator: res.Indicator, + TimeWindow: res.TimeWindow, + Objective: res.Objective, + Settings: &res.Settings, + } +} diff --git a/internal/clients/kibana/slo_test.go b/internal/clients/kibana/slo_test.go new file mode 100644 index 000000000..7f72deb57 --- /dev/null +++ b/internal/clients/kibana/slo_test.go @@ -0,0 +1,96 @@ +package kibana + +import ( + "testing" + + "github.com/elastic/terraform-provider-elasticstack/generated/slo" + "github.com/elastic/terraform-provider-elasticstack/internal/models" + "github.com/stretchr/testify/require" +) + +func Test_sloResponseToModel(t *testing.T) { + var syncDelay = "2m" + + tests := []struct { + name string + spaceId string + sloResponse *slo.SloResponse + expectedModel *models.Slo + }{ + { + name: "should return a model with the correct values", + 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, + }, + 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", + GroupBy: nil, + }, + }, + + { + name: "nil response should return a nil model", + spaceId: "space-id", + sloResponse: nil, + expectedModel: nil, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + model := sloResponseToModel(tt.spaceId, tt.sloResponse) + + require.Equal(t, tt.expectedModel, model) + }) + } +} diff --git a/internal/kibana/slo.go b/internal/kibana/slo.go new file mode 100644 index 000000000..58c6a67cd --- /dev/null +++ b/internal/kibana/slo.go @@ -0,0 +1,863 @@ +package kibana + +import ( + "context" + + "github.com/elastic/terraform-provider-elasticstack/generated/slo" + "github.com/elastic/terraform-provider-elasticstack/internal/clients" + "github.com/elastic/terraform-provider-elasticstack/internal/clients/kibana" + "github.com/elastic/terraform-provider-elasticstack/internal/models" + "github.com/elastic/terraform-provider-elasticstack/internal/utils" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" +) + +func ResourceSlo() *schema.Resource { + var indicatorAddresses []string + for i := range indicatorAddressToType { + indicatorAddresses = append(indicatorAddresses, i) + } + + sloSchema := map[string]*schema.Schema{ + "id": { + Description: "An ID (8 and 36 characters). If omitted, a UUIDv1 will be generated server-side.", + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Computed: true, + }, + "name": { + Description: "The name of the SLO.", + Type: schema.TypeString, + Required: true, + }, + "description": { + Description: "A description for the SLO.", + Type: schema.TypeString, + Required: true, + }, + "metric_custom_indicator": { + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Optional: true, + ExactlyOneOf: indicatorAddresses, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "index": { + Type: schema.TypeString, + Required: true, + }, + "filter": { + Type: schema.TypeString, + Optional: true, + }, + "timestamp_field": { + Type: schema.TypeString, + Optional: true, + Default: "@timestamp", + }, + "good": { + Type: schema.TypeList, + Required: true, + MinItems: 1, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "metrics": { + Type: schema.TypeList, + Required: true, + MinItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "aggregation": { + Type: schema.TypeString, + Required: true, + }, + "field": { + Type: schema.TypeString, + Required: true, + }, + "filter": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "equation": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "total": { + Type: schema.TypeList, + Required: true, + MinItems: 1, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "metrics": { + Type: schema.TypeList, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "aggregation": { + Type: schema.TypeString, + Required: true, + }, + "field": { + Type: schema.TypeString, + Required: true, + }, + "filter": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "equation": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + }, + }, + }, + "histogram_custom_indicator": { + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Optional: true, + ExactlyOneOf: indicatorAddresses, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "index": { + Type: schema.TypeString, + Required: true, + }, + "filter": { + Type: schema.TypeString, + Optional: true, + }, + "timestamp_field": { + Type: schema.TypeString, + Optional: true, + Default: "@timestamp", + }, + "good": { + Type: schema.TypeList, + Required: true, + MinItems: 1, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "field": { + Type: schema.TypeString, + Required: true, + }, + "aggregation": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"value_count", "range"}, false), + }, + "filter": { + Type: schema.TypeString, + Optional: true, + }, + "from": { + Type: schema.TypeInt, //TODO: validate this is set if aggregation is range + Optional: true, + }, + "to": { + Type: schema.TypeInt, //TODO: validate this is set if aggregation is range + Optional: true, + }, + }, + }, + }, + "total": { + Type: schema.TypeList, + Required: true, + MinItems: 1, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "aggregation": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"value_count", "range"}, false), + }, + "field": { + Type: schema.TypeString, + Required: true, + }, + "filter": { + Type: schema.TypeString, + Optional: true, + }, + "from": { + Type: schema.TypeFloat, + Optional: true, + }, + "to": { + Type: schema.TypeFloat, + Optional: true, + }, + }, + }, + }, + }, + }, + }, + "apm_latency_indicator": { + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Optional: true, + ExactlyOneOf: indicatorAddresses, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "index": { + Type: schema.TypeString, + Required: true, + }, + "filter": { + Type: schema.TypeString, + Optional: true, + }, + "service": { + Type: schema.TypeString, + Required: true, + }, + "environment": { + Type: schema.TypeString, + Required: true, + }, + "transaction_type": { + Type: schema.TypeString, + Required: true, + }, + "transaction_name": { + Type: schema.TypeString, + Required: true, + }, + "threshold": { + Type: schema.TypeInt, + Required: true, + }, + }, + }, + }, + "apm_availability_indicator": { + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Optional: true, + ExactlyOneOf: indicatorAddresses, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "index": { + Type: schema.TypeString, + Required: true, + }, + "filter": { + Type: schema.TypeString, + Optional: true, + }, + "service": { + Type: schema.TypeString, + Required: true, + }, + "environment": { + Type: schema.TypeString, + Required: true, + }, + "transaction_type": { + Type: schema.TypeString, + Required: true, + }, + "transaction_name": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "kql_custom_indicator": { + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Optional: true, + ExactlyOneOf: indicatorAddresses, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "index": { + Type: schema.TypeString, + Required: true, + }, + "filter": { + Type: schema.TypeString, + Optional: true, + }, + "good": { + Type: schema.TypeString, + Optional: true, + }, + "total": { + Type: schema.TypeString, + Optional: true, + }, + "timestamp_field": { + Type: schema.TypeString, + Optional: true, + Default: "@timestamp", + }, + }, + }, + }, + "time_window": { + Description: "Currently support `calendarAligned` and `rolling` time windows. Any duration greater than 1 day can be used: days, weeks, months, quarters, years. Rolling time window requires a duration, e.g. `1w` for one week, and type: `rolling`. SLOs defined with such time window, will only consider the SLI data from the last duration period as a moving window. Calendar aligned time window requires a duration, limited to `1M` for monthly or `1w` for weekly, and type: `calendarAligned`.", + Type: schema.TypeList, + Required: true, + MinItems: 1, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "duration": { + Type: schema.TypeString, + Required: true, + }, + "type": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + }, + "budgeting_method": { + Description: "An `occurrences` budgeting method uses the number of good and total events during the time window. A `timeslices` budgeting method uses the number of good slices and total slices during the time window. A slice is an arbitrary time window (smaller than the overall SLO time window) that is either considered good or bad, calculated from the timeslice threshold and the ratio of good over total events that happened during the slice window. A budgeting method is required and must be either occurrences or timeslices.", + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{"occurrences", "timeslices"}, false), + }, + "objective": { + Description: "The target objective is the value the SLO needs to meet during the time window. If a timeslices budgeting method is used, we also need to define the timesliceTarget which can be different than the overall SLO target.", + Type: schema.TypeList, + Required: true, + MinItems: 1, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "target": { + Type: schema.TypeFloat, + Required: true, + }, + "timeslice_target": { + Type: schema.TypeFloat, + Optional: true, + }, + "timeslice_window": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + "settings": { + Description: "The default settings should be sufficient for most users, but if needed, these properties can be overwritten.", + Type: schema.TypeList, + Optional: true, + Computed: true, + MinItems: 1, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "sync_delay": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "frequency": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + }, + }, + }, + "space_id": { + Description: "An identifier for the space. If space_id is not provided, the default space is used.", + Type: schema.TypeString, + Optional: true, + Default: "default", + ForceNew: true, + }, + "group_by": { + Description: "Optional group by field to use to generate an SLO per distinct value.", + Type: schema.TypeString, + Optional: true, + ForceNew: false, + }, + } + + return &schema.Resource{ + Description: "Creates an SLO.", + + CreateContext: resourceSloCreate, + UpdateContext: resourceSloUpdate, + ReadContext: resourceSloRead, + DeleteContext: resourceSloDelete, + + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, + + Schema: sloSchema, + } +} + +func getOrNilString(path string, d *schema.ResourceData) *string { + if v, ok := d.GetOk(path); ok { + str := v.(string) + return &str + } + return nil +} + +func getOrNilFloat(path string, d *schema.ResourceData) *float64 { + if v, ok := d.GetOk(path); ok { + f := v.(float64) + return &f + } + return nil +} + +func getSloFromResourceData(d *schema.ResourceData) (models.Slo, diag.Diagnostics) { + var diags diag.Diagnostics + + var indicator slo.SloResponseIndicator + var indicatorType string + for key := range indicatorAddressToType { + _, exists := d.GetOk(key) + if exists { + indicatorType = key + } + } + + switch indicatorType { + case "kql_custom_indicator": + indicator = slo.SloResponseIndicator{ + IndicatorPropertiesCustomKql: &slo.IndicatorPropertiesCustomKql{ + Type: indicatorAddressToType[indicatorType], + 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), + TimestampField: d.Get(indicatorType + ".0.timestamp_field").(string), + }, + }, + } + + case "apm_availability_indicator": + indicator = slo.SloResponseIndicator{ + IndicatorPropertiesApmAvailability: &slo.IndicatorPropertiesApmAvailability{ + Type: indicatorAddressToType[indicatorType], + Params: slo.IndicatorPropertiesApmAvailabilityParams{ + Service: d.Get(indicatorType + ".0.service").(string), + Environment: d.Get(indicatorType + ".0.environment").(string), + TransactionType: d.Get(indicatorType + ".0.transaction_type").(string), + TransactionName: d.Get(indicatorType + ".0.transaction_name").(string), + Filter: getOrNilString(indicatorType+".0.filter", d), + Index: d.Get(indicatorType + ".0.index").(string), + }, + }, + } + + case "apm_latency_indicator": + indicator = slo.SloResponseIndicator{ + IndicatorPropertiesApmLatency: &slo.IndicatorPropertiesApmLatency{ + Type: indicatorAddressToType[indicatorType], + Params: slo.IndicatorPropertiesApmLatencyParams{ + Service: d.Get(indicatorType + ".0.service").(string), + Environment: d.Get(indicatorType + ".0.environment").(string), + TransactionType: d.Get(indicatorType + ".0.transaction_type").(string), + TransactionName: d.Get(indicatorType + ".0.transaction_name").(string), + Filter: getOrNilString(indicatorType+".0.filter", d), + Index: d.Get(indicatorType + ".0.index").(string), + Threshold: float64(d.Get(indicatorType + ".0.threshold").(int)), + }, + }, + } + + case "histogram_custom_indicator": + indicator = slo.SloResponseIndicator{ + IndicatorPropertiesHistogram: &slo.IndicatorPropertiesHistogram{ + Type: indicatorAddressToType[indicatorType], + Params: slo.IndicatorPropertiesHistogramParams{ + Filter: getOrNilString(indicatorType+".0.filter", d), + Index: d.Get(indicatorType + ".0.index").(string), + TimestampField: d.Get(indicatorType + ".0.timestamp_field").(string), + Good: slo.IndicatorPropertiesHistogramParamsGood{ + Field: d.Get(indicatorType + ".0.good.0.field").(string), + Aggregation: d.Get(indicatorType + ".0.good.0.aggregation").(string), + Filter: getOrNilString(indicatorType+".0.good.0.filter", d), + From: getOrNilFloat(indicatorType+".0.good.0.from", d), + To: getOrNilFloat(indicatorType+".0.good.0.to", d), + }, + Total: slo.IndicatorPropertiesHistogramParamsTotal{ + Field: d.Get(indicatorType + ".0.total.0.field").(string), + Aggregation: d.Get(indicatorType + ".0.total.0.aggregation").(string), + Filter: getOrNilString(indicatorType+".0.total.0.filter", d), + From: getOrNilFloat(indicatorType+".0.total.0.from", d), + To: getOrNilFloat(indicatorType+".0.total.0.to", d), + }, + }, + }, + } + + case "metric_custom_indicator": + indicator = slo.SloResponseIndicator{ + IndicatorPropertiesCustomMetric: &slo.IndicatorPropertiesCustomMetric{ + Type: indicatorAddressToType[indicatorType], + Params: slo.IndicatorPropertiesCustomMetricParams{ + Filter: d.Get(indicatorType + ".0.filter").(string), + Index: d.Get(indicatorType + ".0.index").(string), + TimestampField: d.Get(indicatorType + ".0.timestamp_field").(string), + Total: slo.IndicatorPropertiesCustomMetricParamsTotal{ + Equation: d.Get(indicatorType + ".0.total.0.equation").(string), + Metrics: []slo.IndicatorPropertiesCustomMetricParamsTotalMetricsInner{ //are there actually instances where there are more than one 'good' / 'total'? Need to build array if so. + { + Name: d.Get(indicatorType + ".0.total.0.metrics.0.name").(string), + Field: d.Get(indicatorType + ".0.total.0.metrics.0.field").(string), + Aggregation: d.Get(indicatorType + ".0.total.0.metrics.0.aggregation").(string), + Filter: getOrNilString(indicatorType+".0.total.0.metrics.0.filter", d), + }, + }, + }, + Good: slo.IndicatorPropertiesCustomMetricParamsGood{ + Equation: d.Get(indicatorType + ".0.good.0.equation").(string), + Metrics: []slo.IndicatorPropertiesCustomMetricParamsGoodMetricsInner{ //are there actually instances where there are more than one 'good' / 'total'? Need to build array if so. + { + Name: d.Get(indicatorType + ".0.good.0.metrics.0.name").(string), + Field: d.Get(indicatorType + ".0.good.0.metrics.0.field").(string), + Aggregation: d.Get(indicatorType + ".0.good.0.metrics.0.aggregation").(string), + Filter: getOrNilString(indicatorType+".0.good.0.metrics.0.filter", d), + }, + }, + }, + }, + }, + } + + default: + return models.Slo{}, diag.Errorf("unknown indicator type %s", indicatorType) + } + + timeWindow := slo.TimeWindow{ + Type: d.Get("time_window.0.type").(string), + Duration: d.Get("time_window.0.duration").(string), + } + + objective := slo.Objective{ + Target: d.Get("objective.0.target").(float64), + TimesliceTarget: getOrNilFloat("objective.0.timeslice_target", d), + TimesliceWindow: getOrNilString("objective.0.timeslice_window", d), + } + + settings := slo.Settings{ + SyncDelay: getOrNilString("settings.0.sync_delay", d), + Frequency: getOrNilString("settings.0.frequency", d), + } + + budgetingMethod := slo.BudgetingMethod(d.Get("budgeting_method").(string)) + + slo := models.Slo{ + Name: d.Get("name").(string), + Description: d.Get("description").(string), + Indicator: indicator, + TimeWindow: timeWindow, + BudgetingMethod: budgetingMethod, + Objective: objective, + Settings: &settings, + SpaceID: d.Get("space_id").(string), + GroupBy: getOrNilString("group_by", d), + } + + return slo, diags +} + +func resourceSloCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + client, diags := clients.NewApiClient(d, meta) + if diags.HasError() { + return diags + } + + slo, diags := getSloFromResourceData(d) + if diags.HasError() { + return diags + } + + res, diags := kibana.CreateSlo(ctx, client, slo) + + if diags.HasError() { + return diags + } + + id := &clients.CompositeId{ClusterId: slo.SpaceID, ResourceId: res.ID} + d.SetId(id.String()) + + return resourceSloRead(ctx, d, meta) +} + +func resourceSloUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + client, diags := clients.NewApiClient(d, meta) + if diags.HasError() { + return diags + } + + slo, diags := getSloFromResourceData(d) + if diags.HasError() { + return diags + } + + compId, diags := clients.CompositeIdFromStr(d.Id()) + if diags.HasError() { + return diags + } + slo.ID = compId.ResourceId + + res, diags := kibana.UpdateSlo(ctx, client, slo) + + if diags.HasError() { + return diags + } + + id := &clients.CompositeId{ClusterId: slo.SpaceID, ResourceId: res.ID} + d.SetId(id.String()) + + return resourceSloRead(ctx, d, meta) +} + +func resourceSloRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + client, diags := clients.NewApiClient(d, meta) + if diags.HasError() { + return diags + } + compId, diags := clients.CompositeIdFromStr(d.Id()) + if diags.HasError() { + return diags + } + id := compId.ResourceId + spaceId := compId.ClusterId + + s, diags := kibana.GetSlo(ctx, client, id, spaceId) + if s == nil && diags == nil { + d.SetId("") + return nil + } + if diags.HasError() { + return diags + } + + indicator := []interface{}{} + var indicatorAddress string + switch { + case s.Indicator.IndicatorPropertiesApmAvailability != nil: + indicatorAddress = indicatorTypeToAddress[s.Indicator.IndicatorPropertiesApmAvailability.Type] + params := s.Indicator.IndicatorPropertiesApmAvailability.Params + indicator = append(indicator, map[string]interface{}{ + "environment": params.Environment, + "service": params.Service, + "transaction_type": params.TransactionType, + "transaction_name": params.TransactionName, + "index": params.Index, + "filter": params.Filter, + }) + + case s.Indicator.IndicatorPropertiesApmLatency != nil: + indicatorAddress = indicatorTypeToAddress[s.Indicator.IndicatorPropertiesApmLatency.Type] + params := s.Indicator.IndicatorPropertiesApmLatency.Params + indicator = append(indicator, map[string]interface{}{ + "environment": params.Environment, + "service": params.Service, + "transaction_type": params.TransactionType, + "transaction_name": params.TransactionName, + "index": params.Index, + "filter": params.Filter, + "threshold": params.Threshold, + }) + + case s.Indicator.IndicatorPropertiesCustomKql != nil: + indicatorAddress = indicatorTypeToAddress[s.Indicator.IndicatorPropertiesCustomKql.Type] + params := s.Indicator.IndicatorPropertiesCustomKql.Params + indicator = append(indicator, map[string]interface{}{ + "index": params.Index, + "filter": params.Filter, + "good": params.Good, + "total": params.Total, + "timestamp_field": params.TimestampField, + }) + + case s.Indicator.IndicatorPropertiesHistogram != nil: + indicatorAddress = indicatorTypeToAddress[s.Indicator.IndicatorPropertiesHistogram.Type] + params := s.Indicator.IndicatorPropertiesHistogram.Params + good := []map[string]interface{}{{ + "field": params.Good.Field, + "aggregation": params.Good.Aggregation, + "filter": params.Good.Filter, + "from": params.Good.From, + "to": params.Good.To, + }} + total := []map[string]interface{}{{ + "field": params.Total.Field, + "aggregation": params.Total.Aggregation, + "filter": params.Total.Filter, + "from": params.Total.From, + "to": params.Total.To, + }} + indicator = append(indicator, map[string]interface{}{ + "index": params.Index, + "filter": params.Filter, + "timestamp_field": params.TimestampField, + "good": good, + "total": total, + }) + + case s.Indicator.IndicatorPropertiesCustomMetric != nil: + indicatorAddress = indicatorTypeToAddress[s.Indicator.IndicatorPropertiesCustomMetric.Type] + params := s.Indicator.IndicatorPropertiesCustomMetric.Params + good := []map[string]interface{}{{ + "equation": params.Good.Equation, + "metrics": []map[string]interface{}{{ + "name": params.Good.Metrics[0].Name, //this is only getting the first one? Does this really need to be an array? + "aggregation": params.Good.Metrics[0].Aggregation, + "field": params.Good.Metrics[0].Field, + "filter": params.Good.Metrics[0].Filter, + }}, + }} + total := []map[string]interface{}{{ + "equation": params.Total.Equation, + "metrics": []map[string]interface{}{{ + "name": params.Total.Metrics[0].Name, //this is only getting the first one? Does this really need to be an array? + "aggregation": params.Total.Metrics[0].Aggregation, + "field": params.Total.Metrics[0].Field, + "filter": params.Total.Metrics[0].Filter, + }}, + }} + indicator = append(indicator, map[string]interface{}{ + "index": params.Index, + "filter": params.Filter, + "timestamp_field": params.TimestampField, + "good": good, + "total": total, + }) + + default: + return diag.Errorf("indicator not set") + } + + if err := d.Set(indicatorAddress, indicator); err != nil { + return diag.FromErr(err) + } + + time_window := []interface{}{ + map[string]interface{}{ + "duration": s.TimeWindow.Duration, + "type": s.TimeWindow.Type, + }, + } + if err := d.Set("time_window", time_window); err != nil { + return diag.FromErr(err) + } + + objective := []interface{}{ + map[string]interface{}{ + "target": s.Objective.Target, + "timeslice_target": s.Objective.TimesliceTarget, + "timeslice_window": s.Objective.TimesliceWindow, + }, + } + if err := d.Set("objective", objective); err != nil { + return diag.FromErr(err) + } + + if err := d.Set("settings", []interface{}{ + map[string]interface{}{ + "sync_delay": s.Settings.SyncDelay, + "frequency": s.Settings.Frequency, + }, + }); err != nil { + return diag.FromErr(err) + } + + if s.GroupBy != nil { + if err := d.Set("group_by", s.GroupBy); err != nil { + return diag.FromErr(err) + } + } + + if err := d.Set("id", s.ID); err != nil { + return diag.FromErr(err) + } + if err := d.Set("space_id", s.SpaceID); err != nil { + return diag.FromErr(err) + } + if err := d.Set("name", s.Name); err != nil { + return diag.FromErr(err) + } + if err := d.Set("description", s.Description); err != nil { + return diag.FromErr(err) + } + if err := d.Set("budgeting_method", s.BudgetingMethod); err != nil { + return diag.FromErr(err) + } + + return diags +} + +func resourceSloDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + client, diags := clients.NewApiClient(d, meta) + if diags.HasError() { + return diags + } + compId, diags := clients.CompositeIdFromStr(d.Id()) + if diags.HasError() { + return diags + } + + spaceId := d.Get("space_id").(string) + + if diags = kibana.DeleteSlo(ctx, client, spaceId, compId.ResourceId); diags.HasError() { + return diags + } + + d.SetId("") + return diags +} + +// indicatorAddressToType is a mapping between the terraform resource address and the internal indicator type name used by the API +var indicatorAddressToType = map[string]string{ + "apm_latency_indicator": "sli.apm.transactionDuration", + "apm_availability_indicator": "sli.apm.transactionErrorRate", + "kql_custom_indicator": "sli.kql.custom", + "metric_custom_indicator": "sli.metric.custom", + "histogram_custom_indicator": "sli.histogram.custom", +} + +var indicatorTypeToAddress = utils.FlipMap(indicatorAddressToType) diff --git a/internal/kibana/slo_test.go b/internal/kibana/slo_test.go new file mode 100644 index 000000000..53a048c37 --- /dev/null +++ b/internal/kibana/slo_test.go @@ -0,0 +1,382 @@ +package kibana_test + +import ( + "context" + "fmt" + "regexp" + "strings" + "testing" + + "github.com/elastic/terraform-provider-elasticstack/internal/acctest" + "github.com/elastic/terraform-provider-elasticstack/internal/clients" + "github.com/elastic/terraform-provider-elasticstack/internal/clients/kibana" + "github.com/elastic/terraform-provider-elasticstack/internal/versionutils" + "github.com/hashicorp/go-version" + + // sdkacctest "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + sdkacctest "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" +) + +func TestAccResourceSlo(t *testing.T) { + sloName := sdkacctest.RandStringFromCharSet(22, sdkacctest.CharSetAlphaNum) + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + CheckDestroy: checkResourceSloDestroy, + ProtoV5ProviderFactories: acctest.Providers, + Steps: []resource.TestStep{ + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.9.0"))), + Config: getSLOConfig(sloName, "apm_latency_indicator", false), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "name", sloName), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "description", "fully sick SLO"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "apm_latency_indicator.0.environment", "production"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "apm_latency_indicator.0.service", "my-service"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "apm_latency_indicator.0.transaction_type", "request"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "apm_latency_indicator.0.transaction_name", "GET /sup/dawg"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "apm_latency_indicator.0.index", "my-index"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "apm_latency_indicator.0.threshold", "500"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "time_window.0.duration", "7d"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "time_window.0.type", "rolling"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "budgeting_method", "timeslices"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "objective.0.target", "0.999"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "objective.0.timeslice_target", "0.95"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "objective.0.timeslice_window", "5m"), + 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), + 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), + 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"), + ), + }, + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.9.0"))), + Config: getSLOConfig(sloName, "apm_availability_indicator", true), + 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"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "apm_availability_indicator.0.transaction_type", "request"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "apm_availability_indicator.0.transaction_name", "GET /sup/dawg"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "apm_availability_indicator.0.index", "my-index"), + ), + }, + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.9.0"))), + Config: getSLOConfig(sloName, "kql_custom_indicator", true), + 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"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "kql_custom_indicator.0.total", "*"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "kql_custom_indicator.0.filter", "labels.groupId: group-0"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "kql_custom_indicator.0.timestamp_field", "custom_timestamp"), + ), + }, + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.10.0-SNAPSHOT"))), //TODO: once 8.10.0 is released, move to 8.10.0 + Config: getSLOConfig(sloName, "histogram_custom_indicator", true), + 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"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.good.0.aggregation", "value_count"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.good.0.filter", "latency < 300"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.total.0.field", "test"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "histogram_custom_indicator.0.total.0.aggregation", "value_count"), + ), + }, + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.10.0-SNAPSHOT"))), //TODO: once 8.10.0 is released, move to 8.10.0 + Config: getSLOConfig(sloName, "metric_custom_indicator", true), + 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"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "metric_custom_indicator.0.good.0.metrics.0.aggregation", "sum"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "metric_custom_indicator.0.good.0.metrics.0.field", "processor.processed"), + 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"), + ), + }, + }, + }) +} + +func TestAccResourceSloErrors(t *testing.T) { + multipleIndicatorsConfig := ` + provider "elasticstack" { + elasticsearch {} + kibana {} + } + + resource "elasticstack_elasticsearch_index" "my_index" { + name = "my-index" + deletion_protection = false + } + + resource "elasticstack_kibana_slo" "test_slo" { + name = "fail" + description = "multiple indicator fail" + + histogram_custom_indicator { + index = "my-index" + good { + field = "test" + aggregation = "value_count" + filter = "latency < 300" + } + total { + field = "test" + aggregation = "value_count" + } + filter = "labels.groupId: group-0" + timestamp_field = "custom_timestamp" + } + + kql_custom_indicator { + index = "my-index" + good = "latency < 300" + total = "*" + filter = "labels.groupId: group-0" + timestamp_field = "custom_timestamp" + } + + time_window { + duration = "7d" + type = "rolling" + } + + budgeting_method = "supdawg" + + objective { + target = 0.999 + timeslice_target = 0.95 + timeslice_window = "5m" + } + + depends_on = [elasticstack_elasticsearch_index.my_index] + + }` + + budgetingMethodFailConfig := getSLOConfig("budgetingMethodFail", "apm_latency_indicator", false) + budgetingMethodFailConfig = strings.Replace(budgetingMethodFailConfig, "budgeting_method = \"timeslices\"", "budgeting_method = \"supdawg\"", -1) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(t) }, + ProtoV5ProviderFactories: acctest.Providers, + Steps: []resource.TestStep{ + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.9.0"))), + Config: multipleIndicatorsConfig, + ExpectError: regexp.MustCompile("Invalid combination of arguments"), + }, + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.10.0-SNAPSHOT"))), + Config: getSLOConfig("failwhale", "histogram_custom_indicator_agg_fail", false), + ExpectError: regexp.MustCompile(`expected histogram_custom_indicator.0.good.0.aggregation to be one of \[value_count range\], got supdawg`), + }, + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(version.Must(version.NewSemver("8.9.0"))), + Config: budgetingMethodFailConfig, + ExpectError: regexp.MustCompile(`expected budgeting_method to be one of \[occurrences timeslices\], got supdawg`), + }, + }, + }) +} + +func checkResourceSloDestroy(s *terraform.State) error { + client, err := clients.NewAcceptanceTestingClient() + if err != nil { + return err + } + + for _, rs := range s.RootModule().Resources { + if rs.Type != "elasticstack_kibana_slo" { + continue + } + compId, _ := clients.CompositeIdFromStr(rs.Primary.ID) + + slo, diags := kibana.GetSlo(context.Background(), client, compId.ResourceId, compId.ClusterId) + if diags.HasError() { + if len(diags) > 1 || diags[0].Summary != "404 Not Found" { + return fmt.Errorf("Failed to check if SLO was destroyed: %v", diags) + } + } + + if slo != nil { + return fmt.Errorf("SLO (%s) still exists", compId.ResourceId) + } + } + return nil +} + +func getSLOConfig(name string, indicatorType string, settingsEnabled bool) string { + var settings string + if settingsEnabled { + settings = ` + settings { + sync_delay = "5m" + frequency = "5m" + } + ` + } else { + settings = "" + } + + configTemplate := ` + provider "elasticstack" { + elasticsearch {} + kibana {} + } + + resource "elasticstack_elasticsearch_index" "my_index" { + name = "my-index" + deletion_protection = false + } + + resource "elasticstack_kibana_slo" "test_slo" { + name = "%s" + description = "fully sick SLO" + + %s + + time_window { + duration = "7d" + type = "rolling" + } + + budgeting_method = "timeslices" + + objective { + target = 0.999 + timeslice_target = 0.95 + timeslice_window = "5m" + } + + %s + + group_by = "some.field" + + depends_on = [elasticstack_elasticsearch_index.my_index] + + } + ` + + getIndicator := func(indicatorType string) string { + var indicator string + + switch indicatorType { + case "apm_latency_indicator": + indicator = ` + apm_latency_indicator { + environment = "production" + service = "my-service" + transaction_type = "request" + transaction_name = "GET /sup/dawg" + index = "my-index" + threshold = 500 + } + ` + + case "apm_availability_indicator": + indicator = ` + apm_availability_indicator { + environment = "production" + service = "my-service" + transaction_type = "request" + transaction_name = "GET /sup/dawg" + index = "my-index" + } + ` + + case "kql_custom_indicator": + indicator = ` + kql_custom_indicator { + index = "my-index" + good = "latency < 300" + total = "*" + filter = "labels.groupId: group-0" + timestamp_field = "custom_timestamp" + } + ` + + case "histogram_custom_indicator": + indicator = ` + histogram_custom_indicator { + index = "my-index" + good { + field = "test" + aggregation = "value_count" + filter = "latency < 300" + } + total { + field = "test" + aggregation = "value_count" + } + filter = "labels.groupId: group-0" + timestamp_field = "custom_timestamp" + } + ` + + case "histogram_custom_indicator_agg_fail": + indicator = ` + histogram_custom_indicator { + index = "my-index" + good { + field = "test" + aggregation = "supdawg" + filter = "latency < 300" + } + total { + field = "test" + aggregation = "supdawg" + } + filter = "labels.groupId: group-0" + timestamp_field = "custom_timestamp" + } + ` + + case "metric_custom_indicator": + indicator = ` + metric_custom_indicator { + index = "my-index" + good { + metrics { + name = "A" + aggregation = "sum" + field = "processor.processed" + } + equation = "A" + } + + total { + metrics { + name = "A" + aggregation = "sum" + field = "processor.accepted" + } + equation = "A" + } + } + ` + } + return indicator + } + + config := fmt.Sprintf(configTemplate, name, getIndicator(indicatorType), settings) + return config +} diff --git a/internal/models/slo.go b/internal/models/slo.go new file mode 100644 index 000000000..d1d830729 --- /dev/null +++ b/internal/models/slo.go @@ -0,0 +1,18 @@ +package models + +import ( + "github.com/elastic/terraform-provider-elasticstack/generated/slo" +) + +type Slo struct { + ID string + Name string + Description string + Indicator slo.SloResponseIndicator + TimeWindow slo.TimeWindow + BudgetingMethod slo.BudgetingMethod + Objective slo.Objective + Settings *slo.Settings + SpaceID string + GroupBy *string +} diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 57c86912d..50c1ff1a9 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -188,3 +188,11 @@ func ConvertSettingsKeyToTFFieldKey(settingKey string) string { func Pointer[T any](value T) *T { return &value } + +func FlipMap[K comparable, V comparable](m map[K]V) map[V]K { + inv := make(map[V]K) + for k, v := range m { + inv[v] = k + } + return inv +} diff --git a/provider/provider.go b/provider/provider.go index d51f3fb7b..408e3b58a 100644 --- a/provider/provider.go +++ b/provider/provider.go @@ -102,6 +102,7 @@ func New(version string) *schema.Provider { "elasticstack_kibana_alerting_rule": kibana.ResourceAlertingRule(), "elasticstack_kibana_space": kibana.ResourceSpace(), "elasticstack_kibana_action_connector": kibana.ResourceActionConnector(), + "elasticstack_kibana_slo": kibana.ResourceSlo(), "elasticstack_fleet_agent_policy": fleet.ResourceAgentPolicy(), "elasticstack_fleet_output": fleet.ResourceOutput(), diff --git a/templates/resources/kibana_slo.md.tmpl b/templates/resources/kibana_slo.md.tmpl new file mode 100644 index 000000000..c88772104 --- /dev/null +++ b/templates/resources/kibana_slo.md.tmpl @@ -0,0 +1,23 @@ +--- +subcategory: "Kibana" +layout: "" +page_title: "Elasticstack: elasticstack_kibana_slo Resource" +description: |- + Creates or updates a Kibana SLO. +--- + +# Resource: elasticstack_kibana_slo + +Creates or updates a Kibana SLO. See the [Kibana SLO docs](https://www.elastic.co/guide/en/observability/current/slo.html) and [dev docs](https://github.com/elastic/kibana/blob/main/x-pack/plugins/observability/dev_docs/slo.md) for more information. + +## Example Usage + +{{ tffile "examples/resources/elasticstack_kibana_slo/resource.tf" }} + +{{ .SchemaMarkdown | trimspace }} + +## Import + +Import is supported using the following syntax: + +{{ codefile "shell" "examples/resources/elasticstack_kibana_slo/import.sh" }}