func ExampleELBV2_RegisterTargets_shared01() {
	svc := elbv2.New(session.New())
	input := &elbv2.RegisterTargetsInput{
		TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/3bb63f11dfb0faf9"),
		Targets: []*elbv2.TargetDescription{
			{
				Id:   aws.String("i-80c8dd94"),
				Port: aws.Int64(80),
			},
			{
				Id:   aws.String("i-80c8dd94"),
				Port: aws.Int64(766),
			},
		},
	}

	result, err := svc.RegisterTargets(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case elbv2.ErrCodeTargetGroupNotFoundException:
				fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error())
			case elbv2.ErrCodeTooManyTargetsException:
				fmt.Println(elbv2.ErrCodeTooManyTargetsException, aerr.Error())
			case elbv2.ErrCodeInvalidTargetException:
				fmt.Println(elbv2.ErrCodeInvalidTargetException, aerr.Error())
			case elbv2.ErrCodeTooManyRegistrationsForTargetIdException:
				fmt.Println(elbv2.ErrCodeTooManyRegistrationsForTargetIdException, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			// Print the error, cast err to awserr.Error to get the Code and
			// Message from an error.
			fmt.Println(err.Error())
		}
		return
	}

	fmt.Println(result)
}
// To register targets with a target group using port overrides
//
// This example registers the specified instance with the specified target group using
// multiple ports. This enables you to register ECS containers on the same instance
// as targets in the target group.
To register targets with a target group using port overrides

This example registers the specified instance with the specified target group using
multiple ports. This enables you to register ECS containers on the same instance
as targets in the target group.
// To register targets with a target group using port overrides // // This example registers the specified instance with the specified target group using // multiple ports . This enables you to register ECS containers on the same instance // as targets in the target group .
func ExampleELBV2_RegisterTargets_shared01() {
	svc := elbv2.New(session.New())
	input := &elbv2.RegisterTargetsInput{
		TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/3bb63f11dfb0faf9"),
		Targets: []*elbv2.TargetDescription{
			{
				Id:   aws.String("i-80c8dd94"),
				Port: aws.Int64(80),
			},
			{
				Id:   aws.String("i-80c8dd94"),
				Port: aws.Int64(766),
			},
		},
	}
	result, err := svc.RegisterTargets(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case elbv2.ErrCodeTargetGroupNotFoundException:
				fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error())
			case elbv2.ErrCodeTooManyTargetsException:
				fmt.Println(elbv2.ErrCodeTooManyTargetsException, aerr.Error())
			case elbv2.ErrCodeInvalidTargetException:
				fmt.Println(elbv2.ErrCodeInvalidTargetException, aerr.Error())
			case elbv2.ErrCodeTooManyRegistrationsForTargetIdException:
				fmt.Println(elbv2.ErrCodeTooManyRegistrationsForTargetIdException, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			fmt.Println(err.Error())
		}
		return
	}
	fmt.Println(result)
}
func ExampleELBV2_RegisterTargets_shared01 ( ) { svc := elbv2 . New ( session . New ( ) ) input := & elbv2 . RegisterTargetsInput { TargetGroupArn : aws . String ( " " ) , Targets : [ ] * elbv2 . TargetDescription { { Id : aws . String ( " " ) , Port : aws . Int64 ( 80 ) , } , { Id : aws . String ( " " ) , Port : aws . Int64 ( 766 ) , } , } , } result , err := svc . RegisterTargets ( input ) if err != nil { if aerr , ok := err . ( awserr . Error ) ; ok { switch aerr . Code ( ) { case elbv2 . ErrCodeTargetGroupNotFoundException : fmt . Println ( elbv2 . ErrCodeTargetGroupNotFoundException , aerr . Error ( ) ) case elbv2 . ErrCodeTooManyTargetsException : fmt . Println ( elbv2 . ErrCodeTooManyTargetsException , aerr . Error ( ) ) case elbv2 . ErrCodeInvalidTargetException : fmt . Println ( elbv2 . ErrCodeInvalidTargetException , aerr . Error ( ) ) case elbv2 . ErrCodeTooManyRegistrationsForTargetIdException : fmt . Println ( elbv2 . ErrCodeTooManyRegistrationsForTargetIdException , aerr . Error ( ) ) default : fmt . Println ( aerr . Error ( ) ) } } else { fmt . Println ( err . Error ( ) ) } return } fmt . Println ( result ) }
To register targets with a target group using port overrides
To register targets with a target group using port overrides
// Print the error, cast err to awserr.Error to get the Code and // Message from an error.