bulkupdateapikeys

package
v9.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Bulk update API keys. Update the attributes for multiple API keys.

IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required.

This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates.

It is not possible to update expired or invalidated API keys.

This API supports updates to API key access scope, metadata and expiration. The access scope of each API key is derived from the `role_descriptors` you specify in the request and a snapshot of the owner user's permissions at the time of the request. The snapshot of the owner's permissions is updated automatically on every call.

IMPORTANT: If you don't specify `role_descriptors` in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified.

A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update.

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildPath = errors.New("cannot build path, check for missing path parameters")

ErrBuildPath is returned in case of missing parameters within the build of the request.

Functions

This section is empty.

Types

type BulkUpdateApiKeys

type BulkUpdateApiKeys struct {
	// contains filtered or unexported fields
}

func New

Bulk update API keys. Update the attributes for multiple API keys.

IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required.

This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates.

It is not possible to update expired or invalidated API keys.

This API supports updates to API key access scope, metadata and expiration. The access scope of each API key is derived from the `role_descriptors` you specify in the request and a snapshot of the owner user's permissions at the time of the request. The snapshot of the owner's permissions is updated automatically on every call.

IMPORTANT: If you don't specify `role_descriptors` in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified.

A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update.

https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-security-bulk-update-api-keys

func (*BulkUpdateApiKeys) AddRoleDescriptor

func (r *BulkUpdateApiKeys) AddRoleDescriptor(key string, value types.RoleDescriptorVariant) *BulkUpdateApiKeys

func (BulkUpdateApiKeys) Do

func (r BulkUpdateApiKeys) Do(providedCtx context.Context) (*Response, error)

Do runs the request through the transport, handle the response and returns a bulkupdateapikeys.Response

func (*BulkUpdateApiKeys) ErrorTrace

func (r *BulkUpdateApiKeys) ErrorTrace(errortrace bool) *BulkUpdateApiKeys

ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errors when they occur. API name: error_trace

func (*BulkUpdateApiKeys) Expiration

func (r *BulkUpdateApiKeys) Expiration(duration types.DurationVariant) *BulkUpdateApiKeys

Expiration time for the API keys. By default, API keys never expire. This property can be omitted to leave the value unchanged. API name: expiration

func (*BulkUpdateApiKeys) FilterPath

func (r *BulkUpdateApiKeys) FilterPath(filterpaths ...string) *BulkUpdateApiKeys

FilterPath Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch. API name: filter_path

func (*BulkUpdateApiKeys) Header

func (r *BulkUpdateApiKeys) Header(key, value string) *BulkUpdateApiKeys

Header set a key, value pair in the BulkUpdateApiKeys headers map.

func (*BulkUpdateApiKeys) HttpRequest

func (r *BulkUpdateApiKeys) HttpRequest(ctx context.Context) (*http.Request, error)

HttpRequest returns the http.Request object built from the given parameters.

func (*BulkUpdateApiKeys) Human

func (r *BulkUpdateApiKeys) Human(human bool) *BulkUpdateApiKeys

Human When set to `true` will return statistics in a format suitable for humans. For example `"exists_time": "1h"` for humans and `"eixsts_time_in_millis": 3600000` for computers. When disabled the human readable values will be omitted. This makes sense for responses being consumed only by machines. API name: human

func (*BulkUpdateApiKeys) Ids

func (r *BulkUpdateApiKeys) Ids(ids ...string) *BulkUpdateApiKeys

The API key identifiers. API name: ids

func (*BulkUpdateApiKeys) Metadata

Arbitrary nested metadata to associate with the API keys. Within the `metadata` object, top-level keys beginning with an underscore (`_`) are reserved for system usage. Any information specified with this parameter fully replaces metadata previously associated with the API key. API name: metadata

func (BulkUpdateApiKeys) Perform

func (r BulkUpdateApiKeys) Perform(providedCtx context.Context) (*http.Response, error)

Perform runs the http.Request through the provided transport and returns an http.Response.

func (*BulkUpdateApiKeys) Pretty

func (r *BulkUpdateApiKeys) Pretty(pretty bool) *BulkUpdateApiKeys

