client

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetProjectIDFromToken

func GetProjectIDFromToken(token string) (uint, bool, error)

Types

type Client

type Client struct {
	BaseURL        string
	HTTPClient     *http.Client
	Cookie         *http.Cookie
	CookieFilePath string
	Token          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 NewClientWithToken

func NewClientWithToken(baseURL, token string) *Client

func (*Client) AuthCheck

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

func (*Client) CreateAWSIntegration

func (c *Client) CreateAWSIntegration(
	ctx context.Context,
	projectID uint,
	req *types.CreateAWSRequest,
) (*types.CreateAWSResponse, error)

CreateAWSIntegration creates an AWS integration with the given request options

func (*Client) CreateBasicAuthIntegration

func (c *Client) CreateBasicAuthIntegration(
	ctx context.Context,
	projectID uint,
	req *types.CreateBasicRequest,
) (*types.CreateBasicResponse, error)

CreateBasicAuthIntegration creates a "basic auth" integration

func (*Client) CreateDNSRecord

func (c *Client) CreateDNSRecord(
	ctx context.Context,
	projID, clusterID uint,
	namespace, name string,
) (*types.DNSRecord, error)

CreateDNSRecord creates a Github action with basic authentication

func (*Client) CreateEvent

func (c *Client) CreateEvent(
	ctx context.Context,
	projID, clusterID uint,
	namespace, name string,
	req *types.UpdateReleaseStepsRequest,
) error

CreateEvent sends an event from deployment to the api

func (*Client) CreateGCPIntegration

func (c *Client) CreateGCPIntegration(
	ctx context.Context,
	projectID uint,
	req *types.CreateGCPRequest,
) (*types.CreateGCPResponse, error)

CreateGCPIntegration creates a GCP integration with the given request options

func (*Client) CreateProject

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

CreateProject creates a project with the given request options

func (*Client) CreateProjectCandidates

func (c *Client) CreateProjectCandidates(
	ctx context.Context,
	projectID uint,
	req *types.CreateClusterCandidateRequest,
) (*types.CreateClusterCandidateResponse, error)

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

func (*Client) CreateProjectCluster

func (c *Client) CreateProjectCluster(
	ctx context.Context,
	projectID, candidateID uint,
	req *types.ClusterResolverAll,
) (*types.Cluster, error)

CreateProjectCluster creates a cluster given a project id and a candidate id, which gets resolved using the list of actions

func (*Client) CreateRegistry

func (c *Client) CreateRegistry(
	ctx context.Context,
	projectID uint,
	req *types.CreateRegistryRequest,
) (*types.Registry, error)

CreateRegistry creates a new registry integration

func (*Client) CreateRepository

func (c *Client) CreateRepository(
	ctx context.Context,
	projectID, regID uint,
	req *types.CreateRegistryRepositoryRequest,
) error

func (*Client) CreateUser

func (c *Client) CreateUser(
	ctx context.Context,
	req *types.CreateUserRequest,
) (*types.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,
) error

// DeleteProject deletes a project by id

func (*Client) DeleteProjectCluster

func (c *Client) DeleteProjectCluster(
	ctx context.Context,
	projectID uint,
	clusterID uint,
) error

DeleteProjectCluster deletes a cluster given a project id and cluster id

func (*Client) DeleteProjectRegistry

func (c *Client) DeleteProjectRegistry(
	ctx context.Context,
	projectID uint,
	registryID uint,
) error

DeleteProjectRegistry deletes a registry given a project id and registry id

func (*Client) DeleteUser

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

DeleteUser deletes the current user

func (*Client) DeployTemplate

func (c *Client) DeployTemplate(
	ctx context.Context,
	projID, clusterID uint,
	namespace string,
	req *types.CreateReleaseRequest,
) error

func (*Client) DeployWithWebhook

func (c *Client) DeployWithWebhook(
	ctx context.Context,
	webhook string,
	req *types.WebhookRequest,
) error

DeployWithWebhook deploys an application with an image tag using a unique webhook URI

func (*Client) GetDOCRAuthorizationToken

func (c *Client) GetDOCRAuthorizationToken(
	ctx context.Context,
	projectID uint,
	req *types.GetRegistryGCRTokenRequest,
) (*types.GetRegistryTokenResponse, error)

GetDOCRAuthorizationToken gets a DOCR authorization token

func (*Client) GetDockerhubAuthorizationToken

func (c *Client) GetDockerhubAuthorizationToken(
	ctx context.Context,
	projectID uint,
) (*types.GetRegistryTokenResponse, error)

GetDockerhubAuthorizationToken gets a Docker Hub authorization token

func (*Client) GetECRAuthorizationToken

func (c *Client) GetECRAuthorizationToken(
	ctx context.Context,
	projectID uint,
	req *types.GetRegistryECRTokenRequest,
) (*types.GetRegistryTokenResponse, error)

GetECRAuthorizationToken gets an ECR authorization token

func (*Client) GetGCRAuthorizationToken

func (c *Client) GetGCRAuthorizationToken(
	ctx context.Context,
	projectID uint,
	req *types.GetRegistryGCRTokenRequest,
) (*types.GetRegistryTokenResponse, error)

GetGCRAuthorizationToken gets a GCR authorization token

func (*Client) GetK8sAllPods

func (c *Client) GetK8sAllPods(
	ctx context.Context,
	projectID, clusterID uint,
	namespace, name string,
) (*types.GetReleaseAllPodsResponse, error)

GetK8sAllPods gets all pods for a given release

func (*Client) GetK8sNamespaces

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

GetK8sNamespaces gets a namespaces list in a k8s cluster

func (*Client) GetKubeconfig

func (c *Client) GetKubeconfig(
	ctx context.Context,
	projectID uint,
	clusterID uint,
) (*types.GetTemporaryKubeconfigResponse, error)

func (*Client) GetProject

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

GetProject retrieves a project by id

func (*Client) GetProjectCandidates

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

GetProjectCandidates returns the cluster candidates for a given project id

func (*Client) GetProjectCluster

func (c *Client) GetProjectCluster(
	ctx context.Context,
	projectID uint,
	clusterID uint,
) (*types.ClusterGetResponse, error)

GetProjectCluster retrieves a project's cluster by id

func (*Client) GetRelease

func (c *Client) GetRelease(
	ctx context.Context,
	projectID, clusterID uint,
	namespace, name string,
) (*types.GetReleaseResponse, error)

func (*Client) GetReleaseWebhook

func (c *Client) GetReleaseWebhook(
	ctx context.Context,
	projID, clusterID uint,
	name, namespace string,
) (*types.PorterRelease, error)

GetReleaseWebhook retrieves the release webhook for a given release

func (*Client) GetRepoZIPDownloadURL

func (c *Client) GetRepoZIPDownloadURL(
	ctx context.Context,
	projID uint,
	gitInstallationID int64,
	kind, owner, name, branch string,
) (*types.GetTarballURLResponse, error)

func (*Client) GetTemplate

func (c *Client) GetTemplate(
	ctx context.Context,
	name, version string,
	req *types.GetTemplateRequest,
) (*types.GetTemplateResponse, error)

func (*Client) ListGitInstallationIDs

func (c *Client) ListGitInstallationIDs(
	ctx context.Context,
	projID uint,
) (*types.ListGitInstallationIDsResponse, error)

ListGitInstallationIDs returns a list of Git installation IDs for a user

func (*Client) ListGitRepos

func (c *Client) ListGitRepos(
	ctx context.Context,
	projID uint,
	gitInstallationID int64,
) (*types.ListReposResponse, error)

ListGitRepos returns a list of Git installation IDs for a user

func (*Client) ListImages

func (c *Client) ListImages(
	ctx context.Context,
	projectID uint,
	registryID uint,
	repoName string,
) (*types.ListImageResponse, error)

ListImages lists the images (repository+tag) in a repository

func (*Client) ListOAuthIntegrations

func (c *Client) ListOAuthIntegrations(
	ctx context.Context,
	projectID uint,
) (*types.ListOAuthResponse, error)

ListOAuthIntegrations lists the oauth integrations in a project

func (*Client) ListProjectClusters

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

ListProjectClusters creates a list of clusters for a given project

func (*Client) ListRegistries

func (c *Client) ListRegistries(
	ctx context.Context,
	projectID uint,
) (*types.RegistryListResponse, error)

ListRegistries returns a list of registries for a project

func (*Client) ListRegistryRepositories

func (c *Client) ListRegistryRepositories(
	ctx context.Context,
	projectID uint,
	registryID uint,
) (*types.ListRegistryRepositoryResponse, error)

ListRegistryRepositories lists the repositories in a registry

func (*Client) ListTemplates

func (c *Client) ListTemplates(
	ctx context.Context,
	req *types.ListTemplatesRequest,
) (*types.ListTemplatesResponse, error)

func (*Client) ListUserProjects

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

ListUserProjects returns a list of projects associated with a user

func (*Client) Login

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

func (*Client) UpdateBatchImage

func (c *Client) UpdateBatchImage(
	ctx context.Context,
	projID, clusterID uint,
	namespace string,
	req *types.UpdateImageBatchRequest,
) error

UpdateBatchImage updates all releases that use a certain image with a new tag, within a single namespace

func (*Client) UpgradeRelease

func (c *Client) UpgradeRelease(
	ctx context.Context,
	projID, clusterID uint,
	namespace, name string,
	req *types.UpgradeReleaseRequest,
) error

UpgradeRelease upgrades a specific release with new values or chart version

type CookieStorage

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

CookieStorage for temporary fs-based cookie storage before jwt tokens

type TokenProjectID

type TokenProjectID struct {
	ProjectID uint `json:"project_id"`
}

Jump to

Keyboard shortcuts

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