putrole

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Adds and updates roles in the native realm.

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 (PutRole) Do

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

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

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) Name

func (r *PutRole) Name(v string) *PutRole

Name The name of the role. API Name: name

func (PutRole) Perform

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

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

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(enum 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) Request

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

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

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"`
	// 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 map[string]json.RawMessage `json:"metadata,omitempty"`
	// RunAs A list of users that the owners of this role can impersonate.
	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 *types.TransientMetadataConfig `json:"transient_metadata,omitempty"`
}

Request holds the request body struct for the package putrole

https://github.com/elastic/elasticsearch-specification/blob/1ad7fe36297b3a8e187b2259dedaf68a47bc236e/specification/security/put_role/SecurityPutRoleRequest.ts#L31-L80

func NewRequest

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON

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

FromJSON allows to load an arbitrary json into the request structure

type Response

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

func NewResponse

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