func (a Actions) List(fields ...string) ([]Test, error) {
	if len(fields) == 0 {
		fields = TestFields[:]
	}
	resp, err := a.down.ListActions(listMask(a.ctx, fields...), &resultstore.ListActionsRequest{
		Parent: a.configuredTarget,
	})
	if err != nil {
		return nil, err
	}
	var ret []Test
	for _, r := range resp.Actions {
		ret = append(ret, fromTest(r))
	}
	return ret, nil
}
List tests in this configured target.
package resultstore
import (
	"context"
	"crypto/x509"
	"fmt"
	"strings"
	"github.com/google/uuid"
	resultstore "google.golang.org/genproto/googleapis/devtools/resultstore/v2"
	"google.golang.org/genproto/protobuf/field_mask"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials"
	"google.golang.org/grpc/credentials/oauth"
	"google.golang.org/grpc/metadata"
)
func Connect(ctx context.Context, serviceAccountPath string) (*grpc.ClientConn, error) {
	pool, err := x509.SystemCertPool()
	if err != nil {
		return nil, fmt.Errorf("system cert pool: %v", err)
	}
	creds := credentials.NewClientTLSFromCert(pool, "")
	const scope = "https://www.googleapis.com/auth/cloud-platform"
	var perRPC credentials.PerRPCCredentials
	if serviceAccountPath != "" {
		perRPC, err = oauth.NewServiceAccountFromFile(serviceAccountPath, scope)
	} else {
		perRPC, err = oauth.NewApplicationDefault(ctx, scope)
	}
	if err != nil {
		return nil, fmt.Errorf("create oauth: %v", err)
	}
	conn, err := grpc.Dial(
		"resultstore.googleapis.com:443",
		grpc.WithTransportCredentials(creds),
		grpc.WithPerRPCCredentials(perRPC),
	)
	if err != nil {
		return nil, fmt.Errorf("dial: %v", err)
	}
	return conn, nil
}
type Secret string
func UUID() string {
	return uuid.New().String()
}
func NewSecret() Secret {
	return Secret(UUID())
}
type Client struct {
	up    resultstore.ResultStoreUploadClient
	down  resultstore.ResultStoreDownloadClient
	ctx   context.Context
	token string
}
func NewClient(conn *grpc.ClientConn) *Client {
	return &Client{
		up:   resultstore.NewResultStoreUploadClient(conn),
		down: resultstore.NewResultStoreDownloadClient(conn),
		ctx:  context.Background(),
	}
}
func (c *Client) WithContext(ctx context.Context) *Client {
	c.ctx = ctx
	return c
}
func (c *Client) WithSecret(authorizationToken Secret) *Client {
	c.token = string(authorizationToken)
	return c
}
func (c Client) Invocations() Invocations {
	return Invocations{
		Client: c,
	}
}
func (c Client) Configurations(invocationName string) Configurations {
	return Configurations{
		Client: c,
		inv:    invocationName,
	}
}
func (c Client) Targets(invocationName string) Targets {
	return Targets{
		Client: c,
		inv:    invocationName,
	}
}
func (c Client) ConfiguredTargets(targetName, configID string) ConfiguredTargets {
	return ConfiguredTargets{
		Client: c,
		target: targetName,
		config: configID,
	}
}
func (c Client) Actions(configuredTargetName string) Actions {
	return Actions{
		Client:           c,
		configuredTarget: configuredTargetName,
	}
}
type Invocations struct {
	Client
}
type Targets struct {
	Client
	inv string
}
type Configurations struct {
	Client
	inv string
}
type ConfiguredTargets struct {
	Client
	target string
	config string
}
type Actions struct {
	Client
	configuredTarget string
}
func fieldMask(ctx context.Context, fields ...string) context.Context {
	return metadata.AppendToOutgoingContext(ctx, "X-Goog-FieldMask", strings.Join(fields, ","))
}
func listMask(ctx context.Context, fields ...string) context.Context {
	return fieldMask(ctx, append(fields, "next_page_token")...)
}
func (t Targets) Create(id string, target Target) (string, error) {
	tgt, err := t.up.CreateTarget(t.ctx, &resultstore.CreateTargetRequest{
		Parent:             t.inv,
		TargetId:           id,
		Target:             target.To(),
		AuthorizationToken: t.token,
	})
	if err != nil {
		return "", err
	}
	return tgt.Name, nil
}
func (t Targets) List(fields ...string) ([]Target, error) {
	resp, err := t.down.ListTargets(listMask(t.ctx, fields...), &resultstore.ListTargetsRequest{
		Parent: t.inv,
	})
	if err != nil {
		return nil, err
	}
	var targets []Target
	for _, r := range resp.Targets {
		targets = append(targets, fromTarget(r))
	}
	return targets, nil
}
const (
	Default = "default"
)
func (c Configurations) Create(id string) (string, error) {
	config, err := c.up.CreateConfiguration(c.ctx, &resultstore.CreateConfigurationRequest{
		Parent:             c.inv,
		ConfigId:           id,
		AuthorizationToken: c.token,
	})
	if err != nil {
		return "", err
	}
	return config.Name, nil
}
func (ct ConfiguredTargets) Create(act Action) (string, error) {
	resp, err := ct.up.CreateConfiguredTarget(ct.ctx, &resultstore.CreateConfiguredTargetRequest{
		Parent:             ct.target,
		ConfigId:           ct.config,
		AuthorizationToken: ct.token,
		ConfiguredTarget: &resultstore.ConfiguredTarget{
			StatusAttributes: status(act.Status, act.Description),
		},
	})
	if err != nil {
		return "", err
	}
	return resp.Name, nil
}
func (a Actions) Create(id string, test Test) (string, error) {
	resp, err := a.up.CreateAction(a.ctx, &resultstore.CreateActionRequest{
		Parent:             a.configuredTarget,
		ActionId:           id,
		AuthorizationToken: a.token,
		Action:             test.To(),
	})
	if err != nil {
		return "", err
	}
	return resp.Name, nil
}
var TestFields = [...]string{
	"actions.name",
	"actions.test_action",
	"actions.description",
	"actions.timing",
}