From 00cb58368ebad3d2f17ce7b60c105080c3aac58f Mon Sep 17 00:00:00 2001 From: Toby Brain Date: Mon, 5 Feb 2024 19:31:45 +1100 Subject: [PATCH 1/6] Update api spec to include spaces in operation paths --- generated/data_views/bundled.yaml | 250 ++++++++++++++++-------------- 1 file changed, 137 insertions(+), 113 deletions(-) diff --git a/generated/data_views/bundled.yaml b/generated/data_views/bundled.yaml index 4ed7552d2..b98135605 100644 --- a/generated/data_views/bundled.yaml +++ b/generated/data_views/bundled.yaml @@ -17,7 +17,7 @@ tags: - name: data views description: Data view APIs enable you to manage data views, formerly known as Kibana index patterns. paths: - /api/data_views: + /s/{spaceId}/api/data_views: get: summary: Retrieves a list of all data views. operationId: getAllDataViews @@ -25,6 +25,8 @@ paths: This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. tags: - data views + parameters: + - $ref: '#/components/parameters/space_id' responses: '200': description: Indicates a successful call. @@ -59,7 +61,7 @@ paths: application/json: schema: $ref: '#/components/schemas/400_response' - /api/data_views/data_view: + /s/{spaceId}/api/data_views/data_view: post: summary: Creates a data view. operationId: createDataView @@ -69,6 +71,7 @@ paths: - data views parameters: - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' requestBody: required: true content: @@ -91,7 +94,7 @@ paths: application/json: schema: $ref: '#/components/schemas/400_response' - /api/data_views/data_view/{viewId}: + /s/{spaceId}/api/data_views/data_view/{viewId}: get: summary: Retrieves a single data view by identifier. operationId: getDataView @@ -101,6 +104,7 @@ paths: - data views parameters: - $ref: '#/components/parameters/view_id' + - $ref: '#/components/parameters/space_id' responses: '200': description: Indicates a successful call. @@ -127,6 +131,7 @@ paths: parameters: - $ref: '#/components/parameters/kbn_xsrf' - $ref: '#/components/parameters/view_id' + - $ref: '#/components/parameters/space_id' responses: '204': description: Indicates a successful call. @@ -146,6 +151,7 @@ paths: parameters: - $ref: '#/components/parameters/kbn_xsrf' - $ref: '#/components/parameters/view_id' + - $ref: '#/components/parameters/space_id' requestBody: required: true content: @@ -168,7 +174,84 @@ paths: application/json: schema: $ref: '#/components/schemas/400_response' - /api/data_views/data_view/{viewId}/fields: + /s/{spaceId}/api/data_views/default: + get: + summary: Retrieves the default data view identifier. + operationId: getDefaultDataView + description: | + This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. + tags: + - data views + parameters: + - $ref: '#/components/parameters/space_id' + responses: + '200': + description: Indicates a successful call. + content: + application/json: + schema: + type: object + properties: + data_view_id: + type: string + examples: + getDefaultDataViewResponse: + $ref: '#/components/examples/get_default_data_view_response' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' + post: + summary: Sets the default data view identifier. + operationId: setDefaultDatailView + description: | + This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. + tags: + - data views + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - data_view_id + properties: + data_view_id: + type: + - string + - 'null' + description: | + The data view identifier. NOTE: The API does not validate whether it is a valid identifier. Use `null` to unset the default data view. + force: + type: boolean + description: Update an existing default data view identifier. + default: false + examples: + setDefaultDataViewRequest: + $ref: '#/components/examples/set_default_data_view_request' + responses: + '200': + description: Indicates a successful call. + content: + application/json: + schema: + type: object + properties: + acknowledged: + type: boolean + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' + /s/{spaceId}/api/data_views/data_view/{viewId}/fields: post: summary: Update fields presentation metadata such as count, customLabel and format. operationId: updateFieldsMetadata @@ -179,6 +262,7 @@ paths: parameters: - $ref: '#/components/parameters/kbn_xsrf' - $ref: '#/components/parameters/view_id' + - $ref: '#/components/parameters/space_id' requestBody: required: true content: @@ -210,7 +294,7 @@ paths: application/json: schema: $ref: '#/components/schemas/400_response' - /api/data_views/data_view/{viewId}/runtime_field: + /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field: post: summary: Creates a runtime field. operationId: createRuntimeField @@ -221,6 +305,7 @@ paths: parameters: - $ref: '#/components/parameters/kbn_xsrf' - $ref: '#/components/parameters/view_id' + - $ref: '#/components/parameters/space_id' requestBody: required: true content: @@ -251,6 +336,7 @@ paths: - data views parameters: - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/space_id' - name: viewId in: path description: | @@ -302,7 +388,7 @@ paths: application/json: schema: $ref: '#/components/schemas/400_response' - /api/data_views/data_view/{viewId}/runtime_field/{fieldName}: + /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field/{fieldName}: get: summary: Retrieves a runtime field. operationId: getRuntimeField @@ -313,6 +399,7 @@ paths: parameters: - $ref: '#/components/parameters/field_name' - $ref: '#/components/parameters/view_id' + - $ref: '#/components/parameters/space_id' responses: '200': description: Indicates a successful call. @@ -346,6 +433,7 @@ paths: parameters: - $ref: '#/components/parameters/field_name' - $ref: '#/components/parameters/view_id' + - $ref: '#/components/parameters/space_id' responses: '200': description: Indicates a successful call. @@ -365,6 +453,7 @@ paths: parameters: - $ref: '#/components/parameters/field_name' - $ref: '#/components/parameters/view_id' + - $ref: '#/components/parameters/space_id' requestBody: required: true content: @@ -395,80 +484,6 @@ paths: application/json: schema: $ref: '#/components/schemas/400_response' - /api/data_views/default: - get: - summary: Retrieves the default data view identifier. - operationId: getDefaultDataView - description: | - This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. - tags: - - data views - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - type: object - properties: - data_view_id: - type: string - examples: - getDefaultDataViewResponse: - $ref: '#/components/examples/get_default_data_view_response' - '400': - description: Bad request - content: - application/json: - schema: - $ref: '#/components/schemas/400_response' - post: - summary: Sets the default data view identifier. - operationId: setDefaultDatailView - description: | - This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. - tags: - - data views - parameters: - - $ref: '#/components/parameters/kbn_xsrf' - requestBody: - required: true - content: - application/json: - schema: - type: object - required: - - data_view_id - properties: - data_view_id: - type: - - string - - 'null' - description: | - The data view identifier. NOTE: The API does not validate whether it is a valid identifier. Use `null` to unset the default data view. - force: - type: boolean - description: Update an existing default data view identifier. - default: false - examples: - setDefaultDataViewRequest: - $ref: '#/components/examples/set_default_data_view_request' - responses: - '200': - description: Indicates a successful call. - content: - application/json: - schema: - type: object - properties: - acknowledged: - type: boolean - '400': - description: Bad request - content: - application/json: - schema: - $ref: '#/components/schemas/400_response' components: securitySchemes: basicAuth: @@ -479,6 +494,39 @@ components: in: header name: Authorization description: 'e.g. Authorization: ApiKey base64AccessApiKey' + parameters: + 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 + examples: + - default + kbn_xsrf: + schema: + type: string + in: header + name: kbn-xsrf + description: Cross-site request forgery protection + required: true + view_id: + in: path + name: viewId + description: An identifier for the data view. + required: true + schema: + type: string + example: ff959d40-b880-11e8-a6d9-e546fe2bba5f + field_name: + in: path + name: fieldName + description: The name of the runtime field. + required: true + schema: + type: string + example: hour_of_day examples: get_data_views_response: summary: The get all data views API returns a list of data views. @@ -1447,6 +1495,15 @@ components: allowNoIndex: false name: Kibana Sample Data eCommerce refresh_fields: true + get_default_data_view_response: + summary: The get default data view API returns the default data view identifier. + value: + data_view_id: ff959d40-b880-11e8-a6d9-e546fe2bba5f + set_default_data_view_request: + summary: Set the default data view identifier. + value: + data_view_id: ff959d40-b880-11e8-a6d9-e546fe2bba5f + force: true update_field_metadata_request: summary: Set popularity count for field foo. value: @@ -1973,15 +2030,6 @@ components: runtimeField: script: source: emit(doc["bar"].value) - get_default_data_view_response: - summary: The get default data view API returns the default data view identifier. - value: - data_view_id: ff959d40-b880-11e8-a6d9-e546fe2bba5f - set_default_data_view_request: - summary: Set the default data view identifier. - value: - data_view_id: ff959d40-b880-11e8-a6d9-e546fe2bba5f - force: true schemas: 400_response: title: Bad request @@ -2171,27 +2219,3 @@ components: type: boolean description: Reloads the data view fields after the data view is updated. default: false - parameters: - kbn_xsrf: - schema: - type: string - in: header - name: kbn-xsrf - description: Cross-site request forgery protection - required: true - view_id: - in: path - name: viewId - description: An identifier for the data view. - required: true - schema: - type: string - example: ff959d40-b880-11e8-a6d9-e546fe2bba5f - field_name: - in: path - name: fieldName - description: The name of the runtime field. - required: true - schema: - type: string - example: hour_of_day From 376b0f729825710c5758b038f535960cb6c9f36d Mon Sep 17 00:00:00 2001 From: Toby Brain Date: Mon, 5 Feb 2024 19:31:58 +1100 Subject: [PATCH 2/6] Regenerate client --- generated/data_views/.openapi-generator/FILES | 4 +- generated/data_views/README.md | 28 +- generated/data_views/api/openapi.yaml | 333 ++++++++++++------ generated/data_views/api_data_views.go | 167 ++++++--- generated/data_views/docs/DataViewsAPI.md | 147 +++++--- .../docs/SetDefaultDatailView200Response.md | 56 +++ ...el_set_default_datail_view_200_response.go | 124 +++++++ 7 files changed, 645 insertions(+), 214 deletions(-) create mode 100644 generated/data_views/docs/SetDefaultDatailView200Response.md create mode 100644 generated/data_views/model_set_default_datail_view_200_response.go diff --git a/generated/data_views/.openapi-generator/FILES b/generated/data_views/.openapi-generator/FILES index 6f95fb7ed..0de6b469a 100644 --- a/generated/data_views/.openapi-generator/FILES +++ b/generated/data_views/.openapi-generator/FILES @@ -17,11 +17,11 @@ docs/GetAllDataViews200ResponseDataViewInner.md docs/GetDefaultDataView200Response.md docs/Model400Response.md docs/Model404Response.md +docs/SetDefaultDatailView200Response.md docs/SetDefaultDatailViewRequest.md docs/SourcefiltersInner.md docs/UpdateDataViewRequestObject.md docs/UpdateDataViewRequestObjectDataView.md -docs/UpdateFieldsMetadata200Response.md docs/UpdateFieldsMetadataRequest.md docs/UpdateRuntimeFieldRequest.md git_push.sh @@ -38,11 +38,11 @@ model_data_view_response_object_data_view.go model_get_all_data_views_200_response.go model_get_all_data_views_200_response_data_view_inner.go model_get_default_data_view_200_response.go +model_set_default_datail_view_200_response.go model_set_default_datail_view_request.go model_sourcefilters_inner.go model_update_data_view_request_object.go model_update_data_view_request_object_data_view.go -model_update_fields_metadata_200_response.go model_update_fields_metadata_request.go model_update_runtime_field_request.go response.go diff --git a/generated/data_views/README.md b/generated/data_views/README.md index 571c95cf8..93b07ea26 100644 --- a/generated/data_views/README.md +++ b/generated/data_views/README.md @@ -77,19 +77,19 @@ All URIs are relative to *http://localhost* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*DataViewsAPI* | [**CreateDataView**](docs/DataViewsAPI.md#createdataview) | **Post** /api/data_views/data_view | Creates a data view. -*DataViewsAPI* | [**CreateRuntimeField**](docs/DataViewsAPI.md#createruntimefield) | **Post** /api/data_views/data_view/{viewId}/runtime_field | Creates a runtime field. -*DataViewsAPI* | [**CreateUpdateRuntimeField**](docs/DataViewsAPI.md#createupdateruntimefield) | **Put** /api/data_views/data_view/{viewId}/runtime_field | Create or update an existing runtime field. -*DataViewsAPI* | [**DeleteDataView**](docs/DataViewsAPI.md#deletedataview) | **Delete** /api/data_views/data_view/{viewId} | Deletes a data view. -*DataViewsAPI* | [**DeleteRuntimeField**](docs/DataViewsAPI.md#deleteruntimefield) | **Delete** /api/data_views/data_view/{viewId}/runtime_field/{fieldName} | Delete a runtime field from a data view. -*DataViewsAPI* | [**GetAllDataViews**](docs/DataViewsAPI.md#getalldataviews) | **Get** /api/data_views | Retrieves a list of all data views. -*DataViewsAPI* | [**GetDataView**](docs/DataViewsAPI.md#getdataview) | **Get** /api/data_views/data_view/{viewId} | Retrieves a single data view by identifier. -*DataViewsAPI* | [**GetDefaultDataView**](docs/DataViewsAPI.md#getdefaultdataview) | **Get** /api/data_views/default | Retrieves the default data view identifier. -*DataViewsAPI* | [**GetRuntimeField**](docs/DataViewsAPI.md#getruntimefield) | **Get** /api/data_views/data_view/{viewId}/runtime_field/{fieldName} | Retrieves a runtime field. -*DataViewsAPI* | [**SetDefaultDatailView**](docs/DataViewsAPI.md#setdefaultdatailview) | **Post** /api/data_views/default | Sets the default data view identifier. -*DataViewsAPI* | [**UpdateDataView**](docs/DataViewsAPI.md#updatedataview) | **Post** /api/data_views/data_view/{viewId} | Updates a data view. -*DataViewsAPI* | [**UpdateFieldsMetadata**](docs/DataViewsAPI.md#updatefieldsmetadata) | **Post** /api/data_views/data_view/{viewId}/fields | Update fields presentation metadata such as count, customLabel and format. -*DataViewsAPI* | [**UpdateRuntimeField**](docs/DataViewsAPI.md#updateruntimefield) | **Post** /api/data_views/data_view/{viewId}/runtime_field/{fieldName} | Update an existing runtime field. +*DataViewsAPI* | [**CreateDataView**](docs/DataViewsAPI.md#createdataview) | **Post** /s/{spaceId}/api/data_views/data_view | Creates a data view. +*DataViewsAPI* | [**CreateRuntimeField**](docs/DataViewsAPI.md#createruntimefield) | **Post** /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field | Creates a runtime field. +*DataViewsAPI* | [**CreateUpdateRuntimeField**](docs/DataViewsAPI.md#createupdateruntimefield) | **Put** /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field | Create or update an existing runtime field. +*DataViewsAPI* | [**DeleteDataView**](docs/DataViewsAPI.md#deletedataview) | **Delete** /s/{spaceId}/api/data_views/data_view/{viewId} | Deletes a data view. +*DataViewsAPI* | [**DeleteRuntimeField**](docs/DataViewsAPI.md#deleteruntimefield) | **Delete** /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field/{fieldName} | Delete a runtime field from a data view. +*DataViewsAPI* | [**GetAllDataViews**](docs/DataViewsAPI.md#getalldataviews) | **Get** /s/{spaceId}/api/data_views | Retrieves a list of all data views. +*DataViewsAPI* | [**GetDataView**](docs/DataViewsAPI.md#getdataview) | **Get** /s/{spaceId}/api/data_views/data_view/{viewId} | Retrieves a single data view by identifier. +*DataViewsAPI* | [**GetDefaultDataView**](docs/DataViewsAPI.md#getdefaultdataview) | **Get** /s/{spaceId}/api/data_views/default | Retrieves the default data view identifier. +*DataViewsAPI* | [**GetRuntimeField**](docs/DataViewsAPI.md#getruntimefield) | **Get** /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field/{fieldName} | Retrieves a runtime field. +*DataViewsAPI* | [**SetDefaultDatailView**](docs/DataViewsAPI.md#setdefaultdatailview) | **Post** /s/{spaceId}/api/data_views/default | Sets the default data view identifier. +*DataViewsAPI* | [**UpdateDataView**](docs/DataViewsAPI.md#updatedataview) | **Post** /s/{spaceId}/api/data_views/data_view/{viewId} | Updates a data view. +*DataViewsAPI* | [**UpdateFieldsMetadata**](docs/DataViewsAPI.md#updatefieldsmetadata) | **Post** /s/{spaceId}/api/data_views/data_view/{viewId}/fields | Update fields presentation metadata such as count, customLabel and format. +*DataViewsAPI* | [**UpdateRuntimeField**](docs/DataViewsAPI.md#updateruntimefield) | **Post** /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field/{fieldName} | Update an existing runtime field. ## Documentation For Models @@ -105,11 +105,11 @@ Class | Method | HTTP request | Description - [GetDefaultDataView200Response](docs/GetDefaultDataView200Response.md) - [Model400Response](docs/Model400Response.md) - [Model404Response](docs/Model404Response.md) + - [SetDefaultDatailView200Response](docs/SetDefaultDatailView200Response.md) - [SetDefaultDatailViewRequest](docs/SetDefaultDatailViewRequest.md) - [SourcefiltersInner](docs/SourcefiltersInner.md) - [UpdateDataViewRequestObject](docs/UpdateDataViewRequestObject.md) - [UpdateDataViewRequestObjectDataView](docs/UpdateDataViewRequestObjectDataView.md) - - [UpdateFieldsMetadata200Response](docs/UpdateFieldsMetadata200Response.md) - [UpdateFieldsMetadataRequest](docs/UpdateFieldsMetadataRequest.md) - [UpdateRuntimeFieldRequest](docs/UpdateRuntimeFieldRequest.md) diff --git a/generated/data_views/api/openapi.yaml b/generated/data_views/api/openapi.yaml index f50282b10..5bab9687f 100644 --- a/generated/data_views/api/openapi.yaml +++ b/generated/data_views/api/openapi.yaml @@ -18,11 +18,21 @@ tags: \ Kibana index patterns." name: data views paths: - /api/data_views: + /s/{spaceId}/api/data_views: get: description: | This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. operationId: getAllDataViews + parameters: + - 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: + type: string + style: simple responses: "200": content: @@ -42,7 +52,7 @@ paths: summary: Retrieves a list of all data views. tags: - data views - /api/data_views/data_view: + /s/{spaceId}/api/data_views/data_view: post: description: | This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. @@ -56,6 +66,15 @@ paths: 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: + type: string + style: simple requestBody: content: application/json: @@ -81,7 +100,7 @@ paths: summary: Creates a data view. tags: - data views - /api/data_views/data_view/{viewId}: + /s/{spaceId}/api/data_views/data_view/{viewId}: delete: description: | WARNING: When you delete a data view, it cannot be recovered. This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. @@ -104,6 +123,15 @@ paths: example: ff959d40-b880-11e8-a6d9-e546fe2bba5f 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: + type: string + style: simple responses: "204": description: Indicates a successful call. @@ -130,6 +158,15 @@ paths: example: ff959d40-b880-11e8-a6d9-e546fe2bba5f 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: + type: string + style: simple responses: "200": content: @@ -171,6 +208,15 @@ paths: example: ff959d40-b880-11e8-a6d9-e546fe2bba5f 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: + type: string + style: simple requestBody: content: application/json: @@ -196,7 +242,88 @@ paths: summary: Updates a data view. tags: - data views - /api/data_views/data_view/{viewId}/fields: + /s/{spaceId}/api/data_views/default: + get: + description: | + This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. + operationId: getDefaultDataView + parameters: + - 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: + type: string + style: simple + responses: + "200": + content: + application/json: + examples: + getDefaultDataViewResponse: + $ref: '#/components/examples/get_default_data_view_response' + schema: + $ref: '#/components/schemas/getDefaultDataView_200_response' + description: Indicates a successful call. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' + description: Bad request + summary: Retrieves the default data view identifier. + tags: + - data views + post: + description: | + This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. + operationId: setDefaultDatailView + 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: + type: string + style: simple + requestBody: + content: + application/json: + examples: + setDefaultDataViewRequest: + $ref: '#/components/examples/set_default_data_view_request' + schema: + $ref: '#/components/schemas/setDefaultDatailView_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/setDefaultDatailView_200_response' + description: Indicates a successful call. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' + description: Bad request + summary: Sets the default data view identifier. + tags: + - data views + /s/{spaceId}/api/data_views/data_view/{viewId}/fields: post: description: | This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. You can update multiple fields in one request. Updates are merged with persisted metadata. To remove existing metadata, specify null as the value. @@ -219,6 +346,15 @@ paths: example: ff959d40-b880-11e8-a6d9-e546fe2bba5f 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: + type: string + style: simple requestBody: content: application/json: @@ -233,7 +369,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/updateFieldsMetadata_200_response' + $ref: '#/components/schemas/setDefaultDatailView_200_response' description: Indicates a successful call. "400": content: @@ -245,7 +381,7 @@ paths: \ format." tags: - data views - /api/data_views/data_view/{viewId}/runtime_field: + /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field: post: description: | This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. @@ -268,6 +404,15 @@ paths: example: ff959d40-b880-11e8-a6d9-e546fe2bba5f 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: + type: string + style: simple requestBody: content: application/json: @@ -293,6 +438,15 @@ paths: 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: + type: string + style: simple - description: | The ID of the data view fields you want to update. explode: false @@ -330,7 +484,7 @@ paths: summary: Create or update an existing runtime field. tags: - data views - /api/data_views/data_view/{viewId}/runtime_field/{fieldName}: + /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field/{fieldName}: delete: description: | This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. @@ -354,6 +508,15 @@ paths: example: ff959d40-b880-11e8-a6d9-e546fe2bba5f 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: + type: string + style: simple responses: "200": description: Indicates a successful call. @@ -389,6 +552,15 @@ paths: example: ff959d40-b880-11e8-a6d9-e546fe2bba5f 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: + type: string + style: simple responses: "200": content: @@ -431,60 +603,11 @@ paths: example: ff959d40-b880-11e8-a6d9-e546fe2bba5f type: string style: simple - requestBody: - content: - application/json: - examples: - updateRuntimeFieldRequest: - $ref: '#/components/examples/update_runtime_field_request' - schema: - $ref: '#/components/schemas/updateRuntimeField_request' - required: true - responses: - "200": - description: Indicates a successful call. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/400_response' - description: Bad request - summary: Update an existing runtime field. - tags: - - data views - /api/data_views/default: - get: - description: | - This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. - operationId: getDefaultDataView - responses: - "200": - content: - application/json: - examples: - getDefaultDataViewResponse: - $ref: '#/components/examples/get_default_data_view_response' - schema: - $ref: '#/components/schemas/getDefaultDataView_200_response' - description: Indicates a successful call. - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/400_response' - description: Bad request - summary: Retrieves the default data view identifier. - tags: - - data views - post: - description: | - This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. - operationId: setDefaultDatailView - parameters: - - description: Cross-site request forgery protection + - description: "An identifier for the space. If `/s/` and the identifier are\ + \ omitted from the path, the default space is used." explode: false - in: header - name: kbn-xsrf + in: path + name: spaceId required: true schema: type: string @@ -493,17 +616,13 @@ paths: content: application/json: examples: - setDefaultDataViewRequest: - $ref: '#/components/examples/set_default_data_view_request' + updateRuntimeFieldRequest: + $ref: '#/components/examples/update_runtime_field_request' schema: - $ref: '#/components/schemas/setDefaultDatailView_request' + $ref: '#/components/schemas/updateRuntimeField_request' required: true responses: "200": - content: - application/json: - schema: - $ref: '#/components/schemas/updateFieldsMetadata_200_response' description: Indicates a successful call. "400": content: @@ -511,7 +630,7 @@ paths: schema: $ref: '#/components/schemas/400_response' description: Bad request - summary: Sets the default data view identifier. + summary: Update an existing runtime field. tags: - data views components: @@ -1484,6 +1603,15 @@ components: allowNoIndex: false name: Kibana Sample Data eCommerce refresh_fields: true + get_default_data_view_response: + summary: The get default data view API returns the default data view identifier. + value: + data_view_id: ff959d40-b880-11e8-a6d9-e546fe2bba5f + set_default_data_view_request: + summary: Set the default data view identifier. + value: + data_view_id: ff959d40-b880-11e8-a6d9-e546fe2bba5f + force: true update_field_metadata_request: summary: Set popularity count for field foo. value: @@ -2012,16 +2140,17 @@ components: runtimeField: script: source: "emit(doc[\"bar\"].value)" - get_default_data_view_response: - summary: The get default data view API returns the default data view identifier. - value: - data_view_id: ff959d40-b880-11e8-a6d9-e546fe2bba5f - set_default_data_view_request: - summary: Set the default data view identifier. - value: - data_view_id: ff959d40-b880-11e8-a6d9-e546fe2bba5f - force: true parameters: + 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: + type: string + style: simple kbn_xsrf: description: Cross-site request forgery protection explode: false @@ -2219,21 +2348,40 @@ components: $ref: '#/components/schemas/getAllDataViews_200_response_data_view_inner' type: array type: object - updateFieldsMetadata_request: + getDefaultDataView_200_response: + example: + data_view_id: data_view_id properties: - fields: - description: The field object. - type: object + data_view_id: + type: string + type: object + setDefaultDatailView_request: + properties: + data_view_id: + description: | + The data view identifier. NOTE: The API does not validate whether it is a valid identifier. Use `null` to unset the default data view. + force: + default: false + description: Update an existing default data view identifier. + type: boolean required: - - fields + - data_view_id type: object - updateFieldsMetadata_200_response: + setDefaultDatailView_200_response: example: acknowledged: true properties: acknowledged: type: boolean type: object + updateFieldsMetadata_request: + properties: + fields: + description: The field object. + type: object + required: + - fields + type: object createUpdateRuntimeField_request: properties: name: @@ -2276,25 +2424,6 @@ components: required: - runtimeField type: object - getDefaultDataView_200_response: - example: - data_view_id: data_view_id - properties: - data_view_id: - type: string - type: object - setDefaultDatailView_request: - properties: - data_view_id: - description: | - The data view identifier. NOTE: The API does not validate whether it is a valid identifier. Use `null` to unset the default data view. - force: - default: false - description: Update an existing default data view identifier. - type: boolean - required: - - data_view_id - type: object sourcefilters_inner: example: value: value diff --git a/generated/data_views/api_data_views.go b/generated/data_views/api_data_views.go index 0a5976513..81beddc04 100644 --- a/generated/data_views/api_data_views.go +++ b/generated/data_views/api_data_views.go @@ -28,9 +28,10 @@ type DataViewsAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiCreateDataViewRequest */ - CreateDataView(ctx context.Context) ApiCreateDataViewRequest + CreateDataView(ctx context.Context, spaceId string) ApiCreateDataViewRequest // CreateDataViewExecute executes the request // @return DataViewResponseObject @@ -44,9 +45,10 @@ type DataViewsAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiCreateRuntimeFieldRequest */ - CreateRuntimeField(ctx context.Context, viewId string) ApiCreateRuntimeFieldRequest + CreateRuntimeField(ctx context.Context, viewId string, spaceId string) ApiCreateRuntimeFieldRequest // CreateRuntimeFieldExecute executes the request CreateRuntimeFieldExecute(r ApiCreateRuntimeFieldRequest) (*http.Response, error) @@ -58,10 +60,11 @@ type DataViewsAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @param viewId The ID of the data view fields you want to update. @return ApiCreateUpdateRuntimeFieldRequest */ - CreateUpdateRuntimeField(ctx context.Context, viewId string) ApiCreateUpdateRuntimeFieldRequest + CreateUpdateRuntimeField(ctx context.Context, spaceId string, viewId string) ApiCreateUpdateRuntimeFieldRequest // CreateUpdateRuntimeFieldExecute executes the request // @return CreateUpdateRuntimeField200Response @@ -75,9 +78,10 @@ type DataViewsAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiDeleteDataViewRequest */ - DeleteDataView(ctx context.Context, viewId string) ApiDeleteDataViewRequest + DeleteDataView(ctx context.Context, viewId string, spaceId string) ApiDeleteDataViewRequest // DeleteDataViewExecute executes the request DeleteDataViewExecute(r ApiDeleteDataViewRequest) (*http.Response, error) @@ -91,9 +95,10 @@ type DataViewsAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param fieldName The name of the runtime field. @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiDeleteRuntimeFieldRequest */ - DeleteRuntimeField(ctx context.Context, fieldName string, viewId string) ApiDeleteRuntimeFieldRequest + DeleteRuntimeField(ctx context.Context, fieldName string, viewId string, spaceId string) ApiDeleteRuntimeFieldRequest // DeleteRuntimeFieldExecute executes the request DeleteRuntimeFieldExecute(r ApiDeleteRuntimeFieldRequest) (*http.Response, error) @@ -105,9 +110,10 @@ type DataViewsAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiGetAllDataViewsRequest */ - GetAllDataViews(ctx context.Context) ApiGetAllDataViewsRequest + GetAllDataViews(ctx context.Context, spaceId string) ApiGetAllDataViewsRequest // GetAllDataViewsExecute executes the request // @return GetAllDataViews200Response @@ -121,9 +127,10 @@ type DataViewsAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiGetDataViewRequest */ - GetDataView(ctx context.Context, viewId string) ApiGetDataViewRequest + GetDataView(ctx context.Context, viewId string, spaceId string) ApiGetDataViewRequest // GetDataViewExecute executes the request // @return DataViewResponseObject @@ -136,9 +143,10 @@ type DataViewsAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiGetDefaultDataViewRequest */ - GetDefaultDataView(ctx context.Context) ApiGetDefaultDataViewRequest + GetDefaultDataView(ctx context.Context, spaceId string) ApiGetDefaultDataViewRequest // GetDefaultDataViewExecute executes the request // @return GetDefaultDataView200Response @@ -153,9 +161,10 @@ type DataViewsAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param fieldName The name of the runtime field. @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiGetRuntimeFieldRequest */ - GetRuntimeField(ctx context.Context, fieldName string, viewId string) ApiGetRuntimeFieldRequest + GetRuntimeField(ctx context.Context, fieldName string, viewId string, spaceId string) ApiGetRuntimeFieldRequest // GetRuntimeFieldExecute executes the request // @return CreateUpdateRuntimeField200Response @@ -168,13 +177,14 @@ type DataViewsAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiSetDefaultDatailViewRequest */ - SetDefaultDatailView(ctx context.Context) ApiSetDefaultDatailViewRequest + SetDefaultDatailView(ctx context.Context, spaceId string) ApiSetDefaultDatailViewRequest // SetDefaultDatailViewExecute executes the request - // @return UpdateFieldsMetadata200Response - SetDefaultDatailViewExecute(r ApiSetDefaultDatailViewRequest) (*UpdateFieldsMetadata200Response, *http.Response, error) + // @return SetDefaultDatailView200Response + SetDefaultDatailViewExecute(r ApiSetDefaultDatailViewRequest) (*SetDefaultDatailView200Response, *http.Response, error) /* UpdateDataView Updates a data view. @@ -184,9 +194,10 @@ type DataViewsAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiUpdateDataViewRequest */ - UpdateDataView(ctx context.Context, viewId string) ApiUpdateDataViewRequest + UpdateDataView(ctx context.Context, viewId string, spaceId string) ApiUpdateDataViewRequest // UpdateDataViewExecute executes the request // @return DataViewResponseObject @@ -200,13 +211,14 @@ type DataViewsAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiUpdateFieldsMetadataRequest */ - UpdateFieldsMetadata(ctx context.Context, viewId string) ApiUpdateFieldsMetadataRequest + UpdateFieldsMetadata(ctx context.Context, viewId string, spaceId string) ApiUpdateFieldsMetadataRequest // UpdateFieldsMetadataExecute executes the request - // @return UpdateFieldsMetadata200Response - UpdateFieldsMetadataExecute(r ApiUpdateFieldsMetadataRequest) (*UpdateFieldsMetadata200Response, *http.Response, error) + // @return SetDefaultDatailView200Response + UpdateFieldsMetadataExecute(r ApiUpdateFieldsMetadataRequest) (*SetDefaultDatailView200Response, *http.Response, error) /* UpdateRuntimeField Update an existing runtime field. @@ -217,9 +229,10 @@ type DataViewsAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param fieldName The name of the runtime field. @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiUpdateRuntimeFieldRequest */ - UpdateRuntimeField(ctx context.Context, fieldName string, viewId string) ApiUpdateRuntimeFieldRequest + UpdateRuntimeField(ctx context.Context, fieldName string, viewId string, spaceId string) ApiUpdateRuntimeFieldRequest // UpdateRuntimeFieldExecute executes the request UpdateRuntimeFieldExecute(r ApiUpdateRuntimeFieldRequest) (*http.Response, error) @@ -232,6 +245,7 @@ type ApiCreateDataViewRequest struct { ctx context.Context ApiService DataViewsAPI kbnXsrf *string + spaceId string createDataViewRequestObject *CreateDataViewRequestObject } @@ -256,12 +270,14 @@ CreateDataView Creates a data view. This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. @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 ApiCreateDataViewRequest */ -func (a *DataViewsAPIService) CreateDataView(ctx context.Context) ApiCreateDataViewRequest { +func (a *DataViewsAPIService) CreateDataView(ctx context.Context, spaceId string) ApiCreateDataViewRequest { return ApiCreateDataViewRequest{ ApiService: a, ctx: ctx, + spaceId: spaceId, } } @@ -281,7 +297,8 @@ func (a *DataViewsAPIService) CreateDataViewExecute(r ApiCreateDataViewRequest) return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/data_views/data_view" + localVarPath := localBasePath + "/s/{spaceId}/api/data_views/data_view" + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -379,6 +396,7 @@ type ApiCreateRuntimeFieldRequest struct { ApiService DataViewsAPI kbnXsrf *string viewId string + spaceId string createUpdateRuntimeFieldRequest *CreateUpdateRuntimeFieldRequest } @@ -404,13 +422,15 @@ This functionality is in technical preview and may be changed or removed in a fu @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiCreateRuntimeFieldRequest */ -func (a *DataViewsAPIService) CreateRuntimeField(ctx context.Context, viewId string) ApiCreateRuntimeFieldRequest { +func (a *DataViewsAPIService) CreateRuntimeField(ctx context.Context, viewId string, spaceId string) ApiCreateRuntimeFieldRequest { return ApiCreateRuntimeFieldRequest{ ApiService: a, ctx: ctx, viewId: viewId, + spaceId: spaceId, } } @@ -427,8 +447,9 @@ func (a *DataViewsAPIService) CreateRuntimeFieldExecute(r ApiCreateRuntimeFieldR return nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/data_views/data_view/{viewId}/runtime_field" + localVarPath := localBasePath + "/s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field" localVarPath = strings.Replace(localVarPath, "{"+"viewId"+"}", url.PathEscape(parameterValueToString(r.viewId, "viewId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -506,6 +527,7 @@ type ApiCreateUpdateRuntimeFieldRequest struct { ctx context.Context ApiService DataViewsAPI kbnXsrf *string + spaceId string viewId string createUpdateRuntimeFieldRequest *CreateUpdateRuntimeFieldRequest } @@ -531,13 +553,15 @@ CreateUpdateRuntimeField Create or update an existing runtime field. This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. @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 viewId The ID of the data view fields you want to update. @return ApiCreateUpdateRuntimeFieldRequest */ -func (a *DataViewsAPIService) CreateUpdateRuntimeField(ctx context.Context, viewId string) ApiCreateUpdateRuntimeFieldRequest { +func (a *DataViewsAPIService) CreateUpdateRuntimeField(ctx context.Context, spaceId string, viewId string) ApiCreateUpdateRuntimeFieldRequest { return ApiCreateUpdateRuntimeFieldRequest{ ApiService: a, ctx: ctx, + spaceId: spaceId, viewId: viewId, } } @@ -558,7 +582,8 @@ func (a *DataViewsAPIService) CreateUpdateRuntimeFieldExecute(r ApiCreateUpdateR return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/data_views/data_view/{viewId}/runtime_field" + localVarPath := localBasePath + "/s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field" + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"viewId"+"}", url.PathEscape(parameterValueToString(r.viewId, "viewId")), -1) localVarHeaderParams := make(map[string]string) @@ -657,6 +682,7 @@ type ApiDeleteDataViewRequest struct { ApiService DataViewsAPI kbnXsrf *string viewId string + spaceId string } // Cross-site request forgery protection @@ -676,13 +702,15 @@ WARNING: When you delete a data view, it cannot be recovered. This functionality @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiDeleteDataViewRequest */ -func (a *DataViewsAPIService) DeleteDataView(ctx context.Context, viewId string) ApiDeleteDataViewRequest { +func (a *DataViewsAPIService) DeleteDataView(ctx context.Context, viewId string, spaceId string) ApiDeleteDataViewRequest { return ApiDeleteDataViewRequest{ ApiService: a, ctx: ctx, viewId: viewId, + spaceId: spaceId, } } @@ -699,8 +727,9 @@ func (a *DataViewsAPIService) DeleteDataViewExecute(r ApiDeleteDataViewRequest) return nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/data_views/data_view/{viewId}" + localVarPath := localBasePath + "/s/{spaceId}/api/data_views/data_view/{viewId}" localVarPath = strings.Replace(localVarPath, "{"+"viewId"+"}", url.PathEscape(parameterValueToString(r.viewId, "viewId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -784,6 +813,7 @@ type ApiDeleteRuntimeFieldRequest struct { ApiService DataViewsAPI fieldName string viewId string + spaceId string } func (r ApiDeleteRuntimeFieldRequest) Execute() (*http.Response, error) { @@ -798,14 +828,16 @@ This functionality is in technical preview and may be changed or removed in a fu @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param fieldName The name of the runtime field. @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiDeleteRuntimeFieldRequest */ -func (a *DataViewsAPIService) DeleteRuntimeField(ctx context.Context, fieldName string, viewId string) ApiDeleteRuntimeFieldRequest { +func (a *DataViewsAPIService) DeleteRuntimeField(ctx context.Context, fieldName string, viewId string, spaceId string) ApiDeleteRuntimeFieldRequest { return ApiDeleteRuntimeFieldRequest{ ApiService: a, ctx: ctx, fieldName: fieldName, viewId: viewId, + spaceId: spaceId, } } @@ -822,9 +854,10 @@ func (a *DataViewsAPIService) DeleteRuntimeFieldExecute(r ApiDeleteRuntimeFieldR return nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/data_views/data_view/{viewId}/runtime_field/{fieldName}" + localVarPath := localBasePath + "/s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field/{fieldName}" localVarPath = strings.Replace(localVarPath, "{"+"fieldName"+"}", url.PathEscape(parameterValueToString(r.fieldName, "fieldName")), -1) localVarPath = strings.Replace(localVarPath, "{"+"viewId"+"}", url.PathEscape(parameterValueToString(r.viewId, "viewId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -902,6 +935,7 @@ func (a *DataViewsAPIService) DeleteRuntimeFieldExecute(r ApiDeleteRuntimeFieldR type ApiGetAllDataViewsRequest struct { ctx context.Context ApiService DataViewsAPI + spaceId string } func (r ApiGetAllDataViewsRequest) Execute() (*GetAllDataViews200Response, *http.Response, error) { @@ -914,12 +948,14 @@ GetAllDataViews Retrieves a list of all data views. This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. @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 ApiGetAllDataViewsRequest */ -func (a *DataViewsAPIService) GetAllDataViews(ctx context.Context) ApiGetAllDataViewsRequest { +func (a *DataViewsAPIService) GetAllDataViews(ctx context.Context, spaceId string) ApiGetAllDataViewsRequest { return ApiGetAllDataViewsRequest{ ApiService: a, ctx: ctx, + spaceId: spaceId, } } @@ -939,7 +975,8 @@ func (a *DataViewsAPIService) GetAllDataViewsExecute(r ApiGetAllDataViewsRequest return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/data_views" + localVarPath := localBasePath + "/s/{spaceId}/api/data_views" + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1027,6 +1064,7 @@ type ApiGetDataViewRequest struct { ctx context.Context ApiService DataViewsAPI viewId string + spaceId string } func (r ApiGetDataViewRequest) Execute() (*DataViewResponseObject, *http.Response, error) { @@ -1040,13 +1078,15 @@ This functionality is in technical preview and may be changed or removed in a fu @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiGetDataViewRequest */ -func (a *DataViewsAPIService) GetDataView(ctx context.Context, viewId string) ApiGetDataViewRequest { +func (a *DataViewsAPIService) GetDataView(ctx context.Context, viewId string, spaceId string) ApiGetDataViewRequest { return ApiGetDataViewRequest{ ApiService: a, ctx: ctx, viewId: viewId, + spaceId: spaceId, } } @@ -1066,8 +1106,9 @@ func (a *DataViewsAPIService) GetDataViewExecute(r ApiGetDataViewRequest) (*Data return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/data_views/data_view/{viewId}" + localVarPath := localBasePath + "/s/{spaceId}/api/data_views/data_view/{viewId}" localVarPath = strings.Replace(localVarPath, "{"+"viewId"+"}", url.PathEscape(parameterValueToString(r.viewId, "viewId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1154,6 +1195,7 @@ func (a *DataViewsAPIService) GetDataViewExecute(r ApiGetDataViewRequest) (*Data type ApiGetDefaultDataViewRequest struct { ctx context.Context ApiService DataViewsAPI + spaceId string } func (r ApiGetDefaultDataViewRequest) Execute() (*GetDefaultDataView200Response, *http.Response, error) { @@ -1166,12 +1208,14 @@ GetDefaultDataView Retrieves the default data view identifier. This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. @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 ApiGetDefaultDataViewRequest */ -func (a *DataViewsAPIService) GetDefaultDataView(ctx context.Context) ApiGetDefaultDataViewRequest { +func (a *DataViewsAPIService) GetDefaultDataView(ctx context.Context, spaceId string) ApiGetDefaultDataViewRequest { return ApiGetDefaultDataViewRequest{ ApiService: a, ctx: ctx, + spaceId: spaceId, } } @@ -1191,7 +1235,8 @@ func (a *DataViewsAPIService) GetDefaultDataViewExecute(r ApiGetDefaultDataViewR return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/data_views/default" + localVarPath := localBasePath + "/s/{spaceId}/api/data_views/default" + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1280,6 +1325,7 @@ type ApiGetRuntimeFieldRequest struct { ApiService DataViewsAPI fieldName string viewId string + spaceId string } func (r ApiGetRuntimeFieldRequest) Execute() (*CreateUpdateRuntimeField200Response, *http.Response, error) { @@ -1294,14 +1340,16 @@ This functionality is in technical preview and may be changed or removed in a fu @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param fieldName The name of the runtime field. @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiGetRuntimeFieldRequest */ -func (a *DataViewsAPIService) GetRuntimeField(ctx context.Context, fieldName string, viewId string) ApiGetRuntimeFieldRequest { +func (a *DataViewsAPIService) GetRuntimeField(ctx context.Context, fieldName string, viewId string, spaceId string) ApiGetRuntimeFieldRequest { return ApiGetRuntimeFieldRequest{ ApiService: a, ctx: ctx, fieldName: fieldName, viewId: viewId, + spaceId: spaceId, } } @@ -1321,9 +1369,10 @@ func (a *DataViewsAPIService) GetRuntimeFieldExecute(r ApiGetRuntimeFieldRequest return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/data_views/data_view/{viewId}/runtime_field/{fieldName}" + localVarPath := localBasePath + "/s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field/{fieldName}" localVarPath = strings.Replace(localVarPath, "{"+"fieldName"+"}", url.PathEscape(parameterValueToString(r.fieldName, "fieldName")), -1) localVarPath = strings.Replace(localVarPath, "{"+"viewId"+"}", url.PathEscape(parameterValueToString(r.viewId, "viewId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1411,6 +1460,7 @@ type ApiSetDefaultDatailViewRequest struct { ctx context.Context ApiService DataViewsAPI kbnXsrf *string + spaceId string setDefaultDatailViewRequest *SetDefaultDatailViewRequest } @@ -1425,7 +1475,7 @@ func (r ApiSetDefaultDatailViewRequest) SetDefaultDatailViewRequest(setDefaultDa return r } -func (r ApiSetDefaultDatailViewRequest) Execute() (*UpdateFieldsMetadata200Response, *http.Response, error) { +func (r ApiSetDefaultDatailViewRequest) Execute() (*SetDefaultDatailView200Response, *http.Response, error) { return r.ApiService.SetDefaultDatailViewExecute(r) } @@ -1435,24 +1485,26 @@ SetDefaultDatailView Sets the default data view identifier. This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. @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 ApiSetDefaultDatailViewRequest */ -func (a *DataViewsAPIService) SetDefaultDatailView(ctx context.Context) ApiSetDefaultDatailViewRequest { +func (a *DataViewsAPIService) SetDefaultDatailView(ctx context.Context, spaceId string) ApiSetDefaultDatailViewRequest { return ApiSetDefaultDatailViewRequest{ ApiService: a, ctx: ctx, + spaceId: spaceId, } } // Execute executes the request // -// @return UpdateFieldsMetadata200Response -func (a *DataViewsAPIService) SetDefaultDatailViewExecute(r ApiSetDefaultDatailViewRequest) (*UpdateFieldsMetadata200Response, *http.Response, error) { +// @return SetDefaultDatailView200Response +func (a *DataViewsAPIService) SetDefaultDatailViewExecute(r ApiSetDefaultDatailViewRequest) (*SetDefaultDatailView200Response, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *UpdateFieldsMetadata200Response + localVarReturnValue *SetDefaultDatailView200Response ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataViewsAPIService.SetDefaultDatailView") @@ -1460,7 +1512,8 @@ func (a *DataViewsAPIService) SetDefaultDatailViewExecute(r ApiSetDefaultDatailV return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/data_views/default" + localVarPath := localBasePath + "/s/{spaceId}/api/data_views/default" + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1558,6 +1611,7 @@ type ApiUpdateDataViewRequest struct { ApiService DataViewsAPI kbnXsrf *string viewId string + spaceId string updateDataViewRequestObject *UpdateDataViewRequestObject } @@ -1583,13 +1637,15 @@ This functionality is in technical preview and may be changed or removed in a fu @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiUpdateDataViewRequest */ -func (a *DataViewsAPIService) UpdateDataView(ctx context.Context, viewId string) ApiUpdateDataViewRequest { +func (a *DataViewsAPIService) UpdateDataView(ctx context.Context, viewId string, spaceId string) ApiUpdateDataViewRequest { return ApiUpdateDataViewRequest{ ApiService: a, ctx: ctx, viewId: viewId, + spaceId: spaceId, } } @@ -1609,8 +1665,9 @@ func (a *DataViewsAPIService) UpdateDataViewExecute(r ApiUpdateDataViewRequest) return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/data_views/data_view/{viewId}" + localVarPath := localBasePath + "/s/{spaceId}/api/data_views/data_view/{viewId}" localVarPath = strings.Replace(localVarPath, "{"+"viewId"+"}", url.PathEscape(parameterValueToString(r.viewId, "viewId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1708,6 +1765,7 @@ type ApiUpdateFieldsMetadataRequest struct { ApiService DataViewsAPI kbnXsrf *string viewId string + spaceId string updateFieldsMetadataRequest *UpdateFieldsMetadataRequest } @@ -1722,7 +1780,7 @@ func (r ApiUpdateFieldsMetadataRequest) UpdateFieldsMetadataRequest(updateFields return r } -func (r ApiUpdateFieldsMetadataRequest) Execute() (*UpdateFieldsMetadata200Response, *http.Response, error) { +func (r ApiUpdateFieldsMetadataRequest) Execute() (*SetDefaultDatailView200Response, *http.Response, error) { return r.ApiService.UpdateFieldsMetadataExecute(r) } @@ -1733,25 +1791,27 @@ This functionality is in technical preview and may be changed or removed in a fu @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiUpdateFieldsMetadataRequest */ -func (a *DataViewsAPIService) UpdateFieldsMetadata(ctx context.Context, viewId string) ApiUpdateFieldsMetadataRequest { +func (a *DataViewsAPIService) UpdateFieldsMetadata(ctx context.Context, viewId string, spaceId string) ApiUpdateFieldsMetadataRequest { return ApiUpdateFieldsMetadataRequest{ ApiService: a, ctx: ctx, viewId: viewId, + spaceId: spaceId, } } // Execute executes the request // -// @return UpdateFieldsMetadata200Response -func (a *DataViewsAPIService) UpdateFieldsMetadataExecute(r ApiUpdateFieldsMetadataRequest) (*UpdateFieldsMetadata200Response, *http.Response, error) { +// @return SetDefaultDatailView200Response +func (a *DataViewsAPIService) UpdateFieldsMetadataExecute(r ApiUpdateFieldsMetadataRequest) (*SetDefaultDatailView200Response, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *UpdateFieldsMetadata200Response + localVarReturnValue *SetDefaultDatailView200Response ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataViewsAPIService.UpdateFieldsMetadata") @@ -1759,8 +1819,9 @@ func (a *DataViewsAPIService) UpdateFieldsMetadataExecute(r ApiUpdateFieldsMetad return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/data_views/data_view/{viewId}/fields" + localVarPath := localBasePath + "/s/{spaceId}/api/data_views/data_view/{viewId}/fields" localVarPath = strings.Replace(localVarPath, "{"+"viewId"+"}", url.PathEscape(parameterValueToString(r.viewId, "viewId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1858,6 +1919,7 @@ type ApiUpdateRuntimeFieldRequest struct { ApiService DataViewsAPI fieldName string viewId string + spaceId string updateRuntimeFieldRequest *UpdateRuntimeFieldRequest } @@ -1878,14 +1940,16 @@ This functionality is in technical preview and may be changed or removed in a fu @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param fieldName The name of the runtime field. @param viewId An identifier for the data view. + @param spaceId An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. @return ApiUpdateRuntimeFieldRequest */ -func (a *DataViewsAPIService) UpdateRuntimeField(ctx context.Context, fieldName string, viewId string) ApiUpdateRuntimeFieldRequest { +func (a *DataViewsAPIService) UpdateRuntimeField(ctx context.Context, fieldName string, viewId string, spaceId string) ApiUpdateRuntimeFieldRequest { return ApiUpdateRuntimeFieldRequest{ ApiService: a, ctx: ctx, fieldName: fieldName, viewId: viewId, + spaceId: spaceId, } } @@ -1902,9 +1966,10 @@ func (a *DataViewsAPIService) UpdateRuntimeFieldExecute(r ApiUpdateRuntimeFieldR return nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/api/data_views/data_view/{viewId}/runtime_field/{fieldName}" + localVarPath := localBasePath + "/s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field/{fieldName}" localVarPath = strings.Replace(localVarPath, "{"+"fieldName"+"}", url.PathEscape(parameterValueToString(r.fieldName, "fieldName")), -1) localVarPath = strings.Replace(localVarPath, "{"+"viewId"+"}", url.PathEscape(parameterValueToString(r.viewId, "viewId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"spaceId"+"}", url.PathEscape(parameterValueToString(r.spaceId, "spaceId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} diff --git a/generated/data_views/docs/DataViewsAPI.md b/generated/data_views/docs/DataViewsAPI.md index d0069eeaa..4892fe8cd 100644 --- a/generated/data_views/docs/DataViewsAPI.md +++ b/generated/data_views/docs/DataViewsAPI.md @@ -4,25 +4,25 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- -[**CreateDataView**](DataViewsAPI.md#CreateDataView) | **Post** /api/data_views/data_view | Creates a data view. -[**CreateRuntimeField**](DataViewsAPI.md#CreateRuntimeField) | **Post** /api/data_views/data_view/{viewId}/runtime_field | Creates a runtime field. -[**CreateUpdateRuntimeField**](DataViewsAPI.md#CreateUpdateRuntimeField) | **Put** /api/data_views/data_view/{viewId}/runtime_field | Create or update an existing runtime field. -[**DeleteDataView**](DataViewsAPI.md#DeleteDataView) | **Delete** /api/data_views/data_view/{viewId} | Deletes a data view. -[**DeleteRuntimeField**](DataViewsAPI.md#DeleteRuntimeField) | **Delete** /api/data_views/data_view/{viewId}/runtime_field/{fieldName} | Delete a runtime field from a data view. -[**GetAllDataViews**](DataViewsAPI.md#GetAllDataViews) | **Get** /api/data_views | Retrieves a list of all data views. -[**GetDataView**](DataViewsAPI.md#GetDataView) | **Get** /api/data_views/data_view/{viewId} | Retrieves a single data view by identifier. -[**GetDefaultDataView**](DataViewsAPI.md#GetDefaultDataView) | **Get** /api/data_views/default | Retrieves the default data view identifier. -[**GetRuntimeField**](DataViewsAPI.md#GetRuntimeField) | **Get** /api/data_views/data_view/{viewId}/runtime_field/{fieldName} | Retrieves a runtime field. -[**SetDefaultDatailView**](DataViewsAPI.md#SetDefaultDatailView) | **Post** /api/data_views/default | Sets the default data view identifier. -[**UpdateDataView**](DataViewsAPI.md#UpdateDataView) | **Post** /api/data_views/data_view/{viewId} | Updates a data view. -[**UpdateFieldsMetadata**](DataViewsAPI.md#UpdateFieldsMetadata) | **Post** /api/data_views/data_view/{viewId}/fields | Update fields presentation metadata such as count, customLabel and format. -[**UpdateRuntimeField**](DataViewsAPI.md#UpdateRuntimeField) | **Post** /api/data_views/data_view/{viewId}/runtime_field/{fieldName} | Update an existing runtime field. +[**CreateDataView**](DataViewsAPI.md#CreateDataView) | **Post** /s/{spaceId}/api/data_views/data_view | Creates a data view. +[**CreateRuntimeField**](DataViewsAPI.md#CreateRuntimeField) | **Post** /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field | Creates a runtime field. +[**CreateUpdateRuntimeField**](DataViewsAPI.md#CreateUpdateRuntimeField) | **Put** /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field | Create or update an existing runtime field. +[**DeleteDataView**](DataViewsAPI.md#DeleteDataView) | **Delete** /s/{spaceId}/api/data_views/data_view/{viewId} | Deletes a data view. +[**DeleteRuntimeField**](DataViewsAPI.md#DeleteRuntimeField) | **Delete** /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field/{fieldName} | Delete a runtime field from a data view. +[**GetAllDataViews**](DataViewsAPI.md#GetAllDataViews) | **Get** /s/{spaceId}/api/data_views | Retrieves a list of all data views. +[**GetDataView**](DataViewsAPI.md#GetDataView) | **Get** /s/{spaceId}/api/data_views/data_view/{viewId} | Retrieves a single data view by identifier. +[**GetDefaultDataView**](DataViewsAPI.md#GetDefaultDataView) | **Get** /s/{spaceId}/api/data_views/default | Retrieves the default data view identifier. +[**GetRuntimeField**](DataViewsAPI.md#GetRuntimeField) | **Get** /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field/{fieldName} | Retrieves a runtime field. +[**SetDefaultDatailView**](DataViewsAPI.md#SetDefaultDatailView) | **Post** /s/{spaceId}/api/data_views/default | Sets the default data view identifier. +[**UpdateDataView**](DataViewsAPI.md#UpdateDataView) | **Post** /s/{spaceId}/api/data_views/data_view/{viewId} | Updates a data view. +[**UpdateFieldsMetadata**](DataViewsAPI.md#UpdateFieldsMetadata) | **Post** /s/{spaceId}/api/data_views/data_view/{viewId}/fields | Update fields presentation metadata such as count, customLabel and format. +[**UpdateRuntimeField**](DataViewsAPI.md#UpdateRuntimeField) | **Post** /s/{spaceId}/api/data_views/data_view/{viewId}/runtime_field/{fieldName} | Update an existing runtime field. ## CreateDataView -> DataViewResponseObject CreateDataView(ctx).KbnXsrf(kbnXsrf).CreateDataViewRequestObject(createDataViewRequestObject).Execute() +> DataViewResponseObject CreateDataView(ctx, spaceId).KbnXsrf(kbnXsrf).CreateDataViewRequestObject(createDataViewRequestObject).Execute() Creates a data view. @@ -42,11 +42,12 @@ import ( func main() { kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection + spaceId := "spaceId_example" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. createDataViewRequestObject := *openapiclient.NewCreateDataViewRequestObject(*openapiclient.NewCreateDataViewRequestObjectDataView("Title_example")) // CreateDataViewRequestObject | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DataViewsAPI.CreateDataView(context.Background()).KbnXsrf(kbnXsrf).CreateDataViewRequestObject(createDataViewRequestObject).Execute() + resp, r, err := apiClient.DataViewsAPI.CreateDataView(context.Background(), spaceId).KbnXsrf(kbnXsrf).CreateDataViewRequestObject(createDataViewRequestObject).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DataViewsAPI.CreateDataView``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -59,6 +60,10 @@ func main() { ### 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 @@ -68,6 +73,7 @@ Other parameters are passed through a pointer to a apiCreateDataViewRequest stru Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **kbnXsrf** | **string** | Cross-site request forgery protection | + **createDataViewRequestObject** | [**CreateDataViewRequestObject**](CreateDataViewRequestObject.md) | | ### Return type @@ -90,7 +96,7 @@ Name | Type | Description | Notes ## CreateRuntimeField -> CreateRuntimeField(ctx, viewId).KbnXsrf(kbnXsrf).CreateUpdateRuntimeFieldRequest(createUpdateRuntimeFieldRequest).Execute() +> CreateRuntimeField(ctx, viewId, spaceId).KbnXsrf(kbnXsrf).CreateUpdateRuntimeFieldRequest(createUpdateRuntimeFieldRequest).Execute() Creates a runtime field. @@ -111,11 +117,12 @@ import ( func main() { kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection viewId := "ff959d40-b880-11e8-a6d9-e546fe2bba5f" // string | An identifier for the data view. + spaceId := "spaceId_example" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. createUpdateRuntimeFieldRequest := *openapiclient.NewCreateUpdateRuntimeFieldRequest("Name_example", map[string]interface{}(123)) // CreateUpdateRuntimeFieldRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.DataViewsAPI.CreateRuntimeField(context.Background(), viewId).KbnXsrf(kbnXsrf).CreateUpdateRuntimeFieldRequest(createUpdateRuntimeFieldRequest).Execute() + r, err := apiClient.DataViewsAPI.CreateRuntimeField(context.Background(), viewId, spaceId).KbnXsrf(kbnXsrf).CreateUpdateRuntimeFieldRequest(createUpdateRuntimeFieldRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DataViewsAPI.CreateRuntimeField``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -130,6 +137,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **viewId** | **string** | An identifier for the data view. | +**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -140,6 +148,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **kbnXsrf** | **string** | Cross-site request forgery protection | + **createUpdateRuntimeFieldRequest** | [**CreateUpdateRuntimeFieldRequest**](CreateUpdateRuntimeFieldRequest.md) | | ### Return type @@ -162,7 +171,7 @@ Name | Type | Description | Notes ## CreateUpdateRuntimeField -> CreateUpdateRuntimeField200Response CreateUpdateRuntimeField(ctx, viewId).KbnXsrf(kbnXsrf).CreateUpdateRuntimeFieldRequest(createUpdateRuntimeFieldRequest).Execute() +> CreateUpdateRuntimeField200Response CreateUpdateRuntimeField(ctx, spaceId, viewId).KbnXsrf(kbnXsrf).CreateUpdateRuntimeFieldRequest(createUpdateRuntimeFieldRequest).Execute() Create or update an existing runtime field. @@ -182,12 +191,13 @@ import ( func main() { kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection + spaceId := "spaceId_example" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. viewId := "viewId_example" // string | The ID of the data view fields you want to update. createUpdateRuntimeFieldRequest := *openapiclient.NewCreateUpdateRuntimeFieldRequest("Name_example", map[string]interface{}(123)) // CreateUpdateRuntimeFieldRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DataViewsAPI.CreateUpdateRuntimeField(context.Background(), viewId).KbnXsrf(kbnXsrf).CreateUpdateRuntimeFieldRequest(createUpdateRuntimeFieldRequest).Execute() + resp, r, err := apiClient.DataViewsAPI.CreateUpdateRuntimeField(context.Background(), spaceId, viewId).KbnXsrf(kbnXsrf).CreateUpdateRuntimeFieldRequest(createUpdateRuntimeFieldRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DataViewsAPI.CreateUpdateRuntimeField``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -203,6 +213,7 @@ func main() { 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. | **viewId** | **string** | The ID of the data view fields you want to update. | ### Other Parameters @@ -214,6 +225,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **kbnXsrf** | **string** | Cross-site request forgery protection | + **createUpdateRuntimeFieldRequest** | [**CreateUpdateRuntimeFieldRequest**](CreateUpdateRuntimeFieldRequest.md) | | ### Return type @@ -236,7 +248,7 @@ Name | Type | Description | Notes ## DeleteDataView -> DeleteDataView(ctx, viewId).KbnXsrf(kbnXsrf).Execute() +> DeleteDataView(ctx, viewId, spaceId).KbnXsrf(kbnXsrf).Execute() Deletes a data view. @@ -257,10 +269,11 @@ import ( func main() { kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection viewId := "ff959d40-b880-11e8-a6d9-e546fe2bba5f" // string | An identifier for the data view. + spaceId := "spaceId_example" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.DataViewsAPI.DeleteDataView(context.Background(), viewId).KbnXsrf(kbnXsrf).Execute() + r, err := apiClient.DataViewsAPI.DeleteDataView(context.Background(), viewId, spaceId).KbnXsrf(kbnXsrf).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DataViewsAPI.DeleteDataView``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -275,6 +288,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **viewId** | **string** | An identifier for the data view. | +**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -286,6 +300,7 @@ Name | Type | Description | Notes **kbnXsrf** | **string** | Cross-site request forgery protection | + ### Return type (empty response body) @@ -306,7 +321,7 @@ Name | Type | Description | Notes ## DeleteRuntimeField -> DeleteRuntimeField(ctx, fieldName, viewId).Execute() +> DeleteRuntimeField(ctx, fieldName, viewId, spaceId).Execute() Delete a runtime field from a data view. @@ -327,10 +342,11 @@ import ( func main() { fieldName := "hour_of_day" // string | The name of the runtime field. viewId := "ff959d40-b880-11e8-a6d9-e546fe2bba5f" // string | An identifier for the data view. + spaceId := "spaceId_example" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.DataViewsAPI.DeleteRuntimeField(context.Background(), fieldName, viewId).Execute() + r, err := apiClient.DataViewsAPI.DeleteRuntimeField(context.Background(), fieldName, viewId, spaceId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DataViewsAPI.DeleteRuntimeField``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -346,6 +362,7 @@ Name | Type | Description | Notes **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **fieldName** | **string** | The name of the runtime field. | **viewId** | **string** | An identifier for the data view. | +**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -357,6 +374,7 @@ Name | Type | Description | Notes + ### Return type (empty response body) @@ -377,7 +395,7 @@ Name | Type | Description | Notes ## GetAllDataViews -> GetAllDataViews200Response GetAllDataViews(ctx).Execute() +> GetAllDataViews200Response GetAllDataViews(ctx, spaceId).Execute() Retrieves a list of all data views. @@ -396,10 +414,11 @@ import ( ) func main() { + spaceId := "spaceId_example" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DataViewsAPI.GetAllDataViews(context.Background()).Execute() + resp, r, err := apiClient.DataViewsAPI.GetAllDataViews(context.Background(), spaceId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DataViewsAPI.GetAllDataViews``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -411,13 +430,21 @@ func main() { ### Path Parameters -This endpoint does not need any parameter. + +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 apiGetAllDataViewsRequest struct via the builder pattern +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + ### Return type [**GetAllDataViews200Response**](GetAllDataViews200Response.md) @@ -438,7 +465,7 @@ Other parameters are passed through a pointer to a apiGetAllDataViewsRequest str ## GetDataView -> DataViewResponseObject GetDataView(ctx, viewId).Execute() +> DataViewResponseObject GetDataView(ctx, viewId, spaceId).Execute() Retrieves a single data view by identifier. @@ -458,10 +485,11 @@ import ( func main() { viewId := "ff959d40-b880-11e8-a6d9-e546fe2bba5f" // string | An identifier for the data view. + spaceId := "spaceId_example" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DataViewsAPI.GetDataView(context.Background(), viewId).Execute() + resp, r, err := apiClient.DataViewsAPI.GetDataView(context.Background(), viewId, spaceId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DataViewsAPI.GetDataView``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -478,6 +506,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **viewId** | **string** | An identifier for the data view. | +**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -488,6 +517,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + ### Return type [**DataViewResponseObject**](DataViewResponseObject.md) @@ -508,7 +538,7 @@ Name | Type | Description | Notes ## GetDefaultDataView -> GetDefaultDataView200Response GetDefaultDataView(ctx).Execute() +> GetDefaultDataView200Response GetDefaultDataView(ctx, spaceId).Execute() Retrieves the default data view identifier. @@ -527,10 +557,11 @@ import ( ) func main() { + spaceId := "spaceId_example" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DataViewsAPI.GetDefaultDataView(context.Background()).Execute() + resp, r, err := apiClient.DataViewsAPI.GetDefaultDataView(context.Background(), spaceId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DataViewsAPI.GetDefaultDataView``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -542,13 +573,21 @@ func main() { ### Path Parameters -This endpoint does not need any parameter. + +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 apiGetDefaultDataViewRequest struct via the builder pattern +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + ### Return type [**GetDefaultDataView200Response**](GetDefaultDataView200Response.md) @@ -569,7 +608,7 @@ Other parameters are passed through a pointer to a apiGetDefaultDataViewRequest ## GetRuntimeField -> CreateUpdateRuntimeField200Response GetRuntimeField(ctx, fieldName, viewId).Execute() +> CreateUpdateRuntimeField200Response GetRuntimeField(ctx, fieldName, viewId, spaceId).Execute() Retrieves a runtime field. @@ -590,10 +629,11 @@ import ( func main() { fieldName := "hour_of_day" // string | The name of the runtime field. viewId := "ff959d40-b880-11e8-a6d9-e546fe2bba5f" // string | An identifier for the data view. + spaceId := "spaceId_example" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DataViewsAPI.GetRuntimeField(context.Background(), fieldName, viewId).Execute() + resp, r, err := apiClient.DataViewsAPI.GetRuntimeField(context.Background(), fieldName, viewId, spaceId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DataViewsAPI.GetRuntimeField``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -611,6 +651,7 @@ Name | Type | Description | Notes **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **fieldName** | **string** | The name of the runtime field. | **viewId** | **string** | An identifier for the data view. | +**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -622,6 +663,7 @@ Name | Type | Description | Notes + ### Return type [**CreateUpdateRuntimeField200Response**](CreateUpdateRuntimeField200Response.md) @@ -642,7 +684,7 @@ Name | Type | Description | Notes ## SetDefaultDatailView -> UpdateFieldsMetadata200Response SetDefaultDatailView(ctx).KbnXsrf(kbnXsrf).SetDefaultDatailViewRequest(setDefaultDatailViewRequest).Execute() +> SetDefaultDatailView200Response SetDefaultDatailView(ctx, spaceId).KbnXsrf(kbnXsrf).SetDefaultDatailViewRequest(setDefaultDatailViewRequest).Execute() Sets the default data view identifier. @@ -662,16 +704,17 @@ import ( func main() { kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection + spaceId := "spaceId_example" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. setDefaultDatailViewRequest := *openapiclient.NewSetDefaultDatailViewRequest(interface{}(123)) // SetDefaultDatailViewRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DataViewsAPI.SetDefaultDatailView(context.Background()).KbnXsrf(kbnXsrf).SetDefaultDatailViewRequest(setDefaultDatailViewRequest).Execute() + resp, r, err := apiClient.DataViewsAPI.SetDefaultDatailView(context.Background(), spaceId).KbnXsrf(kbnXsrf).SetDefaultDatailViewRequest(setDefaultDatailViewRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DataViewsAPI.SetDefaultDatailView``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `SetDefaultDatailView`: UpdateFieldsMetadata200Response + // response from `SetDefaultDatailView`: SetDefaultDatailView200Response fmt.Fprintf(os.Stdout, "Response from `DataViewsAPI.SetDefaultDatailView`: %v\n", resp) } ``` @@ -679,6 +722,10 @@ func main() { ### 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 @@ -688,11 +735,12 @@ Other parameters are passed through a pointer to a apiSetDefaultDatailViewReques Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **kbnXsrf** | **string** | Cross-site request forgery protection | + **setDefaultDatailViewRequest** | [**SetDefaultDatailViewRequest**](SetDefaultDatailViewRequest.md) | | ### Return type -[**UpdateFieldsMetadata200Response**](UpdateFieldsMetadata200Response.md) +[**SetDefaultDatailView200Response**](SetDefaultDatailView200Response.md) ### Authorization @@ -710,7 +758,7 @@ Name | Type | Description | Notes ## UpdateDataView -> DataViewResponseObject UpdateDataView(ctx, viewId).KbnXsrf(kbnXsrf).UpdateDataViewRequestObject(updateDataViewRequestObject).Execute() +> DataViewResponseObject UpdateDataView(ctx, viewId, spaceId).KbnXsrf(kbnXsrf).UpdateDataViewRequestObject(updateDataViewRequestObject).Execute() Updates a data view. @@ -731,11 +779,12 @@ import ( func main() { kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection viewId := "ff959d40-b880-11e8-a6d9-e546fe2bba5f" // string | An identifier for the data view. + spaceId := "spaceId_example" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. updateDataViewRequestObject := *openapiclient.NewUpdateDataViewRequestObject(*openapiclient.NewUpdateDataViewRequestObjectDataView()) // UpdateDataViewRequestObject | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DataViewsAPI.UpdateDataView(context.Background(), viewId).KbnXsrf(kbnXsrf).UpdateDataViewRequestObject(updateDataViewRequestObject).Execute() + resp, r, err := apiClient.DataViewsAPI.UpdateDataView(context.Background(), viewId, spaceId).KbnXsrf(kbnXsrf).UpdateDataViewRequestObject(updateDataViewRequestObject).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DataViewsAPI.UpdateDataView``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -752,6 +801,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **viewId** | **string** | An identifier for the data view. | +**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -762,6 +812,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **kbnXsrf** | **string** | Cross-site request forgery protection | + **updateDataViewRequestObject** | [**UpdateDataViewRequestObject**](UpdateDataViewRequestObject.md) | | ### Return type @@ -784,7 +835,7 @@ Name | Type | Description | Notes ## UpdateFieldsMetadata -> UpdateFieldsMetadata200Response UpdateFieldsMetadata(ctx, viewId).KbnXsrf(kbnXsrf).UpdateFieldsMetadataRequest(updateFieldsMetadataRequest).Execute() +> SetDefaultDatailView200Response UpdateFieldsMetadata(ctx, viewId, spaceId).KbnXsrf(kbnXsrf).UpdateFieldsMetadataRequest(updateFieldsMetadataRequest).Execute() Update fields presentation metadata such as count, customLabel and format. @@ -805,16 +856,17 @@ import ( func main() { kbnXsrf := "kbnXsrf_example" // string | Cross-site request forgery protection viewId := "ff959d40-b880-11e8-a6d9-e546fe2bba5f" // string | An identifier for the data view. + spaceId := "spaceId_example" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. updateFieldsMetadataRequest := *openapiclient.NewUpdateFieldsMetadataRequest(map[string]interface{}(123)) // UpdateFieldsMetadataRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DataViewsAPI.UpdateFieldsMetadata(context.Background(), viewId).KbnXsrf(kbnXsrf).UpdateFieldsMetadataRequest(updateFieldsMetadataRequest).Execute() + resp, r, err := apiClient.DataViewsAPI.UpdateFieldsMetadata(context.Background(), viewId, spaceId).KbnXsrf(kbnXsrf).UpdateFieldsMetadataRequest(updateFieldsMetadataRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DataViewsAPI.UpdateFieldsMetadata``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `UpdateFieldsMetadata`: UpdateFieldsMetadata200Response + // response from `UpdateFieldsMetadata`: SetDefaultDatailView200Response fmt.Fprintf(os.Stdout, "Response from `DataViewsAPI.UpdateFieldsMetadata`: %v\n", resp) } ``` @@ -826,6 +878,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **viewId** | **string** | An identifier for the data view. | +**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -836,11 +889,12 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **kbnXsrf** | **string** | Cross-site request forgery protection | + **updateFieldsMetadataRequest** | [**UpdateFieldsMetadataRequest**](UpdateFieldsMetadataRequest.md) | | ### Return type -[**UpdateFieldsMetadata200Response**](UpdateFieldsMetadata200Response.md) +[**SetDefaultDatailView200Response**](SetDefaultDatailView200Response.md) ### Authorization @@ -858,7 +912,7 @@ Name | Type | Description | Notes ## UpdateRuntimeField -> UpdateRuntimeField(ctx, fieldName, viewId).UpdateRuntimeFieldRequest(updateRuntimeFieldRequest).Execute() +> UpdateRuntimeField(ctx, fieldName, viewId, spaceId).UpdateRuntimeFieldRequest(updateRuntimeFieldRequest).Execute() Update an existing runtime field. @@ -879,11 +933,12 @@ import ( func main() { fieldName := "hour_of_day" // string | The name of the runtime field. viewId := "ff959d40-b880-11e8-a6d9-e546fe2bba5f" // string | An identifier for the data view. + spaceId := "spaceId_example" // string | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. updateRuntimeFieldRequest := *openapiclient.NewUpdateRuntimeFieldRequest(map[string]interface{}(123)) // UpdateRuntimeFieldRequest | configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - r, err := apiClient.DataViewsAPI.UpdateRuntimeField(context.Background(), fieldName, viewId).UpdateRuntimeFieldRequest(updateRuntimeFieldRequest).Execute() + r, err := apiClient.DataViewsAPI.UpdateRuntimeField(context.Background(), fieldName, viewId, spaceId).UpdateRuntimeFieldRequest(updateRuntimeFieldRequest).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DataViewsAPI.UpdateRuntimeField``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -899,6 +954,7 @@ Name | Type | Description | Notes **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **fieldName** | **string** | The name of the runtime field. | **viewId** | **string** | An identifier for the data view. | +**spaceId** | **string** | An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used. | ### Other Parameters @@ -909,6 +965,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **updateRuntimeFieldRequest** | [**UpdateRuntimeFieldRequest**](UpdateRuntimeFieldRequest.md) | | ### Return type diff --git a/generated/data_views/docs/SetDefaultDatailView200Response.md b/generated/data_views/docs/SetDefaultDatailView200Response.md new file mode 100644 index 000000000..08ee3502a --- /dev/null +++ b/generated/data_views/docs/SetDefaultDatailView200Response.md @@ -0,0 +1,56 @@ +# SetDefaultDatailView200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Acknowledged** | Pointer to **bool** | | [optional] + +## Methods + +### NewSetDefaultDatailView200Response + +`func NewSetDefaultDatailView200Response() *SetDefaultDatailView200Response` + +NewSetDefaultDatailView200Response instantiates a new SetDefaultDatailView200Response 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 + +### NewSetDefaultDatailView200ResponseWithDefaults + +`func NewSetDefaultDatailView200ResponseWithDefaults() *SetDefaultDatailView200Response` + +NewSetDefaultDatailView200ResponseWithDefaults instantiates a new SetDefaultDatailView200Response 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 + +### GetAcknowledged + +`func (o *SetDefaultDatailView200Response) GetAcknowledged() bool` + +GetAcknowledged returns the Acknowledged field if non-nil, zero value otherwise. + +### GetAcknowledgedOk + +`func (o *SetDefaultDatailView200Response) GetAcknowledgedOk() (*bool, bool)` + +GetAcknowledgedOk returns a tuple with the Acknowledged field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAcknowledged + +`func (o *SetDefaultDatailView200Response) SetAcknowledged(v bool)` + +SetAcknowledged sets Acknowledged field to given value. + +### HasAcknowledged + +`func (o *SetDefaultDatailView200Response) HasAcknowledged() bool` + +HasAcknowledged returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/generated/data_views/model_set_default_datail_view_200_response.go b/generated/data_views/model_set_default_datail_view_200_response.go new file mode 100644 index 000000000..bfd589c8d --- /dev/null +++ b/generated/data_views/model_set_default_datail_view_200_response.go @@ -0,0 +1,124 @@ +/* +Data views + +OpenAPI schema for data view endpoints + +API version: 0.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package data_views + +import ( + "encoding/json" +) + +// checks if the SetDefaultDatailView200Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SetDefaultDatailView200Response{} + +// SetDefaultDatailView200Response struct for SetDefaultDatailView200Response +type SetDefaultDatailView200Response struct { + Acknowledged *bool `json:"acknowledged,omitempty"` +} + +// NewSetDefaultDatailView200Response instantiates a new SetDefaultDatailView200Response 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 NewSetDefaultDatailView200Response() *SetDefaultDatailView200Response { + this := SetDefaultDatailView200Response{} + return &this +} + +// NewSetDefaultDatailView200ResponseWithDefaults instantiates a new SetDefaultDatailView200Response 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 NewSetDefaultDatailView200ResponseWithDefaults() *SetDefaultDatailView200Response { + this := SetDefaultDatailView200Response{} + return &this +} + +// GetAcknowledged returns the Acknowledged field value if set, zero value otherwise. +func (o *SetDefaultDatailView200Response) GetAcknowledged() bool { + if o == nil || IsNil(o.Acknowledged) { + var ret bool + return ret + } + return *o.Acknowledged +} + +// GetAcknowledgedOk returns a tuple with the Acknowledged field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SetDefaultDatailView200Response) GetAcknowledgedOk() (*bool, bool) { + if o == nil || IsNil(o.Acknowledged) { + return nil, false + } + return o.Acknowledged, true +} + +// HasAcknowledged returns a boolean if a field has been set. +func (o *SetDefaultDatailView200Response) HasAcknowledged() bool { + if o != nil && !IsNil(o.Acknowledged) { + return true + } + + return false +} + +// SetAcknowledged gets a reference to the given bool and assigns it to the Acknowledged field. +func (o *SetDefaultDatailView200Response) SetAcknowledged(v bool) { + o.Acknowledged = &v +} + +func (o SetDefaultDatailView200Response) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SetDefaultDatailView200Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Acknowledged) { + toSerialize["acknowledged"] = o.Acknowledged + } + return toSerialize, nil +} + +type NullableSetDefaultDatailView200Response struct { + value *SetDefaultDatailView200Response + isSet bool +} + +func (v NullableSetDefaultDatailView200Response) Get() *SetDefaultDatailView200Response { + return v.value +} + +func (v *NullableSetDefaultDatailView200Response) Set(val *SetDefaultDatailView200Response) { + v.value = val + v.isSet = true +} + +func (v NullableSetDefaultDatailView200Response) IsSet() bool { + return v.isSet +} + +func (v *NullableSetDefaultDatailView200Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSetDefaultDatailView200Response(val *SetDefaultDatailView200Response) *NullableSetDefaultDatailView200Response { + return &NullableSetDefaultDatailView200Response{value: val, isSet: true} +} + +func (v NullableSetDefaultDatailView200Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSetDefaultDatailView200Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} From 119ce8d435fbfd6d1b701fc3f87a04adb23b14c2 Mon Sep 17 00:00:00 2001 From: Toby Brain Date: Mon, 5 Feb 2024 19:32:04 +1100 Subject: [PATCH 3/6] Update usage --- internal/kibana/data_view/create.go | 2 +- internal/kibana/data_view/delete.go | 2 +- internal/kibana/data_view/read.go | 2 +- internal/kibana/data_view/update.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/kibana/data_view/create.go b/internal/kibana/data_view/create.go index 4243fd528..b91f5aef2 100644 --- a/internal/kibana/data_view/create.go +++ b/internal/kibana/data_view/create.go @@ -28,7 +28,7 @@ func (r *Resource) Create(ctx context.Context, request resource.CreateRequest, r apiModel, diags := model.ToCreateRequest(ctx) response.Diagnostics.Append(diags...) authCtx := r.client.SetDataviewAuthContext(ctx) - respModel, res, err := dataviewClient.CreateDataView(authCtx).CreateDataViewRequestObject(apiModel).KbnXsrf("true").Execute() + respModel, res, err := dataviewClient.CreateDataView(authCtx, model.SpaceID.ValueString()).CreateDataViewRequestObject(apiModel).KbnXsrf("true").Execute() if err != nil && res == nil { response.Diagnostics.AddError("Failed to create data view", err.Error()) return diff --git a/internal/kibana/data_view/delete.go b/internal/kibana/data_view/delete.go index 7404081f5..25bc1d048 100644 --- a/internal/kibana/data_view/delete.go +++ b/internal/kibana/data_view/delete.go @@ -25,7 +25,7 @@ func (r *Resource) Delete(ctx context.Context, request resource.DeleteRequest, r } authCtx := r.client.SetDataviewAuthContext(ctx) - res, err := dataviewClient.DeleteDataView(authCtx, model.ID.ValueString()).KbnXsrf("true").Execute() + res, err := dataviewClient.DeleteDataView(authCtx, model.ID.ValueString(), model.SpaceID.ValueString()).KbnXsrf("true").Execute() if err != nil && res == nil { response.Diagnostics.AddError("Failed to delete data view", err.Error()) } diff --git a/internal/kibana/data_view/read.go b/internal/kibana/data_view/read.go index fd2355741..a05297559 100644 --- a/internal/kibana/data_view/read.go +++ b/internal/kibana/data_view/read.go @@ -42,7 +42,7 @@ func (r *Resource) read(ctx context.Context, model tfModelV0) (*apiModelV0, diag } authCtx := r.client.SetDataviewAuthContext(ctx) - respModel, res, err := dataviewClient.GetDataView(authCtx, model.ID.ValueString()).Execute() + respModel, res, err := dataviewClient.GetDataView(authCtx, model.ID.ValueString(), model.SpaceID.ValueString()).Execute() if err != nil && res == nil { return nil, diag.Diagnostics{ diag.NewErrorDiagnostic("failed to read data view", err.Error()), diff --git a/internal/kibana/data_view/update.go b/internal/kibana/data_view/update.go index 4b69f2c05..4d3e75fca 100644 --- a/internal/kibana/data_view/update.go +++ b/internal/kibana/data_view/update.go @@ -31,7 +31,7 @@ func (r *Resource) Update(ctx context.Context, request resource.UpdateRequest, r } authCtx := r.client.SetDataviewAuthContext(ctx) - _, res, err := dataviewClient.UpdateDataView(authCtx, model.ID.ValueString()).UpdateDataViewRequestObject(apiModel).KbnXsrf("true").Execute() + _, res, err := dataviewClient.UpdateDataView(authCtx, model.ID.ValueString(), model.SpaceID.ValueString()).UpdateDataViewRequestObject(apiModel).KbnXsrf("true").Execute() if err != nil && res == nil { response.Diagnostics.AddError("Failed to update data view", err.Error()) return From c7c9924e82f30082d6f0f986d8ccc3e1f5ac66bb Mon Sep 17 00:00:00 2001 From: Toby Brain Date: Tue, 6 Feb 2024 10:01:08 +1100 Subject: [PATCH 4/6] Support imports --- internal/kibana/data_view/acc_test.go | 7 ++++++ internal/kibana/data_view/create.go | 8 ++++++- internal/kibana/data_view/delete.go | 3 ++- internal/kibana/data_view/import.go | 13 ++++++++++ internal/kibana/data_view/read.go | 4 ++-- internal/kibana/data_view/schema.go | 34 ++++++++++++++++++++------- internal/kibana/data_view/update.go | 3 ++- 7 files changed, 58 insertions(+), 14 deletions(-) create mode 100644 internal/kibana/data_view/import.go diff --git a/internal/kibana/data_view/acc_test.go b/internal/kibana/data_view/acc_test.go index 57c41465b..5d0e44a27 100644 --- a/internal/kibana/data_view/acc_test.go +++ b/internal/kibana/data_view/acc_test.go @@ -54,6 +54,13 @@ func TestAccResourceDataView(t *testing.T) { resource.TestCheckNoResourceAttr("elasticstack_kibana_data_view.dv", "data_view.runtime_field_map"), ), }, + { + SkipFunc: versionutils.CheckIfVersionIsUnsupported(minFullDataviewSupport), + Config: testAccResourceDataViewBasicDVUpdated(indexName), + ImportState: true, + ImportStateVerify: true, + ResourceName: "elasticstack_kibana_data_view.dv", + }, }, }) } diff --git a/internal/kibana/data_view/create.go b/internal/kibana/data_view/create.go index b91f5aef2..8c99f3be9 100644 --- a/internal/kibana/data_view/create.go +++ b/internal/kibana/data_view/create.go @@ -3,6 +3,7 @@ package data_view import ( "context" + "github.com/elastic/terraform-provider-elasticstack/internal/clients" "github.com/elastic/terraform-provider-elasticstack/internal/utils" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/types" @@ -40,7 +41,12 @@ func (r *Resource) Create(ctx context.Context, request resource.CreateRequest, r return } - model.ID = types.StringPointerValue(respModel.DataView.Id) + resourceID := clients.CompositeId{ + ClusterId: model.SpaceID.ValueString(), + ResourceId: *respModel.DataView.Id, + } + + model.ID = types.StringValue(resourceID.String()) readModel, diags := r.read(ctx, model) response.Diagnostics = append(response.Diagnostics, diags...) if response.Diagnostics.HasError() { diff --git a/internal/kibana/data_view/delete.go b/internal/kibana/data_view/delete.go index 25bc1d048..a30d20128 100644 --- a/internal/kibana/data_view/delete.go +++ b/internal/kibana/data_view/delete.go @@ -24,8 +24,9 @@ func (r *Resource) Delete(ctx context.Context, request resource.DeleteRequest, r return } + id, spaceID := model.getIDAndSpaceID() authCtx := r.client.SetDataviewAuthContext(ctx) - res, err := dataviewClient.DeleteDataView(authCtx, model.ID.ValueString(), model.SpaceID.ValueString()).KbnXsrf("true").Execute() + res, err := dataviewClient.DeleteDataView(authCtx, id, spaceID).KbnXsrf("true").Execute() if err != nil && res == nil { response.Diagnostics.AddError("Failed to delete data view", err.Error()) } diff --git a/internal/kibana/data_view/import.go b/internal/kibana/data_view/import.go new file mode 100644 index 000000000..38f9e5727 --- /dev/null +++ b/internal/kibana/data_view/import.go @@ -0,0 +1,13 @@ +package data_view + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" +) + +func (r *Resource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + // Retrieve import ID and save to id attribute + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) +} diff --git a/internal/kibana/data_view/read.go b/internal/kibana/data_view/read.go index a05297559..dafe9def7 100644 --- a/internal/kibana/data_view/read.go +++ b/internal/kibana/data_view/read.go @@ -40,9 +40,9 @@ func (r *Resource) read(ctx context.Context, model tfModelV0) (*apiModelV0, diag diag.NewErrorDiagnostic("unable to get data view client", err.Error()), } } - + id, spaceID := model.getIDAndSpaceID() authCtx := r.client.SetDataviewAuthContext(ctx) - respModel, res, err := dataviewClient.GetDataView(authCtx, model.ID.ValueString(), model.SpaceID.ValueString()).Execute() + respModel, res, err := dataviewClient.GetDataView(authCtx, id, spaceID).Execute() if err != nil && res == nil { return nil, diag.Diagnostics{ diag.NewErrorDiagnostic("failed to read data view", err.Error()), diff --git a/internal/kibana/data_view/schema.go b/internal/kibana/data_view/schema.go index a33e54a62..769fc0c1e 100644 --- a/internal/kibana/data_view/schema.go +++ b/internal/kibana/data_view/schema.go @@ -23,6 +23,7 @@ import ( // Ensure provider defined types fully satisfy framework interfaces var _ resource.Resource = &Resource{} var _ resource.ResourceWithConfigure = &Resource{} +var _ resource.ResourceWithImportState = &Resource{} func (r *Resource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = getSchema() @@ -255,26 +256,41 @@ func (m tfModelV0) FromResponse(ctx context.Context, resp *data_views.DataViewRe } var dataView tfDataViewV0 - if diags := m.DataView.As(ctx, &dataView, basetypes.ObjectAsOptions{}); diags.HasError() { - return apiModelV0{}, diags - } + if !m.DataView.IsNull() && !m.DataView.IsUnknown() { + if diags := m.DataView.As(ctx, &dataView, basetypes.ObjectAsOptions{}); diags.HasError() { + return apiModelV0{}, diags + } - namespaces, diags := dataView.getNamespaces(ctx) - if diags.HasError() { - return apiModelV0{}, diags - } + namespaces, diags := dataView.getNamespaces(ctx) + if diags.HasError() { + return apiModelV0{}, diags + } - dv.Namespaces = namespaces + dv.Namespaces = namespaces + } + _, spaceID := m.getIDAndSpaceID() model := apiModelV0{ ID: m.ID.ValueString(), - SpaceID: m.SpaceID.ValueString(), + SpaceID: spaceID, DataView: dv, Override: m.Override.ValueBool(), } return model, nil } +func (model tfModelV0) getIDAndSpaceID() (string, string) { + id := model.ID.ValueString() + spaceID := model.SpaceID.ValueString() + maybeCompositeID, _ := clients.CompositeIdFromStr(id) + if maybeCompositeID != nil { + id = maybeCompositeID.ResourceId + spaceID = maybeCompositeID.ClusterId + } + + return id, spaceID +} + type tfDataViewV0 struct { Title types.String `tfsdk:"title"` Name types.String `tfsdk:"name"` diff --git a/internal/kibana/data_view/update.go b/internal/kibana/data_view/update.go index 4d3e75fca..217c77229 100644 --- a/internal/kibana/data_view/update.go +++ b/internal/kibana/data_view/update.go @@ -30,8 +30,9 @@ func (r *Resource) Update(ctx context.Context, request resource.UpdateRequest, r return } + id, spaceID := model.getIDAndSpaceID() authCtx := r.client.SetDataviewAuthContext(ctx) - _, res, err := dataviewClient.UpdateDataView(authCtx, model.ID.ValueString(), model.SpaceID.ValueString()).UpdateDataViewRequestObject(apiModel).KbnXsrf("true").Execute() + _, res, err := dataviewClient.UpdateDataView(authCtx, id, spaceID).UpdateDataViewRequestObject(apiModel).KbnXsrf("true").Execute() if err != nil && res == nil { response.Diagnostics.AddError("Failed to update data view", err.Error()) return From 401870ed5c541e7517533f72d1e90931003ad729 Mon Sep 17 00:00:00 2001 From: Toby Brain Date: Tue, 6 Feb 2024 10:40:06 +1100 Subject: [PATCH 5/6] Fixup issue when dv space is not included in the namespaces --- internal/kibana/data_view/schema.go | 25 +++++++++++++++++++----- internal/kibana/data_view/schema_test.go | 6 ++++-- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/internal/kibana/data_view/schema.go b/internal/kibana/data_view/schema.go index 769fc0c1e..c12bab8b6 100644 --- a/internal/kibana/data_view/schema.go +++ b/internal/kibana/data_view/schema.go @@ -223,7 +223,7 @@ func (m tfModelV0) ToCreateRequest(ctx context.Context) (data_views.CreateDataVi return data_views.CreateDataViewRequestObject{}, diags } - dv, diags := dataView.ToCreateRequest(ctx) + dv, diags := dataView.ToCreateRequest(ctx, m.SpaceID.ValueString()) if diags.HasError() { return data_views.CreateDataViewRequestObject{}, diags } @@ -261,7 +261,7 @@ func (m tfModelV0) FromResponse(ctx context.Context, resp *data_views.DataViewRe return apiModelV0{}, diags } - namespaces, diags := dataView.getNamespaces(ctx) + namespaces, diags := dataView.getNamespaces(ctx, nil) if diags.HasError() { return apiModelV0{}, diags } @@ -402,7 +402,7 @@ func dataViewFromResponse(resp data_views.DataViewResponseObjectDataView) apiDat return dv } -func (m tfDataViewV0) ToCreateRequest(ctx context.Context) (data_views.CreateDataViewRequestObjectDataView, diag.Diagnostics) { +func (m tfDataViewV0) ToCreateRequest(ctx context.Context, spaceID string) (data_views.CreateDataViewRequestObjectDataView, diag.Diagnostics) { apiModel := data_views.CreateDataViewRequestObjectDataView{ Title: m.Title.ValueString(), Name: m.Name.ValueStringPointer(), @@ -480,7 +480,7 @@ func (m tfDataViewV0) ToCreateRequest(ctx context.Context) (data_views.CreateDat apiModel.RuntimeFieldMap = apiRuntimeFields } - namespaces, diags := m.getNamespaces(ctx) + namespaces, diags := m.getNamespaces(ctx, &spaceID) if diags.HasError() { return data_views.CreateDataViewRequestObjectDataView{}, diags } @@ -492,12 +492,27 @@ func (m tfDataViewV0) ToCreateRequest(ctx context.Context) (data_views.CreateDat return apiModel, nil } -func (m tfDataViewV0) getNamespaces(ctx context.Context) ([]string, diag.Diagnostics) { +func (m tfDataViewV0) getNamespaces(ctx context.Context, spaceID *string) ([]string, diag.Diagnostics) { var namespaces []string if diags := m.Namespaces.ElementsAs(ctx, &namespaces, true); diags.HasError() { return nil, diags } + if len(namespaces) == 0 || spaceID == nil { + return namespaces, nil + } + + includesSpaceID := false + for _, namespace := range namespaces { + if namespace == *spaceID { + includesSpaceID = true + } + } + + if !includesSpaceID { + namespaces = append(namespaces, *spaceID) + } + return namespaces, nil } diff --git a/internal/kibana/data_view/schema_test.go b/internal/kibana/data_view/schema_test.go index b8417b220..f47991717 100644 --- a/internal/kibana/data_view/schema_test.go +++ b/internal/kibana/data_view/schema_test.go @@ -21,6 +21,7 @@ func Test_tfModelV0_ToCreateRequest(t *testing.T) { { name: "all fields", model: apiModelV0{ + SpaceID: "default", DataView: apiDataViewV0{ Title: utils.Pointer("title"), Name: utils.Pointer("name"), @@ -48,7 +49,7 @@ func Test_tfModelV0_ToCreateRequest(t *testing.T) { }, }, AllowNoIndex: true, - Namespaces: []string{"default", "o11y"}, + Namespaces: []string{"backend", "o11y"}, }, }, expectedRequest: data_views.CreateDataViewRequestObject{ @@ -71,7 +72,7 @@ func Test_tfModelV0_ToCreateRequest(t *testing.T) { }, Id: utils.Pointer("id"), Name: utils.Pointer("name"), - Namespaces: []string{"default", "o11y"}, + Namespaces: []string{"backend", "o11y", "default"}, RuntimeFieldMap: map[string]interface{}{ "runtime_field": runtimeField{ Type: "keyword", @@ -92,6 +93,7 @@ func Test_tfModelV0_ToCreateRequest(t *testing.T) { { name: "nil collections", model: apiModelV0{ + SpaceID: "default", DataView: apiDataViewV0{ Title: utils.Pointer("title"), Name: utils.Pointer("name"), From e5344bae96a9ec0e57ecd2bcfd9c0ecf471ee094 Mon Sep 17 00:00:00 2001 From: Toby Brain Date: Tue, 6 Feb 2024 12:37:40 +1100 Subject: [PATCH 6/6] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dec0dd9ba..199f4b38c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Fix issue when setting `override` in `elasticstack_kibana_data_view` resource ([#550](https://github.com/elastic/terraform-provider-elasticstack/pull/550)) - Fixup typos in `elasticstack_elasticsearch_transform` and `elasticstack_kibana_security_role` docs ([#551](https://github.com/elastic/terraform-provider-elasticstack/pull/551)) - Fix issue when setting `field_attrs` in `elasticstack_kibana_data_view` resource ([#552](https://github.com/elastic/terraform-provider-elasticstack/pull/552)) +- Fixup support for managing `elasticstack_kibana_data_view` resources in non-default spaces ([#559](https://github.com/elastic/terraform-provider-elasticstack/pull/559)) ## [0.11.0] - 2023-12-12