api

package
v0.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthCheckResponse

type AuthCheckResponse models.UserExternal

AuthCheckResponse is the user model response that is returned if the user is logged in

type Client

type Client struct {
	BaseURL        string
	HTTPClient     *http.Client
	Cookie         *http.Cookie
	CookieFilePath string
}

Client represents the client for the Porter API

func NewClient

func NewClient(baseURL string, cookieFileName string) *Client

NewClient constructs a new client based on a set of options

func (*Client) AuthCheck

func (c *Client) AuthCheck(ctx context.Context) (*AuthCheckResponse, error)

AuthCheck performs a check to ensure that the user is logged in

func (*Client) CreateProject

func (c *Client) CreateProject(
	ctx context.Context,
	createProjectRequest *CreateProjectRequest,
) (*CreateProjectResponse, error)

CreateProject creates a project with the given request options

func (*Client) CreateProjectCandidates

func (c *Client) CreateProjectCandidates(
	ctx context.Context,
	projectID uint,
	createCandidatesRequest *CreateProjectCandidatesRequest,
) (CreateProjectCandidatesResponse, error)

CreateProjectCandidates creates a service account candidate for a given project, accepting a kubeconfig that gets parsed into a candidate

func (*Client) CreateProjectServiceAccount

func (c *Client) CreateProjectServiceAccount(
	ctx context.Context,
	projectID uint,
	candidateID uint,
	createSARequest CreateProjectServiceAccountRequest,
) (*CreateProjectServiceAccountResponse, error)

CreateProjectServiceAccount creates a service account given a project id and a candidate id, which gets resolved using the list of actions

func (*Client) CreateUser

func (c *Client) CreateUser(
	ctx context.Context,
	createUserRequest *CreateUserRequest,
) (*CreateUserResponse, error)

CreateUser will create the user, authorize the user and grant them a cookie-based session

func (*Client) DeleteProject

func (c *Client) DeleteProject(ctx context.Context, projectID uint) (*DeleteProjectResponse, error)

DeleteProject deletes a project by id

func (*Client) DeleteUser

func (c *Client) DeleteUser(
	ctx context.Context,
	userID uint,
	deleteUserRequest *DeleteUserRequest,
) error

DeleteUser deletes a user of a given user id

func (*Client) GetK8sNamespaces

func (c *Client) GetK8sNamespaces(
	ctx context.Context,
	projectID uint,
	serviceAccountID uint,
	clusterID uint,
) (*GetK8sNamespacesResponse, error)

GetK8sNamespaces gets a namespaces list in a k8s cluster

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, projectID uint) (*GetProjectResponse, error)

GetProject retrieves a project by id

func (*Client) GetProjectCandidates

func (c *Client) GetProjectCandidates(
	ctx context.Context,
	projectID uint,
) (GetProjectCandidatesResponse, error)

GetProjectCandidates returns the service account candidates for a given project id

func (*Client) GetProjectServiceAccount

func (c *Client) GetProjectServiceAccount(
	ctx context.Context,
	projectID uint,
	saID uint,
) (*GetProjectServiceAccountResponse, error)

GetProjectServiceAccount retrieves a project's service account by id

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, userID uint) (*GetUserResponse, error)

GetUser retrieves a user given a user id

func (*Client) ListProjectClusters

func (c *Client) ListProjectClusters(
	ctx context.Context,
	projectID uint,
) (ListProjectClustersResponse, error)

ListProjectClusters creates a list of clusters for a given project

func (*Client) ListUserProjects

func (c *Client) ListUserProjects(ctx context.Context, userID uint) (ListUserProjectsResponse, error)

ListUserProjects returns a list of projects associated with a user

func (*Client) Login

func (c *Client) Login(ctx context.Context, loginRequest *LoginRequest) (*LoginResponse, error)

Login authorizes the user and grants them a cookie-based session

func (*Client) Logout

func (c *Client) Logout(ctx context.Context) error

Logout logs the user out and deauthorizes the cookie-based session

type CookieStorage

type CookieStorage struct {
	Cookie *http.Cookie `json:"cookie"`
}

CookieStorage for temporary fs-based cookie storage before jwt tokens

type CreateProjectCandidatesRequest

type CreateProjectCandidatesRequest struct {
	Kubeconfig string `json:"kubeconfig"`
}

CreateProjectCandidatesRequest creates a project service account candidate, which can be resolved to create a service account

type CreateProjectCandidatesResponse

type CreateProjectCandidatesResponse []*models.ServiceAccountCandidateExternal

CreateProjectCandidatesResponse is the list of candidates returned after creating the candidates

type CreateProjectRequest

type CreateProjectRequest struct {
	Name string `json:"name" form:"required"`
}

CreateProjectRequest represents the accepted fields for creating a project

type CreateProjectResponse

type CreateProjectResponse models.ProjectExternal

CreateProjectResponse is the resulting project after creation

type CreateProjectServiceAccountRequest

type CreateProjectServiceAccountRequest []*models.ServiceAccountAllActions

CreateProjectServiceAccountRequest is a list of service account actions, which resolve a given service account

type CreateProjectServiceAccountResponse

type CreateProjectServiceAccountResponse models.ServiceAccountExternal

CreateProjectServiceAccountResponse is the service account that gets returned after the actions have been resolved

type CreateUserRequest

type CreateUserRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

CreateUserRequest is the email/password associated with creating a user

type CreateUserResponse

type CreateUserResponse models.UserExternal

CreateUserResponse is the user model response that is returned after successfully creating a user

type DeleteProjectResponse

type DeleteProjectResponse models.ProjectExternal

DeleteProjectResponse is the object returned after project deletion

type DeleteUserRequest

type DeleteUserRequest struct {
	Password string `json:"password"`
}

DeleteUserRequest is the password needed to verify a user should be deleted

type GetK8sNamespacesResponse

type GetK8sNamespacesResponse v1.NamespaceList

GetK8sNamespacesResponse is the list of namespaces returned when a user has successfully authenticated

type GetProjectCandidatesResponse

type GetProjectCandidatesResponse []*models.ServiceAccountCandidateExternal

GetProjectCandidatesResponse is the list of service account candidates

type GetProjectResponse

type GetProjectResponse models.ProjectExternal

GetProjectResponse is the response returned after querying for a given project

type GetProjectServiceAccountResponse

type GetProjectServiceAccountResponse models.ServiceAccountExternal

GetProjectServiceAccountResponse is the response returned after querying for a given project's service account

type GetUserResponse

type GetUserResponse models.UserExternal

GetUserResponse is the user model response that is returned after successfully getting a user

type HTTPError

type HTTPError struct {
	Code   uint     `json:"code"`
	Errors []string `json:"errors"`
}

HTTPError is the Porter error response returned if a request fails

type ListProjectClustersResponse

type ListProjectClustersResponse []models.ClusterExternal

ListProjectClustersResponse lists the linked clusters for a project

type ListUserProjectsResponse

type ListUserProjectsResponse []*models.ProjectExternal

ListUserProjectsResponse is the list of projects returned

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

LoginRequest is the email/password associated with a login request

type LoginResponse

type LoginResponse models.UserExternal

LoginResponse is the user model response that is returned after successfully logging in

Jump to

Keyboard shortcuts

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