Documentation
¶
Overview ¶
Package androidapi provides library functions for interating with Android One platform APIs go/ants-api#one-platform
Index ¶
- func FetchCredentials(rt RunType) (*google.Credentials, error)
- func GetAndroidOnePlatformClient(rt RunType) (*http.Client, error)
- func GetLatestGreenBuildNumber(rt RunType, buildsReq BuildGetRequest) (int, error)
- func NewWorkUnit(parentWUId, invocationID, name string, ...) *atp.WorkUnit
- type AndroidBuildAPIOptions
- type BuildGetRequest
- type ChildNodes
- type InvocationService
- type InvocationServiceImpl
- func (w *InvocationServiceImpl) Get(ctx context.Context, resourceID string) (*atp.Invocation, error)
- func (w *InvocationServiceImpl) Insert(invocation *atp.Invocation) (*atp.Invocation, error)
- func (w *InvocationServiceImpl) List(ctx context.Context, invocationID string, options AndroidBuildAPIOptions) (*atp.InvocationListResponse, error)
- func (w *InvocationServiceImpl) Patch(resourceID string, invocation *atp.Invocation) (*atp.Invocation, error)
- func (w *InvocationServiceImpl) Update(resourceID string, invocation *atp.Invocation) (*atp.Invocation, error)
- type InvocationState
- type RunType
- type Service
- type TestArtifactsService
- type TestArtifactsServiceImpl
- func (w *TestArtifactsServiceImpl) Get(resourceID string) (*atp.BuildArtifactMetadata, error)
- func (w *TestArtifactsServiceImpl) List(ctx context.Context, invocationID string, options AndroidBuildAPIOptions) (*atp.TestArtifactListResponse, error)
- func (w *TestArtifactsServiceImpl) Update(resourceID string, reader io.Reader, metadata *atp.BuildArtifactMetadata) (*atp.BuildArtifactMetadata, error)
- type TestResultService
- type TestResultServiceImpl
- func (w *TestResultServiceImpl) BatchInsert(ctx context.Context, invocationID string, ...) (*atp.TestResultBatchInsertResponse, error)
- func (w *TestResultServiceImpl) Get(resourceID int64) (*atp.TestResult, error)
- func (w *TestResultServiceImpl) Insert(testResult *atp.TestResult) (*atp.TestResult, error)
- func (w *TestResultServiceImpl) List(ctx context.Context, invocationID string, options AndroidBuildAPIOptions) (*atp.TestResultListResponse, error)
- func (w *TestResultServiceImpl) Update(resourceID int64, testResult *atp.TestResult) (*atp.TestResult, error)
- type WULayer
- type WorkUnitNode
- func (w *WorkUnitNode) AddChild(node *WorkUnitNode) error
- func (w *WorkUnitNode) FetchAttemptLayer() ([][]*WorkUnitNode, error)
- func (w *WorkUnitNode) FetchHead() (*WorkUnitNode, error)
- func (w *WorkUnitNode) FetchRunLayer() ([]*WorkUnitNode, error)
- func (w *WorkUnitNode) FetchShardLayer() ([][]*WorkUnitNode, error)
- func (w *WorkUnitNode) GetChildren() ChildNodes
- func (w *WorkUnitNode) GetIndex() int
- func (w *WorkUnitNode) GetLayer() WULayer
- func (w *WorkUnitNode) GetParent() *WorkUnitNode
- func (w *WorkUnitNode) GetWorkUnit() *atp.WorkUnit
- func (w *WorkUnitNode) SetWorkUnit(newWU *atp.WorkUnit)
- type WorkUnitService
- type WorkUnitServiceImpl
- func (w *WorkUnitServiceImpl) Get(resourceID string) (*atp.WorkUnit, error)
- func (w *WorkUnitServiceImpl) Insert(workunit *atp.WorkUnit) (*atp.WorkUnit, error)
- func (w *WorkUnitServiceImpl) List(ctx context.Context, invocationID string, options AndroidBuildAPIOptions) (*atp.WorkUnitListResponse, error)
- func (w *WorkUnitServiceImpl) Patch(resourceID string, workunit *atp.WorkUnit) (*atp.WorkUnit, error)
- func (w *WorkUnitServiceImpl) Update(resourceID string, workunit *atp.WorkUnit) (*atp.WorkUnit, error)
- type WorkUnitState
- type WorkUnitTree
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchCredentials ¶
func FetchCredentials(rt RunType) (*google.Credentials, error)
FetchCredentials fetches creds for authentication.
func GetAndroidOnePlatformClient ¶
GetAndroidOnePlatformClient returns an HTTP client for making REST calls to Android One platform APIs. The rt parameter specifies the environment, determining whether the client is used on a bot with an attached Service Account (SA), within a container, or in a local environment.
func GetLatestGreenBuildNumber ¶
func GetLatestGreenBuildNumber(rt RunType, buildsReq BuildGetRequest) (int, error)
GetLatestGreenBuildNumber calls the android one platform api to get latest build version
Types ¶
type AndroidBuildAPIOptions ¶
type AndroidBuildAPIOptions struct { // The optional page token for the request. // If empty, the first page will be returned. PageToken string // The max results to be returned by the API. // If empty, the default max results will be used. MaxResults int64 }
AndroidBuildAPIOptions represents the common request options when communicating with android build API.
type BuildGetRequest ¶
type BuildGetRequest struct { BuildType string Branch string MaxResults string SortingType string Successful string Board string }
BuildGetRequest defines get request params for builds endpoint
type ChildNodes ¶
type ChildNodes []*WorkUnitNode
ChildNodes implements sort.Interface so that we can iterate according to the node's index.
func (ChildNodes) Len ¶
func (c ChildNodes) Len() int
func (ChildNodes) Less ¶
func (c ChildNodes) Less(i, j int) bool
func (ChildNodes) Swap ¶
func (c ChildNodes) Swap(i, j int)
type InvocationService ¶
type InvocationService interface { Get(ctx context.Context, resourceID string) (*atp.Invocation, error) Insert(invocation *atp.Invocation) (*atp.Invocation, error) Update(resourceID string, invocation *atp.Invocation) (*atp.Invocation, error) Patch(resourceID string, invocation *atp.Invocation) (*atp.Invocation, error) List(ctx context.Context, invocationID string, options AndroidBuildAPIOptions) (*atp.InvocationListResponse, error) }
InvocationService handles API calls related to invocations.
type InvocationServiceImpl ¶
type InvocationServiceImpl struct {
// contains filtered or unexported fields
}
InvocationServiceImpl is the RPC implementation of InvocationService.
func (*InvocationServiceImpl) Get ¶
func (w *InvocationServiceImpl) Get(ctx context.Context, resourceID string) (*atp.Invocation, error)
Get implementation for invocations.
func (*InvocationServiceImpl) Insert ¶
func (w *InvocationServiceImpl) Insert(invocation *atp.Invocation) (*atp.Invocation, error)
Insert implementation for invocations.
func (*InvocationServiceImpl) List ¶
func (w *InvocationServiceImpl) List(ctx context.Context, invocationID string, options AndroidBuildAPIOptions) (*atp.InvocationListResponse, error)
List implementation for invocations.
func (*InvocationServiceImpl) Patch ¶
func (w *InvocationServiceImpl) Patch(resourceID string, invocation *atp.Invocation) (*atp.Invocation, error)
Patch implementation for invocations.
func (*InvocationServiceImpl) Update ¶
func (w *InvocationServiceImpl) Update(resourceID string, invocation *atp.Invocation) (*atp.Invocation, error)
Update implementation for invocations.
type InvocationState ¶
type InvocationState int
const ( InvocationUnspecified InvocationState = iota InvocationQueued InvocationRunning InvocationError InvocationCompleted InvocationCancelled InvocationPending InvocationSkipped )
func (InvocationState) String ¶
func (w InvocationState) String() string
type RunType ¶
type RunType int
RunType is enum defining where would client be executed
Define constants for RunType
type Service ¶
type Service struct { WorkUnitService WorkUnitService InvocationService InvocationService TestResultService TestResultService TestArtifactsService TestArtifactsService }
Service is used for accessing the android build api. It is broken into sub services similar to the underlying API. All sub services share the same client, so the caller needs to initialize it when the service is first used.
func NewAndroidBuildService ¶
func NewAndroidBuildService(ctx context.Context, rt RunType, env common.Environment) (*Service, error)
NewAndroidBuildService returns a new service which is used to interact with the android build api. It initializes the build client depending on rt RunType(environment SA, container or local)
type TestArtifactsService ¶
type TestArtifactsService interface { Get(resourceID string) (*atp.BuildArtifactMetadata, error) Update(resourceID string, reader io.Reader, metadata *atp.BuildArtifactMetadata) (*atp.BuildArtifactMetadata, error) List(ctx context.Context, invocationID string, options AndroidBuildAPIOptions) (*atp.TestArtifactListResponse, error) }
TestArtifactsService handles API calls related to testResults.
type TestArtifactsServiceImpl ¶
type TestArtifactsServiceImpl struct {
// contains filtered or unexported fields
}
TestArtifactsServiceImpl is the RPC implementation of TestArtifactsService.
func (*TestArtifactsServiceImpl) Get ¶
func (w *TestArtifactsServiceImpl) Get(resourceID string) (*atp.BuildArtifactMetadata, error)
Get implmentation for test artifact metadata.
func (*TestArtifactsServiceImpl) List ¶
func (w *TestArtifactsServiceImpl) List(ctx context.Context, invocationID string, options AndroidBuildAPIOptions) (*atp.TestArtifactListResponse, error)
List implmentation for test artifact.
func (*TestArtifactsServiceImpl) Update ¶
func (w *TestArtifactsServiceImpl) Update(resourceID string, reader io.Reader, metadata *atp.BuildArtifactMetadata) (*atp.BuildArtifactMetadata, error)
Update implementation for test artifact metadata.
type TestResultService ¶
type TestResultService interface { Get(resourceID int64) (*atp.TestResult, error) Insert(testResult *atp.TestResult) (*atp.TestResult, error) BatchInsert(ctx context.Context, invocationID string, request *atp.TestResultBatchInsertRequest) (*atp.TestResultBatchInsertResponse, error) Update(resourceID int64, testResult *atp.TestResult) (*atp.TestResult, error) List(ctx context.Context, invocationID string, options AndroidBuildAPIOptions) (*atp.TestResultListResponse, error) }
TestResultService handles API calls related to testResults.
type TestResultServiceImpl ¶
type TestResultServiceImpl struct {
// contains filtered or unexported fields
}
TestResultServiceImpl is the RPC implementation of TestResultService.
func (*TestResultServiceImpl) BatchInsert ¶
func (w *TestResultServiceImpl) BatchInsert(ctx context.Context, invocationID string, request *atp.TestResultBatchInsertRequest) (*atp.TestResultBatchInsertResponse, error)
BatchInsert implementation for testResults.
func (*TestResultServiceImpl) Get ¶
func (w *TestResultServiceImpl) Get(resourceID int64) (*atp.TestResult, error)
Get implementation for testResults.
func (*TestResultServiceImpl) Insert ¶
func (w *TestResultServiceImpl) Insert(testResult *atp.TestResult) (*atp.TestResult, error)
Insert implementation for testResults.
func (*TestResultServiceImpl) List ¶
func (w *TestResultServiceImpl) List(ctx context.Context, invocationID string, options AndroidBuildAPIOptions) (*atp.TestResultListResponse, error)
List implementation for testResults.
func (*TestResultServiceImpl) Update ¶
func (w *TestResultServiceImpl) Update(resourceID int64, testResult *atp.TestResult) (*atp.TestResult, error)
Update implementation for testResults.
type WULayer ¶
type WULayer int
WULayer is and enum signifying what WU layer type the node represents
type WorkUnitNode ¶
type WorkUnitNode struct { Service WorkUnitService // contains filtered or unexported fields }
WorkUnitNode encapsulates an ATP WorkUnit and associated metadata to keep the tree in memory in a sensible way. Struct fields are not exposed to keep access of the tree limited to the exposed functions.
func NewWorkUnitNode ¶
func NewWorkUnitNode(ctx context.Context, parentWUId, invocationID string, nodeType WULayer, parent *WorkUnitNode, env common.Environment) (*WorkUnitNode, error)
NewWorkUnitNode Creates and registers a Work Unit using the ATP API and inserts it into the local Work Unit tree.
func (*WorkUnitNode) AddChild ¶
func (w *WorkUnitNode) AddChild(node *WorkUnitNode) error
func (*WorkUnitNode) FetchAttemptLayer ¶
func (w *WorkUnitNode) FetchAttemptLayer() ([][]*WorkUnitNode, error)
func (*WorkUnitNode) FetchHead ¶
func (w *WorkUnitNode) FetchHead() (*WorkUnitNode, error)
func (*WorkUnitNode) FetchRunLayer ¶
func (w *WorkUnitNode) FetchRunLayer() ([]*WorkUnitNode, error)
func (*WorkUnitNode) FetchShardLayer ¶
func (w *WorkUnitNode) FetchShardLayer() ([][]*WorkUnitNode, error)
func (*WorkUnitNode) GetChildren ¶
func (w *WorkUnitNode) GetChildren() ChildNodes
GetChildren returns the sorted list of children.
func (*WorkUnitNode) GetIndex ¶
func (w *WorkUnitNode) GetIndex() int
func (*WorkUnitNode) GetLayer ¶
func (w *WorkUnitNode) GetLayer() WULayer
func (*WorkUnitNode) GetParent ¶
func (w *WorkUnitNode) GetParent() *WorkUnitNode
func (*WorkUnitNode) GetWorkUnit ¶
func (w *WorkUnitNode) GetWorkUnit() *atp.WorkUnit
func (*WorkUnitNode) SetWorkUnit ¶
func (w *WorkUnitNode) SetWorkUnit(newWU *atp.WorkUnit)
type WorkUnitService ¶
type WorkUnitService interface { Get(resourceID string) (*atp.WorkUnit, error) Insert(workunit *atp.WorkUnit) (*atp.WorkUnit, error) Update(resourceID string, workunit *atp.WorkUnit) (*atp.WorkUnit, error) Patch(resourceID string, workunit *atp.WorkUnit) (*atp.WorkUnit, error) List(ctx context.Context, invocationID string, options AndroidBuildAPIOptions) (*atp.WorkUnitListResponse, error) }
WorkUnitService handles API calls related to workunits.
type WorkUnitServiceImpl ¶
type WorkUnitServiceImpl struct {
// contains filtered or unexported fields
}
WorkUnitServiceImpl is the RPC implementation of WorkUnitService.
func (*WorkUnitServiceImpl) Get ¶
func (w *WorkUnitServiceImpl) Get(resourceID string) (*atp.WorkUnit, error)
Get implementation for workunits.
func (*WorkUnitServiceImpl) List ¶
func (w *WorkUnitServiceImpl) List(ctx context.Context, invocationID string, options AndroidBuildAPIOptions) (*atp.WorkUnitListResponse, error)
List implementation for workunits.
type WorkUnitState ¶
type WorkUnitState int
const ( WorkUnitUnspecified WorkUnitState = iota WorkUnitQueued WorkUnitRunning WorkUnitError WorkUnitCompleted WorkUnitCancelled WorkUnitPending WorkUnitSkipped )
func (WorkUnitState) String ¶
func (w WorkUnitState) String() string
type WorkUnitTree ¶
type WorkUnitTree struct { Head *WorkUnitNode // ShardsByKey will be used to map shard nodes by the BuildsMap keys. This // will allow us to remove the requirement of including the shards as // arguments to scheduleAndMonitor(). ShardsByKey map[string]*WorkUnitNode }