REST API for adding objects to tenant

When asking questions, please provide the following information:

  • Search Guard and Elasticsearch version: 6.2.2

  • JVM version and operating system version: 1.8

  • Search Guard configuration files: demo

Hi!

Is there a REST api; such as the REST API to add users, roles, and mappings (https://docs.search-guard.com/latest/rest-api.html); for modifying tenants? For example, I want to automate adding index-patterns or dashboards to tenants on creation.

Many thanks!

At the moment there is no separate REST endpoint for modifying tenants (only). Tenants are part of the role definitions, so the only way at the moment is to GET a role, modify the tenants and then save it again via PUT:

···

On Monday, April 2, 2018 at 8:59:33 PM UTC+2, robert@elementdata.com wrote:

When asking questions, please provide the following information:

  • Search Guard and Elasticsearch version: 6.2.2
  • JVM version and operating system version: 1.8
  • Search Guard configuration files: demo

Hi!

Is there a REST api; such as the REST API to add users, roles, and mappings (https://docs.search-guard.com/latest/rest-api.html); for modifying tenants? For example, I want to automate adding index-patterns or dashboards to tenants on creation.

Many thanks!

But that wouldn’t modify the contents of the tenant, it would only change the tenants a role has, right?

···

On Monday, April 2, 2018 at 12:03:14 PM UTC-7, Jochen Kressin wrote:

At the moment there is no separate REST endpoint for modifying tenants (only). Tenants are part of the role definitions, so the only way at the moment is to GET a role, modify the tenants and then save it again via PUT:

https://docs.search-guard.com/latest/rest-api#put-2

On Monday, April 2, 2018 at 8:59:33 PM UTC+2, rob...@elementdata.com wrote:

When asking questions, please provide the following information:

  • Search Guard and Elasticsearch version: 6.2.2
  • JVM version and operating system version: 1.8
  • Search Guard configuration files: demo

Hi!

Is there a REST api; such as the REST API to add users, roles, and mappings (https://docs.search-guard.com/latest/rest-api.html); for modifying tenants? For example, I want to automate adding index-patterns or dashboards to tenants on creation.

Many thanks!

Ah, now I got you. For creating index patterns, dashboards etc. you can use the Kibana API for saved objects. It is not well documented, but works. You can import and export all saved object types with that.

The next version of the SG Kibana plugin (which will be released this week) will support selecting a tenant when using the Kibana saved objects API. I guess you need to wait until it is released, with the current plugin versions it’s not possible I’m afraid.

···

On Monday, April 2, 2018 at 9:15:21 PM UTC+2, robert@elementdata.com wrote:

But that wouldn’t modify the contents of the tenant, it would only change the tenants a role has, right?

On Monday, April 2, 2018 at 12:03:14 PM UTC-7, Jochen Kressin wrote:

At the moment there is no separate REST endpoint for modifying tenants (only). Tenants are part of the role definitions, so the only way at the moment is to GET a role, modify the tenants and then save it again via PUT:

https://docs.search-guard.com/latest/rest-api#put-2

On Monday, April 2, 2018 at 8:59:33 PM UTC+2, rob...@elementdata.com wrote:

When asking questions, please provide the following information:

  • Search Guard and Elasticsearch version: 6.2.2
  • JVM version and operating system version: 1.8
  • Search Guard configuration files: demo

Hi!

Is there a REST api; such as the REST API to add users, roles, and mappings (https://docs.search-guard.com/latest/rest-api.html); for modifying tenants? For example, I want to automate adding index-patterns or dashboards to tenants on creation.

Many thanks!

Great, I’ll look forward to next week’s release! Documentation would be great upon release

···

On Monday, April 2, 2018 at 12:18:51 PM UTC-7, Jochen Kressin wrote:

Ah, now I got you. For creating index patterns, dashboards etc. you can use the Kibana API for saved objects. It is not well documented, but works. You can import and export all saved object types with that.

The next version of the SG Kibana plugin (which will be released this week) will support selecting a tenant when using the Kibana saved objects API. I guess you need to wait until it is released, with the current plugin versions it’s not possible I’m afraid.

On Monday, April 2, 2018 at 9:15:21 PM UTC+2, rob...@elementdata.com wrote:

But that wouldn’t modify the contents of the tenant, it would only change the tenants a role has, right?

On Monday, April 2, 2018 at 12:03:14 PM UTC-7, Jochen Kressin wrote:

At the moment there is no separate REST endpoint for modifying tenants (only). Tenants are part of the role definitions, so the only way at the moment is to GET a role, modify the tenants and then save it again via PUT:

https://docs.search-guard.com/latest/rest-api#put-2

On Monday, April 2, 2018 at 8:59:33 PM UTC+2, rob...@elementdata.com wrote:

When asking questions, please provide the following information:

  • Search Guard and Elasticsearch version: 6.2.2
  • JVM version and operating system version: 1.8
  • Search Guard configuration files: demo

Hi!

Is there a REST api; such as the REST API to add users, roles, and mappings (https://docs.search-guard.com/latest/rest-api.html); for modifying tenants? For example, I want to automate adding index-patterns or dashboards to tenants on creation.

Many thanks!

The Kibana plugin v11 has just been released, including support for selecting tenants via HTTP headers:

Maven:

https://search.maven.org/#search|gav|1|g%3A"com.floragunn"%20AND%20a%3A"search-guard-kibana-plugin"

Release Notes:

https://docs.search-guard.com/latest/changelog-6-x-22

The documentation has been extended and includes a curl example on how to add the tenant header:

···

On Monday, April 2, 2018 at 9:24:26 PM UTC+2, robert@elementdata.com wrote:

Great, I’ll look forward to next week’s release! Documentation would be great upon release

On Monday, April 2, 2018 at 12:18:51 PM UTC-7, Jochen Kressin wrote:

Ah, now I got you. For creating index patterns, dashboards etc. you can use the Kibana API for saved objects. It is not well documented, but works. You can import and export all saved object types with that.

The next version of the SG Kibana plugin (which will be released this week) will support selecting a tenant when using the Kibana saved objects API. I guess you need to wait until it is released, with the current plugin versions it’s not possible I’m afraid.

On Monday, April 2, 2018 at 9:15:21 PM UTC+2, rob...@elementdata.com wrote:

But that wouldn’t modify the contents of the tenant, it would only change the tenants a role has, right?

On Monday, April 2, 2018 at 12:03:14 PM UTC-7, Jochen Kressin wrote:

At the moment there is no separate REST endpoint for modifying tenants (only). Tenants are part of the role definitions, so the only way at the moment is to GET a role, modify the tenants and then save it again via PUT:

https://docs.search-guard.com/latest/rest-api#put-2

On Monday, April 2, 2018 at 8:59:33 PM UTC+2, rob...@elementdata.com wrote:

When asking questions, please provide the following information:

  • Search Guard and Elasticsearch version: 6.2.2
  • JVM version and operating system version: 1.8
  • Search Guard configuration files: demo

Hi!

Is there a REST api; such as the REST API to add users, roles, and mappings (https://docs.search-guard.com/latest/rest-api.html); for modifying tenants? For example, I want to automate adding index-patterns or dashboards to tenants on creation.

Many thanks!