keystone

package
v1.12.3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package keystone implements a keystone client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access struct {
	Token Token `json:"token"`
	User  User  `json:"user"`
}

Access contains the access granted in the login attempt.

type Auth

type Auth struct {
	TenantName          string               `json:"tenantName,omitempty"`
	TenantID            string               `json:"tenantId,omitempty"`
	PasswordCredentials *PasswordCredentials `json:"passwordCredentials,omitempty"`
	Token               *Token               `json:"token,omitempty"`
}

Auth is the authentication information sent in a login request.

type AuthTokensBody

type AuthTokensBody struct {
	Auth AuthV3 `json:"auth"`
}

AuthTokensBody represents the JSON body sent in a v3 login request.

type AuthTokensRequest

type AuthTokensRequest struct {
	httprequest.Route `httprequest:"POST /v3/auth/tokens"`
	Body              AuthTokensBody `httprequest:",body"`
}

AuthTokensRequest is the request sent to /v3/auth/tokens to perform a login. See http://developer.openstack.org/api-ref/identity/v3/index.html?expanded=password-authentication-with-unscoped-authorization-detail for more information.

type AuthTokensResponse

type AuthTokensResponse struct {
	SubjectToken string
	Token        TokenV3 `json:"token"`
}

AuthTokensResponse is the reponse sent by /v3/auth/tokens when there has been a successful login. See http://developer.openstack.org/api-ref/identity/v3/index.html?expanded=password-authentication-with-unscoped-authorization-detail for more information.

func (AuthTokensResponse) SetHeader

func (resp AuthTokensResponse) SetHeader(h http.Header)

SetHeader implements httprequest.HeaderSetter by setting the appropriate X-Subject-Token header for the response.

type AuthV3

type AuthV3 struct {
	Identity Identity `json:"identity"`
}

AuthV3 is the authentication information sent in a v3 login request.

type Client

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

Client provides access to a keystone server. Currently the supported protocols are versions 2.0 & 3, see http://developer.openstack.org/api-ref-identity-v2.html or http://developer.openstack.org/api-ref/identity/v3/index.html for more information.

func NewClient

func NewClient(url string) *Client

NewClient creates a new Client for the keystone server at url.

func (*Client) AuthTokens

func (c *Client) AuthTokens(ctx context.Context, r *AuthTokensRequest) (*AuthTokensResponse, error)

AuthTokens provides access to the /v3/auth/tokens endpoint. See http://developer.openstack.org/api-ref/identity/v3/index.html?expanded=password-authentication-with-unscoped-authorization-detail for more information. This uses version 3 of the keystone protocol and therefore cannot be used with older keystone servers that don't support it.

func (*Client) Tenants

func (c *Client) Tenants(ctx context.Context, r *TenantsRequest) (*TenantsResponse, error)

Tenants provides access to the /v2.0/tenants endpoint. See http://developer.openstack.org/api-ref-identity-v2.html#listTenants for more information.

func (*Client) Tokens

func (c *Client) Tokens(ctx context.Context, r *TokensRequest) (*TokensResponse, error)

Tokens provides access to the /v2.0/tokens endpoint. See http://developer.openstack.org/api-ref-identity-v2.html#authenticate-v2.0 for more information.

func (*Client) UserGroups

func (c *Client) UserGroups(ctx context.Context, r *UserGroupsRequest) (*UserGroupsResponse, error)

UserGroups provides access to the /v3/users/:id/groups endpoint. See http://developer.openstack.org/api-ref/identity/v3/index.html?expanded=list-groups-to-which-a-user-belongs-detail for more information. This uses version 3 of the keystone protocol and therefore cannot be used with older keystone servers that don't support it.

type Domain

type Domain struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name:omitempty"`
}

Domain contains the domain of a user in the v3 API.

type Error

type Error struct {
	Code    int    `json:"code"`
	Title   string `json:"title"`
	Message string `json:"message"`
}

Error represents an error from a keystone server.

func (*Error) Error

func (e *Error) Error() string

type ErrorResponse

type ErrorResponse struct {
	Error *Error `json:"error"`
}

