Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,20 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.23.2
- run: go generate ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: v1.49.0
args: -v
skip-cache: true
version: v1.60.2
args: --verbose --timeout 20m --max-same-issues=30 --allow-parallel-runners
go-tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.23.2
- name: Verify tidy
run: |
go mod tidy
Expand All @@ -41,7 +40,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.23.2
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: "1.3.*"
Expand Down
4 changes: 4 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ linters-settings:
disabled: true
- name: early-return
disabled: true
- name: use-any
disabled: true
- name: unchecked-type-assertion
disabled: true
gocritic:
disabled-checks:
- ifElseChain
Expand Down
12 changes: 0 additions & 12 deletions api/auth.go

This file was deleted.

44 changes: 24 additions & 20 deletions api/client.go
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
package api

import "context"
import (
"context"

v1pb "buf.build/gen/go/bytebase/bytebase/protocolbuffers/go/v1"
)

// Client is the API message for Bytebase OpenAPI client.
type Client interface {
// Auth
// Login will login the user and get the response.
Login() (*AuthResponse, error)
Login() (*v1pb.LoginResponse, error)

// Environment
// CreateEnvironment creates the environment.
CreateEnvironment(ctx context.Context, environmentID string, create *EnvironmentMessage) (*EnvironmentMessage, error)
CreateEnvironment(ctx context.Context, environmentID string, create *v1pb.Environment) (*v1pb.Environment, error)
// GetEnvironment gets the environment by id.
GetEnvironment(ctx context.Context, environmentName string) (*EnvironmentMessage, error)
GetEnvironment(ctx context.Context, environmentName string) (*v1pb.Environment, error)
// ListEnvironment finds all environments.
ListEnvironment(ctx context.Context, showDeleted bool) (*ListEnvironmentMessage, error)
ListEnvironment(ctx context.Context, showDeleted bool) (*v1pb.ListEnvironmentsResponse, error)
// UpdateEnvironment updates the environment.
UpdateEnvironment(ctx context.Context, patch *EnvironmentPatchMessage) (*EnvironmentMessage, error)
UpdateEnvironment(ctx context.Context, patch *v1pb.Environment, updateMask []string) (*v1pb.Environment, error)
// DeleteEnvironment deletes the environment.
DeleteEnvironment(ctx context.Context, environmentName string) error
// UndeleteEnvironment undeletes the environment.
UndeleteEnvironment(ctx context.Context, environmentName string) (*EnvironmentMessage, error)
UndeleteEnvironment(ctx context.Context, environmentName string) (*v1pb.Environment, error)

// Instance
// ListInstance will return instances.
ListInstance(ctx context.Context, find *InstanceFindMessage) (*ListInstanceMessage, error)
ListInstance(ctx context.Context, showDeleted bool) (*v1pb.ListInstancesResponse, error)
// GetInstance gets the instance by id.
GetInstance(ctx context.Context, instanceName string) (*InstanceMessage, error)
GetInstance(ctx context.Context, instanceName string) (*v1pb.Instance, error)
// CreateInstance creates the instance.
CreateInstance(ctx context.Context, instanceID string, instance *InstanceMessage) (*InstanceMessage, error)
CreateInstance(ctx context.Context, instanceID string, instance *v1pb.Instance) (*v1pb.Instance, error)
// UpdateInstance updates the instance.
UpdateInstance(ctx context.Context, patch *InstancePatchMessage) (*InstanceMessage, error)
UpdateInstance(ctx context.Context, patch *v1pb.Instance, updateMasks []string) (*v1pb.Instance, error)
// DeleteInstance deletes the instance.
DeleteInstance(ctx context.Context, instanceName string) error
// UndeleteInstance undeletes the instance.
UndeleteInstance(ctx context.Context, instanceName string) (*InstanceMessage, error)
UndeleteInstance(ctx context.Context, instanceName string) (*v1pb.Instance, error)
// SyncInstanceSchema will trigger the schema sync for an instance.
SyncInstanceSchema(ctx context.Context, instanceName string) error

Expand All @@ -50,23 +54,23 @@ type Client interface {

// Database
// GetDatabase gets the database by instance resource id and the database name.
GetDatabase(ctx context.Context, databaseName string) (*DatabaseMessage, error)
GetDatabase(ctx context.Context, databaseName string) (*v1pb.Database, error)
// ListDatabase list the databases.
ListDatabase(ctx context.Context, find *DatabaseFindMessage) (*ListDatabaseMessage, error)
ListDatabase(ctx context.Context, instanceID, filter string) (*v1pb.ListDatabasesResponse, error)
// UpdateDatabase patches the database.
UpdateDatabase(ctx context.Context, patch *DatabasePatchMessage) (*DatabaseMessage, error)
UpdateDatabase(ctx context.Context, patch *v1pb.Database, updateMasks []string) (*v1pb.Database, error)

// Project
// GetProject gets the project by resource id.
GetProject(ctx context.Context, projectName string) (*ProjectMessage, error)
GetProject(ctx context.Context, projectName string) (*v1pb.Project, error)
// ListProject list the projects,
ListProject(ctx context.Context, showDeleted bool) (*ListProjectMessage, error)
ListProject(ctx context.Context, showDeleted bool) (*v1pb.ListProjectsResponse, error)
// CreateProject creates the project.
CreateProject(ctx context.Context, projectID string, project *ProjectMessage) (*ProjectMessage, error)
CreateProject(ctx context.Context, projectID string, project *v1pb.Project) (*v1pb.Project, error)
// UpdateProject updates the project.
UpdateProject(ctx context.Context, patch *ProjectPatchMessage) (*ProjectMessage, error)
UpdateProject(ctx context.Context, patch *v1pb.Project, updateMask []string) (*v1pb.Project, error)
// DeleteProject deletes the project.
DeleteProject(ctx context.Context, projectName string) error
// UndeleteProject undeletes the project.
UndeleteProject(ctx context.Context, projectName string) (*ProjectMessage, error)
UndeleteProject(ctx context.Context, projectName string) (*v1pb.Project, error)
}
45 changes: 0 additions & 45 deletions api/common.go

This file was deleted.

25 changes: 0 additions & 25 deletions api/data_source.go

This file was deleted.

35 changes: 0 additions & 35 deletions api/database.go

This file was deleted.

36 changes: 0 additions & 36 deletions api/environment.go

This file was deleted.

34 changes: 0 additions & 34 deletions api/instance.go

This file was deleted.

35 changes: 0 additions & 35 deletions api/project.go

This file was deleted.

Loading
Loading