putrole

package
v8.17.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Overview

Create or update roles.

The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. The create or update roles API cannot update roles that are defined in roles files. File-based role management is not available in Elastic Serverless.

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 NewPutRole

type NewPutRole func(name string) *PutRole

NewPutRole type alias for index.

func NewPutRoleFunc

func NewPutRoleFunc(tp elastictransport.Interface) NewPutRole

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

type PutRole

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

func New

Create or update roles.

The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. The create or update roles API cannot update roles that are defined in roles files. File-based role management is not available in Elastic Serverless.

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

func (*PutRole) Applications added in v8.9.0

func (r *PutRole) Applications(applications ...types.ApplicationPrivileges) *PutRole

Applications A list of application privilege entries. API name: applications

func (*PutRole) Cluster added in v8.9.0

func (r *PutRole) Cluster(clusters ...clusterprivilege.ClusterPrivilege) *PutRole

Cluster A list of cluster privileges. These privileges define the cluster-level actions for users with this role. API name: cluster

func (*PutRole) Description added in v8.15.0

func (r *PutRole) Description(description string) *PutRole

Description Optional description of the role descriptor API name: description

func (PutRole) Do

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

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

func (*PutRole) ErrorTrace added in v8.14.0

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

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

func (*PutRole) FilterPath added in v8.14.0

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

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

func (*PutRole) Global added in v8.9.0

func (r *PutRole) Global(global map[string]json.RawMessage) *PutRole

Global An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges. API name: global

func (*PutRole) Header

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

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

func (*PutRole) HttpRequest

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

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

func (*PutRole) Human added in v8.14.0

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

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 (*PutRole) Indices added in v8.9.0

func (r *PutRole) Indices(indices ...types.IndicesPrivileges) *PutRole

Indices A list of indices permissions entries. API name: indices

func (*PutRole) Metadata added in v8.9.0

func (r *PutRole) Metadata(metadata types.Metadata) *PutRole

Metadata Optional metadata. Within the metadata object, keys that begin with an underscore (`_`) are reserved for system use. API name: metadata

func (PutRole) Perform added in v8.7.0

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

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

func (*PutRole) Pretty added in v8.14.0

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

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

func (*PutRole) Raw

func (r *PutRole) Raw(raw io.Reader) *PutRole

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

func (*PutRole) Refresh

func (r *PutRole) Refresh(refresh refresh.Refresh) *PutRole

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

func (r *PutRole) RemoteCluster(remoteclusters ...types.RemoteClusterPrivileges) *PutRole

RemoteCluster A list of remote cluster permissions entries. API name: remote_cluster

func (*PutRole) RemoteIndices added in v8.16.0

func (r *PutRole) RemoteIndices(remoteindices ...types.RemoteIndicesPrivileges) *PutRole

RemoteIndices A list of remote indices permissions entries. API name: remote_indices

func (*PutRole) Request

func (r *PutRole) Request(req *Request) *PutRole

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

func (*PutRole) RunAs added in v8.9.0

func (r *PutRole) RunAs(runas ...string) *PutRole

RunAs A list of users that the owners of this role can impersonate. *Note*: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty `run_as` field, but a non-empty list will be rejected. API name: run_as

func (*PutRole) TransientMetadata added in v8.9.0

func (r *PutRole) TransientMetadata(transientmetadata map[string]json.RawMessage) *PutRole

TransientMetadata Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If `enabled` is `false`, the role is ignored, but is still listed in the response from the authenticate API. API name: transient_metadata

type Request

type Request struct {

	// Applications A list of application privilege entries.
	Applications []types.ApplicationPrivileges `json:"applications,omitempty"`
	// Cluster A list of cluster privileges. These privileges define the cluster-level
	// actions for users with this role.
	Cluster []clusterprivilege.ClusterPrivilege `json:"cluster,omitempty"`
	// Description Optional description of the role descriptor
	Description *string `json:"description,omitempty"`
	// Global An object defining global privileges. A global privilege is a form of cluster
	// privilege that is request-aware. Support for global privileges is currently
	// limited to the management of application privileges.
	Global map[string]json.RawMessage `json:"global,omitempty"`
	// Indices A list of indices permissions entries.
	Indices []types.IndicesPrivileges `json:"indices,omitempty"`
	// Metadata Optional metadata. Within the metadata object, keys that begin with an
	// underscore (`_`) are reserved for system use.
	Metadata types.Metadata `json:"metadata,omitempty"`
	// RemoteCluster A list of remote cluster permissions entries.
	RemoteCluster []types.RemoteClusterPrivileges `json:"remote_cluster,omitempty"`
	// RemoteIndices A list of remote indices permissions entries.
	RemoteIndices []types.RemoteIndicesPrivileges `json:"remote_indices,omitempty"`
	// RunAs A list of users that the owners of this role can impersonate. *Note*: in
	// Serverless, the run-as feature is disabled. For API compatibility, you can
	// still specify an empty `run_as` field, but a non-empty list will be rejected.
	RunAs []string `json:"run_as,omitempty"`
	// TransientMetadata Indicates roles that might be incompatible with the current cluster license,
	// specifically roles with document and field level security. When the cluster
	// license doesn’t allow certain features for a given role, this parameter is
	// updated dynamically to list the incompatible features. If `enabled` is
	// `false`, the role is ignored, but is still listed in the response from the
	// authenticate API.
	TransientMetadata map[string]json.RawMessage `json:"transient_metadata,omitempty"`
}

Request holds the request body struct for the package putrole

https://github.com/elastic/elasticsearch-specification/blob/2f823ff6fcaa7f3f0f9b990dc90512d8901e5d64/specification/security/put_role/SecurityPutRoleRequest.ts#L32-L102

func NewRequest added in v8.5.0

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON added in v8.5.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.12.1

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

type Response added in v8.7.0

type Response struct {
	Role types.CreatedStatus `json:"role"`
}

Response holds the response body struct for the package putrole

https://github.com/elastic/elasticsearch-specification/blob/2f823ff6fcaa7f3f0f9b990dc90512d8901e5d64/specification/security/put_role/SecurityPutRoleResponse.ts#L22-L24

func NewResponse added in v8.7.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