Pretty If set to `true` the returned JSON will be "pretty-formatted". Only use this option for debugging only. API name: pretty

func (*BulkUpdateApiKeys) Raw

Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.

func (*BulkUpdateApiKeys) Request

func (r *BulkUpdateApiKeys) Request(req *Request) *BulkUpdateApiKeys

Request allows to set the request property with the appropriate payload.

func (*BulkUpdateApiKeys) RoleDescriptors

func (r *BulkUpdateApiKeys) RoleDescriptors(roledescriptors map[string]types.RoleDescriptor) *BulkUpdateApiKeys

The role descriptors to assign to the API keys. An API key's effective permissions are an intersection of its assigned privileges and the point-in-time snapshot of permissions of the owner user. You can assign new privileges by specifying them in this parameter. To remove assigned privileges, supply the `role_descriptors` parameter as an empty object `{}`. If an API key has no assigned privileges, it inherits the owner user's full permissions. The snapshot of the owner's permissions is always updated, whether you supply the `role_descriptors` parameter. The structure of a role descriptor is the same as the request for the create API keys API. API name: role_descriptors

type NewBulkUpdateApiKeys

type NewBulkUpdateApiKeys func() *BulkUpdateApiKeys

NewBulkUpdateApiKeys type alias for index.

func NewBulkUpdateApiKeysFunc

func NewBulkUpdateApiKeysFunc(tp elastictransport.Interface) NewBulkUpdateApiKeys

NewBulkUpdateApiKeysFunc returns a new instance of BulkUpdateApiKeys with the provided transport. Used in the index of the library this allows to retrieve every apis in once place.

type Request

type Request struct {

	// Expiration Expiration time for the API keys.
	// By default, API keys never expire.
	// This property can be omitted to leave the value unchanged.
	Expiration types.Duration `json:"expiration,omitempty"`
	// Ids The API key identifiers.
	Ids []string `json:"ids"`
	// Metadata Arbitrary nested metadata to associate with the API keys.
	// Within the `metadata` object, top-level keys beginning with an underscore
	// (`_`) are reserved for system usage.
	// Any information specified with this parameter fully replaces metadata
	// previously associated with the API key.
	Metadata types.Metadata `json:"metadata,omitempty"`
	// RoleDescriptors The role descriptors to assign to the API keys.
	// An API key's effective permissions are an intersection of its assigned
	// privileges and the point-in-time snapshot of permissions of the owner user.
	// You can assign new privileges by specifying them in this parameter.
	// To remove assigned privileges, supply the `role_descriptors` parameter as an
	// empty object `{}`.
	// If an API key has no assigned privileges, it inherits the owner user's full
	// permissions.
	// The snapshot of the owner's permissions is always updated, whether you supply
	// the `role_descriptors` parameter.
	// The structure of a role descriptor is the same as the request for the create
	// API keys API.
	RoleDescriptors map[string]types.RoleDescriptor `json:"role_descriptors,omitempty"`
}

Request holds the request body struct for the package bulkupdateapikeys

https://github.com/elastic/elasticsearch-specification/blob/52c473efb1fb5320a5bac12572d0b285882862fb/specification/security/bulk_update_api_keys/SecurityBulkUpdateApiKeysRequest.ts#L26-L83

func NewRequest

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON

func (r *Request) FromJSON(data string) (*Request, error)

FromJSON allows to load an arbitrary json into the request structure

func (*Request) UnmarshalJSON

func (s *Request) UnmarshalJSON(data []byte) error

type Response

type Response struct {
	Errors  *types.BulkError `json:"errors,omitempty"`
	Noops   []string         `json:"noops"`
	Updated []string         `json:"updated"`
}

Response holds the response body struct for the package bulkupdateapikeys

https://github.com/elastic/elasticsearch-specification/blob/52c473efb1fb5320a5bac12572d0b285882862fb/specification/security/bulk_update_api_keys/SecurityBulkUpdateApiKeysResponse.ts#L22-L28

func NewResponse

func NewResponse() *Response

NewResponse returns a Response