Documentation ¶
Index ¶
- Constants
- Variables
- type CloudClient
- func (x *CloudClient) BuildMetaContext() context.Context
- func (x *CloudClient) CreateProject(projectName string) (*cloud.CreateProject_Response, *schema.Diagnostics)
- func (x *CloudClient) CreateTask(projectName string) (*cloud.CreateTask_Response, *schema.Diagnostics)
- func (x *CloudClient) DialCloudHost() (*grpc.ClientConn, error)
- func (x *CloudClient) FetchOrgDSN() (string, *schema.Diagnostics)
- func (x *CloudClient) GetCredentials() (*CloudCredentials, *schema.Diagnostics)
- func (x *CloudClient) GetCredentialsWorkspacePath() (string, *schema.Diagnostics)
- func (x *CloudClient) IsLoggedIn() bool
- func (x *CloudClient) Login(token string) (*CloudCredentials, *schema.Diagnostics)
- func (x *CloudClient) Logout() *schema.Diagnostics
- func (x *CloudClient) NewIssueStreamUploader(messageChannel *message.Channel[*schema.Diagnostics]) (...)
- func (x *CloudClient) NewLogStreamUploader(messageChannel *message.Channel[*schema.Diagnostics]) (log.LogClient, ...)
- func (x *CloudClient) SaveCredentials(credentials *CloudCredentials) *schema.Diagnostics
- func (x *CloudClient) SetToken(token string)
- func (x *CloudClient) UploadWorkspace(ctx context.Context, projectName, workspace string) *schema.Diagnostics
- type CloudCredentials
Constants ¶
const ( IssueUploaderName = "issue-uploader" LogUploaderName = "log-uploader" )
const CredentialsFileName = "credentials.json"
Variables ¶
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 ¶
func (x *CloudClient) NewIssueStreamUploader(messageChannel *message.Channel[*schema.Diagnostics]) (*selefraGrpc.StreamUploader[issue.Issue_UploadIssueStreamClient, int, *issue.UploadIssueStream_Request, *issue.UploadIssueStream_Response], *schema.Diagnostics)
NewIssueStreamUploader Create a component that uploads Issues
func (*CloudClient) NewLogStreamUploader ¶
func (x *CloudClient) NewLogStreamUploader(messageChannel *message.Channel[*schema.Diagnostics]) (log.LogClient, *selefraGrpc.StreamUploader[log.Log_UploadLogStreamClient, int, *log.UploadLogStream_Request, *log.UploadLogStream_Response], *schema.Diagnostics)
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