Documentation ¶
Index ¶
- type Client
- func (a *Client) Login(params *LoginParams, opts ...ClientOption) (*LoginOK, error)
- func (a *Client) LoginUser(params *LoginUserParams, opts ...ClientOption) (*LoginUserOK, error)
- func (a *Client) Logout(params *LogoutParams, opts ...ClientOption) (*LogoutNoContent, error)
- func (a *Client) SetTransport(transport runtime.ClientTransport)
- type ClientOption
- type ClientService
- type LoginBadRequest
- type LoginNotFound
- type LoginOK
- type LoginParams
- func (o *LoginParams) SetClientID(clientID *string)
- func (o *LoginParams) SetClientSecret(clientSecret *string)
- func (o *LoginParams) SetContext(ctx context.Context)
- func (o *LoginParams) SetDefaults()
- func (o *LoginParams) SetHTTPClient(client *http.Client)
- func (o *LoginParams) SetTimeout(timeout time.Duration)
- func (o *LoginParams) WithClientID(clientID *string) *LoginParams
- func (o *LoginParams) WithClientSecret(clientSecret *string) *LoginParams
- func (o *LoginParams) WithContext(ctx context.Context) *LoginParams
- func (o *LoginParams) WithDefaults() *LoginParams
- func (o *LoginParams) WithHTTPClient(client *http.Client) *LoginParams
- func (o *LoginParams) WithTimeout(timeout time.Duration) *LoginParams
- func (o *LoginParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error
- type LoginReader
- type LoginUserBadRequest
- type LoginUserNotFound
- type LoginUserOK
- type LoginUserParams
- func (o *LoginUserParams) SetAssociative(associative *bool)
- func (o *LoginUserParams) SetContext(ctx context.Context)
- func (o *LoginUserParams) SetDefaults()
- func (o *LoginUserParams) SetHTTPClient(client *http.Client)
- func (o *LoginUserParams) SetTimeout(timeout time.Duration)
- func (o *LoginUserParams) SetUserID(userID int64)
- func (o *LoginUserParams) WithAssociative(associative *bool) *LoginUserParams
- func (o *LoginUserParams) WithContext(ctx context.Context) *LoginUserParams
- func (o *LoginUserParams) WithDefaults() *LoginUserParams
- func (o *LoginUserParams) WithHTTPClient(client *http.Client) *LoginUserParams
- func (o *LoginUserParams) WithTimeout(timeout time.Duration) *LoginUserParams
- func (o *LoginUserParams) WithUserID(userID int64) *LoginUserParams
- func (o *LoginUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error
- type LoginUserReader
- type LogoutBadRequest
- type LogoutNoContent
- type LogoutNotFound
- type LogoutParams
- func (o *LogoutParams) SetContext(ctx context.Context)
- func (o *LogoutParams) SetDefaults()
- func (o *LogoutParams) SetHTTPClient(client *http.Client)
- func (o *LogoutParams) SetTimeout(timeout time.Duration)
- func (o *LogoutParams) WithContext(ctx context.Context) *LogoutParams
- func (o *LogoutParams) WithDefaults() *LogoutParams
- func (o *LogoutParams) WithHTTPClient(client *http.Client) *LogoutParams
- func (o *LogoutParams) WithTimeout(timeout time.Duration) *LogoutParams
- func (o *LogoutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error
- type LogoutReader
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 (*Client) Login ¶
func (a *Client) Login(params *LoginParams, opts ...ClientOption) (*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.
This function can accept `client_id` and `client_secret` parameters as URL query params or as www-form-urlencoded params in the body of the HTTP request. Since there is a small risk that URL parameters may be visible to intermediate nodes on the network route (proxies, routers, etc), passing credentials in the body of the request is considered more secure than URL params.
Example of passing credentials in the HTTP request body: ```` POST HTTP /login Content-Type: application/x-www-form-urlencoded
client_id=CGc9B7v7J48dQSJvxxx&client_secret=nNVS9cSS3xNpSC9JdsBvvvvv ````
### Best Practice: Always pass credentials in body params. Pass credentials in URL query params **only** when you cannot pass body params due to application, tool, or other limitations.
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, opts ...ClientOption) (*LoginUserOK, error)
LoginUser logins user ### Create an access token that runs as 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, opts ...ClientOption) (*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 ClientOption ¶
type ClientOption func(*runtime.ClientOperation)
ClientOption is the option for Client methods
type ClientService ¶
type ClientService interface { Login(params *LoginParams, opts ...ClientOption) (*LoginOK, error) LoginUser(params *LoginUserParams, opts ...ClientOption) (*LoginUserOK, error) Logout(params *LogoutParams, opts ...ClientOption) (*LogoutNoContent, error) SetTransport(transport runtime.ClientTransport) }
ClientService is the interface for Client methods
func New ¶
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService
New creates a new api auth API client.
type LoginBadRequest ¶
LoginBadRequest describes a response with status code 400, 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
func (*LoginBadRequest) GetPayload ¶
func (o *LoginBadRequest) GetPayload() *models.Error
type LoginNotFound ¶
LoginNotFound describes a response with status code 404, 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
func (*LoginNotFound) GetPayload ¶
func (o *LoginNotFound) GetPayload() *models.Error
type LoginOK ¶
type LoginOK struct {
Payload *models.AccessToken
}
LoginOK describes a response with status code 200, with default header values.
Access token with metadata.
func NewLoginOK ¶
func NewLoginOK() *LoginOK
NewLoginOK creates a LoginOK with default headers values
func (*LoginOK) GetPayload ¶
func (o *LoginOK) GetPayload() *models.AccessToken
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 timeout for this client.
Default values are not hydrated, since defaults are normally applied by the API server side.
To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewLoginParamsWithContext ¶
func NewLoginParamsWithContext(ctx context.Context) *LoginParams
NewLoginParamsWithContext creates a new LoginParams object with 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 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 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) SetDefaults ¶
func (o *LoginParams) SetDefaults()
SetDefaults hydrates default values in the login params (not the query body).
All values with no default are reset to their zero value.
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) WithDefaults ¶
func (o *LoginParams) WithDefaults() *LoginParams
WithDefaults hydrates default values in the login params (not the query body).
All values with no default are reset to their zero value.
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 ¶
LoginUserBadRequest describes a response with status code 400, 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
func (*LoginUserBadRequest) GetPayload ¶
func (o *LoginUserBadRequest) GetPayload() *models.Error
type LoginUserNotFound ¶
LoginUserNotFound describes a response with status code 404, 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
func (*LoginUserNotFound) GetPayload ¶
func (o *LoginUserNotFound) GetPayload() *models.Error
type LoginUserOK ¶
type LoginUserOK struct {
Payload *models.AccessToken
}
LoginUserOK describes a response with status code 200, 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
func (*LoginUserOK) GetPayload ¶
func (o *LoginUserOK) GetPayload() *models.AccessToken
type LoginUserParams ¶
type LoginUserParams struct { /* Associative. When true (default), API calls using the returned access_token are attributed to the admin user who created the access_token. When false, API activity is attributed to the user the access_token runs as. False requires a looker license. */ Associative *bool /* UserID. Id of user. Format: int64 */ 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 timeout for this client.
Default values are not hydrated, since defaults are normally applied by the API server side.
To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewLoginUserParamsWithContext ¶
func NewLoginUserParamsWithContext(ctx context.Context) *LoginUserParams
NewLoginUserParamsWithContext creates a new LoginUserParams object with 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 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 ability to set a timeout on a request.
func (*LoginUserParams) SetAssociative ¶
func (o *LoginUserParams) SetAssociative(associative *bool)
SetAssociative adds the associative to the login user params
func (*LoginUserParams) SetContext ¶
func (o *LoginUserParams) SetContext(ctx context.Context)
SetContext adds the context to the login user params
func (*LoginUserParams) SetDefaults ¶
func (o *LoginUserParams) SetDefaults()
SetDefaults hydrates default values in the login user params (not the query body).
All values with no default are reset to their zero value.
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) WithAssociative ¶
func (o *LoginUserParams) WithAssociative(associative *bool) *LoginUserParams
WithAssociative adds the associative 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) WithDefaults ¶
func (o *LoginUserParams) WithDefaults() *LoginUserParams
WithDefaults hydrates default values in the login user params (not the query body).
All values with no default are reset to their zero value.
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 ¶
LogoutBadRequest describes a response with status code 400, 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
func (*LogoutBadRequest) GetPayload ¶
func (o *LogoutBadRequest) GetPayload() *models.Error
type LogoutNoContent ¶
type LogoutNoContent struct {
Payload string
}
LogoutNoContent describes a response with status code 204, 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
func (*LogoutNoContent) GetPayload ¶
func (o *LogoutNoContent) GetPayload() string
type LogoutNotFound ¶
LogoutNotFound describes a response with status code 404, 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
func (*LogoutNotFound) GetPayload ¶
func (o *LogoutNotFound) GetPayload() *models.Error
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 timeout for this client.
Default values are not hydrated, since defaults are normally applied by the API server side.
To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewLogoutParamsWithContext ¶
func NewLogoutParamsWithContext(ctx context.Context) *LogoutParams
NewLogoutParamsWithContext creates a new LogoutParams object with 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 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 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) SetDefaults ¶
func (o *LogoutParams) SetDefaults()
SetDefaults hydrates default values in the logout params (not the query body).
All values with no default are reset to their zero value.
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) WithDefaults ¶
func (o *LogoutParams) WithDefaults() *LogoutParams
WithDefaults hydrates default values in the logout params (not the query body).
All values with no default are reset to their zero value.
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.