createapikey

package
v8.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Overview

Creates an API key for access without requiring basic authentication.

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 CreateApiKey

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

func New

Creates an API key for access without requiring basic authentication.

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

func (CreateApiKey) Do

Do runs the http.Request through the provided transport.

func (*CreateApiKey) Header

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

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

func (*CreateApiKey) HttpRequest

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

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

func (*CreateApiKey) 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 (*CreateApiKey) Refresh

func (r *CreateApiKey) Refresh(enum refresh.Refresh) *CreateApiKey

Refresh If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. API name: refresh

func (*CreateApiKey) Request

func (r *CreateApiKey) Request(req *Request) *CreateApiKey

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

type NewCreateApiKey

type NewCreateApiKey func() *CreateApiKey

NewCreateApiKey type alias for index.

func NewCreateApiKeyFunc

func NewCreateApiKeyFunc(tp elastictransport.Interface) NewCreateApiKey

NewCreateApiKeyFunc returns a new instance of CreateApiKey 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 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 map[string]interface{} `json:"metadata,omitempty"`
	// Name Specifies the name for this API key.
	Name *string `json:"name,omitempty"`
	// RoleDescriptors An array of role descriptors for this API key. This parameter is optional.
	// When it is not specified or is an empty array, then the API key will have a
	// point in time snapshot of permissions of the authenticated user. If you
	// supply role descriptors then the resultant permissions would be an
	// intersection of API keys permissions and authenticated user’s permissions
	// thereby limiting the access scope for API keys. The structure of role
	// descriptor is the same as the request for create role API. For more details,
	// see create or update roles API.
	RoleDescriptors map[string]types.RoleDescriptor `json:"role_descriptors,omitempty"`
}

Request holds the request body struct for the package createapikey

https://github.com/elastic/elasticsearch-specification/blob/7f49eec1f23a5ae155001c058b3196d85981d5c2/specification/security/create_api_key/SecurityCreateApiKeyRequest.ts#L26-L51

func NewRequest added in v8.5.0

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON added in v8.5.0

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

FromJSON allows to load an arbitrary json into the request structure

Jump to

Keyboard shortcuts

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