func ExampleELBV2_CreateTargetGroup_shared00() {
	svc := elbv2.New(session.New())
	input := &elbv2.CreateTargetGroupInput{
		Name:     aws.String("my-targets"),
		Port:     aws.Int64(80),
		Protocol: aws.String("HTTP"),
		VpcId:    aws.String("vpc-3ac0fb5f"),
	}

	result, err := svc.CreateTargetGroup(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case elbv2.ErrCodeDuplicateTargetGroupNameException:
				fmt.Println(elbv2.ErrCodeDuplicateTargetGroupNameException, aerr.Error())
			case elbv2.ErrCodeTooManyTargetGroupsException:
				fmt.Println(elbv2.ErrCodeTooManyTargetGroupsException, aerr.Error())
			case elbv2.ErrCodeInvalidConfigurationRequestException:
				fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error())
			case elbv2.ErrCodeTooManyTagsException:
				fmt.Println(elbv2.ErrCodeTooManyTagsException, 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 create a target group
//
// This example creates a target group that you can use to route traffic to targets
// using HTTP on port 80. This target group uses the default health check configuration.
To create a target group

This example creates a target group that you can use to route traffic to targets
using HTTP on port 80. This target group uses the default health check configuration.
// To create a target group // // This example creates a target group that you can use to route traffic to targets // using HTTP on port 80 . This target group uses the default health check configuration .
func ExampleELBV2_CreateTargetGroup_shared00() {
	svc := elbv2.New(session.New())
	input := &elbv2.CreateTargetGroupInput{
		Name:     aws.String("my-targets"),
		Port:     aws.Int64(80),
		Protocol: aws.String("HTTP"),
		VpcId:    aws.String("vpc-3ac0fb5f"),
	}
	result, err := svc.CreateTargetGroup(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case elbv2.ErrCodeDuplicateTargetGroupNameException:
				fmt.Println(elbv2.ErrCodeDuplicateTargetGroupNameException, aerr.Error())
			case elbv2.ErrCodeTooManyTargetGroupsException:
				fmt.Println(elbv2.ErrCodeTooManyTargetGroupsException, aerr.Error())
			case elbv2.ErrCodeInvalidConfigurationRequestException:
				fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error())
			case elbv2.ErrCodeTooManyTagsException:
				fmt.Println(elbv2.ErrCodeTooManyTagsException, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			fmt.Println(err.Error())
		}
		return
	}
	fmt.Println(result)
}
func ExampleELBV2_CreateTargetGroup_shared00 ( ) { svc := elbv2 . New ( session . New ( ) ) input := & elbv2 . CreateTargetGroupInput { Name : aws . String ( " " ) , Port : aws . Int64 ( 80 ) , Protocol : aws . String ( " " ) , VpcId : aws . String ( " " ) , } result , err := svc . CreateTargetGroup ( input ) if err != nil { if aerr , ok := err . ( awserr . Error ) ; ok { switch aerr . Code ( ) { case elbv2 . ErrCodeDuplicateTargetGroupNameException : fmt . Println ( elbv2 . ErrCodeDuplicateTargetGroupNameException , aerr . Error ( ) ) case elbv2 . ErrCodeTooManyTargetGroupsException : fmt . Println ( elbv2 . ErrCodeTooManyTargetGroupsException , aerr . Error ( ) ) case elbv2 . ErrCodeInvalidConfigurationRequestException : fmt . Println ( elbv2 . ErrCodeInvalidConfigurationRequestException , aerr . Error ( ) ) case elbv2 . ErrCodeTooManyTagsException : fmt . Println ( elbv2 . ErrCodeTooManyTagsException , aerr . Error ( ) ) default : fmt . Println ( aerr . Error ( ) ) } } else { fmt . Println ( err . Error ( ) ) } return } fmt . Println ( result ) }
To create a target group
To create a target group
// Print the error, cast err to awserr.Error to get the Code and // Message from an error.