createcrossclusterapikey

package
v8.17.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Overview

Create a cross-cluster API key.

Create an API key of the `cross_cluster` type for the API key based remote cluster access. A `cross_cluster` API key cannot be used to authenticate through the REST interface.

IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error.

Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled.

NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the `access` property.

A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds.

By default, API keys never expire. You can specify expiration information when you create the API keys.

Cross-cluster API keys can only be updated with the update cross-cluster API key API. Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error.

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 CreateCrossClusterApiKey

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

func New

Create a cross-cluster API key.

Create an API key of the `cross_cluster` type for the API key based remote cluster access. A `cross_cluster` API key cannot be used to authenticate through the REST interface.

IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error.

Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled.

NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the `access` property.

A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds.

By default, API keys never expire. You can specify expiration information when you create the API keys.

Cross-cluster API keys can only be updated with the update cross-cluster API key API. Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error.

https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-cross-cluster-api-key.html

func (*CreateCrossClusterApiKey) Access added in v8.17.0

Access The access to be granted to this API key. The access is composed of permissions for cross-cluster search and cross-cluster replication. At least one of them must be specified.

NOTE: No explicit privileges should be specified for either search or replication access. The creation process automatically converts the access specification to a role descriptor which has relevant privileges assigned accordingly. API name: access

func (CreateCrossClusterApiKey) Do

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

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

func (*CreateCrossClusterApiKey) ErrorTrace added in v8.17.0

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

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

func (*CreateCrossClusterApiKey) Expiration added in v8.17.0

Expiration Expiration time for the API key. By default, API keys never expire. API name: expiration

func (*CreateCrossClusterApiKey) FilterPath added in v8.17.0

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

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

func (*CreateCrossClusterApiKey) Header

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

func (*CreateCrossClusterApiKey) HttpRequest

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

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

func (*CreateCrossClusterApiKey) Human added in v8.17.0

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 (*CreateCrossClusterApiKey) Metadata added in v8.17.0

Metadata Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with `_` are reserved for system usage. API name: metadata

func (*CreateCrossClusterApiKey) Name added in v8.17.0

Name Specifies the name for this API key. API name: name

func (CreateCrossClusterApiKey) Perform

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

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

func (*CreateCrossClusterApiKey) Pretty added in v8.17.0

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

func (*CreateCrossClusterApiKey) Raw added in v8.17.0

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

func (*CreateCrossClusterApiKey) Request added in v8.17.0

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

type NewCreateCrossClusterApiKey

type NewCreateCrossClusterApiKey func() *CreateCrossClusterApiKey

NewCreateCrossClusterApiKey type alias for index.

func NewCreateCrossClusterApiKeyFunc

func NewCreateCrossClusterApiKeyFunc(tp elastictransport.Interface) NewCreateCrossClusterApiKey

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

type Request added in v8.17.0

type Request struct {

	// Access The access to be granted to this API key.
	// The access is composed of permissions for cross-cluster search and
	// cross-cluster replication.
	// At least one of them must be specified.
	//
	// NOTE: No explicit privileges should be specified for either search or
	// replication access.
	// The creation process automatically converts the access specification to a
	// role descriptor which has relevant privileges assigned accordingly.
	Access types.Access `json:"access"`
	// Expiration Expiration time for the API key.
	// By default, API keys never expire.
	Expiration types.Duration `json:"expiration,omitempty"`
	// Metadata Arbitrary metadata that you want to associate with the API key.
	// It supports nested data structure.
	// Within the metadata object, keys beginning with `_` are reserved for system
	// usage.
	Metadata types.Metadata `json:"metadata,omitempty"`
	// Name Specifies the name for this API key.
	Name string `json:"name"`
}

Request holds the request body struct for the package createcrossclusterapikey

https://github.com/elastic/elasticsearch-specification/blob/2f823ff6fcaa7f3f0f9b990dc90512d8901e5d64/specification/security/create_cross_cluster_api_key/CreateCrossClusterApiKeyRequest.ts#L25-L73

func NewRequest added in v8.17.0

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON added in v8.17.0

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

FromJSON allows to load an arbitrary json into the request structure

func (*Request) UnmarshalJSON added in v8.17.0

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

type Response added in v8.17.0

type Response struct {

	// ApiKey Generated API key.
	ApiKey string `json:"api_key"`
	// Encoded API key credentials which is the base64-encoding of
	// the UTF-8 representation of `id` and `api_key` joined
	// by a colon (`:`).
	Encoded string `json:"encoded"`
	// Expiration Expiration in milliseconds for the API key.
	Expiration *int64 `json:"expiration,omitempty"`
	// Id Unique ID for this API key.
	Id string `json:"id"`
	// Name Specifies the name for this API key.
	Name string `json:"name"`
}

Response holds the response body struct for the package createcrossclusterapikey

https://github.com/elastic/elasticsearch-specification/blob/2f823ff6fcaa7f3f0f9b990dc90512d8901e5d64/specification/security/create_cross_cluster_api_key/CreateCrossClusterApiKeyResponse.ts#L23-L48

func NewResponse added in v8.17.0

func NewResponse() *Response

NewResponse returns a Response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL