secrets

package
v0.0.0-...-7eaa7e1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound   = errs.New("Secret not found")
	ErKeypairSave = errs.New("Could not save keypair")
)

Functions

func FetchAll

func FetchAll(client *Client, org *mono_models.Organization) ([]*secretsModels.UserSecret, error)

FetchAll fetchs the current user's secrets for an organization.

func FetchDefinitions

func FetchDefinitions(client *Client, projectID strfmt.UUID) ([]*secretsModels.SecretDefinition, error)

FetchDefinitions fetchs the secret definitions for a given project.

func Reset

func Reset()

Reset will reset the client cache

func SaveSecretShares

func SaveSecretShares(client *Client, org *mono_models.Organization, user *mono_models.User, shares []*secretsModels.UserSecretShare) error

Types

type Client

type Client struct {
	*secrets_client.Secrets
	BaseURI string
	// contains filtered or unexported fields
}

Client encapsulates a Secrets Service API client and its configuration

var DefaultClient *Client

DefaultClient represents a secretsapi Client instance that can be accessed by any package needing it. DefaultClient should be set by a call to InitializeClient; this, it can be nil.

func Get

func Get(auth *authentication.Auth) *Client

Get is an alias for InitializeClient used to persist our Get() pattern used throughout the codebase

func GetClient

func GetClient(auth *authentication.Auth) *Client

GetClient gets the cached (if any) client instance that was initialized using our default settings

func InitializeClient

func InitializeClient(auth *authentication.Auth) *Client

InitializeClient will create new Client using defaults, including the api.BearerToken value. This new Client instance will be accessible as secretapi.DefaultClient afterwards. Calling this function multiple times will redefine the DefaultClient value using the defaults/constants available to it at the time of the call; thus, the DefaultClient can be re-initialized this way. Because this function is dependent on a runtime-value from pkg/platform/api, we are not relying on the init() function for instantiation; this must be called explicitly.

func NewClient

func NewClient(schema, host, basePath string, auth *authentication.Auth) *Client

NewClient creates a new SecretsAPI client instance using the provided HTTP settings. It also expects to receive the actual Bearer token value that will be passed in each API request in order to authenticate each request.

func NewDefaultClient

func NewDefaultClient(auth *authentication.Auth) *Client

NewDefaultClient creates a new Client using constants SecretsAPISchema, -Host, and -Path and a provided Bearer-token value.

func (*Client) AuthenticatedUserID

func (client *Client) AuthenticatedUserID() (strfmt.UUID, error)

AuthenticatedUserID will check with the Secrets Service to ensure the current Bearer token is a valid one and return the user's UID in the response. Otherwise, this function will return a Failure.

func (*Client) Persist

func (client *Client) Persist()

Persist will make the current client the persistentClient

type Scope

type Scope string

Scope covers what scope a secret belongs to

var (
	// ScopeUser is the user scope
	ScopeUser Scope = "user"

	// ScopeProject is the project scope
	ScopeProject Scope = "project"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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