Skip to content

Commit

Permalink
backend: add migration methods for redpanda api client
Browse files Browse the repository at this point in the history
Jira: CONSOLE-28
  • Loading branch information
weeco committed Oct 25, 2024
1 parent 72445fc commit 7d372d2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require (
github.com/redpanda-data/benthos/v4 v4.35.0
github.com/redpanda-data/common-go/api v0.0.0-20240918135346-6c838a508d64
github.com/redpanda-data/common-go/net v0.1.1-0.20240429123545-4da3d2b371f7
github.com/redpanda-data/common-go/rpadmin v0.1.7-0.20240924011720-7c27dd07c8df
github.com/redpanda-data/common-go/rpadmin v0.1.10-0.20241024193040-af78b0194a1f
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
github.com/stretchr/testify v1.9.0
github.com/testcontainers/testcontainers-go v0.32.0
Expand Down
4 changes: 4 additions & 0 deletions backend/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,10 @@ github.com/redpanda-data/common-go/rpadmin v0.1.3 h1:JRdr4rHcdr+A0hHr+viJYnPm+dP
github.com/redpanda-data/common-go/rpadmin v0.1.3/go.mod h1:I7umqhnMhIOSEnIA3fvLtdQU7QO/SbWGCwFfFDs3De4=
github.com/redpanda-data/common-go/rpadmin v0.1.7-0.20240924011720-7c27dd07c8df h1:xIOCcyLOVi/7GlzizOeQ0UyXpCprDV1mhlmNqDCyPXQ=
github.com/redpanda-data/common-go/rpadmin v0.1.7-0.20240924011720-7c27dd07c8df/go.mod h1:I7umqhnMhIOSEnIA3fvLtdQU7QO/SbWGCwFfFDs3De4=
github.com/redpanda-data/common-go/rpadmin v0.1.9 h1:X5a95P7Dc+7EaidU7dusWJyiG3eJmk4zJtUttfvhmc4=
github.com/redpanda-data/common-go/rpadmin v0.1.9/go.mod h1:I7umqhnMhIOSEnIA3fvLtdQU7QO/SbWGCwFfFDs3De4=
github.com/redpanda-data/common-go/rpadmin v0.1.10-0.20241024193040-af78b0194a1f h1:yICqdmqcjoQyN7EuuwNTwWfS1eUYFY4ucxWG/rUqpfs=
github.com/redpanda-data/common-go/rpadmin v0.1.10-0.20241024193040-af78b0194a1f/go.mod h1:I7umqhnMhIOSEnIA3fvLtdQU7QO/SbWGCwFfFDs3De4=
github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA=
github.com/rickb777/period v1.0.6 h1:f4TcHBtL/4qa4D44eqgxs7785/kfLKUjRI7XYI2HCvk=
github.com/rickb777/period v1.0.6/go.mod h1:TKkPHI/WSyjjVdeVCyqwBoQg0Cdb/jRvnc8FFdq2cgw=
Expand Down
29 changes: 27 additions & 2 deletions backend/pkg/redpanda/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,41 @@ func (s *Service) UpdateRoleMembership(ctx context.Context, roleName string, add
return s.adminClient.UpdateRoleMembership(ctx, roleName, add, remove, createRole)
}

// MountTopics mounts topics according to the provided configuration
// MountTopics mounts topics according to the provided configuration.
func (s *Service) MountTopics(ctx context.Context, config adminapi.MountConfiguration) (adminapi.MigrationInfo, error) {
return s.adminClient.MountTopics(ctx, config)
}

// UnmountTopics unmounts topics according to the provided configuration
// UnmountTopics unmounts topics according to the provided configuration.
func (s *Service) UnmountTopics(ctx context.Context, config adminapi.UnmountConfiguration) (adminapi.MigrationInfo, error) {
return s.adminClient.UnmountTopics(ctx, config)
}

// ListMountableTopics retrieves a list of topics that can be mounted from cloud storage.
func (s *Service) ListMountableTopics(ctx context.Context) (adminapi.ListMountableTopicsResponse, error) {
return s.adminClient.ListMountableTopics(ctx)
}

// ListMountTasks returns a list of all ongoing mount, and unmount operations.
func (s *Service) ListMountTasks(ctx context.Context) ([]adminapi.MigrationState, error) {
return s.adminClient.ListMigrations(ctx)
}

// GetMountTask describes the state of the requested mount task.
func (s *Service) GetMountTask(ctx context.Context, id int) (adminapi.MigrationState, error) {
return s.adminClient.GetMigration(ctx, id)
}

// DeleteMountTask removes a mount task.
func (s *Service) DeleteMountTask(ctx context.Context, id int) error {
return s.adminClient.DeleteMigration(ctx, id)
}

// UpdateMountTask executes a migration action (e.g. cancel) on the given mount or unmount task.
func (s *Service) UpdateMountTask(ctx context.Context, id int, action adminapi.MigrationAction) error {
return s.adminClient.ExecuteMigration(ctx, id, action)
}

// CheckFeature checks whether redpanda has the specified feature in the specified state.
// Multiple states can be passed to check if feature state is any one of the given states.
// For example if "active" OR "available".
Expand Down

0 comments on commit 7d372d2

Please sign in to comment.