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


Golang ECS.DescribeTaskDefinition方法代碼示例

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


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

示例1: PrintTaskDefinition

//
// Function to print the details of a service's task definition, since it's got a lot of fiddly details.
//
func PrintTaskDefinition(awsConn *ecs.ECS, taskDefinition *string, verboseFlag bool) {
	// Fetch the details of the task definition.
	taskDef, err := awsConn.DescribeTaskDefinition(&ecs.DescribeTaskDefinitionInput{
		TaskDefinition: taskDefinition,
	})
	CheckError(fmt.Sprintf("fetching Task Definition for %s", *taskDefinition), err)
	fmt.Println("  - Task Definition:", *taskDefinition)
	fmt.Println("    - Family:", *taskDef.TaskDefinition.Family)
	for _, containerDef := range taskDef.TaskDefinition.ContainerDefinitions {
		fmt.Println("    - Container Definition:")
		fmt.Println("      - Image:", *containerDef.Image)
		if verboseFlag {
			fmt.Println("      - CPU:", *containerDef.Cpu)
			fmt.Println("      - Memory:", *containerDef.Memory)
		}
		for _, portMap := range containerDef.PortMappings {
			fmt.Println("      - Container Port", *portMap.ContainerPort, ": Host Port", *portMap.HostPort)
		}
		if len(containerDef.Command) > 0 {
			fmt.Printf("      - Command: %v\n", containerDef.Command)
		}
		if len(containerDef.EntryPoint) > 0 {
			fmt.Printf("      - Entry Point: %v\n", containerDef.EntryPoint)
		}
		if (len(containerDef.Environment) > 0) && (verboseFlag) {
			fmt.Println("      - Environment:")
			for _, envVariable := range containerDef.Environment {
				fmt.Println("       ", *envVariable.Name, "=", *envVariable.Value)
			}
		}
	}
}
開發者ID:masonoise,項目名稱:ecsman,代碼行數:35,代碼來源:tasks.go

示例2: setImage

// setImage
// Create a new Task Definition based on an existing
// ARN, and a new image.
//
// Returns new task's ARN
//
func setImage(svc *ecs.ECS, taskArn string, image string) (string, error) {
	params := &ecs.DescribeTaskDefinitionInput{TaskDefinition: aws.String(taskArn)}
	resp, err := svc.DescribeTaskDefinition(params)
	if err != nil {
		return "", err
	}
	task := resp.TaskDefinition
	task.ContainerDefinitions[0].Image = &image
	regResp, err := svc.RegisterTaskDefinition(&ecs.RegisterTaskDefinitionInput{
		Family:               task.Family,
		ContainerDefinitions: task.ContainerDefinitions,
		Volumes:              task.Volumes,
	})
	return *regResp.TaskDefinition.TaskDefinitionArn, nil
}
開發者ID:oberd,項目名稱:aws-rollout,代碼行數:21,代碼來源:aws-rollout.go


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