本文整理匯總了Golang中github.com/aws/aws-sdk-go/service/devicefarm.DeviceFarm.ListJobs方法的典型用法代碼示例。如果您正苦於以下問題:Golang DeviceFarm.ListJobs方法的具體用法?Golang DeviceFarm.ListJobs怎麽用?Golang DeviceFarm.ListJobs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/aws/aws-sdk-go/service/devicefarm.DeviceFarm
的用法示例。
在下文中一共展示了DeviceFarm.ListJobs方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: listJobs
/* List Jobs */
func listJobs(svc *devicefarm.DeviceFarm, runArn string) {
listReq := &devicefarm.ListJobsInput{
Arn: aws.String(runArn),
}
resp, err := svc.ListJobs(listReq)
failOnErr(err, "error listing jobs")
fmt.Println(awsutil.Prettify(resp))
}
示例2: runReport
/* Get Run Report */
func runReport(svc *devicefarm.DeviceFarm, runArn string) {
infoReq := &devicefarm.GetRunInput{
Arn: aws.String(runArn),
}
resp, err := svc.GetRun(infoReq)
failOnErr(err, "error getting run info")
fmt.Printf("Reporting on run %s\n", *resp.Run.Name)
fmt.Printf("Run arn %s\n", runArn)
//fmt.Println(awsutil.Prettify(resp))
jobReq := &devicefarm.ListJobsInput{
Arn: aws.String(runArn),
}
// Find all artifacts
artifactReq := &devicefarm.ListArtifactsInput{
Arn: aws.String(runArn),
}
types := []string{"LOG", "SCREENSHOT", "FILE"}
artifacts := map[string][]devicefarm.ListArtifactsOutput{}
for _, artifactType := range types {
artifactReq.Type = aws.String(artifactType)
artifactResp, err := svc.ListArtifacts(artifactReq)
failOnErr(err, "error getting run info")
// Store type artifacts
artifacts[artifactType] = append(artifacts[artifactType], *artifactResp)
}
respJob, err := svc.ListJobs(jobReq)
failOnErr(err, "error getting jobs")
// Find all jobs within this run
for _, job := range respJob.Jobs {
fmt.Println("==========================================")
time.Sleep(2 * time.Second)
jobFriendlyName := fmt.Sprintf("%s - %s - %s", *job.Name, *job.Device.Model, *job.Device.Os)
fmt.Println(awsutil.Prettify(job))
suiteReq := &devicefarm.ListSuitesInput{
Arn: aws.String(*job.Arn),
}
suiteResp, err := svc.ListSuites(suiteReq)
failOnErr(err, "error getting run info")
for _, suite := range suiteResp.Suites {
message := ""
if suite.Message != nil {
message = *suite.Message
}
debug := true
if debug {
fmt.Printf("%s -> %s : %s \n----> %s\n", jobFriendlyName, *suite.Name, message, *suite.Arn)
}
dirPrefix := fmt.Sprintf("report/%s/%s", jobFriendlyName, *suite.Name)
downloadArtifactsForSuite(dirPrefix, artifacts, *suite)
}
fmt.Println(awsutil.Prettify(suiteResp))
}
params := &devicefarm.ListUniqueProblemsInput{
Arn: aws.String(runArn), // Required
}
problems, err := svc.ListUniqueProblems(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(problems))
problemsJson, _ := jsonutil.BuildJSON(problems)
writeFile(problemsJson, "./report/unique_problems.json")
}
示例3: runReport
/* Get Run Report */
func runReport(svc *devicefarm.DeviceFarm, runArn string) {
infoReq := &devicefarm.GetRunInput{
ARN: aws.String(runArn),
}
resp, err := svc.GetRun(infoReq)
failOnErr(err, "error getting run info")
fmt.Printf("%s\n", *resp.Run.Name)
//fmt.Println(awsutil.Prettify(resp))
jobReq := &devicefarm.ListJobsInput{
ARN: aws.String(runArn),
}
// Find all artifacts
artifactReq := &devicefarm.ListArtifactsInput{
ARN: aws.String(runArn),
}
types := []string{"LOG", "SCREENSHOT", "FILE"}
artifacts := map[string][]devicefarm.ListArtifactsOutput{}
for _, artifactType := range types {
artifactReq.Type = aws.String(artifactType)
artifactResp, err := svc.ListArtifacts(artifactReq)
failOnErr(err, "error getting run info")
// Store type artifacts
artifacts[artifactType] = append(artifacts[artifactType], *artifactResp)
/*
for _, artifact := range artifactResp.Artifacts {
fmt.Println(awsutil.Prettify(artifact))
}
*/
}
respJob, err := svc.ListJobs(jobReq)
failOnErr(err, "error getting jobs")
for _, job := range respJob.Jobs {
fmt.Println("==========================================")
time.Sleep(2 * time.Second)
jobFriendlyName := fmt.Sprintf("%s - %s - %s", *job.Name, *job.Device.Model, *job.Device.Os)
//fmt.Println(awsutil.Prettify(job))
suiteReq := &devicefarm.ListSuitesInput{
ARN: aws.String(*job.ARN),
}
suiteResp, err := svc.ListSuites(suiteReq)
failOnErr(err, "error getting run info")
for _, suite := range suiteResp.Suites {
message := ""
if suite.Message != nil {
message = *suite.Message
}
fmt.Printf("%s -> %s : %s \n----> %s\n", jobFriendlyName, *suite.Name, message, *suite.ARN)
dirPrefix := fmt.Sprintf("report/%s/%s/", jobFriendlyName, *suite.Name)
downloadArtifactsForSuite(dirPrefix, artifacts, *suite)
}
//fmt.Println(awsutil.Prettify(suiteResp))
}
}