ErrorResponse represents an error response from the keystone server.

type Group

type Group struct {
	ID          string `json:"id"`
	DomainID    string `json:"domain_id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

Group contains information on a keystone group.

type Identity

type Identity struct {
	Methods  []string       `json:"methods"`
	Password *Password      `json:"password,omitempty"`
	Token    *IdentityToken `json:"token,omitempty"`
}

Identity contains the identity information sent in a v3 login request.

type IdentityToken

type IdentityToken struct {
	ID string `json:"id"`
}

IdentityToken contains the token based identity information sent in a v3 login request.

type Password

type Password struct {
	User User `json:"user"`
}

Password contains the password based identity information sent in a v3 login request.

type PasswordCredentials

type PasswordCredentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

PasswordCredentials holds the credentials for a username/password authentication.

type Tenant

type Tenant struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Enabled     bool   `json:"enabled"`
}

Tenant contains details of a tenant in the openstack environment.

type TenantsRequest

type TenantsRequest struct {
	httprequest.Route `httprequest:"GET /v2.0/tenants"`
	AuthToken         string `httprequest:"X-Auth-Token,header"`
}

TenantsRequest is the request sent to /v2.0/tenants to list tenants a token has access to. See http://developer.openstack.org/api-ref-identity-v2.html#listTenants for more information.

type TenantsResponse

type TenantsResponse struct {
	Tenants []Tenant `json:"tenants"`
}

TenantsResponse is the list of tenants a token has access to.

type Time

type Time struct {
	time.Time
}

Time is a time.Time that provides a custom UnmarshalJSON method.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

type Token

type Token struct {
	ID       string  `json:"id,omitempty"`
	IssuedAt *Time   `json:"issued_at,omitempty"`
	Expires  *Time   `json:"expires,omitempty"`
	Tenant   *Tenant `json:"tenant,omitempty"`
}

Token contains the details of a token generated by keystone.

type TokenV3

type TokenV3 struct {
	IssuedAt  *Time    `json:"issued_at,omitempty"`
	Methods   []string `json:"methods,omitempty"`
	ExpiresAt *Time    `json:"expires_at,omitempty"`
	User      User     `json:"user"`
}

TokenV3 represents the token returned from /v3/auth/tokens after a successful login.

type TokensBody

type TokensBody struct {
	Auth Auth `json:"auth"`
}

TokensBody represents the JSON body sent in a login request.

type TokensRequest

type TokensRequest struct {
	httprequest.Route `httprequest:"POST /v2.0/tokens"`
	Body              TokensBody `httprequest:",body"`
}

TokensRequest is the request sent to /v2.0/tokens to perform a login. See http://developer.openstack.org/api-ref-identity-v2.html#authenticate-v2.0 for more information.

type TokensResponse

type TokensResponse struct {
	Access Access `json:"access"`
}

TokensResponse is the response from /v2.0/tokens on success.

type User

type User struct {
	ID       string  `json:"id,omitempty"`
	Name     string  `json:"name,omitempty"`
	Username string  `json:"username,omitemtpy"`
	Domain   *Domain `json:"domain,omitempty"`
	Password string  `json:"password,omitempty"`
}

User contains details of a user in the openstack environment.

type UserGroupsRequest

type UserGroupsRequest struct {
	httprequest.Route `httprequest:"GET /v3/users/:UserID/groups"`
	UserID            string `httprequest:",path"`
	AuthToken         string `httprequest:"X-Auth-Token,header"`
}

UserGroupsRequest represents a request to the /v3/users/:id/groups endpoint. See http://developer.openstack.org/api-ref/identity/v3/index.html?expanded=list-groups-to-which-a-user-belongs-detail for more information.

type UserGroupsResponse

type UserGroupsResponse struct {
	Groups []Group `json:"groups"`
}

UserGroupsResponse represents a response to the /v3/users/:id/groups endpoint. See http://developer.openstack.org/api-ref/identity/v3/index.html?expanded=list-groups-to-which-a-user-belongs-detail for more information.

Jump to

Keyboard shortcuts

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