xhttp

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Identity AuthIdentity `json:"identity"`
	Scope    Scope        `json:"scope"`
}

type AuthIdentity

type AuthIdentity struct {
	Methods  []string `json:"methods"`
	Password Password `json:"password"`
}

type AuthRequest

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

type AuthResponse

type AuthResponse struct {
	Token Token
}

type Client

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

client is a Barbican REST API client responsible for fetching and renewing authentication tokens.

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context, config Config) error

Authenticate tries to obtain a new authentication token from the given Barbican endpoint via the given credentials.

Authenticate should be called to obtain the first authentication token. This token can then be renewed via RenewApiToken.

func (*Client) HttpDelete

func (c *Client) HttpDelete(ctx context.Context, url string, payload []byte, params url.Values) ([]byte, error)

func (*Client) HttpGet

func (c *Client) HttpGet(ctx context.Context, url string, params url.Values) ([]byte, error)

func (*Client) HttpPost

func (c *Client) HttpPost(ctx context.Context, url string, payload []byte, params url.Values) ([]byte, error)

func (*Client) HttpPut

func (c *Client) HttpPut(ctx context.Context, url string, payload []byte, params url.Values) ([]byte, error)

type Config

type Config struct {
	// Endpoint is the Barbican instance endpoint.
	Endpoint string

	// Credentials used to login to OpenStack to retrieve the APIKey
	Login Credentials
}

Config is a structure containing configuration options for connecting to a Barbican server.

type Credentials

type Credentials struct {
	ProjectDomain  string
	ProjectName    string
	AuthUrl        string
	Username       string
	Password       string
	UserDomainName string
}

type Name

type Name struct {
	Name string `json:"name"`
}

type Password

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

type Project

type Project struct {
	Domain Name   `json:"domain"`
	Name   string `json:"name"`
}

type Scope

type Scope struct {
	Project Project `json:"project"`
}

type Token

type Token struct {
	ExpiresAt string `json:"expires_at"`
}

type User

type User struct {
	Domain   Name   `json:"domain"`
	Name     string `json:"name"`
	Password string `json:"password"`
}

Jump to

Keyboard shortcuts

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