Documentation ¶
Overview ¶
Creates a bearer token for access without requiring basic authentication.
Index ¶
- Variables
- type GetToken
- func (r GetToken) Do(providedCtx context.Context) (*Response, error)
- func (r *GetToken) GrantType(granttype accesstokengranttype.AccessTokenGrantType) *GetToken
- func (r *GetToken) Header(key, value string) *GetToken
- func (r *GetToken) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *GetToken) KerberosTicket(kerberosticket string) *GetToken
- func (r *GetToken) Password(password string) *GetToken
- func (r GetToken) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *GetToken) Raw(raw io.Reader) *GetToken
- func (r *GetToken) RefreshToken(refreshtoken string) *GetToken
- func (r *GetToken) Request(req *Request) *GetToken
- func (r *GetToken) Scope(scope string) *GetToken
- func (r *GetToken) Username(username string) *GetToken
- type NewGetToken
- 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 GetToken ¶
type GetToken struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *GetToken
Creates a bearer token for access without requiring basic authentication.
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html
func (GetToken) Do ¶
Do runs the request through the transport, handle the response and returns a gettoken.Response
func (*GetToken) GrantType ¶ added in v8.9.0
func (r *GetToken) GrantType(granttype accesstokengranttype.AccessTokenGrantType) *GetToken
API name: grant_type
func (*GetToken) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*GetToken) KerberosTicket ¶ added in v8.9.0
API name: kerberos_ticket
func (GetToken) Perform ¶ added in v8.7.0
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*GetToken) 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 (*GetToken) RefreshToken ¶ added in v8.9.0
API name: refresh_token
type NewGetToken ¶
type NewGetToken func() *GetToken
NewGetToken type alias for index.
func NewGetTokenFunc ¶
func NewGetTokenFunc(tp elastictransport.Interface) NewGetToken
NewGetTokenFunc returns a new instance of GetToken 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 { GrantType *accesstokengranttype.AccessTokenGrantType `json:"grant_type,omitempty"` KerberosTicket *string `json:"kerberos_ticket,omitempty"` Password *string `json:"password,omitempty"` RefreshToken *string `json:"refresh_token,omitempty"` Scope *string `json:"scope,omitempty"` Username *string `json:"username,omitempty"` }
Request holds the request body struct for the package gettoken
type Response ¶ added in v8.7.0
type Response struct { AccessToken string `json:"access_token"` Authentication types.AuthenticatedUser `json:"authentication"` ExpiresIn int64 `json:"expires_in"` KerberosAuthenticationResponseToken *string `json:"kerberos_authentication_response_token,omitempty"` RefreshToken *string `json:"refresh_token,omitempty"` Scope *string `json:"scope,omitempty"` Type string `json:"type"` }
Response holds the response body struct for the package gettoken