Conver to regular Go vendor + dep tool

This commit is contained in:
Andrey Smirnov
2017-03-22 17:38:32 +03:00
parent 070347295e
commit c6c1012330
3260 changed files with 1742550 additions and 72 deletions
File diff suppressed because it is too large Load Diff
+193
View File
@@ -0,0 +1,193 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package elbv2iface provides an interface to enable mocking the Elastic Load Balancing service client
// for testing your code.
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters.
package elbv2iface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/elbv2"
)
// ELBV2API provides an interface to enable mocking the
// elbv2.ELBV2 service client's API operation,
// paginators, and waiters. This make unit testing your code that calls out
// to the SDK's service client's calls easier.
//
// The best way to use this interface is so the SDK's service client's calls
// can be stubbed out for unit testing your code with the SDK without needing
// to inject custom request handlers into the the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // Elastic Load Balancing.
// func myFunc(svc elbv2iface.ELBV2API) bool {
// // Make svc.AddTags request
// }
//
// func main() {
// sess := session.New()
// svc := elbv2.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockELBV2Client struct {
// elbv2iface.ELBV2API
// }
// func (m *mockELBV2Client) AddTags(input *elbv2.AddTagsInput) (*elbv2.AddTagsOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockELBV2Client{}
//
// myfunc(mockSvc)
//
// // Verify myFunc's functionality
// }
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters. Its suggested to use the pattern above for testing, or using
// tooling to generate mocks to satisfy the interfaces.
type ELBV2API interface {
AddTags(*elbv2.AddTagsInput) (*elbv2.AddTagsOutput, error)
AddTagsWithContext(aws.Context, *elbv2.AddTagsInput, ...request.Option) (*elbv2.AddTagsOutput, error)
AddTagsRequest(*elbv2.AddTagsInput) (*request.Request, *elbv2.AddTagsOutput)
CreateListener(*elbv2.CreateListenerInput) (*elbv2.CreateListenerOutput, error)
CreateListenerWithContext(aws.Context, *elbv2.CreateListenerInput, ...request.Option) (*elbv2.CreateListenerOutput, error)
CreateListenerRequest(*elbv2.CreateListenerInput) (*request.Request, *elbv2.CreateListenerOutput)
CreateLoadBalancer(*elbv2.CreateLoadBalancerInput) (*elbv2.CreateLoadBalancerOutput, error)
CreateLoadBalancerWithContext(aws.Context, *elbv2.CreateLoadBalancerInput, ...request.Option) (*elbv2.CreateLoadBalancerOutput, error)
CreateLoadBalancerRequest(*elbv2.CreateLoadBalancerInput) (*request.Request, *elbv2.CreateLoadBalancerOutput)
CreateRule(*elbv2.CreateRuleInput) (*elbv2.CreateRuleOutput, error)
CreateRuleWithContext(aws.Context, *elbv2.CreateRuleInput, ...request.Option) (*elbv2.CreateRuleOutput, error)
CreateRuleRequest(*elbv2.CreateRuleInput) (*request.Request, *elbv2.CreateRuleOutput)
CreateTargetGroup(*elbv2.CreateTargetGroupInput) (*elbv2.CreateTargetGroupOutput, error)
CreateTargetGroupWithContext(aws.Context, *elbv2.CreateTargetGroupInput, ...request.Option) (*elbv2.CreateTargetGroupOutput, error)
CreateTargetGroupRequest(*elbv2.CreateTargetGroupInput) (*request.Request, *elbv2.CreateTargetGroupOutput)
DeleteListener(*elbv2.DeleteListenerInput) (*elbv2.DeleteListenerOutput, error)
DeleteListenerWithContext(aws.Context, *elbv2.DeleteListenerInput, ...request.Option) (*elbv2.DeleteListenerOutput, error)
DeleteListenerRequest(*elbv2.DeleteListenerInput) (*request.Request, *elbv2.DeleteListenerOutput)
DeleteLoadBalancer(*elbv2.DeleteLoadBalancerInput) (*elbv2.DeleteLoadBalancerOutput, error)
DeleteLoadBalancerWithContext(aws.Context, *elbv2.DeleteLoadBalancerInput, ...request.Option) (*elbv2.DeleteLoadBalancerOutput, error)
DeleteLoadBalancerRequest(*elbv2.DeleteLoadBalancerInput) (*request.Request, *elbv2.DeleteLoadBalancerOutput)
DeleteRule(*elbv2.DeleteRuleInput) (*elbv2.DeleteRuleOutput, error)
DeleteRuleWithContext(aws.Context, *elbv2.DeleteRuleInput, ...request.Option) (*elbv2.DeleteRuleOutput, error)
DeleteRuleRequest(*elbv2.DeleteRuleInput) (*request.Request, *elbv2.DeleteRuleOutput)
DeleteTargetGroup(*elbv2.DeleteTargetGroupInput) (*elbv2.DeleteTargetGroupOutput, error)
DeleteTargetGroupWithContext(aws.Context, *elbv2.DeleteTargetGroupInput, ...request.Option) (*elbv2.DeleteTargetGroupOutput, error)
DeleteTargetGroupRequest(*elbv2.DeleteTargetGroupInput) (*request.Request, *elbv2.DeleteTargetGroupOutput)
DeregisterTargets(*elbv2.DeregisterTargetsInput) (*elbv2.DeregisterTargetsOutput, error)
DeregisterTargetsWithContext(aws.Context, *elbv2.DeregisterTargetsInput, ...request.Option) (*elbv2.DeregisterTargetsOutput, error)
DeregisterTargetsRequest(*elbv2.DeregisterTargetsInput) (*request.Request, *elbv2.DeregisterTargetsOutput)
DescribeListeners(*elbv2.DescribeListenersInput) (*elbv2.DescribeListenersOutput, error)
DescribeListenersWithContext(aws.Context, *elbv2.DescribeListenersInput, ...request.Option) (*elbv2.DescribeListenersOutput, error)
DescribeListenersRequest(*elbv2.DescribeListenersInput) (*request.Request, *elbv2.DescribeListenersOutput)
DescribeListenersPages(*elbv2.DescribeListenersInput, func(*elbv2.DescribeListenersOutput, bool) bool) error
DescribeListenersPagesWithContext(aws.Context, *elbv2.DescribeListenersInput, func(*elbv2.DescribeListenersOutput, bool) bool, ...request.Option) error
DescribeLoadBalancerAttributes(*elbv2.DescribeLoadBalancerAttributesInput) (*elbv2.DescribeLoadBalancerAttributesOutput, error)
DescribeLoadBalancerAttributesWithContext(aws.Context, *elbv2.DescribeLoadBalancerAttributesInput, ...request.Option) (*elbv2.DescribeLoadBalancerAttributesOutput, error)
DescribeLoadBalancerAttributesRequest(*elbv2.DescribeLoadBalancerAttributesInput) (*request.Request, *elbv2.DescribeLoadBalancerAttributesOutput)
DescribeLoadBalancers(*elbv2.DescribeLoadBalancersInput) (*elbv2.DescribeLoadBalancersOutput, error)
DescribeLoadBalancersWithContext(aws.Context, *elbv2.DescribeLoadBalancersInput, ...request.Option) (*elbv2.DescribeLoadBalancersOutput, error)
DescribeLoadBalancersRequest(*elbv2.DescribeLoadBalancersInput) (*request.Request, *elbv2.DescribeLoadBalancersOutput)
DescribeLoadBalancersPages(*elbv2.DescribeLoadBalancersInput, func(*elbv2.DescribeLoadBalancersOutput, bool) bool) error
DescribeLoadBalancersPagesWithContext(aws.Context, *elbv2.DescribeLoadBalancersInput, func(*elbv2.DescribeLoadBalancersOutput, bool) bool, ...request.Option) error
DescribeRules(*elbv2.DescribeRulesInput) (*elbv2.DescribeRulesOutput, error)
DescribeRulesWithContext(aws.Context, *elbv2.DescribeRulesInput, ...request.Option) (*elbv2.DescribeRulesOutput, error)
DescribeRulesRequest(*elbv2.DescribeRulesInput) (*request.Request, *elbv2.DescribeRulesOutput)
DescribeSSLPolicies(*elbv2.DescribeSSLPoliciesInput) (*elbv2.DescribeSSLPoliciesOutput, error)
DescribeSSLPoliciesWithContext(aws.Context, *elbv2.DescribeSSLPoliciesInput, ...request.Option) (*elbv2.DescribeSSLPoliciesOutput, error)
DescribeSSLPoliciesRequest(*elbv2.DescribeSSLPoliciesInput) (*request.Request, *elbv2.DescribeSSLPoliciesOutput)
DescribeTags(*elbv2.DescribeTagsInput) (*elbv2.DescribeTagsOutput, error)
DescribeTagsWithContext(aws.Context, *elbv2.DescribeTagsInput, ...request.Option) (*elbv2.DescribeTagsOutput, error)
DescribeTagsRequest(*elbv2.DescribeTagsInput) (*request.Request, *elbv2.DescribeTagsOutput)
DescribeTargetGroupAttributes(*elbv2.DescribeTargetGroupAttributesInput) (*elbv2.DescribeTargetGroupAttributesOutput, error)
DescribeTargetGroupAttributesWithContext(aws.Context, *elbv2.DescribeTargetGroupAttributesInput, ...request.Option) (*elbv2.DescribeTargetGroupAttributesOutput, error)
DescribeTargetGroupAttributesRequest(*elbv2.DescribeTargetGroupAttributesInput) (*request.Request, *elbv2.DescribeTargetGroupAttributesOutput)
DescribeTargetGroups(*elbv2.DescribeTargetGroupsInput) (*elbv2.DescribeTargetGroupsOutput, error)
DescribeTargetGroupsWithContext(aws.Context, *elbv2.DescribeTargetGroupsInput, ...request.Option) (*elbv2.DescribeTargetGroupsOutput, error)
DescribeTargetGroupsRequest(*elbv2.DescribeTargetGroupsInput) (*request.Request, *elbv2.DescribeTargetGroupsOutput)
DescribeTargetGroupsPages(*elbv2.DescribeTargetGroupsInput, func(*elbv2.DescribeTargetGroupsOutput, bool) bool) error
DescribeTargetGroupsPagesWithContext(aws.Context, *elbv2.DescribeTargetGroupsInput, func(*elbv2.DescribeTargetGroupsOutput, bool) bool, ...request.Option) error
DescribeTargetHealth(*elbv2.DescribeTargetHealthInput) (*elbv2.DescribeTargetHealthOutput, error)
DescribeTargetHealthWithContext(aws.Context, *elbv2.DescribeTargetHealthInput, ...request.Option) (*elbv2.DescribeTargetHealthOutput, error)
DescribeTargetHealthRequest(*elbv2.DescribeTargetHealthInput) (*request.Request, *elbv2.DescribeTargetHealthOutput)
ModifyListener(*elbv2.ModifyListenerInput) (*elbv2.ModifyListenerOutput, error)
ModifyListenerWithContext(aws.Context, *elbv2.ModifyListenerInput, ...request.Option) (*elbv2.ModifyListenerOutput, error)
ModifyListenerRequest(*elbv2.ModifyListenerInput) (*request.Request, *elbv2.ModifyListenerOutput)
ModifyLoadBalancerAttributes(*elbv2.ModifyLoadBalancerAttributesInput) (*elbv2.ModifyLoadBalancerAttributesOutput, error)
ModifyLoadBalancerAttributesWithContext(aws.Context, *elbv2.ModifyLoadBalancerAttributesInput, ...request.Option) (*elbv2.ModifyLoadBalancerAttributesOutput, error)
ModifyLoadBalancerAttributesRequest(*elbv2.ModifyLoadBalancerAttributesInput) (*request.Request, *elbv2.ModifyLoadBalancerAttributesOutput)
ModifyRule(*elbv2.ModifyRuleInput) (*elbv2.ModifyRuleOutput, error)
ModifyRuleWithContext(aws.Context, *elbv2.ModifyRuleInput, ...request.Option) (*elbv2.ModifyRuleOutput, error)
ModifyRuleRequest(*elbv2.ModifyRuleInput) (*request.Request, *elbv2.ModifyRuleOutput)
ModifyTargetGroup(*elbv2.ModifyTargetGroupInput) (*elbv2.ModifyTargetGroupOutput, error)
ModifyTargetGroupWithContext(aws.Context, *elbv2.ModifyTargetGroupInput, ...request.Option) (*elbv2.ModifyTargetGroupOutput, error)
ModifyTargetGroupRequest(*elbv2.ModifyTargetGroupInput) (*request.Request, *elbv2.ModifyTargetGroupOutput)
ModifyTargetGroupAttributes(*elbv2.ModifyTargetGroupAttributesInput) (*elbv2.ModifyTargetGroupAttributesOutput, error)
ModifyTargetGroupAttributesWithContext(aws.Context, *elbv2.ModifyTargetGroupAttributesInput, ...request.Option) (*elbv2.ModifyTargetGroupAttributesOutput, error)
ModifyTargetGroupAttributesRequest(*elbv2.ModifyTargetGroupAttributesInput) (*request.Request, *elbv2.ModifyTargetGroupAttributesOutput)
RegisterTargets(*elbv2.RegisterTargetsInput) (*elbv2.RegisterTargetsOutput, error)
RegisterTargetsWithContext(aws.Context, *elbv2.RegisterTargetsInput, ...request.Option) (*elbv2.RegisterTargetsOutput, error)
RegisterTargetsRequest(*elbv2.RegisterTargetsInput) (*request.Request, *elbv2.RegisterTargetsOutput)
RemoveTags(*elbv2.RemoveTagsInput) (*elbv2.RemoveTagsOutput, error)
RemoveTagsWithContext(aws.Context, *elbv2.RemoveTagsInput, ...request.Option) (*elbv2.RemoveTagsOutput, error)
RemoveTagsRequest(*elbv2.RemoveTagsInput) (*request.Request, *elbv2.RemoveTagsOutput)
SetIpAddressType(*elbv2.SetIpAddressTypeInput) (*elbv2.SetIpAddressTypeOutput, error)
SetIpAddressTypeWithContext(aws.Context, *elbv2.SetIpAddressTypeInput, ...request.Option) (*elbv2.SetIpAddressTypeOutput, error)
SetIpAddressTypeRequest(*elbv2.SetIpAddressTypeInput) (*request.Request, *elbv2.SetIpAddressTypeOutput)
SetRulePriorities(*elbv2.SetRulePrioritiesInput) (*elbv2.SetRulePrioritiesOutput, error)
SetRulePrioritiesWithContext(aws.Context, *elbv2.SetRulePrioritiesInput, ...request.Option) (*elbv2.SetRulePrioritiesOutput, error)
SetRulePrioritiesRequest(*elbv2.SetRulePrioritiesInput) (*request.Request, *elbv2.SetRulePrioritiesOutput)
SetSecurityGroups(*elbv2.SetSecurityGroupsInput) (*elbv2.SetSecurityGroupsOutput, error)
SetSecurityGroupsWithContext(aws.Context, *elbv2.SetSecurityGroupsInput, ...request.Option) (*elbv2.SetSecurityGroupsOutput, error)
SetSecurityGroupsRequest(*elbv2.SetSecurityGroupsInput) (*request.Request, *elbv2.SetSecurityGroupsOutput)
SetSubnets(*elbv2.SetSubnetsInput) (*elbv2.SetSubnetsOutput, error)
SetSubnetsWithContext(aws.Context, *elbv2.SetSubnetsInput, ...request.Option) (*elbv2.SetSubnetsOutput, error)
SetSubnetsRequest(*elbv2.SetSubnetsInput) (*request.Request, *elbv2.SetSubnetsOutput)
}
var _ ELBV2API = (*elbv2.ELBV2)(nil)
+195
View File
@@ -0,0 +1,195 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package elbv2
const (
// ErrCodeCertificateNotFoundException for service response error code
// "CertificateNotFound".
//
// The specified certificate does not exist.
ErrCodeCertificateNotFoundException = "CertificateNotFound"
// ErrCodeDuplicateListenerException for service response error code
// "DuplicateListener".
//
// A listener with the specified port already exists.
ErrCodeDuplicateListenerException = "DuplicateListener"
// ErrCodeDuplicateLoadBalancerNameException for service response error code
// "DuplicateLoadBalancerName".
//
// A load balancer with the specified name already exists for this account.
ErrCodeDuplicateLoadBalancerNameException = "DuplicateLoadBalancerName"
// ErrCodeDuplicateTagKeysException for service response error code
// "DuplicateTagKeys".
//
// A tag key was specified more than once.
ErrCodeDuplicateTagKeysException = "DuplicateTagKeys"
// ErrCodeDuplicateTargetGroupNameException for service response error code
// "DuplicateTargetGroupName".
//
// A target group with the specified name already exists.
ErrCodeDuplicateTargetGroupNameException = "DuplicateTargetGroupName"
// ErrCodeHealthUnavailableException for service response error code
// "HealthUnavailable".
//
// The health of the specified targets could not be retrieved due to an internal
// error.
ErrCodeHealthUnavailableException = "HealthUnavailable"
// ErrCodeIncompatibleProtocolsException for service response error code
// "IncompatibleProtocols".
//
// The specified configuration is not valid with this protocol.
ErrCodeIncompatibleProtocolsException = "IncompatibleProtocols"
// ErrCodeInvalidConfigurationRequestException for service response error code
// "InvalidConfigurationRequest".
//
// The requested configuration is not valid.
ErrCodeInvalidConfigurationRequestException = "InvalidConfigurationRequest"
// ErrCodeInvalidSchemeException for service response error code
// "InvalidScheme".
//
// The requested scheme is not valid.
ErrCodeInvalidSchemeException = "InvalidScheme"
// ErrCodeInvalidSecurityGroupException for service response error code
// "InvalidSecurityGroup".
//
// The specified security group does not exist.
ErrCodeInvalidSecurityGroupException = "InvalidSecurityGroup"
// ErrCodeInvalidSubnetException for service response error code
// "InvalidSubnet".
//
// The specified subnet is out of available addresses.
ErrCodeInvalidSubnetException = "InvalidSubnet"
// ErrCodeInvalidTargetException for service response error code
// "InvalidTarget".
//
// The specified target does not exist or is not in the same VPC as the target
// group.
ErrCodeInvalidTargetException = "InvalidTarget"
// ErrCodeListenerNotFoundException for service response error code
// "ListenerNotFound".
//
// The specified listener does not exist.
ErrCodeListenerNotFoundException = "ListenerNotFound"
// ErrCodeLoadBalancerNotFoundException for service response error code
// "LoadBalancerNotFound".
//
// The specified load balancer does not exist.
ErrCodeLoadBalancerNotFoundException = "LoadBalancerNotFound"
// ErrCodeOperationNotPermittedException for service response error code
// "OperationNotPermitted".
//
// This operation is not allowed.
ErrCodeOperationNotPermittedException = "OperationNotPermitted"
// ErrCodePriorityInUseException for service response error code
// "PriorityInUse".
//
// The specified priority is in use.
ErrCodePriorityInUseException = "PriorityInUse"
// ErrCodeResourceInUseException for service response error code
// "ResourceInUse".
//
// A specified resource is in use.
ErrCodeResourceInUseException = "ResourceInUse"
// ErrCodeRuleNotFoundException for service response error code
// "RuleNotFound".
//
// The specified rule does not exist.
ErrCodeRuleNotFoundException = "RuleNotFound"
// ErrCodeSSLPolicyNotFoundException for service response error code
// "SSLPolicyNotFound".
//
// The specified SSL policy does not exist.
ErrCodeSSLPolicyNotFoundException = "SSLPolicyNotFound"
// ErrCodeSubnetNotFoundException for service response error code
// "SubnetNotFound".
//
// The specified subnet does not exist.
ErrCodeSubnetNotFoundException = "SubnetNotFound"
// ErrCodeTargetGroupAssociationLimitException for service response error code
// "TargetGroupAssociationLimit".
//
// You've reached the limit on the number of load balancers per target group.
ErrCodeTargetGroupAssociationLimitException = "TargetGroupAssociationLimit"
// ErrCodeTargetGroupNotFoundException for service response error code
// "TargetGroupNotFound".
//
// The specified target group does not exist.
ErrCodeTargetGroupNotFoundException = "TargetGroupNotFound"
// ErrCodeTooManyCertificatesException for service response error code
// "TooManyCertificates".
//
// You've reached the limit on the number of certificates per listener.
ErrCodeTooManyCertificatesException = "TooManyCertificates"
// ErrCodeTooManyListenersException for service response error code
// "TooManyListeners".
//
// You've reached the limit on the number of listeners per load balancer.
ErrCodeTooManyListenersException = "TooManyListeners"
// ErrCodeTooManyLoadBalancersException for service response error code
// "TooManyLoadBalancers".
//
// You've reached the limit on the number of load balancers for your AWS account.
ErrCodeTooManyLoadBalancersException = "TooManyLoadBalancers"
// ErrCodeTooManyRegistrationsForTargetIdException for service response error code
// "TooManyRegistrationsForTargetId".
//
// You've reached the limit on the number of times a target can be registered
// with a load balancer.
ErrCodeTooManyRegistrationsForTargetIdException = "TooManyRegistrationsForTargetId"
// ErrCodeTooManyRulesException for service response error code
// "TooManyRules".
//
// You've reached the limit on the number of rules per load balancer.
ErrCodeTooManyRulesException = "TooManyRules"
// ErrCodeTooManyTagsException for service response error code
// "TooManyTags".
//
// You've reached the limit on the number of tags per load balancer.
ErrCodeTooManyTagsException = "TooManyTags"
// ErrCodeTooManyTargetGroupsException for service response error code
// "TooManyTargetGroups".
//
// You've reached the limit on the number of target groups for your AWS account.
ErrCodeTooManyTargetGroupsException = "TooManyTargetGroups"
// ErrCodeTooManyTargetsException for service response error code
// "TooManyTargets".
//
// You've reached the limit on the number of targets.
ErrCodeTooManyTargetsException = "TooManyTargets"
// ErrCodeUnsupportedProtocolException for service response error code
// "UnsupportedProtocol".
//
// The specified protocol is not supported.
ErrCodeUnsupportedProtocolException = "UnsupportedProtocol"
)
+857
View File
@@ -0,0 +1,857 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package elbv2_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/elbv2"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleELBV2_AddTags() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.AddTagsInput{
ResourceArns: []*string{ // Required
aws.String("ResourceArn"), // Required
// More values...
},
Tags: []*elbv2.Tag{ // Required
{ // Required
Key: aws.String("TagKey"), // Required
Value: aws.String("TagValue"),
},
// More values...
},
}
resp, err := svc.AddTags(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(resp)
}
func ExampleELBV2_CreateListener() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.CreateListenerInput{
DefaultActions: []*elbv2.Action{ // Required
{ // Required
TargetGroupArn: aws.String("TargetGroupArn"), // Required
Type: aws.String("ActionTypeEnum"), // Required
},
// More values...
},
LoadBalancerArn: aws.String("LoadBalancerArn"), // Required
Port: aws.Int64(1), // Required
Protocol: aws.String("ProtocolEnum"), // Required
Certificates: []*elbv2.Certificate{
{ // Required
CertificateArn: aws.String("CertificateArn"),
},
// More values...
},
SslPolicy: aws.String("SslPolicyName"),
}
resp, err := svc.CreateListener(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(resp)
}
func ExampleELBV2_CreateLoadBalancer() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.CreateLoadBalancerInput{
Name: aws.String("LoadBalancerName"), // Required
Subnets: []*string{ // Required
aws.String("SubnetId"), // Required
// More values...
},
IpAddressType: aws.String("IpAddressType"),
Scheme: aws.String("LoadBalancerSchemeEnum"),
SecurityGroups: []*string{
aws.String("SecurityGroupId"), // Required
// More values...
},
Tags: []*elbv2.Tag{
{ // Required
Key: aws.String("TagKey"), // Required
Value: aws.String("TagValue"),
},
// More values...
},
}
resp, err := svc.CreateLoadBalancer(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(resp)
}
func ExampleELBV2_CreateRule() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.CreateRuleInput{
Actions: []*elbv2.Action{ // Required
{ // Required
TargetGroupArn: aws.String("TargetGroupArn"), // Required
Type: aws.String("ActionTypeEnum"), // Required
},
// More values...
},
Conditions: []*elbv2.RuleCondition{ // Required
{ // Required
Field: aws.String("ConditionFieldName"),
Values: []*string{
aws.String("StringValue"), // Required
// More values...
},
},
// More values...
},
ListenerArn: aws.String("ListenerArn"), // Required
Priority: aws.Int64(1), // Required
}
resp, err := svc.CreateRule(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(resp)
}
func ExampleELBV2_CreateTargetGroup() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.CreateTargetGroupInput{
Name: aws.String("TargetGroupName"), // Required
Port: aws.Int64(1), // Required
Protocol: aws.String("ProtocolEnum"), // Required
VpcId: aws.String("VpcId"), // Required
HealthCheckIntervalSeconds: aws.Int64(1),
HealthCheckPath: aws.String("Path"),
HealthCheckPort: aws.String("HealthCheckPort"),
HealthCheckProtocol: aws.String("ProtocolEnum"),
HealthCheckTimeoutSeconds: aws.Int64(1),
HealthyThresholdCount: aws.Int64(1),
Matcher: &elbv2.Matcher{
HttpCode: aws.String("HttpCode"), // Required
},
UnhealthyThresholdCount: aws.Int64(1),
}
resp, err := svc.CreateTargetGroup(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(resp)
}
func ExampleELBV2_DeleteListener() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DeleteListenerInput{
ListenerArn: aws.String("ListenerArn"), // Required
}
resp, err := svc.DeleteListener(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(resp)
}
func ExampleELBV2_DeleteLoadBalancer() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DeleteLoadBalancerInput{
LoadBalancerArn: aws.String("LoadBalancerArn"), // Required
}
resp, err := svc.DeleteLoadBalancer(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(resp)
}
func ExampleELBV2_DeleteRule() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DeleteRuleInput{
RuleArn: aws.String("RuleArn"), // Required
}
resp, err := svc.DeleteRule(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(resp)
}
func ExampleELBV2_DeleteTargetGroup() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DeleteTargetGroupInput{
TargetGroupArn: aws.String("TargetGroupArn"), // Required
}
resp, err := svc.DeleteTargetGroup(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(resp)
}
func ExampleELBV2_DeregisterTargets() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DeregisterTargetsInput{
TargetGroupArn: aws.String("TargetGroupArn"), // Required
Targets: []*elbv2.TargetDescription{ // Required
{ // Required
Id: aws.String("TargetId"), // Required
Port: aws.Int64(1),
},
// More values...
},
}
resp, err := svc.DeregisterTargets(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(resp)
}
func ExampleELBV2_DescribeListeners() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DescribeListenersInput{
ListenerArns: []*string{
aws.String("ListenerArn"), // Required
// More values...
},
LoadBalancerArn: aws.String("LoadBalancerArn"),
Marker: aws.String("Marker"),
PageSize: aws.Int64(1),
}
resp, err := svc.DescribeListeners(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(resp)
}
func ExampleELBV2_DescribeLoadBalancerAttributes() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DescribeLoadBalancerAttributesInput{
LoadBalancerArn: aws.String("LoadBalancerArn"), // Required
}
resp, err := svc.DescribeLoadBalancerAttributes(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(resp)
}
func ExampleELBV2_DescribeLoadBalancers() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DescribeLoadBalancersInput{
LoadBalancerArns: []*string{
aws.String("LoadBalancerArn"), // Required
// More values...
},
Marker: aws.String("Marker"),
Names: []*string{
aws.String("LoadBalancerName"), // Required
// More values...
},
PageSize: aws.Int64(1),
}
resp, err := svc.DescribeLoadBalancers(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(resp)
}
func ExampleELBV2_DescribeRules() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DescribeRulesInput{
ListenerArn: aws.String("ListenerArn"),
RuleArns: []*string{
aws.String("RuleArn"), // Required
// More values...
},
}
resp, err := svc.DescribeRules(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(resp)
}
func ExampleELBV2_DescribeSSLPolicies() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DescribeSSLPoliciesInput{
Marker: aws.String("Marker"),
Names: []*string{
aws.String("SslPolicyName"), // Required
// More values...
},
PageSize: aws.Int64(1),
}
resp, err := svc.DescribeSSLPolicies(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(resp)
}
func ExampleELBV2_DescribeTags() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DescribeTagsInput{
ResourceArns: []*string{ // Required
aws.String("ResourceArn"), // Required
// More values...
},
}
resp, err := svc.DescribeTags(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(resp)
}
func ExampleELBV2_DescribeTargetGroupAttributes() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DescribeTargetGroupAttributesInput{
TargetGroupArn: aws.String("TargetGroupArn"), // Required
}
resp, err := svc.DescribeTargetGroupAttributes(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(resp)
}
func ExampleELBV2_DescribeTargetGroups() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DescribeTargetGroupsInput{
LoadBalancerArn: aws.String("LoadBalancerArn"),
Marker: aws.String("Marker"),
Names: []*string{
aws.String("TargetGroupName"), // Required
// More values...
},
PageSize: aws.Int64(1),
TargetGroupArns: []*string{
aws.String("TargetGroupArn"), // Required
// More values...
},
}
resp, err := svc.DescribeTargetGroups(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(resp)
}
func ExampleELBV2_DescribeTargetHealth() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.DescribeTargetHealthInput{
TargetGroupArn: aws.String("TargetGroupArn"), // Required
Targets: []*elbv2.TargetDescription{
{ // Required
Id: aws.String("TargetId"), // Required
Port: aws.Int64(1),
},
// More values...
},
}
resp, err := svc.DescribeTargetHealth(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(resp)
}
func ExampleELBV2_ModifyListener() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.ModifyListenerInput{
ListenerArn: aws.String("ListenerArn"), // Required
Certificates: []*elbv2.Certificate{
{ // Required
CertificateArn: aws.String("CertificateArn"),
},
// More values...
},
DefaultActions: []*elbv2.Action{
{ // Required
TargetGroupArn: aws.String("TargetGroupArn"), // Required
Type: aws.String("ActionTypeEnum"), // Required
},
// More values...
},
Port: aws.Int64(1),
Protocol: aws.String("ProtocolEnum"),
SslPolicy: aws.String("SslPolicyName"),
}
resp, err := svc.ModifyListener(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(resp)
}
func ExampleELBV2_ModifyLoadBalancerAttributes() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.ModifyLoadBalancerAttributesInput{
Attributes: []*elbv2.LoadBalancerAttribute{ // Required
{ // Required
Key: aws.String("LoadBalancerAttributeKey"),
Value: aws.String("LoadBalancerAttributeValue"),
},
// More values...
},
LoadBalancerArn: aws.String("LoadBalancerArn"), // Required
}
resp, err := svc.ModifyLoadBalancerAttributes(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(resp)
}
func ExampleELBV2_ModifyRule() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.ModifyRuleInput{
RuleArn: aws.String("RuleArn"), // Required
Actions: []*elbv2.Action{
{ // Required
TargetGroupArn: aws.String("TargetGroupArn"), // Required
Type: aws.String("ActionTypeEnum"), // Required
},
// More values...
},
Conditions: []*elbv2.RuleCondition{
{ // Required
Field: aws.String("ConditionFieldName"),
Values: []*string{
aws.String("StringValue"), // Required
// More values...
},
},
// More values...
},
}
resp, err := svc.ModifyRule(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(resp)
}
func ExampleELBV2_ModifyTargetGroup() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.ModifyTargetGroupInput{
TargetGroupArn: aws.String("TargetGroupArn"), // Required
HealthCheckIntervalSeconds: aws.Int64(1),
HealthCheckPath: aws.String("Path"),
HealthCheckPort: aws.String("HealthCheckPort"),
HealthCheckProtocol: aws.String("ProtocolEnum"),
HealthCheckTimeoutSeconds: aws.Int64(1),
HealthyThresholdCount: aws.Int64(1),
Matcher: &elbv2.Matcher{
HttpCode: aws.String("HttpCode"), // Required
},
UnhealthyThresholdCount: aws.Int64(1),
}
resp, err := svc.ModifyTargetGroup(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(resp)
}
func ExampleELBV2_ModifyTargetGroupAttributes() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.ModifyTargetGroupAttributesInput{
Attributes: []*elbv2.TargetGroupAttribute{ // Required
{ // Required
Key: aws.String("TargetGroupAttributeKey"),
Value: aws.String("TargetGroupAttributeValue"),
},
// More values...
},
TargetGroupArn: aws.String("TargetGroupArn"), // Required
}
resp, err := svc.ModifyTargetGroupAttributes(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(resp)
}
func ExampleELBV2_RegisterTargets() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.RegisterTargetsInput{
TargetGroupArn: aws.String("TargetGroupArn"), // Required
Targets: []*elbv2.TargetDescription{ // Required
{ // Required
Id: aws.String("TargetId"), // Required
Port: aws.Int64(1),
},
// More values...
},
}
resp, err := svc.RegisterTargets(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(resp)
}
func ExampleELBV2_RemoveTags() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.RemoveTagsInput{
ResourceArns: []*string{ // Required
aws.String("ResourceArn"), // Required
// More values...
},
TagKeys: []*string{ // Required
aws.String("TagKey"), // Required
// More values...
},
}
resp, err := svc.RemoveTags(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(resp)
}
func ExampleELBV2_SetIpAddressType() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.SetIpAddressTypeInput{
IpAddressType: aws.String("IpAddressType"), // Required
LoadBalancerArn: aws.String("LoadBalancerArn"), // Required
}
resp, err := svc.SetIpAddressType(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(resp)
}
func ExampleELBV2_SetRulePriorities() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.SetRulePrioritiesInput{
RulePriorities: []*elbv2.RulePriorityPair{ // Required
{ // Required
Priority: aws.Int64(1),
RuleArn: aws.String("RuleArn"),
},
// More values...
},
}
resp, err := svc.SetRulePriorities(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(resp)
}
func ExampleELBV2_SetSecurityGroups() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.SetSecurityGroupsInput{
LoadBalancerArn: aws.String("LoadBalancerArn"), // Required
SecurityGroups: []*string{ // Required
aws.String("SecurityGroupId"), // Required
// More values...
},
}
resp, err := svc.SetSecurityGroups(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(resp)
}
func ExampleELBV2_SetSubnets() {
sess := session.Must(session.NewSession())
svc := elbv2.New(sess)
params := &elbv2.SetSubnetsInput{
LoadBalancerArn: aws.String("LoadBalancerArn"), // Required
Subnets: []*string{ // Required
aws.String("SubnetId"), // Required
// More values...
},
}
resp, err := svc.SetSubnets(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(resp)
}
+136
View File
@@ -0,0 +1,136 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package elbv2
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/query"
)
// A load balancer distributes incoming traffic across targets, such as your
// EC2 instances. This enables you to increase the availability of your application.
// The load balancer also monitors the health of its registered targets and
// ensures that it routes traffic only to healthy targets. You configure your
// load balancer to accept incoming traffic by specifying one or more listeners,
// which are configured with a protocol and port number for connections from
// clients to the load balancer. You configure a target group with a protocol
// and port number for connections from the load balancer to the targets, and
// with health check settings to be used when checking the health status of
// the targets.
//
// Elastic Load Balancing supports two types of load balancers: Classic Load
// Balancers and Application Load Balancers. A Classic Load Balancer makes routing
// and load balancing decisions either at the transport layer (TCP/SSL) or the
// application layer (HTTP/HTTPS), and supports either EC2-Classic or a VPC.
// An Application Load Balancer makes routing and load balancing decisions at
// the application layer (HTTP/HTTPS), supports path-based routing, and can
// route requests to one or more ports on each EC2 instance or container instance
// in your virtual private cloud (VPC). For more information, see the Elastic
// Load Balancing User Guide (http://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/).
//
// This reference covers the 2015-12-01 API, which supports Application Load
// Balancers. The 2012-06-01 API supports Classic Load Balancers.
//
// To get started, complete the following tasks:
//
// Create an Application Load Balancer using CreateLoadBalancer.
//
// Create a target group using CreateTargetGroup.
//
// Register targets for the target group using RegisterTargets.
//
// Create one or more listeners for your load balancer using CreateListener.
//
// (Optional) Create one or more rules for content routing based on URL using
// CreateRule.
//
// To delete an Application Load Balancer and its related resources, complete
// the following tasks:
//
// Delete the load balancer using DeleteLoadBalancer.
//
// Delete the target group using DeleteTargetGroup.
//
// All Elastic Load Balancing operations are idempotent, which means that they
// complete at most one time. If you repeat an operation, it succeeds.
// The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01
type ELBV2 struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "elasticloadbalancing" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the ELBV2 client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a ELBV2 client from just a session.
// svc := elbv2.New(mySession)
//
// // Create a ELBV2 client with additional configuration
// svc := elbv2.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *ELBV2 {
c := p.ClientConfig(EndpointsID, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *ELBV2 {
svc := &ELBV2{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2015-12-01",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(query.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a ELBV2 operation and runs any
// custom request initialization.
func (c *ELBV2) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}