本文整理汇总了Golang中github.com/tetrafolium/aws-sdk-go/service/elb.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleELB_SetLoadBalancerPoliciesOfListener
func ExampleELB_SetLoadBalancerPoliciesOfListener() {
svc := elb.New(nil)
params := &elb.SetLoadBalancerPoliciesOfListenerInput{
LoadBalancerName: aws.String("AccessPointName"), // Required
LoadBalancerPort: aws.Int64(1), // Required
PolicyNames: []*string{ // Required
aws.String("PolicyName"), // Required
// More values...
},
}
resp, err := svc.SetLoadBalancerPoliciesOfListener(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例2: ExampleELB_DescribeLoadBalancerAttributes
func ExampleELB_DescribeLoadBalancerAttributes() {
svc := elb.New(nil)
params := &elb.DescribeLoadBalancerAttributesInput{
LoadBalancerName: aws.String("AccessPointName"), // Required
}
resp, err := svc.DescribeLoadBalancerAttributes(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例3: ExampleELB_ConfigureHealthCheck
func ExampleELB_ConfigureHealthCheck() {
svc := elb.New(nil)
params := &elb.ConfigureHealthCheckInput{
HealthCheck: &elb.HealthCheck{ // Required
HealthyThreshold: aws.Int64(1), // Required
Interval: aws.Int64(1), // Required
Target: aws.String("HealthCheckTarget"), // Required
Timeout: aws.Int64(1), // Required
UnhealthyThreshold: aws.Int64(1), // Required
},
LoadBalancerName: aws.String("AccessPointName"), // Required
}
resp, err := svc.ConfigureHealthCheck(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例4: ExampleELB_CreateLoadBalancer
func ExampleELB_CreateLoadBalancer() {
svc := elb.New(nil)
params := &elb.CreateLoadBalancerInput{
Listeners: []*elb.Listener{ // Required
{ // Required
InstancePort: aws.Int64(1), // Required
LoadBalancerPort: aws.Int64(1), // Required
Protocol: aws.String("Protocol"), // Required
InstanceProtocol: aws.String("Protocol"),
SSLCertificateId: aws.String("SSLCertificateId"),
},
// More values...
},
LoadBalancerName: aws.String("AccessPointName"), // Required
AvailabilityZones: []*string{
aws.String("AvailabilityZone"), // Required
// More values...
},
Scheme: aws.String("LoadBalancerScheme"),
SecurityGroups: []*string{
aws.String("SecurityGroupId"), // Required
// More values...
},
Subnets: []*string{
aws.String("SubnetId"), // Required
// More values...
},
Tags: []*elb.Tag{
{ // Required
Key: aws.String("TagKey"), // Required
Value: aws.String("TagValue"),
},
// More values...
},
}
resp, err := svc.CreateLoadBalancer(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例5: ExampleELB_ModifyLoadBalancerAttributes
func ExampleELB_ModifyLoadBalancerAttributes() {
svc := elb.New(nil)
params := &elb.ModifyLoadBalancerAttributesInput{
LoadBalancerAttributes: &elb.LoadBalancerAttributes{ // Required
AccessLog: &elb.AccessLog{
Enabled: aws.Bool(true), // Required
EmitInterval: aws.Int64(1),
S3BucketName: aws.String("S3BucketName"),
S3BucketPrefix: aws.String("AccessLogPrefix"),
},
AdditionalAttributes: []*elb.AdditionalAttribute{
{ // Required
Key: aws.String("StringVal"),
Value: aws.String("StringVal"),
},
// More values...
},
ConnectionDraining: &elb.ConnectionDraining{
Enabled: aws.Bool(true), // Required
Timeout: aws.Int64(1),
},
ConnectionSettings: &elb.ConnectionSettings{
IdleTimeout: aws.Int64(1), // Required
},
CrossZoneLoadBalancing: &elb.CrossZoneLoadBalancing{
Enabled: aws.Bool(true), // Required
},
},
LoadBalancerName: aws.String("AccessPointName"), // Required
}
resp, err := svc.ModifyLoadBalancerAttributes(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
示例6: TestInterface
func TestInterface(t *testing.T) {
assert.Implements(t, (*elbiface.ELBAPI)(nil), elb.New(nil))
}
示例7: init
func init() {
Before("@elb", func() {
World["client"] = elb.New(nil)
})
}