From 67ca4795a6d47161f9f819a3fd7d7288d9cb6c6c Mon Sep 17 00:00:00 2001 From: Kevin Delemme Date: Mon, 16 Jun 2025 14:15:36 -0400 Subject: [PATCH 1/3] generate new version --- generated/openapitools.json | 7 + generated/slo-spec2.yml | 2029 +++++++++++++++++ generated/slo/.openapi-generator/FILES | 62 +- generated/slo/.openapi-generator/VERSION | 2 +- generated/slo/README.md | 114 +- generated/slo/api/openapi.yaml | 1337 +++++++++-- generated/slo/api_slo.go | 1482 +++++++----- generated/slo/client.go | 192 +- generated/slo/configuration.go | 42 +- generated/slo/docs/BulkDeleteRequest.md | 51 + generated/slo/docs/BulkDeleteResponse.md | 56 + .../slo/docs/BulkDeleteStatusResponse.md | 108 + .../BulkDeleteStatusResponseResultsInner.md | 108 + generated/slo/docs/BulkPurgeRollupRequest.md | 72 + .../docs/BulkPurgeRollupRequestPurgePolicy.md | 108 + .../BulkPurgeRollupRequestPurgePolicyOneOf.md | 82 + ...BulkPurgeRollupRequestPurgePolicyOneOf1.md | 82 + generated/slo/docs/BulkPurgeRollupResponse.md | 56 + generated/slo/docs/CreateSloRequest.md | 8 +- generated/slo/docs/ErrorBudget.md | 26 +- generated/slo/docs/Filter.md | 82 + generated/slo/docs/FilterMeta.md | 352 +++ .../slo/docs/FindSloDefinitionsResponse.md | 186 ++ .../docs/FindSloDefinitionsResponseOneOf.md | 134 ++ .../docs/FindSloDefinitionsResponseOneOf1.md | 186 ++ generated/slo/docs/FindSloResponse.md | 84 +- generated/slo/docs/GroupBy.md | 30 + .../IndicatorPropertiesApmLatencyParams.md | 10 +- .../IndicatorPropertiesCustomKqlParams.md | 52 +- .../IndicatorPropertiesCustomMetricParams.md | 26 + ...rtiesCustomMetricParamsGoodMetricsInner.md | 2 +- ...CustomMetricParamsGoodMetricsInnerOneOf.md | 119 + ...ustomMetricParamsGoodMetricsInnerOneOf1.md | 98 + ...icatorPropertiesCustomMetricParamsTotal.md | 10 +- .../IndicatorPropertiesHistogramParams.md | 26 + .../IndicatorPropertiesHistogramParamsGood.md | 16 +- ...IndicatorPropertiesHistogramParamsTotal.md | 16 +- ...ndicatorPropertiesTimesliceMetricParams.md | 26 + ...orPropertiesTimesliceMetricParamsMetric.md | 10 +- ...TimesliceMetricParamsMetricMetricsInner.md | 10 +- generated/slo/docs/KqlWithFilters.md | 82 + generated/slo/docs/KqlWithFiltersGood.md | 82 + generated/slo/docs/KqlWithFiltersOneOf.md | 82 + generated/slo/docs/KqlWithFiltersTotal.md | 82 + generated/slo/docs/Model400Response.md | 10 +- generated/slo/docs/Model401Response.md | 10 +- generated/slo/docs/Model403Response.md | 10 +- generated/slo/docs/Model404Response.md | 10 +- generated/slo/docs/Model409Response.md | 10 +- generated/slo/docs/Objective.md | 18 +- generated/slo/docs/Settings.md | 56 +- generated/slo/docs/SloApi.md | 700 ++++-- generated/slo/docs/SloDefinitionResponse.md | 345 +++ generated/slo/docs/SloWithSummaryResponse.md | 387 ++++ .../docs/SloWithSummaryResponseIndicator.md | 72 + generated/slo/docs/Summary.md | 10 +- .../docs/TimesliceMetricPercentileMetric.md | 10 +- generated/slo/docs/UpdateSloRequest.md | 8 +- generated/slo/git_push.sh | 4 +- generated/slo/go.mod | 7 + generated/slo/go.sum | 13 + generated/slo/model_400_response.go | 65 +- generated/slo/model_401_response.go | 65 +- generated/slo/model_403_response.go | 65 +- generated/slo/model_404_response.go | 65 +- generated/slo/model_409_response.go | 65 +- generated/slo/model_budgeting_method.go | 5 +- generated/slo/model_bulk_delete_request.go | 159 ++ generated/slo/model_bulk_delete_response.go | 127 ++ .../slo/model_bulk_delete_status_response.go | 201 ++ ...lk_delete_status_response_results_inner.go | 201 ++ .../slo/model_bulk_purge_rollup_request.go | 187 ++ ..._bulk_purge_rollup_request_purge_policy.go | 171 ++ ...urge_rollup_request_purge_policy_one_of.go | 164 ++ ...ge_rollup_request_purge_policy_one_of_1.go | 164 ++ .../slo/model_bulk_purge_rollup_response.go | 127 ++ generated/slo/model_create_slo_request.go | 78 +- .../slo/model_create_slo_request_indicator.go | 94 +- generated/slo/model_create_slo_response.go | 47 +- .../slo/model_delete_slo_instances_request.go | 49 +- ...delete_slo_instances_request_list_inner.go | 48 +- generated/slo/model_error_budget.go | 82 +- generated/slo/model_filter.go | 162 ++ generated/slo/model_filter_meta.go | 532 +++++ .../model_find_slo_definitions_response.go | 171 ++ ...el_find_slo_definitions_response_one_of.go | 234 ++ ..._find_slo_definitions_response_one_of_1.go | 313 +++ generated/slo/model_find_slo_response.go | 129 +- generated/slo/model_group_by.go | 171 ++ ...l_indicator_properties_apm_availability.go | 48 +- ...ator_properties_apm_availability_params.go | 51 +- .../model_indicator_properties_apm_latency.go | 48 +- ...indicator_properties_apm_latency_params.go | 64 +- .../model_indicator_properties_custom_kql.go | 50 +- ..._indicator_properties_custom_kql_params.go | 126 +- ...odel_indicator_properties_custom_metric.go | 48 +- ...dicator_properties_custom_metric_params.go | 95 +- ...or_properties_custom_metric_params_good.go | 50 +- ...custom_metric_params_good_metrics_inner.go | 212 +- ...metric_params_good_metrics_inner_one_of.go | 254 +++ ...tric_params_good_metrics_inner_one_of_1.go | 225 ++ ...r_properties_custom_metric_params_total.go | 62 +- .../model_indicator_properties_histogram.go | 48 +- ...l_indicator_properties_histogram_params.go | 95 +- ...icator_properties_histogram_params_good.go | 74 +- ...cator_properties_histogram_params_total.go | 74 +- ...l_indicator_properties_timeslice_metric.go | 48 +- ...ator_properties_timeslice_metric_params.go | 92 +- ...operties_timeslice_metric_params_metric.go | 64 +- ...lice_metric_params_metric_metrics_inner.go | 18 +- generated/slo/model_kql_with_filters.go | 171 ++ generated/slo/model_kql_with_filters_good.go | 171 ++ .../slo/model_kql_with_filters_one_of.go | 162 ++ generated/slo/model_kql_with_filters_total.go | 171 ++ generated/slo/model_objective.go | 71 +- generated/slo/model_settings.go | 96 +- .../slo/model_slo_definition_response.go | 559 +++++ .../slo/model_slo_with_summary_response.go | 616 +++++ ...del_slo_with_summary_response_indicator.go | 323 +++ generated/slo/model_summary.go | 65 +- generated/slo/model_summary_status.go | 9 +- generated/slo/model_time_window.go | 48 +- ...imeslice_metric_basic_metric_with_field.go | 51 +- ...model_timeslice_metric_doc_count_metric.go | 50 +- ...odel_timeslice_metric_percentile_metric.go | 64 +- generated/slo/model_update_slo_request.go | 32 +- generated/slo/response.go | 2 +- generated/slo/test/api_slo_test.go | 210 ++ generated/slo/utils.go | 18 +- 129 files changed, 16462 insertions(+), 1721 deletions(-) create mode 100644 generated/openapitools.json create mode 100644 generated/slo-spec2.yml create mode 100644 generated/slo/docs/BulkDeleteRequest.md create mode 100644 generated/slo/docs/BulkDeleteResponse.md create mode 100644 generated/slo/docs/BulkDeleteStatusResponse.md create mode 100644 generated/slo/docs/BulkDeleteStatusResponseResultsInner.md create mode 100644 generated/slo/docs/BulkPurgeRollupRequest.md create mode 100644 generated/slo/docs/BulkPurgeRollupRequestPurgePolicy.md create mode 100644 generated/slo/docs/BulkPurgeRollupRequestPurgePolicyOneOf.md create mode 100644 generated/slo/docs/BulkPurgeRollupRequestPurgePolicyOneOf1.md create mode 100644 generated/slo/docs/BulkPurgeRollupResponse.md create mode 100644 generated/slo/docs/Filter.md create mode 100644 generated/slo/docs/FilterMeta.md create mode 100644 generated/slo/docs/FindSloDefinitionsResponse.md create mode 100644 generated/slo/docs/FindSloDefinitionsResponseOneOf.md create mode 100644 generated/slo/docs/FindSloDefinitionsResponseOneOf1.md create mode 100644 generated/slo/docs/GroupBy.md create mode 100644 generated/slo/docs/IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf.md create mode 100644 generated/slo/docs/IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1.md create mode 100644 generated/slo/docs/KqlWithFilters.md create mode 100644 generated/slo/docs/KqlWithFiltersGood.md create mode 100644 generated/slo/docs/KqlWithFiltersOneOf.md create mode 100644 generated/slo/docs/KqlWithFiltersTotal.md create mode 100644 generated/slo/docs/SloDefinitionResponse.md create mode 100644 generated/slo/docs/SloWithSummaryResponse.md create mode 100644 generated/slo/docs/SloWithSummaryResponseIndicator.md create mode 100644 generated/slo/go.mod create mode 100644 generated/slo/go.sum create mode 100644 generated/slo/model_bulk_delete_request.go create mode 100644 generated/slo/model_bulk_delete_response.go create mode 100644 generated/slo/model_bulk_delete_status_response.go create mode 100644 generated/slo/model_bulk_delete_status_response_results_inner.go create mode 100644 generated/slo/model_bulk_purge_rollup_request.go create mode 100644 generated/slo/model_bulk_purge_rollup_request_purge_policy.go create mode 100644 generated/slo/model_bulk_purge_rollup_request_purge_policy_one_of.go create mode 100644 generated/slo/model_bulk_purge_rollup_request_purge_policy_one_of_1.go create mode 100644 generated/slo/model_bulk_purge_rollup_response.go create mode 100644 generated/slo/model_filter.go create mode 100644 generated/slo/model_filter_meta.go create mode 100644 generated/slo/model_find_slo_definitions_response.go create mode 100644 generated/slo/model_find_slo_definitions_response_one_of.go create mode 100644 generated/slo/model_find_slo_definitions_response_one_of_1.go create mode 100644 generated/slo/model_group_by.go create mode 100644 generated/slo/model_indicator_properties_custom_metric_params_good_metrics_inner_one_of.go create mode 100644 generated/slo/model_indicator_properties_custom_metric_params_good_metrics_inner_one_of_1.go create mode 100644 generated/slo/model_kql_with_filters.go create mode 100644 generated/slo/model_kql_with_filters_good.go create mode 100644 generated/slo/model_kql_with_filters_one_of.go create mode 100644 generated/slo/model_kql_with_filters_total.go create mode 100644 generated/slo/model_slo_definition_response.go create mode 100644 generated/slo/model_slo_with_summary_response.go create mode 100644 generated/slo/model_slo_with_summary_response_indicator.go create mode 100644 generated/slo/test/api_slo_test.go diff --git a/generated/openapitools.json b/generated/openapitools.json new file mode 100644 index 000000000..151c200f7 --- /dev/null +++ b/generated/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.13.0" + } +} diff --git a/generated/slo-spec2.yml b/generated/slo-spec2.yml new file mode 100644 index 000000000..bbc2bb684 --- /dev/null +++ b/generated/slo-spec2.yml @@ -0,0 +1,2029 @@ +openapi: 3.0.1 +info: + title: SLOs + description: OpenAPI schema for SLOs endpoints + version: '1.1' + contact: + name: Actionable Observability Team + license: + name: Elastic License 2.0 + url: https://www.elastic.co/licensing/elastic-license +servers: + - url: https://{kibana_url} + variables: + kibana_url: + default: localhost:5601 +tags: + - name: slo + description: SLO APIs enable you to define, manage and track service-level objectives +paths: + /s/{spaceId}/api/observability/slos: + post: + summary: Create 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' + get: + summary: Get 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: size + in: query + description: The page size to use for cursor-based pagination, must be greater or equal than 1 + schema: + type: integer + default: 1 + example: 1 + - name: searchAfter + in: query + description: The cursor to use for fetching the results from, when using a cursor-base pagination. + schema: + type: array + items: + type: string + - name: page + in: query + description: The page to use for pagination, must be greater or equal than 1 + schema: + type: integer + default: 1 + example: 1 + - name: perPage + in: query + description: Number of SLOs returned by page + schema: + type: integer + default: 25 + maximum: 5000 + 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 + - name: hideStale + in: query + description: Hide stale SLOs from the list as defined by stale SLO threshold in SLO settings + schema: + type: boolean + 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: Get an 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_with_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' + '404': + description: Not found response + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + put: + summary: Update 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_definition_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: Delete 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: Enable 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: Disable 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: + '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}/_reset: + post: + summary: Reset an SLO + operationId: resetSloOp + 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 + content: + application/json: + schema: + $ref: '#/components/schemas/slo_definition_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/_bulk_purge_rollup: + post: + summary: Batch delete rollup and summary data + operationId: deleteRollupDataOp + description: | + The deletion occurs for the specified list of `sloId`. 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/bulk_purge_rollup_request' + responses: + '200': + description: Successful request + content: + application/json: + schema: + $ref: '#/components/schemas/bulk_purge_rollup_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' + /s/{spaceId}/internal/observability/slos/_definitions: + get: + summary: Get the SLO definitions + operationId: getDefinitionsOp + 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: includeOutdatedOnly + in: query + description: Indicates if the API returns only outdated SLO or all SLO definitions + schema: + type: boolean + example: true + - name: tags + in: query + description: Filters the SLOs by tag + schema: + type: string + - name: search + in: query + description: Filters the SLOs by name + schema: + type: string + example: my service availability + - name: page + in: query + description: The page to use for pagination, must be greater or equal than 1 + schema: + type: number + example: 1 + - name: perPage + in: query + description: Number of SLOs returned by page + schema: + type: integer + default: 100 + maximum: 1000 + example: 100 + responses: + '200': + description: Successful request + content: + application/json: + schema: + $ref: '#/components/schemas/find_slo_definitions_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' + /s/{spaceId}/api/observability/slos/_delete_instances: + post: + summary: Batch delete rollup and summary data + operationId: deleteSloInstancesOp + description: | + The deletion occurs for the specified list of `sloId` and `instanceId`. You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + tags: + - slo + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/delete_slo_instances_request' + responses: + '204': + description: Successful request + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' + '401': + description: Unauthorized response + content: + application/json: + schema: + $ref: '#/components/schemas/401_response' + '403': + description: Unauthorized response + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' + /s/{spaceId}/api/observability/slos/_bulk_delete: + post: + summary: Bulk delete SLO definitions and their associated summary and rollup data. + operationId: bulkDeleteOp + description: | + Bulk delete SLO definitions and their associated summary and rollup data. This endpoint initiates a bulk deletion operation for SLOs, which may take some time to complete. The status of the operation can be checked using the `GET /api/slo/_bulk_delete/{taskId}` endpoint. + tags: + - slo + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/bulk_delete_request' + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/bulk_delete_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' + /s/{spaceId}/api/observability/slos/_bulk_delete/{taskId}: + get: + summary: Retrieve the status of the bulk deletion + operationId: bulkDeleteStatusOp + description: | + Retrieve the status of the bulk deletion operation for SLOs. This endpoint returns the status of the bulk deletion operation, including whether it is completed and the results of the operation. + tags: + - slo + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' + - name: taskId + in: path + description: The task id of the bulk delete operation + required: true + schema: + type: string + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/bulk_delete_status_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: + 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 + filter_meta: + title: FilterMeta + description: Defines properties for a filter + type: object + properties: + alias: + type: string + nullable: true + disabled: + type: boolean + negate: + type: boolean + controlledBy: + type: string + group: + type: string + index: + type: string + isMultiIndex: + type: boolean + type: + type: string + key: + type: string + params: + type: object + value: + type: string + field: + type: string + filter: + title: Filter + description: Defines properties for a filter + type: object + properties: + query: + type: object + meta: + $ref: '#/components/schemas/filter_meta' + kql_with_filters: + title: KQL with filters + description: Defines properties for a filter + oneOf: + - description: the KQL query to filter the documents with. + type: string + example: 'field.environment : "production" and service.name : "my-service"' + - type: object + properties: + kqlQuery: + type: string + filters: + type: array + items: + $ref: '#/components/schemas/filter' + kql_with_filters_good: + title: KQL query for good events + description: The KQL query used to define the good events. + oneOf: + - description: the KQL query to filter the documents with. + type: string + example: 'request.latency <= 150 and request.status_code : "2xx"' + - type: object + properties: + kqlQuery: + type: string + filters: + type: array + items: + $ref: '#/components/schemas/filter' + kql_with_filters_total: + title: KQL query for all events + description: The KQL query used to define all events. + oneOf: + - description: the KQL query to filter the documents with. + type: string + example: 'field.environment : "production" and service.name : "my-service"' + - type: object + properties: + kqlQuery: + type: string + filters: + type: array + items: + $ref: '#/components/schemas/filter' + indicator_properties_custom_kql: + title: Custom Query + required: + - type + - params + description: Defines properties for a custom query 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-* + dataViewId: + description: The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. + type: string + example: 03b80ab3-003d-498b-881c-3beedbaf1162 + filter: + $ref: '#/components/schemas/kql_with_filters' + good: + $ref: '#/components/schemas/kql_with_filters_good' + total: + $ref: '#/components/schemas/kql_with_filters_total' + 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 + properties: + index: + description: The index or index pattern to use + type: string + example: my-service-* + dataViewId: + description: The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. + type: string + example: 03b80ab3-003d-498b-881c-3beedbaf1162 + 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: + oneOf: + - 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. + 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: *' + - type: object + required: + - name + - aggregation + properties: + name: + description: The name of the metric. Only valid options are A-Z + type: string + example: A + pattern: ^[A-Z]$ + aggregation: + description: The aggregation type of the metric. + type: string + example: doc_count + enum: + - doc_count + filter: + description: The filter to apply to the metric. + type: string + example: 'processor.outcome: *' + 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: + oneOf: + - 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. + 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: *' + - type: object + required: + - name + - aggregation + properties: + name: + description: The name of the metric. Only valid options are A-Z + type: string + example: A + pattern: ^[A-Z]$ + aggregation: + description: The aggregation type of the metric. + type: string + example: doc_count + enum: + - doc_count + 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-* + dataViewId: + description: The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. + type: string + example: 03b80ab3-003d-498b-881c-3beedbaf1162 + 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 + timeslice_metric_basic_metric_with_field: + title: Timeslice Metric Basic Metric with Field + required: + - name + - aggregation + - field + type: object + properties: + name: + description: The name of the metric. Only valid options are A-Z + type: string + example: A + pattern: ^[A-Z]$ + aggregation: + description: The aggregation type of the metric. + type: string + example: sum + enum: + - sum + - avg + - min + - max + - std_deviation + - last_value + - cardinality + field: + description: The field of the metric. + type: string + example: processor.processed + filter: + description: The filter to apply to the metric. + type: string + example: 'processor.outcome: "success"' + timeslice_metric_percentile_metric: + title: Timeslice Metric Percentile Metric + required: + - name + - aggregation + - field + - percentile + type: object + properties: + name: + description: The name of the metric. Only valid options are A-Z + type: string + example: A + pattern: ^[A-Z]$ + aggregation: + description: The aggregation type of the metric. Only valid option is "percentile" + type: string + example: percentile + enum: + - percentile + field: + description: The field of the metric. + type: string + example: processor.processed + percentile: + description: The percentile value. + type: number + example: 95 + filter: + description: The filter to apply to the metric. + type: string + example: 'processor.outcome: "success"' + timeslice_metric_doc_count_metric: + title: Timeslice Metric Doc Count Metric + required: + - name + - aggregation + type: object + properties: + name: + description: The name of the metric. Only valid options are A-Z + type: string + example: A + pattern: ^[A-Z]$ + aggregation: + description: The aggregation type of the metric. Only valid option is "doc_count" + type: string + example: doc_count + enum: + - doc_count + filter: + description: The filter to apply to the metric. + type: string + example: 'processor.outcome: "success"' + indicator_properties_timeslice_metric: + title: Timeslice metric + required: + - type + - params + description: Defines properties for a timeslice metric indicator type + type: object + properties: + params: + description: An object containing the indicator parameters. + type: object + nullable: false + required: + - index + - timestampField + - metric + properties: + index: + description: The index or index pattern to use + type: string + example: my-service-* + dataViewId: + description: The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. + type: string + example: 03b80ab3-003d-498b-881c-3beedbaf1162 + filter: + description: the KQL query to filter the documents with. + type: string + example: 'field.environment : "production" and service.name : "my-service"' + timestampField: + description: | + The timestamp field used in the source indice. + type: string + example: timestamp + metric: + description: | + An object defining the metrics, equation, and threshold to determine if it's a good slice or not + type: object + required: + - metrics + - equation + - comparator + - threshold + properties: + metrics: + description: List of metrics with their name, aggregation type, and field. + type: array + items: + anyOf: + - $ref: '#/components/schemas/timeslice_metric_basic_metric_with_field' + - $ref: '#/components/schemas/timeslice_metric_percentile_metric' + - $ref: '#/components/schemas/timeslice_metric_doc_count_metric' + equation: + description: The equation to calculate the metric. + type: string + example: A + comparator: + description: The comparator to use to compare the equation to the threshold. + type: string + example: GT + enum: + - GT + - GTE + - LT + - LTE + threshold: + description: The threshold used to determine if the metric is a good slice or not. + type: number + example: 100 + type: + description: The type of indicator. + type: string + example: sli.metric.timeslice + time_window: + title: Time window + required: + - 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 + minimum: 0 + maximum: 100 + exclusiveMinimum: true + exclusiveMaximum: true + example: 0.99 + timesliceTarget: + description: the target objective for each slice when using a timeslices budgeting method + type: number + minimum: 0 + maximum: 100 + 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: + syncField: + description: The date field that is used to identify new documents in the source. It is strongly recommended to use a field that contains the ingest timestamp. If you use a different field, you might need to set the delay such that it accounts for data transmission delays. When unspecified, we use the indicator timestamp field. + type: string + example: event.ingested + syncDelay: + description: The time delay in minutes between the current time and the latest source data time. Increasing the value will delay any alerting. The default value is 1 minute. The minimum value is 1m and the maximum is 359m. It should always be greater then source index refresh interval. + type: string + default: 1m + example: 5m + frequency: + description: The interval between checks for changes in the source data. The minimum value is 1m and the maximum is 59m. The default value is 1 minute. + type: string + default: 1m + example: 5m + preventInitialBackfill: + description: Start aggregating data from the time the SLO is created, instead of backfilling data from the beginning of the time window. + type: boolean + default: false + example: true + 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' + group_by: + title: Group by + description: optional group by field or fields to use to generate an SLO per distinct value + example: + - - service.name + - service.name + - - service.name + - service.environment + oneOf: + - type: string + - type: array + items: + type: string + slo_with_summary_response: + title: SLO response + type: object + required: + - id + - name + - description + - indicator + - timeWindow + - budgetingMethod + - objective + - settings + - revision + - summary + - enabled + - groupBy + - instanceId + - tags + - createdAt + - updatedAt + - version + 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' + sli.metric.timeslice: '#/components/schemas/indicator_properties_timeslice_metric' + oneOf: + - $ref: '#/components/schemas/indicator_properties_custom_kql' + - $ref: '#/components/schemas/indicator_properties_apm_availability' + - $ref: '#/components/schemas/indicator_properties_apm_latency' + - $ref: '#/components/schemas/indicator_properties_custom_metric' + - $ref: '#/components/schemas/indicator_properties_histogram' + - $ref: '#/components/schemas/indicator_properties_timeslice_metric' + timeWindow: + $ref: '#/components/schemas/time_window' + budgetingMethod: + $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: + $ref: '#/components/schemas/group_by' + instanceId: + description: the value derived from the groupBy field, if present, otherwise '*' + type: string + example: host-abcde + tags: + description: List of tags + type: array + items: + type: string + createdAt: + description: The creation date + type: string + example: '2023-01-12T10:03:19.000Z' + updatedAt: + description: The last update date + type: string + example: '2023-01-12T10:03:19.000Z' + version: + description: The internal SLO version + type: number + example: 2 + find_slo_response: + title: Find SLO response + description: | + A paginated response of SLOs matching the query. + type: object + properties: + size: + type: number + example: 25 + description: Size provided for cursor based pagination + searchAfter: + type: string + page: + type: number + example: 1 + perPage: + type: number + example: 25 + total: + type: number + example: 34 + results: + type: array + items: + $ref: '#/components/schemas/slo_with_summary_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' + - $ref: '#/components/schemas/indicator_properties_timeslice_metric' + timeWindow: + $ref: '#/components/schemas/time_window' + budgetingMethod: + $ref: '#/components/schemas/budgeting_method' + objective: + $ref: '#/components/schemas/objective' + settings: + $ref: '#/components/schemas/settings' + groupBy: + $ref: '#/components/schemas/group_by' + tags: + description: List of tags + type: array + items: + type: string + 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' + - $ref: '#/components/schemas/indicator_properties_timeslice_metric' + timeWindow: + $ref: '#/components/schemas/time_window' + budgetingMethod: + $ref: '#/components/schemas/budgeting_method' + objective: + $ref: '#/components/schemas/objective' + settings: + $ref: '#/components/schemas/settings' + groupBy: + $ref: '#/components/schemas/group_by' + tags: + description: List of tags + type: array + items: + type: string + slo_definition_response: + title: SLO definition response + type: object + required: + - id + - name + - description + - indicator + - timeWindow + - budgetingMethod + - objective + - settings + - revision + - enabled + - groupBy + - tags + - createdAt + - updatedAt + - version + 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' + sli.metric.timeslice: '#/components/schemas/indicator_properties_timeslice_metric' + oneOf: + - $ref: '#/components/schemas/indicator_properties_custom_kql' + - $ref: '#/components/schemas/indicator_properties_apm_availability' + - $ref: '#/components/schemas/indicator_properties_apm_latency' + - $ref: '#/components/schemas/indicator_properties_custom_metric' + - $ref: '#/components/schemas/indicator_properties_histogram' + - $ref: '#/components/schemas/indicator_properties_timeslice_metric' + timeWindow: + $ref: '#/components/schemas/time_window' + budgetingMethod: + $ref: '#/components/schemas/budgeting_method' + objective: + $ref: '#/components/schemas/objective' + settings: + $ref: '#/components/schemas/settings' + revision: + description: The SLO revision + type: number + example: 2 + enabled: + description: Indicate if the SLO is enabled + type: boolean + example: true + groupBy: + $ref: '#/components/schemas/group_by' + tags: + description: List of tags + type: array + items: + type: string + 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' + version: + description: The internal SLO version + type: number + example: 2 + bulk_purge_rollup_request: + title: Bulk Purge Rollup data request + description: | + The bulk purge rollup data request takes a list of SLO ids and a purge policy, then deletes the rollup data according to the purge policy. This API can be used to remove the staled data of an instance SLO that no longer get updated. + type: object + required: + - list + - purgePolicy + properties: + list: + description: An array of slo ids + type: array + items: + type: string + description: The SLO Definition id + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + purgePolicy: + description: Policy that dictates which SLI documents to purge based on age + type: object + oneOf: + - type: object + properties: + purgeType: + type: string + description: Specifies whether documents will be purged based on a specific age or on a timestamp + enum: + - fixed-age + age: + type: string + description: The duration to determine which documents to purge, formatted as {duration}{unit}. This value should be greater than or equal to the time window of every SLO provided. + example: 7d + - type: object + properties: + purgeType: + type: string + description: Specifies whether documents will be purged based on a specific age or on a timestamp + enum: + - fixed-time + timestamp: + type: string + description: The timestamp to determine which documents to purge, formatted in ISO. This value should be older than the applicable time window of every SLO provided. + example: '2024-12-31T00:00:00.000Z' + bulk_purge_rollup_response: + title: Bulk Purge Rollup data response + description: | + The bulk purge rollup data response returns a task id from the elasticsearch deleteByQuery response. + type: object + properties: + taskId: + type: string + description: The task id of the purge operation + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + find_slo_definitions_response: + title: Find SLO definitions response + description: | + A paginated response of SLO definitions matching the query. + type: object + oneOf: + - 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_with_summary_response' + - type: object + properties: + page: + type: number + default: 1 + description: for backward compability + perPage: + type: number + example: 25 + description: for backward compability + size: + type: number + example: 25 + searchAfter: + type: array + items: + type: string + example: + - some-slo-id + - other-cursor-id + description: the cursor to provide to get the next paged results + total: + type: number + example: 34 + results: + type: array + items: + $ref: '#/components/schemas/slo_with_summary_response' + delete_slo_instances_request: + title: Delete SLO instances request + description: | + The delete SLO instances request takes a list of SLO id and instance id, then delete the rollup and summary data. This API can be used to remove the staled data of an instance SLO that no longer get updated. + type: object + required: + - list + properties: + list: + description: An array of slo id and instance id + type: array + items: + type: object + required: + - sloId + - instanceId + properties: + sloId: + description: The SLO unique identifier + type: string + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + instanceId: + description: The SLO instance identifier + type: string + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + bulk_delete_request: + title: Bulk delete SLO request + description: | + The bulk delete SLO request takes a list of SLOs Definition id to delete. + type: object + required: + - list + properties: + list: + description: An array of SLO Definition id + type: array + items: + type: string + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + description: The SLO Definition id + bulk_delete_response: + title: Bulk delete SLO response + description: | + The bulk delete SLO response returns a taskId that can be used to poll for its status + type: object + properties: + taskId: + type: string + example: d08506b7-f0e8-4f8b-a06a-a83940f4db91 + description: The taskId of the bulk delete operation + bulk_delete_status_response: + title: The status of the bulk deletion + description: Indicates if the bulk deletion is completed, with the detailed results of the operation. + type: object + properties: + isDone: + type: boolean + example: true + description: Indicates if the bulk deletion operation is completed + error: + type: string + example: Task not found + description: The error message if the bulk deletion operation failed + results: + description: The results of the bulk deletion operation, including the success status and any errors for each SLO + type: array + items: + type: object + properties: + id: + type: string + example: d08506b7-f0e8-4f8b-a06a-a83940f4db91 + description: The ID of the SLO that was deleted + success: + type: boolean + example: true + description: The result of the deletion operation for this SLO + error: + type: string + example: SLO [d08506b7-f0e8-4f8b-a06a-a83940f4db91] not found + description: The error message if the deletion operation failed for this SLO diff --git a/generated/slo/.openapi-generator/FILES b/generated/slo/.openapi-generator/FILES index 9145efdc6..e0dd3cfb5 100644 --- a/generated/slo/.openapi-generator/FILES +++ b/generated/slo/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -7,15 +6,28 @@ api_slo.go client.go configuration.go docs/BudgetingMethod.md +docs/BulkDeleteRequest.md +docs/BulkDeleteResponse.md +docs/BulkDeleteStatusResponse.md +docs/BulkDeleteStatusResponseResultsInner.md +docs/BulkPurgeRollupRequest.md +docs/BulkPurgeRollupRequestPurgePolicy.md +docs/BulkPurgeRollupRequestPurgePolicyOneOf.md +docs/BulkPurgeRollupRequestPurgePolicyOneOf1.md +docs/BulkPurgeRollupResponse.md docs/CreateSloRequest.md docs/CreateSloRequestIndicator.md docs/CreateSloResponse.md docs/DeleteSloInstancesRequest.md docs/DeleteSloInstancesRequestListInner.md docs/ErrorBudget.md +docs/Filter.md +docs/FilterMeta.md +docs/FindSloDefinitionsResponse.md +docs/FindSloDefinitionsResponseOneOf.md +docs/FindSloDefinitionsResponseOneOf1.md docs/FindSloResponse.md -docs/HistoricalSummaryRequest.md -docs/HistoricalSummaryResponseInner.md +docs/GroupBy.md docs/IndicatorPropertiesApmAvailability.md docs/IndicatorPropertiesApmAvailabilityParams.md docs/IndicatorPropertiesApmLatency.md @@ -26,8 +38,9 @@ docs/IndicatorPropertiesCustomMetric.md docs/IndicatorPropertiesCustomMetricParams.md docs/IndicatorPropertiesCustomMetricParamsGood.md docs/IndicatorPropertiesCustomMetricParamsGoodMetricsInner.md +docs/IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf.md +docs/IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1.md docs/IndicatorPropertiesCustomMetricParamsTotal.md -docs/IndicatorPropertiesCustomMetricParamsTotalMetricsInner.md docs/IndicatorPropertiesHistogram.md docs/IndicatorPropertiesHistogramParams.md docs/IndicatorPropertiesHistogramParamsGood.md @@ -36,6 +49,10 @@ docs/IndicatorPropertiesTimesliceMetric.md docs/IndicatorPropertiesTimesliceMetricParams.md docs/IndicatorPropertiesTimesliceMetricParamsMetric.md docs/IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner.md +docs/KqlWithFilters.md +docs/KqlWithFiltersGood.md +docs/KqlWithFiltersOneOf.md +docs/KqlWithFiltersTotal.md docs/Model400Response.md docs/Model401Response.md docs/Model403Response.md @@ -44,9 +61,9 @@ docs/Model409Response.md docs/Objective.md docs/Settings.md docs/SloAPI.md -docs/SloResponse.md -docs/SloResponseGroupBy.md -docs/SloResponseIndicator.md +docs/SloDefinitionResponse.md +docs/SloWithSummaryResponse.md +docs/SloWithSummaryResponseIndicator.md docs/Summary.md docs/SummaryStatus.md docs/TimeWindow.md @@ -63,15 +80,28 @@ model_403_response.go model_404_response.go model_409_response.go model_budgeting_method.go +model_bulk_delete_request.go +model_bulk_delete_response.go +model_bulk_delete_status_response.go +model_bulk_delete_status_response_results_inner.go +model_bulk_purge_rollup_request.go +model_bulk_purge_rollup_request_purge_policy.go +model_bulk_purge_rollup_request_purge_policy_one_of.go +model_bulk_purge_rollup_request_purge_policy_one_of_1.go +model_bulk_purge_rollup_response.go model_create_slo_request.go model_create_slo_request_indicator.go model_create_slo_response.go model_delete_slo_instances_request.go model_delete_slo_instances_request_list_inner.go model_error_budget.go +model_filter.go +model_filter_meta.go +model_find_slo_definitions_response.go +model_find_slo_definitions_response_one_of.go +model_find_slo_definitions_response_one_of_1.go model_find_slo_response.go -model_historical_summary_request.go -model_historical_summary_response_inner.go +model_group_by.go model_indicator_properties_apm_availability.go model_indicator_properties_apm_availability_params.go model_indicator_properties_apm_latency.go @@ -82,8 +112,9 @@ 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_good_metrics_inner_one_of.go +model_indicator_properties_custom_metric_params_good_metrics_inner_one_of_1.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 @@ -92,11 +123,15 @@ model_indicator_properties_timeslice_metric.go model_indicator_properties_timeslice_metric_params.go model_indicator_properties_timeslice_metric_params_metric.go model_indicator_properties_timeslice_metric_params_metric_metrics_inner.go +model_kql_with_filters.go +model_kql_with_filters_good.go +model_kql_with_filters_one_of.go +model_kql_with_filters_total.go model_objective.go model_settings.go -model_slo_response.go -model_slo_response_group_by.go -model_slo_response_indicator.go +model_slo_definition_response.go +model_slo_with_summary_response.go +model_slo_with_summary_response_indicator.go model_summary.go model_summary_status.go model_time_window.go @@ -105,5 +140,4 @@ model_timeslice_metric_doc_count_metric.go model_timeslice_metric_percentile_metric.go model_update_slo_request.go response.go -test/api_slo_test.go utils.go diff --git a/generated/slo/.openapi-generator/VERSION b/generated/slo/.openapi-generator/VERSION index 73a86b197..eb1dc6a51 100644 --- a/generated/slo/.openapi-generator/VERSION +++ b/generated/slo/.openapi-generator/VERSION @@ -1 +1 @@ -7.0.1 \ No newline at end of file +7.13.0 diff --git a/generated/slo/README.md b/generated/slo/README.md index 261fc2d0e..84fe4b160 100644 --- a/generated/slo/README.md +++ b/generated/slo/README.md @@ -5,28 +5,29 @@ 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: 1.0 +- API version: 1.1 - Package version: 1.0.0 +- Generator version: 7.13.0 - Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation Install the following dependencies: -```shell +```sh go get github.com/stretchr/testify/assert go get golang.org/x/net/context ``` Put the package under your project folder and add the following in import: -```golang -import slo "github.com/elastic/terraform-provider-elasticstack/slo" +```go +import slo "github.com/GIT_USER_ID/GIT_REPO_ID" ``` To use a proxy, set the environment variable `HTTP_PROXY`: -```golang +```go os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") ``` @@ -36,17 +37,17 @@ Default configuration comes with `Servers` field that contains server objects as ### Select Server Configuration -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. +For using other server than the one defined on index 0 set context value `slo.ContextServerIndex` of type `int`. -```golang +```go ctx := context.WithValue(context.Background(), slo.ContextServerIndex, 1) ``` ### Templated Server URL -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. +Templated server URL is formatted using default variables from configuration or from context value `slo.ContextServerVariables` of type `map[string]string`. -```golang +```go ctx := context.WithValue(context.Background(), slo.ContextServerVariables, map[string]string{ "basePath": "v2", }) @@ -58,9 +59,9 @@ Note, enum values are always validated and all unused variables are silently ign Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. +Similar rules for overriding default operation server index and variables applies by using `slo.ContextOperationServerIndices` and `slo.ContextOperationServerVariables` context maps. -```golang +```go ctx := context.WithValue(context.Background(), slo.ContextOperationServerIndices, map[string]int{ "{classname}Service.{nickname}": 2, }) @@ -73,33 +74,50 @@ ctx = context.WithValue(context.Background(), slo.ContextOperationServerVariable ## Documentation for API Endpoints -All URIs are relative to *http://localhost:5601* +All URIs are relative to *https://localhost:5601* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*SloAPI* | [**CreateSloOp**](docs/SloAPI.md#createsloop) | **Post** /s/{spaceId}/api/observability/slos | Creates an SLO. -*SloAPI* | [**DeleteSloInstancesOp**](docs/SloAPI.md#deletesloinstancesop) | **Post** /s/{spaceId}/api/observability/slos/_delete_instances | Batch delete rollup and summary data for the matching list of sloId and instanceId -*SloAPI* | [**DeleteSloOp**](docs/SloAPI.md#deletesloop) | **Delete** /s/{spaceId}/api/observability/slos/{sloId} | Deletes an SLO -*SloAPI* | [**DisableSloOp**](docs/SloAPI.md#disablesloop) | **Post** /s/{spaceId}/api/observability/slos/{sloId}/disable | Disables an SLO -*SloAPI* | [**EnableSloOp**](docs/SloAPI.md#enablesloop) | **Post** /s/{spaceId}/api/observability/slos/{sloId}/enable | Enables an SLO -*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 +*SloAPI* | [**BulkDeleteOp**](docs/SloAPI.md#bulkdeleteop) | **Post** /s/{spaceId}/api/observability/slos/_bulk_delete | Bulk delete SLO definitions and their associated summary and rollup data. +*SloAPI* | [**BulkDeleteStatusOp**](docs/SloAPI.md#bulkdeletestatusop) | **Get** /s/{spaceId}/api/observability/slos/_bulk_delete/{taskId} | Retrieve the status of the bulk deletion +*SloAPI* | [**CreateSloOp**](docs/SloAPI.md#createsloop) | **Post** /s/{spaceId}/api/observability/slos | Create an SLO +*SloAPI* | [**DeleteRollupDataOp**](docs/SloAPI.md#deleterollupdataop) | **Post** /s/{spaceId}/api/observability/slos/_bulk_purge_rollup | Batch delete rollup and summary data +*SloAPI* | [**DeleteSloInstancesOp**](docs/SloAPI.md#deletesloinstancesop) | **Post** /s/{spaceId}/api/observability/slos/_delete_instances | Batch delete rollup and summary data +*SloAPI* | [**DeleteSloOp**](docs/SloAPI.md#deletesloop) | **Delete** /s/{spaceId}/api/observability/slos/{sloId} | Delete an SLO +*SloAPI* | [**DisableSloOp**](docs/SloAPI.md#disablesloop) | **Post** /s/{spaceId}/api/observability/slos/{sloId}/disable | Disable an SLO +*SloAPI* | [**EnableSloOp**](docs/SloAPI.md#enablesloop) | **Post** /s/{spaceId}/api/observability/slos/{sloId}/enable | Enable an SLO +*SloAPI* | [**FindSlosOp**](docs/SloAPI.md#findslosop) | **Get** /s/{spaceId}/api/observability/slos | Get a paginated list of SLOs +*SloAPI* | [**GetDefinitionsOp**](docs/SloAPI.md#getdefinitionsop) | **Get** /s/{spaceId}/internal/observability/slos/_definitions | Get the SLO definitions +*SloAPI* | [**GetSloOp**](docs/SloAPI.md#getsloop) | **Get** /s/{spaceId}/api/observability/slos/{sloId} | Get an SLO +*SloAPI* | [**ResetSloOp**](docs/SloAPI.md#resetsloop) | **Post** /s/{spaceId}/api/observability/slos/{sloId}/_reset | Reset an SLO +*SloAPI* | [**UpdateSloOp**](docs/SloAPI.md#updatesloop) | **Put** /s/{spaceId}/api/observability/slos/{sloId} | Update an SLO ## Documentation For Models - [BudgetingMethod](docs/BudgetingMethod.md) + - [BulkDeleteRequest](docs/BulkDeleteRequest.md) + - [BulkDeleteResponse](docs/BulkDeleteResponse.md) + - [BulkDeleteStatusResponse](docs/BulkDeleteStatusResponse.md) + - [BulkDeleteStatusResponseResultsInner](docs/BulkDeleteStatusResponseResultsInner.md) + - [BulkPurgeRollupRequest](docs/BulkPurgeRollupRequest.md) + - [BulkPurgeRollupRequestPurgePolicy](docs/BulkPurgeRollupRequestPurgePolicy.md) + - [BulkPurgeRollupRequestPurgePolicyOneOf](docs/BulkPurgeRollupRequestPurgePolicyOneOf.md) + - [BulkPurgeRollupRequestPurgePolicyOneOf1](docs/BulkPurgeRollupRequestPurgePolicyOneOf1.md) + - [BulkPurgeRollupResponse](docs/BulkPurgeRollupResponse.md) - [CreateSloRequest](docs/CreateSloRequest.md) - [CreateSloRequestIndicator](docs/CreateSloRequestIndicator.md) - [CreateSloResponse](docs/CreateSloResponse.md) - [DeleteSloInstancesRequest](docs/DeleteSloInstancesRequest.md) - [DeleteSloInstancesRequestListInner](docs/DeleteSloInstancesRequestListInner.md) - [ErrorBudget](docs/ErrorBudget.md) + - [Filter](docs/Filter.md) + - [FilterMeta](docs/FilterMeta.md) + - [FindSloDefinitionsResponse](docs/FindSloDefinitionsResponse.md) + - [FindSloDefinitionsResponseOneOf](docs/FindSloDefinitionsResponseOneOf.md) + - [FindSloDefinitionsResponseOneOf1](docs/FindSloDefinitionsResponseOneOf1.md) - [FindSloResponse](docs/FindSloResponse.md) - - [HistoricalSummaryRequest](docs/HistoricalSummaryRequest.md) - - [HistoricalSummaryResponseInner](docs/HistoricalSummaryResponseInner.md) + - [GroupBy](docs/GroupBy.md) - [IndicatorPropertiesApmAvailability](docs/IndicatorPropertiesApmAvailability.md) - [IndicatorPropertiesApmAvailabilityParams](docs/IndicatorPropertiesApmAvailabilityParams.md) - [IndicatorPropertiesApmLatency](docs/IndicatorPropertiesApmLatency.md) @@ -110,8 +128,9 @@ Class | Method | HTTP request | Description - [IndicatorPropertiesCustomMetricParams](docs/IndicatorPropertiesCustomMetricParams.md) - [IndicatorPropertiesCustomMetricParamsGood](docs/IndicatorPropertiesCustomMetricParamsGood.md) - [IndicatorPropertiesCustomMetricParamsGoodMetricsInner](docs/IndicatorPropertiesCustomMetricParamsGoodMetricsInner.md) + - [IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf](docs/IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf.md) + - [IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1](docs/IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1.md) - [IndicatorPropertiesCustomMetricParamsTotal](docs/IndicatorPropertiesCustomMetricParamsTotal.md) - - [IndicatorPropertiesCustomMetricParamsTotalMetricsInner](docs/IndicatorPropertiesCustomMetricParamsTotalMetricsInner.md) - [IndicatorPropertiesHistogram](docs/IndicatorPropertiesHistogram.md) - [IndicatorPropertiesHistogramParams](docs/IndicatorPropertiesHistogramParams.md) - [IndicatorPropertiesHistogramParamsGood](docs/IndicatorPropertiesHistogramParamsGood.md) @@ -120,6 +139,10 @@ Class | Method | HTTP request | Description - [IndicatorPropertiesTimesliceMetricParams](docs/IndicatorPropertiesTimesliceMetricParams.md) - [IndicatorPropertiesTimesliceMetricParamsMetric](docs/IndicatorPropertiesTimesliceMetricParamsMetric.md) - [IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner](docs/IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner.md) + - [KqlWithFilters](docs/KqlWithFilters.md) + - [KqlWithFiltersGood](docs/KqlWithFiltersGood.md) + - [KqlWithFiltersOneOf](docs/KqlWithFiltersOneOf.md) + - [KqlWithFiltersTotal](docs/KqlWithFiltersTotal.md) - [Model400Response](docs/Model400Response.md) - [Model401Response](docs/Model401Response.md) - [Model403Response](docs/Model403Response.md) @@ -127,9 +150,9 @@ Class | Method | HTTP request | Description - [Model409Response](docs/Model409Response.md) - [Objective](docs/Objective.md) - [Settings](docs/Settings.md) - - [SloResponse](docs/SloResponse.md) - - [SloResponseGroupBy](docs/SloResponseGroupBy.md) - - [SloResponseIndicator](docs/SloResponseIndicator.md) + - [SloDefinitionResponse](docs/SloDefinitionResponse.md) + - [SloWithSummaryResponse](docs/SloWithSummaryResponse.md) + - [SloWithSummaryResponseIndicator](docs/SloWithSummaryResponseIndicator.md) - [Summary](docs/Summary.md) - [SummaryStatus](docs/SummaryStatus.md) - [TimeWindow](docs/TimeWindow.md) @@ -141,42 +164,7 @@ Class | Method | HTTP request | Description ## Documentation For Authorization - -Authentication schemes defined for the API: -### basicAuth - -- **Type**: HTTP basic authentication - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ - UserName: "username", - Password: "password", -}) -r, err := client.Service.Operation(auth, args) -``` - -### apiKeyAuth - -- **Type**: API key -- **API key parameter name**: Authorization -- **Location**: HTTP header - -Note, each API key must be added to a map of `map[string]APIKey` where the key is: Authorization and passed in as the auth context for each request. - -Example - -```golang -auth := context.WithValue( - context.Background(), - sw.ContextAPIKeys, - map[string]sw.APIKey{ - "Authorization": {Key: "API_KEY_STRING"}, - }, - ) -r, err := client.Service.Operation(auth, args) -``` +Endpoints do not require authorization. ## Documentation for Utility Methods diff --git a/generated/slo/api/openapi.yaml b/generated/slo/api/openapi.yaml index 6533b9907..ac643f3f3 100644 --- a/generated/slo/api/openapi.yaml +++ b/generated/slo/api/openapi.yaml @@ -7,13 +7,12 @@ info: name: Elastic License 2.0 url: https://www.elastic.co/licensing/elastic-license title: SLOs - version: "1.0" + version: "1.1" servers: -- description: local - url: http://localhost:5601 -security: -- basicAuth: [] -- apiKeyAuth: [] +- url: "https://{kibana_url}" + variables: + kibana_url: + default: localhost:5601 tags: - description: "SLO APIs enable you to define, manage and track service-level objectives" name: slo @@ -51,7 +50,30 @@ paths: schema: type: string style: form - - description: The page number to return + - description: "The page size to use for cursor-based pagination, must be greater\ + \ or equal than 1" + example: 1 + explode: true + in: query + name: size + required: false + schema: + default: 1 + type: integer + style: form + - description: "The cursor to use for fetching the results from, when using\ + \ a cursor-base pagination." + explode: true + in: query + name: searchAfter + required: false + schema: + items: + type: string + type: array + style: form + - description: "The page to use for pagination, must be greater or equal than\ + \ 1" example: 1 explode: true in: query @@ -61,7 +83,7 @@ paths: default: 1 type: integer style: form - - description: The number of SLOs to return per page + - description: Number of SLOs returned by page example: 25 explode: true in: query @@ -100,6 +122,15 @@ paths: - desc type: string style: form + - description: Hide stale SLOs from the list as defined by stale SLO threshold + in SLO settings + explode: true + in: query + name: hideStale + required: false + schema: + type: boolean + style: form responses: "200": content: @@ -131,7 +162,7 @@ paths: schema: $ref: '#/components/schemas/404_response' description: Not found response - summary: Retrieves a paginated list of SLOs + summary: Get a paginated list of SLOs tags: - slo post: @@ -194,9 +225,7 @@ paths: schema: $ref: '#/components/schemas/409_response' description: Conflict - The SLO id already exists - servers: - - url: https://localhost:5601 - summary: Creates an SLO. + summary: Create an SLO tags: - slo /s/{spaceId}/api/observability/slos/{sloId}: @@ -259,7 +288,7 @@ paths: schema: $ref: '#/components/schemas/404_response' description: Not found response - summary: Deletes an SLO + summary: Delete an SLO tags: - slo get: @@ -308,7 +337,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/slo_response' + $ref: '#/components/schemas/slo_with_summary_response' description: Successful request "400": content: @@ -334,7 +363,7 @@ paths: schema: $ref: '#/components/schemas/404_response' description: Not found response - summary: Retrieves a SLO + summary: Get an SLO tags: - slo put: @@ -380,7 +409,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/slo_response' + $ref: '#/components/schemas/slo_definition_response' description: Successful request "400": content: @@ -406,7 +435,7 @@ paths: schema: $ref: '#/components/schemas/404_response' description: Not found response - summary: Updates an SLO + summary: Update an SLO tags: - slo /s/{spaceId}/api/observability/slos/{sloId}/enable: @@ -469,7 +498,7 @@ paths: schema: $ref: '#/components/schemas/404_response' description: Not found response - summary: Enables an SLO + summary: Enable an SLO tags: - slo /s/{spaceId}/api/observability/slos/{sloId}/disable: @@ -478,6 +507,69 @@ paths: You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. operationId: disableSloOp parameters: + - description: Cross-site request forgery protection + explode: false + in: header + name: kbn-xsrf + required: true + schema: + type: string + style: simple + - description: "An identifier for the space. If `/s/` and the identifier are\ + \ omitted from the path, the default space is used." + explode: false + in: path + name: spaceId + required: true + schema: + example: default + type: string + style: simple + - description: An identifier for the slo. + explode: false + in: path + name: sloId + required: true + schema: + example: 9c235211-6834-11ea-a78c-6feb38a34414 + type: string + style: simple + responses: + "204": + description: Successful request + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' + description: Bad request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/401_response' + description: Unauthorized response + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' + description: Unauthorized response + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + description: Not found response + summary: Disable an SLO + tags: + - slo + /s/{spaceId}/api/observability/slos/{sloId}/_reset: + post: + description: | + You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + operationId: resetSloOp + parameters: - description: Cross-site request forgery protection explode: false in: header @@ -507,6 +599,10 @@ paths: style: simple responses: "200": + content: + application/json: + schema: + $ref: '#/components/schemas/slo_definition_response' description: Successful request "400": content: @@ -532,14 +628,14 @@ paths: schema: $ref: '#/components/schemas/404_response' description: Not found response - summary: Disables an SLO + summary: Reset an SLO tags: - slo - /s/{spaceId}/internal/observability/slos/_historical_summary: + /s/{spaceId}/api/observability/slos/_bulk_purge_rollup: post: description: | - You must have the `read` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. - operationId: historicalSummaryOp + The deletion occurs for the specified list of `sloId`. You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + operationId: deleteRollupDataOp parameters: - description: Cross-site request forgery protection explode: false @@ -563,14 +659,113 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/historical_summary_request' + $ref: '#/components/schemas/bulk_purge_rollup_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/bulk_purge_rollup_response' + description: Successful request + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' + description: Bad request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/401_response' + description: Unauthorized response + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' + description: Unauthorized response + summary: Batch delete rollup and summary data + tags: + - slo + /s/{spaceId}/internal/observability/slos/_definitions: + get: + description: | + You must have the `read` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + operationId: getDefinitionsOp + parameters: + - description: Cross-site request forgery protection + explode: false + in: header + name: kbn-xsrf + required: true + schema: + type: string + style: simple + - description: "An identifier for the space. If `/s/` and the identifier are\ + \ omitted from the path, the default space is used." + explode: false + in: path + name: spaceId required: true + schema: + example: default + type: string + style: simple + - description: Indicates if the API returns only outdated SLO or all SLO definitions + example: true + explode: true + in: query + name: includeOutdatedOnly + required: false + schema: + type: boolean + style: form + - description: Filters the SLOs by tag + explode: true + in: query + name: tags + required: false + schema: + type: string + style: form + - description: Filters the SLOs by name + example: my service availability + explode: true + in: query + name: search + required: false + schema: + type: string + style: form + - description: "The page to use for pagination, must be greater or equal than\ + \ 1" + example: 1 + explode: true + in: query + name: page + required: false + schema: + type: number + style: form + - description: Number of SLOs returned by page + example: 100 + explode: true + in: query + name: perPage + required: false + schema: + default: 100 + maximum: 1000 + type: integer + style: form responses: "200": content: application/json: schema: - $ref: '#/components/schemas/historical_summary_response' + $ref: '#/components/schemas/find_slo_definitions_response' description: Successful request "400": content: @@ -590,13 +785,13 @@ paths: schema: $ref: '#/components/schemas/403_response' description: Unauthorized response - summary: Retrieves the historical summary for a list of SLOs + summary: Get the SLO definitions tags: - slo /s/{spaceId}/api/observability/slos/_delete_instances: post: description: | - You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + The deletion occurs for the specified list of `sloId` and `instanceId`. You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. operationId: deleteSloInstancesOp parameters: - description: Cross-site request forgery protection @@ -644,86 +839,275 @@ paths: schema: $ref: '#/components/schemas/403_response' description: Unauthorized response - servers: - - url: https://localhost:5601 - summary: Batch delete rollup and summary data for the matching list of sloId - and instanceId + summary: Batch delete rollup and summary data tags: - slo -components: - parameters: - kbn_xsrf: - description: Cross-site request forgery protection - explode: false - in: header - name: kbn-xsrf - required: true - schema: - type: string - style: simple - space_id: - description: "An identifier for the space. If `/s/` and the identifier are omitted\ - \ from the path, the default space is used." - explode: false - in: path - name: spaceId - required: true - schema: - example: default - type: string - style: simple - slo_id: - description: An identifier for the slo. - explode: false - in: path - name: sloId - required: true - schema: - example: 9c235211-6834-11ea-a78c-6feb38a34414 - 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: - params: - $ref: '#/components/schemas/indicator_properties_custom_kql_params' - type: - description: The type of indicator. - example: sli.kql.custom + /s/{spaceId}/api/observability/slos/_bulk_delete: + post: + description: | + Bulk delete SLO definitions and their associated summary and rollup data. This endpoint initiates a bulk deletion operation for SLOs, which may take some time to complete. The status of the operation can be checked using the `GET /api/slo/_bulk_delete/{taskId}` endpoint. + operationId: bulkDeleteOp + parameters: + - description: Cross-site request forgery protection + explode: false + in: header + name: kbn-xsrf + required: true + schema: type: string - required: - - params - - type - title: Custom KQL - type: object - indicator_properties_apm_latency: - description: Defines properties for the APM latency indicator type - properties: - params: - $ref: '#/components/schemas/indicator_properties_apm_latency_params' - type: - description: The type of indicator. - example: sli.apm.transactionDuration + style: simple + - description: "An identifier for the space. If `/s/` and the identifier are\ + \ omitted from the path, the default space is used." + explode: false + in: path + name: spaceId + required: true + schema: + example: default type: string - required: - - params - - type - title: APM latency + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/bulk_delete_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/bulk_delete_response' + description: Successful response + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' + description: Bad request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/401_response' + description: Unauthorized response + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' + description: Unauthorized response + summary: Bulk delete SLO definitions and their associated summary and rollup + data. + tags: + - slo + /s/{spaceId}/api/observability/slos/_bulk_delete/{taskId}: + get: + description: | + Retrieve the status of the bulk deletion operation for SLOs. This endpoint returns the status of the bulk deletion operation, including whether it is completed and the results of the operation. + operationId: bulkDeleteStatusOp + parameters: + - description: Cross-site request forgery protection + explode: false + in: header + name: kbn-xsrf + required: true + schema: + type: string + style: simple + - description: "An identifier for the space. If `/s/` and the identifier are\ + \ omitted from the path, the default space is used." + explode: false + in: path + name: spaceId + required: true + schema: + example: default + type: string + style: simple + - description: The task id of the bulk delete operation + explode: false + in: path + name: taskId + required: true + schema: + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/bulk_delete_status_response' + description: Successful response + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' + description: Bad request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/401_response' + description: Unauthorized response + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/403_response' + description: Unauthorized response + summary: Retrieve the status of the bulk deletion + tags: + - slo +components: + parameters: + kbn_xsrf: + description: Cross-site request forgery protection + explode: false + in: header + name: kbn-xsrf + required: true + schema: + type: string + style: simple + space_id: + description: "An identifier for the space. If `/s/` and the identifier are omitted\ + \ from the path, the default space is used." + explode: false + in: path + name: spaceId + required: true + schema: + example: default + type: string + style: simple + slo_id: + description: An identifier for the slo. + explode: false + in: path + name: sloId + required: true + schema: + example: 9c235211-6834-11ea-a78c-6feb38a34414 + 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 + filter_meta: + description: Defines properties for a filter + properties: + alias: + nullable: true + type: string + disabled: + type: boolean + negate: + type: boolean + controlledBy: + type: string + group: + type: string + index: + type: string + isMultiIndex: + type: boolean + type: + type: string + key: + type: string + params: + type: object + value: + type: string + field: + type: string + title: FilterMeta + type: object + filter: + description: Defines properties for a filter + properties: + query: + type: object + meta: + $ref: '#/components/schemas/filter_meta' + title: Filter + type: object + kql_with_filters: + description: Defines properties for a filter + oneOf: + - description: the KQL query to filter the documents with. + example: "field.environment : \"production\" and service.name : \"my-service\"" + type: string + - $ref: '#/components/schemas/kql_with_filters_oneOf' + title: KQL with filters + kql_with_filters_good: + description: The KQL query used to define the good events. + oneOf: + - description: the KQL query to filter the documents with. + example: "request.latency <= 150 and request.status_code : \"2xx\"" + type: string + - $ref: '#/components/schemas/kql_with_filters_oneOf' + title: KQL query for good events + kql_with_filters_total: + description: The KQL query used to define all events. + oneOf: + - description: the KQL query to filter the documents with. + example: "field.environment : \"production\" and service.name : \"my-service\"" + type: string + - $ref: '#/components/schemas/kql_with_filters_oneOf' + title: KQL query for all events + indicator_properties_custom_kql: + description: Defines properties for a custom query indicator type + example: + params: + filter: "field.environment : \"production\" and service.name : \"my-service\"" + dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 + total: "field.environment : \"production\" and service.name : \"my-service\"" + index: my-service-* + timestampField: timestamp + good: "request.latency <= 150 and request.status_code : \"2xx\"" + type: sli.kql.custom + properties: + params: + $ref: '#/components/schemas/indicator_properties_custom_kql_params' + type: + description: The type of indicator. + example: sli.kql.custom + type: string + required: + - params + - type + title: Custom Query + type: object + indicator_properties_apm_latency: + description: Defines properties for the APM latency indicator type + properties: + params: + $ref: '#/components/schemas/indicator_properties_apm_latency_params' + type: + description: The type of indicator. + example: sli.apm.transactionDuration + type: string + required: + - params + - type + title: APM latency type: object indicator_properties_custom_metric: description: Defines properties for a custom metric indicator type @@ -897,11 +1281,17 @@ components: target: description: the target objective between 0 and 1 excluded example: 0.99 + exclusiveMaximum: true + exclusiveMinimum: true + maximum: 100 + minimum: 0 type: number timesliceTarget: description: the target objective for each slice when using a timeslices budgeting method example: 0.995 + maximum: 100 + minimum: 0 type: number timesliceWindow: description: "the duration of each slice when using a timeslices budgeting\ @@ -915,17 +1305,40 @@ components: settings: description: Defines properties for SLO settings. example: + syncField: event.ingested + preventInitialBackfill: true syncDelay: 5m frequency: 5m properties: + syncField: + description: "The date field that is used to identify new documents in the\ + \ source. It is strongly recommended to use a field that contains the\ + \ ingest timestamp. If you use a different field, you might need to set\ + \ the delay such that it accounts for data transmission delays. When unspecified,\ + \ we use the indicator timestamp field." + example: event.ingested + type: string syncDelay: - description: The synch delay to apply to the transform. Default 1m + default: 1m + description: The time delay in minutes between the current time and the + latest source data time. Increasing the value will delay any alerting. + The default value is 1 minute. The minimum value is 1m and the maximum + is 359m. It should always be greater then source index refresh interval. example: 5m type: string frequency: - description: "Configure how often the transform runs, default 1m" + default: 1m + description: The interval between checks for changes in the source data. + The minimum value is 1m and the maximum is 59m. The default value is 1 + minute. example: 5m type: string + preventInitialBackfill: + default: false + description: "Start aggregating data from the time the SLO is created, instead\ + \ of backfilling data from the beginning of the time window." + example: true + type: boolean title: Settings type: object summary_status: @@ -994,9 +1407,31 @@ components: - status title: Summary type: object - slo_response: + group_by: + description: optional group by field or fields to use to generate an SLO per + distinct value + example: + - - service.name + - service.name + - - service.name + - service.environment + oneOf: + - type: string + - items: + type: string + type: array + title: Group by + slo_with_summary_response: example: - indicator: null + indicator: + params: + filter: "field.environment : \"production\" and service.name : \"my-service\"" + dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 + total: "field.environment : \"production\" and service.name : \"my-service\"" + index: my-service-* + timestampField: timestamp + good: "request.latency <= 150 and request.status_code : \"2xx\"" + type: sli.kql.custom summary: errorBudget: consumed: 0.8 @@ -1006,13 +1441,20 @@ components: status: HEALTHY sliValue: 0.9836 settings: + syncField: event.ingested + preventInitialBackfill: true syncDelay: 5m frequency: 5m timeWindow: duration: 30d type: rolling description: My SLO description - groupBy: some.field + groupBy: + - - service.name + - service.name + - - service.name + - service.environment + version: 2 enabled: true objective: timesliceWindow: 5m @@ -1042,7 +1484,7 @@ components: example: My SLO description type: string indicator: - $ref: '#/components/schemas/slo_response_indicator' + $ref: '#/components/schemas/slo_with_summary_response_indicator' timeWindow: $ref: '#/components/schemas/time_window' budgetingMethod: @@ -1062,7 +1504,7 @@ components: example: true type: boolean groupBy: - $ref: '#/components/schemas/slo_response_groupBy' + $ref: '#/components/schemas/group_by' instanceId: description: "the value derived from the groupBy field, if present, otherwise\ \ '*'" @@ -1081,6 +1523,10 @@ components: description: The last update date example: 2023-01-12T10:03:19.000Z type: string + version: + description: The internal SLO version + example: 2 + type: number required: - budgetingMethod - createdAt @@ -1098,6 +1544,7 @@ components: - tags - timeWindow - updatedAt + - version title: SLO response type: object find_slo_response: @@ -1106,9 +1553,19 @@ components: example: total: 34 perPage: 25 + size: 25 + searchAfter: searchAfter page: 1 results: - - indicator: null + - indicator: + params: + filter: "field.environment : \"production\" and service.name : \"my-service\"" + dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 + total: "field.environment : \"production\" and service.name : \"my-service\"" + index: my-service-* + timestampField: timestamp + good: "request.latency <= 150 and request.status_code : \"2xx\"" + type: sli.kql.custom summary: errorBudget: consumed: 0.8 @@ -1118,13 +1575,20 @@ components: status: HEALTHY sliValue: 0.9836 settings: + syncField: event.ingested + preventInitialBackfill: true syncDelay: 5m frequency: 5m timeWindow: duration: 30d type: rolling description: My SLO description - groupBy: some.field + groupBy: + - - service.name + - service.name + - - service.name + - service.environment + version: 2 enabled: true objective: timesliceWindow: 5m @@ -1140,7 +1604,15 @@ components: id: 8853df00-ae2e-11ed-90af-09bb6422b258 budgetingMethod: occurrences updatedAt: 2023-01-12T10:03:19.000Z - - indicator: null + - indicator: + params: + filter: "field.environment : \"production\" and service.name : \"my-service\"" + dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 + total: "field.environment : \"production\" and service.name : \"my-service\"" + index: my-service-* + timestampField: timestamp + good: "request.latency <= 150 and request.status_code : \"2xx\"" + type: sli.kql.custom summary: errorBudget: consumed: 0.8 @@ -1150,13 +1622,20 @@ components: status: HEALTHY sliValue: 0.9836 settings: + syncField: event.ingested + preventInitialBackfill: true syncDelay: 5m frequency: 5m timeWindow: duration: 30d type: rolling description: My SLO description - groupBy: some.field + groupBy: + - - service.name + - service.name + - - service.name + - service.environment + version: 2 enabled: true objective: timesliceWindow: 5m @@ -1173,6 +1652,12 @@ components: budgetingMethod: occurrences updatedAt: 2023-01-12T10:03:19.000Z properties: + size: + description: Size provided for cursor based pagination + example: 25 + type: number + searchAfter: + type: string page: example: 1 type: number @@ -1184,11 +1669,15 @@ components: type: number results: items: - $ref: '#/components/schemas/slo_response' + $ref: '#/components/schemas/slo_with_summary_response' type: array title: Find SLO response type: object "400_response": + example: + error: Bad Request + message: "Invalid value 'foo' supplied to: [...]" + statusCode: 400 properties: statusCode: example: 400 @@ -1206,6 +1695,12 @@ components: title: Bad request type: object "401_response": + example: + error: Unauthorized + message: "[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]" + statusCode: 401 properties: statusCode: example: 401 @@ -1225,6 +1720,12 @@ components: title: Unauthorized type: object "403_response": + example: + error: Unauthorized + message: "[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]" + statusCode: 403 properties: statusCode: example: 403 @@ -1244,6 +1745,10 @@ components: title: Unauthorized type: object "404_response": + example: + error: Not Found + message: "SLO [3749f390-03a3-11ee-8139-c7ff60a1692d] not found" + statusCode: 404 properties: statusCode: example: 404 @@ -1286,7 +1791,7 @@ components: settings: $ref: '#/components/schemas/settings' groupBy: - $ref: '#/components/schemas/slo_response_groupBy' + $ref: '#/components/schemas/group_by' tags: description: List of tags items: @@ -1313,6 +1818,10 @@ components: title: Create SLO response type: object "409_response": + example: + error: Conflict + message: "SLO [d077e940-1515-11ee-9c50-9d096392f520] already exists" + statusCode: 409 properties: statusCode: example: 409 @@ -1350,7 +1859,7 @@ components: settings: $ref: '#/components/schemas/settings' groupBy: - $ref: '#/components/schemas/slo_response_groupBy' + $ref: '#/components/schemas/group_by' tags: description: List of tags items: @@ -1358,43 +1867,227 @@ components: type: array title: Update SLO request type: object - historical_summary_request: - properties: - list: - description: The list of SLO identifiers to get the historical summary for - items: - example: 8853df00-ae2e-11ed-90af-09bb6422b258 - type: string - type: array - required: - - list - title: Historical summary request - type: object - historical_summary_response: - additionalProperties: - items: - $ref: '#/components/schemas/Historical_summary_response_inner' - type: array - title: Historical summary response - type: object - delete_slo_instances_request: - description: | - The delete SLO instances request takes a list of SLO id and instance id, then delete the rollup and summary data. This API can be used to remove the staled data of an instance SLO that no longer get updated. - properties: - list: - description: An array of slo id and instance id - items: - $ref: '#/components/schemas/delete_slo_instances_request_list_inner' - type: array - required: - - list - title: Delete SLO instances request - type: object - indicator_properties_apm_availability_params: - description: An object containing the indicator parameters. - nullable: false + slo_definition_response: + example: + indicator: + params: + filter: "field.environment : \"production\" and service.name : \"my-service\"" + dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 + total: "field.environment : \"production\" and service.name : \"my-service\"" + index: my-service-* + timestampField: timestamp + good: "request.latency <= 150 and request.status_code : \"2xx\"" + type: sli.kql.custom + settings: + syncField: event.ingested + preventInitialBackfill: true + syncDelay: 5m + frequency: 5m + timeWindow: + duration: 30d + type: rolling + description: My SLO description + groupBy: + - - service.name + - service.name + - - service.name + - service.environment + version: 2 + enabled: true + objective: + timesliceWindow: 5m + timesliceTarget: 0.995 + target: 0.99 + revision: 2 + tags: + - tags + - tags + createdAt: 2023-01-12T10:03:19.000Z + name: My Service SLO + id: 8853df00-ae2e-11ed-90af-09bb6422b258 + budgetingMethod: occurrences + updatedAt: 2023-01-12T10:03:19.000Z properties: - service: + id: + description: The identifier of the SLO. + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + type: string + name: + description: The name of the SLO. + example: My Service SLO + type: string + description: + description: The description of the SLO. + example: My SLO description + type: string + indicator: + $ref: '#/components/schemas/slo_with_summary_response_indicator' + 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 + example: 2 + type: number + enabled: + description: Indicate if the SLO is enabled + example: true + type: boolean + groupBy: + $ref: '#/components/schemas/group_by' + tags: + description: List of tags + items: + type: string + type: array + createdAt: + description: The creation date + example: 2023-01-12T10:03:19.000Z + type: string + updatedAt: + description: The last update date + example: 2023-01-12T10:03:19.000Z + type: string + version: + description: The internal SLO version + example: 2 + type: number + required: + - budgetingMethod + - createdAt + - description + - enabled + - groupBy + - id + - indicator + - name + - objective + - revision + - settings + - tags + - timeWindow + - updatedAt + - version + title: SLO definition response + type: object + bulk_purge_rollup_request: + description: | + The bulk purge rollup data request takes a list of SLO ids and a purge policy, then deletes the rollup data according to the purge policy. This API can be used to remove the staled data of an instance SLO that no longer get updated. + properties: + list: + description: An array of slo ids + items: + description: The SLO Definition id + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + type: string + type: array + purgePolicy: + $ref: '#/components/schemas/bulk_purge_rollup_request_purgePolicy' + required: + - list + - purgePolicy + title: Bulk Purge Rollup data request + type: object + bulk_purge_rollup_response: + description: | + The bulk purge rollup data response returns a task id from the elasticsearch deleteByQuery response. + example: + taskId: 8853df00-ae2e-11ed-90af-09bb6422b258 + properties: + taskId: + description: The task id of the purge operation + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + type: string + title: Bulk Purge Rollup data response + type: object + find_slo_definitions_response: + description: | + A paginated response of SLO definitions matching the query. + oneOf: + - $ref: '#/components/schemas/find_slo_definitions_response_oneOf' + - $ref: '#/components/schemas/find_slo_definitions_response_oneOf_1' + title: Find SLO definitions response + type: object + delete_slo_instances_request: + description: | + The delete SLO instances request takes a list of SLO id and instance id, then delete the rollup and summary data. This API can be used to remove the staled data of an instance SLO that no longer get updated. + properties: + list: + description: An array of slo id and instance id + items: + $ref: '#/components/schemas/delete_slo_instances_request_list_inner' + type: array + required: + - list + title: Delete SLO instances request + type: object + bulk_delete_request: + description: | + The bulk delete SLO request takes a list of SLOs Definition id to delete. + properties: + list: + description: An array of SLO Definition id + items: + description: The SLO Definition id + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + type: string + type: array + required: + - list + title: Bulk delete SLO request + type: object + bulk_delete_response: + description: | + The bulk delete SLO response returns a taskId that can be used to poll for its status + example: + taskId: d08506b7-f0e8-4f8b-a06a-a83940f4db91 + properties: + taskId: + description: The taskId of the bulk delete operation + example: d08506b7-f0e8-4f8b-a06a-a83940f4db91 + type: string + title: Bulk delete SLO response + type: object + bulk_delete_status_response: + description: "Indicates if the bulk deletion is completed, with the detailed\ + \ results of the operation." + example: + error: Task not found + isDone: true + results: + - success: true + id: d08506b7-f0e8-4f8b-a06a-a83940f4db91 + error: "SLO [d08506b7-f0e8-4f8b-a06a-a83940f4db91] not found" + - success: true + id: d08506b7-f0e8-4f8b-a06a-a83940f4db91 + error: "SLO [d08506b7-f0e8-4f8b-a06a-a83940f4db91] not found" + properties: + isDone: + description: Indicates if the bulk deletion operation is completed + example: true + type: boolean + error: + description: The error message if the bulk deletion operation failed + example: Task not found + type: string + results: + description: "The results of the bulk deletion operation, including the\ + \ success status and any errors for each SLO" + items: + $ref: '#/components/schemas/bulk_delete_status_response_results_inner' + type: array + title: The status of the bulk deletion + 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 @@ -1425,26 +2118,43 @@ components: - transactionName - transactionType type: object + kql_with_filters_oneOf: + properties: + kqlQuery: + type: string + filters: + items: + $ref: '#/components/schemas/filter' + type: array + type: object indicator_properties_custom_kql_params: description: An object containing the indicator parameters. + example: + filter: "field.environment : \"production\" and service.name : \"my-service\"" + dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 + total: "field.environment : \"production\" and service.name : \"my-service\"" + index: my-service-* + timestampField: timestamp + good: "request.latency <= 150 and request.status_code : \"2xx\"" 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\"" + dataViewId: + description: "The kibana data view id to use, primarily used to include\ + \ data view runtime mappings. Make sure to save SLO again if you add/update\ + \ run time fields to the data view and if those fields are being used\ + \ in slo queries." + example: 03b80ab3-003d-498b-881c-3beedbaf1162 type: string + filter: + $ref: '#/components/schemas/kql_with_filters' good: - description: the KQL query used to define the good events. - example: "request.latency <= 150 and request.status_code : \"2xx\"" - type: string + $ref: '#/components/schemas/kql_with_filters_good' total: - description: the KQL query used to define all events. - example: "" - type: string + $ref: '#/components/schemas/kql_with_filters_total' timestampField: description: | The timestamp field used in the source indice. @@ -1496,7 +2206,7 @@ components: - transactionName - transactionType type: object - indicator_properties_custom_metric_params_good_metrics_inner: + indicator_properties_custom_metric_params_good_metrics_inner_oneOf: properties: name: description: The name of the metric. Only valid options are A-Z @@ -1504,7 +2214,7 @@ components: pattern: "^[A-Z]$" type: string aggregation: - description: The aggregation type of the metric. Only valid option is "sum" + description: The aggregation type of the metric. enum: - sum example: sum @@ -1515,31 +2225,14 @@ components: type: string filter: description: The filter to apply to the metric. - example: "processor.outcome: \"success\"" + example: "processor.outcome: *" 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: + indicator_properties_custom_metric_params_good_metrics_inner_oneOf_1: properties: name: description: The name of the metric. Only valid options are A-Z @@ -1547,14 +2240,10 @@ components: pattern: "^[A-Z]$" type: string aggregation: - description: The aggregation type of the metric. Only valid option is "sum" + description: The aggregation type of the metric. enum: - - sum - example: sum - type: string - field: - description: The field of the metric. - example: processor.processed + - doc_count + example: doc_count type: string filter: description: The filter to apply to the metric. @@ -1562,9 +2251,29 @@ components: type: string required: - aggregation - - field - name type: object + indicator_properties_custom_metric_params_good_metrics_inner: + oneOf: + - $ref: '#/components/schemas/indicator_properties_custom_metric_params_good_metrics_inner_oneOf' + - $ref: '#/components/schemas/indicator_properties_custom_metric_params_good_metrics_inner_oneOf_1' + 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: description: | An object defining the "total" metrics and equation @@ -1572,7 +2281,7 @@ components: metrics: description: "List of metrics with their name, aggregation type, and field." items: - $ref: '#/components/schemas/indicator_properties_custom_metric_params_total_metrics_inner' + $ref: '#/components/schemas/indicator_properties_custom_metric_params_good_metrics_inner' type: array equation: description: The equation to calculate the "total" metric. @@ -1590,6 +2299,13 @@ components: description: The index or index pattern to use example: my-service-* type: string + dataViewId: + description: "The kibana data view id to use, primarily used to include\ + \ data view runtime mappings. Make sure to save SLO again if you add/update\ + \ run time fields to the data view and if those fields are being used\ + \ in slo queries." + example: 03b80ab3-003d-498b-881c-3beedbaf1162 + type: string filter: description: the KQL query to filter the documents with. example: "field.environment : \"production\" and service.name : \"my-service\"" @@ -1681,6 +2397,13 @@ components: description: The index or index pattern to use example: my-service-* type: string + dataViewId: + description: "The kibana data view id to use, primarily used to include\ + \ data view runtime mappings. Make sure to save SLO again if you add/update\ + \ run time fields to the data view and if those fields are being used\ + \ in slo queries." + example: 03b80ab3-003d-498b-881c-3beedbaf1162 + type: string filter: description: the KQL query to filter the documents with. example: "field.environment : \"production\" and service.name : \"my-service\"" @@ -1746,6 +2469,13 @@ components: description: The index or index pattern to use example: my-service-* type: string + dataViewId: + description: "The kibana data view id to use, primarily used to include\ + \ data view runtime mappings. Make sure to save SLO again if you add/update\ + \ run time fields to the data view and if those fields are being used\ + \ in slo queries." + example: 03b80ab3-003d-498b-881c-3beedbaf1162 + type: string filter: description: the KQL query to filter the documents with. example: "field.environment : \"production\" and service.name : \"my-service\"" @@ -1762,7 +2492,7 @@ components: - metric - timestampField type: object - slo_response_indicator: + slo_with_summary_response_indicator: discriminator: mapping: sli.apm.transactionErrorRate: '#/components/schemas/indicator_properties_apm_availability' @@ -1779,15 +2509,6 @@ components: - $ref: '#/components/schemas/indicator_properties_custom_metric' - $ref: '#/components/schemas/indicator_properties_histogram' - $ref: '#/components/schemas/indicator_properties_timeslice_metric' - slo_response_groupBy: - description: optional group by field to use to generate an SLO per distinct - value - example: some.field - oneOf: - - type: string - - items: - type: string - type: array create_slo_request_indicator: oneOf: - $ref: '#/components/schemas/indicator_properties_custom_kql' @@ -1796,18 +2517,185 @@ components: - $ref: '#/components/schemas/indicator_properties_custom_metric' - $ref: '#/components/schemas/indicator_properties_histogram' - $ref: '#/components/schemas/indicator_properties_timeslice_metric' - Historical_summary_response_inner: + bulk_purge_rollup_request_purgePolicy_oneOf: properties: - date: - example: 2022-01-01T00:00:00.000Z + purgeType: + description: Specifies whether documents will be purged based on a specific + age or on a timestamp + enum: + - fixed-age type: string - status: - $ref: '#/components/schemas/summary_status' - sliValue: - example: 0.9836 + age: + description: "The duration to determine which documents to purge, formatted\ + \ as {duration}{unit}. This value should be greater than or equal to the\ + \ time window of every SLO provided." + example: 7d + type: string + type: object + bulk_purge_rollup_request_purgePolicy_oneOf_1: + properties: + purgeType: + description: Specifies whether documents will be purged based on a specific + age or on a timestamp + enum: + - fixed-time + type: string + timestamp: + description: "The timestamp to determine which documents to purge, formatted\ + \ in ISO. This value should be older than the applicable time window of\ + \ every SLO provided." + example: 2024-12-31T00:00:00.000Z + type: string + type: object + bulk_purge_rollup_request_purgePolicy: + description: Policy that dictates which SLI documents to purge based on age + oneOf: + - $ref: '#/components/schemas/bulk_purge_rollup_request_purgePolicy_oneOf' + - $ref: '#/components/schemas/bulk_purge_rollup_request_purgePolicy_oneOf_1' + type: object + find_slo_definitions_response_oneOf: + example: + total: 34 + perPage: 25 + page: 1 + results: + - indicator: + params: + filter: "field.environment : \"production\" and service.name : \"my-service\"" + dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 + total: "field.environment : \"production\" and service.name : \"my-service\"" + index: my-service-* + timestampField: timestamp + good: "request.latency <= 150 and request.status_code : \"2xx\"" + type: sli.kql.custom + summary: + errorBudget: + consumed: 0.8 + isEstimated: true + initial: 0.02 + remaining: 0.2 + status: HEALTHY + sliValue: 0.9836 + settings: + syncField: event.ingested + preventInitialBackfill: true + syncDelay: 5m + frequency: 5m + timeWindow: + duration: 30d + type: rolling + description: My SLO description + groupBy: + - - service.name + - service.name + - - service.name + - service.environment + version: 2 + enabled: true + objective: + timesliceWindow: 5m + timesliceTarget: 0.995 + target: 0.99 + revision: 2 + tags: + - tags + - tags + createdAt: 2023-01-12T10:03:19.000Z + instanceId: host-abcde + name: My Service SLO + id: 8853df00-ae2e-11ed-90af-09bb6422b258 + budgetingMethod: occurrences + updatedAt: 2023-01-12T10:03:19.000Z + - indicator: + params: + filter: "field.environment : \"production\" and service.name : \"my-service\"" + dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 + total: "field.environment : \"production\" and service.name : \"my-service\"" + index: my-service-* + timestampField: timestamp + good: "request.latency <= 150 and request.status_code : \"2xx\"" + type: sli.kql.custom + summary: + errorBudget: + consumed: 0.8 + isEstimated: true + initial: 0.02 + remaining: 0.2 + status: HEALTHY + sliValue: 0.9836 + settings: + syncField: event.ingested + preventInitialBackfill: true + syncDelay: 5m + frequency: 5m + timeWindow: + duration: 30d + type: rolling + description: My SLO description + groupBy: + - - service.name + - service.name + - - service.name + - service.environment + version: 2 + enabled: true + objective: + timesliceWindow: 5m + timesliceTarget: 0.995 + target: 0.99 + revision: 2 + tags: + - tags + - tags + createdAt: 2023-01-12T10:03:19.000Z + instanceId: host-abcde + name: My Service SLO + id: 8853df00-ae2e-11ed-90af-09bb6422b258 + budgetingMethod: occurrences + updatedAt: 2023-01-12T10:03:19.000Z + properties: + page: + example: 1 type: number - errorBudget: - $ref: '#/components/schemas/error_budget' + perPage: + example: 25 + type: number + total: + example: 34 + type: number + results: + items: + $ref: '#/components/schemas/slo_with_summary_response' + type: array + type: object + find_slo_definitions_response_oneOf_1: + properties: + page: + default: 1 + description: for backward compability + type: number + perPage: + description: for backward compability + example: 25 + type: number + size: + example: 25 + type: number + searchAfter: + description: the cursor to provide to get the next paged results + example: + - some-slo-id + - other-cursor-id + items: + type: string + type: array + total: + example: 34 + type: number + results: + items: + $ref: '#/components/schemas/slo_with_summary_response' + type: array type: object delete_slo_instances_request_list_inner: properties: @@ -1823,12 +2711,23 @@ components: - instanceId - sloId type: object - securitySchemes: - basicAuth: - scheme: basic - type: http - apiKeyAuth: - description: "e.g. Authorization: ApiKey base64AccessApiKey" - in: header - name: Authorization - type: apiKey + bulk_delete_status_response_results_inner: + example: + success: true + id: d08506b7-f0e8-4f8b-a06a-a83940f4db91 + error: "SLO [d08506b7-f0e8-4f8b-a06a-a83940f4db91] not found" + properties: + id: + description: The ID of the SLO that was deleted + example: d08506b7-f0e8-4f8b-a06a-a83940f4db91 + type: string + success: + description: The result of the deletion operation for this SLO + example: true + type: boolean + error: + description: The error message if the deletion operation failed for this + SLO + example: "SLO [d08506b7-f0e8-4f8b-a06a-a83940f4db91] not found" + type: string + type: object diff --git a/generated/slo/api_slo.go b/generated/slo/api_slo.go index d4340c8c7..7bda4a35d 100644 --- a/generated/slo/api_slo.go +++ b/generated/slo/api_slo.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,216 +17,548 @@ import ( "net/http" "net/url" "strings" + "reflect" ) -type SloAPI interface { - /* - CreateSloOp Creates an SLO. +// SloAPIService SloAPI service +type SloAPIService service - You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. +type ApiBulkDeleteOpRequest struct { + ctx context.Context + ApiService *SloAPIService + kbnXsrf *string + spaceId string + bulkDeleteRequest *BulkDeleteRequest +} +// Cross-site request forgery protection +func (r ApiBulkDeleteOpRequest) KbnXsrf(kbnXsrf string) ApiBulkDeleteOpRequest { + r.kbnXsrf = &kbnXsrf + return r +} - @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 ApiCreateSloOpRequest - */ - CreateSloOp(ctx context.Context, spaceId string) ApiCreateSloOpRequest +func (r ApiBulkDeleteOpRequest) BulkDeleteRequest(bulkDeleteRequest BulkDeleteRequest) ApiBulkDeleteOpRequest { + r.bulkDeleteRequest = &bulkDeleteRequest + return r +} - // CreateSloOpExecute executes the request - // @return CreateSloResponse - CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloResponse, *http.Response, error) +func (r ApiBulkDeleteOpRequest) Execute() (*BulkDeleteResponse, *http.Response, error) { + return r.ApiService.BulkDeleteOpExecute(r) +} - /* - DeleteSloInstancesOp Batch delete rollup and summary data for the matching list of sloId and instanceId +/* +BulkDeleteOp Bulk delete SLO definitions and their associated summary and rollup data. - You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. +Bulk delete SLO definitions and their associated summary and rollup data. This endpoint initiates a bulk deletion operation for SLOs, which may take some time to complete. The status of the operation can be checked using the `GET /api/slo/_bulk_delete/{taskId}` endpoint. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - @return ApiDeleteSloInstancesOpRequest - */ - DeleteSloInstancesOp(ctx context.Context, spaceId string) ApiDeleteSloInstancesOpRequest + @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 ApiBulkDeleteOpRequest +*/ +func (a *SloAPIService) BulkDeleteOp(ctx context.Context, spaceId string) ApiBulkDeleteOpRequest { + return ApiBulkDeleteOpRequest{ + ApiService: a, + ctx: ctx, + spaceId: spaceId, + } +} - // DeleteSloInstancesOpExecute executes the request - DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpRequest) (*http.Response, error) +// Execute executes the request +// @return BulkDeleteResponse +func (a *SloAPIService) BulkDeleteOpExecute(r ApiBulkDeleteOpRequest) (*BulkDeleteResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BulkDeleteResponse + ) - /* - DeleteSloOp Deletes an SLO + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.BulkDeleteOp") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } - You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + localVarPath := localBasePath + "/s/{spaceId}/api/observability/slos/_bulk_delete" + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.kbnXsrf == nil { + return localVarReturnValue, nil, reportError("kbnXsrf is required and must be specified") + } + if r.bulkDeleteRequest == nil { + return localVarReturnValue, nil, reportError("bulkDeleteRequest is required and must be specified") + } - @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 ApiDeleteSloOpRequest - */ - DeleteSloOp(ctx context.Context, spaceId string, sloId string) ApiDeleteSloOpRequest + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} - // DeleteSloOpExecute executes the request - DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Response, error) + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } - /* - DisableSloOp Disables an SLO + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} - You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + // body params + localVarPostBody = r.bulkDeleteRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } - @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 ApiDisableSloOpRequest - */ - DisableSloOp(ctx context.Context, spaceId string, sloId string) ApiDisableSloOpRequest + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Model400Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Model401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return 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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBulkDeleteStatusOpRequest struct { + ctx context.Context + ApiService *SloAPIService + kbnXsrf *string + spaceId string + taskId string +} + +// Cross-site request forgery protection +func (r ApiBulkDeleteStatusOpRequest) KbnXsrf(kbnXsrf string) ApiBulkDeleteStatusOpRequest { + r.kbnXsrf = &kbnXsrf + return r +} + +func (r ApiBulkDeleteStatusOpRequest) Execute() (*BulkDeleteStatusResponse, *http.Response, error) { + return r.ApiService.BulkDeleteStatusOpExecute(r) +} + +/* +BulkDeleteStatusOp Retrieve the status of the bulk deletion + +Retrieve the status of the bulk deletion operation for SLOs. This endpoint returns the status of the bulk deletion operation, including whether it is completed and the results of the operation. + + + @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 taskId The task id of the bulk delete operation + @return ApiBulkDeleteStatusOpRequest +*/ +func (a *SloAPIService) BulkDeleteStatusOp(ctx context.Context, spaceId string, taskId string) ApiBulkDeleteStatusOpRequest { + return ApiBulkDeleteStatusOpRequest{ + ApiService: a, + ctx: ctx, + spaceId: spaceId, + taskId: taskId, + } +} + +// Execute executes the request +// @return BulkDeleteStatusResponse +func (a *SloAPIService) BulkDeleteStatusOpExecute(r ApiBulkDeleteStatusOpRequest) (*BulkDeleteStatusResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BulkDeleteStatusResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.BulkDeleteStatusOp") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/s/{spaceId}/api/observability/slos/_bulk_delete/{taskId}" + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"taskId"+"}", url.PathEscape(parameterValueToString(r.taskId, "taskId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.kbnXsrf == nil { + return localVarReturnValue, nil, reportError("kbnXsrf is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } - // DisableSloOpExecute executes the request - DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Response, error) + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } - /* - EnableSloOp Enables an SLO + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } - You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Model400Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Model401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return 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 + } + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } - @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 ApiEnableSloOpRequest - */ - EnableSloOp(ctx context.Context, spaceId string, sloId string) ApiEnableSloOpRequest + return localVarReturnValue, localVarHTTPResponse, nil +} - // EnableSloOpExecute executes the request - EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Response, error) +type ApiCreateSloOpRequest struct { + ctx context.Context + ApiService *SloAPIService + kbnXsrf *string + spaceId string + createSloRequest *CreateSloRequest +} - /* - FindSlosOp Retrieves a paginated list of SLOs +// Cross-site request forgery protection +func (r ApiCreateSloOpRequest) KbnXsrf(kbnXsrf string) ApiCreateSloOpRequest { + r.kbnXsrf = &kbnXsrf + return r +} - You must have the `read` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. +func (r ApiCreateSloOpRequest) CreateSloRequest(createSloRequest CreateSloRequest) ApiCreateSloOpRequest { + r.createSloRequest = &createSloRequest + return r +} +func (r ApiCreateSloOpRequest) Execute() (*CreateSloResponse, *http.Response, error) { + return r.ApiService.CreateSloOpExecute(r) +} - @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 ApiFindSlosOpRequest - */ - FindSlosOp(ctx context.Context, spaceId string) ApiFindSlosOpRequest +/* +CreateSloOp Create an SLO - // FindSlosOpExecute executes the request - // @return FindSloResponse - FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloResponse, *http.Response, error) +You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. - /* - 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. + @return ApiCreateSloOpRequest +*/ +func (a *SloAPIService) CreateSloOp(ctx context.Context, spaceId string) ApiCreateSloOpRequest { + return ApiCreateSloOpRequest{ + ApiService: a, + ctx: ctx, + spaceId: spaceId, + } +} +// Execute executes the request +// @return CreateSloResponse +func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateSloResponse + ) - @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 ApiGetSloOpRequest - */ - GetSloOp(ctx context.Context, spaceId string, sloId string) ApiGetSloOpRequest + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.CreateSloOp") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } - // GetSloOpExecute executes the request - // @return SloResponse - GetSloOpExecute(r ApiGetSloOpRequest) (*SloResponse, *http.Response, error) + localVarPath := localBasePath + "/s/{spaceId}/api/observability/slos" + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) - /* - HistoricalSummaryOp Retrieves the historical summary for a list of SLOs + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.kbnXsrf == nil { + return localVarReturnValue, nil, reportError("kbnXsrf is required and must be specified") + } + if r.createSloRequest == nil { + return localVarReturnValue, nil, reportError("createSloRequest is required and must be specified") + } - You must have the `read` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } - @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 ApiHistoricalSummaryOpRequest - */ - HistoricalSummaryOp(ctx context.Context, spaceId string) ApiHistoricalSummaryOpRequest + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} - // HistoricalSummaryOpExecute executes the request - // @return map[string][]HistoricalSummaryResponseInner - HistoricalSummaryOpExecute(r ApiHistoricalSummaryOpRequest) (*map[string][]HistoricalSummaryResponseInner, *http.Response, error) + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + // body params + localVarPostBody = r.createSloRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } - /* - UpdateSloOp Updates an SLO + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } - You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Model400Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Model401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return 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() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } - @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 ApiUpdateSloOpRequest - */ - UpdateSloOp(ctx context.Context, spaceId string, sloId string) ApiUpdateSloOpRequest + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } - // UpdateSloOpExecute executes the request - // @return SloResponse - UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloResponse, *http.Response, error) + return localVarReturnValue, localVarHTTPResponse, nil } -// SloAPIService SloAPI service -type SloAPIService service - -type ApiCreateSloOpRequest struct { - ctx context.Context - ApiService SloAPI - kbnXsrf *string - spaceId string - createSloRequest *CreateSloRequest +type ApiDeleteRollupDataOpRequest struct { + ctx context.Context + ApiService *SloAPIService + kbnXsrf *string + spaceId string + bulkPurgeRollupRequest *BulkPurgeRollupRequest } // Cross-site request forgery protection -func (r ApiCreateSloOpRequest) KbnXsrf(kbnXsrf string) ApiCreateSloOpRequest { +func (r ApiDeleteRollupDataOpRequest) KbnXsrf(kbnXsrf string) ApiDeleteRollupDataOpRequest { r.kbnXsrf = &kbnXsrf return r } -func (r ApiCreateSloOpRequest) CreateSloRequest(createSloRequest CreateSloRequest) ApiCreateSloOpRequest { - r.createSloRequest = &createSloRequest +func (r ApiDeleteRollupDataOpRequest) BulkPurgeRollupRequest(bulkPurgeRollupRequest BulkPurgeRollupRequest) ApiDeleteRollupDataOpRequest { + r.bulkPurgeRollupRequest = &bulkPurgeRollupRequest return r } -func (r ApiCreateSloOpRequest) Execute() (*CreateSloResponse, *http.Response, error) { - return r.ApiService.CreateSloOpExecute(r) +func (r ApiDeleteRollupDataOpRequest) Execute() (*BulkPurgeRollupResponse, *http.Response, error) { + return r.ApiService.DeleteRollupDataOpExecute(r) } /* -CreateSloOp Creates an SLO. +DeleteRollupDataOp Batch delete rollup and summary data -You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. +The deletion occurs for the specified list of `sloId`. 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 ApiCreateSloOpRequest + + @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 ApiDeleteRollupDataOpRequest */ -func (a *SloAPIService) CreateSloOp(ctx context.Context, spaceId string) ApiCreateSloOpRequest { - return ApiCreateSloOpRequest{ +func (a *SloAPIService) DeleteRollupDataOp(ctx context.Context, spaceId string) ApiDeleteRollupDataOpRequest { + return ApiDeleteRollupDataOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, + ctx: ctx, + spaceId: spaceId, } } // Execute executes the request -// -// @return CreateSloResponse -func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloResponse, *http.Response, error) { +// @return BulkPurgeRollupResponse +func (a *SloAPIService) DeleteRollupDataOpExecute(r ApiDeleteRollupDataOpRequest) (*BulkPurgeRollupResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *CreateSloResponse + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BulkPurgeRollupResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.CreateSloOp") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.DeleteRollupDataOp") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/s/{spaceId}/api/observability/slos" + localVarPath := localBasePath + "/s/{spaceId}/api/observability/slos/_bulk_purge_rollup" localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarHeaderParams := make(map[string]string) @@ -235,8 +567,8 @@ func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloR if r.kbnXsrf == nil { return localVarReturnValue, nil, reportError("kbnXsrf is required and must be specified") } - if r.createSloRequest == nil { - return localVarReturnValue, nil, reportError("createSloRequest is required and must be specified") + if r.bulkPurgeRollupRequest == nil { + return localVarReturnValue, nil, reportError("bulkPurgeRollupRequest is required and must be specified") } // to determine the Content-Type header @@ -256,23 +588,9 @@ func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloR if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") // body params - localVarPostBody = r.createSloRequest - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["Authorization"] = key - } - } - } + localVarPostBody = r.bulkPurgeRollupRequest req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -302,8 +620,8 @@ func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -313,8 +631,8 @@ func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -324,19 +642,8 @@ func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloR 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() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -354,10 +661,10 @@ func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloR } type ApiDeleteSloInstancesOpRequest struct { - ctx context.Context - ApiService SloAPI - kbnXsrf *string - spaceId string + ctx context.Context + ApiService *SloAPIService + kbnXsrf *string + spaceId string deleteSloInstancesRequest *DeleteSloInstancesRequest } @@ -377,28 +684,29 @@ func (r ApiDeleteSloInstancesOpRequest) Execute() (*http.Response, error) { } /* -DeleteSloInstancesOp Batch delete rollup and summary data for the matching list of sloId and instanceId +DeleteSloInstancesOp Batch delete rollup and summary data -You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. +The deletion occurs for the specified list of `sloId` and `instanceId`. You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - @return ApiDeleteSloInstancesOpRequest + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + @return ApiDeleteSloInstancesOpRequest */ func (a *SloAPIService) DeleteSloInstancesOp(ctx context.Context, spaceId string) ApiDeleteSloInstancesOpRequest { return ApiDeleteSloInstancesOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, + ctx: ctx, + spaceId: spaceId, } } // Execute executes the request func (a *SloAPIService) DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.DeleteSloInstancesOp") @@ -436,23 +744,9 @@ func (a *SloAPIService) DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpReq if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") // body params localVarPostBody = r.deleteSloInstancesRequest - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["Authorization"] = key - } - } - } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err @@ -482,8 +776,8 @@ func (a *SloAPIService) DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpReq newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -493,8 +787,8 @@ func (a *SloAPIService) DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpReq newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -504,8 +798,8 @@ func (a *SloAPIService) DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpReq newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarHTTPResponse, newErr } @@ -514,11 +808,11 @@ func (a *SloAPIService) DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpReq } type ApiDeleteSloOpRequest struct { - ctx context.Context - ApiService SloAPI - kbnXsrf *string - spaceId string - sloId string + ctx context.Context + ApiService *SloAPIService + kbnXsrf *string + spaceId string + sloId string } // Cross-site request forgery protection @@ -532,30 +826,31 @@ func (r ApiDeleteSloOpRequest) Execute() (*http.Response, error) { } /* -DeleteSloOp Deletes an SLO +DeleteSloOp Delete 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 ApiDeleteSloOpRequest + + @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 ApiDeleteSloOpRequest */ func (a *SloAPIService) DeleteSloOp(ctx context.Context, spaceId string, sloId string) ApiDeleteSloOpRequest { return ApiDeleteSloOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, - sloId: sloId, + ctx: ctx, + spaceId: spaceId, + sloId: sloId, } } // Execute executes the request func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.DeleteSloOp") @@ -591,21 +886,7 @@ func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Respo if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["Authorization"] = key - } - } - } + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err @@ -635,8 +916,8 @@ func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -646,8 +927,8 @@ func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -657,8 +938,8 @@ func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { @@ -668,8 +949,8 @@ func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarHTTPResponse, newErr } @@ -678,11 +959,11 @@ func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Respo } type ApiDisableSloOpRequest struct { - ctx context.Context - ApiService SloAPI - kbnXsrf *string - spaceId string - sloId string + ctx context.Context + ApiService *SloAPIService + kbnXsrf *string + spaceId string + sloId string } // Cross-site request forgery protection @@ -696,30 +977,31 @@ func (r ApiDisableSloOpRequest) Execute() (*http.Response, error) { } /* -DisableSloOp Disables an SLO +DisableSloOp Disable 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 ApiDisableSloOpRequest + + @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 ApiDisableSloOpRequest */ func (a *SloAPIService) DisableSloOp(ctx context.Context, spaceId string, sloId string) ApiDisableSloOpRequest { return ApiDisableSloOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, - sloId: sloId, + ctx: ctx, + spaceId: spaceId, + sloId: sloId, } } // Execute executes the request func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.DisableSloOp") @@ -755,21 +1037,7 @@ func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Res if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["Authorization"] = key - } - } - } + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err @@ -799,8 +1067,8 @@ func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Res newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -810,8 +1078,8 @@ func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Res newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -821,8 +1089,8 @@ func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Res newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { @@ -832,8 +1100,8 @@ func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Res newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarHTTPResponse, newErr } @@ -842,11 +1110,11 @@ func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Res } type ApiEnableSloOpRequest struct { - ctx context.Context - ApiService SloAPI - kbnXsrf *string - spaceId string - sloId string + ctx context.Context + ApiService *SloAPIService + kbnXsrf *string + spaceId string + sloId string } // Cross-site request forgery protection @@ -860,30 +1128,31 @@ func (r ApiEnableSloOpRequest) Execute() (*http.Response, error) { } /* -EnableSloOp Enables an SLO +EnableSloOp Enable 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 ApiEnableSloOpRequest + + @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 ApiEnableSloOpRequest */ func (a *SloAPIService) EnableSloOp(ctx context.Context, spaceId string, sloId string) ApiEnableSloOpRequest { return ApiEnableSloOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, - sloId: sloId, + ctx: ctx, + spaceId: spaceId, + sloId: sloId, } } // Execute executes the request func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.EnableSloOp") @@ -919,21 +1188,7 @@ func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Respo if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["Authorization"] = key - } - } - } + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err @@ -963,8 +1218,8 @@ func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -974,8 +1229,8 @@ func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -985,8 +1240,8 @@ func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { @@ -996,8 +1251,8 @@ func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarHTTPResponse, newErr } @@ -1006,15 +1261,18 @@ func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Respo } type ApiFindSlosOpRequest struct { - ctx context.Context - ApiService SloAPI - kbnXsrf *string - spaceId string - kqlQuery *string - page *int32 - perPage *int32 - sortBy *string + ctx context.Context + ApiService *SloAPIService + kbnXsrf *string + spaceId string + kqlQuery *string + size *int32 + searchAfter *[]string + page *int32 + perPage *int32 + sortBy *string sortDirection *string + hideStale *bool } // Cross-site request forgery protection @@ -1029,13 +1287,25 @@ func (r ApiFindSlosOpRequest) KqlQuery(kqlQuery string) ApiFindSlosOpRequest { return r } -// The page number to return +// The page size to use for cursor-based pagination, must be greater or equal than 1 +func (r ApiFindSlosOpRequest) Size(size int32) ApiFindSlosOpRequest { + r.size = &size + return r +} + +// The cursor to use for fetching the results from, when using a cursor-base pagination. +func (r ApiFindSlosOpRequest) SearchAfter(searchAfter []string) ApiFindSlosOpRequest { + r.searchAfter = &searchAfter + return r +} + +// The page to use for pagination, must be greater or equal than 1 func (r ApiFindSlosOpRequest) Page(page int32) ApiFindSlosOpRequest { r.page = &page return r } -// The number of SLOs to return per page +// Number of SLOs returned by page func (r ApiFindSlosOpRequest) PerPage(perPage int32) ApiFindSlosOpRequest { r.perPage = &perPage return r @@ -1053,36 +1323,42 @@ func (r ApiFindSlosOpRequest) SortDirection(sortDirection string) ApiFindSlosOpR return r } +// Hide stale SLOs from the list as defined by stale SLO threshold in SLO settings +func (r ApiFindSlosOpRequest) HideStale(hideStale bool) ApiFindSlosOpRequest { + r.hideStale = &hideStale + return r +} + func (r ApiFindSlosOpRequest) Execute() (*FindSloResponse, *http.Response, error) { return r.ApiService.FindSlosOpExecute(r) } /* -FindSlosOp Retrieves a paginated list of SLOs +FindSlosOp Get 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 ApiFindSlosOpRequest + + @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 ApiFindSlosOpRequest */ func (a *SloAPIService) FindSlosOp(ctx context.Context, spaceId string) ApiFindSlosOpRequest { return ApiFindSlosOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, + ctx: ctx, + spaceId: spaceId, } } // Execute executes the request -// -// @return FindSloResponse +// @return FindSloResponse func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *FindSloResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FindSloResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.FindSlosOp") @@ -1101,32 +1377,52 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo } if r.kqlQuery != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "kqlQuery", r.kqlQuery, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "kqlQuery", r.kqlQuery, "form", "") + } + if r.size != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "size", r.size, "form", "") + } else { + var defaultValue int32 = 1 + r.size = &defaultValue + } + if r.searchAfter != nil { + t := *r.searchAfter + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + parameterAddToHeaderOrQuery(localVarQueryParams, "searchAfter", s.Index(i).Interface(), "form", "multi") + } + } else { + parameterAddToHeaderOrQuery(localVarQueryParams, "searchAfter", t, "form", "multi") + } } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") } else { var defaultValue int32 = 1 r.page = &defaultValue } if r.perPage != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "perPage", r.perPage, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "perPage", r.perPage, "form", "") } else { var defaultValue int32 = 25 r.perPage = &defaultValue } if r.sortBy != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "sortBy", r.sortBy, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "sortBy", r.sortBy, "form", "") } else { var defaultValue string = "status" r.sortBy = &defaultValue } if r.sortDirection != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "sortDirection", r.sortDirection, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "sortDirection", r.sortDirection, "form", "") } else { var defaultValue string = "asc" r.sortDirection = &defaultValue } + if r.hideStale != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "hideStale", r.hideStale, "form", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1144,21 +1440,7 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["Authorization"] = key - } - } - } + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -1188,8 +1470,8 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -1199,8 +1481,8 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -1210,8 +1492,8 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { @@ -1221,8 +1503,208 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetDefinitionsOpRequest struct { + ctx context.Context + ApiService *SloAPIService + kbnXsrf *string + spaceId string + includeOutdatedOnly *bool + tags *string + search *string + page *float32 + perPage *int32 +} + +// Cross-site request forgery protection +func (r ApiGetDefinitionsOpRequest) KbnXsrf(kbnXsrf string) ApiGetDefinitionsOpRequest { + r.kbnXsrf = &kbnXsrf + return r +} + +// Indicates if the API returns only outdated SLO or all SLO definitions +func (r ApiGetDefinitionsOpRequest) IncludeOutdatedOnly(includeOutdatedOnly bool) ApiGetDefinitionsOpRequest { + r.includeOutdatedOnly = &includeOutdatedOnly + return r +} + +// Filters the SLOs by tag +func (r ApiGetDefinitionsOpRequest) Tags(tags string) ApiGetDefinitionsOpRequest { + r.tags = &tags + return r +} + +// Filters the SLOs by name +func (r ApiGetDefinitionsOpRequest) Search(search string) ApiGetDefinitionsOpRequest { + r.search = &search + return r +} + +// The page to use for pagination, must be greater or equal than 1 +func (r ApiGetDefinitionsOpRequest) Page(page float32) ApiGetDefinitionsOpRequest { + r.page = &page + return r +} + +// Number of SLOs returned by page +func (r ApiGetDefinitionsOpRequest) PerPage(perPage int32) ApiGetDefinitionsOpRequest { + r.perPage = &perPage + return r +} + +func (r ApiGetDefinitionsOpRequest) Execute() (*FindSloDefinitionsResponse, *http.Response, error) { + return r.ApiService.GetDefinitionsOpExecute(r) +} + +/* +GetDefinitionsOp Get the SLO definitions + +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 ApiGetDefinitionsOpRequest +*/ +func (a *SloAPIService) GetDefinitionsOp(ctx context.Context, spaceId string) ApiGetDefinitionsOpRequest { + return ApiGetDefinitionsOpRequest{ + ApiService: a, + ctx: ctx, + spaceId: spaceId, + } +} + +// Execute executes the request +// @return FindSloDefinitionsResponse +func (a *SloAPIService) GetDefinitionsOpExecute(r ApiGetDefinitionsOpRequest) (*FindSloDefinitionsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FindSloDefinitionsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.GetDefinitionsOp") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/s/{spaceId}/internal/observability/slos/_definitions" + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.kbnXsrf == nil { + return localVarReturnValue, nil, reportError("kbnXsrf is required and must be specified") + } + + if r.includeOutdatedOnly != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "includeOutdatedOnly", r.includeOutdatedOnly, "form", "") + } + if r.tags != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "tags", r.tags, "form", "") + } + if r.search != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "search", r.search, "form", "") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } + if r.perPage != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "perPage", r.perPage, "form", "") + } else { + var defaultValue int32 = 100 + r.perPage = &defaultValue + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Model400Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Model401Response + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return 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 } @@ -1240,11 +1722,11 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo } type ApiGetSloOpRequest struct { - ctx context.Context - ApiService SloAPI - kbnXsrf *string - spaceId string - sloId string + ctx context.Context + ApiService *SloAPIService + kbnXsrf *string + spaceId string + sloId string instanceId *string } @@ -1260,38 +1742,38 @@ func (r ApiGetSloOpRequest) InstanceId(instanceId string) ApiGetSloOpRequest { return r } -func (r ApiGetSloOpRequest) Execute() (*SloResponse, *http.Response, error) { +func (r ApiGetSloOpRequest) Execute() (*SloWithSummaryResponse, *http.Response, error) { return r.ApiService.GetSloOpExecute(r) } /* -GetSloOp Retrieves a SLO +GetSloOp Get an 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 ApiGetSloOpRequest + + @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 ApiGetSloOpRequest */ func (a *SloAPIService) GetSloOp(ctx context.Context, spaceId string, sloId string) ApiGetSloOpRequest { return ApiGetSloOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, - sloId: sloId, + ctx: ctx, + spaceId: spaceId, + sloId: sloId, } } // Execute executes the request -// -// @return SloResponse -func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloResponse, *http.Response, error) { +// @return SloWithSummaryResponse +func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloWithSummaryResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *SloResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SloWithSummaryResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.GetSloOp") @@ -1311,7 +1793,7 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloResponse, *ht } if r.instanceId != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "instanceId", r.instanceId, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "instanceId", r.instanceId, "form", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1330,21 +1812,7 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloResponse, *ht if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["Authorization"] = key - } - } - } + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -1374,8 +1842,8 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloResponse, *ht newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -1385,8 +1853,8 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloResponse, *ht newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -1396,8 +1864,8 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloResponse, *ht newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { @@ -1407,8 +1875,8 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloResponse, *ht newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1425,64 +1893,62 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloResponse, *ht return localVarReturnValue, localVarHTTPResponse, nil } -type ApiHistoricalSummaryOpRequest struct { - ctx context.Context - ApiService SloAPI - kbnXsrf *string - spaceId string - historicalSummaryRequest *HistoricalSummaryRequest +type ApiResetSloOpRequest struct { + ctx context.Context + ApiService *SloAPIService + kbnXsrf *string + spaceId string + sloId string } // Cross-site request forgery protection -func (r ApiHistoricalSummaryOpRequest) KbnXsrf(kbnXsrf string) ApiHistoricalSummaryOpRequest { +func (r ApiResetSloOpRequest) KbnXsrf(kbnXsrf string) ApiResetSloOpRequest { r.kbnXsrf = &kbnXsrf return r } -func (r ApiHistoricalSummaryOpRequest) HistoricalSummaryRequest(historicalSummaryRequest HistoricalSummaryRequest) ApiHistoricalSummaryOpRequest { - r.historicalSummaryRequest = &historicalSummaryRequest - return r -} - -func (r ApiHistoricalSummaryOpRequest) Execute() (*map[string][]HistoricalSummaryResponseInner, *http.Response, error) { - return r.ApiService.HistoricalSummaryOpExecute(r) +func (r ApiResetSloOpRequest) Execute() (*SloDefinitionResponse, *http.Response, error) { + return r.ApiService.ResetSloOpExecute(r) } /* -HistoricalSummaryOp Retrieves the historical summary for a list of SLOs +ResetSloOp Reset an SLO -You must have the `read` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. +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. - @return ApiHistoricalSummaryOpRequest + + @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 ApiResetSloOpRequest */ -func (a *SloAPIService) HistoricalSummaryOp(ctx context.Context, spaceId string) ApiHistoricalSummaryOpRequest { - return ApiHistoricalSummaryOpRequest{ +func (a *SloAPIService) ResetSloOp(ctx context.Context, spaceId string, sloId string) ApiResetSloOpRequest { + return ApiResetSloOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, + ctx: ctx, + spaceId: spaceId, + sloId: sloId, } } // Execute executes the request -// -// @return map[string][]HistoricalSummaryResponseInner -func (a *SloAPIService) HistoricalSummaryOpExecute(r ApiHistoricalSummaryOpRequest) (*map[string][]HistoricalSummaryResponseInner, *http.Response, error) { +// @return SloDefinitionResponse +func (a *SloAPIService) ResetSloOpExecute(r ApiResetSloOpRequest) (*SloDefinitionResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *map[string][]HistoricalSummaryResponseInner + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SloDefinitionResponse ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.HistoricalSummaryOp") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.ResetSloOp") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/s/{spaceId}/internal/observability/slos/_historical_summary" + localVarPath := localBasePath + "/s/{spaceId}/api/observability/slos/{sloId}/_reset" localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sloId"+"}", url.PathEscape(parameterValueToString(r.sloId, "sloId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1490,12 +1956,9 @@ func (a *SloAPIService) HistoricalSummaryOpExecute(r ApiHistoricalSummaryOpReque if r.kbnXsrf == nil { return localVarReturnValue, nil, reportError("kbnXsrf is required and must be specified") } - if r.historicalSummaryRequest == nil { - return localVarReturnValue, nil, reportError("historicalSummaryRequest is required and must be specified") - } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -1511,23 +1974,7 @@ func (a *SloAPIService) HistoricalSummaryOpExecute(r ApiHistoricalSummaryOpReque if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") - // body params - localVarPostBody = r.historicalSummaryRequest - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["Authorization"] = key - } - } - } + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -1557,8 +2004,8 @@ func (a *SloAPIService) HistoricalSummaryOpExecute(r ApiHistoricalSummaryOpReque newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -1568,8 +2015,8 @@ func (a *SloAPIService) HistoricalSummaryOpExecute(r ApiHistoricalSummaryOpReque newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -1579,8 +2026,19 @@ func (a *SloAPIService) HistoricalSummaryOpExecute(r ApiHistoricalSummaryOpReque newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + 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() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1598,11 +2056,11 @@ func (a *SloAPIService) HistoricalSummaryOpExecute(r ApiHistoricalSummaryOpReque } type ApiUpdateSloOpRequest struct { - ctx context.Context - ApiService SloAPI - kbnXsrf *string - spaceId string - sloId string + ctx context.Context + ApiService *SloAPIService + kbnXsrf *string + spaceId string + sloId string updateSloRequest *UpdateSloRequest } @@ -1617,38 +2075,38 @@ func (r ApiUpdateSloOpRequest) UpdateSloRequest(updateSloRequest UpdateSloReques return r } -func (r ApiUpdateSloOpRequest) Execute() (*SloResponse, *http.Response, error) { +func (r ApiUpdateSloOpRequest) Execute() (*SloDefinitionResponse, *http.Response, error) { return r.ApiService.UpdateSloOpExecute(r) } /* -UpdateSloOp Updates an SLO +UpdateSloOp Update 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 ApiUpdateSloOpRequest + + @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 ApiUpdateSloOpRequest */ func (a *SloAPIService) UpdateSloOp(ctx context.Context, spaceId string, sloId string) ApiUpdateSloOpRequest { return ApiUpdateSloOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, - sloId: sloId, + ctx: ctx, + spaceId: spaceId, + sloId: sloId, } } // Execute executes the request -// -// @return SloResponse -func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloResponse, *http.Response, error) { +// @return SloDefinitionResponse +func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloDefinitionResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPut - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *SloResponse + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SloDefinitionResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.UpdateSloOp") @@ -1687,23 +2145,9 @@ func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloRespons if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") // body params localVarPostBody = r.updateSloRequest - if r.ctx != nil { - // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { - if apiKey, ok := auth["apiKeyAuth"]; ok { - var key string - if apiKey.Prefix != "" { - key = apiKey.Prefix + " " + apiKey.Key - } else { - key = apiKey.Key - } - localVarHeaderParams["Authorization"] = key - } - } - } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -1733,8 +2177,8 @@ func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloRespons newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -1744,8 +2188,8 @@ func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloRespons newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -1755,8 +2199,8 @@ func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloRespons newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { @@ -1766,8 +2210,8 @@ func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloRespons newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/generated/slo/client.go b/generated/slo/client.go index 6a012a56f..8cf7fff4b 100644 --- a/generated/slo/client.go +++ b/generated/slo/client.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -31,16 +31,17 @@ import ( "strings" "time" "unicode/utf8" + ) var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) - xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) - queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") + queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) ) -// APIClient manages communication with the SLOs API v1.0 +// APIClient manages communication with the SLOs API v1.1 // In most cases there should be only one, shared, APIClient. type APIClient struct { cfg *Configuration @@ -48,7 +49,7 @@ type APIClient struct { // API Services - SloAPI SloAPI + SloAPI *SloAPIService } type service struct { @@ -124,15 +125,19 @@ func typeCheckParameter(obj interface{}, expected string, name string) error { return nil } -func parameterValueToString(obj interface{}, key string) string { +func parameterValueToString( obj interface{}, key string ) string { if reflect.TypeOf(obj).Kind() != reflect.Ptr { + if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { + return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) + } + return fmt.Sprintf("%v", obj) } - var param, ok = obj.(MappedNullable) + var param,ok = obj.(MappedNullable) if !ok { return "" } - dataMap, err := param.ToMap() + dataMap,err := param.ToMap() if err != nil { return "" } @@ -141,88 +146,92 @@ func parameterValueToString(obj interface{}, key string) string { // parameterAddToHeaderOrQuery adds the provided object to the request header or url query // supporting deep object syntax -func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { var v = reflect.ValueOf(obj) var value = "" if v == reflect.ValueOf(nil) { value = "null" } else { switch v.Kind() { - case reflect.Invalid: - value = "invalid" + case reflect.Invalid: + value = "invalid" - case reflect.Struct: - if t, ok := obj.(MappedNullable); ok { - dataMap, err := t.ToMap() - if err != nil { + case reflect.Struct: + if t,ok := obj.(MappedNullable); ok { + dataMap,err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) return } - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) - return - } - if t, ok := obj.(time.Time); ok { - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) - return - } - value = v.Type().String() + " value" - case reflect.Slice: - var indValue = reflect.ValueOf(obj) - if indValue == reflect.ValueOf(nil) { + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i:=0;i BulkDeleteResponse BulkDeleteOp(ctx, spaceId).KbnXsrf(kbnXsrf).BulkDeleteRequest(bulkDeleteRequest).Execute() + +Bulk delete SLO definitions and their associated summary and rollup data. + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +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. + bulkDeleteRequest := *openapiclient.NewBulkDeleteRequest([]string{"8853df00-ae2e-11ed-90af-09bb6422b258"}) // BulkDeleteRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.SloAPI.BulkDeleteOp(context.Background(), spaceId).KbnXsrf(kbnXsrf).BulkDeleteRequest(bulkDeleteRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.BulkDeleteOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BulkDeleteOp`: BulkDeleteResponse + fmt.Fprintf(os.Stdout, "Response from `SloAPI.BulkDeleteOp`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBulkDeleteOpRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **kbnXsrf** | **string** | Cross-site request forgery protection | + + **bulkDeleteRequest** | [**BulkDeleteRequest**](BulkDeleteRequest.md) | | + +### Return type + +[**BulkDeleteResponse**](BulkDeleteResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BulkDeleteStatusOp + +> BulkDeleteStatusResponse BulkDeleteStatusOp(ctx, spaceId, taskId).KbnXsrf(kbnXsrf).Execute() + +Retrieve the status of the bulk deletion + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +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. + taskId := "8853df00-ae2e-11ed-90af-09bb6422b258" // string | The task id of the bulk delete operation + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.SloAPI.BulkDeleteStatusOp(context.Background(), spaceId, taskId).KbnXsrf(kbnXsrf).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.BulkDeleteStatusOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BulkDeleteStatusOp`: BulkDeleteStatusResponse + fmt.Fprintf(os.Stdout, "Response from `SloAPI.BulkDeleteStatusOp`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**taskId** | **string** | The task id of the bulk delete operation | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBulkDeleteStatusOpRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **kbnXsrf** | **string** | Cross-site request forgery protection | + + + +### Return type + +[**BulkDeleteStatusResponse**](BulkDeleteStatusResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## CreateSloOp > CreateSloResponse CreateSloOp(ctx, spaceId).KbnXsrf(kbnXsrf).CreateSloRequest(createSloRequest).Execute() -Creates an SLO. +Create an SLO @@ -30,26 +183,26 @@ Creates an SLO. package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/elastic/terraform-provider-elasticstack/slo" + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" ) 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.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.SloAPI.CreateSloOp(context.Background(), spaceId).KbnXsrf(kbnXsrf).CreateSloRequest(createSloRequest).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.CreateSloOp``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `CreateSloOp`: CreateSloResponse - fmt.Fprintf(os.Stdout, "Response from `SloAPI.CreateSloOp`: %v\n", resp) + 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.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(float32(0.99))) // CreateSloRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.SloAPI.CreateSloOp(context.Background(), spaceId).KbnXsrf(kbnXsrf).CreateSloRequest(createSloRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.CreateSloOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateSloOp`: CreateSloResponse + fmt.Fprintf(os.Stdout, "Response from `SloAPI.CreateSloOp`: %v\n", resp) } ``` @@ -78,7 +231,81 @@ Name | Type | Description | Notes ### Authorization -[basicAuth](../README.md#basicAuth), [apiKeyAuth](../README.md#apiKeyAuth) +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteRollupDataOp + +> BulkPurgeRollupResponse DeleteRollupDataOp(ctx, spaceId).KbnXsrf(kbnXsrf).BulkPurgeRollupRequest(bulkPurgeRollupRequest).Execute() + +Batch delete rollup and summary data + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +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. + bulkPurgeRollupRequest := *openapiclient.NewBulkPurgeRollupRequest([]string{"8853df00-ae2e-11ed-90af-09bb6422b258"}, openapiclient.bulk_purge_rollup_request_purgePolicy{BulkPurgeRollupRequestPurgePolicyOneOf: openapiclient.NewBulkPurgeRollupRequestPurgePolicyOneOf()}) // BulkPurgeRollupRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.SloAPI.DeleteRollupDataOp(context.Background(), spaceId).KbnXsrf(kbnXsrf).BulkPurgeRollupRequest(bulkPurgeRollupRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.DeleteRollupDataOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DeleteRollupDataOp`: BulkPurgeRollupResponse + fmt.Fprintf(os.Stdout, "Response from `SloAPI.DeleteRollupDataOp`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteRollupDataOpRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **kbnXsrf** | **string** | Cross-site request forgery protection | + + **bulkPurgeRollupRequest** | [**BulkPurgeRollupRequest**](BulkPurgeRollupRequest.md) | | + +### Return type + +[**BulkPurgeRollupResponse**](BulkPurgeRollupResponse.md) + +### Authorization + +No authorization required ### HTTP request headers @@ -94,7 +321,7 @@ Name | Type | Description | Notes > DeleteSloInstancesOp(ctx, spaceId).KbnXsrf(kbnXsrf).DeleteSloInstancesRequest(deleteSloInstancesRequest).Execute() -Batch delete rollup and summary data for the matching list of sloId and instanceId +Batch delete rollup and summary data @@ -104,24 +331,24 @@ Batch delete rollup and summary data for the matching list of sloId and instance package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/elastic/terraform-provider-elasticstack/slo" + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" ) func main() { - kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection - spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - deleteSloInstancesRequest := *openapiclient.NewDeleteSloInstancesRequest([]openapiclient.DeleteSloInstancesRequestListInner{*openapiclient.NewDeleteSloInstancesRequestListInner("8853df00-ae2e-11ed-90af-09bb6422b258", "8853df00-ae2e-11ed-90af-09bb6422b258")}) // DeleteSloInstancesRequest | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.SloAPI.DeleteSloInstancesOp(context.Background(), spaceId).KbnXsrf(kbnXsrf).DeleteSloInstancesRequest(deleteSloInstancesRequest).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.DeleteSloInstancesOp``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection + spaceId := "default" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + deleteSloInstancesRequest := *openapiclient.NewDeleteSloInstancesRequest([]openapiclient.DeleteSloInstancesRequestListInner{*openapiclient.NewDeleteSloInstancesRequestListInner("8853df00-ae2e-11ed-90af-09bb6422b258", "8853df00-ae2e-11ed-90af-09bb6422b258")}) // DeleteSloInstancesRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.SloAPI.DeleteSloInstancesOp(context.Background(), spaceId).KbnXsrf(kbnXsrf).DeleteSloInstancesRequest(deleteSloInstancesRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.DeleteSloInstancesOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -150,7 +377,7 @@ Name | Type | Description | Notes ### Authorization -[basicAuth](../README.md#basicAuth), [apiKeyAuth](../README.md#apiKeyAuth) +No authorization required ### HTTP request headers @@ -166,7 +393,7 @@ Name | Type | Description | Notes > DeleteSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).Execute() -Deletes an SLO +Delete an SLO @@ -176,24 +403,24 @@ Deletes an SLO package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/elastic/terraform-provider-elasticstack/slo" + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" ) 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. - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.SloAPI.DeleteSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.DeleteSloOp``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + 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. + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.SloAPI.DeleteSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.DeleteSloOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -223,7 +450,7 @@ Name | Type | Description | Notes ### Authorization -[basicAuth](../README.md#basicAuth), [apiKeyAuth](../README.md#apiKeyAuth) +No authorization required ### HTTP request headers @@ -239,7 +466,7 @@ Name | Type | Description | Notes > DisableSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).Execute() -Disables an SLO +Disable an SLO @@ -249,24 +476,24 @@ Disables an SLO package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/elastic/terraform-provider-elasticstack/slo" + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" ) 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. - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.SloAPI.DisableSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.DisableSloOp``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + 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. + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.SloAPI.DisableSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.DisableSloOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -296,7 +523,7 @@ Name | Type | Description | Notes ### Authorization -[basicAuth](../README.md#basicAuth), [apiKeyAuth](../README.md#apiKeyAuth) +No authorization required ### HTTP request headers @@ -312,7 +539,7 @@ Name | Type | Description | Notes > EnableSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).Execute() -Enables an SLO +Enable an SLO @@ -322,24 +549,24 @@ Enables an SLO package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/elastic/terraform-provider-elasticstack/slo" + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" ) 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. - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.SloAPI.EnableSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.EnableSloOp``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } + 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. + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.SloAPI.EnableSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.EnableSloOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } } ``` @@ -369,7 +596,7 @@ Name | Type | Description | Notes ### Authorization -[basicAuth](../README.md#basicAuth), [apiKeyAuth](../README.md#apiKeyAuth) +No authorization required ### HTTP request headers @@ -383,9 +610,9 @@ Name | Type | Description | Notes ## FindSlosOp -> FindSloResponse FindSlosOp(ctx, spaceId).KbnXsrf(kbnXsrf).KqlQuery(kqlQuery).Page(page).PerPage(perPage).SortBy(sortBy).SortDirection(sortDirection).Execute() +> FindSloResponse FindSlosOp(ctx, spaceId).KbnXsrf(kbnXsrf).KqlQuery(kqlQuery).Size(size).SearchAfter(searchAfter).Page(page).PerPage(perPage).SortBy(sortBy).SortDirection(sortDirection).HideStale(hideStale).Execute() -Retrieves a paginated list of SLOs +Get a paginated list of SLOs @@ -395,30 +622,33 @@ Retrieves a paginated list of SLOs package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/elastic/terraform-provider-elasticstack/slo" + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" ) 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. - 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(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.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 `SloAPI.FindSlosOp``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `FindSlosOp`: FindSloResponse - fmt.Fprintf(os.Stdout, "Response from `SloAPI.FindSlosOp`: %v\n", resp) + 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. + kqlQuery := "slo.name:latency* and slo.tags : "prod"" // string | A valid kql query to filter the SLO with (optional) + size := int32(1) // int32 | The page size to use for cursor-based pagination, must be greater or equal than 1 (optional) (default to 1) + searchAfter := []string{"Inner_example"} // []string | The cursor to use for fetching the results from, when using a cursor-base pagination. (optional) + page := int32(1) // int32 | The page to use for pagination, must be greater or equal than 1 (optional) (default to 1) + perPage := int32(25) // int32 | Number of SLOs returned by page (optional) (default to 25) + sortBy := "status" // string | Sort by field (optional) (default to "status") + sortDirection := "asc" // string | Sort order (optional) (default to "asc") + hideStale := true // bool | Hide stale SLOs from the list as defined by stale SLO threshold in SLO settings (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.SloAPI.FindSlosOp(context.Background(), spaceId).KbnXsrf(kbnXsrf).KqlQuery(kqlQuery).Size(size).SearchAfter(searchAfter).Page(page).PerPage(perPage).SortBy(sortBy).SortDirection(sortDirection).HideStale(hideStale).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.FindSlosOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `FindSlosOp`: FindSloResponse + fmt.Fprintf(os.Stdout, "Response from `SloAPI.FindSlosOp`: %v\n", resp) } ``` @@ -440,10 +670,13 @@ Name | Type | Description | Notes **kbnXsrf** | **string** | Cross-site request forgery protection | **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] + **size** | **int32** | The page size to use for cursor-based pagination, must be greater or equal than 1 | [default to 1] + **searchAfter** | **[]string** | The cursor to use for fetching the results from, when using a cursor-base pagination. | + **page** | **int32** | The page to use for pagination, must be greater or equal than 1 | [default to 1] + **perPage** | **int32** | Number of SLOs returned by page | [default to 25] **sortBy** | **string** | Sort by field | [default to "status"] **sortDirection** | **string** | Sort order | [default to "asc"] + **hideStale** | **bool** | Hide stale SLOs from the list as defined by stale SLO threshold in SLO settings | ### Return type @@ -451,7 +684,89 @@ Name | Type | Description | Notes ### Authorization -[basicAuth](../README.md#basicAuth), [apiKeyAuth](../README.md#apiKeyAuth) +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetDefinitionsOp + +> FindSloDefinitionsResponse GetDefinitionsOp(ctx, spaceId).KbnXsrf(kbnXsrf).IncludeOutdatedOnly(includeOutdatedOnly).Tags(tags).Search(search).Page(page).PerPage(perPage).Execute() + +Get the SLO definitions + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +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. + includeOutdatedOnly := true // bool | Indicates if the API returns only outdated SLO or all SLO definitions (optional) + tags := "tags_example" // string | Filters the SLOs by tag (optional) + search := "my service availability" // string | Filters the SLOs by name (optional) + page := float32(1) // float32 | The page to use for pagination, must be greater or equal than 1 (optional) + perPage := int32(100) // int32 | Number of SLOs returned by page (optional) (default to 100) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.SloAPI.GetDefinitionsOp(context.Background(), spaceId).KbnXsrf(kbnXsrf).IncludeOutdatedOnly(includeOutdatedOnly).Tags(tags).Search(search).Page(page).PerPage(perPage).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.GetDefinitionsOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetDefinitionsOp`: FindSloDefinitionsResponse + fmt.Fprintf(os.Stdout, "Response from `SloAPI.GetDefinitionsOp`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetDefinitionsOpRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **kbnXsrf** | **string** | Cross-site request forgery protection | + + **includeOutdatedOnly** | **bool** | Indicates if the API returns only outdated SLO or all SLO definitions | + **tags** | **string** | Filters the SLOs by tag | + **search** | **string** | Filters the SLOs by name | + **page** | **float32** | The page to use for pagination, must be greater or equal than 1 | + **perPage** | **int32** | Number of SLOs returned by page | [default to 100] + +### Return type + +[**FindSloDefinitionsResponse**](FindSloDefinitionsResponse.md) + +### Authorization + +No authorization required ### HTTP request headers @@ -465,9 +780,9 @@ Name | Type | Description | Notes ## GetSloOp -> SloResponse GetSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).InstanceId(instanceId).Execute() +> SloWithSummaryResponse GetSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).InstanceId(instanceId).Execute() -Retrieves a SLO +Get an SLO @@ -477,27 +792,27 @@ Retrieves a SLO package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/elastic/terraform-provider-elasticstack/slo" + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" ) 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.SloAPI.GetSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).InstanceId(instanceId).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.GetSloOp``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GetSloOp`: SloResponse - fmt.Fprintf(os.Stdout, "Response from `SloAPI.GetSloOp`: %v\n", resp) + 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.SloAPI.GetSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).InstanceId(instanceId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.GetSloOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetSloOp`: SloWithSummaryResponse + fmt.Fprintf(os.Stdout, "Response from `SloAPI.GetSloOp`: %v\n", resp) } ``` @@ -524,11 +839,11 @@ Name | Type | Description | Notes ### Return type -[**SloResponse**](SloResponse.md) +[**SloWithSummaryResponse**](SloWithSummaryResponse.md) ### Authorization -[basicAuth](../README.md#basicAuth), [apiKeyAuth](../README.md#apiKeyAuth) +No authorization required ### HTTP request headers @@ -540,11 +855,11 @@ Name | Type | Description | Notes [[Back to README]](../README.md) -## HistoricalSummaryOp +## ResetSloOp -> map[string][]HistoricalSummaryResponseInner HistoricalSummaryOp(ctx, spaceId).KbnXsrf(kbnXsrf).HistoricalSummaryRequest(historicalSummaryRequest).Execute() +> SloDefinitionResponse ResetSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).Execute() -Retrieves the historical summary for a list of SLOs +Reset an SLO @@ -554,26 +869,26 @@ Retrieves the historical summary for a list of SLOs package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/elastic/terraform-provider-elasticstack/slo" + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" ) 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. - historicalSummaryRequest := *openapiclient.NewHistoricalSummaryRequest([]string{"8853df00-ae2e-11ed-90af-09bb6422b258"}) // HistoricalSummaryRequest | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.SloAPI.HistoricalSummaryOp(context.Background(), spaceId).KbnXsrf(kbnXsrf).HistoricalSummaryRequest(historicalSummaryRequest).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.HistoricalSummaryOp``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `HistoricalSummaryOp`: map[string][]HistoricalSummaryResponseInner - fmt.Fprintf(os.Stdout, "Response from `SloAPI.HistoricalSummaryOp`: %v\n", resp) + 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. + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.SloAPI.ResetSloOp(context.Background(), spaceId, sloId).KbnXsrf(kbnXsrf).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SloAPI.ResetSloOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ResetSloOp`: SloDefinitionResponse + fmt.Fprintf(os.Stdout, "Response from `SloAPI.ResetSloOp`: %v\n", resp) } ``` @@ -584,29 +899,30 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | +**sloId** | **string** | An identifier for the slo. | ### Other Parameters -Other parameters are passed through a pointer to a apiHistoricalSummaryOpRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiResetSloOpRequest struct via the builder pattern Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **kbnXsrf** | **string** | Cross-site request forgery protection | - **historicalSummaryRequest** | [**HistoricalSummaryRequest**](HistoricalSummaryRequest.md) | | + ### Return type -[**map[string][]HistoricalSummaryResponseInner**](array.md) +[**SloDefinitionResponse**](SloDefinitionResponse.md) ### Authorization -[basicAuth](../README.md#basicAuth), [apiKeyAuth](../README.md#apiKeyAuth) +No authorization required ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) @@ -616,9 +932,9 @@ Name | Type | Description | Notes ## UpdateSloOp -> SloResponse UpdateSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).UpdateSloRequest(updateSloRequest).Execute() +> SloDefinitionResponse UpdateSloOp(ctx, spaceId, sloId).KbnXsrf(kbnXsrf).UpdateSloRequest(updateSloRequest).Execute() -Updates an SLO +Update an SLO @@ -628,27 +944,27 @@ Updates an SLO package main import ( - "context" - "fmt" - "os" - openapiclient "github.com/elastic/terraform-provider-elasticstack/slo" + "context" + "fmt" + "os" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" ) 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. - updateSloRequest := *openapiclient.NewUpdateSloRequest() // UpdateSloRequest | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - 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 `SloAPI.UpdateSloOp``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `UpdateSloOp`: SloResponse - fmt.Fprintf(os.Stdout, "Response from `SloAPI.UpdateSloOp`: %v\n", resp) + 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. + updateSloRequest := *openapiclient.NewUpdateSloRequest() // UpdateSloRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + 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 `SloAPI.UpdateSloOp``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `UpdateSloOp`: SloDefinitionResponse + fmt.Fprintf(os.Stdout, "Response from `SloAPI.UpdateSloOp`: %v\n", resp) } ``` @@ -675,11 +991,11 @@ Name | Type | Description | Notes ### Return type -[**SloResponse**](SloResponse.md) +[**SloDefinitionResponse**](SloDefinitionResponse.md) ### Authorization -[basicAuth](../README.md#basicAuth), [apiKeyAuth](../README.md#apiKeyAuth) +No authorization required ### HTTP request headers diff --git a/generated/slo/docs/SloDefinitionResponse.md b/generated/slo/docs/SloDefinitionResponse.md new file mode 100644 index 000000000..529122f8b --- /dev/null +++ b/generated/slo/docs/SloDefinitionResponse.md @@ -0,0 +1,345 @@ +# SloDefinitionResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | The identifier of the SLO. | +**Name** | **string** | The name of the SLO. | +**Description** | **string** | The description of the SLO. | +**Indicator** | [**SloWithSummaryResponseIndicator**](SloWithSummaryResponseIndicator.md) | | +**TimeWindow** | [**TimeWindow**](TimeWindow.md) | | +**BudgetingMethod** | [**BudgetingMethod**](BudgetingMethod.md) | | +**Objective** | [**Objective**](Objective.md) | | +**Settings** | [**Settings**](Settings.md) | | +**Revision** | **float32** | The SLO revision | +**Enabled** | **bool** | Indicate if the SLO is enabled | +**GroupBy** | [**GroupBy**](GroupBy.md) | | +**Tags** | **[]string** | List of tags | +**CreatedAt** | **string** | The creation date | +**UpdatedAt** | **string** | The last update date | +**Version** | **float32** | The internal SLO version | + +## Methods + +### NewSloDefinitionResponse + +`func NewSloDefinitionResponse(id string, name string, description string, indicator SloWithSummaryResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float32, enabled bool, groupBy GroupBy, tags []string, createdAt string, updatedAt string, version float32, ) *SloDefinitionResponse` + +NewSloDefinitionResponse instantiates a new SloDefinitionResponse 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 + +### NewSloDefinitionResponseWithDefaults + +`func NewSloDefinitionResponseWithDefaults() *SloDefinitionResponse` + +NewSloDefinitionResponseWithDefaults instantiates a new SloDefinitionResponse 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 *SloDefinitionResponse) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *SloDefinitionResponse) 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 *SloDefinitionResponse) SetId(v string)` + +SetId sets Id field to given value. + + +### GetName + +`func (o *SloDefinitionResponse) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *SloDefinitionResponse) 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 *SloDefinitionResponse) SetName(v string)` + +SetName sets Name field to given value. + + +### GetDescription + +`func (o *SloDefinitionResponse) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *SloDefinitionResponse) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *SloDefinitionResponse) SetDescription(v string)` + +SetDescription sets Description field to given value. + + +### GetIndicator + +`func (o *SloDefinitionResponse) GetIndicator() SloWithSummaryResponseIndicator` + +GetIndicator returns the Indicator field if non-nil, zero value otherwise. + +### GetIndicatorOk + +`func (o *SloDefinitionResponse) GetIndicatorOk() (*SloWithSummaryResponseIndicator, 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 *SloDefinitionResponse) SetIndicator(v SloWithSummaryResponseIndicator)` + +SetIndicator sets Indicator field to given value. + + +### GetTimeWindow + +`func (o *SloDefinitionResponse) GetTimeWindow() TimeWindow` + +GetTimeWindow returns the TimeWindow field if non-nil, zero value otherwise. + +### GetTimeWindowOk + +`func (o *SloDefinitionResponse) 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 *SloDefinitionResponse) SetTimeWindow(v TimeWindow)` + +SetTimeWindow sets TimeWindow field to given value. + + +### GetBudgetingMethod + +`func (o *SloDefinitionResponse) GetBudgetingMethod() BudgetingMethod` + +GetBudgetingMethod returns the BudgetingMethod field if non-nil, zero value otherwise. + +### GetBudgetingMethodOk + +`func (o *SloDefinitionResponse) GetBudgetingMethodOk() (*BudgetingMethod, bool)` + +GetBudgetingMethodOk returns a tuple with the BudgetingMethod field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBudgetingMethod + +`func (o *SloDefinitionResponse) SetBudgetingMethod(v BudgetingMethod)` + +SetBudgetingMethod sets BudgetingMethod field to given value. + + +### GetObjective + +`func (o *SloDefinitionResponse) GetObjective() Objective` + +GetObjective returns the Objective field if non-nil, zero value otherwise. + +### GetObjectiveOk + +`func (o *SloDefinitionResponse) GetObjectiveOk() (*Objective, bool)` + +GetObjectiveOk returns a tuple with the Objective field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObjective + +`func (o *SloDefinitionResponse) SetObjective(v Objective)` + +SetObjective sets Objective field to given value. + + +### GetSettings + +`func (o *SloDefinitionResponse) GetSettings() Settings` + +GetSettings returns the Settings field if non-nil, zero value otherwise. + +### GetSettingsOk + +`func (o *SloDefinitionResponse) GetSettingsOk() (*Settings, bool)` + +GetSettingsOk returns a tuple with the Settings field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSettings + +`func (o *SloDefinitionResponse) SetSettings(v Settings)` + +SetSettings sets Settings field to given value. + + +### GetRevision + +`func (o *SloDefinitionResponse) GetRevision() float32` + +GetRevision returns the Revision field if non-nil, zero value otherwise. + +### GetRevisionOk + +`func (o *SloDefinitionResponse) GetRevisionOk() (*float32, 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 *SloDefinitionResponse) SetRevision(v float32)` + +SetRevision sets Revision field to given value. + + +### GetEnabled + +`func (o *SloDefinitionResponse) GetEnabled() bool` + +GetEnabled returns the Enabled field if non-nil, zero value otherwise. + +### GetEnabledOk + +`func (o *SloDefinitionResponse) GetEnabledOk() (*bool, bool)` + +GetEnabledOk returns a tuple with the Enabled field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnabled + +`func (o *SloDefinitionResponse) SetEnabled(v bool)` + +SetEnabled sets Enabled field to given value. + + +### GetGroupBy + +`func (o *SloDefinitionResponse) GetGroupBy() GroupBy` + +GetGroupBy returns the GroupBy field if non-nil, zero value otherwise. + +### GetGroupByOk + +`func (o *SloDefinitionResponse) GetGroupByOk() (*GroupBy, 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 *SloDefinitionResponse) SetGroupBy(v GroupBy)` + +SetGroupBy sets GroupBy field to given value. + + +### GetTags + +`func (o *SloDefinitionResponse) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *SloDefinitionResponse) GetTagsOk() (*[]string, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *SloDefinitionResponse) SetTags(v []string)` + +SetTags sets Tags field to given value. + + +### GetCreatedAt + +`func (o *SloDefinitionResponse) GetCreatedAt() string` + +GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise. + +### GetCreatedAtOk + +`func (o *SloDefinitionResponse) GetCreatedAtOk() (*string, bool)` + +GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCreatedAt + +`func (o *SloDefinitionResponse) SetCreatedAt(v string)` + +SetCreatedAt sets CreatedAt field to given value. + + +### GetUpdatedAt + +`func (o *SloDefinitionResponse) GetUpdatedAt() string` + +GetUpdatedAt returns the UpdatedAt field if non-nil, zero value otherwise. + +### GetUpdatedAtOk + +`func (o *SloDefinitionResponse) GetUpdatedAtOk() (*string, bool)` + +GetUpdatedAtOk returns a tuple with the UpdatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUpdatedAt + +`func (o *SloDefinitionResponse) SetUpdatedAt(v string)` + +SetUpdatedAt sets UpdatedAt field to given value. + + +### GetVersion + +`func (o *SloDefinitionResponse) GetVersion() float32` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *SloDefinitionResponse) GetVersionOk() (*float32, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *SloDefinitionResponse) SetVersion(v float32)` + +SetVersion sets Version 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/SloWithSummaryResponse.md b/generated/slo/docs/SloWithSummaryResponse.md new file mode 100644 index 000000000..643ebcf10 --- /dev/null +++ b/generated/slo/docs/SloWithSummaryResponse.md @@ -0,0 +1,387 @@ +# SloWithSummaryResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | The identifier of the SLO. | +**Name** | **string** | The name of the SLO. | +**Description** | **string** | The description of the SLO. | +**Indicator** | [**SloWithSummaryResponseIndicator**](SloWithSummaryResponseIndicator.md) | | +**TimeWindow** | [**TimeWindow**](TimeWindow.md) | | +**BudgetingMethod** | [**BudgetingMethod**](BudgetingMethod.md) | | +**Objective** | [**Objective**](Objective.md) | | +**Settings** | [**Settings**](Settings.md) | | +**Revision** | **float32** | The SLO revision | +**Summary** | [**Summary**](Summary.md) | | +**Enabled** | **bool** | Indicate if the SLO is enabled | +**GroupBy** | [**GroupBy**](GroupBy.md) | | +**InstanceId** | **string** | the value derived from the groupBy field, if present, otherwise '*' | +**Tags** | **[]string** | List of tags | +**CreatedAt** | **string** | The creation date | +**UpdatedAt** | **string** | The last update date | +**Version** | **float32** | The internal SLO version | + +## Methods + +### NewSloWithSummaryResponse + +`func NewSloWithSummaryResponse(id string, name string, description string, indicator SloWithSummaryResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float32, summary Summary, enabled bool, groupBy GroupBy, instanceId string, tags []string, createdAt string, updatedAt string, version float32, ) *SloWithSummaryResponse` + +NewSloWithSummaryResponse instantiates a new SloWithSummaryResponse 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 + +### NewSloWithSummaryResponseWithDefaults + +`func NewSloWithSummaryResponseWithDefaults() *SloWithSummaryResponse` + +NewSloWithSummaryResponseWithDefaults instantiates a new SloWithSummaryResponse 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 *SloWithSummaryResponse) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *SloWithSummaryResponse) 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 *SloWithSummaryResponse) SetId(v string)` + +SetId sets Id field to given value. + + +### GetName + +`func (o *SloWithSummaryResponse) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *SloWithSummaryResponse) 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 *SloWithSummaryResponse) SetName(v string)` + +SetName sets Name field to given value. + + +### GetDescription + +`func (o *SloWithSummaryResponse) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *SloWithSummaryResponse) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *SloWithSummaryResponse) SetDescription(v string)` + +SetDescription sets Description field to given value. + + +### GetIndicator + +`func (o *SloWithSummaryResponse) GetIndicator() SloWithSummaryResponseIndicator` + +GetIndicator returns the Indicator field if non-nil, zero value otherwise. + +### GetIndicatorOk + +`func (o *SloWithSummaryResponse) GetIndicatorOk() (*SloWithSummaryResponseIndicator, 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 *SloWithSummaryResponse) SetIndicator(v SloWithSummaryResponseIndicator)` + +SetIndicator sets Indicator field to given value. + + +### GetTimeWindow + +`func (o *SloWithSummaryResponse) GetTimeWindow() TimeWindow` + +GetTimeWindow returns the TimeWindow field if non-nil, zero value otherwise. + +### GetTimeWindowOk + +`func (o *SloWithSummaryResponse) 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 *SloWithSummaryResponse) SetTimeWindow(v TimeWindow)` + +SetTimeWindow sets TimeWindow field to given value. + + +### GetBudgetingMethod + +`func (o *SloWithSummaryResponse) GetBudgetingMethod() BudgetingMethod` + +GetBudgetingMethod returns the BudgetingMethod field if non-nil, zero value otherwise. + +### GetBudgetingMethodOk + +`func (o *SloWithSummaryResponse) GetBudgetingMethodOk() (*BudgetingMethod, bool)` + +GetBudgetingMethodOk returns a tuple with the BudgetingMethod field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBudgetingMethod + +`func (o *SloWithSummaryResponse) SetBudgetingMethod(v BudgetingMethod)` + +SetBudgetingMethod sets BudgetingMethod field to given value. + + +### GetObjective + +`func (o *SloWithSummaryResponse) GetObjective() Objective` + +GetObjective returns the Objective field if non-nil, zero value otherwise. + +### GetObjectiveOk + +`func (o *SloWithSummaryResponse) GetObjectiveOk() (*Objective, bool)` + +GetObjectiveOk returns a tuple with the Objective field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetObjective + +`func (o *SloWithSummaryResponse) SetObjective(v Objective)` + +SetObjective sets Objective field to given value. + + +### GetSettings + +`func (o *SloWithSummaryResponse) GetSettings() Settings` + +GetSettings returns the Settings field if non-nil, zero value otherwise. + +### GetSettingsOk + +`func (o *SloWithSummaryResponse) GetSettingsOk() (*Settings, bool)` + +GetSettingsOk returns a tuple with the Settings field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSettings + +`func (o *SloWithSummaryResponse) SetSettings(v Settings)` + +SetSettings sets Settings field to given value. + + +### GetRevision + +`func (o *SloWithSummaryResponse) GetRevision() float32` + +GetRevision returns the Revision field if non-nil, zero value otherwise. + +### GetRevisionOk + +`func (o *SloWithSummaryResponse) GetRevisionOk() (*float32, 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 *SloWithSummaryResponse) SetRevision(v float32)` + +SetRevision sets Revision field to given value. + + +### GetSummary + +`func (o *SloWithSummaryResponse) GetSummary() Summary` + +GetSummary returns the Summary field if non-nil, zero value otherwise. + +### GetSummaryOk + +`func (o *SloWithSummaryResponse) GetSummaryOk() (*Summary, bool)` + +GetSummaryOk returns a tuple with the Summary field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSummary + +`func (o *SloWithSummaryResponse) SetSummary(v Summary)` + +SetSummary sets Summary field to given value. + + +### GetEnabled + +`func (o *SloWithSummaryResponse) GetEnabled() bool` + +GetEnabled returns the Enabled field if non-nil, zero value otherwise. + +### GetEnabledOk + +`func (o *SloWithSummaryResponse) GetEnabledOk() (*bool, bool)` + +GetEnabledOk returns a tuple with the Enabled field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEnabled + +`func (o *SloWithSummaryResponse) SetEnabled(v bool)` + +SetEnabled sets Enabled field to given value. + + +### GetGroupBy + +`func (o *SloWithSummaryResponse) GetGroupBy() GroupBy` + +GetGroupBy returns the GroupBy field if non-nil, zero value otherwise. + +### GetGroupByOk + +`func (o *SloWithSummaryResponse) GetGroupByOk() (*GroupBy, 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 *SloWithSummaryResponse) SetGroupBy(v GroupBy)` + +SetGroupBy sets GroupBy field to given value. + + +### GetInstanceId + +`func (o *SloWithSummaryResponse) GetInstanceId() string` + +GetInstanceId returns the InstanceId field if non-nil, zero value otherwise. + +### GetInstanceIdOk + +`func (o *SloWithSummaryResponse) 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 *SloWithSummaryResponse) SetInstanceId(v string)` + +SetInstanceId sets InstanceId field to given value. + + +### GetTags + +`func (o *SloWithSummaryResponse) GetTags() []string` + +GetTags returns the Tags field if non-nil, zero value otherwise. + +### GetTagsOk + +`func (o *SloWithSummaryResponse) GetTagsOk() (*[]string, bool)` + +GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTags + +`func (o *SloWithSummaryResponse) SetTags(v []string)` + +SetTags sets Tags field to given value. + + +### GetCreatedAt + +`func (o *SloWithSummaryResponse) GetCreatedAt() string` + +GetCreatedAt returns the CreatedAt field if non-nil, zero value otherwise. + +### GetCreatedAtOk + +`func (o *SloWithSummaryResponse) GetCreatedAtOk() (*string, bool)` + +GetCreatedAtOk returns a tuple with the CreatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCreatedAt + +`func (o *SloWithSummaryResponse) SetCreatedAt(v string)` + +SetCreatedAt sets CreatedAt field to given value. + + +### GetUpdatedAt + +`func (o *SloWithSummaryResponse) GetUpdatedAt() string` + +GetUpdatedAt returns the UpdatedAt field if non-nil, zero value otherwise. + +### GetUpdatedAtOk + +`func (o *SloWithSummaryResponse) GetUpdatedAtOk() (*string, bool)` + +GetUpdatedAtOk returns a tuple with the UpdatedAt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUpdatedAt + +`func (o *SloWithSummaryResponse) SetUpdatedAt(v string)` + +SetUpdatedAt sets UpdatedAt field to given value. + + +### GetVersion + +`func (o *SloWithSummaryResponse) GetVersion() float32` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *SloWithSummaryResponse) GetVersionOk() (*float32, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *SloWithSummaryResponse) SetVersion(v float32)` + +SetVersion sets Version 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/SloWithSummaryResponseIndicator.md b/generated/slo/docs/SloWithSummaryResponseIndicator.md new file mode 100644 index 000000000..269441cc0 --- /dev/null +++ b/generated/slo/docs/SloWithSummaryResponseIndicator.md @@ -0,0 +1,72 @@ +# SloWithSummaryResponseIndicator + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Params** | [**IndicatorPropertiesTimesliceMetricParams**](IndicatorPropertiesTimesliceMetricParams.md) | | +**Type** | **string** | The type of indicator. | + +## Methods + +### NewSloWithSummaryResponseIndicator + +`func NewSloWithSummaryResponseIndicator(params IndicatorPropertiesTimesliceMetricParams, type_ string, ) *SloWithSummaryResponseIndicator` + +NewSloWithSummaryResponseIndicator instantiates a new SloWithSummaryResponseIndicator 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 + +### NewSloWithSummaryResponseIndicatorWithDefaults + +`func NewSloWithSummaryResponseIndicatorWithDefaults() *SloWithSummaryResponseIndicator` + +NewSloWithSummaryResponseIndicatorWithDefaults instantiates a new SloWithSummaryResponseIndicator 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 *SloWithSummaryResponseIndicator) GetParams() IndicatorPropertiesTimesliceMetricParams` + +GetParams returns the Params field if non-nil, zero value otherwise. + +### GetParamsOk + +`func (o *SloWithSummaryResponseIndicator) GetParamsOk() (*IndicatorPropertiesTimesliceMetricParams, bool)` + +GetParamsOk returns a tuple with the Params field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetParams + +`func (o *SloWithSummaryResponseIndicator) SetParams(v IndicatorPropertiesTimesliceMetricParams)` + +SetParams sets Params field to given value. + + +### GetType + +`func (o *SloWithSummaryResponseIndicator) GetType() string` + +GetType returns the Type field if non-nil, zero value otherwise. + +### GetTypeOk + +`func (o *SloWithSummaryResponseIndicator) 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 *SloWithSummaryResponseIndicator) 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/Summary.md b/generated/slo/docs/Summary.md index 56b7e11c7..3df6985a6 100644 --- a/generated/slo/docs/Summary.md +++ b/generated/slo/docs/Summary.md @@ -5,14 +5,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Status** | [**SummaryStatus**](SummaryStatus.md) | | -**SliValue** | **float64** | | +**SliValue** | **float32** | | **ErrorBudget** | [**ErrorBudget**](ErrorBudget.md) | | ## Methods ### NewSummary -`func NewSummary(status SummaryStatus, sliValue float64, errorBudget ErrorBudget, ) *Summary` +`func NewSummary(status SummaryStatus, sliValue float32, errorBudget ErrorBudget, ) *Summary` NewSummary instantiates a new Summary object This constructor will assign default values to properties that have it defined, @@ -49,20 +49,20 @@ SetStatus sets Status field to given value. ### GetSliValue -`func (o *Summary) GetSliValue() float64` +`func (o *Summary) GetSliValue() float32` GetSliValue returns the SliValue field if non-nil, zero value otherwise. ### GetSliValueOk -`func (o *Summary) GetSliValueOk() (*float64, bool)` +`func (o *Summary) GetSliValueOk() (*float32, 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 float64)` +`func (o *Summary) SetSliValue(v float32)` SetSliValue sets SliValue field to given value. diff --git a/generated/slo/docs/TimesliceMetricPercentileMetric.md b/generated/slo/docs/TimesliceMetricPercentileMetric.md index 2b873b06d..0791c0d8f 100644 --- a/generated/slo/docs/TimesliceMetricPercentileMetric.md +++ b/generated/slo/docs/TimesliceMetricPercentileMetric.md @@ -7,14 +7,14 @@ Name | Type | Description | Notes **Name** | **string** | The name of the metric. Only valid options are A-Z | **Aggregation** | **string** | The aggregation type of the metric. Only valid option is \"percentile\" | **Field** | **string** | The field of the metric. | -**Percentile** | **float64** | The percentile value. | +**Percentile** | **float32** | The percentile value. | **Filter** | Pointer to **string** | The filter to apply to the metric. | [optional] ## Methods ### NewTimesliceMetricPercentileMetric -`func NewTimesliceMetricPercentileMetric(name string, aggregation string, field string, percentile float64, ) *TimesliceMetricPercentileMetric` +`func NewTimesliceMetricPercentileMetric(name string, aggregation string, field string, percentile float32, ) *TimesliceMetricPercentileMetric` NewTimesliceMetricPercentileMetric instantiates a new TimesliceMetricPercentileMetric object This constructor will assign default values to properties that have it defined, @@ -91,20 +91,20 @@ SetField sets Field field to given value. ### GetPercentile -`func (o *TimesliceMetricPercentileMetric) GetPercentile() float64` +`func (o *TimesliceMetricPercentileMetric) GetPercentile() float32` GetPercentile returns the Percentile field if non-nil, zero value otherwise. ### GetPercentileOk -`func (o *TimesliceMetricPercentileMetric) GetPercentileOk() (*float64, bool)` +`func (o *TimesliceMetricPercentileMetric) GetPercentileOk() (*float32, bool)` GetPercentileOk returns a tuple with the Percentile field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetPercentile -`func (o *TimesliceMetricPercentileMetric) SetPercentile(v float64)` +`func (o *TimesliceMetricPercentileMetric) SetPercentile(v float32)` SetPercentile sets Percentile field to given value. diff --git a/generated/slo/docs/UpdateSloRequest.md b/generated/slo/docs/UpdateSloRequest.md index 2a4cdb393..4518217c5 100644 --- a/generated/slo/docs/UpdateSloRequest.md +++ b/generated/slo/docs/UpdateSloRequest.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **BudgetingMethod** | Pointer to [**BudgetingMethod**](BudgetingMethod.md) | | [optional] **Objective** | Pointer to [**Objective**](Objective.md) | | [optional] **Settings** | Pointer to [**Settings**](Settings.md) | | [optional] -**GroupBy** | Pointer to [**SloResponseGroupBy**](SloResponseGroupBy.md) | | [optional] +**GroupBy** | Pointer to [**GroupBy**](GroupBy.md) | | [optional] **Tags** | Pointer to **[]string** | List of tags | [optional] ## Methods @@ -210,20 +210,20 @@ HasSettings returns a boolean if a field has been set. ### GetGroupBy -`func (o *UpdateSloRequest) GetGroupBy() SloResponseGroupBy` +`func (o *UpdateSloRequest) GetGroupBy() GroupBy` GetGroupBy returns the GroupBy field if non-nil, zero value otherwise. ### GetGroupByOk -`func (o *UpdateSloRequest) GetGroupByOk() (*SloResponseGroupBy, bool)` +`func (o *UpdateSloRequest) GetGroupByOk() (*GroupBy, 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 *UpdateSloRequest) SetGroupBy(v SloResponseGroupBy)` +`func (o *UpdateSloRequest) SetGroupBy(v GroupBy)` SetGroupBy sets GroupBy field to given value. diff --git a/generated/slo/git_push.sh b/generated/slo/git_push.sh index 9c304b700..f53a75d4f 100644 --- a/generated/slo/git_push.sh +++ b/generated/slo/git_push.sh @@ -14,12 +14,12 @@ if [ "$git_host" = "" ]; then fi if [ "$git_user_id" = "" ]; then - git_user_id="elastic" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="terraform-provider-elasticstack" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/generated/slo/go.mod b/generated/slo/go.mod new file mode 100644 index 000000000..e5402f85f --- /dev/null +++ b/generated/slo/go.mod @@ -0,0 +1,7 @@ +module github.com/GIT_USER_ID/GIT_REPO_ID + +go 1.18 + +require ( + gopkg.in/validator.v2 v2.0.1 +) diff --git a/generated/slo/go.sum b/generated/slo/go.sum new file mode 100644 index 000000000..525afa0f3 --- /dev/null +++ b/generated/slo/go.sum @@ -0,0 +1,13 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +gopkg.in/validator.v2 v2.0.1 h1:xF0KWyGWXm/LM2G1TrEjqOu4pa6coO9AlWSf3msVfDY= +gopkg.in/validator.v2 v2.0.1/go.mod h1:lIUZBlB3Im4s/eYp39Ry/wkR02yOPhZ9IwIRBjuPuG8= diff --git a/generated/slo/model_400_response.go b/generated/slo/model_400_response.go index 1965ef831..148a52293 100644 --- a/generated/slo/model_400_response.go +++ b/generated/slo/model_400_response.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the Model400Response type satisfies the MappedNullable interface at compile time @@ -19,16 +21,18 @@ var _ MappedNullable = &Model400Response{} // Model400Response struct for Model400Response type Model400Response struct { - StatusCode float64 `json:"statusCode"` - Error string `json:"error"` - Message string `json:"message"` + StatusCode float32 `json:"statusCode"` + Error string `json:"error"` + Message string `json:"message"` } +type _Model400Response Model400Response + // 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 { +func NewModel400Response(statusCode float32, error_ string, message string) *Model400Response { this := Model400Response{} this.StatusCode = statusCode this.Error = error_ @@ -45,9 +49,9 @@ func NewModel400ResponseWithDefaults() *Model400Response { } // GetStatusCode returns the StatusCode field value -func (o *Model400Response) GetStatusCode() float64 { +func (o *Model400Response) GetStatusCode() float32 { if o == nil { - var ret float64 + var ret float32 return ret } @@ -56,7 +60,7 @@ func (o *Model400Response) GetStatusCode() float64 { // 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) { +func (o *Model400Response) GetStatusCodeOk() (*float32, bool) { if o == nil { return nil, false } @@ -64,7 +68,7 @@ func (o *Model400Response) GetStatusCodeOk() (*float64, bool) { } // SetStatusCode sets field value -func (o *Model400Response) SetStatusCode(v float64) { +func (o *Model400Response) SetStatusCode(v float32) { o.StatusCode = v } @@ -117,7 +121,7 @@ func (o *Model400Response) SetMessage(v string) { } func (o Model400Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -132,6 +136,45 @@ func (o Model400Response) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *Model400Response) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "statusCode", + "error", + "message", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varModel400Response := _Model400Response{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varModel400Response) + + if err != nil { + return err + } + + *o = Model400Response(varModel400Response) + + return err +} + type NullableModel400Response struct { value *Model400Response isSet bool @@ -167,3 +210,5 @@ 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 index b4f7f83e7..a92c05586 100644 --- a/generated/slo/model_401_response.go +++ b/generated/slo/model_401_response.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the Model401Response type satisfies the MappedNullable interface at compile time @@ -19,16 +21,18 @@ var _ MappedNullable = &Model401Response{} // Model401Response struct for Model401Response type Model401Response struct { - StatusCode float64 `json:"statusCode"` - Error string `json:"error"` - Message string `json:"message"` + StatusCode float32 `json:"statusCode"` + Error string `json:"error"` + Message string `json:"message"` } +type _Model401Response 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 -func NewModel401Response(statusCode float64, error_ string, message string) *Model401Response { +func NewModel401Response(statusCode float32, error_ string, message string) *Model401Response { this := Model401Response{} this.StatusCode = statusCode this.Error = error_ @@ -45,9 +49,9 @@ func NewModel401ResponseWithDefaults() *Model401Response { } // GetStatusCode returns the StatusCode field value -func (o *Model401Response) GetStatusCode() float64 { +func (o *Model401Response) GetStatusCode() float32 { if o == nil { - var ret float64 + var ret float32 return ret } @@ -56,7 +60,7 @@ func (o *Model401Response) GetStatusCode() float64 { // 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) { +func (o *Model401Response) GetStatusCodeOk() (*float32, bool) { if o == nil { return nil, false } @@ -64,7 +68,7 @@ func (o *Model401Response) GetStatusCodeOk() (*float64, bool) { } // SetStatusCode sets field value -func (o *Model401Response) SetStatusCode(v float64) { +func (o *Model401Response) SetStatusCode(v float32) { o.StatusCode = v } @@ -117,7 +121,7 @@ func (o *Model401Response) SetMessage(v string) { } func (o Model401Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -132,6 +136,45 @@ func (o Model401Response) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *Model401Response) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "statusCode", + "error", + "message", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varModel401Response := _Model401Response{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varModel401Response) + + if err != nil { + return err + } + + *o = Model401Response(varModel401Response) + + return err +} + type NullableModel401Response struct { value *Model401Response isSet bool @@ -167,3 +210,5 @@ func (v *NullableModel401Response) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_403_response.go b/generated/slo/model_403_response.go index 4ccd57a9a..16cfaacb3 100644 --- a/generated/slo/model_403_response.go +++ b/generated/slo/model_403_response.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the Model403Response type satisfies the MappedNullable interface at compile time @@ -19,16 +21,18 @@ var _ MappedNullable = &Model403Response{} // Model403Response struct for Model403Response type Model403Response struct { - StatusCode float64 `json:"statusCode"` - Error string `json:"error"` - Message string `json:"message"` + StatusCode float32 `json:"statusCode"` + Error string `json:"error"` + Message string `json:"message"` } +type _Model403Response 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 -func NewModel403Response(statusCode float64, error_ string, message string) *Model403Response { +func NewModel403Response(statusCode float32, error_ string, message string) *Model403Response { this := Model403Response{} this.StatusCode = statusCode this.Error = error_ @@ -45,9 +49,9 @@ func NewModel403ResponseWithDefaults() *Model403Response { } // GetStatusCode returns the StatusCode field value -func (o *Model403Response) GetStatusCode() float64 { +func (o *Model403Response) GetStatusCode() float32 { if o == nil { - var ret float64 + var ret float32 return ret } @@ -56,7 +60,7 @@ func (o *Model403Response) GetStatusCode() float64 { // GetStatusCodeOk returns a tuple with the StatusCode field value // and a boolean to check if the value has been set. -func (o *Model403Response) GetStatusCodeOk() (*float64, bool) { +func (o *Model403Response) GetStatusCodeOk() (*float32, bool) { if o == nil { return nil, false } @@ -64,7 +68,7 @@ func (o *Model403Response) GetStatusCodeOk() (*float64, bool) { } // SetStatusCode sets field value -func (o *Model403Response) SetStatusCode(v float64) { +func (o *Model403Response) SetStatusCode(v float32) { o.StatusCode = v } @@ -117,7 +121,7 @@ func (o *Model403Response) SetMessage(v string) { } func (o Model403Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -132,6 +136,45 @@ func (o Model403Response) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *Model403Response) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "statusCode", + "error", + "message", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varModel403Response := _Model403Response{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varModel403Response) + + if err != nil { + return err + } + + *o = Model403Response(varModel403Response) + + return err +} + type NullableModel403Response struct { value *Model403Response isSet bool @@ -167,3 +210,5 @@ 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 index a52e5d6e3..439102677 100644 --- a/generated/slo/model_404_response.go +++ b/generated/slo/model_404_response.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the Model404Response type satisfies the MappedNullable interface at compile time @@ -19,16 +21,18 @@ var _ MappedNullable = &Model404Response{} // Model404Response struct for Model404Response type Model404Response struct { - StatusCode float64 `json:"statusCode"` - Error string `json:"error"` - Message string `json:"message"` + StatusCode float32 `json:"statusCode"` + Error string `json:"error"` + Message string `json:"message"` } +type _Model404Response 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 -func NewModel404Response(statusCode float64, error_ string, message string) *Model404Response { +func NewModel404Response(statusCode float32, error_ string, message string) *Model404Response { this := Model404Response{} this.StatusCode = statusCode this.Error = error_ @@ -45,9 +49,9 @@ func NewModel404ResponseWithDefaults() *Model404Response { } // GetStatusCode returns the StatusCode field value -func (o *Model404Response) GetStatusCode() float64 { +func (o *Model404Response) GetStatusCode() float32 { if o == nil { - var ret float64 + var ret float32 return ret } @@ -56,7 +60,7 @@ func (o *Model404Response) GetStatusCode() float64 { // 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) { +func (o *Model404Response) GetStatusCodeOk() (*float32, bool) { if o == nil { return nil, false } @@ -64,7 +68,7 @@ func (o *Model404Response) GetStatusCodeOk() (*float64, bool) { } // SetStatusCode sets field value -func (o *Model404Response) SetStatusCode(v float64) { +func (o *Model404Response) SetStatusCode(v float32) { o.StatusCode = v } @@ -117,7 +121,7 @@ func (o *Model404Response) SetMessage(v string) { } func (o Model404Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -132,6 +136,45 @@ func (o Model404Response) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *Model404Response) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "statusCode", + "error", + "message", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varModel404Response := _Model404Response{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varModel404Response) + + if err != nil { + return err + } + + *o = Model404Response(varModel404Response) + + return err +} + type NullableModel404Response struct { value *Model404Response isSet bool @@ -167,3 +210,5 @@ 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 index 8d3405b68..59bbc657e 100644 --- a/generated/slo/model_409_response.go +++ b/generated/slo/model_409_response.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the Model409Response type satisfies the MappedNullable interface at compile time @@ -19,16 +21,18 @@ var _ MappedNullable = &Model409Response{} // Model409Response struct for Model409Response type Model409Response struct { - StatusCode float64 `json:"statusCode"` - Error string `json:"error"` - Message string `json:"message"` + StatusCode float32 `json:"statusCode"` + Error string `json:"error"` + Message string `json:"message"` } +type _Model409Response 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 -func NewModel409Response(statusCode float64, error_ string, message string) *Model409Response { +func NewModel409Response(statusCode float32, error_ string, message string) *Model409Response { this := Model409Response{} this.StatusCode = statusCode this.Error = error_ @@ -45,9 +49,9 @@ func NewModel409ResponseWithDefaults() *Model409Response { } // GetStatusCode returns the StatusCode field value -func (o *Model409Response) GetStatusCode() float64 { +func (o *Model409Response) GetStatusCode() float32 { if o == nil { - var ret float64 + var ret float32 return ret } @@ -56,7 +60,7 @@ func (o *Model409Response) GetStatusCode() float64 { // 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) { +func (o *Model409Response) GetStatusCodeOk() (*float32, bool) { if o == nil { return nil, false } @@ -64,7 +68,7 @@ func (o *Model409Response) GetStatusCodeOk() (*float64, bool) { } // SetStatusCode sets field value -func (o *Model409Response) SetStatusCode(v float64) { +func (o *Model409Response) SetStatusCode(v float32) { o.StatusCode = v } @@ -117,7 +121,7 @@ func (o *Model409Response) SetMessage(v string) { } func (o Model409Response) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -132,6 +136,45 @@ func (o Model409Response) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *Model409Response) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "statusCode", + "error", + "message", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varModel409Response := _Model409Response{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varModel409Response) + + if err != nil { + return err + } + + *o = Model409Response(varModel409Response) + + return err +} + type NullableModel409Response struct { value *Model409Response isSet bool @@ -167,3 +210,5 @@ 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 b22d09e1c..83d7abdf3 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -21,7 +21,7 @@ type BudgetingMethod string // List of budgeting_method const ( OCCURRENCES BudgetingMethod = "occurrences" - TIMESLICES BudgetingMethod = "timeslices" + TIMESLICES BudgetingMethod = "timeslices" ) // All allowed values of BudgetingMethod enum @@ -108,3 +108,4 @@ func (v *NullableBudgetingMethod) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + diff --git a/generated/slo/model_bulk_delete_request.go b/generated/slo/model_bulk_delete_request.go new file mode 100644 index 000000000..1c105cabe --- /dev/null +++ b/generated/slo/model_bulk_delete_request.go @@ -0,0 +1,159 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the BulkDeleteRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BulkDeleteRequest{} + +// BulkDeleteRequest The bulk delete SLO request takes a list of SLOs Definition id to delete. +type BulkDeleteRequest struct { + // An array of SLO Definition id + List []string `json:"list"` +} + +type _BulkDeleteRequest BulkDeleteRequest + +// NewBulkDeleteRequest instantiates a new BulkDeleteRequest 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 NewBulkDeleteRequest(list []string) *BulkDeleteRequest { + this := BulkDeleteRequest{} + this.List = list + return &this +} + +// NewBulkDeleteRequestWithDefaults instantiates a new BulkDeleteRequest 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 NewBulkDeleteRequestWithDefaults() *BulkDeleteRequest { + this := BulkDeleteRequest{} + return &this +} + +// GetList returns the List field value +func (o *BulkDeleteRequest) GetList() []string { + if o == nil { + var ret []string + return ret + } + + return o.List +} + +// GetListOk returns a tuple with the List field value +// and a boolean to check if the value has been set. +func (o *BulkDeleteRequest) GetListOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.List, true +} + +// SetList sets field value +func (o *BulkDeleteRequest) SetList(v []string) { + o.List = v +} + +func (o BulkDeleteRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BulkDeleteRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["list"] = o.List + return toSerialize, nil +} + +func (o *BulkDeleteRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "list", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varBulkDeleteRequest := _BulkDeleteRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varBulkDeleteRequest) + + if err != nil { + return err + } + + *o = BulkDeleteRequest(varBulkDeleteRequest) + + return err +} + +type NullableBulkDeleteRequest struct { + value *BulkDeleteRequest + isSet bool +} + +func (v NullableBulkDeleteRequest) Get() *BulkDeleteRequest { + return v.value +} + +func (v *NullableBulkDeleteRequest) Set(val *BulkDeleteRequest) { + v.value = val + v.isSet = true +} + +func (v NullableBulkDeleteRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableBulkDeleteRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBulkDeleteRequest(val *BulkDeleteRequest) *NullableBulkDeleteRequest { + return &NullableBulkDeleteRequest{value: val, isSet: true} +} + +func (v NullableBulkDeleteRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBulkDeleteRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_bulk_delete_response.go b/generated/slo/model_bulk_delete_response.go new file mode 100644 index 000000000..ffa8afd0b --- /dev/null +++ b/generated/slo/model_bulk_delete_response.go @@ -0,0 +1,127 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the BulkDeleteResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BulkDeleteResponse{} + +// BulkDeleteResponse The bulk delete SLO response returns a taskId that can be used to poll for its status +type BulkDeleteResponse struct { + // The taskId of the bulk delete operation + TaskId *string `json:"taskId,omitempty"` +} + +// NewBulkDeleteResponse instantiates a new BulkDeleteResponse 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 NewBulkDeleteResponse() *BulkDeleteResponse { + this := BulkDeleteResponse{} + return &this +} + +// NewBulkDeleteResponseWithDefaults instantiates a new BulkDeleteResponse 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 NewBulkDeleteResponseWithDefaults() *BulkDeleteResponse { + this := BulkDeleteResponse{} + return &this +} + +// GetTaskId returns the TaskId field value if set, zero value otherwise. +func (o *BulkDeleteResponse) GetTaskId() string { + if o == nil || IsNil(o.TaskId) { + var ret string + return ret + } + return *o.TaskId +} + +// GetTaskIdOk returns a tuple with the TaskId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BulkDeleteResponse) GetTaskIdOk() (*string, bool) { + if o == nil || IsNil(o.TaskId) { + return nil, false + } + return o.TaskId, true +} + +// HasTaskId returns a boolean if a field has been set. +func (o *BulkDeleteResponse) HasTaskId() bool { + if o != nil && !IsNil(o.TaskId) { + return true + } + + return false +} + +// SetTaskId gets a reference to the given string and assigns it to the TaskId field. +func (o *BulkDeleteResponse) SetTaskId(v string) { + o.TaskId = &v +} + +func (o BulkDeleteResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BulkDeleteResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.TaskId) { + toSerialize["taskId"] = o.TaskId + } + return toSerialize, nil +} + +type NullableBulkDeleteResponse struct { + value *BulkDeleteResponse + isSet bool +} + +func (v NullableBulkDeleteResponse) Get() *BulkDeleteResponse { + return v.value +} + +func (v *NullableBulkDeleteResponse) Set(val *BulkDeleteResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBulkDeleteResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBulkDeleteResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBulkDeleteResponse(val *BulkDeleteResponse) *NullableBulkDeleteResponse { + return &NullableBulkDeleteResponse{value: val, isSet: true} +} + +func (v NullableBulkDeleteResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBulkDeleteResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_bulk_delete_status_response.go b/generated/slo/model_bulk_delete_status_response.go new file mode 100644 index 000000000..9af03cf4a --- /dev/null +++ b/generated/slo/model_bulk_delete_status_response.go @@ -0,0 +1,201 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the BulkDeleteStatusResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BulkDeleteStatusResponse{} + +// BulkDeleteStatusResponse Indicates if the bulk deletion is completed, with the detailed results of the operation. +type BulkDeleteStatusResponse struct { + // Indicates if the bulk deletion operation is completed + IsDone *bool `json:"isDone,omitempty"` + // The error message if the bulk deletion operation failed + Error *string `json:"error,omitempty"` + // The results of the bulk deletion operation, including the success status and any errors for each SLO + Results []BulkDeleteStatusResponseResultsInner `json:"results,omitempty"` +} + +// NewBulkDeleteStatusResponse instantiates a new BulkDeleteStatusResponse 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 NewBulkDeleteStatusResponse() *BulkDeleteStatusResponse { + this := BulkDeleteStatusResponse{} + return &this +} + +// NewBulkDeleteStatusResponseWithDefaults instantiates a new BulkDeleteStatusResponse 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 NewBulkDeleteStatusResponseWithDefaults() *BulkDeleteStatusResponse { + this := BulkDeleteStatusResponse{} + return &this +} + +// GetIsDone returns the IsDone field value if set, zero value otherwise. +func (o *BulkDeleteStatusResponse) GetIsDone() bool { + if o == nil || IsNil(o.IsDone) { + var ret bool + return ret + } + return *o.IsDone +} + +// GetIsDoneOk returns a tuple with the IsDone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BulkDeleteStatusResponse) GetIsDoneOk() (*bool, bool) { + if o == nil || IsNil(o.IsDone) { + return nil, false + } + return o.IsDone, true +} + +// HasIsDone returns a boolean if a field has been set. +func (o *BulkDeleteStatusResponse) HasIsDone() bool { + if o != nil && !IsNil(o.IsDone) { + return true + } + + return false +} + +// SetIsDone gets a reference to the given bool and assigns it to the IsDone field. +func (o *BulkDeleteStatusResponse) SetIsDone(v bool) { + o.IsDone = &v +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *BulkDeleteStatusResponse) GetError() string { + if o == nil || IsNil(o.Error) { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BulkDeleteStatusResponse) GetErrorOk() (*string, bool) { + if o == nil || IsNil(o.Error) { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *BulkDeleteStatusResponse) HasError() bool { + if o != nil && !IsNil(o.Error) { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *BulkDeleteStatusResponse) SetError(v string) { + o.Error = &v +} + +// GetResults returns the Results field value if set, zero value otherwise. +func (o *BulkDeleteStatusResponse) GetResults() []BulkDeleteStatusResponseResultsInner { + if o == nil || IsNil(o.Results) { + var ret []BulkDeleteStatusResponseResultsInner + return ret + } + return o.Results +} + +// GetResultsOk returns a tuple with the Results field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BulkDeleteStatusResponse) GetResultsOk() ([]BulkDeleteStatusResponseResultsInner, bool) { + if o == nil || IsNil(o.Results) { + return nil, false + } + return o.Results, true +} + +// HasResults returns a boolean if a field has been set. +func (o *BulkDeleteStatusResponse) HasResults() bool { + if o != nil && !IsNil(o.Results) { + return true + } + + return false +} + +// SetResults gets a reference to the given []BulkDeleteStatusResponseResultsInner and assigns it to the Results field. +func (o *BulkDeleteStatusResponse) SetResults(v []BulkDeleteStatusResponseResultsInner) { + o.Results = v +} + +func (o BulkDeleteStatusResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BulkDeleteStatusResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.IsDone) { + toSerialize["isDone"] = o.IsDone + } + if !IsNil(o.Error) { + toSerialize["error"] = o.Error + } + if !IsNil(o.Results) { + toSerialize["results"] = o.Results + } + return toSerialize, nil +} + +type NullableBulkDeleteStatusResponse struct { + value *BulkDeleteStatusResponse + isSet bool +} + +func (v NullableBulkDeleteStatusResponse) Get() *BulkDeleteStatusResponse { + return v.value +} + +func (v *NullableBulkDeleteStatusResponse) Set(val *BulkDeleteStatusResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBulkDeleteStatusResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBulkDeleteStatusResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBulkDeleteStatusResponse(val *BulkDeleteStatusResponse) *NullableBulkDeleteStatusResponse { + return &NullableBulkDeleteStatusResponse{value: val, isSet: true} +} + +func (v NullableBulkDeleteStatusResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBulkDeleteStatusResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_bulk_delete_status_response_results_inner.go b/generated/slo/model_bulk_delete_status_response_results_inner.go new file mode 100644 index 000000000..830640661 --- /dev/null +++ b/generated/slo/model_bulk_delete_status_response_results_inner.go @@ -0,0 +1,201 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the BulkDeleteStatusResponseResultsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BulkDeleteStatusResponseResultsInner{} + +// BulkDeleteStatusResponseResultsInner struct for BulkDeleteStatusResponseResultsInner +type BulkDeleteStatusResponseResultsInner struct { + // The ID of the SLO that was deleted + Id *string `json:"id,omitempty"` + // The result of the deletion operation for this SLO + Success *bool `json:"success,omitempty"` + // The error message if the deletion operation failed for this SLO + Error *string `json:"error,omitempty"` +} + +// NewBulkDeleteStatusResponseResultsInner instantiates a new BulkDeleteStatusResponseResultsInner 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 NewBulkDeleteStatusResponseResultsInner() *BulkDeleteStatusResponseResultsInner { + this := BulkDeleteStatusResponseResultsInner{} + return &this +} + +// NewBulkDeleteStatusResponseResultsInnerWithDefaults instantiates a new BulkDeleteStatusResponseResultsInner 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 NewBulkDeleteStatusResponseResultsInnerWithDefaults() *BulkDeleteStatusResponseResultsInner { + this := BulkDeleteStatusResponseResultsInner{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BulkDeleteStatusResponseResultsInner) 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 *BulkDeleteStatusResponseResultsInner) 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 *BulkDeleteStatusResponseResultsInner) 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 *BulkDeleteStatusResponseResultsInner) SetId(v string) { + o.Id = &v +} + +// GetSuccess returns the Success field value if set, zero value otherwise. +func (o *BulkDeleteStatusResponseResultsInner) GetSuccess() bool { + if o == nil || IsNil(o.Success) { + var ret bool + return ret + } + return *o.Success +} + +// GetSuccessOk returns a tuple with the Success field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BulkDeleteStatusResponseResultsInner) GetSuccessOk() (*bool, bool) { + if o == nil || IsNil(o.Success) { + return nil, false + } + return o.Success, true +} + +// HasSuccess returns a boolean if a field has been set. +func (o *BulkDeleteStatusResponseResultsInner) HasSuccess() bool { + if o != nil && !IsNil(o.Success) { + return true + } + + return false +} + +// SetSuccess gets a reference to the given bool and assigns it to the Success field. +func (o *BulkDeleteStatusResponseResultsInner) SetSuccess(v bool) { + o.Success = &v +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *BulkDeleteStatusResponseResultsInner) GetError() string { + if o == nil || IsNil(o.Error) { + var ret string + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BulkDeleteStatusResponseResultsInner) GetErrorOk() (*string, bool) { + if o == nil || IsNil(o.Error) { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *BulkDeleteStatusResponseResultsInner) HasError() bool { + if o != nil && !IsNil(o.Error) { + return true + } + + return false +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *BulkDeleteStatusResponseResultsInner) SetError(v string) { + o.Error = &v +} + +func (o BulkDeleteStatusResponseResultsInner) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BulkDeleteStatusResponseResultsInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Success) { + toSerialize["success"] = o.Success + } + if !IsNil(o.Error) { + toSerialize["error"] = o.Error + } + return toSerialize, nil +} + +type NullableBulkDeleteStatusResponseResultsInner struct { + value *BulkDeleteStatusResponseResultsInner + isSet bool +} + +func (v NullableBulkDeleteStatusResponseResultsInner) Get() *BulkDeleteStatusResponseResultsInner { + return v.value +} + +func (v *NullableBulkDeleteStatusResponseResultsInner) Set(val *BulkDeleteStatusResponseResultsInner) { + v.value = val + v.isSet = true +} + +func (v NullableBulkDeleteStatusResponseResultsInner) IsSet() bool { + return v.isSet +} + +func (v *NullableBulkDeleteStatusResponseResultsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBulkDeleteStatusResponseResultsInner(val *BulkDeleteStatusResponseResultsInner) *NullableBulkDeleteStatusResponseResultsInner { + return &NullableBulkDeleteStatusResponseResultsInner{value: val, isSet: true} +} + +func (v NullableBulkDeleteStatusResponseResultsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBulkDeleteStatusResponseResultsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_bulk_purge_rollup_request.go b/generated/slo/model_bulk_purge_rollup_request.go new file mode 100644 index 000000000..27c5fa3b1 --- /dev/null +++ b/generated/slo/model_bulk_purge_rollup_request.go @@ -0,0 +1,187 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the BulkPurgeRollupRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BulkPurgeRollupRequest{} + +// BulkPurgeRollupRequest The bulk purge rollup data request takes a list of SLO ids and a purge policy, then deletes the rollup data according to the purge policy. This API can be used to remove the staled data of an instance SLO that no longer get updated. +type BulkPurgeRollupRequest struct { + // An array of slo ids + List []string `json:"list"` + PurgePolicy BulkPurgeRollupRequestPurgePolicy `json:"purgePolicy"` +} + +type _BulkPurgeRollupRequest BulkPurgeRollupRequest + +// NewBulkPurgeRollupRequest instantiates a new BulkPurgeRollupRequest 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 NewBulkPurgeRollupRequest(list []string, purgePolicy BulkPurgeRollupRequestPurgePolicy) *BulkPurgeRollupRequest { + this := BulkPurgeRollupRequest{} + this.List = list + this.PurgePolicy = purgePolicy + return &this +} + +// NewBulkPurgeRollupRequestWithDefaults instantiates a new BulkPurgeRollupRequest 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 NewBulkPurgeRollupRequestWithDefaults() *BulkPurgeRollupRequest { + this := BulkPurgeRollupRequest{} + return &this +} + +// GetList returns the List field value +func (o *BulkPurgeRollupRequest) GetList() []string { + if o == nil { + var ret []string + return ret + } + + return o.List +} + +// GetListOk returns a tuple with the List field value +// and a boolean to check if the value has been set. +func (o *BulkPurgeRollupRequest) GetListOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.List, true +} + +// SetList sets field value +func (o *BulkPurgeRollupRequest) SetList(v []string) { + o.List = v +} + +// GetPurgePolicy returns the PurgePolicy field value +func (o *BulkPurgeRollupRequest) GetPurgePolicy() BulkPurgeRollupRequestPurgePolicy { + if o == nil { + var ret BulkPurgeRollupRequestPurgePolicy + return ret + } + + return o.PurgePolicy +} + +// GetPurgePolicyOk returns a tuple with the PurgePolicy field value +// and a boolean to check if the value has been set. +func (o *BulkPurgeRollupRequest) GetPurgePolicyOk() (*BulkPurgeRollupRequestPurgePolicy, bool) { + if o == nil { + return nil, false + } + return &o.PurgePolicy, true +} + +// SetPurgePolicy sets field value +func (o *BulkPurgeRollupRequest) SetPurgePolicy(v BulkPurgeRollupRequestPurgePolicy) { + o.PurgePolicy = v +} + +func (o BulkPurgeRollupRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BulkPurgeRollupRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["list"] = o.List + toSerialize["purgePolicy"] = o.PurgePolicy + return toSerialize, nil +} + +func (o *BulkPurgeRollupRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "list", + "purgePolicy", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varBulkPurgeRollupRequest := _BulkPurgeRollupRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varBulkPurgeRollupRequest) + + if err != nil { + return err + } + + *o = BulkPurgeRollupRequest(varBulkPurgeRollupRequest) + + return err +} + +type NullableBulkPurgeRollupRequest struct { + value *BulkPurgeRollupRequest + isSet bool +} + +func (v NullableBulkPurgeRollupRequest) Get() *BulkPurgeRollupRequest { + return v.value +} + +func (v *NullableBulkPurgeRollupRequest) Set(val *BulkPurgeRollupRequest) { + v.value = val + v.isSet = true +} + +func (v NullableBulkPurgeRollupRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableBulkPurgeRollupRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBulkPurgeRollupRequest(val *BulkPurgeRollupRequest) *NullableBulkPurgeRollupRequest { + return &NullableBulkPurgeRollupRequest{value: val, isSet: true} +} + +func (v NullableBulkPurgeRollupRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBulkPurgeRollupRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_bulk_purge_rollup_request_purge_policy.go b/generated/slo/model_bulk_purge_rollup_request_purge_policy.go new file mode 100644 index 000000000..e9dc69195 --- /dev/null +++ b/generated/slo/model_bulk_purge_rollup_request_purge_policy.go @@ -0,0 +1,171 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "fmt" + "gopkg.in/validator.v2" +) + +// BulkPurgeRollupRequestPurgePolicy - Policy that dictates which SLI documents to purge based on age +type BulkPurgeRollupRequestPurgePolicy struct { + BulkPurgeRollupRequestPurgePolicyOneOf *BulkPurgeRollupRequestPurgePolicyOneOf + BulkPurgeRollupRequestPurgePolicyOneOf1 *BulkPurgeRollupRequestPurgePolicyOneOf1 +} + +// BulkPurgeRollupRequestPurgePolicyOneOfAsBulkPurgeRollupRequestPurgePolicy is a convenience function that returns BulkPurgeRollupRequestPurgePolicyOneOf wrapped in BulkPurgeRollupRequestPurgePolicy +func BulkPurgeRollupRequestPurgePolicyOneOfAsBulkPurgeRollupRequestPurgePolicy(v *BulkPurgeRollupRequestPurgePolicyOneOf) BulkPurgeRollupRequestPurgePolicy { + return BulkPurgeRollupRequestPurgePolicy{ + BulkPurgeRollupRequestPurgePolicyOneOf: v, + } +} + +// BulkPurgeRollupRequestPurgePolicyOneOf1AsBulkPurgeRollupRequestPurgePolicy is a convenience function that returns BulkPurgeRollupRequestPurgePolicyOneOf1 wrapped in BulkPurgeRollupRequestPurgePolicy +func BulkPurgeRollupRequestPurgePolicyOneOf1AsBulkPurgeRollupRequestPurgePolicy(v *BulkPurgeRollupRequestPurgePolicyOneOf1) BulkPurgeRollupRequestPurgePolicy { + return BulkPurgeRollupRequestPurgePolicy{ + BulkPurgeRollupRequestPurgePolicyOneOf1: v, + } +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *BulkPurgeRollupRequestPurgePolicy) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into BulkPurgeRollupRequestPurgePolicyOneOf + err = newStrictDecoder(data).Decode(&dst.BulkPurgeRollupRequestPurgePolicyOneOf) + if err == nil { + jsonBulkPurgeRollupRequestPurgePolicyOneOf, _ := json.Marshal(dst.BulkPurgeRollupRequestPurgePolicyOneOf) + if string(jsonBulkPurgeRollupRequestPurgePolicyOneOf) == "{}" { // empty struct + dst.BulkPurgeRollupRequestPurgePolicyOneOf = nil + } else { + if err = validator.Validate(dst.BulkPurgeRollupRequestPurgePolicyOneOf); err != nil { + dst.BulkPurgeRollupRequestPurgePolicyOneOf = nil + } else { + match++ + } + } + } else { + dst.BulkPurgeRollupRequestPurgePolicyOneOf = nil + } + + // try to unmarshal data into BulkPurgeRollupRequestPurgePolicyOneOf1 + err = newStrictDecoder(data).Decode(&dst.BulkPurgeRollupRequestPurgePolicyOneOf1) + if err == nil { + jsonBulkPurgeRollupRequestPurgePolicyOneOf1, _ := json.Marshal(dst.BulkPurgeRollupRequestPurgePolicyOneOf1) + if string(jsonBulkPurgeRollupRequestPurgePolicyOneOf1) == "{}" { // empty struct + dst.BulkPurgeRollupRequestPurgePolicyOneOf1 = nil + } else { + if err = validator.Validate(dst.BulkPurgeRollupRequestPurgePolicyOneOf1); err != nil { + dst.BulkPurgeRollupRequestPurgePolicyOneOf1 = nil + } else { + match++ + } + } + } else { + dst.BulkPurgeRollupRequestPurgePolicyOneOf1 = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.BulkPurgeRollupRequestPurgePolicyOneOf = nil + dst.BulkPurgeRollupRequestPurgePolicyOneOf1 = nil + + return fmt.Errorf("data matches more than one schema in oneOf(BulkPurgeRollupRequestPurgePolicy)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(BulkPurgeRollupRequestPurgePolicy)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src BulkPurgeRollupRequestPurgePolicy) MarshalJSON() ([]byte, error) { + if src.BulkPurgeRollupRequestPurgePolicyOneOf != nil { + return json.Marshal(&src.BulkPurgeRollupRequestPurgePolicyOneOf) + } + + if src.BulkPurgeRollupRequestPurgePolicyOneOf1 != nil { + return json.Marshal(&src.BulkPurgeRollupRequestPurgePolicyOneOf1) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *BulkPurgeRollupRequestPurgePolicy) GetActualInstance() (interface{}) { + if obj == nil { + return nil + } + if obj.BulkPurgeRollupRequestPurgePolicyOneOf != nil { + return obj.BulkPurgeRollupRequestPurgePolicyOneOf + } + + if obj.BulkPurgeRollupRequestPurgePolicyOneOf1 != nil { + return obj.BulkPurgeRollupRequestPurgePolicyOneOf1 + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj BulkPurgeRollupRequestPurgePolicy) GetActualInstanceValue() (interface{}) { + if obj.BulkPurgeRollupRequestPurgePolicyOneOf != nil { + return *obj.BulkPurgeRollupRequestPurgePolicyOneOf + } + + if obj.BulkPurgeRollupRequestPurgePolicyOneOf1 != nil { + return *obj.BulkPurgeRollupRequestPurgePolicyOneOf1 + } + + // all schemas are nil + return nil +} + +type NullableBulkPurgeRollupRequestPurgePolicy struct { + value *BulkPurgeRollupRequestPurgePolicy + isSet bool +} + +func (v NullableBulkPurgeRollupRequestPurgePolicy) Get() *BulkPurgeRollupRequestPurgePolicy { + return v.value +} + +func (v *NullableBulkPurgeRollupRequestPurgePolicy) Set(val *BulkPurgeRollupRequestPurgePolicy) { + v.value = val + v.isSet = true +} + +func (v NullableBulkPurgeRollupRequestPurgePolicy) IsSet() bool { + return v.isSet +} + +func (v *NullableBulkPurgeRollupRequestPurgePolicy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBulkPurgeRollupRequestPurgePolicy(val *BulkPurgeRollupRequestPurgePolicy) *NullableBulkPurgeRollupRequestPurgePolicy { + return &NullableBulkPurgeRollupRequestPurgePolicy{value: val, isSet: true} +} + +func (v NullableBulkPurgeRollupRequestPurgePolicy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBulkPurgeRollupRequestPurgePolicy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_bulk_purge_rollup_request_purge_policy_one_of.go b/generated/slo/model_bulk_purge_rollup_request_purge_policy_one_of.go new file mode 100644 index 000000000..b07ee1466 --- /dev/null +++ b/generated/slo/model_bulk_purge_rollup_request_purge_policy_one_of.go @@ -0,0 +1,164 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the BulkPurgeRollupRequestPurgePolicyOneOf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BulkPurgeRollupRequestPurgePolicyOneOf{} + +// BulkPurgeRollupRequestPurgePolicyOneOf struct for BulkPurgeRollupRequestPurgePolicyOneOf +type BulkPurgeRollupRequestPurgePolicyOneOf struct { + // Specifies whether documents will be purged based on a specific age or on a timestamp + PurgeType *string `json:"purgeType,omitempty"` + // The duration to determine which documents to purge, formatted as {duration}{unit}. This value should be greater than or equal to the time window of every SLO provided. + Age *string `json:"age,omitempty"` +} + +// NewBulkPurgeRollupRequestPurgePolicyOneOf instantiates a new BulkPurgeRollupRequestPurgePolicyOneOf 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 NewBulkPurgeRollupRequestPurgePolicyOneOf() *BulkPurgeRollupRequestPurgePolicyOneOf { + this := BulkPurgeRollupRequestPurgePolicyOneOf{} + return &this +} + +// NewBulkPurgeRollupRequestPurgePolicyOneOfWithDefaults instantiates a new BulkPurgeRollupRequestPurgePolicyOneOf 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 NewBulkPurgeRollupRequestPurgePolicyOneOfWithDefaults() *BulkPurgeRollupRequestPurgePolicyOneOf { + this := BulkPurgeRollupRequestPurgePolicyOneOf{} + return &this +} + +// GetPurgeType returns the PurgeType field value if set, zero value otherwise. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf) GetPurgeType() string { + if o == nil || IsNil(o.PurgeType) { + var ret string + return ret + } + return *o.PurgeType +} + +// GetPurgeTypeOk returns a tuple with the PurgeType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf) GetPurgeTypeOk() (*string, bool) { + if o == nil || IsNil(o.PurgeType) { + return nil, false + } + return o.PurgeType, true +} + +// HasPurgeType returns a boolean if a field has been set. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf) HasPurgeType() bool { + if o != nil && !IsNil(o.PurgeType) { + return true + } + + return false +} + +// SetPurgeType gets a reference to the given string and assigns it to the PurgeType field. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf) SetPurgeType(v string) { + o.PurgeType = &v +} + +// GetAge returns the Age field value if set, zero value otherwise. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf) GetAge() string { + if o == nil || IsNil(o.Age) { + var ret string + return ret + } + return *o.Age +} + +// GetAgeOk returns a tuple with the Age field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf) GetAgeOk() (*string, bool) { + if o == nil || IsNil(o.Age) { + return nil, false + } + return o.Age, true +} + +// HasAge returns a boolean if a field has been set. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf) HasAge() bool { + if o != nil && !IsNil(o.Age) { + return true + } + + return false +} + +// SetAge gets a reference to the given string and assigns it to the Age field. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf) SetAge(v string) { + o.Age = &v +} + +func (o BulkPurgeRollupRequestPurgePolicyOneOf) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BulkPurgeRollupRequestPurgePolicyOneOf) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.PurgeType) { + toSerialize["purgeType"] = o.PurgeType + } + if !IsNil(o.Age) { + toSerialize["age"] = o.Age + } + return toSerialize, nil +} + +type NullableBulkPurgeRollupRequestPurgePolicyOneOf struct { + value *BulkPurgeRollupRequestPurgePolicyOneOf + isSet bool +} + +func (v NullableBulkPurgeRollupRequestPurgePolicyOneOf) Get() *BulkPurgeRollupRequestPurgePolicyOneOf { + return v.value +} + +func (v *NullableBulkPurgeRollupRequestPurgePolicyOneOf) Set(val *BulkPurgeRollupRequestPurgePolicyOneOf) { + v.value = val + v.isSet = true +} + +func (v NullableBulkPurgeRollupRequestPurgePolicyOneOf) IsSet() bool { + return v.isSet +} + +func (v *NullableBulkPurgeRollupRequestPurgePolicyOneOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBulkPurgeRollupRequestPurgePolicyOneOf(val *BulkPurgeRollupRequestPurgePolicyOneOf) *NullableBulkPurgeRollupRequestPurgePolicyOneOf { + return &NullableBulkPurgeRollupRequestPurgePolicyOneOf{value: val, isSet: true} +} + +func (v NullableBulkPurgeRollupRequestPurgePolicyOneOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBulkPurgeRollupRequestPurgePolicyOneOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_bulk_purge_rollup_request_purge_policy_one_of_1.go b/generated/slo/model_bulk_purge_rollup_request_purge_policy_one_of_1.go new file mode 100644 index 000000000..44d6fb292 --- /dev/null +++ b/generated/slo/model_bulk_purge_rollup_request_purge_policy_one_of_1.go @@ -0,0 +1,164 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the BulkPurgeRollupRequestPurgePolicyOneOf1 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BulkPurgeRollupRequestPurgePolicyOneOf1{} + +// BulkPurgeRollupRequestPurgePolicyOneOf1 struct for BulkPurgeRollupRequestPurgePolicyOneOf1 +type BulkPurgeRollupRequestPurgePolicyOneOf1 struct { + // Specifies whether documents will be purged based on a specific age or on a timestamp + PurgeType *string `json:"purgeType,omitempty"` + // The timestamp to determine which documents to purge, formatted in ISO. This value should be older than the applicable time window of every SLO provided. + Timestamp *string `json:"timestamp,omitempty"` +} + +// NewBulkPurgeRollupRequestPurgePolicyOneOf1 instantiates a new BulkPurgeRollupRequestPurgePolicyOneOf1 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 NewBulkPurgeRollupRequestPurgePolicyOneOf1() *BulkPurgeRollupRequestPurgePolicyOneOf1 { + this := BulkPurgeRollupRequestPurgePolicyOneOf1{} + return &this +} + +// NewBulkPurgeRollupRequestPurgePolicyOneOf1WithDefaults instantiates a new BulkPurgeRollupRequestPurgePolicyOneOf1 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 NewBulkPurgeRollupRequestPurgePolicyOneOf1WithDefaults() *BulkPurgeRollupRequestPurgePolicyOneOf1 { + this := BulkPurgeRollupRequestPurgePolicyOneOf1{} + return &this +} + +// GetPurgeType returns the PurgeType field value if set, zero value otherwise. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf1) GetPurgeType() string { + if o == nil || IsNil(o.PurgeType) { + var ret string + return ret + } + return *o.PurgeType +} + +// GetPurgeTypeOk returns a tuple with the PurgeType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf1) GetPurgeTypeOk() (*string, bool) { + if o == nil || IsNil(o.PurgeType) { + return nil, false + } + return o.PurgeType, true +} + +// HasPurgeType returns a boolean if a field has been set. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf1) HasPurgeType() bool { + if o != nil && !IsNil(o.PurgeType) { + return true + } + + return false +} + +// SetPurgeType gets a reference to the given string and assigns it to the PurgeType field. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf1) SetPurgeType(v string) { + o.PurgeType = &v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf1) GetTimestamp() string { + if o == nil || IsNil(o.Timestamp) { + var ret string + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf1) GetTimestampOk() (*string, bool) { + if o == nil || IsNil(o.Timestamp) { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf1) HasTimestamp() bool { + if o != nil && !IsNil(o.Timestamp) { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given string and assigns it to the Timestamp field. +func (o *BulkPurgeRollupRequestPurgePolicyOneOf1) SetTimestamp(v string) { + o.Timestamp = &v +} + +func (o BulkPurgeRollupRequestPurgePolicyOneOf1) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BulkPurgeRollupRequestPurgePolicyOneOf1) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.PurgeType) { + toSerialize["purgeType"] = o.PurgeType + } + if !IsNil(o.Timestamp) { + toSerialize["timestamp"] = o.Timestamp + } + return toSerialize, nil +} + +type NullableBulkPurgeRollupRequestPurgePolicyOneOf1 struct { + value *BulkPurgeRollupRequestPurgePolicyOneOf1 + isSet bool +} + +func (v NullableBulkPurgeRollupRequestPurgePolicyOneOf1) Get() *BulkPurgeRollupRequestPurgePolicyOneOf1 { + return v.value +} + +func (v *NullableBulkPurgeRollupRequestPurgePolicyOneOf1) Set(val *BulkPurgeRollupRequestPurgePolicyOneOf1) { + v.value = val + v.isSet = true +} + +func (v NullableBulkPurgeRollupRequestPurgePolicyOneOf1) IsSet() bool { + return v.isSet +} + +func (v *NullableBulkPurgeRollupRequestPurgePolicyOneOf1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBulkPurgeRollupRequestPurgePolicyOneOf1(val *BulkPurgeRollupRequestPurgePolicyOneOf1) *NullableBulkPurgeRollupRequestPurgePolicyOneOf1 { + return &NullableBulkPurgeRollupRequestPurgePolicyOneOf1{value: val, isSet: true} +} + +func (v NullableBulkPurgeRollupRequestPurgePolicyOneOf1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBulkPurgeRollupRequestPurgePolicyOneOf1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_bulk_purge_rollup_response.go b/generated/slo/model_bulk_purge_rollup_response.go new file mode 100644 index 000000000..525002e5a --- /dev/null +++ b/generated/slo/model_bulk_purge_rollup_response.go @@ -0,0 +1,127 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the BulkPurgeRollupResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BulkPurgeRollupResponse{} + +// BulkPurgeRollupResponse The bulk purge rollup data response returns a task id from the elasticsearch deleteByQuery response. +type BulkPurgeRollupResponse struct { + // The task id of the purge operation + TaskId *string `json:"taskId,omitempty"` +} + +// NewBulkPurgeRollupResponse instantiates a new BulkPurgeRollupResponse 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 NewBulkPurgeRollupResponse() *BulkPurgeRollupResponse { + this := BulkPurgeRollupResponse{} + return &this +} + +// NewBulkPurgeRollupResponseWithDefaults instantiates a new BulkPurgeRollupResponse 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 NewBulkPurgeRollupResponseWithDefaults() *BulkPurgeRollupResponse { + this := BulkPurgeRollupResponse{} + return &this +} + +// GetTaskId returns the TaskId field value if set, zero value otherwise. +func (o *BulkPurgeRollupResponse) GetTaskId() string { + if o == nil || IsNil(o.TaskId) { + var ret string + return ret + } + return *o.TaskId +} + +// GetTaskIdOk returns a tuple with the TaskId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BulkPurgeRollupResponse) GetTaskIdOk() (*string, bool) { + if o == nil || IsNil(o.TaskId) { + return nil, false + } + return o.TaskId, true +} + +// HasTaskId returns a boolean if a field has been set. +func (o *BulkPurgeRollupResponse) HasTaskId() bool { + if o != nil && !IsNil(o.TaskId) { + return true + } + + return false +} + +// SetTaskId gets a reference to the given string and assigns it to the TaskId field. +func (o *BulkPurgeRollupResponse) SetTaskId(v string) { + o.TaskId = &v +} + +func (o BulkPurgeRollupResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BulkPurgeRollupResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.TaskId) { + toSerialize["taskId"] = o.TaskId + } + return toSerialize, nil +} + +type NullableBulkPurgeRollupResponse struct { + value *BulkPurgeRollupResponse + isSet bool +} + +func (v NullableBulkPurgeRollupResponse) Get() *BulkPurgeRollupResponse { + return v.value +} + +func (v *NullableBulkPurgeRollupResponse) Set(val *BulkPurgeRollupResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBulkPurgeRollupResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBulkPurgeRollupResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBulkPurgeRollupResponse(val *BulkPurgeRollupResponse) *NullableBulkPurgeRollupResponse { + return &NullableBulkPurgeRollupResponse{value: val, isSet: true} +} + +func (v NullableBulkPurgeRollupResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBulkPurgeRollupResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_create_slo_request.go b/generated/slo/model_create_slo_request.go index 02210deb0..4998b96ba 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,29 +12,33 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the CreateSloRequest type satisfies the MappedNullable interface at compile time var _ MappedNullable = &CreateSloRequest{} -// CreateSloRequest The create SLO API request body varies depending on the type of indicator, time window and budgeting method. +// 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 CreateSloRequestIndicator `json:"indicator"` - TimeWindow TimeWindow `json:"timeWindow"` - BudgetingMethod BudgetingMethod `json:"budgetingMethod"` - Objective Objective `json:"objective"` - Settings *Settings `json:"settings,omitempty"` - GroupBy *SloResponseGroupBy `json:"groupBy,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"` + GroupBy *GroupBy `json:"groupBy,omitempty"` // List of tags Tags []string `json:"tags,omitempty"` } +type _CreateSloRequest CreateSloRequest + // 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 @@ -267,9 +271,9 @@ func (o *CreateSloRequest) SetSettings(v Settings) { } // GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *CreateSloRequest) GetGroupBy() SloResponseGroupBy { +func (o *CreateSloRequest) GetGroupBy() GroupBy { if o == nil || IsNil(o.GroupBy) { - var ret SloResponseGroupBy + var ret GroupBy return ret } return *o.GroupBy @@ -277,7 +281,7 @@ func (o *CreateSloRequest) GetGroupBy() SloResponseGroupBy { // 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() (*SloResponseGroupBy, bool) { +func (o *CreateSloRequest) GetGroupByOk() (*GroupBy, bool) { if o == nil || IsNil(o.GroupBy) { return nil, false } @@ -293,8 +297,8 @@ func (o *CreateSloRequest) HasGroupBy() bool { return false } -// SetGroupBy gets a reference to the given SloResponseGroupBy and assigns it to the GroupBy field. -func (o *CreateSloRequest) SetGroupBy(v SloResponseGroupBy) { +// SetGroupBy gets a reference to the given GroupBy and assigns it to the GroupBy field. +func (o *CreateSloRequest) SetGroupBy(v GroupBy) { o.GroupBy = &v } @@ -331,7 +335,7 @@ func (o *CreateSloRequest) SetTags(v []string) { } func (o CreateSloRequest) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -361,6 +365,48 @@ func (o CreateSloRequest) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *CreateSloRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "description", + "indicator", + "timeWindow", + "budgetingMethod", + "objective", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateSloRequest := _CreateSloRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateSloRequest) + + if err != nil { + return err + } + + *o = CreateSloRequest(varCreateSloRequest) + + return err +} + type NullableCreateSloRequest struct { value *CreateSloRequest isSet bool @@ -396,3 +442,5 @@ func (v *NullableCreateSloRequest) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_create_slo_request_indicator.go b/generated/slo/model_create_slo_request_indicator.go index 56c4975b2..439462684 100644 --- a/generated/slo/model_create_slo_request_indicator.go +++ b/generated/slo/model_create_slo_request_indicator.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -13,15 +13,16 @@ package slo import ( "encoding/json" "fmt" + "gopkg.in/validator.v2" ) // CreateSloRequestIndicator - struct for CreateSloRequestIndicator type CreateSloRequestIndicator struct { IndicatorPropertiesApmAvailability *IndicatorPropertiesApmAvailability - IndicatorPropertiesApmLatency *IndicatorPropertiesApmLatency - IndicatorPropertiesCustomKql *IndicatorPropertiesCustomKql - IndicatorPropertiesCustomMetric *IndicatorPropertiesCustomMetric - IndicatorPropertiesHistogram *IndicatorPropertiesHistogram + IndicatorPropertiesApmLatency *IndicatorPropertiesApmLatency + IndicatorPropertiesCustomKql *IndicatorPropertiesCustomKql + IndicatorPropertiesCustomMetric *IndicatorPropertiesCustomMetric + IndicatorPropertiesHistogram *IndicatorPropertiesHistogram IndicatorPropertiesTimesliceMetric *IndicatorPropertiesTimesliceMetric } @@ -67,83 +68,108 @@ func IndicatorPropertiesTimesliceMetricAsCreateSloRequestIndicator(v *IndicatorP } } + // 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) + err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesApmAvailability) if err == nil { jsonIndicatorPropertiesApmAvailability, _ := json.Marshal(dst.IndicatorPropertiesApmAvailability) if string(jsonIndicatorPropertiesApmAvailability) == "{}" { // empty struct dst.IndicatorPropertiesApmAvailability = nil } else { - match++ + if err = validator.Validate(dst.IndicatorPropertiesApmAvailability); err != nil { + dst.IndicatorPropertiesApmAvailability = nil + } else { + match++ + } } } else { dst.IndicatorPropertiesApmAvailability = nil } // try to unmarshal data into IndicatorPropertiesApmLatency - err = json.Unmarshal(data, &dst.IndicatorPropertiesApmLatency) + err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesApmLatency) if err == nil { jsonIndicatorPropertiesApmLatency, _ := json.Marshal(dst.IndicatorPropertiesApmLatency) if string(jsonIndicatorPropertiesApmLatency) == "{}" { // empty struct dst.IndicatorPropertiesApmLatency = nil } else { - match++ + if err = validator.Validate(dst.IndicatorPropertiesApmLatency); err != nil { + dst.IndicatorPropertiesApmLatency = nil + } else { + match++ + } } } else { dst.IndicatorPropertiesApmLatency = nil } // try to unmarshal data into IndicatorPropertiesCustomKql - err = json.Unmarshal(data, &dst.IndicatorPropertiesCustomKql) + err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesCustomKql) if err == nil { jsonIndicatorPropertiesCustomKql, _ := json.Marshal(dst.IndicatorPropertiesCustomKql) if string(jsonIndicatorPropertiesCustomKql) == "{}" { // empty struct dst.IndicatorPropertiesCustomKql = nil } else { - match++ + if err = validator.Validate(dst.IndicatorPropertiesCustomKql); err != nil { + dst.IndicatorPropertiesCustomKql = nil + } else { + match++ + } } } else { dst.IndicatorPropertiesCustomKql = nil } // try to unmarshal data into IndicatorPropertiesCustomMetric - err = json.Unmarshal(data, &dst.IndicatorPropertiesCustomMetric) + err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesCustomMetric) if err == nil { jsonIndicatorPropertiesCustomMetric, _ := json.Marshal(dst.IndicatorPropertiesCustomMetric) if string(jsonIndicatorPropertiesCustomMetric) == "{}" { // empty struct dst.IndicatorPropertiesCustomMetric = nil } else { - match++ + if err = validator.Validate(dst.IndicatorPropertiesCustomMetric); err != nil { + dst.IndicatorPropertiesCustomMetric = nil + } else { + match++ + } } } else { dst.IndicatorPropertiesCustomMetric = nil } // try to unmarshal data into IndicatorPropertiesHistogram - err = json.Unmarshal(data, &dst.IndicatorPropertiesHistogram) + err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesHistogram) if err == nil { jsonIndicatorPropertiesHistogram, _ := json.Marshal(dst.IndicatorPropertiesHistogram) if string(jsonIndicatorPropertiesHistogram) == "{}" { // empty struct dst.IndicatorPropertiesHistogram = nil } else { - match++ + if err = validator.Validate(dst.IndicatorPropertiesHistogram); err != nil { + dst.IndicatorPropertiesHistogram = nil + } else { + match++ + } } } else { dst.IndicatorPropertiesHistogram = nil } // try to unmarshal data into IndicatorPropertiesTimesliceMetric - err = json.Unmarshal(data, &dst.IndicatorPropertiesTimesliceMetric) + err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesTimesliceMetric) if err == nil { jsonIndicatorPropertiesTimesliceMetric, _ := json.Marshal(dst.IndicatorPropertiesTimesliceMetric) if string(jsonIndicatorPropertiesTimesliceMetric) == "{}" { // empty struct dst.IndicatorPropertiesTimesliceMetric = nil } else { - match++ + if err = validator.Validate(dst.IndicatorPropertiesTimesliceMetric); err != nil { + dst.IndicatorPropertiesTimesliceMetric = nil + } else { + match++ + } } } else { dst.IndicatorPropertiesTimesliceMetric = nil @@ -196,7 +222,7 @@ func (src CreateSloRequestIndicator) MarshalJSON() ([]byte, error) { } // Get the actual instance -func (obj *CreateSloRequestIndicator) GetActualInstance() interface{} { +func (obj *CreateSloRequestIndicator) GetActualInstance() (interface{}) { if obj == nil { return nil } @@ -228,6 +254,36 @@ func (obj *CreateSloRequestIndicator) GetActualInstance() interface{} { return nil } +// Get the actual instance value +func (obj CreateSloRequestIndicator) GetActualInstanceValue() (interface{}) { + 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 + } + + if obj.IndicatorPropertiesTimesliceMetric != nil { + return *obj.IndicatorPropertiesTimesliceMetric + } + + // all schemas are nil + return nil +} + type NullableCreateSloRequestIndicator struct { value *CreateSloRequestIndicator isSet bool @@ -263,3 +319,5 @@ 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 53d6c95db..478fed3b0 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the CreateSloResponse type satisfies the MappedNullable interface at compile time @@ -22,6 +24,8 @@ type CreateSloResponse struct { Id string `json:"id"` } +type _CreateSloResponse CreateSloResponse + // NewCreateSloResponse instantiates a new CreateSloResponse 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 @@ -65,7 +69,7 @@ func (o *CreateSloResponse) SetId(v string) { } func (o CreateSloResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -78,6 +82,43 @@ func (o CreateSloResponse) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *CreateSloResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateSloResponse := _CreateSloResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateSloResponse) + + if err != nil { + return err + } + + *o = CreateSloResponse(varCreateSloResponse) + + return err +} + type NullableCreateSloResponse struct { value *CreateSloResponse isSet bool @@ -113,3 +154,5 @@ func (v *NullableCreateSloResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_delete_slo_instances_request.go b/generated/slo/model_delete_slo_instances_request.go index a8a4be95f..d02eebc9a 100644 --- a/generated/slo/model_delete_slo_instances_request.go +++ b/generated/slo/model_delete_slo_instances_request.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,17 +12,21 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the DeleteSloInstancesRequest type satisfies the MappedNullable interface at compile time var _ MappedNullable = &DeleteSloInstancesRequest{} -// DeleteSloInstancesRequest The delete SLO instances request takes a list of SLO id and instance id, then delete the rollup and summary data. This API can be used to remove the staled data of an instance SLO that no longer get updated. +// DeleteSloInstancesRequest The delete SLO instances request takes a list of SLO id and instance id, then delete the rollup and summary data. This API can be used to remove the staled data of an instance SLO that no longer get updated. type DeleteSloInstancesRequest struct { // An array of slo id and instance id List []DeleteSloInstancesRequestListInner `json:"list"` } +type _DeleteSloInstancesRequest DeleteSloInstancesRequest + // NewDeleteSloInstancesRequest instantiates a new DeleteSloInstancesRequest object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -66,7 +70,7 @@ func (o *DeleteSloInstancesRequest) SetList(v []DeleteSloInstancesRequestListInn } func (o DeleteSloInstancesRequest) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -79,6 +83,43 @@ func (o DeleteSloInstancesRequest) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *DeleteSloInstancesRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "list", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varDeleteSloInstancesRequest := _DeleteSloInstancesRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varDeleteSloInstancesRequest) + + if err != nil { + return err + } + + *o = DeleteSloInstancesRequest(varDeleteSloInstancesRequest) + + return err +} + type NullableDeleteSloInstancesRequest struct { value *DeleteSloInstancesRequest isSet bool @@ -114,3 +155,5 @@ func (v *NullableDeleteSloInstancesRequest) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_delete_slo_instances_request_list_inner.go b/generated/slo/model_delete_slo_instances_request_list_inner.go index 22694c856..4685b38f6 100644 --- a/generated/slo/model_delete_slo_instances_request_list_inner.go +++ b/generated/slo/model_delete_slo_instances_request_list_inner.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the DeleteSloInstancesRequestListInner type satisfies the MappedNullable interface at compile time @@ -25,6 +27,8 @@ type DeleteSloInstancesRequestListInner struct { InstanceId string `json:"instanceId"` } +type _DeleteSloInstancesRequestListInner DeleteSloInstancesRequestListInner + // NewDeleteSloInstancesRequestListInner instantiates a new DeleteSloInstancesRequestListInner object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -93,7 +97,7 @@ func (o *DeleteSloInstancesRequestListInner) SetInstanceId(v string) { } func (o DeleteSloInstancesRequestListInner) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -107,6 +111,44 @@ func (o DeleteSloInstancesRequestListInner) ToMap() (map[string]interface{}, err return toSerialize, nil } +func (o *DeleteSloInstancesRequestListInner) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "sloId", + "instanceId", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varDeleteSloInstancesRequestListInner := _DeleteSloInstancesRequestListInner{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varDeleteSloInstancesRequestListInner) + + if err != nil { + return err + } + + *o = DeleteSloInstancesRequestListInner(varDeleteSloInstancesRequestListInner) + + return err +} + type NullableDeleteSloInstancesRequestListInner struct { value *DeleteSloInstancesRequestListInner isSet bool @@ -142,3 +184,5 @@ func (v *NullableDeleteSloInstancesRequestListInner) UnmarshalJSON(src []byte) e v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_error_budget.go b/generated/slo/model_error_budget.go index d7d8e6b6d..ea98c1b13 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the ErrorBudget type satisfies the MappedNullable interface at compile time @@ -20,20 +22,22 @@ var _ MappedNullable = &ErrorBudget{} // ErrorBudget struct for ErrorBudget type ErrorBudget struct { // The initial error budget, as 1 - objective - Initial float64 `json:"initial"` + Initial float32 `json:"initial"` // The error budget consummed, as a percentage of the initial value. - Consumed float64 `json:"consumed"` + Consumed float32 `json:"consumed"` // The error budget remaining, as a percentage of the initial value. - Remaining float64 `json:"remaining"` + Remaining float32 `json:"remaining"` // Only for SLO defined with occurrences budgeting method and calendar aligned time window. IsEstimated bool `json:"isEstimated"` } +type _ErrorBudget ErrorBudget + // 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(initial float64, consumed float64, remaining float64, isEstimated bool) *ErrorBudget { +func NewErrorBudget(initial float32, consumed float32, remaining float32, isEstimated bool) *ErrorBudget { this := ErrorBudget{} this.Initial = initial this.Consumed = consumed @@ -51,9 +55,9 @@ func NewErrorBudgetWithDefaults() *ErrorBudget { } // GetInitial returns the Initial field value -func (o *ErrorBudget) GetInitial() float64 { +func (o *ErrorBudget) GetInitial() float32 { if o == nil { - var ret float64 + var ret float32 return ret } @@ -62,7 +66,7 @@ func (o *ErrorBudget) GetInitial() float64 { // GetInitialOk returns a tuple with the Initial field value // and a boolean to check if the value has been set. -func (o *ErrorBudget) GetInitialOk() (*float64, bool) { +func (o *ErrorBudget) GetInitialOk() (*float32, bool) { if o == nil { return nil, false } @@ -70,14 +74,14 @@ func (o *ErrorBudget) GetInitialOk() (*float64, bool) { } // SetInitial sets field value -func (o *ErrorBudget) SetInitial(v float64) { +func (o *ErrorBudget) SetInitial(v float32) { o.Initial = v } // GetConsumed returns the Consumed field value -func (o *ErrorBudget) GetConsumed() float64 { +func (o *ErrorBudget) GetConsumed() float32 { if o == nil { - var ret float64 + var ret float32 return ret } @@ -86,7 +90,7 @@ func (o *ErrorBudget) GetConsumed() float64 { // GetConsumedOk returns a tuple with the Consumed field value // and a boolean to check if the value has been set. -func (o *ErrorBudget) GetConsumedOk() (*float64, bool) { +func (o *ErrorBudget) GetConsumedOk() (*float32, bool) { if o == nil { return nil, false } @@ -94,14 +98,14 @@ func (o *ErrorBudget) GetConsumedOk() (*float64, bool) { } // SetConsumed sets field value -func (o *ErrorBudget) SetConsumed(v float64) { +func (o *ErrorBudget) SetConsumed(v float32) { o.Consumed = v } // GetRemaining returns the Remaining field value -func (o *ErrorBudget) GetRemaining() float64 { +func (o *ErrorBudget) GetRemaining() float32 { if o == nil { - var ret float64 + var ret float32 return ret } @@ -110,7 +114,7 @@ func (o *ErrorBudget) GetRemaining() float64 { // GetRemainingOk returns a tuple with the Remaining field value // and a boolean to check if the value has been set. -func (o *ErrorBudget) GetRemainingOk() (*float64, bool) { +func (o *ErrorBudget) GetRemainingOk() (*float32, bool) { if o == nil { return nil, false } @@ -118,7 +122,7 @@ func (o *ErrorBudget) GetRemainingOk() (*float64, bool) { } // SetRemaining sets field value -func (o *ErrorBudget) SetRemaining(v float64) { +func (o *ErrorBudget) SetRemaining(v float32) { o.Remaining = v } @@ -147,7 +151,7 @@ func (o *ErrorBudget) SetIsEstimated(v bool) { } func (o ErrorBudget) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -163,6 +167,46 @@ func (o ErrorBudget) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *ErrorBudget) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "initial", + "consumed", + "remaining", + "isEstimated", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varErrorBudget := _ErrorBudget{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varErrorBudget) + + if err != nil { + return err + } + + *o = ErrorBudget(varErrorBudget) + + return err +} + type NullableErrorBudget struct { value *ErrorBudget isSet bool @@ -198,3 +242,5 @@ func (v *NullableErrorBudget) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_filter.go b/generated/slo/model_filter.go new file mode 100644 index 000000000..c01acbb5a --- /dev/null +++ b/generated/slo/model_filter.go @@ -0,0 +1,162 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the Filter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Filter{} + +// Filter Defines properties for a filter +type Filter struct { + Query map[string]interface{} `json:"query,omitempty"` + Meta *FilterMeta `json:"meta,omitempty"` +} + +// NewFilter instantiates a new Filter 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 NewFilter() *Filter { + this := Filter{} + return &this +} + +// NewFilterWithDefaults instantiates a new Filter 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 NewFilterWithDefaults() *Filter { + this := Filter{} + return &this +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *Filter) GetQuery() map[string]interface{} { + if o == nil || IsNil(o.Query) { + var ret map[string]interface{} + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Filter) GetQueryOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Query) { + return map[string]interface{}{}, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *Filter) HasQuery() bool { + if o != nil && !IsNil(o.Query) { + return true + } + + return false +} + +// SetQuery gets a reference to the given map[string]interface{} and assigns it to the Query field. +func (o *Filter) SetQuery(v map[string]interface{}) { + o.Query = v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *Filter) GetMeta() FilterMeta { + if o == nil || IsNil(o.Meta) { + var ret FilterMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Filter) GetMetaOk() (*FilterMeta, bool) { + if o == nil || IsNil(o.Meta) { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *Filter) HasMeta() bool { + if o != nil && !IsNil(o.Meta) { + return true + } + + return false +} + +// SetMeta gets a reference to the given FilterMeta and assigns it to the Meta field. +func (o *Filter) SetMeta(v FilterMeta) { + o.Meta = &v +} + +func (o Filter) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Filter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Query) { + toSerialize["query"] = o.Query + } + if !IsNil(o.Meta) { + toSerialize["meta"] = o.Meta + } + return toSerialize, nil +} + +type NullableFilter struct { + value *Filter + isSet bool +} + +func (v NullableFilter) Get() *Filter { + return v.value +} + +func (v *NullableFilter) Set(val *Filter) { + v.value = val + v.isSet = true +} + +func (v NullableFilter) IsSet() bool { + return v.isSet +} + +func (v *NullableFilter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFilter(val *Filter) *NullableFilter { + return &NullableFilter{value: val, isSet: true} +} + +func (v NullableFilter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFilter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_filter_meta.go b/generated/slo/model_filter_meta.go new file mode 100644 index 000000000..2f0cc9e70 --- /dev/null +++ b/generated/slo/model_filter_meta.go @@ -0,0 +1,532 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the FilterMeta type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FilterMeta{} + +// FilterMeta Defines properties for a filter +type FilterMeta struct { + Alias NullableString `json:"alias,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + Negate *bool `json:"negate,omitempty"` + ControlledBy *string `json:"controlledBy,omitempty"` + Group *string `json:"group,omitempty"` + Index *string `json:"index,omitempty"` + IsMultiIndex *bool `json:"isMultiIndex,omitempty"` + Type *string `json:"type,omitempty"` + Key *string `json:"key,omitempty"` + Params map[string]interface{} `json:"params,omitempty"` + Value *string `json:"value,omitempty"` + Field *string `json:"field,omitempty"` +} + +// NewFilterMeta instantiates a new FilterMeta 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 NewFilterMeta() *FilterMeta { + this := FilterMeta{} + return &this +} + +// NewFilterMetaWithDefaults instantiates a new FilterMeta 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 NewFilterMetaWithDefaults() *FilterMeta { + this := FilterMeta{} + return &this +} + +// GetAlias returns the Alias field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FilterMeta) GetAlias() string { + if o == nil || IsNil(o.Alias.Get()) { + var ret string + return ret + } + return *o.Alias.Get() +} + +// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FilterMeta) GetAliasOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Alias.Get(), o.Alias.IsSet() +} + +// HasAlias returns a boolean if a field has been set. +func (o *FilterMeta) HasAlias() bool { + if o != nil && o.Alias.IsSet() { + return true + } + + return false +} + +// SetAlias gets a reference to the given NullableString and assigns it to the Alias field. +func (o *FilterMeta) SetAlias(v string) { + o.Alias.Set(&v) +} +// SetAliasNil sets the value for Alias to be an explicit nil +func (o *FilterMeta) SetAliasNil() { + o.Alias.Set(nil) +} + +// UnsetAlias ensures that no value is present for Alias, not even an explicit nil +func (o *FilterMeta) UnsetAlias() { + o.Alias.Unset() +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise. +func (o *FilterMeta) GetDisabled() bool { + if o == nil || IsNil(o.Disabled) { + var ret bool + return ret + } + return *o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetDisabledOk() (*bool, bool) { + if o == nil || IsNil(o.Disabled) { + return nil, false + } + return o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *FilterMeta) HasDisabled() bool { + if o != nil && !IsNil(o.Disabled) { + return true + } + + return false +} + +// SetDisabled gets a reference to the given bool and assigns it to the Disabled field. +func (o *FilterMeta) SetDisabled(v bool) { + o.Disabled = &v +} + +// GetNegate returns the Negate field value if set, zero value otherwise. +func (o *FilterMeta) GetNegate() bool { + if o == nil || IsNil(o.Negate) { + var ret bool + return ret + } + return *o.Negate +} + +// GetNegateOk returns a tuple with the Negate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetNegateOk() (*bool, bool) { + if o == nil || IsNil(o.Negate) { + return nil, false + } + return o.Negate, true +} + +// HasNegate returns a boolean if a field has been set. +func (o *FilterMeta) HasNegate() bool { + if o != nil && !IsNil(o.Negate) { + return true + } + + return false +} + +// SetNegate gets a reference to the given bool and assigns it to the Negate field. +func (o *FilterMeta) SetNegate(v bool) { + o.Negate = &v +} + +// GetControlledBy returns the ControlledBy field value if set, zero value otherwise. +func (o *FilterMeta) GetControlledBy() string { + if o == nil || IsNil(o.ControlledBy) { + var ret string + return ret + } + return *o.ControlledBy +} + +// GetControlledByOk returns a tuple with the ControlledBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetControlledByOk() (*string, bool) { + if o == nil || IsNil(o.ControlledBy) { + return nil, false + } + return o.ControlledBy, true +} + +// HasControlledBy returns a boolean if a field has been set. +func (o *FilterMeta) HasControlledBy() bool { + if o != nil && !IsNil(o.ControlledBy) { + return true + } + + return false +} + +// SetControlledBy gets a reference to the given string and assigns it to the ControlledBy field. +func (o *FilterMeta) SetControlledBy(v string) { + o.ControlledBy = &v +} + +// GetGroup returns the Group field value if set, zero value otherwise. +func (o *FilterMeta) GetGroup() string { + if o == nil || IsNil(o.Group) { + var ret string + return ret + } + return *o.Group +} + +// GetGroupOk returns a tuple with the Group field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetGroupOk() (*string, bool) { + if o == nil || IsNil(o.Group) { + return nil, false + } + return o.Group, true +} + +// HasGroup returns a boolean if a field has been set. +func (o *FilterMeta) HasGroup() bool { + if o != nil && !IsNil(o.Group) { + return true + } + + return false +} + +// SetGroup gets a reference to the given string and assigns it to the Group field. +func (o *FilterMeta) SetGroup(v string) { + o.Group = &v +} + +// GetIndex returns the Index field value if set, zero value otherwise. +func (o *FilterMeta) GetIndex() string { + if o == nil || IsNil(o.Index) { + var ret string + return ret + } + return *o.Index +} + +// GetIndexOk returns a tuple with the Index field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetIndexOk() (*string, bool) { + if o == nil || IsNil(o.Index) { + return nil, false + } + return o.Index, true +} + +// HasIndex returns a boolean if a field has been set. +func (o *FilterMeta) HasIndex() bool { + if o != nil && !IsNil(o.Index) { + return true + } + + return false +} + +// SetIndex gets a reference to the given string and assigns it to the Index field. +func (o *FilterMeta) SetIndex(v string) { + o.Index = &v +} + +// GetIsMultiIndex returns the IsMultiIndex field value if set, zero value otherwise. +func (o *FilterMeta) GetIsMultiIndex() bool { + if o == nil || IsNil(o.IsMultiIndex) { + var ret bool + return ret + } + return *o.IsMultiIndex +} + +// GetIsMultiIndexOk returns a tuple with the IsMultiIndex field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetIsMultiIndexOk() (*bool, bool) { + if o == nil || IsNil(o.IsMultiIndex) { + return nil, false + } + return o.IsMultiIndex, true +} + +// HasIsMultiIndex returns a boolean if a field has been set. +func (o *FilterMeta) HasIsMultiIndex() bool { + if o != nil && !IsNil(o.IsMultiIndex) { + return true + } + + return false +} + +// SetIsMultiIndex gets a reference to the given bool and assigns it to the IsMultiIndex field. +func (o *FilterMeta) SetIsMultiIndex(v bool) { + o.IsMultiIndex = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *FilterMeta) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *FilterMeta) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *FilterMeta) SetType(v string) { + o.Type = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *FilterMeta) GetKey() string { + if o == nil || IsNil(o.Key) { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetKeyOk() (*string, bool) { + if o == nil || IsNil(o.Key) { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *FilterMeta) HasKey() bool { + if o != nil && !IsNil(o.Key) { + return true + } + + return false +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *FilterMeta) SetKey(v string) { + o.Key = &v +} + +// GetParams returns the Params field value if set, zero value otherwise. +func (o *FilterMeta) GetParams() map[string]interface{} { + if o == nil || IsNil(o.Params) { + var ret map[string]interface{} + return ret + } + return o.Params +} + +// GetParamsOk returns a tuple with the Params field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetParamsOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Params) { + return map[string]interface{}{}, false + } + return o.Params, true +} + +// HasParams returns a boolean if a field has been set. +func (o *FilterMeta) HasParams() bool { + if o != nil && !IsNil(o.Params) { + return true + } + + return false +} + +// SetParams gets a reference to the given map[string]interface{} and assigns it to the Params field. +func (o *FilterMeta) SetParams(v map[string]interface{}) { + o.Params = v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *FilterMeta) GetValue() string { + if o == nil || IsNil(o.Value) { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetValueOk() (*string, bool) { + if o == nil || IsNil(o.Value) { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *FilterMeta) HasValue() bool { + if o != nil && !IsNil(o.Value) { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *FilterMeta) SetValue(v string) { + o.Value = &v +} + +// GetField returns the Field field value if set, zero value otherwise. +func (o *FilterMeta) GetField() string { + if o == nil || IsNil(o.Field) { + var ret string + return ret + } + return *o.Field +} + +// GetFieldOk returns a tuple with the Field field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FilterMeta) GetFieldOk() (*string, bool) { + if o == nil || IsNil(o.Field) { + return nil, false + } + return o.Field, true +} + +// HasField returns a boolean if a field has been set. +func (o *FilterMeta) HasField() bool { + if o != nil && !IsNil(o.Field) { + return true + } + + return false +} + +// SetField gets a reference to the given string and assigns it to the Field field. +func (o *FilterMeta) SetField(v string) { + o.Field = &v +} + +func (o FilterMeta) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FilterMeta) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Alias.IsSet() { + toSerialize["alias"] = o.Alias.Get() + } + if !IsNil(o.Disabled) { + toSerialize["disabled"] = o.Disabled + } + if !IsNil(o.Negate) { + toSerialize["negate"] = o.Negate + } + if !IsNil(o.ControlledBy) { + toSerialize["controlledBy"] = o.ControlledBy + } + if !IsNil(o.Group) { + toSerialize["group"] = o.Group + } + if !IsNil(o.Index) { + toSerialize["index"] = o.Index + } + if !IsNil(o.IsMultiIndex) { + toSerialize["isMultiIndex"] = o.IsMultiIndex + } + if !IsNil(o.Type) { + toSerialize["type"] = o.Type + } + if !IsNil(o.Key) { + toSerialize["key"] = o.Key + } + if !IsNil(o.Params) { + toSerialize["params"] = o.Params + } + if !IsNil(o.Value) { + toSerialize["value"] = o.Value + } + if !IsNil(o.Field) { + toSerialize["field"] = o.Field + } + return toSerialize, nil +} + +type NullableFilterMeta struct { + value *FilterMeta + isSet bool +} + +func (v NullableFilterMeta) Get() *FilterMeta { + return v.value +} + +func (v *NullableFilterMeta) Set(val *FilterMeta) { + v.value = val + v.isSet = true +} + +func (v NullableFilterMeta) IsSet() bool { + return v.isSet +} + +func (v *NullableFilterMeta) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFilterMeta(val *FilterMeta) *NullableFilterMeta { + return &NullableFilterMeta{value: val, isSet: true} +} + +func (v NullableFilterMeta) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFilterMeta) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_find_slo_definitions_response.go b/generated/slo/model_find_slo_definitions_response.go new file mode 100644 index 000000000..425243055 --- /dev/null +++ b/generated/slo/model_find_slo_definitions_response.go @@ -0,0 +1,171 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "fmt" + "gopkg.in/validator.v2" +) + +// FindSloDefinitionsResponse - A paginated response of SLO definitions matching the query. +type FindSloDefinitionsResponse struct { + FindSloDefinitionsResponseOneOf *FindSloDefinitionsResponseOneOf + FindSloDefinitionsResponseOneOf1 *FindSloDefinitionsResponseOneOf1 +} + +// FindSloDefinitionsResponseOneOfAsFindSloDefinitionsResponse is a convenience function that returns FindSloDefinitionsResponseOneOf wrapped in FindSloDefinitionsResponse +func FindSloDefinitionsResponseOneOfAsFindSloDefinitionsResponse(v *FindSloDefinitionsResponseOneOf) FindSloDefinitionsResponse { + return FindSloDefinitionsResponse{ + FindSloDefinitionsResponseOneOf: v, + } +} + +// FindSloDefinitionsResponseOneOf1AsFindSloDefinitionsResponse is a convenience function that returns FindSloDefinitionsResponseOneOf1 wrapped in FindSloDefinitionsResponse +func FindSloDefinitionsResponseOneOf1AsFindSloDefinitionsResponse(v *FindSloDefinitionsResponseOneOf1) FindSloDefinitionsResponse { + return FindSloDefinitionsResponse{ + FindSloDefinitionsResponseOneOf1: v, + } +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *FindSloDefinitionsResponse) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into FindSloDefinitionsResponseOneOf + err = newStrictDecoder(data).Decode(&dst.FindSloDefinitionsResponseOneOf) + if err == nil { + jsonFindSloDefinitionsResponseOneOf, _ := json.Marshal(dst.FindSloDefinitionsResponseOneOf) + if string(jsonFindSloDefinitionsResponseOneOf) == "{}" { // empty struct + dst.FindSloDefinitionsResponseOneOf = nil + } else { + if err = validator.Validate(dst.FindSloDefinitionsResponseOneOf); err != nil { + dst.FindSloDefinitionsResponseOneOf = nil + } else { + match++ + } + } + } else { + dst.FindSloDefinitionsResponseOneOf = nil + } + + // try to unmarshal data into FindSloDefinitionsResponseOneOf1 + err = newStrictDecoder(data).Decode(&dst.FindSloDefinitionsResponseOneOf1) + if err == nil { + jsonFindSloDefinitionsResponseOneOf1, _ := json.Marshal(dst.FindSloDefinitionsResponseOneOf1) + if string(jsonFindSloDefinitionsResponseOneOf1) == "{}" { // empty struct + dst.FindSloDefinitionsResponseOneOf1 = nil + } else { + if err = validator.Validate(dst.FindSloDefinitionsResponseOneOf1); err != nil { + dst.FindSloDefinitionsResponseOneOf1 = nil + } else { + match++ + } + } + } else { + dst.FindSloDefinitionsResponseOneOf1 = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.FindSloDefinitionsResponseOneOf = nil + dst.FindSloDefinitionsResponseOneOf1 = nil + + return fmt.Errorf("data matches more than one schema in oneOf(FindSloDefinitionsResponse)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(FindSloDefinitionsResponse)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src FindSloDefinitionsResponse) MarshalJSON() ([]byte, error) { + if src.FindSloDefinitionsResponseOneOf != nil { + return json.Marshal(&src.FindSloDefinitionsResponseOneOf) + } + + if src.FindSloDefinitionsResponseOneOf1 != nil { + return json.Marshal(&src.FindSloDefinitionsResponseOneOf1) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *FindSloDefinitionsResponse) GetActualInstance() (interface{}) { + if obj == nil { + return nil + } + if obj.FindSloDefinitionsResponseOneOf != nil { + return obj.FindSloDefinitionsResponseOneOf + } + + if obj.FindSloDefinitionsResponseOneOf1 != nil { + return obj.FindSloDefinitionsResponseOneOf1 + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj FindSloDefinitionsResponse) GetActualInstanceValue() (interface{}) { + if obj.FindSloDefinitionsResponseOneOf != nil { + return *obj.FindSloDefinitionsResponseOneOf + } + + if obj.FindSloDefinitionsResponseOneOf1 != nil { + return *obj.FindSloDefinitionsResponseOneOf1 + } + + // all schemas are nil + return nil +} + +type NullableFindSloDefinitionsResponse struct { + value *FindSloDefinitionsResponse + isSet bool +} + +func (v NullableFindSloDefinitionsResponse) Get() *FindSloDefinitionsResponse { + return v.value +} + +func (v *NullableFindSloDefinitionsResponse) Set(val *FindSloDefinitionsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableFindSloDefinitionsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableFindSloDefinitionsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindSloDefinitionsResponse(val *FindSloDefinitionsResponse) *NullableFindSloDefinitionsResponse { + return &NullableFindSloDefinitionsResponse{value: val, isSet: true} +} + +func (v NullableFindSloDefinitionsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindSloDefinitionsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_find_slo_definitions_response_one_of.go b/generated/slo/model_find_slo_definitions_response_one_of.go new file mode 100644 index 000000000..48911fa9d --- /dev/null +++ b/generated/slo/model_find_slo_definitions_response_one_of.go @@ -0,0 +1,234 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the FindSloDefinitionsResponseOneOf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FindSloDefinitionsResponseOneOf{} + +// FindSloDefinitionsResponseOneOf struct for FindSloDefinitionsResponseOneOf +type FindSloDefinitionsResponseOneOf struct { + Page *float32 `json:"page,omitempty"` + PerPage *float32 `json:"perPage,omitempty"` + Total *float32 `json:"total,omitempty"` + Results []SloWithSummaryResponse `json:"results,omitempty"` +} + +// NewFindSloDefinitionsResponseOneOf instantiates a new FindSloDefinitionsResponseOneOf 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 NewFindSloDefinitionsResponseOneOf() *FindSloDefinitionsResponseOneOf { + this := FindSloDefinitionsResponseOneOf{} + return &this +} + +// NewFindSloDefinitionsResponseOneOfWithDefaults instantiates a new FindSloDefinitionsResponseOneOf 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 NewFindSloDefinitionsResponseOneOfWithDefaults() *FindSloDefinitionsResponseOneOf { + this := FindSloDefinitionsResponseOneOf{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *FindSloDefinitionsResponseOneOf) GetPage() float32 { + if o == nil || IsNil(o.Page) { + var ret float32 + return ret + } + return *o.Page +} + +// 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 *FindSloDefinitionsResponseOneOf) GetPageOk() (*float32, bool) { + if o == nil || IsNil(o.Page) { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *FindSloDefinitionsResponseOneOf) HasPage() bool { + if o != nil && !IsNil(o.Page) { + return true + } + + return false +} + +// SetPage gets a reference to the given float32 and assigns it to the Page field. +func (o *FindSloDefinitionsResponseOneOf) SetPage(v float32) { + o.Page = &v +} + +// GetPerPage returns the PerPage field value if set, zero value otherwise. +func (o *FindSloDefinitionsResponseOneOf) GetPerPage() float32 { + if o == nil || IsNil(o.PerPage) { + var ret float32 + return ret + } + return *o.PerPage +} + +// 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 *FindSloDefinitionsResponseOneOf) GetPerPageOk() (*float32, bool) { + if o == nil || IsNil(o.PerPage) { + return nil, false + } + return o.PerPage, true +} + +// HasPerPage returns a boolean if a field has been set. +func (o *FindSloDefinitionsResponseOneOf) HasPerPage() bool { + if o != nil && !IsNil(o.PerPage) { + return true + } + + return false +} + +// SetPerPage gets a reference to the given float32 and assigns it to the PerPage field. +func (o *FindSloDefinitionsResponseOneOf) SetPerPage(v float32) { + o.PerPage = &v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *FindSloDefinitionsResponseOneOf) GetTotal() float32 { + if o == nil || IsNil(o.Total) { + var ret float32 + return ret + } + return *o.Total +} + +// 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 *FindSloDefinitionsResponseOneOf) GetTotalOk() (*float32, bool) { + if o == nil || IsNil(o.Total) { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *FindSloDefinitionsResponseOneOf) HasTotal() bool { + if o != nil && !IsNil(o.Total) { + return true + } + + return false +} + +// SetTotal gets a reference to the given float32 and assigns it to the Total field. +func (o *FindSloDefinitionsResponseOneOf) SetTotal(v float32) { + o.Total = &v +} + +// GetResults returns the Results field value if set, zero value otherwise. +func (o *FindSloDefinitionsResponseOneOf) GetResults() []SloWithSummaryResponse { + if o == nil || IsNil(o.Results) { + var ret []SloWithSummaryResponse + return ret + } + return o.Results +} + +// GetResultsOk returns a tuple with the Results field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindSloDefinitionsResponseOneOf) GetResultsOk() ([]SloWithSummaryResponse, bool) { + if o == nil || IsNil(o.Results) { + return nil, false + } + return o.Results, true +} + +// HasResults returns a boolean if a field has been set. +func (o *FindSloDefinitionsResponseOneOf) HasResults() bool { + if o != nil && !IsNil(o.Results) { + return true + } + + return false +} + +// SetResults gets a reference to the given []SloWithSummaryResponse and assigns it to the Results field. +func (o *FindSloDefinitionsResponseOneOf) SetResults(v []SloWithSummaryResponse) { + o.Results = v +} + +func (o FindSloDefinitionsResponseOneOf) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FindSloDefinitionsResponseOneOf) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Page) { + toSerialize["page"] = o.Page + } + if !IsNil(o.PerPage) { + toSerialize["perPage"] = o.PerPage + } + if !IsNil(o.Total) { + toSerialize["total"] = o.Total + } + if !IsNil(o.Results) { + toSerialize["results"] = o.Results + } + return toSerialize, nil +} + +type NullableFindSloDefinitionsResponseOneOf struct { + value *FindSloDefinitionsResponseOneOf + isSet bool +} + +func (v NullableFindSloDefinitionsResponseOneOf) Get() *FindSloDefinitionsResponseOneOf { + return v.value +} + +func (v *NullableFindSloDefinitionsResponseOneOf) Set(val *FindSloDefinitionsResponseOneOf) { + v.value = val + v.isSet = true +} + +func (v NullableFindSloDefinitionsResponseOneOf) IsSet() bool { + return v.isSet +} + +func (v *NullableFindSloDefinitionsResponseOneOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindSloDefinitionsResponseOneOf(val *FindSloDefinitionsResponseOneOf) *NullableFindSloDefinitionsResponseOneOf { + return &NullableFindSloDefinitionsResponseOneOf{value: val, isSet: true} +} + +func (v NullableFindSloDefinitionsResponseOneOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindSloDefinitionsResponseOneOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_find_slo_definitions_response_one_of_1.go b/generated/slo/model_find_slo_definitions_response_one_of_1.go new file mode 100644 index 000000000..d5197604a --- /dev/null +++ b/generated/slo/model_find_slo_definitions_response_one_of_1.go @@ -0,0 +1,313 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the FindSloDefinitionsResponseOneOf1 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FindSloDefinitionsResponseOneOf1{} + +// FindSloDefinitionsResponseOneOf1 struct for FindSloDefinitionsResponseOneOf1 +type FindSloDefinitionsResponseOneOf1 struct { + // for backward compability + Page *float32 `json:"page,omitempty"` + // for backward compability + PerPage *float32 `json:"perPage,omitempty"` + Size *float32 `json:"size,omitempty"` + // the cursor to provide to get the next paged results + SearchAfter []string `json:"searchAfter,omitempty"` + Total *float32 `json:"total,omitempty"` + Results []SloWithSummaryResponse `json:"results,omitempty"` +} + +// NewFindSloDefinitionsResponseOneOf1 instantiates a new FindSloDefinitionsResponseOneOf1 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 NewFindSloDefinitionsResponseOneOf1() *FindSloDefinitionsResponseOneOf1 { + this := FindSloDefinitionsResponseOneOf1{} + var page float32 = 1 + this.Page = &page + return &this +} + +// NewFindSloDefinitionsResponseOneOf1WithDefaults instantiates a new FindSloDefinitionsResponseOneOf1 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 NewFindSloDefinitionsResponseOneOf1WithDefaults() *FindSloDefinitionsResponseOneOf1 { + this := FindSloDefinitionsResponseOneOf1{} + var page float32 = 1 + this.Page = &page + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *FindSloDefinitionsResponseOneOf1) GetPage() float32 { + if o == nil || IsNil(o.Page) { + var ret float32 + return ret + } + return *o.Page +} + +// 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 *FindSloDefinitionsResponseOneOf1) GetPageOk() (*float32, bool) { + if o == nil || IsNil(o.Page) { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *FindSloDefinitionsResponseOneOf1) HasPage() bool { + if o != nil && !IsNil(o.Page) { + return true + } + + return false +} + +// SetPage gets a reference to the given float32 and assigns it to the Page field. +func (o *FindSloDefinitionsResponseOneOf1) SetPage(v float32) { + o.Page = &v +} + +// GetPerPage returns the PerPage field value if set, zero value otherwise. +func (o *FindSloDefinitionsResponseOneOf1) GetPerPage() float32 { + if o == nil || IsNil(o.PerPage) { + var ret float32 + return ret + } + return *o.PerPage +} + +// 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 *FindSloDefinitionsResponseOneOf1) GetPerPageOk() (*float32, bool) { + if o == nil || IsNil(o.PerPage) { + return nil, false + } + return o.PerPage, true +} + +// HasPerPage returns a boolean if a field has been set. +func (o *FindSloDefinitionsResponseOneOf1) HasPerPage() bool { + if o != nil && !IsNil(o.PerPage) { + return true + } + + return false +} + +// SetPerPage gets a reference to the given float32 and assigns it to the PerPage field. +func (o *FindSloDefinitionsResponseOneOf1) SetPerPage(v float32) { + o.PerPage = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *FindSloDefinitionsResponseOneOf1) GetSize() float32 { + if o == nil || IsNil(o.Size) { + var ret float32 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindSloDefinitionsResponseOneOf1) GetSizeOk() (*float32, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *FindSloDefinitionsResponseOneOf1) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given float32 and assigns it to the Size field. +func (o *FindSloDefinitionsResponseOneOf1) SetSize(v float32) { + o.Size = &v +} + +// GetSearchAfter returns the SearchAfter field value if set, zero value otherwise. +func (o *FindSloDefinitionsResponseOneOf1) GetSearchAfter() []string { + if o == nil || IsNil(o.SearchAfter) { + var ret []string + return ret + } + return o.SearchAfter +} + +// GetSearchAfterOk returns a tuple with the SearchAfter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindSloDefinitionsResponseOneOf1) GetSearchAfterOk() ([]string, bool) { + if o == nil || IsNil(o.SearchAfter) { + return nil, false + } + return o.SearchAfter, true +} + +// HasSearchAfter returns a boolean if a field has been set. +func (o *FindSloDefinitionsResponseOneOf1) HasSearchAfter() bool { + if o != nil && !IsNil(o.SearchAfter) { + return true + } + + return false +} + +// SetSearchAfter gets a reference to the given []string and assigns it to the SearchAfter field. +func (o *FindSloDefinitionsResponseOneOf1) SetSearchAfter(v []string) { + o.SearchAfter = v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *FindSloDefinitionsResponseOneOf1) GetTotal() float32 { + if o == nil || IsNil(o.Total) { + var ret float32 + return ret + } + return *o.Total +} + +// 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 *FindSloDefinitionsResponseOneOf1) GetTotalOk() (*float32, bool) { + if o == nil || IsNil(o.Total) { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *FindSloDefinitionsResponseOneOf1) HasTotal() bool { + if o != nil && !IsNil(o.Total) { + return true + } + + return false +} + +// SetTotal gets a reference to the given float32 and assigns it to the Total field. +func (o *FindSloDefinitionsResponseOneOf1) SetTotal(v float32) { + o.Total = &v +} + +// GetResults returns the Results field value if set, zero value otherwise. +func (o *FindSloDefinitionsResponseOneOf1) GetResults() []SloWithSummaryResponse { + if o == nil || IsNil(o.Results) { + var ret []SloWithSummaryResponse + return ret + } + return o.Results +} + +// GetResultsOk returns a tuple with the Results field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindSloDefinitionsResponseOneOf1) GetResultsOk() ([]SloWithSummaryResponse, bool) { + if o == nil || IsNil(o.Results) { + return nil, false + } + return o.Results, true +} + +// HasResults returns a boolean if a field has been set. +func (o *FindSloDefinitionsResponseOneOf1) HasResults() bool { + if o != nil && !IsNil(o.Results) { + return true + } + + return false +} + +// SetResults gets a reference to the given []SloWithSummaryResponse and assigns it to the Results field. +func (o *FindSloDefinitionsResponseOneOf1) SetResults(v []SloWithSummaryResponse) { + o.Results = v +} + +func (o FindSloDefinitionsResponseOneOf1) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FindSloDefinitionsResponseOneOf1) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Page) { + toSerialize["page"] = o.Page + } + if !IsNil(o.PerPage) { + toSerialize["perPage"] = o.PerPage + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.SearchAfter) { + toSerialize["searchAfter"] = o.SearchAfter + } + if !IsNil(o.Total) { + toSerialize["total"] = o.Total + } + if !IsNil(o.Results) { + toSerialize["results"] = o.Results + } + return toSerialize, nil +} + +type NullableFindSloDefinitionsResponseOneOf1 struct { + value *FindSloDefinitionsResponseOneOf1 + isSet bool +} + +func (v NullableFindSloDefinitionsResponseOneOf1) Get() *FindSloDefinitionsResponseOneOf1 { + return v.value +} + +func (v *NullableFindSloDefinitionsResponseOneOf1) Set(val *FindSloDefinitionsResponseOneOf1) { + v.value = val + v.isSet = true +} + +func (v NullableFindSloDefinitionsResponseOneOf1) IsSet() bool { + return v.isSet +} + +func (v *NullableFindSloDefinitionsResponseOneOf1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindSloDefinitionsResponseOneOf1(val *FindSloDefinitionsResponseOneOf1) *NullableFindSloDefinitionsResponseOneOf1 { + return &NullableFindSloDefinitionsResponseOneOf1{value: val, isSet: true} +} + +func (v NullableFindSloDefinitionsResponseOneOf1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindSloDefinitionsResponseOneOf1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_find_slo_response.go b/generated/slo/model_find_slo_response.go index fe90673e2..3fa981d28 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,12 +17,15 @@ import ( // checks if the FindSloResponse type satisfies the MappedNullable interface at compile time var _ MappedNullable = &FindSloResponse{} -// FindSloResponse A paginated response of SLOs matching the query. +// FindSloResponse A paginated response of SLOs matching the query. type FindSloResponse struct { - Page *float64 `json:"page,omitempty"` - PerPage *float64 `json:"perPage,omitempty"` - Total *float64 `json:"total,omitempty"` - Results []SloResponse `json:"results,omitempty"` + // Size provided for cursor based pagination + Size *float32 `json:"size,omitempty"` + SearchAfter *string `json:"searchAfter,omitempty"` + Page *float32 `json:"page,omitempty"` + PerPage *float32 `json:"perPage,omitempty"` + Total *float32 `json:"total,omitempty"` + Results []SloWithSummaryResponse `json:"results,omitempty"` } // NewFindSloResponse instantiates a new FindSloResponse object @@ -42,10 +45,74 @@ func NewFindSloResponseWithDefaults() *FindSloResponse { return &this } +// GetSize returns the Size field value if set, zero value otherwise. +func (o *FindSloResponse) GetSize() float32 { + if o == nil || IsNil(o.Size) { + var ret float32 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindSloResponse) GetSizeOk() (*float32, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *FindSloResponse) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given float32 and assigns it to the Size field. +func (o *FindSloResponse) SetSize(v float32) { + o.Size = &v +} + +// GetSearchAfter returns the SearchAfter field value if set, zero value otherwise. +func (o *FindSloResponse) GetSearchAfter() string { + if o == nil || IsNil(o.SearchAfter) { + var ret string + return ret + } + return *o.SearchAfter +} + +// GetSearchAfterOk returns a tuple with the SearchAfter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindSloResponse) GetSearchAfterOk() (*string, bool) { + if o == nil || IsNil(o.SearchAfter) { + return nil, false + } + return o.SearchAfter, true +} + +// HasSearchAfter returns a boolean if a field has been set. +func (o *FindSloResponse) HasSearchAfter() bool { + if o != nil && !IsNil(o.SearchAfter) { + return true + } + + return false +} + +// SetSearchAfter gets a reference to the given string and assigns it to the SearchAfter field. +func (o *FindSloResponse) SetSearchAfter(v string) { + o.SearchAfter = &v +} + // GetPage returns the Page field value if set, zero value otherwise. -func (o *FindSloResponse) GetPage() float64 { +func (o *FindSloResponse) GetPage() float32 { if o == nil || IsNil(o.Page) { - var ret float64 + var ret float32 return ret } return *o.Page @@ -53,7 +120,7 @@ func (o *FindSloResponse) GetPage() float64 { // 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() (*float64, bool) { +func (o *FindSloResponse) GetPageOk() (*float32, bool) { if o == nil || IsNil(o.Page) { return nil, false } @@ -69,15 +136,15 @@ func (o *FindSloResponse) HasPage() bool { return false } -// SetPage gets a reference to the given float64 and assigns it to the Page field. -func (o *FindSloResponse) SetPage(v float64) { +// SetPage gets a reference to the given float32 and assigns it to the Page field. +func (o *FindSloResponse) SetPage(v float32) { o.Page = &v } // GetPerPage returns the PerPage field value if set, zero value otherwise. -func (o *FindSloResponse) GetPerPage() float64 { +func (o *FindSloResponse) GetPerPage() float32 { if o == nil || IsNil(o.PerPage) { - var ret float64 + var ret float32 return ret } return *o.PerPage @@ -85,7 +152,7 @@ func (o *FindSloResponse) GetPerPage() float64 { // 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() (*float64, bool) { +func (o *FindSloResponse) GetPerPageOk() (*float32, bool) { if o == nil || IsNil(o.PerPage) { return nil, false } @@ -101,15 +168,15 @@ func (o *FindSloResponse) HasPerPage() bool { return false } -// SetPerPage gets a reference to the given float64 and assigns it to the PerPage field. -func (o *FindSloResponse) SetPerPage(v float64) { +// SetPerPage gets a reference to the given float32 and assigns it to the PerPage field. +func (o *FindSloResponse) SetPerPage(v float32) { o.PerPage = &v } // GetTotal returns the Total field value if set, zero value otherwise. -func (o *FindSloResponse) GetTotal() float64 { +func (o *FindSloResponse) GetTotal() float32 { if o == nil || IsNil(o.Total) { - var ret float64 + var ret float32 return ret } return *o.Total @@ -117,7 +184,7 @@ func (o *FindSloResponse) GetTotal() float64 { // 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() (*float64, bool) { +func (o *FindSloResponse) GetTotalOk() (*float32, bool) { if o == nil || IsNil(o.Total) { return nil, false } @@ -133,15 +200,15 @@ func (o *FindSloResponse) HasTotal() bool { return false } -// SetTotal gets a reference to the given float64 and assigns it to the Total field. -func (o *FindSloResponse) SetTotal(v float64) { +// SetTotal gets a reference to the given float32 and assigns it to the Total field. +func (o *FindSloResponse) SetTotal(v float32) { o.Total = &v } // GetResults returns the Results field value if set, zero value otherwise. -func (o *FindSloResponse) GetResults() []SloResponse { +func (o *FindSloResponse) GetResults() []SloWithSummaryResponse { if o == nil || IsNil(o.Results) { - var ret []SloResponse + var ret []SloWithSummaryResponse return ret } return o.Results @@ -149,7 +216,7 @@ func (o *FindSloResponse) GetResults() []SloResponse { // GetResultsOk returns a tuple with the Results field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *FindSloResponse) GetResultsOk() ([]SloResponse, bool) { +func (o *FindSloResponse) GetResultsOk() ([]SloWithSummaryResponse, bool) { if o == nil || IsNil(o.Results) { return nil, false } @@ -165,13 +232,13 @@ func (o *FindSloResponse) HasResults() bool { return false } -// SetResults gets a reference to the given []SloResponse and assigns it to the Results field. -func (o *FindSloResponse) SetResults(v []SloResponse) { +// SetResults gets a reference to the given []SloWithSummaryResponse and assigns it to the Results field. +func (o *FindSloResponse) SetResults(v []SloWithSummaryResponse) { o.Results = v } func (o FindSloResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -180,6 +247,12 @@ func (o FindSloResponse) MarshalJSON() ([]byte, error) { func (o FindSloResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.SearchAfter) { + toSerialize["searchAfter"] = o.SearchAfter + } if !IsNil(o.Page) { toSerialize["page"] = o.Page } @@ -230,3 +303,5 @@ func (v *NullableFindSloResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_group_by.go b/generated/slo/model_group_by.go new file mode 100644 index 000000000..a5929d23b --- /dev/null +++ b/generated/slo/model_group_by.go @@ -0,0 +1,171 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "fmt" + "gopkg.in/validator.v2" +) + +// GroupBy - optional group by field or fields to use to generate an SLO per distinct value +type GroupBy struct { + ArrayOfString *[]string + String *string +} + +// []stringAsGroupBy is a convenience function that returns []string wrapped in GroupBy +func ArrayOfStringAsGroupBy(v *[]string) GroupBy { + return GroupBy{ + ArrayOfString: v, + } +} + +// stringAsGroupBy is a convenience function that returns string wrapped in GroupBy +func StringAsGroupBy(v *string) GroupBy { + return GroupBy{ + String: v, + } +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *GroupBy) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into ArrayOfString + err = newStrictDecoder(data).Decode(&dst.ArrayOfString) + if err == nil { + jsonArrayOfString, _ := json.Marshal(dst.ArrayOfString) + if string(jsonArrayOfString) == "{}" { // empty struct + dst.ArrayOfString = nil + } else { + if err = validator.Validate(dst.ArrayOfString); err != nil { + dst.ArrayOfString = nil + } else { + match++ + } + } + } else { + dst.ArrayOfString = nil + } + + // try to unmarshal data into String + err = newStrictDecoder(data).Decode(&dst.String) + if err == nil { + jsonString, _ := json.Marshal(dst.String) + if string(jsonString) == "{}" { // empty struct + dst.String = nil + } else { + if err = validator.Validate(dst.String); err != nil { + dst.String = nil + } else { + match++ + } + } + } else { + dst.String = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.ArrayOfString = nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(GroupBy)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(GroupBy)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src GroupBy) MarshalJSON() ([]byte, error) { + if src.ArrayOfString != nil { + return json.Marshal(&src.ArrayOfString) + } + + if src.String != nil { + return json.Marshal(&src.String) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *GroupBy) GetActualInstance() (interface{}) { + if obj == nil { + return nil + } + if obj.ArrayOfString != nil { + return obj.ArrayOfString + } + + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj GroupBy) GetActualInstanceValue() (interface{}) { + if obj.ArrayOfString != nil { + return *obj.ArrayOfString + } + + if obj.String != nil { + return *obj.String + } + + // all schemas are nil + return nil +} + +type NullableGroupBy struct { + value *GroupBy + isSet bool +} + +func (v NullableGroupBy) Get() *GroupBy { + return v.value +} + +func (v *NullableGroupBy) Set(val *GroupBy) { + v.value = val + v.isSet = true +} + +func (v NullableGroupBy) IsSet() bool { + return v.isSet +} + +func (v *NullableGroupBy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGroupBy(val *GroupBy) *NullableGroupBy { + return &NullableGroupBy{value: val, isSet: true} +} + +func (v NullableGroupBy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGroupBy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_indicator_properties_apm_availability.go b/generated/slo/model_indicator_properties_apm_availability.go index a449183cc..c8abe69d7 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesApmAvailability type satisfies the MappedNullable interface at compile time @@ -24,6 +26,8 @@ type IndicatorPropertiesApmAvailability struct { Type string `json:"type"` } +type _IndicatorPropertiesApmAvailability IndicatorPropertiesApmAvailability + // NewIndicatorPropertiesApmAvailability instantiates a new IndicatorPropertiesApmAvailability 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 @@ -92,7 +96,7 @@ func (o *IndicatorPropertiesApmAvailability) SetType(v string) { } func (o IndicatorPropertiesApmAvailability) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -106,6 +110,44 @@ func (o IndicatorPropertiesApmAvailability) ToMap() (map[string]interface{}, err return toSerialize, nil } +func (o *IndicatorPropertiesApmAvailability) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "params", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesApmAvailability := _IndicatorPropertiesApmAvailability{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesApmAvailability) + + if err != nil { + return err + } + + *o = IndicatorPropertiesApmAvailability(varIndicatorPropertiesApmAvailability) + + return err +} + type NullableIndicatorPropertiesApmAvailability struct { value *IndicatorPropertiesApmAvailability isSet bool @@ -141,3 +183,5 @@ func (v *NullableIndicatorPropertiesApmAvailability) UnmarshalJSON(src []byte) e v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_indicator_properties_apm_availability_params.go b/generated/slo/model_indicator_properties_apm_availability_params.go index 5872135c1..168de4136 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesApmAvailabilityParams type satisfies the MappedNullable interface at compile time @@ -33,6 +35,8 @@ type IndicatorPropertiesApmAvailabilityParams struct { Index string `json:"index"` } +type _IndicatorPropertiesApmAvailabilityParams IndicatorPropertiesApmAvailabilityParams + // NewIndicatorPropertiesApmAvailabilityParams instantiates a new IndicatorPropertiesApmAvailabilityParams 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 @@ -208,7 +212,7 @@ func (o *IndicatorPropertiesApmAvailabilityParams) SetIndex(v string) { } func (o IndicatorPropertiesApmAvailabilityParams) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -228,6 +232,47 @@ func (o IndicatorPropertiesApmAvailabilityParams) ToMap() (map[string]interface{ return toSerialize, nil } +func (o *IndicatorPropertiesApmAvailabilityParams) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "service", + "environment", + "transactionType", + "transactionName", + "index", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesApmAvailabilityParams := _IndicatorPropertiesApmAvailabilityParams{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesApmAvailabilityParams) + + if err != nil { + return err + } + + *o = IndicatorPropertiesApmAvailabilityParams(varIndicatorPropertiesApmAvailabilityParams) + + return err +} + type NullableIndicatorPropertiesApmAvailabilityParams struct { value *IndicatorPropertiesApmAvailabilityParams isSet bool @@ -263,3 +308,5 @@ func (v *NullableIndicatorPropertiesApmAvailabilityParams) UnmarshalJSON(src []b v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_indicator_properties_apm_latency.go b/generated/slo/model_indicator_properties_apm_latency.go index 5876d056a..239a5cc92 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesApmLatency type satisfies the MappedNullable interface at compile time @@ -24,6 +26,8 @@ type IndicatorPropertiesApmLatency struct { Type string `json:"type"` } +type _IndicatorPropertiesApmLatency IndicatorPropertiesApmLatency + // NewIndicatorPropertiesApmLatency instantiates a new IndicatorPropertiesApmLatency 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 @@ -92,7 +96,7 @@ func (o *IndicatorPropertiesApmLatency) SetType(v string) { } func (o IndicatorPropertiesApmLatency) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -106,6 +110,44 @@ func (o IndicatorPropertiesApmLatency) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *IndicatorPropertiesApmLatency) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "params", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesApmLatency := _IndicatorPropertiesApmLatency{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesApmLatency) + + if err != nil { + return err + } + + *o = IndicatorPropertiesApmLatency(varIndicatorPropertiesApmLatency) + + return err +} + type NullableIndicatorPropertiesApmLatency struct { value *IndicatorPropertiesApmLatency isSet bool @@ -141,3 +183,5 @@ func (v *NullableIndicatorPropertiesApmLatency) UnmarshalJSON(src []byte) error v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_indicator_properties_apm_latency_params.go b/generated/slo/model_indicator_properties_apm_latency_params.go index 74c484f39..2651e7d78 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesApmLatencyParams type satisfies the MappedNullable interface at compile time @@ -32,14 +34,16 @@ type IndicatorPropertiesApmLatencyParams struct { // The index used by APM metrics Index string `json:"index"` // The latency threshold in milliseconds - Threshold float64 `json:"threshold"` + Threshold float32 `json:"threshold"` } +type _IndicatorPropertiesApmLatencyParams IndicatorPropertiesApmLatencyParams + // 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, threshold float64) *IndicatorPropertiesApmLatencyParams { +func NewIndicatorPropertiesApmLatencyParams(service string, environment string, transactionType string, transactionName string, index string, threshold float32) *IndicatorPropertiesApmLatencyParams { this := IndicatorPropertiesApmLatencyParams{} this.Service = service this.Environment = environment @@ -211,9 +215,9 @@ func (o *IndicatorPropertiesApmLatencyParams) SetIndex(v string) { } // GetThreshold returns the Threshold field value -func (o *IndicatorPropertiesApmLatencyParams) GetThreshold() float64 { +func (o *IndicatorPropertiesApmLatencyParams) GetThreshold() float32 { if o == nil { - var ret float64 + var ret float32 return ret } @@ -222,7 +226,7 @@ func (o *IndicatorPropertiesApmLatencyParams) GetThreshold() float64 { // 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) { +func (o *IndicatorPropertiesApmLatencyParams) GetThresholdOk() (*float32, bool) { if o == nil { return nil, false } @@ -230,12 +234,12 @@ func (o *IndicatorPropertiesApmLatencyParams) GetThresholdOk() (*float64, bool) } // SetThreshold sets field value -func (o *IndicatorPropertiesApmLatencyParams) SetThreshold(v float64) { +func (o *IndicatorPropertiesApmLatencyParams) SetThreshold(v float32) { o.Threshold = v } func (o IndicatorPropertiesApmLatencyParams) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -256,6 +260,48 @@ func (o IndicatorPropertiesApmLatencyParams) ToMap() (map[string]interface{}, er return toSerialize, nil } +func (o *IndicatorPropertiesApmLatencyParams) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "service", + "environment", + "transactionType", + "transactionName", + "index", + "threshold", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesApmLatencyParams := _IndicatorPropertiesApmLatencyParams{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesApmLatencyParams) + + if err != nil { + return err + } + + *o = IndicatorPropertiesApmLatencyParams(varIndicatorPropertiesApmLatencyParams) + + return err +} + type NullableIndicatorPropertiesApmLatencyParams struct { value *IndicatorPropertiesApmLatencyParams isSet bool @@ -291,3 +337,5 @@ func (v *NullableIndicatorPropertiesApmLatencyParams) UnmarshalJSON(src []byte) v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_indicator_properties_custom_kql.go b/generated/slo/model_indicator_properties_custom_kql.go index 657856d3f..4cf2ccab7 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,18 +12,22 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesCustomKql type satisfies the MappedNullable interface at compile time var _ MappedNullable = &IndicatorPropertiesCustomKql{} -// IndicatorPropertiesCustomKql Defines properties for a custom KQL indicator type +// IndicatorPropertiesCustomKql Defines properties for a custom query indicator type type IndicatorPropertiesCustomKql struct { Params IndicatorPropertiesCustomKqlParams `json:"params"` // The type of indicator. Type string `json:"type"` } +type _IndicatorPropertiesCustomKql IndicatorPropertiesCustomKql + // NewIndicatorPropertiesCustomKql instantiates a new IndicatorPropertiesCustomKql 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 @@ -92,7 +96,7 @@ func (o *IndicatorPropertiesCustomKql) SetType(v string) { } func (o IndicatorPropertiesCustomKql) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -106,6 +110,44 @@ func (o IndicatorPropertiesCustomKql) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *IndicatorPropertiesCustomKql) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "params", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesCustomKql := _IndicatorPropertiesCustomKql{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesCustomKql) + + if err != nil { + return err + } + + *o = IndicatorPropertiesCustomKql(varIndicatorPropertiesCustomKql) + + return err +} + type NullableIndicatorPropertiesCustomKql struct { value *IndicatorPropertiesCustomKql isSet bool @@ -141,3 +183,5 @@ func (v *NullableIndicatorPropertiesCustomKql) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_indicator_properties_custom_kql_params.go b/generated/slo/model_indicator_properties_custom_kql_params.go index e84d0b41d..0b376d893 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesCustomKqlParams type satisfies the MappedNullable interface at compile time @@ -21,21 +23,22 @@ var _ MappedNullable = &IndicatorPropertiesCustomKqlParams{} type IndicatorPropertiesCustomKqlParams 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 KQL query used to define the good events. - Good string `json:"good"` - // the KQL query used to define all events. - Total string `json:"total"` - // The timestamp field used in the source indice. + // The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. + DataViewId *string `json:"dataViewId,omitempty"` + Filter *KqlWithFilters `json:"filter,omitempty"` + Good KqlWithFiltersGood `json:"good"` + Total KqlWithFiltersTotal `json:"total"` + // The timestamp field used in the source indice. TimestampField string `json:"timestampField"` } +type _IndicatorPropertiesCustomKqlParams IndicatorPropertiesCustomKqlParams + // NewIndicatorPropertiesCustomKqlParams instantiates a new IndicatorPropertiesCustomKqlParams 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 NewIndicatorPropertiesCustomKqlParams(index string, good string, total string, timestampField string) *IndicatorPropertiesCustomKqlParams { +func NewIndicatorPropertiesCustomKqlParams(index string, good KqlWithFiltersGood, total KqlWithFiltersTotal, timestampField string) *IndicatorPropertiesCustomKqlParams { this := IndicatorPropertiesCustomKqlParams{} this.Index = index this.Good = good @@ -76,10 +79,42 @@ func (o *IndicatorPropertiesCustomKqlParams) SetIndex(v string) { o.Index = v } +// GetDataViewId returns the DataViewId field value if set, zero value otherwise. +func (o *IndicatorPropertiesCustomKqlParams) GetDataViewId() string { + if o == nil || IsNil(o.DataViewId) { + var ret string + return ret + } + return *o.DataViewId +} + +// GetDataViewIdOk returns a tuple with the DataViewId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesCustomKqlParams) GetDataViewIdOk() (*string, bool) { + if o == nil || IsNil(o.DataViewId) { + return nil, false + } + return o.DataViewId, true +} + +// HasDataViewId returns a boolean if a field has been set. +func (o *IndicatorPropertiesCustomKqlParams) HasDataViewId() bool { + if o != nil && !IsNil(o.DataViewId) { + return true + } + + return false +} + +// SetDataViewId gets a reference to the given string and assigns it to the DataViewId field. +func (o *IndicatorPropertiesCustomKqlParams) SetDataViewId(v string) { + o.DataViewId = &v +} + // GetFilter returns the Filter field value if set, zero value otherwise. -func (o *IndicatorPropertiesCustomKqlParams) GetFilter() string { +func (o *IndicatorPropertiesCustomKqlParams) GetFilter() KqlWithFilters { if o == nil || IsNil(o.Filter) { - var ret string + var ret KqlWithFilters return ret } return *o.Filter @@ -87,7 +122,7 @@ func (o *IndicatorPropertiesCustomKqlParams) GetFilter() string { // 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 *IndicatorPropertiesCustomKqlParams) GetFilterOk() (*string, bool) { +func (o *IndicatorPropertiesCustomKqlParams) GetFilterOk() (*KqlWithFilters, bool) { if o == nil || IsNil(o.Filter) { return nil, false } @@ -103,15 +138,15 @@ func (o *IndicatorPropertiesCustomKqlParams) HasFilter() bool { return false } -// SetFilter gets a reference to the given string and assigns it to the Filter field. -func (o *IndicatorPropertiesCustomKqlParams) SetFilter(v string) { +// SetFilter gets a reference to the given KqlWithFilters and assigns it to the Filter field. +func (o *IndicatorPropertiesCustomKqlParams) SetFilter(v KqlWithFilters) { o.Filter = &v } // GetGood returns the Good field value -func (o *IndicatorPropertiesCustomKqlParams) GetGood() string { +func (o *IndicatorPropertiesCustomKqlParams) GetGood() KqlWithFiltersGood { if o == nil { - var ret string + var ret KqlWithFiltersGood return ret } @@ -120,7 +155,7 @@ func (o *IndicatorPropertiesCustomKqlParams) GetGood() string { // GetGoodOk returns a tuple with the Good field value // and a boolean to check if the value has been set. -func (o *IndicatorPropertiesCustomKqlParams) GetGoodOk() (*string, bool) { +func (o *IndicatorPropertiesCustomKqlParams) GetGoodOk() (*KqlWithFiltersGood, bool) { if o == nil { return nil, false } @@ -128,14 +163,14 @@ func (o *IndicatorPropertiesCustomKqlParams) GetGoodOk() (*string, bool) { } // SetGood sets field value -func (o *IndicatorPropertiesCustomKqlParams) SetGood(v string) { +func (o *IndicatorPropertiesCustomKqlParams) SetGood(v KqlWithFiltersGood) { o.Good = v } // GetTotal returns the Total field value -func (o *IndicatorPropertiesCustomKqlParams) GetTotal() string { +func (o *IndicatorPropertiesCustomKqlParams) GetTotal() KqlWithFiltersTotal { if o == nil { - var ret string + var ret KqlWithFiltersTotal return ret } @@ -144,7 +179,7 @@ func (o *IndicatorPropertiesCustomKqlParams) GetTotal() string { // GetTotalOk returns a tuple with the Total field value // and a boolean to check if the value has been set. -func (o *IndicatorPropertiesCustomKqlParams) GetTotalOk() (*string, bool) { +func (o *IndicatorPropertiesCustomKqlParams) GetTotalOk() (*KqlWithFiltersTotal, bool) { if o == nil { return nil, false } @@ -152,7 +187,7 @@ func (o *IndicatorPropertiesCustomKqlParams) GetTotalOk() (*string, bool) { } // SetTotal sets field value -func (o *IndicatorPropertiesCustomKqlParams) SetTotal(v string) { +func (o *IndicatorPropertiesCustomKqlParams) SetTotal(v KqlWithFiltersTotal) { o.Total = v } @@ -181,7 +216,7 @@ func (o *IndicatorPropertiesCustomKqlParams) SetTimestampField(v string) { } func (o IndicatorPropertiesCustomKqlParams) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -191,6 +226,9 @@ func (o IndicatorPropertiesCustomKqlParams) MarshalJSON() ([]byte, error) { func (o IndicatorPropertiesCustomKqlParams) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["index"] = o.Index + if !IsNil(o.DataViewId) { + toSerialize["dataViewId"] = o.DataViewId + } if !IsNil(o.Filter) { toSerialize["filter"] = o.Filter } @@ -200,6 +238,46 @@ func (o IndicatorPropertiesCustomKqlParams) ToMap() (map[string]interface{}, err return toSerialize, nil } +func (o *IndicatorPropertiesCustomKqlParams) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "index", + "good", + "total", + "timestampField", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesCustomKqlParams := _IndicatorPropertiesCustomKqlParams{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesCustomKqlParams) + + if err != nil { + return err + } + + *o = IndicatorPropertiesCustomKqlParams(varIndicatorPropertiesCustomKqlParams) + + return err +} + type NullableIndicatorPropertiesCustomKqlParams struct { value *IndicatorPropertiesCustomKqlParams isSet bool @@ -235,3 +313,5 @@ func (v *NullableIndicatorPropertiesCustomKqlParams) UnmarshalJSON(src []byte) e v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_indicator_properties_custom_metric.go b/generated/slo/model_indicator_properties_custom_metric.go index 80b194643..112dbc563 100644 --- a/generated/slo/model_indicator_properties_custom_metric.go +++ b/generated/slo/model_indicator_properties_custom_metric.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesCustomMetric type satisfies the MappedNullable interface at compile time @@ -24,6 +26,8 @@ type IndicatorPropertiesCustomMetric struct { Type string `json:"type"` } +type _IndicatorPropertiesCustomMetric 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 @@ -92,7 +96,7 @@ func (o *IndicatorPropertiesCustomMetric) SetType(v string) { } func (o IndicatorPropertiesCustomMetric) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -106,6 +110,44 @@ func (o IndicatorPropertiesCustomMetric) ToMap() (map[string]interface{}, error) return toSerialize, nil } +func (o *IndicatorPropertiesCustomMetric) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "params", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesCustomMetric := _IndicatorPropertiesCustomMetric{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesCustomMetric) + + if err != nil { + return err + } + + *o = IndicatorPropertiesCustomMetric(varIndicatorPropertiesCustomMetric) + + return err +} + type NullableIndicatorPropertiesCustomMetric struct { value *IndicatorPropertiesCustomMetric isSet bool @@ -141,3 +183,5 @@ func (v *NullableIndicatorPropertiesCustomMetric) UnmarshalJSON(src []byte) erro 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 index 88f7cc8db..1994f570f 100644 --- a/generated/slo/model_indicator_properties_custom_metric_params.go +++ b/generated/slo/model_indicator_properties_custom_metric_params.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesCustomMetricParams type satisfies the MappedNullable interface at compile time @@ -21,14 +23,18 @@ var _ MappedNullable = &IndicatorPropertiesCustomMetricParams{} type IndicatorPropertiesCustomMetricParams struct { // The index or index pattern to use Index string `json:"index"` + // The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. + DataViewId *string `json:"dataViewId,omitempty"` // 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 IndicatorPropertiesCustomMetricParamsGood `json:"good"` - Total IndicatorPropertiesCustomMetricParamsTotal `json:"total"` + // The timestamp field used in the source indice. + TimestampField string `json:"timestampField"` + Good IndicatorPropertiesCustomMetricParamsGood `json:"good"` + Total IndicatorPropertiesCustomMetricParamsTotal `json:"total"` } +type _IndicatorPropertiesCustomMetricParams 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 @@ -74,6 +80,38 @@ func (o *IndicatorPropertiesCustomMetricParams) SetIndex(v string) { o.Index = v } +// GetDataViewId returns the DataViewId field value if set, zero value otherwise. +func (o *IndicatorPropertiesCustomMetricParams) GetDataViewId() string { + if o == nil || IsNil(o.DataViewId) { + var ret string + return ret + } + return *o.DataViewId +} + +// GetDataViewIdOk returns a tuple with the DataViewId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesCustomMetricParams) GetDataViewIdOk() (*string, bool) { + if o == nil || IsNil(o.DataViewId) { + return nil, false + } + return o.DataViewId, true +} + +// HasDataViewId returns a boolean if a field has been set. +func (o *IndicatorPropertiesCustomMetricParams) HasDataViewId() bool { + if o != nil && !IsNil(o.DataViewId) { + return true + } + + return false +} + +// SetDataViewId gets a reference to the given string and assigns it to the DataViewId field. +func (o *IndicatorPropertiesCustomMetricParams) SetDataViewId(v string) { + o.DataViewId = &v +} + // GetFilter returns the Filter field value if set, zero value otherwise. func (o *IndicatorPropertiesCustomMetricParams) GetFilter() string { if o == nil || IsNil(o.Filter) { @@ -179,7 +217,7 @@ func (o *IndicatorPropertiesCustomMetricParams) SetTotal(v IndicatorPropertiesCu } func (o IndicatorPropertiesCustomMetricParams) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -189,6 +227,9 @@ func (o IndicatorPropertiesCustomMetricParams) MarshalJSON() ([]byte, error) { func (o IndicatorPropertiesCustomMetricParams) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["index"] = o.Index + if !IsNil(o.DataViewId) { + toSerialize["dataViewId"] = o.DataViewId + } if !IsNil(o.Filter) { toSerialize["filter"] = o.Filter } @@ -198,6 +239,46 @@ func (o IndicatorPropertiesCustomMetricParams) ToMap() (map[string]interface{}, return toSerialize, nil } +func (o *IndicatorPropertiesCustomMetricParams) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "index", + "timestampField", + "good", + "total", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesCustomMetricParams := _IndicatorPropertiesCustomMetricParams{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesCustomMetricParams) + + if err != nil { + return err + } + + *o = IndicatorPropertiesCustomMetricParams(varIndicatorPropertiesCustomMetricParams) + + return err +} + type NullableIndicatorPropertiesCustomMetricParams struct { value *IndicatorPropertiesCustomMetricParams isSet bool @@ -233,3 +314,5 @@ func (v *NullableIndicatorPropertiesCustomMetricParams) UnmarshalJSON(src []byte 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 index ada18b405..d1b8b799c 100644 --- a/generated/slo/model_indicator_properties_custom_metric_params_good.go +++ b/generated/slo/model_indicator_properties_custom_metric_params_good.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,12 +12,14 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesCustomMetricParamsGood type satisfies the MappedNullable interface at compile time var _ MappedNullable = &IndicatorPropertiesCustomMetricParamsGood{} -// IndicatorPropertiesCustomMetricParamsGood An object defining the \"good\" metrics and equation +// 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"` @@ -25,6 +27,8 @@ type IndicatorPropertiesCustomMetricParamsGood struct { Equation string `json:"equation"` } +type _IndicatorPropertiesCustomMetricParamsGood 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 @@ -93,7 +97,7 @@ func (o *IndicatorPropertiesCustomMetricParamsGood) SetEquation(v string) { } func (o IndicatorPropertiesCustomMetricParamsGood) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -107,6 +111,44 @@ func (o IndicatorPropertiesCustomMetricParamsGood) ToMap() (map[string]interface return toSerialize, nil } +func (o *IndicatorPropertiesCustomMetricParamsGood) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "metrics", + "equation", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesCustomMetricParamsGood := _IndicatorPropertiesCustomMetricParamsGood{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesCustomMetricParamsGood) + + if err != nil { + return err + } + + *o = IndicatorPropertiesCustomMetricParamsGood(varIndicatorPropertiesCustomMetricParamsGood) + + return err +} + type NullableIndicatorPropertiesCustomMetricParamsGood struct { value *IndicatorPropertiesCustomMetricParamsGood isSet bool @@ -142,3 +184,5 @@ func (v *NullableIndicatorPropertiesCustomMetricParamsGood) UnmarshalJSON(src [] 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 index 59c91d2fb..8c7d7238f 100644 --- 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 @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,164 +12,124 @@ package slo import ( "encoding/json" + "fmt" + "gopkg.in/validator.v2" ) -// checks if the IndicatorPropertiesCustomMetricParamsGoodMetricsInner type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &IndicatorPropertiesCustomMetricParamsGoodMetricsInner{} - -// IndicatorPropertiesCustomMetricParamsGoodMetricsInner struct for 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 + IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf + IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 } -// 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 +// IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOfAsIndicatorPropertiesCustomMetricParamsGoodMetricsInner is a convenience function that returns IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf wrapped in IndicatorPropertiesCustomMetricParamsGoodMetricsInner +func IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOfAsIndicatorPropertiesCustomMetricParamsGoodMetricsInner(v *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) IndicatorPropertiesCustomMetricParamsGoodMetricsInner { + return IndicatorPropertiesCustomMetricParamsGoodMetricsInner{ + IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf: v, } - - 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 +// IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1AsIndicatorPropertiesCustomMetricParamsGoodMetricsInner is a convenience function that returns IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 wrapped in IndicatorPropertiesCustomMetricParamsGoodMetricsInner +func IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1AsIndicatorPropertiesCustomMetricParamsGoodMetricsInner(v *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) IndicatorPropertiesCustomMetricParamsGoodMetricsInner { + return IndicatorPropertiesCustomMetricParamsGoodMetricsInner{ + IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1: v, } - 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 +// Unmarshal JSON data into one of the pointers in the struct +func (dst *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf + err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) + if err == nil { + jsonIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf, _ := json.Marshal(dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) + if string(jsonIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) == "{}" { // empty struct + dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf = nil + } else { + if err = validator.Validate(dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf); err != nil { + dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf = nil + } else { + match++ + } + } + } else { + dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf = nil } - 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 + // try to unmarshal data into IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 + err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) + if err == nil { + jsonIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1, _ := json.Marshal(dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) + if string(jsonIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) == "{}" { // empty struct + dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 = nil + } else { + if err = validator.Validate(dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1); err != nil { + dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 = nil + } else { + match++ + } + } + } else { + dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 = nil } - return &o.Aggregation, true -} -// SetAggregation sets field value -func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) SetAggregation(v string) { - o.Aggregation = v -} + if match > 1 { // more than 1 match + // reset to nil + dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf = nil + dst.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 = nil -// GetField returns the Field field value -func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) GetField() string { - if o == nil { - var ret string - return ret + return fmt.Errorf("data matches more than one schema in oneOf(IndicatorPropertiesCustomMetricParamsGoodMetricsInner)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(IndicatorPropertiesCustomMetricParamsGoodMetricsInner)") } - - 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 +// Marshal data from the first non-nil pointers in the struct to JSON +func (src IndicatorPropertiesCustomMetricParamsGoodMetricsInner) MarshalJSON() ([]byte, error) { + if src.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf != nil { + return json.Marshal(&src.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) } - 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 + if src.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 != nil { + return json.Marshal(&src.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) } - 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 + return nil, nil // no data in oneOf schemas } -// HasFilter returns a boolean if a field has been set. -func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) HasFilter() bool { - if o != nil && !IsNil(o.Filter) { - return true +// Get the actual instance +func (obj *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) GetActualInstance() (interface{}) { + if obj == nil { + return nil + } + if obj.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf != nil { + return obj.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf } - return false -} + if obj.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 != nil { + return obj.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 + } -// SetFilter gets a reference to the given string and assigns it to the Filter field. -func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInner) SetFilter(v string) { - o.Filter = &v + // all schemas are nil + return nil } -func (o IndicatorPropertiesCustomMetricParamsGoodMetricsInner) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err +// Get the actual instance value +func (obj IndicatorPropertiesCustomMetricParamsGoodMetricsInner) GetActualInstanceValue() (interface{}) { + if obj.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf != nil { + return *obj.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf } - 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 + if obj.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 != nil { + return *obj.IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 } - return toSerialize, nil + + // all schemas are nil + return nil } type NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInner struct { @@ -207,3 +167,5 @@ func (v *NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInner) Unmarsha v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_indicator_properties_custom_metric_params_good_metrics_inner_one_of.go b/generated/slo/model_indicator_properties_custom_metric_params_good_metrics_inner_one_of.go new file mode 100644 index 000000000..0f5f69987 --- /dev/null +++ b/generated/slo/model_indicator_properties_custom_metric_params_good_metrics_inner_one_of.go @@ -0,0 +1,254 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf{} + +// IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf struct for IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf +type IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf struct { + // The name of the metric. Only valid options are A-Z + Name string `json:"name" validate:"regexp=^[A-Z]$"` + // The aggregation type of the metric. + Aggregation string `json:"aggregation"` + // The field of the metric. + Field string `json:"field"` + // The filter to apply to the metric. + Filter *string `json:"filter,omitempty"` +} + +type _IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf + +// NewIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf instantiates a new IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf 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 NewIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf(name string, aggregation string, field string) *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf { + this := IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf{} + this.Name = name + this.Aggregation = aggregation + this.Field = field + return &this +} + +// NewIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOfWithDefaults instantiates a new IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf 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 NewIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOfWithDefaults() *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf { + this := IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf{} + return &this +} + +// GetName returns the Name field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) SetName(v string) { + o.Name = v +} + +// GetAggregation returns the Aggregation field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) GetAggregationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) SetAggregation(v string) { + o.Aggregation = v +} + +// GetField returns the Field field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) GetFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Field, true +} + +// SetField sets field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) SetField(v string) { + o.Field = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) SetFilter(v string) { + o.Filter = &v +} + +func (o IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) 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 +} + +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "aggregation", + "field", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf := _IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) + + if err != nil { + return err + } + + *o = IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf(varIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) + + return err +} + +type NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf struct { + value *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf + isSet bool +} + +func (v NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) Get() *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf { + return v.value +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) Set(val *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf(val *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) *NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf { + return &NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf) 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_one_of_1.go b/generated/slo/model_indicator_properties_custom_metric_params_good_metrics_inner_one_of_1.go new file mode 100644 index 000000000..9659e7f65 --- /dev/null +++ b/generated/slo/model_indicator_properties_custom_metric_params_good_metrics_inner_one_of_1.go @@ -0,0 +1,225 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1{} + +// IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 struct for IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 +type IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 struct { + // The name of the metric. Only valid options are A-Z + Name string `json:"name" validate:"regexp=^[A-Z]$"` + // The aggregation type of the metric. + Aggregation string `json:"aggregation"` + // The filter to apply to the metric. + Filter *string `json:"filter,omitempty"` +} + +type _IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 + +// NewIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 instantiates a new IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 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 NewIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1(name string, aggregation string) *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 { + this := IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1{} + this.Name = name + this.Aggregation = aggregation + return &this +} + +// NewIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1WithDefaults instantiates a new IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 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 NewIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1WithDefaults() *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 { + this := IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1{} + return &this +} + +// GetName returns the Name field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) SetName(v string) { + o.Name = v +} + +// GetAggregation returns the Aggregation field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) GetAggregationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Aggregation, true +} + +// SetAggregation sets field value +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) SetAggregation(v string) { + o.Aggregation = v +} + +// GetFilter returns the Filter field value if set, zero value otherwise. +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) 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 *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) SetFilter(v string) { + o.Filter = &v +} + +func (o IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["aggregation"] = o.Aggregation + if !IsNil(o.Filter) { + toSerialize["filter"] = o.Filter + } + return toSerialize, nil +} + +func (o *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "aggregation", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 := _IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) + + if err != nil { + return err + } + + *o = IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1(varIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) + + return err +} + +type NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 struct { + value *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 + isSet bool +} + +func (v NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) Get() *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 { + return v.value +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) Set(val *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) { + v.value = val + v.isSet = true +} + +func (v NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) IsSet() bool { + return v.isSet +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1(val *IndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) *NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1 { + return &NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1{value: val, isSet: true} +} + +func (v NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndicatorPropertiesCustomMetricParamsGoodMetricsInnerOneOf1) 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 index 58d6d255b..b168a15bb 100644 --- a/generated/slo/model_indicator_properties_custom_metric_params_total.go +++ b/generated/slo/model_indicator_properties_custom_metric_params_total.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,24 +12,28 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesCustomMetricParamsTotal type satisfies the MappedNullable interface at compile time var _ MappedNullable = &IndicatorPropertiesCustomMetricParamsTotal{} -// IndicatorPropertiesCustomMetricParamsTotal An object defining the \"total\" metrics and equation +// 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"` + Metrics []IndicatorPropertiesCustomMetricParamsGoodMetricsInner `json:"metrics"` // The equation to calculate the \"total\" metric. Equation string `json:"equation"` } +type _IndicatorPropertiesCustomMetricParamsTotal 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 -func NewIndicatorPropertiesCustomMetricParamsTotal(metrics []IndicatorPropertiesCustomMetricParamsTotalMetricsInner, equation string) *IndicatorPropertiesCustomMetricParamsTotal { +func NewIndicatorPropertiesCustomMetricParamsTotal(metrics []IndicatorPropertiesCustomMetricParamsGoodMetricsInner, equation string) *IndicatorPropertiesCustomMetricParamsTotal { this := IndicatorPropertiesCustomMetricParamsTotal{} this.Metrics = metrics this.Equation = equation @@ -45,9 +49,9 @@ func NewIndicatorPropertiesCustomMetricParamsTotalWithDefaults() *IndicatorPrope } // GetMetrics returns the Metrics field value -func (o *IndicatorPropertiesCustomMetricParamsTotal) GetMetrics() []IndicatorPropertiesCustomMetricParamsTotalMetricsInner { +func (o *IndicatorPropertiesCustomMetricParamsTotal) GetMetrics() []IndicatorPropertiesCustomMetricParamsGoodMetricsInner { if o == nil { - var ret []IndicatorPropertiesCustomMetricParamsTotalMetricsInner + var ret []IndicatorPropertiesCustomMetricParamsGoodMetricsInner return ret } @@ -56,7 +60,7 @@ func (o *IndicatorPropertiesCustomMetricParamsTotal) GetMetrics() []IndicatorPro // 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) { +func (o *IndicatorPropertiesCustomMetricParamsTotal) GetMetricsOk() ([]IndicatorPropertiesCustomMetricParamsGoodMetricsInner, bool) { if o == nil { return nil, false } @@ -64,7 +68,7 @@ func (o *IndicatorPropertiesCustomMetricParamsTotal) GetMetricsOk() ([]Indicator } // SetMetrics sets field value -func (o *IndicatorPropertiesCustomMetricParamsTotal) SetMetrics(v []IndicatorPropertiesCustomMetricParamsTotalMetricsInner) { +func (o *IndicatorPropertiesCustomMetricParamsTotal) SetMetrics(v []IndicatorPropertiesCustomMetricParamsGoodMetricsInner) { o.Metrics = v } @@ -93,7 +97,7 @@ func (o *IndicatorPropertiesCustomMetricParamsTotal) SetEquation(v string) { } func (o IndicatorPropertiesCustomMetricParamsTotal) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -107,6 +111,44 @@ func (o IndicatorPropertiesCustomMetricParamsTotal) ToMap() (map[string]interfac return toSerialize, nil } +func (o *IndicatorPropertiesCustomMetricParamsTotal) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "metrics", + "equation", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesCustomMetricParamsTotal := _IndicatorPropertiesCustomMetricParamsTotal{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesCustomMetricParamsTotal) + + if err != nil { + return err + } + + *o = IndicatorPropertiesCustomMetricParamsTotal(varIndicatorPropertiesCustomMetricParamsTotal) + + return err +} + type NullableIndicatorPropertiesCustomMetricParamsTotal struct { value *IndicatorPropertiesCustomMetricParamsTotal isSet bool @@ -142,3 +184,5 @@ func (v *NullableIndicatorPropertiesCustomMetricParamsTotal) UnmarshalJSON(src [ 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 index 1ac522fc6..946079553 100644 --- a/generated/slo/model_indicator_properties_histogram.go +++ b/generated/slo/model_indicator_properties_histogram.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesHistogram type satisfies the MappedNullable interface at compile time @@ -24,6 +26,8 @@ type IndicatorPropertiesHistogram struct { Type string `json:"type"` } +type _IndicatorPropertiesHistogram 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 @@ -92,7 +96,7 @@ func (o *IndicatorPropertiesHistogram) SetType(v string) { } func (o IndicatorPropertiesHistogram) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -106,6 +110,44 @@ func (o IndicatorPropertiesHistogram) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *IndicatorPropertiesHistogram) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "params", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesHistogram := _IndicatorPropertiesHistogram{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesHistogram) + + if err != nil { + return err + } + + *o = IndicatorPropertiesHistogram(varIndicatorPropertiesHistogram) + + return err +} + type NullableIndicatorPropertiesHistogram struct { value *IndicatorPropertiesHistogram isSet bool @@ -141,3 +183,5 @@ 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 index 5d9348681..10666c5dc 100644 --- a/generated/slo/model_indicator_properties_histogram_params.go +++ b/generated/slo/model_indicator_properties_histogram_params.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesHistogramParams type satisfies the MappedNullable interface at compile time @@ -21,14 +23,18 @@ var _ MappedNullable = &IndicatorPropertiesHistogramParams{} type IndicatorPropertiesHistogramParams struct { // The index or index pattern to use Index string `json:"index"` + // The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. + DataViewId *string `json:"dataViewId,omitempty"` // 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"` + // The timestamp field used in the source indice. + TimestampField string `json:"timestampField"` + Good IndicatorPropertiesHistogramParamsGood `json:"good"` + Total IndicatorPropertiesHistogramParamsTotal `json:"total"` } +type _IndicatorPropertiesHistogramParams 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 @@ -74,6 +80,38 @@ func (o *IndicatorPropertiesHistogramParams) SetIndex(v string) { o.Index = v } +// GetDataViewId returns the DataViewId field value if set, zero value otherwise. +func (o *IndicatorPropertiesHistogramParams) GetDataViewId() string { + if o == nil || IsNil(o.DataViewId) { + var ret string + return ret + } + return *o.DataViewId +} + +// GetDataViewIdOk returns a tuple with the DataViewId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesHistogramParams) GetDataViewIdOk() (*string, bool) { + if o == nil || IsNil(o.DataViewId) { + return nil, false + } + return o.DataViewId, true +} + +// HasDataViewId returns a boolean if a field has been set. +func (o *IndicatorPropertiesHistogramParams) HasDataViewId() bool { + if o != nil && !IsNil(o.DataViewId) { + return true + } + + return false +} + +// SetDataViewId gets a reference to the given string and assigns it to the DataViewId field. +func (o *IndicatorPropertiesHistogramParams) SetDataViewId(v string) { + o.DataViewId = &v +} + // GetFilter returns the Filter field value if set, zero value otherwise. func (o *IndicatorPropertiesHistogramParams) GetFilter() string { if o == nil || IsNil(o.Filter) { @@ -179,7 +217,7 @@ func (o *IndicatorPropertiesHistogramParams) SetTotal(v IndicatorPropertiesHisto } func (o IndicatorPropertiesHistogramParams) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -189,6 +227,9 @@ func (o IndicatorPropertiesHistogramParams) MarshalJSON() ([]byte, error) { func (o IndicatorPropertiesHistogramParams) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["index"] = o.Index + if !IsNil(o.DataViewId) { + toSerialize["dataViewId"] = o.DataViewId + } if !IsNil(o.Filter) { toSerialize["filter"] = o.Filter } @@ -198,6 +239,46 @@ func (o IndicatorPropertiesHistogramParams) ToMap() (map[string]interface{}, err return toSerialize, nil } +func (o *IndicatorPropertiesHistogramParams) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "index", + "timestampField", + "good", + "total", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesHistogramParams := _IndicatorPropertiesHistogramParams{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesHistogramParams) + + if err != nil { + return err + } + + *o = IndicatorPropertiesHistogramParams(varIndicatorPropertiesHistogramParams) + + return err +} + type NullableIndicatorPropertiesHistogramParams struct { value *IndicatorPropertiesHistogramParams isSet bool @@ -233,3 +314,5 @@ func (v *NullableIndicatorPropertiesHistogramParams) UnmarshalJSON(src []byte) e 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 index 2d4f845f6..837cf4a0c 100644 --- a/generated/slo/model_indicator_properties_histogram_params_good.go +++ b/generated/slo/model_indicator_properties_histogram_params_good.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,12 +12,14 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesHistogramParamsGood type satisfies the MappedNullable interface at compile time var _ MappedNullable = &IndicatorPropertiesHistogramParamsGood{} -// IndicatorPropertiesHistogramParamsGood An object defining the \"good\" events +// IndicatorPropertiesHistogramParamsGood An object defining the \"good\" events type IndicatorPropertiesHistogramParamsGood struct { // The field use to aggregate the good events. Field string `json:"field"` @@ -26,11 +28,13 @@ type IndicatorPropertiesHistogramParamsGood struct { // 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"` + From *float32 `json:"from,omitempty"` // The ending value of the range. Only required for \"range\" aggregations. - To *float64 `json:"to,omitempty"` + To *float32 `json:"to,omitempty"` } +type _IndicatorPropertiesHistogramParamsGood 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 @@ -131,9 +135,9 @@ func (o *IndicatorPropertiesHistogramParamsGood) SetFilter(v string) { } // GetFrom returns the From field value if set, zero value otherwise. -func (o *IndicatorPropertiesHistogramParamsGood) GetFrom() float64 { +func (o *IndicatorPropertiesHistogramParamsGood) GetFrom() float32 { if o == nil || IsNil(o.From) { - var ret float64 + var ret float32 return ret } return *o.From @@ -141,7 +145,7 @@ func (o *IndicatorPropertiesHistogramParamsGood) GetFrom() float64 { // 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) { +func (o *IndicatorPropertiesHistogramParamsGood) GetFromOk() (*float32, bool) { if o == nil || IsNil(o.From) { return nil, false } @@ -157,15 +161,15 @@ func (o *IndicatorPropertiesHistogramParamsGood) HasFrom() bool { return false } -// SetFrom gets a reference to the given float64 and assigns it to the From field. -func (o *IndicatorPropertiesHistogramParamsGood) SetFrom(v float64) { +// SetFrom gets a reference to the given float32 and assigns it to the From field. +func (o *IndicatorPropertiesHistogramParamsGood) SetFrom(v float32) { o.From = &v } // GetTo returns the To field value if set, zero value otherwise. -func (o *IndicatorPropertiesHistogramParamsGood) GetTo() float64 { +func (o *IndicatorPropertiesHistogramParamsGood) GetTo() float32 { if o == nil || IsNil(o.To) { - var ret float64 + var ret float32 return ret } return *o.To @@ -173,7 +177,7 @@ func (o *IndicatorPropertiesHistogramParamsGood) GetTo() float64 { // 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) { +func (o *IndicatorPropertiesHistogramParamsGood) GetToOk() (*float32, bool) { if o == nil || IsNil(o.To) { return nil, false } @@ -189,13 +193,13 @@ func (o *IndicatorPropertiesHistogramParamsGood) HasTo() bool { return false } -// SetTo gets a reference to the given float64 and assigns it to the To field. -func (o *IndicatorPropertiesHistogramParamsGood) SetTo(v float64) { +// SetTo gets a reference to the given float32 and assigns it to the To field. +func (o *IndicatorPropertiesHistogramParamsGood) SetTo(v float32) { o.To = &v } func (o IndicatorPropertiesHistogramParamsGood) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -218,6 +222,44 @@ func (o IndicatorPropertiesHistogramParamsGood) ToMap() (map[string]interface{}, return toSerialize, nil } +func (o *IndicatorPropertiesHistogramParamsGood) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "field", + "aggregation", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesHistogramParamsGood := _IndicatorPropertiesHistogramParamsGood{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesHistogramParamsGood) + + if err != nil { + return err + } + + *o = IndicatorPropertiesHistogramParamsGood(varIndicatorPropertiesHistogramParamsGood) + + return err +} + type NullableIndicatorPropertiesHistogramParamsGood struct { value *IndicatorPropertiesHistogramParamsGood isSet bool @@ -253,3 +295,5 @@ func (v *NullableIndicatorPropertiesHistogramParamsGood) UnmarshalJSON(src []byt 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 index 7581231f4..6ce029952 100644 --- a/generated/slo/model_indicator_properties_histogram_params_total.go +++ b/generated/slo/model_indicator_properties_histogram_params_total.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,12 +12,14 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesHistogramParamsTotal type satisfies the MappedNullable interface at compile time var _ MappedNullable = &IndicatorPropertiesHistogramParamsTotal{} -// IndicatorPropertiesHistogramParamsTotal An object defining the \"total\" events +// IndicatorPropertiesHistogramParamsTotal An object defining the \"total\" events type IndicatorPropertiesHistogramParamsTotal struct { // The field use to aggregate the good events. Field string `json:"field"` @@ -26,11 +28,13 @@ type IndicatorPropertiesHistogramParamsTotal struct { // 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"` + From *float32 `json:"from,omitempty"` // The ending value of the range. Only required for \"range\" aggregations. - To *float64 `json:"to,omitempty"` + To *float32 `json:"to,omitempty"` } +type _IndicatorPropertiesHistogramParamsTotal 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 @@ -131,9 +135,9 @@ func (o *IndicatorPropertiesHistogramParamsTotal) SetFilter(v string) { } // GetFrom returns the From field value if set, zero value otherwise. -func (o *IndicatorPropertiesHistogramParamsTotal) GetFrom() float64 { +func (o *IndicatorPropertiesHistogramParamsTotal) GetFrom() float32 { if o == nil || IsNil(o.From) { - var ret float64 + var ret float32 return ret } return *o.From @@ -141,7 +145,7 @@ func (o *IndicatorPropertiesHistogramParamsTotal) GetFrom() float64 { // 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) { +func (o *IndicatorPropertiesHistogramParamsTotal) GetFromOk() (*float32, bool) { if o == nil || IsNil(o.From) { return nil, false } @@ -157,15 +161,15 @@ func (o *IndicatorPropertiesHistogramParamsTotal) HasFrom() bool { return false } -// SetFrom gets a reference to the given float64 and assigns it to the From field. -func (o *IndicatorPropertiesHistogramParamsTotal) SetFrom(v float64) { +// SetFrom gets a reference to the given float32 and assigns it to the From field. +func (o *IndicatorPropertiesHistogramParamsTotal) SetFrom(v float32) { o.From = &v } // GetTo returns the To field value if set, zero value otherwise. -func (o *IndicatorPropertiesHistogramParamsTotal) GetTo() float64 { +func (o *IndicatorPropertiesHistogramParamsTotal) GetTo() float32 { if o == nil || IsNil(o.To) { - var ret float64 + var ret float32 return ret } return *o.To @@ -173,7 +177,7 @@ func (o *IndicatorPropertiesHistogramParamsTotal) GetTo() float64 { // 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) { +func (o *IndicatorPropertiesHistogramParamsTotal) GetToOk() (*float32, bool) { if o == nil || IsNil(o.To) { return nil, false } @@ -189,13 +193,13 @@ func (o *IndicatorPropertiesHistogramParamsTotal) HasTo() bool { return false } -// SetTo gets a reference to the given float64 and assigns it to the To field. -func (o *IndicatorPropertiesHistogramParamsTotal) SetTo(v float64) { +// SetTo gets a reference to the given float32 and assigns it to the To field. +func (o *IndicatorPropertiesHistogramParamsTotal) SetTo(v float32) { o.To = &v } func (o IndicatorPropertiesHistogramParamsTotal) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -218,6 +222,44 @@ func (o IndicatorPropertiesHistogramParamsTotal) ToMap() (map[string]interface{} return toSerialize, nil } +func (o *IndicatorPropertiesHistogramParamsTotal) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "field", + "aggregation", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesHistogramParamsTotal := _IndicatorPropertiesHistogramParamsTotal{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesHistogramParamsTotal) + + if err != nil { + return err + } + + *o = IndicatorPropertiesHistogramParamsTotal(varIndicatorPropertiesHistogramParamsTotal) + + return err +} + type NullableIndicatorPropertiesHistogramParamsTotal struct { value *IndicatorPropertiesHistogramParamsTotal isSet bool @@ -253,3 +295,5 @@ func (v *NullableIndicatorPropertiesHistogramParamsTotal) UnmarshalJSON(src []by v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_indicator_properties_timeslice_metric.go b/generated/slo/model_indicator_properties_timeslice_metric.go index bd5e6fde0..fb9d0c258 100644 --- a/generated/slo/model_indicator_properties_timeslice_metric.go +++ b/generated/slo/model_indicator_properties_timeslice_metric.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesTimesliceMetric type satisfies the MappedNullable interface at compile time @@ -24,6 +26,8 @@ type IndicatorPropertiesTimesliceMetric struct { Type string `json:"type"` } +type _IndicatorPropertiesTimesliceMetric IndicatorPropertiesTimesliceMetric + // NewIndicatorPropertiesTimesliceMetric instantiates a new IndicatorPropertiesTimesliceMetric object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -92,7 +96,7 @@ func (o *IndicatorPropertiesTimesliceMetric) SetType(v string) { } func (o IndicatorPropertiesTimesliceMetric) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -106,6 +110,44 @@ func (o IndicatorPropertiesTimesliceMetric) ToMap() (map[string]interface{}, err return toSerialize, nil } +func (o *IndicatorPropertiesTimesliceMetric) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "params", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesTimesliceMetric := _IndicatorPropertiesTimesliceMetric{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesTimesliceMetric) + + if err != nil { + return err + } + + *o = IndicatorPropertiesTimesliceMetric(varIndicatorPropertiesTimesliceMetric) + + return err +} + type NullableIndicatorPropertiesTimesliceMetric struct { value *IndicatorPropertiesTimesliceMetric isSet bool @@ -141,3 +183,5 @@ func (v *NullableIndicatorPropertiesTimesliceMetric) UnmarshalJSON(src []byte) e v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_indicator_properties_timeslice_metric_params.go b/generated/slo/model_indicator_properties_timeslice_metric_params.go index d702e10b5..e4763a384 100644 --- a/generated/slo/model_indicator_properties_timeslice_metric_params.go +++ b/generated/slo/model_indicator_properties_timeslice_metric_params.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesTimesliceMetricParams type satisfies the MappedNullable interface at compile time @@ -21,13 +23,17 @@ var _ MappedNullable = &IndicatorPropertiesTimesliceMetricParams{} type IndicatorPropertiesTimesliceMetricParams struct { // The index or index pattern to use Index string `json:"index"` + // The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. + DataViewId *string `json:"dataViewId,omitempty"` // the KQL query to filter the documents with. Filter *string `json:"filter,omitempty"` - // The timestamp field used in the source indice. - TimestampField string `json:"timestampField"` - Metric IndicatorPropertiesTimesliceMetricParamsMetric `json:"metric"` + // The timestamp field used in the source indice. + TimestampField string `json:"timestampField"` + Metric IndicatorPropertiesTimesliceMetricParamsMetric `json:"metric"` } +type _IndicatorPropertiesTimesliceMetricParams IndicatorPropertiesTimesliceMetricParams + // NewIndicatorPropertiesTimesliceMetricParams instantiates a new IndicatorPropertiesTimesliceMetricParams object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -72,6 +78,38 @@ func (o *IndicatorPropertiesTimesliceMetricParams) SetIndex(v string) { o.Index = v } +// GetDataViewId returns the DataViewId field value if set, zero value otherwise. +func (o *IndicatorPropertiesTimesliceMetricParams) GetDataViewId() string { + if o == nil || IsNil(o.DataViewId) { + var ret string + return ret + } + return *o.DataViewId +} + +// GetDataViewIdOk returns a tuple with the DataViewId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IndicatorPropertiesTimesliceMetricParams) GetDataViewIdOk() (*string, bool) { + if o == nil || IsNil(o.DataViewId) { + return nil, false + } + return o.DataViewId, true +} + +// HasDataViewId returns a boolean if a field has been set. +func (o *IndicatorPropertiesTimesliceMetricParams) HasDataViewId() bool { + if o != nil && !IsNil(o.DataViewId) { + return true + } + + return false +} + +// SetDataViewId gets a reference to the given string and assigns it to the DataViewId field. +func (o *IndicatorPropertiesTimesliceMetricParams) SetDataViewId(v string) { + o.DataViewId = &v +} + // GetFilter returns the Filter field value if set, zero value otherwise. func (o *IndicatorPropertiesTimesliceMetricParams) GetFilter() string { if o == nil || IsNil(o.Filter) { @@ -153,7 +191,7 @@ func (o *IndicatorPropertiesTimesliceMetricParams) SetMetric(v IndicatorProperti } func (o IndicatorPropertiesTimesliceMetricParams) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -163,6 +201,9 @@ func (o IndicatorPropertiesTimesliceMetricParams) MarshalJSON() ([]byte, error) func (o IndicatorPropertiesTimesliceMetricParams) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["index"] = o.Index + if !IsNil(o.DataViewId) { + toSerialize["dataViewId"] = o.DataViewId + } if !IsNil(o.Filter) { toSerialize["filter"] = o.Filter } @@ -171,6 +212,45 @@ func (o IndicatorPropertiesTimesliceMetricParams) ToMap() (map[string]interface{ return toSerialize, nil } +func (o *IndicatorPropertiesTimesliceMetricParams) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "index", + "timestampField", + "metric", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesTimesliceMetricParams := _IndicatorPropertiesTimesliceMetricParams{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesTimesliceMetricParams) + + if err != nil { + return err + } + + *o = IndicatorPropertiesTimesliceMetricParams(varIndicatorPropertiesTimesliceMetricParams) + + return err +} + type NullableIndicatorPropertiesTimesliceMetricParams struct { value *IndicatorPropertiesTimesliceMetricParams isSet bool @@ -206,3 +286,5 @@ func (v *NullableIndicatorPropertiesTimesliceMetricParams) UnmarshalJSON(src []b v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_indicator_properties_timeslice_metric_params_metric.go b/generated/slo/model_indicator_properties_timeslice_metric_params_metric.go index 89435056d..803014f60 100644 --- a/generated/slo/model_indicator_properties_timeslice_metric_params_metric.go +++ b/generated/slo/model_indicator_properties_timeslice_metric_params_metric.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,12 +12,14 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the IndicatorPropertiesTimesliceMetricParamsMetric type satisfies the MappedNullable interface at compile time var _ MappedNullable = &IndicatorPropertiesTimesliceMetricParamsMetric{} -// IndicatorPropertiesTimesliceMetricParamsMetric An object defining the metrics, equation, and threshold to determine if it's a good slice or not +// IndicatorPropertiesTimesliceMetricParamsMetric An object defining the metrics, equation, and threshold to determine if it's a good slice or not type IndicatorPropertiesTimesliceMetricParamsMetric struct { // List of metrics with their name, aggregation type, and field. Metrics []IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner `json:"metrics"` @@ -26,14 +28,16 @@ type IndicatorPropertiesTimesliceMetricParamsMetric struct { // The comparator to use to compare the equation to the threshold. Comparator string `json:"comparator"` // The threshold used to determine if the metric is a good slice or not. - Threshold float64 `json:"threshold"` + Threshold float32 `json:"threshold"` } +type _IndicatorPropertiesTimesliceMetricParamsMetric IndicatorPropertiesTimesliceMetricParamsMetric + // NewIndicatorPropertiesTimesliceMetricParamsMetric instantiates a new IndicatorPropertiesTimesliceMetricParamsMetric object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewIndicatorPropertiesTimesliceMetricParamsMetric(metrics []IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner, equation string, comparator string, threshold float64) *IndicatorPropertiesTimesliceMetricParamsMetric { +func NewIndicatorPropertiesTimesliceMetricParamsMetric(metrics []IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner, equation string, comparator string, threshold float32) *IndicatorPropertiesTimesliceMetricParamsMetric { this := IndicatorPropertiesTimesliceMetricParamsMetric{} this.Metrics = metrics this.Equation = equation @@ -123,9 +127,9 @@ func (o *IndicatorPropertiesTimesliceMetricParamsMetric) SetComparator(v string) } // GetThreshold returns the Threshold field value -func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetThreshold() float64 { +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetThreshold() float32 { if o == nil { - var ret float64 + var ret float32 return ret } @@ -134,7 +138,7 @@ func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetThreshold() float64 // GetThresholdOk returns a tuple with the Threshold field value // and a boolean to check if the value has been set. -func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetThresholdOk() (*float64, bool) { +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetThresholdOk() (*float32, bool) { if o == nil { return nil, false } @@ -142,12 +146,12 @@ func (o *IndicatorPropertiesTimesliceMetricParamsMetric) GetThresholdOk() (*floa } // SetThreshold sets field value -func (o *IndicatorPropertiesTimesliceMetricParamsMetric) SetThreshold(v float64) { +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) SetThreshold(v float32) { o.Threshold = v } func (o IndicatorPropertiesTimesliceMetricParamsMetric) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -163,6 +167,46 @@ func (o IndicatorPropertiesTimesliceMetricParamsMetric) ToMap() (map[string]inte return toSerialize, nil } +func (o *IndicatorPropertiesTimesliceMetricParamsMetric) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "metrics", + "equation", + "comparator", + "threshold", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIndicatorPropertiesTimesliceMetricParamsMetric := _IndicatorPropertiesTimesliceMetricParamsMetric{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varIndicatorPropertiesTimesliceMetricParamsMetric) + + if err != nil { + return err + } + + *o = IndicatorPropertiesTimesliceMetricParamsMetric(varIndicatorPropertiesTimesliceMetricParamsMetric) + + return err +} + type NullableIndicatorPropertiesTimesliceMetricParamsMetric struct { value *IndicatorPropertiesTimesliceMetricParamsMetric isSet bool @@ -198,3 +242,5 @@ func (v *NullableIndicatorPropertiesTimesliceMetricParamsMetric) UnmarshalJSON(s v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_indicator_properties_timeslice_metric_params_metric_metrics_inner.go b/generated/slo/model_indicator_properties_timeslice_metric_params_metric_metrics_inner.go index 828f796ee..f14dfb72f 100644 --- a/generated/slo/model_indicator_properties_timeslice_metric_params_metric_metrics_inner.go +++ b/generated/slo/model_indicator_properties_timeslice_metric_params_metric_metrics_inner.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -15,18 +15,19 @@ import ( "fmt" ) + // IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner struct for IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner type IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner struct { TimesliceMetricBasicMetricWithField *TimesliceMetricBasicMetricWithField - TimesliceMetricDocCountMetric *TimesliceMetricDocCountMetric - TimesliceMetricPercentileMetric *TimesliceMetricPercentileMetric + TimesliceMetricDocCountMetric *TimesliceMetricDocCountMetric + TimesliceMetricPercentileMetric *TimesliceMetricPercentileMetric } // Unmarshal JSON data into any of the pointers in the struct func (dst *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) UnmarshalJSON(data []byte) error { var err error // try to unmarshal JSON data into TimesliceMetricBasicMetricWithField - err = json.Unmarshal(data, &dst.TimesliceMetricBasicMetricWithField) + err = json.Unmarshal(data, &dst.TimesliceMetricBasicMetricWithField); if err == nil { jsonTimesliceMetricBasicMetricWithField, _ := json.Marshal(dst.TimesliceMetricBasicMetricWithField) if string(jsonTimesliceMetricBasicMetricWithField) == "{}" { // empty struct @@ -39,7 +40,7 @@ func (dst *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) Unmarshal } // try to unmarshal JSON data into TimesliceMetricDocCountMetric - err = json.Unmarshal(data, &dst.TimesliceMetricDocCountMetric) + err = json.Unmarshal(data, &dst.TimesliceMetricDocCountMetric); if err == nil { jsonTimesliceMetricDocCountMetric, _ := json.Marshal(dst.TimesliceMetricDocCountMetric) if string(jsonTimesliceMetricDocCountMetric) == "{}" { // empty struct @@ -52,7 +53,7 @@ func (dst *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) Unmarshal } // try to unmarshal JSON data into TimesliceMetricPercentileMetric - err = json.Unmarshal(data, &dst.TimesliceMetricPercentileMetric) + err = json.Unmarshal(data, &dst.TimesliceMetricPercentileMetric); if err == nil { jsonTimesliceMetricPercentileMetric, _ := json.Marshal(dst.TimesliceMetricPercentileMetric) if string(jsonTimesliceMetricPercentileMetric) == "{}" { // empty struct @@ -68,7 +69,7 @@ func (dst *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) Unmarshal } // Marshal data from the first non-nil pointers in the struct to JSON -func (src *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) MarshalJSON() ([]byte, error) { +func (src IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) MarshalJSON() ([]byte, error) { if src.TimesliceMetricBasicMetricWithField != nil { return json.Marshal(&src.TimesliceMetricBasicMetricWithField) } @@ -84,6 +85,7 @@ func (src *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) MarshalJS return nil, nil // no data in anyOf schemas } + type NullableIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner struct { value *IndicatorPropertiesTimesliceMetricParamsMetricMetricsInner isSet bool @@ -119,3 +121,5 @@ func (v *NullableIndicatorPropertiesTimesliceMetricParamsMetricMetricsInner) Unm v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_kql_with_filters.go b/generated/slo/model_kql_with_filters.go new file mode 100644 index 000000000..60e28c748 --- /dev/null +++ b/generated/slo/model_kql_with_filters.go @@ -0,0 +1,171 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "fmt" + "gopkg.in/validator.v2" +) + +// KqlWithFilters - Defines properties for a filter +type KqlWithFilters struct { + KqlWithFiltersOneOf *KqlWithFiltersOneOf + String *string +} + +// KqlWithFiltersOneOfAsKqlWithFilters is a convenience function that returns KqlWithFiltersOneOf wrapped in KqlWithFilters +func KqlWithFiltersOneOfAsKqlWithFilters(v *KqlWithFiltersOneOf) KqlWithFilters { + return KqlWithFilters{ + KqlWithFiltersOneOf: v, + } +} + +// stringAsKqlWithFilters is a convenience function that returns string wrapped in KqlWithFilters +func StringAsKqlWithFilters(v *string) KqlWithFilters { + return KqlWithFilters{ + String: v, + } +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *KqlWithFilters) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into KqlWithFiltersOneOf + err = newStrictDecoder(data).Decode(&dst.KqlWithFiltersOneOf) + if err == nil { + jsonKqlWithFiltersOneOf, _ := json.Marshal(dst.KqlWithFiltersOneOf) + if string(jsonKqlWithFiltersOneOf) == "{}" { // empty struct + dst.KqlWithFiltersOneOf = nil + } else { + if err = validator.Validate(dst.KqlWithFiltersOneOf); err != nil { + dst.KqlWithFiltersOneOf = nil + } else { + match++ + } + } + } else { + dst.KqlWithFiltersOneOf = nil + } + + // try to unmarshal data into String + err = newStrictDecoder(data).Decode(&dst.String) + if err == nil { + jsonString, _ := json.Marshal(dst.String) + if string(jsonString) == "{}" { // empty struct + dst.String = nil + } else { + if err = validator.Validate(dst.String); err != nil { + dst.String = nil + } else { + match++ + } + } + } else { + dst.String = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.KqlWithFiltersOneOf = nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(KqlWithFilters)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(KqlWithFilters)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src KqlWithFilters) MarshalJSON() ([]byte, error) { + if src.KqlWithFiltersOneOf != nil { + return json.Marshal(&src.KqlWithFiltersOneOf) + } + + if src.String != nil { + return json.Marshal(&src.String) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *KqlWithFilters) GetActualInstance() (interface{}) { + if obj == nil { + return nil + } + if obj.KqlWithFiltersOneOf != nil { + return obj.KqlWithFiltersOneOf + } + + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj KqlWithFilters) GetActualInstanceValue() (interface{}) { + if obj.KqlWithFiltersOneOf != nil { + return *obj.KqlWithFiltersOneOf + } + + if obj.String != nil { + return *obj.String + } + + // all schemas are nil + return nil +} + +type NullableKqlWithFilters struct { + value *KqlWithFilters + isSet bool +} + +func (v NullableKqlWithFilters) Get() *KqlWithFilters { + return v.value +} + +func (v *NullableKqlWithFilters) Set(val *KqlWithFilters) { + v.value = val + v.isSet = true +} + +func (v NullableKqlWithFilters) IsSet() bool { + return v.isSet +} + +func (v *NullableKqlWithFilters) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKqlWithFilters(val *KqlWithFilters) *NullableKqlWithFilters { + return &NullableKqlWithFilters{value: val, isSet: true} +} + +func (v NullableKqlWithFilters) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKqlWithFilters) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_kql_with_filters_good.go b/generated/slo/model_kql_with_filters_good.go new file mode 100644 index 000000000..7f4ae9619 --- /dev/null +++ b/generated/slo/model_kql_with_filters_good.go @@ -0,0 +1,171 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "fmt" + "gopkg.in/validator.v2" +) + +// KqlWithFiltersGood - The KQL query used to define the good events. +type KqlWithFiltersGood struct { + KqlWithFiltersOneOf *KqlWithFiltersOneOf + String *string +} + +// KqlWithFiltersOneOfAsKqlWithFiltersGood is a convenience function that returns KqlWithFiltersOneOf wrapped in KqlWithFiltersGood +func KqlWithFiltersOneOfAsKqlWithFiltersGood(v *KqlWithFiltersOneOf) KqlWithFiltersGood { + return KqlWithFiltersGood{ + KqlWithFiltersOneOf: v, + } +} + +// stringAsKqlWithFiltersGood is a convenience function that returns string wrapped in KqlWithFiltersGood +func StringAsKqlWithFiltersGood(v *string) KqlWithFiltersGood { + return KqlWithFiltersGood{ + String: v, + } +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *KqlWithFiltersGood) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into KqlWithFiltersOneOf + err = newStrictDecoder(data).Decode(&dst.KqlWithFiltersOneOf) + if err == nil { + jsonKqlWithFiltersOneOf, _ := json.Marshal(dst.KqlWithFiltersOneOf) + if string(jsonKqlWithFiltersOneOf) == "{}" { // empty struct + dst.KqlWithFiltersOneOf = nil + } else { + if err = validator.Validate(dst.KqlWithFiltersOneOf); err != nil { + dst.KqlWithFiltersOneOf = nil + } else { + match++ + } + } + } else { + dst.KqlWithFiltersOneOf = nil + } + + // try to unmarshal data into String + err = newStrictDecoder(data).Decode(&dst.String) + if err == nil { + jsonString, _ := json.Marshal(dst.String) + if string(jsonString) == "{}" { // empty struct + dst.String = nil + } else { + if err = validator.Validate(dst.String); err != nil { + dst.String = nil + } else { + match++ + } + } + } else { + dst.String = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.KqlWithFiltersOneOf = nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(KqlWithFiltersGood)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(KqlWithFiltersGood)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src KqlWithFiltersGood) MarshalJSON() ([]byte, error) { + if src.KqlWithFiltersOneOf != nil { + return json.Marshal(&src.KqlWithFiltersOneOf) + } + + if src.String != nil { + return json.Marshal(&src.String) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *KqlWithFiltersGood) GetActualInstance() (interface{}) { + if obj == nil { + return nil + } + if obj.KqlWithFiltersOneOf != nil { + return obj.KqlWithFiltersOneOf + } + + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj KqlWithFiltersGood) GetActualInstanceValue() (interface{}) { + if obj.KqlWithFiltersOneOf != nil { + return *obj.KqlWithFiltersOneOf + } + + if obj.String != nil { + return *obj.String + } + + // all schemas are nil + return nil +} + +type NullableKqlWithFiltersGood struct { + value *KqlWithFiltersGood + isSet bool +} + +func (v NullableKqlWithFiltersGood) Get() *KqlWithFiltersGood { + return v.value +} + +func (v *NullableKqlWithFiltersGood) Set(val *KqlWithFiltersGood) { + v.value = val + v.isSet = true +} + +func (v NullableKqlWithFiltersGood) IsSet() bool { + return v.isSet +} + +func (v *NullableKqlWithFiltersGood) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKqlWithFiltersGood(val *KqlWithFiltersGood) *NullableKqlWithFiltersGood { + return &NullableKqlWithFiltersGood{value: val, isSet: true} +} + +func (v NullableKqlWithFiltersGood) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKqlWithFiltersGood) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_kql_with_filters_one_of.go b/generated/slo/model_kql_with_filters_one_of.go new file mode 100644 index 000000000..ead4fd8fc --- /dev/null +++ b/generated/slo/model_kql_with_filters_one_of.go @@ -0,0 +1,162 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" +) + +// checks if the KqlWithFiltersOneOf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KqlWithFiltersOneOf{} + +// KqlWithFiltersOneOf struct for KqlWithFiltersOneOf +type KqlWithFiltersOneOf struct { + KqlQuery *string `json:"kqlQuery,omitempty"` + Filters []Filter `json:"filters,omitempty"` +} + +// NewKqlWithFiltersOneOf instantiates a new KqlWithFiltersOneOf 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 NewKqlWithFiltersOneOf() *KqlWithFiltersOneOf { + this := KqlWithFiltersOneOf{} + return &this +} + +// NewKqlWithFiltersOneOfWithDefaults instantiates a new KqlWithFiltersOneOf 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 NewKqlWithFiltersOneOfWithDefaults() *KqlWithFiltersOneOf { + this := KqlWithFiltersOneOf{} + return &this +} + +// GetKqlQuery returns the KqlQuery field value if set, zero value otherwise. +func (o *KqlWithFiltersOneOf) GetKqlQuery() string { + if o == nil || IsNil(o.KqlQuery) { + var ret string + return ret + } + return *o.KqlQuery +} + +// GetKqlQueryOk returns a tuple with the KqlQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KqlWithFiltersOneOf) GetKqlQueryOk() (*string, bool) { + if o == nil || IsNil(o.KqlQuery) { + return nil, false + } + return o.KqlQuery, true +} + +// HasKqlQuery returns a boolean if a field has been set. +func (o *KqlWithFiltersOneOf) HasKqlQuery() bool { + if o != nil && !IsNil(o.KqlQuery) { + return true + } + + return false +} + +// SetKqlQuery gets a reference to the given string and assigns it to the KqlQuery field. +func (o *KqlWithFiltersOneOf) SetKqlQuery(v string) { + o.KqlQuery = &v +} + +// GetFilters returns the Filters field value if set, zero value otherwise. +func (o *KqlWithFiltersOneOf) GetFilters() []Filter { + if o == nil || IsNil(o.Filters) { + var ret []Filter + return ret + } + return o.Filters +} + +// GetFiltersOk returns a tuple with the Filters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KqlWithFiltersOneOf) GetFiltersOk() ([]Filter, bool) { + if o == nil || IsNil(o.Filters) { + return nil, false + } + return o.Filters, true +} + +// HasFilters returns a boolean if a field has been set. +func (o *KqlWithFiltersOneOf) HasFilters() bool { + if o != nil && !IsNil(o.Filters) { + return true + } + + return false +} + +// SetFilters gets a reference to the given []Filter and assigns it to the Filters field. +func (o *KqlWithFiltersOneOf) SetFilters(v []Filter) { + o.Filters = v +} + +func (o KqlWithFiltersOneOf) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KqlWithFiltersOneOf) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.KqlQuery) { + toSerialize["kqlQuery"] = o.KqlQuery + } + if !IsNil(o.Filters) { + toSerialize["filters"] = o.Filters + } + return toSerialize, nil +} + +type NullableKqlWithFiltersOneOf struct { + value *KqlWithFiltersOneOf + isSet bool +} + +func (v NullableKqlWithFiltersOneOf) Get() *KqlWithFiltersOneOf { + return v.value +} + +func (v *NullableKqlWithFiltersOneOf) Set(val *KqlWithFiltersOneOf) { + v.value = val + v.isSet = true +} + +func (v NullableKqlWithFiltersOneOf) IsSet() bool { + return v.isSet +} + +func (v *NullableKqlWithFiltersOneOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKqlWithFiltersOneOf(val *KqlWithFiltersOneOf) *NullableKqlWithFiltersOneOf { + return &NullableKqlWithFiltersOneOf{value: val, isSet: true} +} + +func (v NullableKqlWithFiltersOneOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKqlWithFiltersOneOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_kql_with_filters_total.go b/generated/slo/model_kql_with_filters_total.go new file mode 100644 index 000000000..3fa45b178 --- /dev/null +++ b/generated/slo/model_kql_with_filters_total.go @@ -0,0 +1,171 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "fmt" + "gopkg.in/validator.v2" +) + +// KqlWithFiltersTotal - The KQL query used to define all events. +type KqlWithFiltersTotal struct { + KqlWithFiltersOneOf *KqlWithFiltersOneOf + String *string +} + +// KqlWithFiltersOneOfAsKqlWithFiltersTotal is a convenience function that returns KqlWithFiltersOneOf wrapped in KqlWithFiltersTotal +func KqlWithFiltersOneOfAsKqlWithFiltersTotal(v *KqlWithFiltersOneOf) KqlWithFiltersTotal { + return KqlWithFiltersTotal{ + KqlWithFiltersOneOf: v, + } +} + +// stringAsKqlWithFiltersTotal is a convenience function that returns string wrapped in KqlWithFiltersTotal +func StringAsKqlWithFiltersTotal(v *string) KqlWithFiltersTotal { + return KqlWithFiltersTotal{ + String: v, + } +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *KqlWithFiltersTotal) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into KqlWithFiltersOneOf + err = newStrictDecoder(data).Decode(&dst.KqlWithFiltersOneOf) + if err == nil { + jsonKqlWithFiltersOneOf, _ := json.Marshal(dst.KqlWithFiltersOneOf) + if string(jsonKqlWithFiltersOneOf) == "{}" { // empty struct + dst.KqlWithFiltersOneOf = nil + } else { + if err = validator.Validate(dst.KqlWithFiltersOneOf); err != nil { + dst.KqlWithFiltersOneOf = nil + } else { + match++ + } + } + } else { + dst.KqlWithFiltersOneOf = nil + } + + // try to unmarshal data into String + err = newStrictDecoder(data).Decode(&dst.String) + if err == nil { + jsonString, _ := json.Marshal(dst.String) + if string(jsonString) == "{}" { // empty struct + dst.String = nil + } else { + if err = validator.Validate(dst.String); err != nil { + dst.String = nil + } else { + match++ + } + } + } else { + dst.String = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.KqlWithFiltersOneOf = nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(KqlWithFiltersTotal)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(KqlWithFiltersTotal)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src KqlWithFiltersTotal) MarshalJSON() ([]byte, error) { + if src.KqlWithFiltersOneOf != nil { + return json.Marshal(&src.KqlWithFiltersOneOf) + } + + if src.String != nil { + return json.Marshal(&src.String) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *KqlWithFiltersTotal) GetActualInstance() (interface{}) { + if obj == nil { + return nil + } + if obj.KqlWithFiltersOneOf != nil { + return obj.KqlWithFiltersOneOf + } + + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj KqlWithFiltersTotal) GetActualInstanceValue() (interface{}) { + if obj.KqlWithFiltersOneOf != nil { + return *obj.KqlWithFiltersOneOf + } + + if obj.String != nil { + return *obj.String + } + + // all schemas are nil + return nil +} + +type NullableKqlWithFiltersTotal struct { + value *KqlWithFiltersTotal + isSet bool +} + +func (v NullableKqlWithFiltersTotal) Get() *KqlWithFiltersTotal { + return v.value +} + +func (v *NullableKqlWithFiltersTotal) Set(val *KqlWithFiltersTotal) { + v.value = val + v.isSet = true +} + +func (v NullableKqlWithFiltersTotal) IsSet() bool { + return v.isSet +} + +func (v *NullableKqlWithFiltersTotal) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKqlWithFiltersTotal(val *KqlWithFiltersTotal) *NullableKqlWithFiltersTotal { + return &NullableKqlWithFiltersTotal{value: val, isSet: true} +} + +func (v NullableKqlWithFiltersTotal) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKqlWithFiltersTotal) 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 cad95abd2..5c7342773 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the Objective type satisfies the MappedNullable interface at compile time @@ -20,18 +22,20 @@ var _ MappedNullable = &Objective{} // Objective Defines properties for the SLO objective type Objective struct { // the target objective between 0 and 1 excluded - Target float64 `json:"target"` + Target float32 `json:"target"` // the target objective for each slice when using a timeslices budgeting method - TimesliceTarget *float64 `json:"timesliceTarget,omitempty"` + TimesliceTarget *float32 `json:"timesliceTarget,omitempty"` // the duration of each slice when using a timeslices budgeting method, as {duraton}{unit} TimesliceWindow *string `json:"timesliceWindow,omitempty"` } +type _Objective Objective + // 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 float64) *Objective { +func NewObjective(target float32) *Objective { this := Objective{} this.Target = target return &this @@ -46,9 +50,9 @@ func NewObjectiveWithDefaults() *Objective { } // GetTarget returns the Target field value -func (o *Objective) GetTarget() float64 { +func (o *Objective) GetTarget() float32 { if o == nil { - var ret float64 + var ret float32 return ret } @@ -57,7 +61,7 @@ func (o *Objective) GetTarget() float64 { // GetTargetOk returns a tuple with the Target field value // and a boolean to check if the value has been set. -func (o *Objective) GetTargetOk() (*float64, bool) { +func (o *Objective) GetTargetOk() (*float32, bool) { if o == nil { return nil, false } @@ -65,14 +69,14 @@ func (o *Objective) GetTargetOk() (*float64, bool) { } // SetTarget sets field value -func (o *Objective) SetTarget(v float64) { +func (o *Objective) SetTarget(v float32) { o.Target = v } // GetTimesliceTarget returns the TimesliceTarget field value if set, zero value otherwise. -func (o *Objective) GetTimesliceTarget() float64 { +func (o *Objective) GetTimesliceTarget() float32 { if o == nil || IsNil(o.TimesliceTarget) { - var ret float64 + var ret float32 return ret } return *o.TimesliceTarget @@ -80,7 +84,7 @@ func (o *Objective) GetTimesliceTarget() float64 { // 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) GetTimesliceTargetOk() (*float64, bool) { +func (o *Objective) GetTimesliceTargetOk() (*float32, bool) { if o == nil || IsNil(o.TimesliceTarget) { return nil, false } @@ -96,8 +100,8 @@ func (o *Objective) HasTimesliceTarget() bool { return false } -// SetTimesliceTarget gets a reference to the given float64 and assigns it to the TimesliceTarget field. -func (o *Objective) SetTimesliceTarget(v float64) { +// SetTimesliceTarget gets a reference to the given float32 and assigns it to the TimesliceTarget field. +func (o *Objective) SetTimesliceTarget(v float32) { o.TimesliceTarget = &v } @@ -134,7 +138,7 @@ func (o *Objective) SetTimesliceWindow(v string) { } func (o Objective) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -153,6 +157,43 @@ func (o Objective) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *Objective) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "target", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varObjective := _Objective{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varObjective) + + if err != nil { + return err + } + + *o = Objective(varObjective) + + return err +} + type NullableObjective struct { value *Objective isSet bool @@ -188,3 +229,5 @@ func (v *NullableObjective) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_settings.go b/generated/slo/model_settings.go index f7cc30ba7..0119f0d85 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -19,10 +19,14 @@ var _ MappedNullable = &Settings{} // Settings Defines properties for SLO settings. type Settings struct { - // The synch delay to apply to the transform. Default 1m + // The date field that is used to identify new documents in the source. It is strongly recommended to use a field that contains the ingest timestamp. If you use a different field, you might need to set the delay such that it accounts for data transmission delays. When unspecified, we use the indicator timestamp field. + SyncField *string `json:"syncField,omitempty"` + // The time delay in minutes between the current time and the latest source data time. Increasing the value will delay any alerting. The default value is 1 minute. The minimum value is 1m and the maximum is 359m. It should always be greater then source index refresh interval. SyncDelay *string `json:"syncDelay,omitempty"` - // Configure how often the transform runs, default 1m + // The interval between checks for changes in the source data. The minimum value is 1m and the maximum is 59m. The default value is 1 minute. Frequency *string `json:"frequency,omitempty"` + // Start aggregating data from the time the SLO is created, instead of backfilling data from the beginning of the time window. + PreventInitialBackfill *bool `json:"preventInitialBackfill,omitempty"` } // NewSettings instantiates a new Settings object @@ -31,6 +35,12 @@ type Settings struct { // will change when the set of required properties is changed func NewSettings() *Settings { this := Settings{} + var syncDelay string = "1m" + this.SyncDelay = &syncDelay + var frequency string = "1m" + this.Frequency = &frequency + var preventInitialBackfill bool = false + this.PreventInitialBackfill = &preventInitialBackfill return &this } @@ -39,9 +49,47 @@ func NewSettings() *Settings { // but it doesn't guarantee that properties required by API are set func NewSettingsWithDefaults() *Settings { this := Settings{} + var syncDelay string = "1m" + this.SyncDelay = &syncDelay + var frequency string = "1m" + this.Frequency = &frequency + var preventInitialBackfill bool = false + this.PreventInitialBackfill = &preventInitialBackfill return &this } +// GetSyncField returns the SyncField field value if set, zero value otherwise. +func (o *Settings) GetSyncField() string { + if o == nil || IsNil(o.SyncField) { + var ret string + return ret + } + return *o.SyncField +} + +// GetSyncFieldOk returns a tuple with the SyncField field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Settings) GetSyncFieldOk() (*string, bool) { + if o == nil || IsNil(o.SyncField) { + return nil, false + } + return o.SyncField, true +} + +// HasSyncField returns a boolean if a field has been set. +func (o *Settings) HasSyncField() bool { + if o != nil && !IsNil(o.SyncField) { + return true + } + + return false +} + +// SetSyncField gets a reference to the given string and assigns it to the SyncField field. +func (o *Settings) SetSyncField(v string) { + o.SyncField = &v +} + // GetSyncDelay returns the SyncDelay field value if set, zero value otherwise. func (o *Settings) GetSyncDelay() string { if o == nil || IsNil(o.SyncDelay) { @@ -106,8 +154,40 @@ func (o *Settings) SetFrequency(v string) { o.Frequency = &v } +// GetPreventInitialBackfill returns the PreventInitialBackfill field value if set, zero value otherwise. +func (o *Settings) GetPreventInitialBackfill() bool { + if o == nil || IsNil(o.PreventInitialBackfill) { + var ret bool + return ret + } + return *o.PreventInitialBackfill +} + +// GetPreventInitialBackfillOk returns a tuple with the PreventInitialBackfill field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Settings) GetPreventInitialBackfillOk() (*bool, bool) { + if o == nil || IsNil(o.PreventInitialBackfill) { + return nil, false + } + return o.PreventInitialBackfill, true +} + +// HasPreventInitialBackfill returns a boolean if a field has been set. +func (o *Settings) HasPreventInitialBackfill() bool { + if o != nil && !IsNil(o.PreventInitialBackfill) { + return true + } + + return false +} + +// SetPreventInitialBackfill gets a reference to the given bool and assigns it to the PreventInitialBackfill field. +func (o *Settings) SetPreventInitialBackfill(v bool) { + o.PreventInitialBackfill = &v +} + func (o Settings) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -116,12 +196,18 @@ func (o Settings) MarshalJSON() ([]byte, error) { func (o Settings) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if !IsNil(o.SyncField) { + toSerialize["syncField"] = o.SyncField + } if !IsNil(o.SyncDelay) { toSerialize["syncDelay"] = o.SyncDelay } if !IsNil(o.Frequency) { toSerialize["frequency"] = o.Frequency } + if !IsNil(o.PreventInitialBackfill) { + toSerialize["preventInitialBackfill"] = o.PreventInitialBackfill + } return toSerialize, nil } @@ -160,3 +246,5 @@ func (v *NullableSettings) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_slo_definition_response.go b/generated/slo/model_slo_definition_response.go new file mode 100644 index 000000000..d53e3f602 --- /dev/null +++ b/generated/slo/model_slo_definition_response.go @@ -0,0 +1,559 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the SloDefinitionResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SloDefinitionResponse{} + +// SloDefinitionResponse struct for SloDefinitionResponse +type SloDefinitionResponse struct { + // The identifier of the SLO. + Id string `json:"id"` + // The name of the SLO. + Name string `json:"name"` + // The description of the SLO. + Description string `json:"description"` + Indicator SloWithSummaryResponseIndicator `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"` + // Indicate if the SLO is enabled + Enabled bool `json:"enabled"` + GroupBy GroupBy `json:"groupBy"` + // List of tags + Tags []string `json:"tags"` + // The creation date + CreatedAt string `json:"createdAt"` + // The last update date + UpdatedAt string `json:"updatedAt"` + // The internal SLO version + Version float32 `json:"version"` +} + +type _SloDefinitionResponse SloDefinitionResponse + +// NewSloDefinitionResponse instantiates a new SloDefinitionResponse 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 NewSloDefinitionResponse(id string, name string, description string, indicator SloWithSummaryResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float32, enabled bool, groupBy GroupBy, tags []string, createdAt string, updatedAt string, version float32) *SloDefinitionResponse { + this := SloDefinitionResponse{} + 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.Enabled = enabled + this.GroupBy = groupBy + this.Tags = tags + this.CreatedAt = createdAt + this.UpdatedAt = updatedAt + this.Version = version + return &this +} + +// NewSloDefinitionResponseWithDefaults instantiates a new SloDefinitionResponse 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 NewSloDefinitionResponseWithDefaults() *SloDefinitionResponse { + this := SloDefinitionResponse{} + return &this +} + +// GetId returns the Id field value +func (o *SloDefinitionResponse) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *SloDefinitionResponse) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *SloDefinitionResponse) 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 *SloDefinitionResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *SloDefinitionResponse) SetName(v string) { + o.Name = v +} + +// GetDescription returns the Description field value +func (o *SloDefinitionResponse) GetDescription() string { + if o == nil { + var ret string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value +func (o *SloDefinitionResponse) SetDescription(v string) { + o.Description = v +} + +// GetIndicator returns the Indicator field value +func (o *SloDefinitionResponse) GetIndicator() SloWithSummaryResponseIndicator { + if o == nil { + var ret SloWithSummaryResponseIndicator + return ret + } + + return o.Indicator +} + +// GetIndicatorOk returns a tuple with the Indicator field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetIndicatorOk() (*SloWithSummaryResponseIndicator, bool) { + if o == nil { + return nil, false + } + return &o.Indicator, true +} + +// SetIndicator sets field value +func (o *SloDefinitionResponse) SetIndicator(v SloWithSummaryResponseIndicator) { + o.Indicator = v +} + +// GetTimeWindow returns the TimeWindow field value +func (o *SloDefinitionResponse) GetTimeWindow() TimeWindow { + if o == nil { + var ret TimeWindow + return ret + } + + return o.TimeWindow +} + +// GetTimeWindowOk returns a tuple with the TimeWindow field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetTimeWindowOk() (*TimeWindow, bool) { + if o == nil { + return nil, false + } + return &o.TimeWindow, true +} + +// SetTimeWindow sets field value +func (o *SloDefinitionResponse) SetTimeWindow(v TimeWindow) { + o.TimeWindow = v +} + +// GetBudgetingMethod returns the BudgetingMethod field value +func (o *SloDefinitionResponse) GetBudgetingMethod() BudgetingMethod { + if o == nil { + var ret BudgetingMethod + return ret + } + + return o.BudgetingMethod +} + +// GetBudgetingMethodOk returns a tuple with the BudgetingMethod field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetBudgetingMethodOk() (*BudgetingMethod, bool) { + if o == nil { + return nil, false + } + return &o.BudgetingMethod, true +} + +// SetBudgetingMethod sets field value +func (o *SloDefinitionResponse) SetBudgetingMethod(v BudgetingMethod) { + o.BudgetingMethod = v +} + +// GetObjective returns the Objective field value +func (o *SloDefinitionResponse) GetObjective() Objective { + if o == nil { + var ret Objective + return ret + } + + return o.Objective +} + +// GetObjectiveOk returns a tuple with the Objective field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetObjectiveOk() (*Objective, bool) { + if o == nil { + return nil, false + } + return &o.Objective, true +} + +// SetObjective sets field value +func (o *SloDefinitionResponse) SetObjective(v Objective) { + o.Objective = v +} + +// GetSettings returns the Settings field value +func (o *SloDefinitionResponse) GetSettings() Settings { + if o == nil { + var ret Settings + return ret + } + + return o.Settings +} + +// GetSettingsOk returns a tuple with the Settings field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetSettingsOk() (*Settings, bool) { + if o == nil { + return nil, false + } + return &o.Settings, true +} + +// SetSettings sets field value +func (o *SloDefinitionResponse) SetSettings(v Settings) { + o.Settings = v +} + +// GetRevision returns the Revision field value +func (o *SloDefinitionResponse) GetRevision() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.Revision +} + +// GetRevisionOk returns a tuple with the Revision field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetRevisionOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.Revision, true +} + +// SetRevision sets field value +func (o *SloDefinitionResponse) SetRevision(v float32) { + o.Revision = v +} + +// GetEnabled returns the Enabled field value +func (o *SloDefinitionResponse) GetEnabled() bool { + if o == nil { + var ret bool + return ret + } + + return o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Enabled, true +} + +// SetEnabled sets field value +func (o *SloDefinitionResponse) SetEnabled(v bool) { + o.Enabled = v +} + +// GetGroupBy returns the GroupBy field value +func (o *SloDefinitionResponse) GetGroupBy() GroupBy { + if o == nil { + var ret GroupBy + return ret + } + + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetGroupByOk() (*GroupBy, bool) { + if o == nil { + return nil, false + } + return &o.GroupBy, true +} + +// SetGroupBy sets field value +func (o *SloDefinitionResponse) SetGroupBy(v GroupBy) { + o.GroupBy = v +} + +// GetTags returns the Tags field value +func (o *SloDefinitionResponse) GetTags() []string { + if o == nil { + var ret []string + return ret + } + + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetTagsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Tags, true +} + +// SetTags sets field value +func (o *SloDefinitionResponse) SetTags(v []string) { + o.Tags = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *SloDefinitionResponse) GetCreatedAt() string { + if o == nil { + var ret string + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetCreatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *SloDefinitionResponse) SetCreatedAt(v string) { + o.CreatedAt = v +} + +// GetUpdatedAt returns the UpdatedAt field value +func (o *SloDefinitionResponse) GetUpdatedAt() string { + if o == nil { + var ret string + return ret + } + + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetUpdatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.UpdatedAt, true +} + +// SetUpdatedAt sets field value +func (o *SloDefinitionResponse) SetUpdatedAt(v string) { + o.UpdatedAt = v +} + +// GetVersion returns the Version field value +func (o *SloDefinitionResponse) GetVersion() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *SloDefinitionResponse) GetVersionOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *SloDefinitionResponse) SetVersion(v float32) { + o.Version = v +} + +func (o SloDefinitionResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SloDefinitionResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + 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["enabled"] = o.Enabled + toSerialize["groupBy"] = o.GroupBy + toSerialize["tags"] = o.Tags + toSerialize["createdAt"] = o.CreatedAt + toSerialize["updatedAt"] = o.UpdatedAt + toSerialize["version"] = o.Version + return toSerialize, nil +} + +func (o *SloDefinitionResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "name", + "description", + "indicator", + "timeWindow", + "budgetingMethod", + "objective", + "settings", + "revision", + "enabled", + "groupBy", + "tags", + "createdAt", + "updatedAt", + "version", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSloDefinitionResponse := _SloDefinitionResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSloDefinitionResponse) + + if err != nil { + return err + } + + *o = SloDefinitionResponse(varSloDefinitionResponse) + + return err +} + +type NullableSloDefinitionResponse struct { + value *SloDefinitionResponse + isSet bool +} + +func (v NullableSloDefinitionResponse) Get() *SloDefinitionResponse { + return v.value +} + +func (v *NullableSloDefinitionResponse) Set(val *SloDefinitionResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSloDefinitionResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSloDefinitionResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSloDefinitionResponse(val *SloDefinitionResponse) *NullableSloDefinitionResponse { + return &NullableSloDefinitionResponse{value: val, isSet: true} +} + +func (v NullableSloDefinitionResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSloDefinitionResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_slo_with_summary_response.go b/generated/slo/model_slo_with_summary_response.go new file mode 100644 index 000000000..8611cb88e --- /dev/null +++ b/generated/slo/model_slo_with_summary_response.go @@ -0,0 +1,616 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the SloWithSummaryResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SloWithSummaryResponse{} + +// SloWithSummaryResponse struct for SloWithSummaryResponse +type SloWithSummaryResponse struct { + // The identifier of the SLO. + Id string `json:"id"` + // The name of the SLO. + Name string `json:"name"` + // The description of the SLO. + Description string `json:"description"` + Indicator SloWithSummaryResponseIndicator `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"` + Summary Summary `json:"summary"` + // Indicate if the SLO is enabled + Enabled bool `json:"enabled"` + GroupBy GroupBy `json:"groupBy"` + // the value derived from the groupBy field, if present, otherwise '*' + InstanceId string `json:"instanceId"` + // List of tags + Tags []string `json:"tags"` + // The creation date + CreatedAt string `json:"createdAt"` + // The last update date + UpdatedAt string `json:"updatedAt"` + // The internal SLO version + Version float32 `json:"version"` +} + +type _SloWithSummaryResponse SloWithSummaryResponse + +// NewSloWithSummaryResponse instantiates a new SloWithSummaryResponse 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 NewSloWithSummaryResponse(id string, name string, description string, indicator SloWithSummaryResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float32, summary Summary, enabled bool, groupBy GroupBy, instanceId string, tags []string, createdAt string, updatedAt string, version float32) *SloWithSummaryResponse { + this := SloWithSummaryResponse{} + 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.Tags = tags + this.CreatedAt = createdAt + this.UpdatedAt = updatedAt + this.Version = version + return &this +} + +// NewSloWithSummaryResponseWithDefaults instantiates a new SloWithSummaryResponse 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 NewSloWithSummaryResponseWithDefaults() *SloWithSummaryResponse { + this := SloWithSummaryResponse{} + return &this +} + +// GetId returns the Id field value +func (o *SloWithSummaryResponse) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *SloWithSummaryResponse) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *SloWithSummaryResponse) 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 *SloWithSummaryResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *SloWithSummaryResponse) SetName(v string) { + o.Name = v +} + +// GetDescription returns the Description field value +func (o *SloWithSummaryResponse) GetDescription() string { + if o == nil { + var ret string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value +func (o *SloWithSummaryResponse) SetDescription(v string) { + o.Description = v +} + +// GetIndicator returns the Indicator field value +func (o *SloWithSummaryResponse) GetIndicator() SloWithSummaryResponseIndicator { + if o == nil { + var ret SloWithSummaryResponseIndicator + return ret + } + + return o.Indicator +} + +// GetIndicatorOk returns a tuple with the Indicator field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetIndicatorOk() (*SloWithSummaryResponseIndicator, bool) { + if o == nil { + return nil, false + } + return &o.Indicator, true +} + +// SetIndicator sets field value +func (o *SloWithSummaryResponse) SetIndicator(v SloWithSummaryResponseIndicator) { + o.Indicator = v +} + +// GetTimeWindow returns the TimeWindow field value +func (o *SloWithSummaryResponse) GetTimeWindow() TimeWindow { + if o == nil { + var ret TimeWindow + return ret + } + + return o.TimeWindow +} + +// GetTimeWindowOk returns a tuple with the TimeWindow field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetTimeWindowOk() (*TimeWindow, bool) { + if o == nil { + return nil, false + } + return &o.TimeWindow, true +} + +// SetTimeWindow sets field value +func (o *SloWithSummaryResponse) SetTimeWindow(v TimeWindow) { + o.TimeWindow = v +} + +// GetBudgetingMethod returns the BudgetingMethod field value +func (o *SloWithSummaryResponse) GetBudgetingMethod() BudgetingMethod { + if o == nil { + var ret BudgetingMethod + return ret + } + + return o.BudgetingMethod +} + +// GetBudgetingMethodOk returns a tuple with the BudgetingMethod field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetBudgetingMethodOk() (*BudgetingMethod, bool) { + if o == nil { + return nil, false + } + return &o.BudgetingMethod, true +} + +// SetBudgetingMethod sets field value +func (o *SloWithSummaryResponse) SetBudgetingMethod(v BudgetingMethod) { + o.BudgetingMethod = v +} + +// GetObjective returns the Objective field value +func (o *SloWithSummaryResponse) GetObjective() Objective { + if o == nil { + var ret Objective + return ret + } + + return o.Objective +} + +// GetObjectiveOk returns a tuple with the Objective field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetObjectiveOk() (*Objective, bool) { + if o == nil { + return nil, false + } + return &o.Objective, true +} + +// SetObjective sets field value +func (o *SloWithSummaryResponse) SetObjective(v Objective) { + o.Objective = v +} + +// GetSettings returns the Settings field value +func (o *SloWithSummaryResponse) GetSettings() Settings { + if o == nil { + var ret Settings + return ret + } + + return o.Settings +} + +// GetSettingsOk returns a tuple with the Settings field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetSettingsOk() (*Settings, bool) { + if o == nil { + return nil, false + } + return &o.Settings, true +} + +// SetSettings sets field value +func (o *SloWithSummaryResponse) SetSettings(v Settings) { + o.Settings = v +} + +// GetRevision returns the Revision field value +func (o *SloWithSummaryResponse) GetRevision() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.Revision +} + +// GetRevisionOk returns a tuple with the Revision field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetRevisionOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.Revision, true +} + +// SetRevision sets field value +func (o *SloWithSummaryResponse) SetRevision(v float32) { + o.Revision = v +} + +// GetSummary returns the Summary field value +func (o *SloWithSummaryResponse) GetSummary() Summary { + if o == nil { + var ret Summary + return ret + } + + return o.Summary +} + +// GetSummaryOk returns a tuple with the Summary field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetSummaryOk() (*Summary, bool) { + if o == nil { + return nil, false + } + return &o.Summary, true +} + +// SetSummary sets field value +func (o *SloWithSummaryResponse) SetSummary(v Summary) { + o.Summary = v +} + +// GetEnabled returns the Enabled field value +func (o *SloWithSummaryResponse) GetEnabled() bool { + if o == nil { + var ret bool + return ret + } + + return o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Enabled, true +} + +// SetEnabled sets field value +func (o *SloWithSummaryResponse) SetEnabled(v bool) { + o.Enabled = v +} + +// GetGroupBy returns the GroupBy field value +func (o *SloWithSummaryResponse) GetGroupBy() GroupBy { + if o == nil { + var ret GroupBy + return ret + } + + return o.GroupBy +} + +// GetGroupByOk returns a tuple with the GroupBy field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetGroupByOk() (*GroupBy, bool) { + if o == nil { + return nil, false + } + return &o.GroupBy, true +} + +// SetGroupBy sets field value +func (o *SloWithSummaryResponse) SetGroupBy(v GroupBy) { + o.GroupBy = v +} + +// GetInstanceId returns the InstanceId field value +func (o *SloWithSummaryResponse) GetInstanceId() string { + if o == nil { + var ret string + return ret + } + + return o.InstanceId +} + +// GetInstanceIdOk returns a tuple with the InstanceId field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetInstanceIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.InstanceId, true +} + +// SetInstanceId sets field value +func (o *SloWithSummaryResponse) SetInstanceId(v string) { + o.InstanceId = v +} + +// GetTags returns the Tags field value +func (o *SloWithSummaryResponse) GetTags() []string { + if o == nil { + var ret []string + return ret + } + + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetTagsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Tags, true +} + +// SetTags sets field value +func (o *SloWithSummaryResponse) SetTags(v []string) { + o.Tags = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *SloWithSummaryResponse) GetCreatedAt() string { + if o == nil { + var ret string + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetCreatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *SloWithSummaryResponse) SetCreatedAt(v string) { + o.CreatedAt = v +} + +// GetUpdatedAt returns the UpdatedAt field value +func (o *SloWithSummaryResponse) GetUpdatedAt() string { + if o == nil { + var ret string + return ret + } + + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetUpdatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.UpdatedAt, true +} + +// SetUpdatedAt sets field value +func (o *SloWithSummaryResponse) SetUpdatedAt(v string) { + o.UpdatedAt = v +} + +// GetVersion returns the Version field value +func (o *SloWithSummaryResponse) GetVersion() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *SloWithSummaryResponse) GetVersionOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *SloWithSummaryResponse) SetVersion(v float32) { + o.Version = v +} + +func (o SloWithSummaryResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SloWithSummaryResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + 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["tags"] = o.Tags + toSerialize["createdAt"] = o.CreatedAt + toSerialize["updatedAt"] = o.UpdatedAt + toSerialize["version"] = o.Version + return toSerialize, nil +} + +func (o *SloWithSummaryResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "id", + "name", + "description", + "indicator", + "timeWindow", + "budgetingMethod", + "objective", + "settings", + "revision", + "summary", + "enabled", + "groupBy", + "instanceId", + "tags", + "createdAt", + "updatedAt", + "version", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSloWithSummaryResponse := _SloWithSummaryResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSloWithSummaryResponse) + + if err != nil { + return err + } + + *o = SloWithSummaryResponse(varSloWithSummaryResponse) + + return err +} + +type NullableSloWithSummaryResponse struct { + value *SloWithSummaryResponse + isSet bool +} + +func (v NullableSloWithSummaryResponse) Get() *SloWithSummaryResponse { + return v.value +} + +func (v *NullableSloWithSummaryResponse) Set(val *SloWithSummaryResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSloWithSummaryResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSloWithSummaryResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSloWithSummaryResponse(val *SloWithSummaryResponse) *NullableSloWithSummaryResponse { + return &NullableSloWithSummaryResponse{value: val, isSet: true} +} + +func (v NullableSloWithSummaryResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSloWithSummaryResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/generated/slo/model_slo_with_summary_response_indicator.go b/generated/slo/model_slo_with_summary_response_indicator.go new file mode 100644 index 000000000..8d19440d6 --- /dev/null +++ b/generated/slo/model_slo_with_summary_response_indicator.go @@ -0,0 +1,323 @@ +/* +SLOs + +OpenAPI schema for SLOs endpoints + +API version: 1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package slo + +import ( + "encoding/json" + "fmt" + "gopkg.in/validator.v2" +) + +// SloWithSummaryResponseIndicator - struct for SloWithSummaryResponseIndicator +type SloWithSummaryResponseIndicator struct { + IndicatorPropertiesApmAvailability *IndicatorPropertiesApmAvailability + IndicatorPropertiesApmLatency *IndicatorPropertiesApmLatency + IndicatorPropertiesCustomKql *IndicatorPropertiesCustomKql + IndicatorPropertiesCustomMetric *IndicatorPropertiesCustomMetric + IndicatorPropertiesHistogram *IndicatorPropertiesHistogram + IndicatorPropertiesTimesliceMetric *IndicatorPropertiesTimesliceMetric +} + +// IndicatorPropertiesApmAvailabilityAsSloWithSummaryResponseIndicator is a convenience function that returns IndicatorPropertiesApmAvailability wrapped in SloWithSummaryResponseIndicator +func IndicatorPropertiesApmAvailabilityAsSloWithSummaryResponseIndicator(v *IndicatorPropertiesApmAvailability) SloWithSummaryResponseIndicator { + return SloWithSummaryResponseIndicator{ + IndicatorPropertiesApmAvailability: v, + } +} + +// IndicatorPropertiesApmLatencyAsSloWithSummaryResponseIndicator is a convenience function that returns IndicatorPropertiesApmLatency wrapped in SloWithSummaryResponseIndicator +func IndicatorPropertiesApmLatencyAsSloWithSummaryResponseIndicator(v *IndicatorPropertiesApmLatency) SloWithSummaryResponseIndicator { + return SloWithSummaryResponseIndicator{ + IndicatorPropertiesApmLatency: v, + } +} + +// IndicatorPropertiesCustomKqlAsSloWithSummaryResponseIndicator is a convenience function that returns IndicatorPropertiesCustomKql wrapped in SloWithSummaryResponseIndicator +func IndicatorPropertiesCustomKqlAsSloWithSummaryResponseIndicator(v *IndicatorPropertiesCustomKql) SloWithSummaryResponseIndicator { + return SloWithSummaryResponseIndicator{ + IndicatorPropertiesCustomKql: v, + } +} + +// IndicatorPropertiesCustomMetricAsSloWithSummaryResponseIndicator is a convenience function that returns IndicatorPropertiesCustomMetric wrapped in SloWithSummaryResponseIndicator +func IndicatorPropertiesCustomMetricAsSloWithSummaryResponseIndicator(v *IndicatorPropertiesCustomMetric) SloWithSummaryResponseIndicator { + return SloWithSummaryResponseIndicator{ + IndicatorPropertiesCustomMetric: v, + } +} + +// IndicatorPropertiesHistogramAsSloWithSummaryResponseIndicator is a convenience function that returns IndicatorPropertiesHistogram wrapped in SloWithSummaryResponseIndicator +func IndicatorPropertiesHistogramAsSloWithSummaryResponseIndicator(v *IndicatorPropertiesHistogram) SloWithSummaryResponseIndicator { + return SloWithSummaryResponseIndicator{ + IndicatorPropertiesHistogram: v, + } +} + +// IndicatorPropertiesTimesliceMetricAsSloWithSummaryResponseIndicator is a convenience function that returns IndicatorPropertiesTimesliceMetric wrapped in SloWithSummaryResponseIndicator +func IndicatorPropertiesTimesliceMetricAsSloWithSummaryResponseIndicator(v *IndicatorPropertiesTimesliceMetric) SloWithSummaryResponseIndicator { + return SloWithSummaryResponseIndicator{ + IndicatorPropertiesTimesliceMetric: v, + } +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *SloWithSummaryResponseIndicator) 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 + dst.IndicatorPropertiesApmAvailability = nil + } else { + if err = validator.Validate(dst.IndicatorPropertiesApmAvailability); err != nil { + dst.IndicatorPropertiesApmAvailability = nil + } else { + match++ + } + } + } 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 + dst.IndicatorPropertiesApmLatency = nil + } else { + if err = validator.Validate(dst.IndicatorPropertiesApmLatency); err != nil { + dst.IndicatorPropertiesApmLatency = nil + } else { + match++ + } + } + } 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 + } else { + if err = validator.Validate(dst.IndicatorPropertiesCustomKql); err != nil { + dst.IndicatorPropertiesCustomKql = nil + } else { + match++ + } + } + } else { + dst.IndicatorPropertiesCustomKql = nil + } + + // try to unmarshal data into IndicatorPropertiesCustomMetric + err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesCustomMetric) + if err == nil { + jsonIndicatorPropertiesCustomMetric, _ := json.Marshal(dst.IndicatorPropertiesCustomMetric) + if string(jsonIndicatorPropertiesCustomMetric) == "{}" { // empty struct + dst.IndicatorPropertiesCustomMetric = nil + } else { + if err = validator.Validate(dst.IndicatorPropertiesCustomMetric); err != nil { + dst.IndicatorPropertiesCustomMetric = nil + } else { + match++ + } + } + } else { + dst.IndicatorPropertiesCustomMetric = nil + } + + // try to unmarshal data into IndicatorPropertiesHistogram + err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesHistogram) + if err == nil { + jsonIndicatorPropertiesHistogram, _ := json.Marshal(dst.IndicatorPropertiesHistogram) + if string(jsonIndicatorPropertiesHistogram) == "{}" { // empty struct + dst.IndicatorPropertiesHistogram = nil + } else { + if err = validator.Validate(dst.IndicatorPropertiesHistogram); err != nil { + dst.IndicatorPropertiesHistogram = nil + } else { + match++ + } + } + } else { + dst.IndicatorPropertiesHistogram = nil + } + + // try to unmarshal data into IndicatorPropertiesTimesliceMetric + err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesTimesliceMetric) + if err == nil { + jsonIndicatorPropertiesTimesliceMetric, _ := json.Marshal(dst.IndicatorPropertiesTimesliceMetric) + if string(jsonIndicatorPropertiesTimesliceMetric) == "{}" { // empty struct + dst.IndicatorPropertiesTimesliceMetric = nil + } else { + if err = validator.Validate(dst.IndicatorPropertiesTimesliceMetric); err != nil { + dst.IndicatorPropertiesTimesliceMetric = nil + } else { + match++ + } + } + } else { + dst.IndicatorPropertiesTimesliceMetric = 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 + dst.IndicatorPropertiesTimesliceMetric = nil + + return fmt.Errorf("data matches more than one schema in oneOf(SloWithSummaryResponseIndicator)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(SloWithSummaryResponseIndicator)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src SloWithSummaryResponseIndicator) 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) + } + + if src.IndicatorPropertiesTimesliceMetric != nil { + return json.Marshal(&src.IndicatorPropertiesTimesliceMetric) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *SloWithSummaryResponseIndicator) 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 + } + + if obj.IndicatorPropertiesTimesliceMetric != nil { + return obj.IndicatorPropertiesTimesliceMetric + } + + // all schemas are nil + return nil +} + +// Get the actual instance value +func (obj SloWithSummaryResponseIndicator) GetActualInstanceValue() (interface{}) { + 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 + } + + if obj.IndicatorPropertiesTimesliceMetric != nil { + return *obj.IndicatorPropertiesTimesliceMetric + } + + // all schemas are nil + return nil +} + +type NullableSloWithSummaryResponseIndicator struct { + value *SloWithSummaryResponseIndicator + isSet bool +} + +func (v NullableSloWithSummaryResponseIndicator) Get() *SloWithSummaryResponseIndicator { + return v.value +} + +func (v *NullableSloWithSummaryResponseIndicator) Set(val *SloWithSummaryResponseIndicator) { + v.value = val + v.isSet = true +} + +func (v NullableSloWithSummaryResponseIndicator) IsSet() bool { + return v.isSet +} + +func (v *NullableSloWithSummaryResponseIndicator) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSloWithSummaryResponseIndicator(val *SloWithSummaryResponseIndicator) *NullableSloWithSummaryResponseIndicator { + return &NullableSloWithSummaryResponseIndicator{value: val, isSet: true} +} + +func (v NullableSloWithSummaryResponseIndicator) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSloWithSummaryResponseIndicator) 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 e04aea289..e9c558602 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the Summary type satisfies the MappedNullable interface at compile time @@ -19,16 +21,18 @@ var _ MappedNullable = &Summary{} // Summary The SLO computed data type Summary struct { - Status SummaryStatus `json:"status"` - SliValue float64 `json:"sliValue"` - ErrorBudget ErrorBudget `json:"errorBudget"` + Status SummaryStatus `json:"status"` + SliValue float32 `json:"sliValue"` + ErrorBudget ErrorBudget `json:"errorBudget"` } +type _Summary Summary + // 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(status SummaryStatus, sliValue float64, errorBudget ErrorBudget) *Summary { +func NewSummary(status SummaryStatus, sliValue float32, errorBudget ErrorBudget) *Summary { this := Summary{} this.Status = status this.SliValue = sliValue @@ -69,9 +73,9 @@ func (o *Summary) SetStatus(v SummaryStatus) { } // GetSliValue returns the SliValue field value -func (o *Summary) GetSliValue() float64 { +func (o *Summary) GetSliValue() float32 { if o == nil { - var ret float64 + var ret float32 return ret } @@ -80,7 +84,7 @@ func (o *Summary) GetSliValue() float64 { // GetSliValueOk returns a tuple with the SliValue field value // and a boolean to check if the value has been set. -func (o *Summary) GetSliValueOk() (*float64, bool) { +func (o *Summary) GetSliValueOk() (*float32, bool) { if o == nil { return nil, false } @@ -88,7 +92,7 @@ func (o *Summary) GetSliValueOk() (*float64, bool) { } // SetSliValue sets field value -func (o *Summary) SetSliValue(v float64) { +func (o *Summary) SetSliValue(v float32) { o.SliValue = v } @@ -117,7 +121,7 @@ func (o *Summary) SetErrorBudget(v ErrorBudget) { } func (o Summary) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -132,6 +136,45 @@ func (o Summary) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *Summary) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "status", + "sliValue", + "errorBudget", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSummary := _Summary{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSummary) + + if err != nil { + return err + } + + *o = Summary(varSummary) + + return err +} + type NullableSummary struct { value *Summary isSet bool @@ -167,3 +210,5 @@ func (v *NullableSummary) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_summary_status.go b/generated/slo/model_summary_status.go index 4ebe3d0f5..c5f0da437 100644 --- a/generated/slo/model_summary_status.go +++ b/generated/slo/model_summary_status.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -20,10 +20,10 @@ type SummaryStatus string // List of summary_status const ( - NO_DATA SummaryStatus = "NO_DATA" - HEALTHY SummaryStatus = "HEALTHY" + NO_DATA SummaryStatus = "NO_DATA" + HEALTHY SummaryStatus = "HEALTHY" DEGRADING SummaryStatus = "DEGRADING" - VIOLATED SummaryStatus = "VIOLATED" + VIOLATED SummaryStatus = "VIOLATED" ) // All allowed values of SummaryStatus enum @@ -112,3 +112,4 @@ 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 index e7ca20150..fe915f997 100644 --- a/generated/slo/model_time_window.go +++ b/generated/slo/model_time_window.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the TimeWindow type satisfies the MappedNullable interface at compile time @@ -25,6 +27,8 @@ type TimeWindow struct { Type string `json:"type"` } +type _TimeWindow TimeWindow + // 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 @@ -93,7 +97,7 @@ func (o *TimeWindow) SetType(v string) { } func (o TimeWindow) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -107,6 +111,44 @@ func (o TimeWindow) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *TimeWindow) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "duration", + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varTimeWindow := _TimeWindow{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varTimeWindow) + + if err != nil { + return err + } + + *o = TimeWindow(varTimeWindow) + + return err +} + type NullableTimeWindow struct { value *TimeWindow isSet bool @@ -142,3 +184,5 @@ func (v *NullableTimeWindow) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_timeslice_metric_basic_metric_with_field.go b/generated/slo/model_timeslice_metric_basic_metric_with_field.go index 6f3e23eda..98a0b713a 100644 --- a/generated/slo/model_timeslice_metric_basic_metric_with_field.go +++ b/generated/slo/model_timeslice_metric_basic_metric_with_field.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the TimesliceMetricBasicMetricWithField type satisfies the MappedNullable interface at compile time @@ -20,7 +22,7 @@ var _ MappedNullable = &TimesliceMetricBasicMetricWithField{} // TimesliceMetricBasicMetricWithField struct for TimesliceMetricBasicMetricWithField type TimesliceMetricBasicMetricWithField struct { // The name of the metric. Only valid options are A-Z - Name string `json:"name"` + Name string `json:"name" validate:"regexp=^[A-Z]$"` // The aggregation type of the metric. Aggregation string `json:"aggregation"` // The field of the metric. @@ -29,6 +31,8 @@ type TimesliceMetricBasicMetricWithField struct { Filter *string `json:"filter,omitempty"` } +type _TimesliceMetricBasicMetricWithField TimesliceMetricBasicMetricWithField + // NewTimesliceMetricBasicMetricWithField instantiates a new TimesliceMetricBasicMetricWithField object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -154,7 +158,7 @@ func (o *TimesliceMetricBasicMetricWithField) SetFilter(v string) { } func (o TimesliceMetricBasicMetricWithField) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -172,6 +176,45 @@ func (o TimesliceMetricBasicMetricWithField) ToMap() (map[string]interface{}, er return toSerialize, nil } +func (o *TimesliceMetricBasicMetricWithField) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "aggregation", + "field", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varTimesliceMetricBasicMetricWithField := _TimesliceMetricBasicMetricWithField{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varTimesliceMetricBasicMetricWithField) + + if err != nil { + return err + } + + *o = TimesliceMetricBasicMetricWithField(varTimesliceMetricBasicMetricWithField) + + return err +} + type NullableTimesliceMetricBasicMetricWithField struct { value *TimesliceMetricBasicMetricWithField isSet bool @@ -207,3 +250,5 @@ func (v *NullableTimesliceMetricBasicMetricWithField) UnmarshalJSON(src []byte) v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_timeslice_metric_doc_count_metric.go b/generated/slo/model_timeslice_metric_doc_count_metric.go index ac35571c3..6c31e990a 100644 --- a/generated/slo/model_timeslice_metric_doc_count_metric.go +++ b/generated/slo/model_timeslice_metric_doc_count_metric.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the TimesliceMetricDocCountMetric type satisfies the MappedNullable interface at compile time @@ -20,13 +22,15 @@ var _ MappedNullable = &TimesliceMetricDocCountMetric{} // TimesliceMetricDocCountMetric struct for TimesliceMetricDocCountMetric type TimesliceMetricDocCountMetric struct { // The name of the metric. Only valid options are A-Z - Name string `json:"name"` + Name string `json:"name" validate:"regexp=^[A-Z]$"` // The aggregation type of the metric. Only valid option is \"doc_count\" Aggregation string `json:"aggregation"` // The filter to apply to the metric. Filter *string `json:"filter,omitempty"` } +type _TimesliceMetricDocCountMetric TimesliceMetricDocCountMetric + // NewTimesliceMetricDocCountMetric instantiates a new TimesliceMetricDocCountMetric object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -127,7 +131,7 @@ func (o *TimesliceMetricDocCountMetric) SetFilter(v string) { } func (o TimesliceMetricDocCountMetric) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -144,6 +148,44 @@ func (o TimesliceMetricDocCountMetric) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +func (o *TimesliceMetricDocCountMetric) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "aggregation", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varTimesliceMetricDocCountMetric := _TimesliceMetricDocCountMetric{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varTimesliceMetricDocCountMetric) + + if err != nil { + return err + } + + *o = TimesliceMetricDocCountMetric(varTimesliceMetricDocCountMetric) + + return err +} + type NullableTimesliceMetricDocCountMetric struct { value *TimesliceMetricDocCountMetric isSet bool @@ -179,3 +221,5 @@ func (v *NullableTimesliceMetricDocCountMetric) UnmarshalJSON(src []byte) error v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/model_timeslice_metric_percentile_metric.go b/generated/slo/model_timeslice_metric_percentile_metric.go index ada902804..3161e5a51 100644 --- a/generated/slo/model_timeslice_metric_percentile_metric.go +++ b/generated/slo/model_timeslice_metric_percentile_metric.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -12,6 +12,8 @@ package slo import ( "encoding/json" + "bytes" + "fmt" ) // checks if the TimesliceMetricPercentileMetric type satisfies the MappedNullable interface at compile time @@ -20,22 +22,24 @@ var _ MappedNullable = &TimesliceMetricPercentileMetric{} // TimesliceMetricPercentileMetric struct for TimesliceMetricPercentileMetric type TimesliceMetricPercentileMetric struct { // The name of the metric. Only valid options are A-Z - Name string `json:"name"` + Name string `json:"name" validate:"regexp=^[A-Z]$"` // The aggregation type of the metric. Only valid option is \"percentile\" Aggregation string `json:"aggregation"` // The field of the metric. Field string `json:"field"` // The percentile value. - Percentile float64 `json:"percentile"` + Percentile float32 `json:"percentile"` // The filter to apply to the metric. Filter *string `json:"filter,omitempty"` } +type _TimesliceMetricPercentileMetric TimesliceMetricPercentileMetric + // NewTimesliceMetricPercentileMetric instantiates a new TimesliceMetricPercentileMetric object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewTimesliceMetricPercentileMetric(name string, aggregation string, field string, percentile float64) *TimesliceMetricPercentileMetric { +func NewTimesliceMetricPercentileMetric(name string, aggregation string, field string, percentile float32) *TimesliceMetricPercentileMetric { this := TimesliceMetricPercentileMetric{} this.Name = name this.Aggregation = aggregation @@ -125,9 +129,9 @@ func (o *TimesliceMetricPercentileMetric) SetField(v string) { } // GetPercentile returns the Percentile field value -func (o *TimesliceMetricPercentileMetric) GetPercentile() float64 { +func (o *TimesliceMetricPercentileMetric) GetPercentile() float32 { if o == nil { - var ret float64 + var ret float32 return ret } @@ -136,7 +140,7 @@ func (o *TimesliceMetricPercentileMetric) GetPercentile() float64 { // GetPercentileOk returns a tuple with the Percentile field value // and a boolean to check if the value has been set. -func (o *TimesliceMetricPercentileMetric) GetPercentileOk() (*float64, bool) { +func (o *TimesliceMetricPercentileMetric) GetPercentileOk() (*float32, bool) { if o == nil { return nil, false } @@ -144,7 +148,7 @@ func (o *TimesliceMetricPercentileMetric) GetPercentileOk() (*float64, bool) { } // SetPercentile sets field value -func (o *TimesliceMetricPercentileMetric) SetPercentile(v float64) { +func (o *TimesliceMetricPercentileMetric) SetPercentile(v float32) { o.Percentile = v } @@ -181,7 +185,7 @@ func (o *TimesliceMetricPercentileMetric) SetFilter(v string) { } func (o TimesliceMetricPercentileMetric) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -200,6 +204,46 @@ func (o TimesliceMetricPercentileMetric) ToMap() (map[string]interface{}, error) return toSerialize, nil } +func (o *TimesliceMetricPercentileMetric) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "name", + "aggregation", + "field", + "percentile", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varTimesliceMetricPercentileMetric := _TimesliceMetricPercentileMetric{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varTimesliceMetricPercentileMetric) + + if err != nil { + return err + } + + *o = TimesliceMetricPercentileMetric(varTimesliceMetricPercentileMetric) + + return err +} + type NullableTimesliceMetricPercentileMetric struct { value *TimesliceMetricPercentileMetric isSet bool @@ -235,3 +279,5 @@ func (v *NullableTimesliceMetricPercentileMetric) UnmarshalJSON(src []byte) erro 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 242972bca..f4f285462 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: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -17,18 +17,18 @@ 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 *CreateSloRequestIndicator `json:"indicator,omitempty"` - TimeWindow *TimeWindow `json:"timeWindow,omitempty"` - BudgetingMethod *BudgetingMethod `json:"budgetingMethod,omitempty"` - Objective *Objective `json:"objective,omitempty"` - Settings *Settings `json:"settings,omitempty"` - GroupBy *SloResponseGroupBy `json:"groupBy,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"` + GroupBy *GroupBy `json:"groupBy,omitempty"` // List of tags Tags []string `json:"tags,omitempty"` } @@ -275,9 +275,9 @@ func (o *UpdateSloRequest) SetSettings(v Settings) { } // GetGroupBy returns the GroupBy field value if set, zero value otherwise. -func (o *UpdateSloRequest) GetGroupBy() SloResponseGroupBy { +func (o *UpdateSloRequest) GetGroupBy() GroupBy { if o == nil || IsNil(o.GroupBy) { - var ret SloResponseGroupBy + var ret GroupBy return ret } return *o.GroupBy @@ -285,7 +285,7 @@ func (o *UpdateSloRequest) GetGroupBy() SloResponseGroupBy { // 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 *UpdateSloRequest) GetGroupByOk() (*SloResponseGroupBy, bool) { +func (o *UpdateSloRequest) GetGroupByOk() (*GroupBy, bool) { if o == nil || IsNil(o.GroupBy) { return nil, false } @@ -301,8 +301,8 @@ func (o *UpdateSloRequest) HasGroupBy() bool { return false } -// SetGroupBy gets a reference to the given SloResponseGroupBy and assigns it to the GroupBy field. -func (o *UpdateSloRequest) SetGroupBy(v SloResponseGroupBy) { +// SetGroupBy gets a reference to the given GroupBy and assigns it to the GroupBy field. +func (o *UpdateSloRequest) SetGroupBy(v GroupBy) { o.GroupBy = &v } @@ -339,7 +339,7 @@ func (o *UpdateSloRequest) SetTags(v []string) { } func (o UpdateSloRequest) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() + toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } @@ -413,3 +413,5 @@ func (v *NullableUpdateSloRequest) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/generated/slo/response.go b/generated/slo/response.go index 2875928ac..2cb1fb208 100644 --- a/generated/slo/response.go +++ b/generated/slo/response.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. diff --git a/generated/slo/test/api_slo_test.go b/generated/slo/test/api_slo_test.go new file mode 100644 index 000000000..a9d129796 --- /dev/null +++ b/generated/slo/test/api_slo_test.go @@ -0,0 +1,210 @@ +/* +SLOs + +Testing SloAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" +) + +func Test_openapi_SloAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test SloAPIService BulkDeleteOp", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var spaceId string + + resp, httpRes, err := apiClient.SloAPI.BulkDeleteOp(context.Background(), spaceId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SloAPIService BulkDeleteStatusOp", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var spaceId string + var taskId string + + resp, httpRes, err := apiClient.SloAPI.BulkDeleteStatusOp(context.Background(), spaceId, taskId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SloAPIService CreateSloOp", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var spaceId string + + resp, httpRes, err := apiClient.SloAPI.CreateSloOp(context.Background(), spaceId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SloAPIService DeleteRollupDataOp", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var spaceId string + + resp, httpRes, err := apiClient.SloAPI.DeleteRollupDataOp(context.Background(), spaceId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SloAPIService DeleteSloInstancesOp", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var spaceId string + + httpRes, err := apiClient.SloAPI.DeleteSloInstancesOp(context.Background(), spaceId).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SloAPIService DeleteSloOp", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var spaceId string + var sloId string + + httpRes, err := apiClient.SloAPI.DeleteSloOp(context.Background(), spaceId, sloId).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SloAPIService DisableSloOp", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var spaceId string + var sloId string + + httpRes, err := apiClient.SloAPI.DisableSloOp(context.Background(), spaceId, sloId).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SloAPIService EnableSloOp", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var spaceId string + var sloId string + + httpRes, err := apiClient.SloAPI.EnableSloOp(context.Background(), spaceId, sloId).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SloAPIService FindSlosOp", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var spaceId string + + resp, httpRes, err := apiClient.SloAPI.FindSlosOp(context.Background(), spaceId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SloAPIService GetDefinitionsOp", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var spaceId string + + resp, httpRes, err := apiClient.SloAPI.GetDefinitionsOp(context.Background(), spaceId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SloAPIService GetSloOp", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var spaceId string + var sloId string + + resp, httpRes, err := apiClient.SloAPI.GetSloOp(context.Background(), spaceId, sloId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SloAPIService ResetSloOp", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var spaceId string + var sloId string + + resp, httpRes, err := apiClient.SloAPI.ResetSloOp(context.Background(), spaceId, sloId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test SloAPIService UpdateSloOp", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var spaceId string + var sloId string + + resp, httpRes, err := apiClient.SloAPI.UpdateSloOp(context.Background(), spaceId, sloId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/generated/slo/utils.go b/generated/slo/utils.go index 7907b693f..2ed1d7fce 100644 --- a/generated/slo/utils.go +++ b/generated/slo/utils.go @@ -3,7 +3,7 @@ SLOs OpenAPI schema for SLOs endpoints -API version: 1.0 +API version: 1.1 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. @@ -11,7 +11,9 @@ API version: 1.0 package slo import ( + "bytes" "encoding/json" + "fmt" "reflect" "time" ) @@ -320,7 +322,7 @@ func NewNullableTime(val *time.Time) *NullableTime { } func (v NullableTime) MarshalJSON() ([]byte, error) { - return v.value.MarshalJSON() + return json.Marshal(v.value) } func (v *NullableTime) UnmarshalJSON(src []byte) error { @@ -345,3 +347,15 @@ func IsNil(i interface{}) bool { type MappedNullable interface { ToMap() (map[string]interface{}, error) } + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} \ No newline at end of file From 8441415184e7ecaf7e96789c25bcd227b694c5d3 Mon Sep 17 00:00:00 2001 From: Kevin Delemme Date: Fri, 4 Jul 2025 14:17:44 -0400 Subject: [PATCH 2/3] Update all the things --- generated/slo-spec.yml | 852 +++++-- generated/slo-spec2.yml | 2029 ----------------- generated/slo/.openapi-generator/FILES | 2 + generated/slo/.openapi-generator/VERSION | 2 +- generated/slo/README.md | 21 +- generated/slo/api/openapi.yaml | 179 +- generated/slo/api_slo.go | 895 +++++--- generated/slo/client.go | 183 +- generated/slo/configuration.go | 19 +- generated/slo/docs/ErrorBudget.md | 26 +- .../slo/docs/FindSloDefinitionsResponse.md | 32 +- .../docs/FindSloDefinitionsResponseOneOf.md | 24 +- .../docs/FindSloDefinitionsResponseOneOf1.md | 32 +- generated/slo/docs/FindSloResponse.md | 32 +- .../slo/docs/HistoricalSummaryRequest.md | 51 - .../docs/HistoricalSummaryResponseInner.md | 134 -- .../IndicatorPropertiesApmLatencyParams.md | 10 +- ...tiesCustomMetricParamsTotalMetricsInner.md | 119 - .../IndicatorPropertiesHistogramParamsGood.md | 16 +- ...IndicatorPropertiesHistogramParamsTotal.md | 16 +- ...orPropertiesTimesliceMetricParamsMetric.md | 10 +- ...TimesliceMetricParamsMetricMetricsInner.md | 10 +- generated/slo/docs/Model400Response.md | 10 +- generated/slo/docs/Model401Response.md | 10 +- generated/slo/docs/Model403Response.md | 10 +- generated/slo/docs/Model404Response.md | 10 +- generated/slo/docs/Model409Response.md | 10 +- generated/slo/docs/Objective.md | 18 +- generated/slo/docs/SloApi.md | 454 ++-- generated/slo/docs/SloDefinitionResponse.md | 18 +- generated/slo/docs/SloResponse.md | 366 --- generated/slo/docs/SloResponseGroupBy.md | 30 - generated/slo/docs/SloResponseIndicator.md | 72 - generated/slo/docs/SloWithSummaryResponse.md | 18 +- generated/slo/docs/Summary.md | 10 +- .../docs/TimesliceMetricPercentileMetric.md | 10 +- generated/slo/git_push.sh | 4 +- generated/slo/go.mod | 7 - generated/slo/go.sum | 13 - generated/slo/model_400_response.go | 63 +- generated/slo/model_401_response.go | 63 +- generated/slo/model_403_response.go | 63 +- generated/slo/model_404_response.go | 63 +- generated/slo/model_409_response.go | 63 +- generated/slo/model_budgeting_method.go | 3 +- generated/slo/model_bulk_delete_request.go | 47 +- generated/slo/model_bulk_delete_response.go | 6 +- .../slo/model_bulk_delete_status_response.go | 4 +- ...lk_delete_status_response_results_inner.go | 4 +- .../slo/model_bulk_purge_rollup_request.go | 50 +- ..._bulk_purge_rollup_request_purge_policy.go | 38 +- ...urge_rollup_request_purge_policy_one_of.go | 4 +- ...ge_rollup_request_purge_policy_one_of_1.go | 4 +- .../slo/model_bulk_purge_rollup_response.go | 6 +- generated/slo/model_create_slo_request.go | 66 +- .../slo/model_create_slo_request_indicator.go | 92 +- generated/slo/model_create_slo_response.go | 45 +- .../slo/model_delete_slo_instances_request.go | 47 +- ...delete_slo_instances_request_list_inner.go | 46 +- generated/slo/model_error_budget.go | 80 +- generated/slo/model_filter.go | 6 +- generated/slo/model_filter_meta.go | 29 +- .../model_find_slo_definitions_response.go | 40 +- ...el_find_slo_definitions_response_one_of.go | 40 +- ..._find_slo_definitions_response_one_of_1.go | 60 +- generated/slo/model_find_slo_response.go | 58 +- generated/slo/model_group_by.go | 39 +- .../slo/model_historical_summary_request.go | 116 - ...model_historical_summary_response_inner.go | 232 -- ...l_indicator_properties_apm_availability.go | 46 +- ...ator_properties_apm_availability_params.go | 49 +- .../model_indicator_properties_apm_latency.go | 46 +- ...indicator_properties_apm_latency_params.go | 62 +- .../model_indicator_properties_custom_kql.go | 46 +- ..._indicator_properties_custom_kql_params.go | 58 +- ...odel_indicator_properties_custom_metric.go | 46 +- ...dicator_properties_custom_metric_params.go | 56 +- ...or_properties_custom_metric_params_good.go | 48 +- ...custom_metric_params_good_metrics_inner.go | 38 +- ...metric_params_good_metrics_inner_one_of.go | 49 +- ...tric_params_good_metrics_inner_one_of_1.go | 48 +- ...r_properties_custom_metric_params_total.go | 48 +- ...ustom_metric_params_total_metrics_inner.go | 209 -- .../model_indicator_properties_histogram.go | 46 +- ...l_indicator_properties_histogram_params.go | 56 +- ...icator_properties_histogram_params_good.go | 72 +- ...cator_properties_histogram_params_total.go | 72 +- ...l_indicator_properties_timeslice_metric.go | 46 +- ...ator_properties_timeslice_metric_params.go | 53 +- ...operties_timeslice_metric_params_metric.go | 62 +- ...lice_metric_params_metric_metrics_inner.go | 16 +- generated/slo/model_kql_with_filters.go | 42 +- generated/slo/model_kql_with_filters_good.go | 42 +- .../slo/model_kql_with_filters_one_of.go | 8 +- generated/slo/model_kql_with_filters_total.go | 42 +- generated/slo/model_objective.go | 69 +- generated/slo/model_settings.go | 4 +- .../slo/model_slo_definition_response.go | 95 +- generated/slo/model_slo_response.go | 529 ----- generated/slo/model_slo_response_group_by.go | 145 -- generated/slo/model_slo_response_indicator.go | 323 --- .../slo/model_slo_with_summary_response.go | 99 +- ...del_slo_with_summary_response_indicator.go | 260 +-- generated/slo/model_summary.go | 63 +- generated/slo/model_summary_status.go | 7 +- generated/slo/model_time_window.go | 46 +- ...imeslice_metric_basic_metric_with_field.go | 49 +- ...model_timeslice_metric_doc_count_metric.go | 48 +- ...odel_timeslice_metric_percentile_metric.go | 62 +- generated/slo/model_update_slo_request.go | 20 +- generated/slo/test/api_slo_test.go | 210 -- generated/slo/utils.go | 16 +- internal/kibana/slo.go | 22 + internal/kibana/slo_test.go | 6 + 114 files changed, 2360 insertions(+), 8360 deletions(-) delete mode 100644 generated/slo-spec2.yml delete mode 100644 generated/slo/docs/HistoricalSummaryRequest.md delete mode 100644 generated/slo/docs/HistoricalSummaryResponseInner.md delete mode 100644 generated/slo/docs/IndicatorPropertiesCustomMetricParamsTotalMetricsInner.md delete mode 100644 generated/slo/docs/SloResponse.md delete mode 100644 generated/slo/docs/SloResponseGroupBy.md delete mode 100644 generated/slo/docs/SloResponseIndicator.md delete mode 100644 generated/slo/go.mod delete mode 100644 generated/slo/go.sum delete mode 100644 generated/slo/model_historical_summary_request.go delete mode 100644 generated/slo/model_historical_summary_response_inner.go delete mode 100644 generated/slo/model_indicator_properties_custom_metric_params_total_metrics_inner.go delete mode 100644 generated/slo/model_slo_response.go delete mode 100644 generated/slo/model_slo_response_group_by.go delete mode 100644 generated/slo/model_slo_response_indicator.go delete mode 100644 generated/slo/test/api_slo_test.go diff --git a/generated/slo-spec.yml b/generated/slo-spec.yml index a1922fa03..bbc2bb684 100644 --- a/generated/slo-spec.yml +++ b/generated/slo-spec.yml @@ -2,25 +2,24 @@ openapi: 3.0.1 info: title: SLOs description: OpenAPI schema for SLOs endpoints - version: '1.0' + version: '1.1' 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: [] + - url: https://{kibana_url} + variables: + kibana_url: + default: localhost:5601 tags: - name: slo description: SLO APIs enable you to define, manage and track service-level objectives paths: /s/{spaceId}/api/observability/slos: post: - summary: Creates an SLO. + summary: Create an SLO operationId: createSloOp description: | You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. @@ -66,10 +65,8 @@ paths: application/json: schema: $ref: '#/components/schemas/409_response' - servers: - - url: https://localhost:5601 get: - summary: Retrieves a paginated list of SLOs + summary: Get 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. @@ -84,16 +81,30 @@ paths: schema: type: string example: 'slo.name:latency* and slo.tags : "prod"' + - name: size + in: query + description: The page size to use for cursor-based pagination, must be greater or equal than 1 + schema: + type: integer + default: 1 + example: 1 + - name: searchAfter + in: query + description: The cursor to use for fetching the results from, when using a cursor-base pagination. + schema: + type: array + items: + type: string - name: page in: query - description: The page number to return + description: The page to use for pagination, must be greater or equal than 1 schema: type: integer default: 1 example: 1 - name: perPage in: query - description: The number of SLOs to return per page + description: Number of SLOs returned by page schema: type: integer default: 25 @@ -121,6 +132,11 @@ paths: - desc default: asc example: asc + - name: hideStale + in: query + description: Hide stale SLOs from the list as defined by stale SLO threshold in SLO settings + schema: + type: boolean responses: '200': description: Successful request @@ -154,7 +170,7 @@ paths: $ref: '#/components/schemas/404_response' /s/{spaceId}/api/observability/slos/{sloId}: get: - summary: Retrieves a SLO + summary: Get an SLO operationId: getSloOp description: | You must have the `read` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. @@ -176,7 +192,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/slo_response' + $ref: '#/components/schemas/slo_with_summary_response' '400': description: Bad request content: @@ -202,7 +218,7 @@ paths: schema: $ref: '#/components/schemas/404_response' put: - summary: Updates an SLO + summary: Update an SLO operationId: updateSloOp description: | You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. @@ -224,7 +240,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/slo_response' + $ref: '#/components/schemas/slo_definition_response' '400': description: Bad request content: @@ -250,7 +266,7 @@ paths: schema: $ref: '#/components/schemas/404_response' delete: - summary: Deletes an SLO + summary: Delete an SLO operationId: deleteSloOp description: | You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. @@ -289,7 +305,7 @@ paths: $ref: '#/components/schemas/404_response' /s/{spaceId}/api/observability/slos/{sloId}/enable: post: - summary: Enables an SLO + summary: Enable an SLO operationId: enableSloOp description: | You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. @@ -328,8 +344,47 @@ paths: $ref: '#/components/schemas/404_response' /s/{spaceId}/api/observability/slos/{sloId}/disable: post: - summary: Disables an SLO + summary: Disable 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: + '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}/_reset: + post: + summary: Reset an SLO + operationId: resetSloOp description: | You must have the `write` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. tags: @@ -341,6 +396,10 @@ paths: responses: '200': description: Successful request + content: + application/json: + schema: + $ref: '#/components/schemas/slo_definition_response' '400': description: Bad request content: @@ -365,12 +424,12 @@ paths: application/json: schema: $ref: '#/components/schemas/404_response' - /s/{spaceId}/internal/observability/slos/_historical_summary: + /s/{spaceId}/api/observability/slos/_bulk_purge_rollup: post: - summary: Retrieves the historical summary for a list of SLOs - operationId: historicalSummaryOp + summary: Batch delete rollup and summary data + operationId: deleteRollupDataOp description: | - You must have the `read` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + The deletion occurs for the specified list of `sloId`. You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. tags: - slo parameters: @@ -381,14 +440,81 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/historical_summary_request' + $ref: '#/components/schemas/bulk_purge_rollup_request' + responses: + '200': + description: Successful request + content: + application/json: + schema: + $ref: '#/components/schemas/bulk_purge_rollup_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' + /s/{spaceId}/internal/observability/slos/_definitions: + get: + summary: Get the SLO definitions + operationId: getDefinitionsOp + 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: includeOutdatedOnly + in: query + description: Indicates if the API returns only outdated SLO or all SLO definitions + schema: + type: boolean + example: true + - name: tags + in: query + description: Filters the SLOs by tag + schema: + type: string + - name: search + in: query + description: Filters the SLOs by name + schema: + type: string + example: my service availability + - name: page + in: query + description: The page to use for pagination, must be greater or equal than 1 + schema: + type: number + example: 1 + - name: perPage + in: query + description: Number of SLOs returned by page + schema: + type: integer + default: 100 + maximum: 1000 + example: 100 responses: '200': description: Successful request content: application/json: schema: - $ref: '#/components/schemas/historical_summary_response' + $ref: '#/components/schemas/find_slo_definitions_response' '400': description: Bad request content: @@ -409,10 +535,10 @@ paths: $ref: '#/components/schemas/403_response' /s/{spaceId}/api/observability/slos/_delete_instances: post: - summary: Batch delete rollup and summary data for the matching list of sloId and instanceId + summary: Batch delete rollup and summary data operationId: deleteSloInstancesOp description: | - You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + The deletion occurs for the specified list of `sloId` and `instanceId`. You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. tags: - slo parameters: @@ -445,18 +571,92 @@ paths: application/json: schema: $ref: '#/components/schemas/403_response' - servers: - - url: https://localhost:5601 + /s/{spaceId}/api/observability/slos/_bulk_delete: + post: + summary: Bulk delete SLO definitions and their associated summary and rollup data. + operationId: bulkDeleteOp + description: | + Bulk delete SLO definitions and their associated summary and rollup data. This endpoint initiates a bulk deletion operation for SLOs, which may take some time to complete. The status of the operation can be checked using the `GET /api/slo/_bulk_delete/{taskId}` endpoint. + tags: + - slo + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/bulk_delete_request' + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/bulk_delete_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' + /s/{spaceId}/api/observability/slos/_bulk_delete/{taskId}: + get: + summary: Retrieve the status of the bulk deletion + operationId: bulkDeleteStatusOp + description: | + Retrieve the status of the bulk deletion operation for SLOs. This endpoint returns the status of the bulk deletion operation, including whether it is completed and the results of the operation. + tags: + - slo + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' + - name: taskId + in: path + description: The task id of the bulk delete operation + required: true + schema: + type: string + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + responses: + '200': + description: Successful response + content: + application/json: + schema: + $ref: '#/components/schemas/bulk_delete_status_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: Authorization - description: 'e.g. Authorization: ApiKey base64AccessApiKey' parameters: kbn_xsrf: schema: @@ -529,12 +729,96 @@ components: description: The type of indicator. type: string example: sli.apm.transactionDuration + filter_meta: + title: FilterMeta + description: Defines properties for a filter + type: object + properties: + alias: + type: string + nullable: true + disabled: + type: boolean + negate: + type: boolean + controlledBy: + type: string + group: + type: string + index: + type: string + isMultiIndex: + type: boolean + type: + type: string + key: + type: string + params: + type: object + value: + type: string + field: + type: string + filter: + title: Filter + description: Defines properties for a filter + type: object + properties: + query: + type: object + meta: + $ref: '#/components/schemas/filter_meta' + kql_with_filters: + title: KQL with filters + description: Defines properties for a filter + oneOf: + - description: the KQL query to filter the documents with. + type: string + example: 'field.environment : "production" and service.name : "my-service"' + - type: object + properties: + kqlQuery: + type: string + filters: + type: array + items: + $ref: '#/components/schemas/filter' + kql_with_filters_good: + title: KQL query for good events + description: The KQL query used to define the good events. + oneOf: + - description: the KQL query to filter the documents with. + type: string + example: 'request.latency <= 150 and request.status_code : "2xx"' + - type: object + properties: + kqlQuery: + type: string + filters: + type: array + items: + $ref: '#/components/schemas/filter' + kql_with_filters_total: + title: KQL query for all events + description: The KQL query used to define all events. + oneOf: + - description: the KQL query to filter the documents with. + type: string + example: 'field.environment : "production" and service.name : "my-service"' + - type: object + properties: + kqlQuery: + type: string + filters: + type: array + items: + $ref: '#/components/schemas/filter' indicator_properties_custom_kql: - title: Custom KQL + title: Custom Query required: - type - params - description: Defines properties for a custom KQL indicator type + description: Defines properties for a custom query indicator type type: object properties: params: @@ -551,18 +835,16 @@ components: description: The index or index pattern to use type: string example: my-service-* - filter: - description: the KQL query to filter the documents with. + dataViewId: + description: The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. type: string - example: 'field.environment : "production" and service.name : "my-service"' + example: 03b80ab3-003d-498b-881c-3beedbaf1162 + filter: + $ref: '#/components/schemas/kql_with_filters' good: - description: the KQL query used to define the good events. - type: string - example: 'request.latency <= 150 and request.status_code : "2xx"' + $ref: '#/components/schemas/kql_with_filters_good' total: - description: the KQL query used to define all events. - type: string - example: '' + $ref: '#/components/schemas/kql_with_filters_total' timestampField: description: | The timestamp field used in the source indice. @@ -646,6 +928,10 @@ components: description: The index or index pattern to use type: string example: my-service-* + dataViewId: + description: The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. + type: string + example: 03b80ab3-003d-498b-881c-3beedbaf1162 filter: description: the KQL query to filter the documents with. type: string @@ -667,31 +953,52 @@ components: 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"' + oneOf: + - 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. + 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: *' + - type: object + required: + - name + - aggregation + properties: + name: + description: The name of the metric. Only valid options are A-Z + type: string + example: A + pattern: ^[A-Z]$ + aggregation: + description: The aggregation type of the metric. + type: string + example: doc_count + enum: + - doc_count + filter: + description: The filter to apply to the metric. + type: string + example: 'processor.outcome: *' equation: description: The equation to calculate the "good" metric. type: string @@ -708,31 +1015,52 @@ components: 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: *' + oneOf: + - 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. + 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: *' + - type: object + required: + - name + - aggregation + properties: + name: + description: The name of the metric. Only valid options are A-Z + type: string + example: A + pattern: ^[A-Z]$ + aggregation: + description: The aggregation type of the metric. + type: string + example: doc_count + enum: + - doc_count + 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 @@ -763,6 +1091,10 @@ components: description: The index or index pattern to use type: string example: my-service-* + dataViewId: + description: The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. + type: string + example: 03b80ab3-003d-498b-881c-3beedbaf1162 filter: description: the KQL query to filter the documents with. type: string @@ -946,6 +1278,10 @@ components: description: The index or index pattern to use type: string example: my-service-* + dataViewId: + description: The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. + type: string + example: 03b80ab3-003d-498b-881c-3beedbaf1162 filter: description: the KQL query to filter the documents with. type: string @@ -1031,10 +1367,16 @@ components: target: description: the target objective between 0 and 1 excluded type: number + minimum: 0 + maximum: 100 + exclusiveMinimum: true + exclusiveMaximum: true example: 0.99 timesliceTarget: description: the target objective for each slice when using a timeslices budgeting method type: number + minimum: 0 + maximum: 100 example: 0.995 timesliceWindow: description: the duration of each slice when using a timeslices budgeting method, as {duraton}{unit} @@ -1045,14 +1387,25 @@ components: description: Defines properties for SLO settings. type: object properties: + syncField: + description: The date field that is used to identify new documents in the source. It is strongly recommended to use a field that contains the ingest timestamp. If you use a different field, you might need to set the delay such that it accounts for data transmission delays. When unspecified, we use the indicator timestamp field. + type: string + example: event.ingested syncDelay: - description: The synch delay to apply to the transform. Default 1m + description: The time delay in minutes between the current time and the latest source data time. Increasing the value will delay any alerting. The default value is 1 minute. The minimum value is 1m and the maximum is 359m. It should always be greater then source index refresh interval. type: string + default: 1m example: 5m frequency: - description: Configure how often the transform runs, default 1m + description: The interval between checks for changes in the source data. The minimum value is 1m and the maximum is 59m. The default value is 1 minute. type: string + default: 1m example: 5m + preventInitialBackfill: + description: Start aggregating data from the time the SLO is created, instead of backfilling data from the beginning of the time window. + type: boolean + default: false + example: true summary_status: title: summary status type: string @@ -1103,7 +1456,20 @@ components: example: 0.9836 errorBudget: $ref: '#/components/schemas/error_budget' - slo_response: + group_by: + title: Group by + description: optional group by field or fields to use to generate an SLO per distinct value + example: + - - service.name + - service.name + - - service.name + - service.environment + oneOf: + - type: string + - type: array + items: + type: string + slo_with_summary_response: title: SLO response type: object required: @@ -1123,6 +1489,7 @@ components: - tags - createdAt - updatedAt + - version properties: id: description: The identifier of the SLO. @@ -1172,13 +1539,7 @@ components: type: boolean example: true groupBy: - description: optional group by field to use to generate an SLO per distinct value - oneOf: - - type: string - - type: array - items: - type: string - example: some.field + $ref: '#/components/schemas/group_by' instanceId: description: the value derived from the groupBy field, if present, otherwise '*' type: string @@ -1196,12 +1557,22 @@ components: description: The last update date type: string example: '2023-01-12T10:03:19.000Z' + version: + description: The internal SLO version + type: number + example: 2 find_slo_response: title: Find SLO response description: | A paginated response of SLOs matching the query. type: object properties: + size: + type: number + example: 25 + description: Size provided for cursor based pagination + searchAfter: + type: string page: type: number example: 1 @@ -1214,7 +1585,7 @@ components: results: type: array items: - $ref: '#/components/schemas/slo_response' + $ref: '#/components/schemas/slo_with_summary_response' 400_response: title: Bad request type: object @@ -1323,13 +1694,7 @@ components: settings: $ref: '#/components/schemas/settings' groupBy: - description: optional group by field to use to generate an SLO per distinct value - oneOf: - - type: string - - type: array - items: - type: string - example: some.field + $ref: '#/components/schemas/group_by' tags: description: List of tags type: array @@ -1390,48 +1755,197 @@ components: settings: $ref: '#/components/schemas/settings' groupBy: - description: optional group by field to use to generate an SLO per distinct value + $ref: '#/components/schemas/group_by' + tags: + description: List of tags + type: array + items: + type: string + slo_definition_response: + title: SLO definition response + type: object + required: + - id + - name + - description + - indicator + - timeWindow + - budgetingMethod + - objective + - settings + - revision + - enabled + - groupBy + - tags + - createdAt + - updatedAt + - version + 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' + sli.metric.timeslice: '#/components/schemas/indicator_properties_timeslice_metric' oneOf: - - type: string - - type: array - items: - type: string - example: some.field + - $ref: '#/components/schemas/indicator_properties_custom_kql' + - $ref: '#/components/schemas/indicator_properties_apm_availability' + - $ref: '#/components/schemas/indicator_properties_apm_latency' + - $ref: '#/components/schemas/indicator_properties_custom_metric' + - $ref: '#/components/schemas/indicator_properties_histogram' + - $ref: '#/components/schemas/indicator_properties_timeslice_metric' + timeWindow: + $ref: '#/components/schemas/time_window' + budgetingMethod: + $ref: '#/components/schemas/budgeting_method' + objective: + $ref: '#/components/schemas/objective' + settings: + $ref: '#/components/schemas/settings' + revision: + description: The SLO revision + type: number + example: 2 + enabled: + description: Indicate if the SLO is enabled + type: boolean + example: true + groupBy: + $ref: '#/components/schemas/group_by' tags: description: List of tags type: array items: type: string - historical_summary_request: - title: Historical summary request + 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' + version: + description: The internal SLO version + type: number + example: 2 + bulk_purge_rollup_request: + title: Bulk Purge Rollup data request + description: | + The bulk purge rollup data request takes a list of SLO ids and a purge policy, then deletes the rollup data according to the purge policy. This API can be used to remove the staled data of an instance SLO that no longer get updated. type: object required: - list + - purgePolicy properties: list: - description: The list of SLO identifiers to get the historical summary for + description: An array of slo ids type: array items: type: string + description: The SLO Definition id example: 8853df00-ae2e-11ed-90af-09bb6422b258 - historical_summary_response: - title: Historical summary response - type: object - additionalProperties: - type: array - items: + purgePolicy: + description: Policy that dictates which SLI documents to purge based on age type: object + oneOf: + - type: object + properties: + purgeType: + type: string + description: Specifies whether documents will be purged based on a specific age or on a timestamp + enum: + - fixed-age + age: + type: string + description: The duration to determine which documents to purge, formatted as {duration}{unit}. This value should be greater than or equal to the time window of every SLO provided. + example: 7d + - type: object + properties: + purgeType: + type: string + description: Specifies whether documents will be purged based on a specific age or on a timestamp + enum: + - fixed-time + timestamp: + type: string + description: The timestamp to determine which documents to purge, formatted in ISO. This value should be older than the applicable time window of every SLO provided. + example: '2024-12-31T00:00:00.000Z' + bulk_purge_rollup_response: + title: Bulk Purge Rollup data response + description: | + The bulk purge rollup data response returns a task id from the elasticsearch deleteByQuery response. + type: object + properties: + taskId: + type: string + description: The task id of the purge operation + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + find_slo_definitions_response: + title: Find SLO definitions response + description: | + A paginated response of SLO definitions matching the query. + type: object + oneOf: + - type: object properties: - date: - type: string - example: '2022-01-01T00:00:00.000Z' - status: - $ref: '#/components/schemas/summary_status' - sliValue: + page: + type: number + example: 1 + perPage: + type: number + example: 25 + total: + type: number + example: 34 + results: + type: array + items: + $ref: '#/components/schemas/slo_with_summary_response' + - type: object + properties: + page: + type: number + default: 1 + description: for backward compability + perPage: type: number - example: 0.9836 - errorBudget: - $ref: '#/components/schemas/error_budget' + example: 25 + description: for backward compability + size: + type: number + example: 25 + searchAfter: + type: array + items: + type: string + example: + - some-slo-id + - other-cursor-id + description: the cursor to provide to get the next paged results + total: + type: number + example: 34 + results: + type: array + items: + $ref: '#/components/schemas/slo_with_summary_response' delete_slo_instances_request: title: Delete SLO instances request description: | @@ -1457,3 +1971,59 @@ components: description: The SLO instance identifier type: string example: 8853df00-ae2e-11ed-90af-09bb6422b258 + bulk_delete_request: + title: Bulk delete SLO request + description: | + The bulk delete SLO request takes a list of SLOs Definition id to delete. + type: object + required: + - list + properties: + list: + description: An array of SLO Definition id + type: array + items: + type: string + example: 8853df00-ae2e-11ed-90af-09bb6422b258 + description: The SLO Definition id + bulk_delete_response: + title: Bulk delete SLO response + description: | + The bulk delete SLO response returns a taskId that can be used to poll for its status + type: object + properties: + taskId: + type: string + example: d08506b7-f0e8-4f8b-a06a-a83940f4db91 + description: The taskId of the bulk delete operation + bulk_delete_status_response: + title: The status of the bulk deletion + description: Indicates if the bulk deletion is completed, with the detailed results of the operation. + type: object + properties: + isDone: + type: boolean + example: true + description: Indicates if the bulk deletion operation is completed + error: + type: string + example: Task not found + description: The error message if the bulk deletion operation failed + results: + description: The results of the bulk deletion operation, including the success status and any errors for each SLO + type: array + items: + type: object + properties: + id: + type: string + example: d08506b7-f0e8-4f8b-a06a-a83940f4db91 + description: The ID of the SLO that was deleted + success: + type: boolean + example: true + description: The result of the deletion operation for this SLO + error: + type: string + example: SLO [d08506b7-f0e8-4f8b-a06a-a83940f4db91] not found + description: The error message if the deletion operation failed for this SLO diff --git a/generated/slo-spec2.yml b/generated/slo-spec2.yml deleted file mode 100644 index bbc2bb684..000000000 --- a/generated/slo-spec2.yml +++ /dev/null @@ -1,2029 +0,0 @@ -openapi: 3.0.1 -info: - title: SLOs - description: OpenAPI schema for SLOs endpoints - version: '1.1' - contact: - name: Actionable Observability Team - license: - name: Elastic License 2.0 - url: https://www.elastic.co/licensing/elastic-license -servers: - - url: https://{kibana_url} - variables: - kibana_url: - default: localhost:5601 -tags: - - name: slo - description: SLO APIs enable you to define, manage and track service-level objectives -paths: - /s/{spaceId}/api/observability/slos: - post: - summary: Create 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' - get: - summary: Get 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: size - in: query - description: The page size to use for cursor-based pagination, must be greater or equal than 1 - schema: - type: integer - default: 1 - example: 1 - - name: searchAfter - in: query - description: The cursor to use for fetching the results from, when using a cursor-base pagination. - schema: - type: array - items: - type: string - - name: page - in: query - description: The page to use for pagination, must be greater or equal than 1 - schema: - type: integer - default: 1 - example: 1 - - name: perPage - in: query - description: Number of SLOs returned by page - schema: - type: integer - default: 25 - maximum: 5000 - 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 - - name: hideStale - in: query - description: Hide stale SLOs from the list as defined by stale SLO threshold in SLO settings - schema: - type: boolean - 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: Get an 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_with_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' - '404': - description: Not found response - content: - application/json: - schema: - $ref: '#/components/schemas/404_response' - put: - summary: Update 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_definition_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: Delete 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: Enable 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: Disable 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: - '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}/_reset: - post: - summary: Reset an SLO - operationId: resetSloOp - 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 - content: - application/json: - schema: - $ref: '#/components/schemas/slo_definition_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/_bulk_purge_rollup: - post: - summary: Batch delete rollup and summary data - operationId: deleteRollupDataOp - description: | - The deletion occurs for the specified list of `sloId`. 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/bulk_purge_rollup_request' - responses: - '200': - description: Successful request - content: - application/json: - schema: - $ref: '#/components/schemas/bulk_purge_rollup_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' - /s/{spaceId}/internal/observability/slos/_definitions: - get: - summary: Get the SLO definitions - operationId: getDefinitionsOp - 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: includeOutdatedOnly - in: query - description: Indicates if the API returns only outdated SLO or all SLO definitions - schema: - type: boolean - example: true - - name: tags - in: query - description: Filters the SLOs by tag - schema: - type: string - - name: search - in: query - description: Filters the SLOs by name - schema: - type: string - example: my service availability - - name: page - in: query - description: The page to use for pagination, must be greater or equal than 1 - schema: - type: number - example: 1 - - name: perPage - in: query - description: Number of SLOs returned by page - schema: - type: integer - default: 100 - maximum: 1000 - example: 100 - responses: - '200': - description: Successful request - content: - application/json: - schema: - $ref: '#/components/schemas/find_slo_definitions_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' - /s/{spaceId}/api/observability/slos/_delete_instances: - post: - summary: Batch delete rollup and summary data - operationId: deleteSloInstancesOp - description: | - The deletion occurs for the specified list of `sloId` and `instanceId`. You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. - tags: - - slo - parameters: - - $ref: '#/components/parameters/kbn_xsrf' - - $ref: '#/components/parameters/space_id' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/delete_slo_instances_request' - responses: - '204': - description: Successful request - '400': - description: Bad request - content: - application/json: - schema: - $ref: '#/components/schemas/400_response' - '401': - description: Unauthorized response - content: - application/json: - schema: - $ref: '#/components/schemas/401_response' - '403': - description: Unauthorized response - content: - application/json: - schema: - $ref: '#/components/schemas/403_response' - /s/{spaceId}/api/observability/slos/_bulk_delete: - post: - summary: Bulk delete SLO definitions and their associated summary and rollup data. - operationId: bulkDeleteOp - description: | - Bulk delete SLO definitions and their associated summary and rollup data. This endpoint initiates a bulk deletion operation for SLOs, which may take some time to complete. The status of the operation can be checked using the `GET /api/slo/_bulk_delete/{taskId}` endpoint. - tags: - - slo - parameters: - - $ref: '#/components/parameters/kbn_xsrf' - - $ref: '#/components/parameters/space_id' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/bulk_delete_request' - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/bulk_delete_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' - /s/{spaceId}/api/observability/slos/_bulk_delete/{taskId}: - get: - summary: Retrieve the status of the bulk deletion - operationId: bulkDeleteStatusOp - description: | - Retrieve the status of the bulk deletion operation for SLOs. This endpoint returns the status of the bulk deletion operation, including whether it is completed and the results of the operation. - tags: - - slo - parameters: - - $ref: '#/components/parameters/kbn_xsrf' - - $ref: '#/components/parameters/space_id' - - name: taskId - in: path - description: The task id of the bulk delete operation - required: true - schema: - type: string - example: 8853df00-ae2e-11ed-90af-09bb6422b258 - responses: - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/bulk_delete_status_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: - 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 - filter_meta: - title: FilterMeta - description: Defines properties for a filter - type: object - properties: - alias: - type: string - nullable: true - disabled: - type: boolean - negate: - type: boolean - controlledBy: - type: string - group: - type: string - index: - type: string - isMultiIndex: - type: boolean - type: - type: string - key: - type: string - params: - type: object - value: - type: string - field: - type: string - filter: - title: Filter - description: Defines properties for a filter - type: object - properties: - query: - type: object - meta: - $ref: '#/components/schemas/filter_meta' - kql_with_filters: - title: KQL with filters - description: Defines properties for a filter - oneOf: - - description: the KQL query to filter the documents with. - type: string - example: 'field.environment : "production" and service.name : "my-service"' - - type: object - properties: - kqlQuery: - type: string - filters: - type: array - items: - $ref: '#/components/schemas/filter' - kql_with_filters_good: - title: KQL query for good events - description: The KQL query used to define the good events. - oneOf: - - description: the KQL query to filter the documents with. - type: string - example: 'request.latency <= 150 and request.status_code : "2xx"' - - type: object - properties: - kqlQuery: - type: string - filters: - type: array - items: - $ref: '#/components/schemas/filter' - kql_with_filters_total: - title: KQL query for all events - description: The KQL query used to define all events. - oneOf: - - description: the KQL query to filter the documents with. - type: string - example: 'field.environment : "production" and service.name : "my-service"' - - type: object - properties: - kqlQuery: - type: string - filters: - type: array - items: - $ref: '#/components/schemas/filter' - indicator_properties_custom_kql: - title: Custom Query - required: - - type - - params - description: Defines properties for a custom query 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-* - dataViewId: - description: The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. - type: string - example: 03b80ab3-003d-498b-881c-3beedbaf1162 - filter: - $ref: '#/components/schemas/kql_with_filters' - good: - $ref: '#/components/schemas/kql_with_filters_good' - total: - $ref: '#/components/schemas/kql_with_filters_total' - 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 - properties: - index: - description: The index or index pattern to use - type: string - example: my-service-* - dataViewId: - description: The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. - type: string - example: 03b80ab3-003d-498b-881c-3beedbaf1162 - 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: - oneOf: - - 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. - 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: *' - - type: object - required: - - name - - aggregation - properties: - name: - description: The name of the metric. Only valid options are A-Z - type: string - example: A - pattern: ^[A-Z]$ - aggregation: - description: The aggregation type of the metric. - type: string - example: doc_count - enum: - - doc_count - filter: - description: The filter to apply to the metric. - type: string - example: 'processor.outcome: *' - 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: - oneOf: - - 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. - 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: *' - - type: object - required: - - name - - aggregation - properties: - name: - description: The name of the metric. Only valid options are A-Z - type: string - example: A - pattern: ^[A-Z]$ - aggregation: - description: The aggregation type of the metric. - type: string - example: doc_count - enum: - - doc_count - 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-* - dataViewId: - description: The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. - type: string - example: 03b80ab3-003d-498b-881c-3beedbaf1162 - 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 - timeslice_metric_basic_metric_with_field: - title: Timeslice Metric Basic Metric with Field - required: - - name - - aggregation - - field - type: object - properties: - name: - description: The name of the metric. Only valid options are A-Z - type: string - example: A - pattern: ^[A-Z]$ - aggregation: - description: The aggregation type of the metric. - type: string - example: sum - enum: - - sum - - avg - - min - - max - - std_deviation - - last_value - - cardinality - field: - description: The field of the metric. - type: string - example: processor.processed - filter: - description: The filter to apply to the metric. - type: string - example: 'processor.outcome: "success"' - timeslice_metric_percentile_metric: - title: Timeslice Metric Percentile Metric - required: - - name - - aggregation - - field - - percentile - type: object - properties: - name: - description: The name of the metric. Only valid options are A-Z - type: string - example: A - pattern: ^[A-Z]$ - aggregation: - description: The aggregation type of the metric. Only valid option is "percentile" - type: string - example: percentile - enum: - - percentile - field: - description: The field of the metric. - type: string - example: processor.processed - percentile: - description: The percentile value. - type: number - example: 95 - filter: - description: The filter to apply to the metric. - type: string - example: 'processor.outcome: "success"' - timeslice_metric_doc_count_metric: - title: Timeslice Metric Doc Count Metric - required: - - name - - aggregation - type: object - properties: - name: - description: The name of the metric. Only valid options are A-Z - type: string - example: A - pattern: ^[A-Z]$ - aggregation: - description: The aggregation type of the metric. Only valid option is "doc_count" - type: string - example: doc_count - enum: - - doc_count - filter: - description: The filter to apply to the metric. - type: string - example: 'processor.outcome: "success"' - indicator_properties_timeslice_metric: - title: Timeslice metric - required: - - type - - params - description: Defines properties for a timeslice metric indicator type - type: object - properties: - params: - description: An object containing the indicator parameters. - type: object - nullable: false - required: - - index - - timestampField - - metric - properties: - index: - description: The index or index pattern to use - type: string - example: my-service-* - dataViewId: - description: The kibana data view id to use, primarily used to include data view runtime mappings. Make sure to save SLO again if you add/update run time fields to the data view and if those fields are being used in slo queries. - type: string - example: 03b80ab3-003d-498b-881c-3beedbaf1162 - filter: - description: the KQL query to filter the documents with. - type: string - example: 'field.environment : "production" and service.name : "my-service"' - timestampField: - description: | - The timestamp field used in the source indice. - type: string - example: timestamp - metric: - description: | - An object defining the metrics, equation, and threshold to determine if it's a good slice or not - type: object - required: - - metrics - - equation - - comparator - - threshold - properties: - metrics: - description: List of metrics with their name, aggregation type, and field. - type: array - items: - anyOf: - - $ref: '#/components/schemas/timeslice_metric_basic_metric_with_field' - - $ref: '#/components/schemas/timeslice_metric_percentile_metric' - - $ref: '#/components/schemas/timeslice_metric_doc_count_metric' - equation: - description: The equation to calculate the metric. - type: string - example: A - comparator: - description: The comparator to use to compare the equation to the threshold. - type: string - example: GT - enum: - - GT - - GTE - - LT - - LTE - threshold: - description: The threshold used to determine if the metric is a good slice or not. - type: number - example: 100 - type: - description: The type of indicator. - type: string - example: sli.metric.timeslice - time_window: - title: Time window - required: - - 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 - minimum: 0 - maximum: 100 - exclusiveMinimum: true - exclusiveMaximum: true - example: 0.99 - timesliceTarget: - description: the target objective for each slice when using a timeslices budgeting method - type: number - minimum: 0 - maximum: 100 - 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: - syncField: - description: The date field that is used to identify new documents in the source. It is strongly recommended to use a field that contains the ingest timestamp. If you use a different field, you might need to set the delay such that it accounts for data transmission delays. When unspecified, we use the indicator timestamp field. - type: string - example: event.ingested - syncDelay: - description: The time delay in minutes between the current time and the latest source data time. Increasing the value will delay any alerting. The default value is 1 minute. The minimum value is 1m and the maximum is 359m. It should always be greater then source index refresh interval. - type: string - default: 1m - example: 5m - frequency: - description: The interval between checks for changes in the source data. The minimum value is 1m and the maximum is 59m. The default value is 1 minute. - type: string - default: 1m - example: 5m - preventInitialBackfill: - description: Start aggregating data from the time the SLO is created, instead of backfilling data from the beginning of the time window. - type: boolean - default: false - example: true - 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' - group_by: - title: Group by - description: optional group by field or fields to use to generate an SLO per distinct value - example: - - - service.name - - service.name - - - service.name - - service.environment - oneOf: - - type: string - - type: array - items: - type: string - slo_with_summary_response: - title: SLO response - type: object - required: - - id - - name - - description - - indicator - - timeWindow - - budgetingMethod - - objective - - settings - - revision - - summary - - enabled - - groupBy - - instanceId - - tags - - createdAt - - updatedAt - - version - 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' - sli.metric.timeslice: '#/components/schemas/indicator_properties_timeslice_metric' - oneOf: - - $ref: '#/components/schemas/indicator_properties_custom_kql' - - $ref: '#/components/schemas/indicator_properties_apm_availability' - - $ref: '#/components/schemas/indicator_properties_apm_latency' - - $ref: '#/components/schemas/indicator_properties_custom_metric' - - $ref: '#/components/schemas/indicator_properties_histogram' - - $ref: '#/components/schemas/indicator_properties_timeslice_metric' - timeWindow: - $ref: '#/components/schemas/time_window' - budgetingMethod: - $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: - $ref: '#/components/schemas/group_by' - instanceId: - description: the value derived from the groupBy field, if present, otherwise '*' - type: string - example: host-abcde - tags: - description: List of tags - type: array - items: - type: string - createdAt: - description: The creation date - type: string - example: '2023-01-12T10:03:19.000Z' - updatedAt: - description: The last update date - type: string - example: '2023-01-12T10:03:19.000Z' - version: - description: The internal SLO version - type: number - example: 2 - find_slo_response: - title: Find SLO response - description: | - A paginated response of SLOs matching the query. - type: object - properties: - size: - type: number - example: 25 - description: Size provided for cursor based pagination - searchAfter: - type: string - page: - type: number - example: 1 - perPage: - type: number - example: 25 - total: - type: number - example: 34 - results: - type: array - items: - $ref: '#/components/schemas/slo_with_summary_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' - - $ref: '#/components/schemas/indicator_properties_timeslice_metric' - timeWindow: - $ref: '#/components/schemas/time_window' - budgetingMethod: - $ref: '#/components/schemas/budgeting_method' - objective: - $ref: '#/components/schemas/objective' - settings: - $ref: '#/components/schemas/settings' - groupBy: - $ref: '#/components/schemas/group_by' - tags: - description: List of tags - type: array - items: - type: string - 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' - - $ref: '#/components/schemas/indicator_properties_timeslice_metric' - timeWindow: - $ref: '#/components/schemas/time_window' - budgetingMethod: - $ref: '#/components/schemas/budgeting_method' - objective: - $ref: '#/components/schemas/objective' - settings: - $ref: '#/components/schemas/settings' - groupBy: - $ref: '#/components/schemas/group_by' - tags: - description: List of tags - type: array - items: - type: string - slo_definition_response: - title: SLO definition response - type: object - required: - - id - - name - - description - - indicator - - timeWindow - - budgetingMethod - - objective - - settings - - revision - - enabled - - groupBy - - tags - - createdAt - - updatedAt - - version - 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' - sli.metric.timeslice: '#/components/schemas/indicator_properties_timeslice_metric' - oneOf: - - $ref: '#/components/schemas/indicator_properties_custom_kql' - - $ref: '#/components/schemas/indicator_properties_apm_availability' - - $ref: '#/components/schemas/indicator_properties_apm_latency' - - $ref: '#/components/schemas/indicator_properties_custom_metric' - - $ref: '#/components/schemas/indicator_properties_histogram' - - $ref: '#/components/schemas/indicator_properties_timeslice_metric' - timeWindow: - $ref: '#/components/schemas/time_window' - budgetingMethod: - $ref: '#/components/schemas/budgeting_method' - objective: - $ref: '#/components/schemas/objective' - settings: - $ref: '#/components/schemas/settings' - revision: - description: The SLO revision - type: number - example: 2 - enabled: - description: Indicate if the SLO is enabled - type: boolean - example: true - groupBy: - $ref: '#/components/schemas/group_by' - tags: - description: List of tags - type: array - items: - type: string - 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' - version: - description: The internal SLO version - type: number - example: 2 - bulk_purge_rollup_request: - title: Bulk Purge Rollup data request - description: | - The bulk purge rollup data request takes a list of SLO ids and a purge policy, then deletes the rollup data according to the purge policy. This API can be used to remove the staled data of an instance SLO that no longer get updated. - type: object - required: - - list - - purgePolicy - properties: - list: - description: An array of slo ids - type: array - items: - type: string - description: The SLO Definition id - example: 8853df00-ae2e-11ed-90af-09bb6422b258 - purgePolicy: - description: Policy that dictates which SLI documents to purge based on age - type: object - oneOf: - - type: object - properties: - purgeType: - type: string - description: Specifies whether documents will be purged based on a specific age or on a timestamp - enum: - - fixed-age - age: - type: string - description: The duration to determine which documents to purge, formatted as {duration}{unit}. This value should be greater than or equal to the time window of every SLO provided. - example: 7d - - type: object - properties: - purgeType: - type: string - description: Specifies whether documents will be purged based on a specific age or on a timestamp - enum: - - fixed-time - timestamp: - type: string - description: The timestamp to determine which documents to purge, formatted in ISO. This value should be older than the applicable time window of every SLO provided. - example: '2024-12-31T00:00:00.000Z' - bulk_purge_rollup_response: - title: Bulk Purge Rollup data response - description: | - The bulk purge rollup data response returns a task id from the elasticsearch deleteByQuery response. - type: object - properties: - taskId: - type: string - description: The task id of the purge operation - example: 8853df00-ae2e-11ed-90af-09bb6422b258 - find_slo_definitions_response: - title: Find SLO definitions response - description: | - A paginated response of SLO definitions matching the query. - type: object - oneOf: - - 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_with_summary_response' - - type: object - properties: - page: - type: number - default: 1 - description: for backward compability - perPage: - type: number - example: 25 - description: for backward compability - size: - type: number - example: 25 - searchAfter: - type: array - items: - type: string - example: - - some-slo-id - - other-cursor-id - description: the cursor to provide to get the next paged results - total: - type: number - example: 34 - results: - type: array - items: - $ref: '#/components/schemas/slo_with_summary_response' - delete_slo_instances_request: - title: Delete SLO instances request - description: | - The delete SLO instances request takes a list of SLO id and instance id, then delete the rollup and summary data. This API can be used to remove the staled data of an instance SLO that no longer get updated. - type: object - required: - - list - properties: - list: - description: An array of slo id and instance id - type: array - items: - type: object - required: - - sloId - - instanceId - properties: - sloId: - description: The SLO unique identifier - type: string - example: 8853df00-ae2e-11ed-90af-09bb6422b258 - instanceId: - description: The SLO instance identifier - type: string - example: 8853df00-ae2e-11ed-90af-09bb6422b258 - bulk_delete_request: - title: Bulk delete SLO request - description: | - The bulk delete SLO request takes a list of SLOs Definition id to delete. - type: object - required: - - list - properties: - list: - description: An array of SLO Definition id - type: array - items: - type: string - example: 8853df00-ae2e-11ed-90af-09bb6422b258 - description: The SLO Definition id - bulk_delete_response: - title: Bulk delete SLO response - description: | - The bulk delete SLO response returns a taskId that can be used to poll for its status - type: object - properties: - taskId: - type: string - example: d08506b7-f0e8-4f8b-a06a-a83940f4db91 - description: The taskId of the bulk delete operation - bulk_delete_status_response: - title: The status of the bulk deletion - description: Indicates if the bulk deletion is completed, with the detailed results of the operation. - type: object - properties: - isDone: - type: boolean - example: true - description: Indicates if the bulk deletion operation is completed - error: - type: string - example: Task not found - description: The error message if the bulk deletion operation failed - results: - description: The results of the bulk deletion operation, including the success status and any errors for each SLO - type: array - items: - type: object - properties: - id: - type: string - example: d08506b7-f0e8-4f8b-a06a-a83940f4db91 - description: The ID of the SLO that was deleted - success: - type: boolean - example: true - description: The result of the deletion operation for this SLO - error: - type: string - example: SLO [d08506b7-f0e8-4f8b-a06a-a83940f4db91] not found - description: The error message if the deletion operation failed for this SLO diff --git a/generated/slo/.openapi-generator/FILES b/generated/slo/.openapi-generator/FILES index e0dd3cfb5..f5fea0d26 100644 --- a/generated/slo/.openapi-generator/FILES +++ b/generated/slo/.openapi-generator/FILES @@ -1,4 +1,5 @@ .gitignore +.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -140,4 +141,5 @@ model_timeslice_metric_doc_count_metric.go model_timeslice_metric_percentile_metric.go model_update_slo_request.go response.go +test/api_slo_test.go utils.go diff --git a/generated/slo/.openapi-generator/VERSION b/generated/slo/.openapi-generator/VERSION index eb1dc6a51..73a86b197 100644 --- a/generated/slo/.openapi-generator/VERSION +++ b/generated/slo/.openapi-generator/VERSION @@ -1 +1 @@ -7.13.0 +7.0.1 \ No newline at end of file diff --git a/generated/slo/README.md b/generated/slo/README.md index 84fe4b160..39ff76713 100644 --- a/generated/slo/README.md +++ b/generated/slo/README.md @@ -7,27 +7,26 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat - API version: 1.1 - Package version: 1.0.0 -- Generator version: 7.13.0 - Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation Install the following dependencies: -```sh +```shell go get github.com/stretchr/testify/assert go get golang.org/x/net/context ``` Put the package under your project folder and add the following in import: -```go -import slo "github.com/GIT_USER_ID/GIT_REPO_ID" +```golang +import slo "github.com/elastic/terraform-provider-elasticstack/slo" ``` To use a proxy, set the environment variable `HTTP_PROXY`: -```go +```golang os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") ``` @@ -37,17 +36,17 @@ Default configuration comes with `Servers` field that contains server objects as ### Select Server Configuration -For using other server than the one defined on index 0 set context value `slo.ContextServerIndex` of type `int`. +For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. -```go +```golang ctx := context.WithValue(context.Background(), slo.ContextServerIndex, 1) ``` ### Templated Server URL -Templated server URL is formatted using default variables from configuration or from context value `slo.ContextServerVariables` of type `map[string]string`. +Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. -```go +```golang ctx := context.WithValue(context.Background(), slo.ContextServerVariables, map[string]string{ "basePath": "v2", }) @@ -59,9 +58,9 @@ Note, enum values are always validated and all unused variables are silently ign Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. An operation is uniquely identified by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `slo.ContextOperationServerIndices` and `slo.ContextOperationServerVariables` context maps. +Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. -```go +```golang ctx := context.WithValue(context.Background(), slo.ContextOperationServerIndices, map[string]int{ "{classname}Service.{nickname}": 2, }) diff --git a/generated/slo/api/openapi.yaml b/generated/slo/api/openapi.yaml index ac643f3f3..e91fef9ff 100644 --- a/generated/slo/api/openapi.yaml +++ b/generated/slo/api/openapi.yaml @@ -1074,15 +1074,6 @@ components: title: KQL query for all events indicator_properties_custom_kql: description: Defines properties for a custom query indicator type - example: - params: - filter: "field.environment : \"production\" and service.name : \"my-service\"" - dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 - total: "field.environment : \"production\" and service.name : \"my-service\"" - index: my-service-* - timestampField: timestamp - good: "request.latency <= 150 and request.status_code : \"2xx\"" - type: sli.kql.custom properties: params: $ref: '#/components/schemas/indicator_properties_custom_kql_params' @@ -1423,15 +1414,7 @@ components: title: Group by slo_with_summary_response: example: - indicator: - params: - filter: "field.environment : \"production\" and service.name : \"my-service\"" - dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 - total: "field.environment : \"production\" and service.name : \"my-service\"" - index: my-service-* - timestampField: timestamp - good: "request.latency <= 150 and request.status_code : \"2xx\"" - type: sli.kql.custom + indicator: null summary: errorBudget: consumed: 0.8 @@ -1557,15 +1540,7 @@ components: searchAfter: searchAfter page: 1 results: - - indicator: - params: - filter: "field.environment : \"production\" and service.name : \"my-service\"" - dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 - total: "field.environment : \"production\" and service.name : \"my-service\"" - index: my-service-* - timestampField: timestamp - good: "request.latency <= 150 and request.status_code : \"2xx\"" - type: sli.kql.custom + - indicator: null summary: errorBudget: consumed: 0.8 @@ -1604,15 +1579,7 @@ components: id: 8853df00-ae2e-11ed-90af-09bb6422b258 budgetingMethod: occurrences updatedAt: 2023-01-12T10:03:19.000Z - - indicator: - params: - filter: "field.environment : \"production\" and service.name : \"my-service\"" - dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 - total: "field.environment : \"production\" and service.name : \"my-service\"" - index: my-service-* - timestampField: timestamp - good: "request.latency <= 150 and request.status_code : \"2xx\"" - type: sli.kql.custom + - indicator: null summary: errorBudget: consumed: 0.8 @@ -1674,10 +1641,6 @@ components: title: Find SLO response type: object "400_response": - example: - error: Bad Request - message: "Invalid value 'foo' supplied to: [...]" - statusCode: 400 properties: statusCode: example: 400 @@ -1695,12 +1658,6 @@ components: title: Bad request type: object "401_response": - example: - error: Unauthorized - message: "[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]" - statusCode: 401 properties: statusCode: example: 401 @@ -1720,12 +1677,6 @@ components: title: Unauthorized type: object "403_response": - example: - error: Unauthorized - message: "[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]" - statusCode: 403 properties: statusCode: example: 403 @@ -1745,10 +1696,6 @@ components: title: Unauthorized type: object "404_response": - example: - error: Not Found - message: "SLO [3749f390-03a3-11ee-8139-c7ff60a1692d] not found" - statusCode: 404 properties: statusCode: example: 404 @@ -1818,10 +1765,6 @@ components: title: Create SLO response type: object "409_response": - example: - error: Conflict - message: "SLO [d077e940-1515-11ee-9c50-9d096392f520] already exists" - statusCode: 409 properties: statusCode: example: 409 @@ -1869,15 +1812,7 @@ components: type: object slo_definition_response: example: - indicator: - params: - filter: "field.environment : \"production\" and service.name : \"my-service\"" - dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 - total: "field.environment : \"production\" and service.name : \"my-service\"" - index: my-service-* - timestampField: timestamp - good: "request.latency <= 150 and request.status_code : \"2xx\"" - type: sli.kql.custom + indicator: null settings: syncField: event.ingested preventInitialBackfill: true @@ -2129,13 +2064,6 @@ components: type: object indicator_properties_custom_kql_params: description: An object containing the indicator parameters. - example: - filter: "field.environment : \"production\" and service.name : \"my-service\"" - dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 - total: "field.environment : \"production\" and service.name : \"my-service\"" - index: my-service-* - timestampField: timestamp - good: "request.latency <= 150 and request.status_code : \"2xx\"" nullable: false properties: index: @@ -2554,105 +2482,6 @@ components: - $ref: '#/components/schemas/bulk_purge_rollup_request_purgePolicy_oneOf_1' type: object find_slo_definitions_response_oneOf: - example: - total: 34 - perPage: 25 - page: 1 - results: - - indicator: - params: - filter: "field.environment : \"production\" and service.name : \"my-service\"" - dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 - total: "field.environment : \"production\" and service.name : \"my-service\"" - index: my-service-* - timestampField: timestamp - good: "request.latency <= 150 and request.status_code : \"2xx\"" - type: sli.kql.custom - summary: - errorBudget: - consumed: 0.8 - isEstimated: true - initial: 0.02 - remaining: 0.2 - status: HEALTHY - sliValue: 0.9836 - settings: - syncField: event.ingested - preventInitialBackfill: true - syncDelay: 5m - frequency: 5m - timeWindow: - duration: 30d - type: rolling - description: My SLO description - groupBy: - - - service.name - - service.name - - - service.name - - service.environment - version: 2 - enabled: true - objective: - timesliceWindow: 5m - timesliceTarget: 0.995 - target: 0.99 - revision: 2 - tags: - - tags - - tags - createdAt: 2023-01-12T10:03:19.000Z - instanceId: host-abcde - name: My Service SLO - id: 8853df00-ae2e-11ed-90af-09bb6422b258 - budgetingMethod: occurrences - updatedAt: 2023-01-12T10:03:19.000Z - - indicator: - params: - filter: "field.environment : \"production\" and service.name : \"my-service\"" - dataViewId: 03b80ab3-003d-498b-881c-3beedbaf1162 - total: "field.environment : \"production\" and service.name : \"my-service\"" - index: my-service-* - timestampField: timestamp - good: "request.latency <= 150 and request.status_code : \"2xx\"" - type: sli.kql.custom - summary: - errorBudget: - consumed: 0.8 - isEstimated: true - initial: 0.02 - remaining: 0.2 - status: HEALTHY - sliValue: 0.9836 - settings: - syncField: event.ingested - preventInitialBackfill: true - syncDelay: 5m - frequency: 5m - timeWindow: - duration: 30d - type: rolling - description: My SLO description - groupBy: - - - service.name - - service.name - - - service.name - - service.environment - version: 2 - enabled: true - objective: - timesliceWindow: 5m - timesliceTarget: 0.995 - target: 0.99 - revision: 2 - tags: - - tags - - tags - createdAt: 2023-01-12T10:03:19.000Z - instanceId: host-abcde - name: My Service SLO - id: 8853df00-ae2e-11ed-90af-09bb6422b258 - budgetingMethod: occurrences - updatedAt: 2023-01-12T10:03:19.000Z properties: page: example: 1 diff --git a/generated/slo/api_slo.go b/generated/slo/api_slo.go index 7bda4a35d..8c1b0e7b2 100644 --- a/generated/slo/api_slo.go +++ b/generated/slo/api_slo.go @@ -16,19 +16,232 @@ import ( "io" "net/http" "net/url" - "strings" "reflect" + "strings" ) +type SloAPI interface { + + /* + BulkDeleteOp Bulk delete SLO definitions and their associated summary and rollup data. + + Bulk delete SLO definitions and their associated summary and rollup data. This endpoint initiates a bulk deletion operation for SLOs, which may take some time to complete. The status of the operation can be checked using the `GET /api/slo/_bulk_delete/{taskId}` endpoint. + + + @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 ApiBulkDeleteOpRequest + */ + BulkDeleteOp(ctx context.Context, spaceId string) ApiBulkDeleteOpRequest + + // BulkDeleteOpExecute executes the request + // @return BulkDeleteResponse + BulkDeleteOpExecute(r ApiBulkDeleteOpRequest) (*BulkDeleteResponse, *http.Response, error) + + /* + BulkDeleteStatusOp Retrieve the status of the bulk deletion + + Retrieve the status of the bulk deletion operation for SLOs. This endpoint returns the status of the bulk deletion operation, including whether it is completed and the results of the operation. + + + @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 taskId The task id of the bulk delete operation + @return ApiBulkDeleteStatusOpRequest + */ + BulkDeleteStatusOp(ctx context.Context, spaceId string, taskId string) ApiBulkDeleteStatusOpRequest + + // BulkDeleteStatusOpExecute executes the request + // @return BulkDeleteStatusResponse + BulkDeleteStatusOpExecute(r ApiBulkDeleteStatusOpRequest) (*BulkDeleteStatusResponse, *http.Response, error) + + /* + CreateSloOp Create 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 ApiCreateSloOpRequest + */ + CreateSloOp(ctx context.Context, spaceId string) ApiCreateSloOpRequest + + // CreateSloOpExecute executes the request + // @return CreateSloResponse + CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloResponse, *http.Response, error) + + /* + DeleteRollupDataOp Batch delete rollup and summary data + + The deletion occurs for the specified list of `sloId`. 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 ApiDeleteRollupDataOpRequest + */ + DeleteRollupDataOp(ctx context.Context, spaceId string) ApiDeleteRollupDataOpRequest + + // DeleteRollupDataOpExecute executes the request + // @return BulkPurgeRollupResponse + DeleteRollupDataOpExecute(r ApiDeleteRollupDataOpRequest) (*BulkPurgeRollupResponse, *http.Response, error) + + /* + DeleteSloInstancesOp Batch delete rollup and summary data + + The deletion occurs for the specified list of `sloId` and `instanceId`. You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + @return ApiDeleteSloInstancesOpRequest + */ + DeleteSloInstancesOp(ctx context.Context, spaceId string) ApiDeleteSloInstancesOpRequest + + // DeleteSloInstancesOpExecute executes the request + DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpRequest) (*http.Response, error) + + /* + DeleteSloOp Delete 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 ApiDeleteSloOpRequest + */ + DeleteSloOp(ctx context.Context, spaceId string, sloId string) ApiDeleteSloOpRequest + + // DeleteSloOpExecute executes the request + DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Response, error) + + /* + DisableSloOp Disable 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 ApiDisableSloOpRequest + */ + DisableSloOp(ctx context.Context, spaceId string, sloId string) ApiDisableSloOpRequest + + // DisableSloOpExecute executes the request + DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Response, error) + + /* + EnableSloOp Enable 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 ApiEnableSloOpRequest + */ + EnableSloOp(ctx context.Context, spaceId string, sloId string) ApiEnableSloOpRequest + + // EnableSloOpExecute executes the request + EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Response, error) + + /* + FindSlosOp Get 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 ApiFindSlosOpRequest + */ + FindSlosOp(ctx context.Context, spaceId string) ApiFindSlosOpRequest + + // FindSlosOpExecute executes the request + // @return FindSloResponse + FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloResponse, *http.Response, error) + + /* + GetDefinitionsOp Get the SLO definitions + + 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 ApiGetDefinitionsOpRequest + */ + GetDefinitionsOp(ctx context.Context, spaceId string) ApiGetDefinitionsOpRequest + + // GetDefinitionsOpExecute executes the request + // @return FindSloDefinitionsResponse + GetDefinitionsOpExecute(r ApiGetDefinitionsOpRequest) (*FindSloDefinitionsResponse, *http.Response, error) + + /* + GetSloOp Get an 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 ApiGetSloOpRequest + */ + GetSloOp(ctx context.Context, spaceId string, sloId string) ApiGetSloOpRequest + + // GetSloOpExecute executes the request + // @return SloWithSummaryResponse + GetSloOpExecute(r ApiGetSloOpRequest) (*SloWithSummaryResponse, *http.Response, error) + + /* + ResetSloOp Reset 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 ApiResetSloOpRequest + */ + ResetSloOp(ctx context.Context, spaceId string, sloId string) ApiResetSloOpRequest + + // ResetSloOpExecute executes the request + // @return SloDefinitionResponse + ResetSloOpExecute(r ApiResetSloOpRequest) (*SloDefinitionResponse, *http.Response, error) + + /* + UpdateSloOp Update 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 ApiUpdateSloOpRequest + */ + UpdateSloOp(ctx context.Context, spaceId string, sloId string) ApiUpdateSloOpRequest + + // UpdateSloOpExecute executes the request + // @return SloDefinitionResponse + UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloDefinitionResponse, *http.Response, error) +} // SloAPIService SloAPI service type SloAPIService service type ApiBulkDeleteOpRequest struct { - ctx context.Context - ApiService *SloAPIService - kbnXsrf *string - spaceId string + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string bulkDeleteRequest *BulkDeleteRequest } @@ -52,27 +265,27 @@ BulkDeleteOp Bulk delete SLO definitions and their associated summary and rollup Bulk delete SLO definitions and their associated summary and rollup data. This endpoint initiates a bulk deletion operation for SLOs, which may take some time to complete. The status of the operation can be checked using the `GET /api/slo/_bulk_delete/{taskId}` endpoint. - - @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 ApiBulkDeleteOpRequest + @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 ApiBulkDeleteOpRequest */ func (a *SloAPIService) BulkDeleteOp(ctx context.Context, spaceId string) ApiBulkDeleteOpRequest { return ApiBulkDeleteOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, + ctx: ctx, + spaceId: spaceId, } } // Execute executes the request -// @return BulkDeleteResponse +// +// @return BulkDeleteResponse func (a *SloAPIService) BulkDeleteOpExecute(r ApiBulkDeleteOpRequest) (*BulkDeleteResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *BulkDeleteResponse + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BulkDeleteResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.BulkDeleteOp") @@ -110,7 +323,7 @@ func (a *SloAPIService) BulkDeleteOpExecute(r ApiBulkDeleteOpRequest) (*BulkDele if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") // body params localVarPostBody = r.bulkDeleteRequest req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) @@ -142,8 +355,8 @@ func (a *SloAPIService) BulkDeleteOpExecute(r ApiBulkDeleteOpRequest) (*BulkDele newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -153,8 +366,8 @@ func (a *SloAPIService) BulkDeleteOpExecute(r ApiBulkDeleteOpRequest) (*BulkDele newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -164,8 +377,8 @@ func (a *SloAPIService) BulkDeleteOpExecute(r ApiBulkDeleteOpRequest) (*BulkDele newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -183,11 +396,11 @@ func (a *SloAPIService) BulkDeleteOpExecute(r ApiBulkDeleteOpRequest) (*BulkDele } type ApiBulkDeleteStatusOpRequest struct { - ctx context.Context - ApiService *SloAPIService - kbnXsrf *string - spaceId string - taskId string + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string + taskId string } // Cross-site request forgery protection @@ -205,29 +418,29 @@ BulkDeleteStatusOp Retrieve the status of the bulk deletion Retrieve the status of the bulk deletion operation for SLOs. This endpoint returns the status of the bulk deletion operation, including whether it is completed and the results of the operation. - - @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 taskId The task id of the bulk delete operation - @return ApiBulkDeleteStatusOpRequest + @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 taskId The task id of the bulk delete operation + @return ApiBulkDeleteStatusOpRequest */ func (a *SloAPIService) BulkDeleteStatusOp(ctx context.Context, spaceId string, taskId string) ApiBulkDeleteStatusOpRequest { return ApiBulkDeleteStatusOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, - taskId: taskId, + ctx: ctx, + spaceId: spaceId, + taskId: taskId, } } // Execute executes the request -// @return BulkDeleteStatusResponse +// +// @return BulkDeleteStatusResponse func (a *SloAPIService) BulkDeleteStatusOpExecute(r ApiBulkDeleteStatusOpRequest) (*BulkDeleteStatusResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *BulkDeleteStatusResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BulkDeleteStatusResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.BulkDeleteStatusOp") @@ -263,7 +476,7 @@ func (a *SloAPIService) BulkDeleteStatusOpExecute(r ApiBulkDeleteStatusOpRequest if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -293,8 +506,8 @@ func (a *SloAPIService) BulkDeleteStatusOpExecute(r ApiBulkDeleteStatusOpRequest newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -304,8 +517,8 @@ func (a *SloAPIService) BulkDeleteStatusOpExecute(r ApiBulkDeleteStatusOpRequest newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -315,8 +528,8 @@ func (a *SloAPIService) BulkDeleteStatusOpExecute(r ApiBulkDeleteStatusOpRequest newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -334,10 +547,10 @@ func (a *SloAPIService) BulkDeleteStatusOpExecute(r ApiBulkDeleteStatusOpRequest } type ApiCreateSloOpRequest struct { - ctx context.Context - ApiService *SloAPIService - kbnXsrf *string - spaceId string + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string createSloRequest *CreateSloRequest } @@ -361,27 +574,27 @@ CreateSloOp Create 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 ApiCreateSloOpRequest + @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 ApiCreateSloOpRequest */ func (a *SloAPIService) CreateSloOp(ctx context.Context, spaceId string) ApiCreateSloOpRequest { return ApiCreateSloOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, + ctx: ctx, + spaceId: spaceId, } } // Execute executes the request -// @return CreateSloResponse +// +// @return CreateSloResponse func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *CreateSloResponse + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateSloResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.CreateSloOp") @@ -419,7 +632,7 @@ func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloR if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") // body params localVarPostBody = r.createSloRequest req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) @@ -451,8 +664,8 @@ func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -462,8 +675,8 @@ func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -473,8 +686,8 @@ func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 409 { @@ -484,8 +697,8 @@ func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloR newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -503,10 +716,10 @@ func (a *SloAPIService) CreateSloOpExecute(r ApiCreateSloOpRequest) (*CreateSloR } type ApiDeleteRollupDataOpRequest struct { - ctx context.Context - ApiService *SloAPIService - kbnXsrf *string - spaceId string + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string bulkPurgeRollupRequest *BulkPurgeRollupRequest } @@ -530,27 +743,27 @@ DeleteRollupDataOp Batch delete rollup and summary data The deletion occurs for the specified list of `sloId`. 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 ApiDeleteRollupDataOpRequest + @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 ApiDeleteRollupDataOpRequest */ func (a *SloAPIService) DeleteRollupDataOp(ctx context.Context, spaceId string) ApiDeleteRollupDataOpRequest { return ApiDeleteRollupDataOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, + ctx: ctx, + spaceId: spaceId, } } // Execute executes the request -// @return BulkPurgeRollupResponse +// +// @return BulkPurgeRollupResponse func (a *SloAPIService) DeleteRollupDataOpExecute(r ApiDeleteRollupDataOpRequest) (*BulkPurgeRollupResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *BulkPurgeRollupResponse + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BulkPurgeRollupResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.DeleteRollupDataOp") @@ -588,7 +801,7 @@ func (a *SloAPIService) DeleteRollupDataOpExecute(r ApiDeleteRollupDataOpRequest if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") // body params localVarPostBody = r.bulkPurgeRollupRequest req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) @@ -620,8 +833,8 @@ func (a *SloAPIService) DeleteRollupDataOpExecute(r ApiDeleteRollupDataOpRequest newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -631,8 +844,8 @@ func (a *SloAPIService) DeleteRollupDataOpExecute(r ApiDeleteRollupDataOpRequest newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -642,8 +855,8 @@ func (a *SloAPIService) DeleteRollupDataOpExecute(r ApiDeleteRollupDataOpRequest newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -661,10 +874,10 @@ func (a *SloAPIService) DeleteRollupDataOpExecute(r ApiDeleteRollupDataOpRequest } type ApiDeleteSloInstancesOpRequest struct { - ctx context.Context - ApiService *SloAPIService - kbnXsrf *string - spaceId string + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string deleteSloInstancesRequest *DeleteSloInstancesRequest } @@ -688,25 +901,24 @@ DeleteSloInstancesOp Batch delete rollup and summary data The deletion occurs for the specified list of `sloId` and `instanceId`. You must have `all` privileges for the **SLOs** feature in the **Observability** section of the Kibana feature privileges. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. - @return ApiDeleteSloInstancesOpRequest + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. + @return ApiDeleteSloInstancesOpRequest */ func (a *SloAPIService) DeleteSloInstancesOp(ctx context.Context, spaceId string) ApiDeleteSloInstancesOpRequest { return ApiDeleteSloInstancesOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, + ctx: ctx, + spaceId: spaceId, } } // Execute executes the request func (a *SloAPIService) DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.DeleteSloInstancesOp") @@ -744,7 +956,7 @@ func (a *SloAPIService) DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpReq if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") // body params localVarPostBody = r.deleteSloInstancesRequest req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) @@ -776,8 +988,8 @@ func (a *SloAPIService) DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpReq newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -787,8 +999,8 @@ func (a *SloAPIService) DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpReq newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -798,8 +1010,8 @@ func (a *SloAPIService) DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpReq newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarHTTPResponse, newErr } @@ -808,11 +1020,11 @@ func (a *SloAPIService) DeleteSloInstancesOpExecute(r ApiDeleteSloInstancesOpReq } type ApiDeleteSloOpRequest struct { - ctx context.Context - ApiService *SloAPIService - kbnXsrf *string - spaceId string - sloId string + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string + sloId string } // Cross-site request forgery protection @@ -830,27 +1042,26 @@ DeleteSloOp Delete 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 ApiDeleteSloOpRequest + @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 ApiDeleteSloOpRequest */ func (a *SloAPIService) DeleteSloOp(ctx context.Context, spaceId string, sloId string) ApiDeleteSloOpRequest { return ApiDeleteSloOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, - sloId: sloId, + ctx: ctx, + spaceId: spaceId, + sloId: sloId, } } // Execute executes the request func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.DeleteSloOp") @@ -886,7 +1097,7 @@ func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Respo if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err @@ -916,8 +1127,8 @@ func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -927,8 +1138,8 @@ func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -938,8 +1149,8 @@ func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { @@ -949,8 +1160,8 @@ func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarHTTPResponse, newErr } @@ -959,11 +1170,11 @@ func (a *SloAPIService) DeleteSloOpExecute(r ApiDeleteSloOpRequest) (*http.Respo } type ApiDisableSloOpRequest struct { - ctx context.Context - ApiService *SloAPIService - kbnXsrf *string - spaceId string - sloId string + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string + sloId string } // Cross-site request forgery protection @@ -981,27 +1192,26 @@ DisableSloOp Disable 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 ApiDisableSloOpRequest + @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 ApiDisableSloOpRequest */ func (a *SloAPIService) DisableSloOp(ctx context.Context, spaceId string, sloId string) ApiDisableSloOpRequest { return ApiDisableSloOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, - sloId: sloId, + ctx: ctx, + spaceId: spaceId, + sloId: sloId, } } // Execute executes the request func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.DisableSloOp") @@ -1037,7 +1247,7 @@ func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Res if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err @@ -1067,8 +1277,8 @@ func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Res newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -1078,8 +1288,8 @@ func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Res newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -1089,8 +1299,8 @@ func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Res newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { @@ -1100,8 +1310,8 @@ func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Res newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarHTTPResponse, newErr } @@ -1110,11 +1320,11 @@ func (a *SloAPIService) DisableSloOpExecute(r ApiDisableSloOpRequest) (*http.Res } type ApiEnableSloOpRequest struct { - ctx context.Context - ApiService *SloAPIService - kbnXsrf *string - spaceId string - sloId string + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string + sloId string } // Cross-site request forgery protection @@ -1132,27 +1342,26 @@ EnableSloOp Enable 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 ApiEnableSloOpRequest + @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 ApiEnableSloOpRequest */ func (a *SloAPIService) EnableSloOp(ctx context.Context, spaceId string, sloId string) ApiEnableSloOpRequest { return ApiEnableSloOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, - sloId: sloId, + ctx: ctx, + spaceId: spaceId, + sloId: sloId, } } // Execute executes the request func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.EnableSloOp") @@ -1188,7 +1397,7 @@ func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Respo if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err @@ -1218,8 +1427,8 @@ func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -1229,8 +1438,8 @@ func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -1240,8 +1449,8 @@ func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { @@ -1251,8 +1460,8 @@ func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Respo newErr.error = err.Error() return localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarHTTPResponse, newErr } @@ -1261,18 +1470,18 @@ func (a *SloAPIService) EnableSloOpExecute(r ApiEnableSloOpRequest) (*http.Respo } type ApiFindSlosOpRequest struct { - ctx context.Context - ApiService *SloAPIService - kbnXsrf *string - spaceId string - kqlQuery *string - size *int32 - searchAfter *[]string - page *int32 - perPage *int32 - sortBy *string + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string + kqlQuery *string + size *int32 + searchAfter *[]string + page *int32 + perPage *int32 + sortBy *string sortDirection *string - hideStale *bool + hideStale *bool } // Cross-site request forgery protection @@ -1338,27 +1547,27 @@ FindSlosOp Get 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 ApiFindSlosOpRequest + @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 ApiFindSlosOpRequest */ func (a *SloAPIService) FindSlosOp(ctx context.Context, spaceId string) ApiFindSlosOpRequest { return ApiFindSlosOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, + ctx: ctx, + spaceId: spaceId, } } // Execute executes the request -// @return FindSloResponse +// +// @return FindSloResponse func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *FindSloResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FindSloResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.FindSlosOp") @@ -1377,10 +1586,10 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo } if r.kqlQuery != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "kqlQuery", r.kqlQuery, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "kqlQuery", r.kqlQuery, "") } if r.size != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "size", r.size, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "size", r.size, "") } else { var defaultValue int32 = 1 r.size = &defaultValue @@ -1390,38 +1599,38 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { - parameterAddToHeaderOrQuery(localVarQueryParams, "searchAfter", s.Index(i).Interface(), "form", "multi") + parameterAddToHeaderOrQuery(localVarQueryParams, "searchAfter", s.Index(i).Interface(), "multi") } } else { - parameterAddToHeaderOrQuery(localVarQueryParams, "searchAfter", t, "form", "multi") + parameterAddToHeaderOrQuery(localVarQueryParams, "searchAfter", t, "multi") } } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") } else { var defaultValue int32 = 1 r.page = &defaultValue } if r.perPage != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "perPage", r.perPage, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "perPage", r.perPage, "") } else { var defaultValue int32 = 25 r.perPage = &defaultValue } if r.sortBy != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "sortBy", r.sortBy, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "sortBy", r.sortBy, "") } else { var defaultValue string = "status" r.sortBy = &defaultValue } if r.sortDirection != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "sortDirection", r.sortDirection, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "sortDirection", r.sortDirection, "") } else { var defaultValue string = "asc" r.sortDirection = &defaultValue } if r.hideStale != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "hideStale", r.hideStale, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "hideStale", r.hideStale, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1440,7 +1649,7 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -1470,8 +1679,8 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -1481,8 +1690,8 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -1492,8 +1701,8 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { @@ -1503,8 +1712,8 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1522,15 +1731,15 @@ func (a *SloAPIService) FindSlosOpExecute(r ApiFindSlosOpRequest) (*FindSloRespo } type ApiGetDefinitionsOpRequest struct { - ctx context.Context - ApiService *SloAPIService - kbnXsrf *string - spaceId string + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string includeOutdatedOnly *bool - tags *string - search *string - page *float32 - perPage *int32 + tags *string + search *string + page *float64 + perPage *int32 } // Cross-site request forgery protection @@ -1558,7 +1767,7 @@ func (r ApiGetDefinitionsOpRequest) Search(search string) ApiGetDefinitionsOpReq } // The page to use for pagination, must be greater or equal than 1 -func (r ApiGetDefinitionsOpRequest) Page(page float32) ApiGetDefinitionsOpRequest { +func (r ApiGetDefinitionsOpRequest) Page(page float64) ApiGetDefinitionsOpRequest { r.page = &page return r } @@ -1578,27 +1787,27 @@ GetDefinitionsOp Get the SLO definitions 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 ApiGetDefinitionsOpRequest + @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 ApiGetDefinitionsOpRequest */ func (a *SloAPIService) GetDefinitionsOp(ctx context.Context, spaceId string) ApiGetDefinitionsOpRequest { return ApiGetDefinitionsOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, + ctx: ctx, + spaceId: spaceId, } } // Execute executes the request -// @return FindSloDefinitionsResponse +// +// @return FindSloDefinitionsResponse func (a *SloAPIService) GetDefinitionsOpExecute(r ApiGetDefinitionsOpRequest) (*FindSloDefinitionsResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *FindSloDefinitionsResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FindSloDefinitionsResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.GetDefinitionsOp") @@ -1617,19 +1826,19 @@ func (a *SloAPIService) GetDefinitionsOpExecute(r ApiGetDefinitionsOpRequest) (* } if r.includeOutdatedOnly != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "includeOutdatedOnly", r.includeOutdatedOnly, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "includeOutdatedOnly", r.includeOutdatedOnly, "") } if r.tags != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "tags", r.tags, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "tags", r.tags, "") } if r.search != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "search", r.search, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "search", r.search, "") } if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "") } if r.perPage != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "perPage", r.perPage, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "perPage", r.perPage, "") } else { var defaultValue int32 = 100 r.perPage = &defaultValue @@ -1651,7 +1860,7 @@ func (a *SloAPIService) GetDefinitionsOpExecute(r ApiGetDefinitionsOpRequest) (* if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -1681,8 +1890,8 @@ func (a *SloAPIService) GetDefinitionsOpExecute(r ApiGetDefinitionsOpRequest) (* newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -1692,8 +1901,8 @@ func (a *SloAPIService) GetDefinitionsOpExecute(r ApiGetDefinitionsOpRequest) (* newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -1703,8 +1912,8 @@ func (a *SloAPIService) GetDefinitionsOpExecute(r ApiGetDefinitionsOpRequest) (* newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1722,11 +1931,11 @@ func (a *SloAPIService) GetDefinitionsOpExecute(r ApiGetDefinitionsOpRequest) (* } type ApiGetSloOpRequest struct { - ctx context.Context - ApiService *SloAPIService - kbnXsrf *string - spaceId string - sloId string + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string + sloId string instanceId *string } @@ -1751,29 +1960,29 @@ GetSloOp Get an 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 ApiGetSloOpRequest + @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 ApiGetSloOpRequest */ func (a *SloAPIService) GetSloOp(ctx context.Context, spaceId string, sloId string) ApiGetSloOpRequest { return ApiGetSloOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, - sloId: sloId, + ctx: ctx, + spaceId: spaceId, + sloId: sloId, } } // Execute executes the request -// @return SloWithSummaryResponse +// +// @return SloWithSummaryResponse func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloWithSummaryResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *SloWithSummaryResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SloWithSummaryResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.GetSloOp") @@ -1793,7 +2002,7 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloWithSummaryRe } if r.instanceId != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "instanceId", r.instanceId, "form", "") + parameterAddToHeaderOrQuery(localVarQueryParams, "instanceId", r.instanceId, "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1812,7 +2021,7 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloWithSummaryRe if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -1842,8 +2051,8 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloWithSummaryRe newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -1853,8 +2062,8 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloWithSummaryRe newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -1864,8 +2073,8 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloWithSummaryRe newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { @@ -1875,8 +2084,8 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloWithSummaryRe newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -1894,11 +2103,11 @@ func (a *SloAPIService) GetSloOpExecute(r ApiGetSloOpRequest) (*SloWithSummaryRe } type ApiResetSloOpRequest struct { - ctx context.Context - ApiService *SloAPIService - kbnXsrf *string - spaceId string - sloId string + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string + sloId string } // Cross-site request forgery protection @@ -1916,29 +2125,29 @@ ResetSloOp Reset 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 ApiResetSloOpRequest + @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 ApiResetSloOpRequest */ func (a *SloAPIService) ResetSloOp(ctx context.Context, spaceId string, sloId string) ApiResetSloOpRequest { return ApiResetSloOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, - sloId: sloId, + ctx: ctx, + spaceId: spaceId, + sloId: sloId, } } // Execute executes the request -// @return SloDefinitionResponse +// +// @return SloDefinitionResponse func (a *SloAPIService) ResetSloOpExecute(r ApiResetSloOpRequest) (*SloDefinitionResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *SloDefinitionResponse + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SloDefinitionResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.ResetSloOp") @@ -1974,7 +2183,7 @@ func (a *SloAPIService) ResetSloOpExecute(r ApiResetSloOpRequest) (*SloDefinitio if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -2004,8 +2213,8 @@ func (a *SloAPIService) ResetSloOpExecute(r ApiResetSloOpRequest) (*SloDefinitio newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -2015,8 +2224,8 @@ func (a *SloAPIService) ResetSloOpExecute(r ApiResetSloOpRequest) (*SloDefinitio newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -2026,8 +2235,8 @@ func (a *SloAPIService) ResetSloOpExecute(r ApiResetSloOpRequest) (*SloDefinitio newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { @@ -2037,8 +2246,8 @@ func (a *SloAPIService) ResetSloOpExecute(r ApiResetSloOpRequest) (*SloDefinitio newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } @@ -2056,11 +2265,11 @@ func (a *SloAPIService) ResetSloOpExecute(r ApiResetSloOpRequest) (*SloDefinitio } type ApiUpdateSloOpRequest struct { - ctx context.Context - ApiService *SloAPIService - kbnXsrf *string - spaceId string - sloId string + ctx context.Context + ApiService SloAPI + kbnXsrf *string + spaceId string + sloId string updateSloRequest *UpdateSloRequest } @@ -2084,29 +2293,29 @@ UpdateSloOp Update 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 ApiUpdateSloOpRequest + @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 ApiUpdateSloOpRequest */ func (a *SloAPIService) UpdateSloOp(ctx context.Context, spaceId string, sloId string) ApiUpdateSloOpRequest { return ApiUpdateSloOpRequest{ ApiService: a, - ctx: ctx, - spaceId: spaceId, - sloId: sloId, + ctx: ctx, + spaceId: spaceId, + sloId: sloId, } } // Execute executes the request -// @return SloDefinitionResponse +// +// @return SloDefinitionResponse func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloDefinitionResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPut - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *SloDefinitionResponse + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SloDefinitionResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SloAPIService.UpdateSloOp") @@ -2145,7 +2354,7 @@ func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloDefinit if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "simple", "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "kbn-xsrf", r.kbnXsrf, "") // body params localVarPostBody = r.updateSloRequest req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) @@ -2177,8 +2386,8 @@ func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloDefinit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 401 { @@ -2188,8 +2397,8 @@ func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloDefinit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 403 { @@ -2199,8 +2408,8 @@ func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloDefinit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v return localVarReturnValue, localVarHTTPResponse, newErr } if localVarHTTPResponse.StatusCode == 404 { @@ -2210,8 +2419,8 @@ func (a *SloAPIService) UpdateSloOpExecute(r ApiUpdateSloOpRequest) (*SloDefinit newErr.error = err.Error() return localVarReturnValue, localVarHTTPResponse, newErr } - newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.model = v + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v } return localVarReturnValue, localVarHTTPResponse, newErr } diff --git a/generated/slo/client.go b/generated/slo/client.go index 8cf7fff4b..5e6cccbae 100644 --- a/generated/slo/client.go +++ b/generated/slo/client.go @@ -31,14 +31,13 @@ import ( "strings" "time" "unicode/utf8" - ) var ( - JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) - XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) - queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") ) // APIClient manages communication with the SLOs API v1.1 @@ -49,7 +48,7 @@ type APIClient struct { // API Services - SloAPI *SloAPIService + SloAPI SloAPI } type service struct { @@ -125,19 +124,15 @@ func typeCheckParameter(obj interface{}, expected string, name string) error { return nil } -func parameterValueToString( obj interface{}, key string ) string { +func parameterValueToString(obj interface{}, key string) string { if reflect.TypeOf(obj).Kind() != reflect.Ptr { - if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { - return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) - } - return fmt.Sprintf("%v", obj) } - var param,ok = obj.(MappedNullable) + var param, ok = obj.(MappedNullable) if !ok { return "" } - dataMap,err := param.ToMap() + dataMap, err := param.ToMap() if err != nil { return "" } @@ -146,92 +141,88 @@ func parameterValueToString( obj interface{}, key string ) string { // parameterAddToHeaderOrQuery adds the provided object to the request header or url query // supporting deep object syntax -func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { var v = reflect.ValueOf(obj) var value = "" if v == reflect.ValueOf(nil) { value = "null" } else { switch v.Kind() { - case reflect.Invalid: - value = "invalid" + case reflect.Invalid: + value = "invalid" - case reflect.Struct: - if t,ok := obj.(MappedNullable); ok { - dataMap,err := t.ToMap() - if err != nil { - return - } - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) - return - } - if t, ok := obj.(time.Time); ok { - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) - return - } - value = v.Type().String() + " value" - case reflect.Slice: - var indValue = reflect.ValueOf(obj) - if indValue == reflect.ValueOf(nil) { + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { return } - var lenIndValue = indValue.Len() - for i:=0;i 1 { // more than 1 match - // reset to nil - dst.ArrayOfString = nil - dst.String = nil - - return fmt.Errorf("data matches more than one schema in oneOf(SloResponseGroupBy)") - } else if match == 1 { - return nil // exactly one match - } else { // no match - return fmt.Errorf("data failed to match schemas in oneOf(SloResponseGroupBy)") - } -} - -// Marshal data from the first non-nil pointers in the struct to JSON -func (src SloResponseGroupBy) MarshalJSON() ([]byte, error) { - if src.ArrayOfString != nil { - return json.Marshal(&src.ArrayOfString) - } - - if src.String != nil { - return json.Marshal(&src.String) - } - - return nil, nil // no data in oneOf schemas -} - -// Get the actual instance -func (obj *SloResponseGroupBy) GetActualInstance() interface{} { - if obj == nil { - return nil - } - if obj.ArrayOfString != nil { - return obj.ArrayOfString - } - - if obj.String != nil { - return obj.String - } - - // all schemas are nil - return nil -} - -type NullableSloResponseGroupBy struct { - value *SloResponseGroupBy - isSet bool -} - -func (v NullableSloResponseGroupBy) Get() *SloResponseGroupBy { - return v.value -} - -func (v *NullableSloResponseGroupBy) Set(val *SloResponseGroupBy) { - v.value = val - v.isSet = true -} - -func (v NullableSloResponseGroupBy) IsSet() bool { - return v.isSet -} - -func (v *NullableSloResponseGroupBy) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableSloResponseGroupBy(val *SloResponseGroupBy) *NullableSloResponseGroupBy { - return &NullableSloResponseGroupBy{value: val, isSet: true} -} - -func (v NullableSloResponseGroupBy) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableSloResponseGroupBy) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/generated/slo/model_slo_response_indicator.go b/generated/slo/model_slo_response_indicator.go deleted file mode 100644 index e0147a4dd..000000000 --- a/generated/slo/model_slo_response_indicator.go +++ /dev/null @@ -1,323 +0,0 @@ -/* -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" -) - -// SloResponseIndicator - struct for SloResponseIndicator -type SloResponseIndicator struct { - IndicatorPropertiesApmAvailability *IndicatorPropertiesApmAvailability - IndicatorPropertiesApmLatency *IndicatorPropertiesApmLatency - IndicatorPropertiesCustomKql *IndicatorPropertiesCustomKql - IndicatorPropertiesCustomMetric *IndicatorPropertiesCustomMetric - IndicatorPropertiesHistogram *IndicatorPropertiesHistogram - IndicatorPropertiesTimesliceMetric *IndicatorPropertiesTimesliceMetric -} - -// IndicatorPropertiesApmAvailabilityAsSloResponseIndicator is a convenience function that returns IndicatorPropertiesApmAvailability wrapped in SloResponseIndicator -func IndicatorPropertiesApmAvailabilityAsSloResponseIndicator(v *IndicatorPropertiesApmAvailability) SloResponseIndicator { - return SloResponseIndicator{ - IndicatorPropertiesApmAvailability: v, - } -} - -// IndicatorPropertiesApmLatencyAsSloResponseIndicator is a convenience function that returns IndicatorPropertiesApmLatency wrapped in SloResponseIndicator -func IndicatorPropertiesApmLatencyAsSloResponseIndicator(v *IndicatorPropertiesApmLatency) SloResponseIndicator { - return SloResponseIndicator{ - IndicatorPropertiesApmLatency: v, - } -} - -// IndicatorPropertiesCustomKqlAsSloResponseIndicator is a convenience function that returns IndicatorPropertiesCustomKql wrapped in SloResponseIndicator -func IndicatorPropertiesCustomKqlAsSloResponseIndicator(v *IndicatorPropertiesCustomKql) SloResponseIndicator { - return SloResponseIndicator{ - IndicatorPropertiesCustomKql: v, - } -} - -// 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, - } -} - -// IndicatorPropertiesTimesliceMetricAsSloResponseIndicator is a convenience function that returns IndicatorPropertiesTimesliceMetric wrapped in SloResponseIndicator -func IndicatorPropertiesTimesliceMetricAsSloResponseIndicator(v *IndicatorPropertiesTimesliceMetric) SloResponseIndicator { - return SloResponseIndicator{ - IndicatorPropertiesTimesliceMetric: v, - } -} - -// Unmarshal JSON data into one of the pointers in the struct -func (dst *SloResponseIndicator) UnmarshalJSON(data []byte) error { - var err error - // 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 { - dst.IndicatorPropertiesHistogram = nil - return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesHistogram: %s", err.Error()) - } - } - - // check if the discriminator value is 'indicator_properties_timeslice_metric' - if jsonDict["type"] == "indicator_properties_timeslice_metric" { - // try to unmarshal JSON data into IndicatorPropertiesTimesliceMetric - err = json.Unmarshal(data, &dst.IndicatorPropertiesTimesliceMetric) - if err == nil { - return nil // data stored in dst.IndicatorPropertiesTimesliceMetric, return on the first match - } else { - dst.IndicatorPropertiesTimesliceMetric = nil - return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesTimesliceMetric: %s", err.Error()) - } - } - - // check if the discriminator value is 'sli.apm.transactionDuration' - if jsonDict["type"] == "sli.apm.transactionDuration" { - // try to unmarshal JSON data into IndicatorPropertiesApmLatency - 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 { - dst.IndicatorPropertiesApmAvailability = nil - return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesApmAvailability: %s", err.Error()) - } - } - - // 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 { - dst.IndicatorPropertiesHistogram = nil - return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesHistogram: %s", err.Error()) - } - } - - // 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()) - } - } - - // 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()) - } - } - - // check if the discriminator value is 'sli.metric.timeslice' - if jsonDict["type"] == "sli.metric.timeslice" { - // try to unmarshal JSON data into IndicatorPropertiesTimesliceMetric - err = json.Unmarshal(data, &dst.IndicatorPropertiesTimesliceMetric) - if err == nil { - return nil // data stored in dst.IndicatorPropertiesTimesliceMetric, return on the first match - } else { - dst.IndicatorPropertiesTimesliceMetric = nil - return fmt.Errorf("failed to unmarshal SloResponseIndicator as IndicatorPropertiesTimesliceMetric: %s", err.Error()) - } - } - - return nil -} - -// Marshal data from the first non-nil pointers in the struct to JSON -func (src SloResponseIndicator) 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) - } - - if src.IndicatorPropertiesTimesliceMetric != nil { - return json.Marshal(&src.IndicatorPropertiesTimesliceMetric) - } - - return nil, nil // no data in oneOf schemas -} - -// Get the actual instance -func (obj *SloResponseIndicator) 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 - } - - if obj.IndicatorPropertiesTimesliceMetric != nil { - return obj.IndicatorPropertiesTimesliceMetric - } - - // all schemas are nil - return nil -} - -type NullableSloResponseIndicator struct { - value *SloResponseIndicator - isSet bool -} - -func (v NullableSloResponseIndicator) Get() *SloResponseIndicator { - return v.value -} - -func (v *NullableSloResponseIndicator) Set(val *SloResponseIndicator) { - v.value = val - v.isSet = true -} - -func (v NullableSloResponseIndicator) IsSet() bool { - return v.isSet -} - -func (v *NullableSloResponseIndicator) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableSloResponseIndicator(val *SloResponseIndicator) *NullableSloResponseIndicator { - return &NullableSloResponseIndicator{value: val, isSet: true} -} - -func (v NullableSloResponseIndicator) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableSloResponseIndicator) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/generated/slo/model_slo_with_summary_response.go b/generated/slo/model_slo_with_summary_response.go index 8611cb88e..c498dee0f 100644 --- a/generated/slo/model_slo_with_summary_response.go +++ b/generated/slo/model_slo_with_summary_response.go @@ -12,8 +12,6 @@ package slo import ( "encoding/json" - "bytes" - "fmt" ) // checks if the SloWithSummaryResponse type satisfies the MappedNullable interface at compile time @@ -26,17 +24,17 @@ type SloWithSummaryResponse struct { // The name of the SLO. Name string `json:"name"` // The description of the SLO. - Description string `json:"description"` - Indicator SloWithSummaryResponseIndicator `json:"indicator"` - TimeWindow TimeWindow `json:"timeWindow"` - BudgetingMethod BudgetingMethod `json:"budgetingMethod"` - Objective Objective `json:"objective"` - Settings Settings `json:"settings"` + Description string `json:"description"` + Indicator SloWithSummaryResponseIndicator `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"` - Summary Summary `json:"summary"` + Revision float64 `json:"revision"` + Summary Summary `json:"summary"` // Indicate if the SLO is enabled - Enabled bool `json:"enabled"` + Enabled bool `json:"enabled"` GroupBy GroupBy `json:"groupBy"` // the value derived from the groupBy field, if present, otherwise '*' InstanceId string `json:"instanceId"` @@ -47,16 +45,14 @@ type SloWithSummaryResponse struct { // The last update date UpdatedAt string `json:"updatedAt"` // The internal SLO version - Version float32 `json:"version"` + Version float64 `json:"version"` } -type _SloWithSummaryResponse SloWithSummaryResponse - // NewSloWithSummaryResponse instantiates a new SloWithSummaryResponse 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 NewSloWithSummaryResponse(id string, name string, description string, indicator SloWithSummaryResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float32, summary Summary, enabled bool, groupBy GroupBy, instanceId string, tags []string, createdAt string, updatedAt string, version float32) *SloWithSummaryResponse { +func NewSloWithSummaryResponse(id string, name string, description string, indicator SloWithSummaryResponseIndicator, timeWindow TimeWindow, budgetingMethod BudgetingMethod, objective Objective, settings Settings, revision float64, summary Summary, enabled bool, groupBy GroupBy, instanceId string, tags []string, createdAt string, updatedAt string, version float64) *SloWithSummaryResponse { this := SloWithSummaryResponse{} this.Id = id this.Name = name @@ -279,9 +275,9 @@ func (o *SloWithSummaryResponse) SetSettings(v Settings) { } // GetRevision returns the Revision field value -func (o *SloWithSummaryResponse) GetRevision() float32 { +func (o *SloWithSummaryResponse) GetRevision() float64 { if o == nil { - var ret float32 + var ret float64 return ret } @@ -290,7 +286,7 @@ func (o *SloWithSummaryResponse) GetRevision() float32 { // GetRevisionOk returns a tuple with the Revision field value // and a boolean to check if the value has been set. -func (o *SloWithSummaryResponse) GetRevisionOk() (*float32, bool) { +func (o *SloWithSummaryResponse) GetRevisionOk() (*float64, bool) { if o == nil { return nil, false } @@ -298,7 +294,7 @@ func (o *SloWithSummaryResponse) GetRevisionOk() (*float32, bool) { } // SetRevision sets field value -func (o *SloWithSummaryResponse) SetRevision(v float32) { +func (o *SloWithSummaryResponse) SetRevision(v float64) { o.Revision = v } @@ -471,9 +467,9 @@ func (o *SloWithSummaryResponse) SetUpdatedAt(v string) { } // GetVersion returns the Version field value -func (o *SloWithSummaryResponse) GetVersion() float32 { +func (o *SloWithSummaryResponse) GetVersion() float64 { if o == nil { - var ret float32 + var ret float64 return ret } @@ -482,7 +478,7 @@ func (o *SloWithSummaryResponse) GetVersion() float32 { // GetVersionOk returns a tuple with the Version field value // and a boolean to check if the value has been set. -func (o *SloWithSummaryResponse) GetVersionOk() (*float32, bool) { +func (o *SloWithSummaryResponse) GetVersionOk() (*float64, bool) { if o == nil { return nil, false } @@ -490,12 +486,12 @@ func (o *SloWithSummaryResponse) GetVersionOk() (*float32, bool) { } // SetVersion sets field value -func (o *SloWithSummaryResponse) SetVersion(v float32) { +func (o *SloWithSummaryResponse) SetVersion(v float64) { o.Version = v } func (o SloWithSummaryResponse) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -524,59 +520,6 @@ func (o SloWithSummaryResponse) ToMap() (map[string]interface{}, error) { return toSerialize, nil } -func (o *SloWithSummaryResponse) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "id", - "name", - "description", - "indicator", - "timeWindow", - "budgetingMethod", - "objective", - "settings", - "revision", - "summary", - "enabled", - "groupBy", - "instanceId", - "tags", - "createdAt", - "updatedAt", - "version", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err; - } - - for _, requiredProperty := range(requiredProperties) { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varSloWithSummaryResponse := _SloWithSummaryResponse{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varSloWithSummaryResponse) - - if err != nil { - return err - } - - *o = SloWithSummaryResponse(varSloWithSummaryResponse) - - return err -} - type NullableSloWithSummaryResponse struct { value *SloWithSummaryResponse isSet bool @@ -612,5 +555,3 @@ func (v *NullableSloWithSummaryResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/generated/slo/model_slo_with_summary_response_indicator.go b/generated/slo/model_slo_with_summary_response_indicator.go index 8d19440d6..4e5fc86e6 100644 --- a/generated/slo/model_slo_with_summary_response_indicator.go +++ b/generated/slo/model_slo_with_summary_response_indicator.go @@ -13,16 +13,15 @@ package slo import ( "encoding/json" "fmt" - "gopkg.in/validator.v2" ) // SloWithSummaryResponseIndicator - struct for SloWithSummaryResponseIndicator type SloWithSummaryResponseIndicator struct { IndicatorPropertiesApmAvailability *IndicatorPropertiesApmAvailability - IndicatorPropertiesApmLatency *IndicatorPropertiesApmLatency - IndicatorPropertiesCustomKql *IndicatorPropertiesCustomKql - IndicatorPropertiesCustomMetric *IndicatorPropertiesCustomMetric - IndicatorPropertiesHistogram *IndicatorPropertiesHistogram + IndicatorPropertiesApmLatency *IndicatorPropertiesApmLatency + IndicatorPropertiesCustomKql *IndicatorPropertiesCustomKql + IndicatorPropertiesCustomMetric *IndicatorPropertiesCustomMetric + IndicatorPropertiesHistogram *IndicatorPropertiesHistogram IndicatorPropertiesTimesliceMetric *IndicatorPropertiesTimesliceMetric } @@ -68,128 +67,161 @@ func IndicatorPropertiesTimesliceMetricAsSloWithSummaryResponseIndicator(v *Indi } } - // Unmarshal JSON data into one of the pointers in the struct func (dst *SloWithSummaryResponseIndicator) 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 - dst.IndicatorPropertiesApmAvailability = nil + // 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 { - if err = validator.Validate(dst.IndicatorPropertiesApmAvailability); err != nil { - dst.IndicatorPropertiesApmAvailability = nil - } else { - match++ - } + dst.IndicatorPropertiesApmAvailability = nil + return fmt.Errorf("failed to unmarshal SloWithSummaryResponseIndicator as IndicatorPropertiesApmAvailability: %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 - dst.IndicatorPropertiesApmLatency = nil + // 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 { - if err = validator.Validate(dst.IndicatorPropertiesApmLatency); err != nil { - dst.IndicatorPropertiesApmLatency = nil - } else { - match++ - } + dst.IndicatorPropertiesApmLatency = nil + return fmt.Errorf("failed to unmarshal SloWithSummaryResponseIndicator as IndicatorPropertiesApmLatency: %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 '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 { - if err = validator.Validate(dst.IndicatorPropertiesCustomKql); err != nil { - dst.IndicatorPropertiesCustomKql = nil - } else { - match++ - } + dst.IndicatorPropertiesCustomKql = nil + return fmt.Errorf("failed to unmarshal SloWithSummaryResponseIndicator as IndicatorPropertiesCustomKql: %s", err.Error()) } - } else { - dst.IndicatorPropertiesCustomKql = nil } - // try to unmarshal data into IndicatorPropertiesCustomMetric - err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesCustomMetric) - if err == nil { - jsonIndicatorPropertiesCustomMetric, _ := json.Marshal(dst.IndicatorPropertiesCustomMetric) - if string(jsonIndicatorPropertiesCustomMetric) == "{}" { // empty struct - dst.IndicatorPropertiesCustomMetric = nil + // 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 { - if err = validator.Validate(dst.IndicatorPropertiesCustomMetric); err != nil { - dst.IndicatorPropertiesCustomMetric = nil - } else { - match++ - } + dst.IndicatorPropertiesCustomMetric = nil + return fmt.Errorf("failed to unmarshal SloWithSummaryResponseIndicator as IndicatorPropertiesCustomMetric: %s", err.Error()) } - } else { - dst.IndicatorPropertiesCustomMetric = nil } - // try to unmarshal data into IndicatorPropertiesHistogram - err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesHistogram) - if err == nil { - jsonIndicatorPropertiesHistogram, _ := json.Marshal(dst.IndicatorPropertiesHistogram) - if string(jsonIndicatorPropertiesHistogram) == "{}" { // empty struct - dst.IndicatorPropertiesHistogram = nil + // 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 { - if err = validator.Validate(dst.IndicatorPropertiesHistogram); err != nil { - dst.IndicatorPropertiesHistogram = nil - } else { - match++ - } + dst.IndicatorPropertiesHistogram = nil + return fmt.Errorf("failed to unmarshal SloWithSummaryResponseIndicator as IndicatorPropertiesHistogram: %s", err.Error()) } - } else { - dst.IndicatorPropertiesHistogram = nil } - // try to unmarshal data into IndicatorPropertiesTimesliceMetric - err = newStrictDecoder(data).Decode(&dst.IndicatorPropertiesTimesliceMetric) - if err == nil { - jsonIndicatorPropertiesTimesliceMetric, _ := json.Marshal(dst.IndicatorPropertiesTimesliceMetric) - if string(jsonIndicatorPropertiesTimesliceMetric) == "{}" { // empty struct + // check if the discriminator value is 'indicator_properties_timeslice_metric' + if jsonDict["type"] == "indicator_properties_timeslice_metric" { + // try to unmarshal JSON data into IndicatorPropertiesTimesliceMetric + err = json.Unmarshal(data, &dst.IndicatorPropertiesTimesliceMetric) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesTimesliceMetric, return on the first match + } else { dst.IndicatorPropertiesTimesliceMetric = nil + return fmt.Errorf("failed to unmarshal SloWithSummaryResponseIndicator as IndicatorPropertiesTimesliceMetric: %s", err.Error()) + } + } + + // check if the discriminator value is 'sli.apm.transactionDuration' + if jsonDict["type"] == "sli.apm.transactionDuration" { + // try to unmarshal JSON data into IndicatorPropertiesApmLatency + 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 SloWithSummaryResponseIndicator 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 { + dst.IndicatorPropertiesApmAvailability = nil + return fmt.Errorf("failed to unmarshal SloWithSummaryResponseIndicator as IndicatorPropertiesApmAvailability: %s", err.Error()) + } + } + + // 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 { + dst.IndicatorPropertiesHistogram = nil + return fmt.Errorf("failed to unmarshal SloWithSummaryResponseIndicator as IndicatorPropertiesHistogram: %s", err.Error()) + } + } + + // 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 { - if err = validator.Validate(dst.IndicatorPropertiesTimesliceMetric); err != nil { - dst.IndicatorPropertiesTimesliceMetric = nil - } else { - match++ - } + dst.IndicatorPropertiesCustomKql = nil + return fmt.Errorf("failed to unmarshal SloWithSummaryResponseIndicator as IndicatorPropertiesCustomKql: %s", err.Error()) } - } else { - dst.IndicatorPropertiesTimesliceMetric = 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 - dst.IndicatorPropertiesTimesliceMetric = nil + // 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 SloWithSummaryResponseIndicator as IndicatorPropertiesCustomMetric: %s", err.Error()) + } + } - return fmt.Errorf("data matches more than one schema in oneOf(SloWithSummaryResponseIndicator)") - } else if match == 1 { - return nil // exactly one match - } else { // no match - return fmt.Errorf("data failed to match schemas in oneOf(SloWithSummaryResponseIndicator)") + // check if the discriminator value is 'sli.metric.timeslice' + if jsonDict["type"] == "sli.metric.timeslice" { + // try to unmarshal JSON data into IndicatorPropertiesTimesliceMetric + err = json.Unmarshal(data, &dst.IndicatorPropertiesTimesliceMetric) + if err == nil { + return nil // data stored in dst.IndicatorPropertiesTimesliceMetric, return on the first match + } else { + dst.IndicatorPropertiesTimesliceMetric = nil + return fmt.Errorf("failed to unmarshal SloWithSummaryResponseIndicator as IndicatorPropertiesTimesliceMetric: %s", err.Error()) + } } + + return nil } // Marshal data from the first non-nil pointers in the struct to JSON @@ -222,7 +254,7 @@ func (src SloWithSummaryResponseIndicator) MarshalJSON() ([]byte, error) { } // Get the actual instance -func (obj *SloWithSummaryResponseIndicator) GetActualInstance() (interface{}) { +func (obj *SloWithSummaryResponseIndicator) GetActualInstance() interface{} { if obj == nil { return nil } @@ -254,36 +286,6 @@ func (obj *SloWithSummaryResponseIndicator) GetActualInstance() (interface{}) { return nil } -// Get the actual instance value -func (obj SloWithSummaryResponseIndicator) GetActualInstanceValue() (interface{}) { - 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 - } - - if obj.IndicatorPropertiesTimesliceMetric != nil { - return *obj.IndicatorPropertiesTimesliceMetric - } - - // all schemas are nil - return nil -} - type NullableSloWithSummaryResponseIndicator struct { value *SloWithSummaryResponseIndicator isSet bool @@ -319,5 +321,3 @@ func (v *NullableSloWithSummaryResponseIndicator) UnmarshalJSON(src []byte) erro v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/generated/slo/model_summary.go b/generated/slo/model_summary.go index e9c558602..251539a2e 100644 --- a/generated/slo/model_summary.go +++ b/generated/slo/model_summary.go @@ -12,8 +12,6 @@ package slo import ( "encoding/json" - "bytes" - "fmt" ) // checks if the Summary type satisfies the MappedNullable interface at compile time @@ -21,18 +19,16 @@ var _ MappedNullable = &Summary{} // Summary The SLO computed data type Summary struct { - Status SummaryStatus `json:"status"` - SliValue float32 `json:"sliValue"` - ErrorBudget ErrorBudget `json:"errorBudget"` + Status SummaryStatus `json:"status"` + SliValue float64 `json:"sliValue"` + ErrorBudget ErrorBudget `json:"errorBudget"` } -type _Summary Summary - // 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(status SummaryStatus, sliValue float32, errorBudget ErrorBudget) *Summary { +func NewSummary(status SummaryStatus, sliValue float64, errorBudget ErrorBudget) *Summary { this := Summary{} this.Status = status this.SliValue = sliValue @@ -73,9 +69,9 @@ func (o *Summary) SetStatus(v SummaryStatus) { } // GetSliValue returns the SliValue field value -func (o *Summary) GetSliValue() float32 { +func (o *Summary) GetSliValue() float64 { if o == nil { - var ret float32 + var ret float64 return ret } @@ -84,7 +80,7 @@ func (o *Summary) GetSliValue() float32 { // 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) { +func (o *Summary) GetSliValueOk() (*float64, bool) { if o == nil { return nil, false } @@ -92,7 +88,7 @@ func (o *Summary) GetSliValueOk() (*float32, bool) { } // SetSliValue sets field value -func (o *Summary) SetSliValue(v float32) { +func (o *Summary) SetSliValue(v float64) { o.SliValue = v } @@ -121,7 +117,7 @@ func (o *Summary) SetErrorBudget(v ErrorBudget) { } func (o Summary) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -136,45 +132,6 @@ func (o Summary) ToMap() (map[string]interface{}, error) { return toSerialize, nil } -func (o *Summary) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "status", - "sliValue", - "errorBudget", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err; - } - - for _, requiredProperty := range(requiredProperties) { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varSummary := _Summary{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varSummary) - - if err != nil { - return err - } - - *o = Summary(varSummary) - - return err -} - type NullableSummary struct { value *Summary isSet bool @@ -210,5 +167,3 @@ func (v *NullableSummary) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/generated/slo/model_summary_status.go b/generated/slo/model_summary_status.go index c5f0da437..a942168d9 100644 --- a/generated/slo/model_summary_status.go +++ b/generated/slo/model_summary_status.go @@ -20,10 +20,10 @@ type SummaryStatus string // List of summary_status const ( - NO_DATA SummaryStatus = "NO_DATA" - HEALTHY SummaryStatus = "HEALTHY" + NO_DATA SummaryStatus = "NO_DATA" + HEALTHY SummaryStatus = "HEALTHY" DEGRADING SummaryStatus = "DEGRADING" - VIOLATED SummaryStatus = "VIOLATED" + VIOLATED SummaryStatus = "VIOLATED" ) // All allowed values of SummaryStatus enum @@ -112,4 +112,3 @@ 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 index fe915f997..71e713707 100644 --- a/generated/slo/model_time_window.go +++ b/generated/slo/model_time_window.go @@ -12,8 +12,6 @@ package slo import ( "encoding/json" - "bytes" - "fmt" ) // checks if the TimeWindow type satisfies the MappedNullable interface at compile time @@ -27,8 +25,6 @@ type TimeWindow struct { Type string `json:"type"` } -type _TimeWindow TimeWindow - // 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 @@ -97,7 +93,7 @@ func (o *TimeWindow) SetType(v string) { } func (o TimeWindow) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -111,44 +107,6 @@ func (o TimeWindow) ToMap() (map[string]interface{}, error) { return toSerialize, nil } -func (o *TimeWindow) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "duration", - "type", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err; - } - - for _, requiredProperty := range(requiredProperties) { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varTimeWindow := _TimeWindow{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varTimeWindow) - - if err != nil { - return err - } - - *o = TimeWindow(varTimeWindow) - - return err -} - type NullableTimeWindow struct { value *TimeWindow isSet bool @@ -184,5 +142,3 @@ func (v *NullableTimeWindow) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/generated/slo/model_timeslice_metric_basic_metric_with_field.go b/generated/slo/model_timeslice_metric_basic_metric_with_field.go index 98a0b713a..e54d5af2a 100644 --- a/generated/slo/model_timeslice_metric_basic_metric_with_field.go +++ b/generated/slo/model_timeslice_metric_basic_metric_with_field.go @@ -12,8 +12,6 @@ package slo import ( "encoding/json" - "bytes" - "fmt" ) // checks if the TimesliceMetricBasicMetricWithField type satisfies the MappedNullable interface at compile time @@ -22,7 +20,7 @@ var _ MappedNullable = &TimesliceMetricBasicMetricWithField{} // TimesliceMetricBasicMetricWithField struct for TimesliceMetricBasicMetricWithField type TimesliceMetricBasicMetricWithField struct { // The name of the metric. Only valid options are A-Z - Name string `json:"name" validate:"regexp=^[A-Z]$"` + Name string `json:"name"` // The aggregation type of the metric. Aggregation string `json:"aggregation"` // The field of the metric. @@ -31,8 +29,6 @@ type TimesliceMetricBasicMetricWithField struct { Filter *string `json:"filter,omitempty"` } -type _TimesliceMetricBasicMetricWithField TimesliceMetricBasicMetricWithField - // NewTimesliceMetricBasicMetricWithField instantiates a new TimesliceMetricBasicMetricWithField object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -158,7 +154,7 @@ func (o *TimesliceMetricBasicMetricWithField) SetFilter(v string) { } func (o TimesliceMetricBasicMetricWithField) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -176,45 +172,6 @@ func (o TimesliceMetricBasicMetricWithField) ToMap() (map[string]interface{}, er return toSerialize, nil } -func (o *TimesliceMetricBasicMetricWithField) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "name", - "aggregation", - "field", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err; - } - - for _, requiredProperty := range(requiredProperties) { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varTimesliceMetricBasicMetricWithField := _TimesliceMetricBasicMetricWithField{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varTimesliceMetricBasicMetricWithField) - - if err != nil { - return err - } - - *o = TimesliceMetricBasicMetricWithField(varTimesliceMetricBasicMetricWithField) - - return err -} - type NullableTimesliceMetricBasicMetricWithField struct { value *TimesliceMetricBasicMetricWithField isSet bool @@ -250,5 +207,3 @@ func (v *NullableTimesliceMetricBasicMetricWithField) UnmarshalJSON(src []byte) v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/generated/slo/model_timeslice_metric_doc_count_metric.go b/generated/slo/model_timeslice_metric_doc_count_metric.go index 6c31e990a..efcba9abe 100644 --- a/generated/slo/model_timeslice_metric_doc_count_metric.go +++ b/generated/slo/model_timeslice_metric_doc_count_metric.go @@ -12,8 +12,6 @@ package slo import ( "encoding/json" - "bytes" - "fmt" ) // checks if the TimesliceMetricDocCountMetric type satisfies the MappedNullable interface at compile time @@ -22,15 +20,13 @@ var _ MappedNullable = &TimesliceMetricDocCountMetric{} // TimesliceMetricDocCountMetric struct for TimesliceMetricDocCountMetric type TimesliceMetricDocCountMetric struct { // The name of the metric. Only valid options are A-Z - Name string `json:"name" validate:"regexp=^[A-Z]$"` + Name string `json:"name"` // The aggregation type of the metric. Only valid option is \"doc_count\" Aggregation string `json:"aggregation"` // The filter to apply to the metric. Filter *string `json:"filter,omitempty"` } -type _TimesliceMetricDocCountMetric TimesliceMetricDocCountMetric - // NewTimesliceMetricDocCountMetric instantiates a new TimesliceMetricDocCountMetric object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments @@ -131,7 +127,7 @@ func (o *TimesliceMetricDocCountMetric) SetFilter(v string) { } func (o TimesliceMetricDocCountMetric) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -148,44 +144,6 @@ func (o TimesliceMetricDocCountMetric) ToMap() (map[string]interface{}, error) { return toSerialize, nil } -func (o *TimesliceMetricDocCountMetric) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "name", - "aggregation", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err; - } - - for _, requiredProperty := range(requiredProperties) { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varTimesliceMetricDocCountMetric := _TimesliceMetricDocCountMetric{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varTimesliceMetricDocCountMetric) - - if err != nil { - return err - } - - *o = TimesliceMetricDocCountMetric(varTimesliceMetricDocCountMetric) - - return err -} - type NullableTimesliceMetricDocCountMetric struct { value *TimesliceMetricDocCountMetric isSet bool @@ -221,5 +179,3 @@ func (v *NullableTimesliceMetricDocCountMetric) UnmarshalJSON(src []byte) error v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/generated/slo/model_timeslice_metric_percentile_metric.go b/generated/slo/model_timeslice_metric_percentile_metric.go index 3161e5a51..0d2844b2c 100644 --- a/generated/slo/model_timeslice_metric_percentile_metric.go +++ b/generated/slo/model_timeslice_metric_percentile_metric.go @@ -12,8 +12,6 @@ package slo import ( "encoding/json" - "bytes" - "fmt" ) // checks if the TimesliceMetricPercentileMetric type satisfies the MappedNullable interface at compile time @@ -22,24 +20,22 @@ var _ MappedNullable = &TimesliceMetricPercentileMetric{} // TimesliceMetricPercentileMetric struct for TimesliceMetricPercentileMetric type TimesliceMetricPercentileMetric struct { // The name of the metric. Only valid options are A-Z - Name string `json:"name" validate:"regexp=^[A-Z]$"` + Name string `json:"name"` // The aggregation type of the metric. Only valid option is \"percentile\" Aggregation string `json:"aggregation"` // The field of the metric. Field string `json:"field"` // The percentile value. - Percentile float32 `json:"percentile"` + Percentile float64 `json:"percentile"` // The filter to apply to the metric. Filter *string `json:"filter,omitempty"` } -type _TimesliceMetricPercentileMetric TimesliceMetricPercentileMetric - // NewTimesliceMetricPercentileMetric instantiates a new TimesliceMetricPercentileMetric object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewTimesliceMetricPercentileMetric(name string, aggregation string, field string, percentile float32) *TimesliceMetricPercentileMetric { +func NewTimesliceMetricPercentileMetric(name string, aggregation string, field string, percentile float64) *TimesliceMetricPercentileMetric { this := TimesliceMetricPercentileMetric{} this.Name = name this.Aggregation = aggregation @@ -129,9 +125,9 @@ func (o *TimesliceMetricPercentileMetric) SetField(v string) { } // GetPercentile returns the Percentile field value -func (o *TimesliceMetricPercentileMetric) GetPercentile() float32 { +func (o *TimesliceMetricPercentileMetric) GetPercentile() float64 { if o == nil { - var ret float32 + var ret float64 return ret } @@ -140,7 +136,7 @@ func (o *TimesliceMetricPercentileMetric) GetPercentile() float32 { // GetPercentileOk returns a tuple with the Percentile field value // and a boolean to check if the value has been set. -func (o *TimesliceMetricPercentileMetric) GetPercentileOk() (*float32, bool) { +func (o *TimesliceMetricPercentileMetric) GetPercentileOk() (*float64, bool) { if o == nil { return nil, false } @@ -148,7 +144,7 @@ func (o *TimesliceMetricPercentileMetric) GetPercentileOk() (*float32, bool) { } // SetPercentile sets field value -func (o *TimesliceMetricPercentileMetric) SetPercentile(v float32) { +func (o *TimesliceMetricPercentileMetric) SetPercentile(v float64) { o.Percentile = v } @@ -185,7 +181,7 @@ func (o *TimesliceMetricPercentileMetric) SetFilter(v string) { } func (o TimesliceMetricPercentileMetric) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -204,46 +200,6 @@ func (o TimesliceMetricPercentileMetric) ToMap() (map[string]interface{}, error) return toSerialize, nil } -func (o *TimesliceMetricPercentileMetric) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "name", - "aggregation", - "field", - "percentile", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err; - } - - for _, requiredProperty := range(requiredProperties) { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } - } - - varTimesliceMetricPercentileMetric := _TimesliceMetricPercentileMetric{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varTimesliceMetricPercentileMetric) - - if err != nil { - return err - } - - *o = TimesliceMetricPercentileMetric(varTimesliceMetricPercentileMetric) - - return err -} - type NullableTimesliceMetricPercentileMetric struct { value *TimesliceMetricPercentileMetric isSet bool @@ -279,5 +235,3 @@ func (v *NullableTimesliceMetricPercentileMetric) UnmarshalJSON(src []byte) erro 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 f4f285462..607c081c8 100644 --- a/generated/slo/model_update_slo_request.go +++ b/generated/slo/model_update_slo_request.go @@ -17,18 +17,18 @@ 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 *CreateSloRequestIndicator `json:"indicator,omitempty"` - TimeWindow *TimeWindow `json:"timeWindow,omitempty"` - BudgetingMethod *BudgetingMethod `json:"budgetingMethod,omitempty"` - Objective *Objective `json:"objective,omitempty"` - Settings *Settings `json:"settings,omitempty"` - GroupBy *GroupBy `json:"groupBy,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"` + GroupBy *GroupBy `json:"groupBy,omitempty"` // List of tags Tags []string `json:"tags,omitempty"` } @@ -339,7 +339,7 @@ func (o *UpdateSloRequest) SetTags(v []string) { } func (o UpdateSloRequest) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -413,5 +413,3 @@ func (v *NullableUpdateSloRequest) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/generated/slo/test/api_slo_test.go b/generated/slo/test/api_slo_test.go deleted file mode 100644 index a9d129796..000000000 --- a/generated/slo/test/api_slo_test.go +++ /dev/null @@ -1,210 +0,0 @@ -/* -SLOs - -Testing SloAPIService - -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); - -package openapi - -import ( - "context" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "testing" - openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" -) - -func Test_openapi_SloAPIService(t *testing.T) { - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - - t.Run("Test SloAPIService BulkDeleteOp", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var spaceId string - - resp, httpRes, err := apiClient.SloAPI.BulkDeleteOp(context.Background(), spaceId).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test SloAPIService BulkDeleteStatusOp", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var spaceId string - var taskId string - - resp, httpRes, err := apiClient.SloAPI.BulkDeleteStatusOp(context.Background(), spaceId, taskId).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test SloAPIService CreateSloOp", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var spaceId string - - resp, httpRes, err := apiClient.SloAPI.CreateSloOp(context.Background(), spaceId).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test SloAPIService DeleteRollupDataOp", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var spaceId string - - resp, httpRes, err := apiClient.SloAPI.DeleteRollupDataOp(context.Background(), spaceId).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test SloAPIService DeleteSloInstancesOp", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var spaceId string - - httpRes, err := apiClient.SloAPI.DeleteSloInstancesOp(context.Background(), spaceId).Execute() - - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test SloAPIService DeleteSloOp", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var spaceId string - var sloId string - - httpRes, err := apiClient.SloAPI.DeleteSloOp(context.Background(), spaceId, sloId).Execute() - - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test SloAPIService DisableSloOp", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var spaceId string - var sloId string - - httpRes, err := apiClient.SloAPI.DisableSloOp(context.Background(), spaceId, sloId).Execute() - - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test SloAPIService EnableSloOp", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var spaceId string - var sloId string - - httpRes, err := apiClient.SloAPI.EnableSloOp(context.Background(), spaceId, sloId).Execute() - - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test SloAPIService FindSlosOp", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var spaceId string - - resp, httpRes, err := apiClient.SloAPI.FindSlosOp(context.Background(), spaceId).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test SloAPIService GetDefinitionsOp", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var spaceId string - - resp, httpRes, err := apiClient.SloAPI.GetDefinitionsOp(context.Background(), spaceId).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test SloAPIService GetSloOp", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var spaceId string - var sloId string - - resp, httpRes, err := apiClient.SloAPI.GetSloOp(context.Background(), spaceId, sloId).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test SloAPIService ResetSloOp", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var spaceId string - var sloId string - - resp, httpRes, err := apiClient.SloAPI.ResetSloOp(context.Background(), spaceId, sloId).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test SloAPIService UpdateSloOp", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var spaceId string - var sloId string - - resp, httpRes, err := apiClient.SloAPI.UpdateSloOp(context.Background(), spaceId, sloId).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - -} diff --git a/generated/slo/utils.go b/generated/slo/utils.go index 2ed1d7fce..826d18aca 100644 --- a/generated/slo/utils.go +++ b/generated/slo/utils.go @@ -11,9 +11,7 @@ API version: 1.1 package slo import ( - "bytes" "encoding/json" - "fmt" "reflect" "time" ) @@ -322,7 +320,7 @@ func NewNullableTime(val *time.Time) *NullableTime { } func (v NullableTime) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) + return v.value.MarshalJSON() } func (v *NullableTime) UnmarshalJSON(src []byte) error { @@ -347,15 +345,3 @@ func IsNil(i interface{}) bool { type MappedNullable interface { ToMap() (map[string]interface{}, error) } - -// A wrapper for strict JSON decoding -func newStrictDecoder(data []byte) *json.Decoder { - dec := json.NewDecoder(bytes.NewBuffer(data)) - dec.DisallowUnknownFields() - return dec -} - -// Prevent trying to import "fmt" -func reportError(format string, a ...interface{}) error { - return fmt.Errorf(format, a...) -} \ No newline at end of file diff --git a/internal/kibana/slo.go b/internal/kibana/slo.go index ce8c6bd8c..267c5ed86 100644 --- a/internal/kibana/slo.go +++ b/internal/kibana/slo.go @@ -447,6 +447,11 @@ func getSchema() map[string]*schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "sync_field": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, "sync_delay": { Type: schema.TypeString, Optional: true, @@ -457,6 +462,11 @@ func getSchema() map[string]*schema.Schema { Optional: true, Computed: true, }, + "prevent_initial_backfill": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, }, }, }, @@ -500,6 +510,14 @@ func getOrNilString(path string, d *schema.ResourceData) *string { return nil } +func getOrNilBool(path string, d *schema.ResourceData) *bool { + if v, ok := d.GetOk(path); ok { + b := v.(bool) + return &b + } + return nil +} + func getOrNilFloat(path string, d *schema.ResourceData) *float64 { if v, ok := d.GetOk(path); ok { f := v.(float64) @@ -650,8 +668,10 @@ func getSloFromResourceData(d *schema.ResourceData) (models.Slo, diag.Diagnostic } settings := slo.Settings{ + SyncField: getOrNilString("settings.0.sync_field", d), SyncDelay: getOrNilString("settings.0.sync_delay", d), Frequency: getOrNilString("settings.0.frequency", d), + PreventInitialBackfill: getOrNilBool("settings.0.prevent_initial_backfill", d), } budgetingMethod := slo.BudgetingMethod(d.Get("budgeting_method").(string)) @@ -904,8 +924,10 @@ func resourceSloRead(ctx context.Context, d *schema.ResourceData, meta interface if err := d.Set("settings", []interface{}{ map[string]interface{}{ + "sync_field": s.Settings.SyncField, "sync_delay": s.Settings.SyncDelay, "frequency": s.Settings.Frequency, + "prevent_initial_backfill": s.Settings.PreventInitialBackfill, }, }); err != nil { return diag.FromErr(err) diff --git a/internal/kibana/slo_test.go b/internal/kibana/slo_test.go index e1523bc7c..b886a241b 100644 --- a/internal/kibana/slo_test.go +++ b/internal/kibana/slo_test.go @@ -56,6 +56,8 @@ func TestAccResourceSlo(t *testing.T) { 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", "settings.0.sync_field", "event.ingested"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "settings.0.prevent_initial_backfill", "true"), resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "space_id", "default"), ), }, @@ -75,6 +77,8 @@ func TestAccResourceSlo(t *testing.T) { 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"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "settings.0.sync_field", "event.ingested"), + resource.TestCheckResourceAttr("elasticstack_kibana_slo.test_slo", "settings.0.prevent_initial_backfill", "false"), ), }, { @@ -361,6 +365,8 @@ func getSLOConfig(vars sloVars) string { settings { sync_delay = "5m" frequency = "5m" + sync_field = "event.ingested" + prevent_initial_backfill = true } ` } else { From 568e34368c2aaed2a678f057aa2a197876ff23cb Mon Sep 17 00:00:00 2001 From: Kevin Delemme Date: Fri, 4 Jul 2025 14:33:22 -0400 Subject: [PATCH 3/3] revert groupby --- generated/slo/model_group_by.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generated/slo/model_group_by.go b/generated/slo/model_group_by.go index 55a5d1eb3..1f631e7ec 100644 --- a/generated/slo/model_group_by.go +++ b/generated/slo/model_group_by.go @@ -43,8 +43,8 @@ func (dst *GroupBy) UnmarshalJSON(data []byte) error { // try to unmarshal data into ArrayOfString err = json.Unmarshal(data, &dst.ArrayOfString) if err == nil { - json[]string, _ := json.Marshal(dst.ArrayOfString) - if string(json[]string) == "{}" { // empty struct + jsonArraystring, _ := json.Marshal(dst.ArrayOfString) + if string(jsonArraystring) == "{}" { // empty struct dst.ArrayOfString = nil } else { match++