| // Copyright 2023 The Fuchsia Authors. All rights reserved |
| // Use of this source code is governed by a BSD-style license that can |
| // found in the LICENSE file. |
| package main |
| |
| import ( |
| "context" |
| "fmt" |
| |
| "go.chromium.org/luci/auth" |
| "go.chromium.org/luci/common/api/swarming/swarming/v1" |
| ) |
| |
| type Swarming struct { |
| client *swarming.Service |
| } |
| |
| func NewSwarming(ctx context.Context) (*Swarming, error) { |
| authenticator := auth.NewAuthenticator(ctx, auth.SilentLogin, auth.Options{}) |
| httpClient, err := authenticator.Client() |
| if err != nil { |
| return nil, fmt.Errorf("authenticator.Client: %v", err) |
| } |
| swarmingClient, err := swarming.New(httpClient) |
| if err != nil { |
| return nil, fmt.Errorf("swarming.New: %v", err) |
| } |
| swarming := &Swarming{ |
| client: swarmingClient, |
| } |
| return swarming, nil |
| } |
| |
| func (s *Swarming) LaunchTask() (string, error) { |
| // TODO(b/258456267): Launch swarming task... |
| return "foo", nil |
| } |