@@ -1409,51 +1409,46 @@ func (s *UsersService) DisableTwoFactor(user int, options ...RequestOptionFunc)
1409
1409
}
1410
1410
}
1411
1411
1412
- // CreateUserRunnerOptions represents the options available when creating a GitLab Runner
1413
- // using the new user-based flow.
1412
+ // UserRunner represents a GitLab runner linked to the current user.
1414
1413
//
1415
1414
// GitLab API docs:
1416
1415
// https://docs.gitlab.com/ee/api/users.html#create-a-runner
1417
- type CreateUserRunnerOptions struct {
1418
- RunnerType string `json:"runner_type"`
1419
- GroupID int `json:"group_id"`
1420
- ProjectID int `json:"project_id"`
1421
- Description string `json:"description"`
1422
- Paused bool `json:"paused"`
1423
- Locked bool `json:"locked"`
1424
- RunUntagged bool `json:"run_untagged"`
1425
- TagList []string `json:"tag_list"`
1426
- AccessLevel string `json:"access_level"`
1427
- MaximumTimeout int `json:"maximum_timeout"`
1428
- MaintenanceNote string `json:"maintenance_note"`
1416
+ type UserRunner struct {
1417
+ ID int `json:"id"`
1418
+ Token string `json:"token"`
1419
+ TokenExpiresAt * time.Time `json:"token_expires_at"`
1429
1420
}
1430
1421
1431
- // UserRunner represents the a GitLab runner instance created using the user-based flow
1422
+ // CreateUserRunnerOptions represents the available CreateUserRunner() options.
1432
1423
//
1433
1424
// GitLab API docs:
1434
1425
// https://docs.gitlab.com/ee/api/users.html#create-a-runner
1435
- type UserRunner struct {
1436
- ID int `json:"id"`
1437
- Token string `json:"token"`
1438
- TokenExpiresAt string `json:"token_expires_at"`
1426
+ type CreateUserRunnerOptions struct {
1427
+ RunnerType * string `url:"runner_type,omitempty" json:"runner_type,omitempty"`
1428
+ GroupID * int `url:"group_id,omitempty" json:"group_id,omitempty"`
1429
+ ProjectID * int `url:"project_id,omitempty" json:"project_id,omitempty"`
1430
+ Description * string `url:"description,omitempty" json:"description,omitempty"`
1431
+ Paused * bool `url:"paused,omitempty" json:"paused,omitempty"`
1432
+ Locked * bool `url:"locked,omitempty" json:"locked,omitempty"`
1433
+ RunUntagged * bool `url:"run_untagged,omitempty" json:"run_untagged,omitempty"`
1434
+ TagList * []string `url:"tag_list,omitempty" json:"tag_list,omitempty"`
1435
+ AccessLevel * string `url:"access_level,omitempty" json:"access_level,omitempty"`
1436
+ MaximumTimeout * int `url:"maximum_timeout,omitempty" json:"maximum_timeout,omitempty"`
1437
+ MaintenanceNote * string `url:"maintenance_note,omitempty" json:"maintenance_note,omitempty"`
1439
1438
}
1440
1439
1441
- // CreateUserRunner creates a new runner using the user-based flow and returns the authentication
1442
- // token.
1440
+ // CreateUserRunner creates a runner linked to the current user.
1443
1441
//
1444
1442
// GitLab API docs:
1445
1443
// https://docs.gitlab.com/ee/api/users.html#create-a-runner
1446
- func (s * UsersService ) CreateUserRunner (runnerOpts * CreateUserRunnerOptions , options ... RequestOptionFunc ) (* UserRunner , * Response , error ) {
1447
- // The user who owns the runner comes from the access token used to authorize the request.
1448
- u := "user/runners"
1449
-
1450
- req , err := s .client .NewRequest (http .MethodPost , u , runnerOpts , options )
1444
+ func (s * UsersService ) CreateUserRunner (opts * CreateUserRunnerOptions , options ... RequestOptionFunc ) (* UserRunner , * Response , error ) {
1445
+ req , err := s .client .NewRequest (http .MethodPost , "user/runners" , opts , options )
1451
1446
if err != nil {
1452
1447
return nil , nil , err
1453
1448
}
1454
1449
1455
- var r * UserRunner
1456
- resp , err := s .client .Do (req , & r )
1450
+ r := new ( UserRunner )
1451
+ resp , err := s .client .Do (req , r )
1457
1452
if err != nil {
1458
1453
return nil , resp , err
1459
1454
}
0 commit comments