MCPcopy Create free account
hub / github.com/cloudbase/garm / newActionsRequest

Method newActionsRequest

util/github/scalesets/util.go:26–65  ·  view source on GitHub ↗
(ctx context.Context, method, uriPath string, body io.Reader)

Source from the content-addressed store, hash-verified

24)
25
26func (s *ScaleSetClient) newActionsRequest(ctx context.Context, method, uriPath string, body io.Reader) (*http.Request, error) {
27 if err := s.ensureAdminInfo(ctx); err != nil {
28 return nil, fmt.Errorf("failed to update token: %w", err)
29 }
30
31 actionsURI, err := s.actionsServiceInfo.GetURL()
32 if err != nil {
33 return nil, fmt.Errorf("failed to get pipeline URL: %w", err)
34 }
35
36 pathURI, err := url.Parse(uriPath)
37 if err != nil {
38 return nil, fmt.Errorf("failed to parse path: %w", err)
39 }
40 pathQuery := pathURI.Query()
41 baseQuery := actionsURI.Query()
42 for k, values := range pathQuery {
43 if baseQuery.Get(k) == "" {
44 for _, val := range values {
45 baseQuery.Add(k, val)
46 }
47 }
48 }
49 if baseQuery.Get("api-version") == "" {
50 baseQuery.Set("api-version", "6.0-preview")
51 }
52
53 actionsURI.Path = path.Join(actionsURI.Path, pathURI.Path)
54 actionsURI.RawQuery = baseQuery.Encode()
55
56 req, err := http.NewRequestWithContext(ctx, method, actionsURI.String(), body)
57 if err != nil {
58 return nil, err
59 }
60
61 req.Header.Set("Content-Type", "application/json")
62 req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", s.actionsServiceInfo.Token))
63
64 return req, nil
65}

Callers 15

GetRunnerMethod · 0.95
ListAllRunnersMethod · 0.95
GetRunnerByNameMethod · 0.95
RemoveRunnerMethod · 0.95
AcquireJobsMethod · 0.95
GetAcquirableJobsMethod · 0.95
CreateMessageSessionMethod · 0.95
DeleteMessageSessionMethod · 0.95
GetRunnerScaleSetByIDMethod · 0.95
ListRunnerScaleSetsMethod · 0.95

Calls 6

ensureAdminInfoMethod · 0.95
AddMethod · 0.80
GetURLMethod · 0.45
GetMethod · 0.45
SetMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected