Skip to content

Commit

Permalink
Use separate options for each schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
nwestbury committed Jul 19, 2023
1 parent 86dd632 commit f2c344c
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions snippet_repository_storage_move.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,20 @@ func (s SnippetRepositoryStorageMoveService) GetStorageMoveForSnippet(snippet in
return ssm, resp, err
}

// ScheduleSnippetStorageMoveOptions represents the available options
// for ScheduleAllSnippetStorageMoves() and ScheduleStorageMoveForSnippet()
// ScheduleStorageMoveForSnippetOptions represents the available options
// for ScheduleStorageMoveForSnippet()
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/snippet_repository_storage_moves.html
type ScheduleSnippetStorageMoveOptions struct {
SourceStorageName string `json:"source_storage_name,omitempty"`
type ScheduleStorageMoveForSnippetOptions struct {
DestinationStorageName string `json:"destination_storage_name,omitempty"`
}

// ScheduleStorageMoveForSnippet schedule a repository to be moved for a snippet.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/snippet_repository_storage_moves.html#schedule-a-repository-storage-move-for-a-snippet
func (s SnippetRepositoryStorageMoveService) ScheduleStorageMoveForSnippet(snippet int, opts ScheduleSnippetStorageMoveOptions, options ...RequestOptionFunc) (*SnippetRepositoryStorageMove, *Response, error) {
func (s SnippetRepositoryStorageMoveService) ScheduleStorageMoveForSnippet(snippet int, opts ScheduleStorageMoveForSnippetOptions, options ...RequestOptionFunc) (*SnippetRepositoryStorageMove, *Response, error) {
u := fmt.Sprintf("snippets/%d/repository_storage_moves", snippet)

req, err := s.client.NewRequest(http.MethodPost, u, opts, options)
Expand All @@ -183,11 +182,21 @@ func (s SnippetRepositoryStorageMoveService) ScheduleStorageMoveForSnippet(snipp
return ssm, resp, err
}

// ScheduleAllSnippetStorageMovesOptions represents the available options
// for ScheduleAllSnippetStorageMoves()
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/snippet_repository_storage_moves.html
type ScheduleAllSnippetStorageMovesOptions struct {
SourceStorageName string `json:"source_storage_name,omitempty"`
DestinationStorageName string `json:"destination_storage_name,omitempty"`
}

// ScheduleAllSnippetStorageMoves schedules all snippet repositories to be moved.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/snippet_repository_storage_moves.html#schedule-repository-storage-moves-for-all-snippets-on-a-storage-shard
func (s SnippetRepositoryStorageMoveService) ScheduleAllSnippetStorageMoves(opts ScheduleSnippetStorageMoveOptions, options ...RequestOptionFunc) (*Response, error) {
func (s SnippetRepositoryStorageMoveService) ScheduleAllSnippetStorageMoves(opts ScheduleAllSnippetStorageMovesOptions, options ...RequestOptionFunc) (*Response, error) {
req, err := s.client.NewRequest(http.MethodPost, "snippet_repository_storage_moves", opts, options)
if err != nil {
return nil, err
Expand Down

0 comments on commit f2c344c

Please sign in to comment.