當前位置: 首頁>>代碼示例>>Golang>>正文


Golang DeviceFarm.ListDevices方法代碼示例

本文整理匯總了Golang中github.com/aws/aws-sdk-go/service/devicefarm.DeviceFarm.ListDevices方法的典型用法代碼示例。如果您正苦於以下問題:Golang DeviceFarm.ListDevices方法的具體用法?Golang DeviceFarm.ListDevices怎麽用?Golang DeviceFarm.ListDevices使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/aws/aws-sdk-go/service/devicefarm.DeviceFarm的用法示例。


在下文中一共展示了DeviceFarm.ListDevices方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: listDevices

/* List all Devices */
func listDevices(svc *devicefarm.DeviceFarm) {

	input := &devicefarm.ListDevicesInput{}
	resp, err := svc.ListDevices(input)

	failOnErr(err, "error listing devices")
	fmt.Println(awsutil.Prettify(resp))
}
開發者ID:dmreiland,項目名稱:devicefarm-cli,代碼行數:9,代碼來源:devicefarm-cli.go

示例2: listDevices

/* List all Devices */
func listDevices(svc *devicefarm.DeviceFarm) {

	input := &devicefarm.ListDevicesInput{}
	resp, err := svc.ListDevices(input)

	failOnErr(err, "error listing devices")
	//fmt.Println(awsutil.Prettify(resp))

	table := tablewriter.NewWriter(os.Stdout)
	table.SetHeader([]string{"Name", "Os", "Platform", "Form", "Arn"})
	table.SetAlignment(tablewriter.ALIGN_LEFT)
	table.SetColWidth(50)

	for _, m := range resp.Devices {
		line := []string{*m.Name, *m.Os, *m.Platform, *m.FormFactor, *m.Arn}
		table.Append(line)
	}
	table.Render() // Send output

	/*
	   	    {
	         Arn: "arn:aws:devicefarm:us-west-2::device:A0E6E6E1059E45918208DF75B2B7EF6C",
	         CPU: {
	           Architecture: "ARMv7",
	           Clock: 2265,
	           Frequency: "MHz"
	         },
	         FormFactor: "PHONE",
	         HeapSize: 0,
	         Image: "NA",
	         Manufacturer: "LG",
	         Memory: 17179869184,
	         Model: "G2",
	         Name: "LG G2 (Sprint)",
	         Os: "4.2.2",
	         Platform: "ANDROID",
	         Resolution: {
	           Height: 1920,
	           Width: 1080
	         }
	       }
	*/

}
開發者ID:ainoya,項目名稱:devicefarm-cli,代碼行數:45,代碼來源:devicefarm-cli.go

示例3: lookupDeviceArn

// --- internal API starts here
func lookupDeviceArn(svc *devicefarm.DeviceFarm, deviceName string) (deviceArn string, err error) {

	input := &devicefarm.ListDevicesInput{}
	resp, err := svc.ListDevices(input)

	failOnErr(err, "error listing devices")
	//fmt.Println(awsutil.Prettify(resp))

	devices := make(map[string]string)
	for _, m := range resp.Devices {
		key := fmt.Sprintf("%s - %s", *m.Name, *m.Os)
		devices[key] = *m.Arn
		//line := []string{*m.Name, *m.Os, *m.Platform, *m.FormFactor, *m.Arn}
	}

	arn := devices[deviceName]

	if arn != "" {
		return arn, nil
	}

	return "", errors.New("failed to find a device with name " + deviceName)

}
開發者ID:ainoya,項目名稱:devicefarm-cli,代碼行數:25,代碼來源:devicefarm-cli.go


注:本文中的github.com/aws/aws-sdk-go/service/devicefarm.DeviceFarm.ListDevices方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。