internal

package
v0.0.0-...-8fe0c81 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Copyright (C) 2020 Serge ALEXANDRE

This file is part of koobind project

koobind is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

koobind is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with koobind. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Serge ALEXANDRE

This file is part of koobind project

koobind is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

koobind is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with koobind.  If not, see <http://www.gnu.org/licenses/>.

This file is part of koobind project

koobind is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

koobind is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with koobind. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureLogger

func ConfigureLogger(ll string, json bool)

func DeleteTokenBag

func DeleteTokenBag(context string)

Better to test and remove. Alternate would be to remove withhout testing, but this may hide some errors

func ListContext

func ListContext() []string

func ReturnCodeFromStatusCode

func ReturnCodeFromStatusCode(sc int) int

func SaveConfig

func SaveConfig(context string, config *Config)

func SaveTokenBag

func SaveTokenBag(context string, tokenBag *TokenBag)

Types

type Config

type Config struct {
	Server     string `json:"server"`
	RootCaFile string `json:"rootCaFile"`
	Client     proto_v2.AuthClient
}

func LoadConfig

func LoadConfig(context string) *Config

type CurrentContext

type CurrentContext struct {
	Context string `json:"context"`
}

type HttpAuth

type HttpAuth struct {
	Login    string
	Password string
	Token    string
}

type HttpConnection

type HttpConnection struct {
	BaseUrl string
	// contains filtered or unexported fields
}

Concurrent safe, as http.Client is and baseUrl is not mutated.

func NewHttpConnection

func NewHttpConnection(baseUrl string, rootCaFile string, log *logrus.Entry) *HttpConnection

func (*HttpConnection) Do

func (this *HttpConnection) Do(method string, urlPath string, auth *HttpAuth, body io.Reader) (*http.Response, error)

type TokenBag

type TokenBag struct {
	Token      string        `json:"token"`
	ClientTTL  time.Duration `json:"clientTTL"`
	LastAccess time.Time     `json:"lastAccess"`
	Username   string        `json:"username"`
	Uid        string        `json:"uid"`
	Groups     []string      `json:"groups"`
}

func LoadTokenBag

func LoadTokenBag(context string) *TokenBag

Jump to

Keyboard shortcuts

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