client

package
v0.0.0-...-4df811a Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GET    methodType = "GET"
	POST   methodType = "POST"
	PUT    methodType = "PUT"
	DELETE methodType = "DELETE"
)

Variables

Functions

This section is empty.

Types

type Devices

type Devices struct {
	// contains filtered or unexported fields
}

func (*Devices) GetAll

func (c *Devices) GetAll() ([]models.Device, error)

GetAll method fetches and returns a list of all the user's devices

func (*Devices) Revoke

func (c *Devices) Revoke(uid string) error

Revoke method revokes access to the device with UID `uid`

type GenericResponse

type GenericResponse struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

type GetOptions

type GetOptions bool
const (
	OWNED_ONLY GetOptions = true
	ALL_KNWON  GetOptions = false
)

type KeystoneClient

type KeystoneClient interface {
	Project(projectId string) *Project
	Roles() *Roles
	Users() *Users
	Messages() *Messages
	Devices() *Devices
	Organizations() *Organizations
}

func NewKeystoneClient

func NewKeystoneClient() (KeystoneClient, *errors.Error)

NewKeystoneClient function returns a new instance of KeysotneClient

type KeystoneClientImpl

type KeystoneClientImpl struct {
	// contains filtered or unexported fields
}

func (*KeystoneClientImpl) Devices

func (client *KeystoneClientImpl) Devices() *Devices

Devices method returns an interface to interact with devices

func (*KeystoneClientImpl) Messages

func (client *KeystoneClientImpl) Messages() *Messages

Messages method returns an interface to interact with messages

func (*KeystoneClientImpl) Organizations

func (client *KeystoneClientImpl) Organizations() *Organizations

Organizations method returns an interfaec to interact with organizations

func (*KeystoneClientImpl) Project

func (client *KeystoneClientImpl) Project(projectId string) *Project

Project method returns an interface to interact with projects

func (*KeystoneClientImpl) Roles

func (client *KeystoneClientImpl) Roles() *Roles

Roles method returns an interface to interact with roles

func (*KeystoneClientImpl) Users

func (client *KeystoneClientImpl) Users() *Users

Users method returns an interface to interact with users/members

type Messages

type Messages struct {
	// contains filtered or unexported fields
}

func (*Messages) DeleteMessage

func (client *Messages) DeleteMessage(messageID uint) (GenericResponse, error)

DeleteMessage method deletes the message

func (*Messages) GetMessages

func (client *Messages) GetMessages(
	projectID string,
) (models.GetMessageByEnvironmentResponse, error)

GetMessages method gets all messages for the users device, regarding the current project

func (*Messages) SendMessages

func (client *Messages) SendMessages(
	messages models.MessagesToWritePayload,
) (models.GetEnvironmentsResponse, error)

SendMessages method sends messages to members of the project

type Organizations

type Organizations struct {
	// contains filtered or unexported fields
}

func (*Organizations) CreateOrganization

func (c *Organizations) CreateOrganization(
	organizationName string,
	private bool,
) (models.Organization, error)

CreateOrganization method creates a new organization

func (*Organizations) GetAll

func (c *Organizations) GetAll() ([]models.Organization, error)

GetAll method returns all the organizations the user is a member of

func (*Organizations) GetByName

func (c *Organizations) GetByName(
	name string,
	owned GetOptions,
) (models.Organization, error)

GetByName method returns the organiziation withe the name `name`. Set `owned` to `OWNED_ONLY` to only search among the organizations owned by the user. Set it to `ALL_KNWON` to search among all the organizations the user is a member of.

func (*Organizations) GetManagementUrl

func (c *Organizations) GetManagementUrl(
	organizationName string,
) (url string, err error)

GetManagementUrl returns an URL to a service that manages an existing subscription for the named organization To be called to update payment method or cancel an existing plan

func (*Organizations) GetMembers

