cloud_sdk

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IssueUploaderName = "issue-uploader"
	LogUploaderName   = "log-uploader"
)
View Source
const CredentialsFileName = "credentials.json"

Variables

View Source
var (
	ErrYouAreNotLogin = errors.New("you are not logged in")
)

Functions

This section is empty.

Types

type CloudClient

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

func NewCloudClient

func NewCloudClient(serverUrl string) (*CloudClient, *schema.Diagnostics)

func (*CloudClient) BuildMetaContext

func (x *CloudClient) BuildMetaContext() context.Context

func (*CloudClient) CreateProject

func (x *CloudClient) CreateProject(projectName string) (*cloud.CreateProject_Response, *schema.Diagnostics)

CreateProject Returns the name of the project if the given project name already exists, otherwise creates the project and returns information about the project

func (*CloudClient) CreateTask

func (x *CloudClient) CreateTask(projectName string) (*cloud.CreateTask_Response, *schema.Diagnostics)

func (*CloudClient) DialCloudHost

func (x *CloudClient) DialCloudHost() (*grpc.ClientConn, error)

func (*CloudClient) FetchOrgDSN

func (x *CloudClient) FetchOrgDSN() (string, *schema.Diagnostics)

FetchOrgDSN Getting a user-configured database connection from the selefra cloud may not be configured

func (*CloudClient) GetCredentials

func (x *CloudClient) GetCredentials() (*CloudCredentials, *schema.Diagnostics)

GetCredentials Read the credentials stored in the local directory

func (*CloudClient) GetCredentialsWorkspacePath

func (x *CloudClient) GetCredentialsWorkspacePath() (string, *schema.Diagnostics)

GetCredentialsWorkspacePath get the Credentials save directory

func (*CloudClient) IsLoggedIn

func (x *CloudClient) IsLoggedIn() bool

IsLoggedIn Check whether the login status is current

func (*CloudClient) Login

func (x *CloudClient) Login(token string) (*CloudCredentials, *schema.Diagnostics)

Login Try to log in with the given token

func (*CloudClient) Logout

func (x *CloudClient) Logout() *schema.Diagnostics

Logout Log out the current token

func (*CloudClient) NewIssueStreamUploader

NewIssueStreamUploader Create a component that uploads Issues

func (*CloudClient) NewLogStreamUploader

NewLogStreamUploader Create a component that uploads logs

func (*CloudClient) SaveCredentials

func (x *CloudClient) SaveCredentials(credentials *CloudCredentials) *schema.Diagnostics

SaveCredentials Save the login credentials to the local directory

func (*CloudClient) SetToken

func (x *CloudClient) SetToken(token string)

func (*CloudClient) UploadWorkspace

func (x *CloudClient) UploadWorkspace(ctx context.Context, projectName, workspace string) *schema.Diagnostics

type CloudCredentials

type CloudCredentials struct {

	// The name of the token above is easy to remember
	// This name is set when the token is created on the cloud side
	TokenName string `json:"token_name"`

	// token used for authentication
	Token string `json:"token"`

	UserName string `json:"user_name"`

	OrgName string `json:"org_name"`

	ServerHost string `json:"server_host"`

	// Time of the last login
	LoginTime time.Time `json:"login_time"`

	// The last time the token was used
	LastUseTime time.Time `json:"last_login_time"`
}

CloudCredentials Credentials to connect to the selefra cloud

Jump to

Keyboard shortcuts

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