api_auth

package
v0.0.0-...-162d0cd Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client for api auth API

func New

func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client

New creates a new api auth API client.

func (*Client) Login

func (a *Client) Login(params *LoginParams) (*LoginOK, error)

Login logins

### Present client credentials to obtain an authorization token

Looker API implements the OAuth2 [Resource Owner Password Credentials Grant](https://looker.com/docs/r/api/outh2_resource_owner_pc) pattern. The client credentials required for this login must be obtained by creating an API3 key on a user account in the Looker Admin console. The API3 key consists of a public `client_id` and a private `client_secret`.

The access token returned by `login` must be used in the HTTP Authorization header of subsequent API requests, like this: ``` Authorization: token 4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4 ``` Replace "4QDkCy..." with the `access_token` value returned by `login`. The word 'token' is a string literal and must be included exactly as shown.

For more information and detailed examples of Looker API authorization, see [How to Authenticate to Looker API3](https://github.com/looker/looker-sdk-ruby/blob/master/authentication.md).

func (*Client) LoginUser

func (a *Client) LoginUser(params *LoginUserParams) (*LoginUserOK, error)

LoginUser logins user

### Create an access token for a given user.

This can only be called by an authenticated admin user. It allows that admin to generate a new authentication token for the user with the given user id. That token can then be used for subsequent API calls - which are then performed *as* that target user.

The target user does *not* need to have a pre-existing API client_id/client_secret pair. And, no such credentials are created by this call.

This allows for building systems where api user authentication for an arbitrary number of users is done outside of Looker and funneled through a single 'service account' with admin permissions. Note that a new access token is generated on each call. If target users are going to be making numerous API calls in a short period then it is wise to cache this authentication token rather than call this before each of those API calls.

See 'login' for more detail on the access token and how to use it.

func (*Client) Logout

func (a *Client) Logout(params *LogoutParams) (*LogoutNoContent, error)

Logout logouts

### Logout of the API and invalidate the current access token.

func (*Client) SetTransport

func (a *Client) SetTransport(transport runtime.ClientTransport)

SetTransport changes the transport on the client

type LoginBadRequest

type LoginBadRequest struct {
	Payload *models.Error
}

LoginBadRequest handles this case with default header values.

Bad Request

func NewLoginBadRequest

func NewLoginBadRequest() *LoginBadRequest

NewLoginBadRequest creates a LoginBadRequest with default headers values

func (*LoginBadRequest) Error

func (o *LoginBadRequest) Error() string

type LoginNotFound

type LoginNotFound struct {
	Payload *models.Error
}

LoginNotFound handles this case with default header values.

Not Found

func NewLoginNotFound

func NewLoginNotFound() *LoginNotFound

NewLoginNotFound creates a LoginNotFound with default headers values

func (*LoginNotFound) Error

func (o *LoginNotFound) Error() string

type LoginOK

type LoginOK struct {
	Payload *models.AccessToken
}

LoginOK handles this case with default header values.

Access token with metadata.

func NewLoginOK

func NewLoginOK() *LoginOK

NewLoginOK creates a LoginOK with default headers values

func (*LoginOK) Error

func (o *LoginOK) Error() string

type LoginParams

type LoginParams struct {

	/*ClientID
	  client_id part of API3 Key.

	*/
	ClientID *string
	/*ClientSecret
	  client_secret part of API3 Key.

	*/
	ClientSecret *string

	Context    context.Context
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

LoginParams contains all the parameters to send to the API endpoint for the login operation typically these are written to a http.Request

func NewLoginParams

func NewLoginParams() *LoginParams

NewLoginParams creates a new LoginParams object with the default values initialized.

func NewLoginParamsWithContext

func NewLoginParamsWithContext(ctx context.Context) *LoginParams

NewLoginParamsWithContext creates a new LoginParams object with the default values initialized, and the ability to set a context for a request

func NewLoginParamsWithHTTPClient

func NewLoginParamsWithHTTPClient(client *http.Client) *LoginParams

NewLoginParamsWithHTTPClient creates a new LoginParams object with the default values initialized, and the ability to set a custom HTTPClient for a request

func NewLoginParamsWithTimeout

func NewLoginParamsWithTimeout(timeout time.Duration) *LoginParams

NewLoginParamsWithTimeout creates a new LoginParams object with the default values initialized, and the ability to set a timeout on a request

func (*LoginParams) SetClientID

func (o *LoginParams) SetClientID(clientID *string)

SetClientID adds the clientId to the login params

func (*LoginParams) SetClientSecret

func (o *LoginParams) SetClientSecret(clientSecret *string)

SetClientSecret adds the clientSecret to the login params

func (*LoginParams) SetContext

func (o *LoginParams) SetContext(ctx context.Context)

SetContext adds the context to the login params

func (*LoginParams) SetHTTPClient

func (o *LoginParams) SetHTTPClient(client *http.Client)

SetHTTPClient adds the HTTPClient to the login params

func (*LoginParams) SetTimeout

func (o *LoginParams) SetTimeout(timeout time.Duration)

SetTimeout adds the timeout to the login params

func (*LoginParams) WithClientID

func (o *LoginParams) WithClientID(clientID *string) *LoginParams

WithClientID adds the clientID to the login params

func (*LoginParams) WithClientSecret

func (o *LoginParams) WithClientSecret(clientSecret *string) *LoginParams

WithClientSecret adds the clientSecret to the login params

func (*LoginParams) WithContext

func (o *LoginParams) WithContext(ctx context.Context) *LoginParams

WithContext adds the context to the login params

func (*LoginParams) WithHTTPClient

func (o *LoginParams) WithHTTPClient(client *http.Client) *LoginParams

WithHTTPClient adds the HTTPClient to the login params

func (*LoginParams) WithTimeout

func (o *LoginParams) WithTimeout(timeout time.Duration) *LoginParams

WithTimeout adds the timeout to the login params

func (*LoginParams) WriteToRequest

func (o *LoginParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error

WriteToRequest writes these params to a swagger request

type LoginReader

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

LoginReader is a Reader for the Login structure.

func (*LoginReader) ReadResponse

func (o *LoginReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)

ReadResponse reads a server response into the received o.

type LoginUserBadRequest

type LoginUserBadRequest struct {
	Payload *models.Error
}

LoginUserBadRequest handles this case with default header values.

Bad Request

func NewLoginUserBadRequest

func NewLoginUserBadRequest() *LoginUserBadRequest

NewLoginUserBadRequest creates a LoginUserBadRequest with default headers values

func (*LoginUserBadRequest) Error

func (o *LoginUserBadRequest) Error() string

type LoginUserNotFound

type LoginUserNotFound struct {
	Payload *models.Error
}

LoginUserNotFound handles this case with default header values.

Not Found

func NewLoginUserNotFound

func NewLoginUserNotFound() *LoginUserNotFound

NewLoginUserNotFound creates a LoginUserNotFound with default headers values

func (*LoginUserNotFound) Error

func (o *LoginUserNotFound) Error() string

type LoginUserOK

type LoginUserOK struct {
	Payload *models.AccessToken
}

LoginUserOK handles this case with default header values.

Access token with metadata.

func NewLoginUserOK

func NewLoginUserOK() *LoginUserOK

NewLoginUserOK creates a LoginUserOK with default headers values

func (*LoginUserOK) Error

func (o *LoginUserOK) Error() string

type LoginUserParams

type LoginUserParams struct {

	/*UserID
	  Id of user.

	*/
	UserID int64

	Context    context.Context
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

LoginUserParams contains all the parameters to send to the API endpoint for the login user operation typically these are written to a http.Request

func NewLoginUserParams

func NewLoginUserParams() *LoginUserParams

NewLoginUserParams creates a new LoginUserParams object with the default values initialized.

func NewLoginUserParamsWithContext

func NewLoginUserParamsWithContext(ctx context.Context) *LoginUserParams

NewLoginUserParamsWithContext creates a new LoginUserParams object with the default values initialized, and the ability to set a context for a request

func NewLoginUserParamsWithHTTPClient

func NewLoginUserParamsWithHTTPClient(client *http.Client) *LoginUserParams

NewLoginUserParamsWithHTTPClient creates a new LoginUserParams object with the default values initialized, and the ability to set a custom HTTPClient for a request

func NewLoginUserParamsWithTimeout

func NewLoginUserParamsWithTimeout(timeout time.Duration) *LoginUserParams

NewLoginUserParamsWithTimeout creates a new LoginUserParams object with the default values initialized, and the ability to set a timeout on a request

func (*LoginUserParams) SetContext

func (o *LoginUserParams) SetContext(ctx context.Context)

SetContext adds the context to the login user params

func (*LoginUserParams) SetHTTPClient

func (o *LoginUserParams) SetHTTPClient(client *http.Client)

SetHTTPClient adds the HTTPClient to the login user params

func (*LoginUserParams) SetTimeout

func (o *LoginUserParams) SetTimeout(timeout time.Duration)

SetTimeout adds the timeout to the login user params

func (*LoginUserParams) SetUserID

func (o *LoginUserParams) SetUserID(userID int64)

SetUserID adds the userId to the login user params

func (*LoginUserParams) WithContext

func (o *LoginUserParams) WithContext(ctx context.Context) *LoginUserParams

WithContext adds the context to the login user params

func (*LoginUserParams) WithHTTPClient

func (o *LoginUserParams) WithHTTPClient(client *http.Client) *LoginUserParams

WithHTTPClient adds the HTTPClient to the login user params

func (*LoginUserParams) WithTimeout

func (o *LoginUserParams) WithTimeout(timeout time.Duration) *LoginUserParams

WithTimeout adds the timeout to the login user params

func (*LoginUserParams) WithUserID

func (o *LoginUserParams) WithUserID(userID int64) *LoginUserParams

WithUserID adds the userID to the login user params

func (*LoginUserParams) WriteToRequest

func (o *LoginUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error

WriteToRequest writes these params to a swagger request

type LoginUserReader

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

LoginUserReader is a Reader for the LoginUser structure.

func (*LoginUserReader) ReadResponse

func (o *LoginUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)

ReadResponse reads a server response into the received o.

type LogoutBadRequest

type LogoutBadRequest struct {
	Payload *models.Error
}

LogoutBadRequest handles this case with default header values.

Bad Request

func NewLogoutBadRequest

func NewLogoutBadRequest() *LogoutBadRequest

NewLogoutBadRequest creates a LogoutBadRequest with default headers values

func (*LogoutBadRequest) Error

func (o *LogoutBadRequest) Error() string

type LogoutNoContent

type LogoutNoContent struct {
	Payload string
}

LogoutNoContent handles this case with default header values.

Logged out successfully.

func NewLogoutNoContent

func NewLogoutNoContent() *LogoutNoContent

NewLogoutNoContent creates a LogoutNoContent with default headers values

func (*LogoutNoContent) Error

func (o *LogoutNoContent) Error() string

type LogoutNotFound

type LogoutNotFound struct {
	Payload *models.Error
}

LogoutNotFound handles this case with default header values.

Not Found

func NewLogoutNotFound

func NewLogoutNotFound() *LogoutNotFound

NewLogoutNotFound creates a LogoutNotFound with default headers values

func (*LogoutNotFound) Error

func (o *LogoutNotFound) Error() string

type LogoutParams

type LogoutParams struct {
	Context    context.Context
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

LogoutParams contains all the parameters to send to the API endpoint for the logout operation typically these are written to a http.Request

func NewLogoutParams

func NewLogoutParams() *LogoutParams

NewLogoutParams creates a new LogoutParams object with the default values initialized.

func NewLogoutParamsWithContext

func NewLogoutParamsWithContext(ctx context.Context) *LogoutParams

NewLogoutParamsWithContext creates a new LogoutParams object with the default values initialized, and the ability to set a context for a request

func NewLogoutParamsWithHTTPClient

func NewLogoutParamsWithHTTPClient(client *http.Client) *LogoutParams

NewLogoutParamsWithHTTPClient creates a new LogoutParams object with the default values initialized, and the ability to set a custom HTTPClient for a request

func NewLogoutParamsWithTimeout

func NewLogoutParamsWithTimeout(timeout time.Duration) *LogoutParams

NewLogoutParamsWithTimeout creates a new LogoutParams object with the default values initialized, and the ability to set a timeout on a request

func (*LogoutParams) SetContext

func (o *LogoutParams) SetContext(ctx context.Context)

SetContext adds the context to the logout params

func (*LogoutParams) SetHTTPClient

func (o *LogoutParams) SetHTTPClient(client *http.Client)

SetHTTPClient adds the HTTPClient to the logout params

func (*LogoutParams) SetTimeout

func (o *LogoutParams) SetTimeout(timeout time.Duration)

SetTimeout adds the timeout to the logout params

func (*LogoutParams) WithContext

func (o *LogoutParams) WithContext(ctx context.Context) *LogoutParams

WithContext adds the context to the logout params

func (*LogoutParams) WithHTTPClient

func (o *LogoutParams) WithHTTPClient(client *http.Client) *LogoutParams

WithHTTPClient adds the HTTPClient to the logout params

func (*LogoutParams) WithTimeout

func (o *LogoutParams) WithTimeout(timeout time.Duration) *LogoutParams

WithTimeout adds the timeout to the logout params

func (*LogoutParams) WriteToRequest

func (o *LogoutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error

WriteToRequest writes these params to a swagger request

type LogoutReader

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

LogoutReader is a Reader for the Logout structure.

func (*LogoutReader) ReadResponse

func (o *LogoutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error)

ReadResponse reads a server response into the received o.

Jump to

Keyboard shortcuts

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