func (c *Organizations) GetMembers(
	orga models.Organization,
) ([]models.ProjectMember, error)

GetMembers method returns all the members having access to the organization

func (*Organizations) GetProjects

func (c *Organizations) GetProjects(
	orga models.Organization,
) ([]models.Project, error)

GetProjects method returns all the projects that belong to the organization

func (*Organizations) GetUpgradeUrl

func (c *Organizations) GetUpgradeUrl(
	organizationName string,
) (url string, err error)

GetUpgradeUrl returns an URL to a service that creates a new subscription for the named organization To be called to turn a non-paid organization into a paid one

func (*Organizations) UpdateOrganization

func (c *Organizations) UpdateOrganization(
	organization models.Organization,
) (models.Organization, error)

UpdateOrganization method updates (renames) an organizaiton

type Project

type Project struct {
	// contains filtered or unexported fields
}

func (*Project) AddMembers

func (p *Project) AddMembers(memberRoles map[string]models.Role) error

Add members to a project

func (*Project) Destroy

func (p *Project) Destroy() (err error)

Destroys the project, its environments, environments versions, project members, messages, etc. Permanently

func (*Project) GetAccessibleEnvironments

func (p *Project) GetAccessibleEnvironments() ([]models.Environment, error)

GetAccessibleEnvironments method returns the list of environments the current user is allowed access to.

func (*Project) GetAll

func (p *Project) GetAll() ([]models.Project, error)

GetAll method returns a list of all the projects the current user is associated with

func (*Project) GetAllMembers

func (p *Project) GetAllMembers() ([]models.ProjectMember, error)

GetAllMembers method returns all members associated with the project

func (*Project) GetLogs

func (p *Project) GetLogs(
	options *models.GetLogsOptions,
) ([]models.ActivityLogLite, error)

GetLogs method returns all the logs relative to the current project

func (*Project) GetProjectsOrganization

func (p *Project) GetProjectsOrganization() (models.Organization, error)

GetProjectsOrganization method fetches the organziation this project belongs to

func (*Project) GetRoles

func (p *Project) GetRoles() ([]models.Role, error)

GetRoles method returns roles available for that organization

func (*Project) Init

func (p *Project) Init(
	name string,
	organizationID uint,
) (models.Project, error)

Init method creates a new project

func (*Project) IsOrganizationPaid

func (p *Project) IsOrganizationPaid() (bool, error)

IsOrganizationPaid method returns true if the organization the project belongs to is paid

func (*Project) RemoveMembers

func (p *Project) RemoveMembers(members []string) error

Removes members from the project (from all environments)

func (*Project) SetMemberRole

func (p *Project) SetMemberRole(memberId string, role string) (err error)

Changes the role of a member memberId should have the form <username>@<github|gitlab>

type Roles

type Roles struct {
	// contains filtered or unexported fields
}

func (*Roles) GetAll

func (c *Roles) GetAll(projectID string) ([]models.Role, error)

GetAll method returns all the roles available in project identifiled by `projectID`

type Users

type Users struct {
	// contains filtered or unexported fields
}

func (*Users) CheckUsersExist

func (u *Users) CheckUsersExist(
	userIds []string,
) (models.CheckMembersResponse, error)

CheckUsersExist method check the existence of the users given in `userIds` These are Keystone userIds: `member@service`

func (*Users) GetEnvironmentPublicKeys

func (u *Users) GetEnvironmentPublicKeys(
	environmentId string,
) (models.PublicKeys, error)

GetEnvironmentPublicKeys method get the public keys of all the devices that have a read access to the environment

func (*Users) GetUserKeys

func (u *Users) GetUserKeys(
	userID string,
) (result models.UserDevices, err error)

GetUserKeys method returns the public key of a specific user

func (*Users) InviteUser

func (u *Users) InviteUser(
	userEmail string,
	projectName string,
) (result models.GetInviteResponse, err error)

InviteUser method sends a Keystone invitation mail

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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