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 ¶
- Variables
- type CreateCrossClusterApiKey
- func (r *CreateCrossClusterApiKey) Access(access types.AccessVariant) *CreateCrossClusterApiKey
- func (r CreateCrossClusterApiKey) Do(providedCtx context.Context) (*Response, error)
- func (r *CreateCrossClusterApiKey) ErrorTrace(errortrace bool) *CreateCrossClusterApiKey
- func (r *CreateCrossClusterApiKey) Expiration(duration types.DurationVariant) *CreateCrossClusterApiKey
- func (r *CreateCrossClusterApiKey) FilterPath(filterpaths ...string) *CreateCrossClusterApiKey
- func (r *CreateCrossClusterApiKey) Header(key, value string) *CreateCrossClusterApiKey
- func (r *CreateCrossClusterApiKey) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *CreateCrossClusterApiKey) Human(human bool) *CreateCrossClusterApiKey
- func (r *CreateCrossClusterApiKey) Metadata(metadata types.MetadataVariant) *CreateCrossClusterApiKey
- func (r *CreateCrossClusterApiKey) Name(name string) *CreateCrossClusterApiKey
- func (r CreateCrossClusterApiKey) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *CreateCrossClusterApiKey) Pretty(pretty bool) *CreateCrossClusterApiKey
- func (r *CreateCrossClusterApiKey) Raw(raw io.Reader) *CreateCrossClusterApiKey
- func (r *CreateCrossClusterApiKey) Request(req *Request) *CreateCrossClusterApiKey
- type NewCreateCrossClusterApiKey
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
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 ¶
func New(tp elastictransport.Interface) *CreateCrossClusterApiKey
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.
func (*CreateCrossClusterApiKey) Access ¶
func (r *CreateCrossClusterApiKey) Access(access types.AccessVariant) *CreateCrossClusterApiKey
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 ¶
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 ¶
func (r *CreateCrossClusterApiKey) Expiration(duration types.DurationVariant) *CreateCrossClusterApiKey
Expiration time for the API key. By default, API keys never expire. API name: expiration
func (*CreateCrossClusterApiKey) FilterPath ¶
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 ¶
func (r *CreateCrossClusterApiKey) Header(key, value string) *CreateCrossClusterApiKey
Header set a key, value pair in the CreateCrossClusterApiKey headers map.
func (*CreateCrossClusterApiKey) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*CreateCrossClusterApiKey) Human ¶
func (r *CreateCrossClusterApiKey) Human(human bool) *CreateCrossClusterApiKey
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 ¶
func (r *CreateCrossClusterApiKey) Metadata(metadata types.MetadataVariant) *CreateCrossClusterApiKey
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 ¶
func (r *CreateCrossClusterApiKey) Name(name string) *CreateCrossClusterApiKey
Specifies the name for this API key. API name: name
func (CreateCrossClusterApiKey) Perform ¶
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*CreateCrossClusterApiKey) Pretty ¶
func (r *CreateCrossClusterApiKey) Pretty(pretty bool) *CreateCrossClusterApiKey
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 ¶
func (r *CreateCrossClusterApiKey) Raw(raw io.Reader) *CreateCrossClusterApiKey
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 ¶
func (r *CreateCrossClusterApiKey) Request(req *Request) *CreateCrossClusterApiKey
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 ¶
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
func (*Request) UnmarshalJSON ¶
type Response ¶
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