Documentation
¶
Overview ¶
Invalidate API keys.
This API invalidates API keys created by the create API key or grant API key APIs. Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. The `manage_api_key` privilege allows deleting any API keys. The `manage_own_api_key` only allows deleting API keys that are owned by the user. In addition, with the `manage_own_api_key` privilege, an invalidation request must be issued in one of the three formats: - Set the parameter `owner=true`. - Or, set both `username` and `realm_name` to match the user’s identity. - Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the `ids` field.
Index ¶
- Variables
- type InvalidateApiKey
- func (r InvalidateApiKey) Do(providedCtx context.Context) (*Response, error)
- func (r *InvalidateApiKey) ErrorTrace(errortrace bool) *InvalidateApiKey
- func (r *InvalidateApiKey) FilterPath(filterpaths ...string) *InvalidateApiKey
- func (r *InvalidateApiKey) Header(key, value string) *InvalidateApiKey
- func (r *InvalidateApiKey) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *InvalidateApiKey) Human(human bool) *InvalidateApiKey
- func (r *InvalidateApiKey) Id(id string) *InvalidateApiKey
- func (r *InvalidateApiKey) Ids(ids ...string) *InvalidateApiKey
- func (r *InvalidateApiKey) Name(name string) *InvalidateApiKey
- func (r *InvalidateApiKey) Owner(owner bool) *InvalidateApiKey
- func (r InvalidateApiKey) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *InvalidateApiKey) Pretty(pretty bool) *InvalidateApiKey
- func (r *InvalidateApiKey) Raw(raw io.Reader) *InvalidateApiKey
- func (r *InvalidateApiKey) RealmName(realmname string) *InvalidateApiKey
- func (r *InvalidateApiKey) Request(req *Request) *InvalidateApiKey
- func (r *InvalidateApiKey) Username(username string) *InvalidateApiKey
- type NewInvalidateApiKey
- 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 InvalidateApiKey ¶
type InvalidateApiKey struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *InvalidateApiKey
Invalidate API keys.
This API invalidates API keys created by the create API key or grant API key APIs. Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted. The `manage_api_key` privilege allows deleting any API keys. The `manage_own_api_key` only allows deleting API keys that are owned by the user. In addition, with the `manage_own_api_key` privilege, an invalidation request must be issued in one of the three formats: - Set the parameter `owner=true`. - Or, set both `username` and `realm_name` to match the user’s identity. - Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the `ids` field.
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-api-key.html
func (InvalidateApiKey) Do ¶
func (r InvalidateApiKey) Do(providedCtx context.Context) (*Response, error)
Do runs the request through the transport, handle the response and returns a invalidateapikey.Response
func (*InvalidateApiKey) ErrorTrace ¶ added in v8.14.0
func (r *InvalidateApiKey) ErrorTrace(errortrace bool) *InvalidateApiKey
ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errors when they occur. API name: error_trace
func (*InvalidateApiKey) FilterPath ¶ added in v8.14.0
func (r *InvalidateApiKey) FilterPath(filterpaths ...string) *InvalidateApiKey
FilterPath Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch. API name: filter_path
func (*InvalidateApiKey) Header ¶
func (r *InvalidateApiKey) Header(key, value string) *InvalidateApiKey
Header set a key, value pair in the InvalidateApiKey headers map.
func (*InvalidateApiKey) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*InvalidateApiKey) Human ¶ added in v8.14.0
func (r *InvalidateApiKey) Human(human bool) *InvalidateApiKey
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 (*InvalidateApiKey) Id ¶ added in v8.9.0
func (r *InvalidateApiKey) Id(id string) *InvalidateApiKey
API name: id
func (*InvalidateApiKey) Ids ¶ added in v8.9.0
func (r *InvalidateApiKey) Ids(ids ...string) *InvalidateApiKey
Ids A list of API key ids. This parameter cannot be used with any of `name`, `realm_name`, or `username`. API name: ids
func (*InvalidateApiKey) Name ¶ added in v8.9.0
func (r *InvalidateApiKey) Name(name string) *InvalidateApiKey
Name An API key name. This parameter cannot be used with any of `ids`, `realm_name` or `username`. API name: name
func (*InvalidateApiKey) Owner ¶ added in v8.9.0
func (r *InvalidateApiKey) Owner(owner bool) *InvalidateApiKey
Owner Can be used to query API keys owned by the currently authenticated user. The `realm_name` or `username` parameters cannot be specified when this parameter is set to `true` as they are assumed to be the currently authenticated ones. API name: owner
func (InvalidateApiKey) Perform ¶ added in v8.7.0
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*InvalidateApiKey) Pretty ¶ added in v8.14.0
func (r *InvalidateApiKey) Pretty(pretty bool) *InvalidateApiKey
Pretty If set to `true` the returned JSON will be "pretty-formatted". Only use this option for debugging only. API name: pretty
func (*InvalidateApiKey) Raw ¶
func (r *InvalidateApiKey) Raw(raw io.Reader) *InvalidateApiKey
Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.
func (*InvalidateApiKey) RealmName ¶ added in v8.9.0
func (r *InvalidateApiKey) RealmName(realmname string) *InvalidateApiKey
RealmName The name of an authentication realm. This parameter cannot be used with either `ids` or `name`, or when `owner` flag is set to `true`. API name: realm_name
func (*InvalidateApiKey) Request ¶
func (r *InvalidateApiKey) Request(req *Request) *InvalidateApiKey
Request allows to set the request property with the appropriate payload.
func (*InvalidateApiKey) Username ¶ added in v8.9.0
func (r *InvalidateApiKey) Username(username string) *InvalidateApiKey
Username The username of a user. This parameter cannot be used with either `ids` or `name`, or when `owner` flag is set to `true`. API name: username
type NewInvalidateApiKey ¶
type NewInvalidateApiKey func() *InvalidateApiKey
NewInvalidateApiKey type alias for index.
func NewInvalidateApiKeyFunc ¶
func NewInvalidateApiKeyFunc(tp elastictransport.Interface) NewInvalidateApiKey
NewInvalidateApiKeyFunc returns a new instance of InvalidateApiKey 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 { Id *string `json:"id,omitempty"` // Ids A list of API key ids. // This parameter cannot be used with any of `name`, `realm_name`, or // `username`. Ids []string `json:"ids,omitempty"` // Name An API key name. // This parameter cannot be used with any of `ids`, `realm_name` or `username`. Name *string `json:"name,omitempty"` // Owner Can be used to query API keys owned by the currently authenticated user. // The `realm_name` or `username` parameters cannot be specified when this // parameter is set to `true` as they are assumed to be the currently // authenticated ones. Owner *bool `json:"owner,omitempty"` // RealmName The name of an authentication realm. // This parameter cannot be used with either `ids` or `name`, or when `owner` // flag is set to `true`. RealmName *string `json:"realm_name,omitempty"` // Username The username of a user. // This parameter cannot be used with either `ids` or `name`, or when `owner` // flag is set to `true`. Username *string `json:"username,omitempty"` }
Request holds the request body struct for the package invalidateapikey
func (*Request) FromJSON ¶ added in v8.5.0
FromJSON allows to load an arbitrary json into the request structure
func (*Request) UnmarshalJSON ¶ added in v8.12.1
type Response ¶ added in v8.7.0
type Response struct { ErrorCount int `json:"error_count"` ErrorDetails []types.ErrorCause `json:"error_details,omitempty"` InvalidatedApiKeys []string `json:"invalidated_api_keys"` PreviouslyInvalidatedApiKeys []string `json:"previously_invalidated_api_keys"` }
Response holds the response body struct for the package invalidateapikey