本文整理汇总了Golang中github.com/upstartmobile/aws-sdk-go/service/elb.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleELB_RemoveTags
func ExampleELB_RemoveTags() {
svc := elb.New(nil)
params := &elb.RemoveTagsInput{
LoadBalancerNames: []*string{ // Required
aws.String("AccessPointName"), // Required
// More values...
},
Tags: []*elb.TagKeyOnly{ // Required
{ // Required
Key: aws.String("TagKey"),
},
// 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)
}
示例2: ExampleELB_CreateLoadBalancerPolicy
func ExampleELB_CreateLoadBalancerPolicy() {
svc := elb.New(nil)
params := &elb.CreateLoadBalancerPolicyInput{
LoadBalancerName: aws.String("AccessPointName"), // Required
PolicyName: aws.String("PolicyName"), // Required
PolicyTypeName: aws.String("PolicyTypeName"), // Required
PolicyAttributes: []*elb.PolicyAttribute{
{ // Required
AttributeName: aws.String("AttributeName"),
AttributeValue: aws.String("AttributeValue"),
},
// More values...
},
}
resp, err := svc.CreateLoadBalancerPolicy(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)
}
示例3: ExampleELB_CreateLoadBalancerListeners
func ExampleELB_CreateLoadBalancerListeners() {
svc := elb.New(nil)
params := &elb.CreateLoadBalancerListenersInput{
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
}
resp, err := svc.CreateLoadBalancerListeners(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)
}
示例4: 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 {
// 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)
}
示例5: 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 {
// 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)
}
示例6: 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 {
// 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)
}
示例7: 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 {
// 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)
}
示例8: ExampleELB_SetLoadBalancerListenerSSLCertificate
func ExampleELB_SetLoadBalancerListenerSSLCertificate() {
svc := elb.New(nil)
params := &elb.SetLoadBalancerListenerSSLCertificateInput{
LoadBalancerName: aws.String("AccessPointName"), // Required
LoadBalancerPort: aws.Int64(1), // Required
SSLCertificateId: aws.String("SSLCertificateId"), // Required
}
resp, err := svc.SetLoadBalancerListenerSSLCertificate(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)
}
示例9: ExampleELB_CreateLBCookieStickinessPolicy
func ExampleELB_CreateLBCookieStickinessPolicy() {
svc := elb.New(nil)
params := &elb.CreateLBCookieStickinessPolicyInput{
LoadBalancerName: aws.String("AccessPointName"), // Required
PolicyName: aws.String("PolicyName"), // Required
CookieExpirationPeriod: aws.Int64(1),
}
resp, err := svc.CreateLBCookieStickinessPolicy(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)
}
示例10: ExampleELB_DescribeLoadBalancerPolicyTypes
func ExampleELB_DescribeLoadBalancerPolicyTypes() {
svc := elb.New(nil)
params := &elb.DescribeLoadBalancerPolicyTypesInput{
PolicyTypeNames: []*string{
aws.String("PolicyTypeName"), // Required
// More values...
},
}
resp, err := svc.DescribeLoadBalancerPolicyTypes(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)
}
示例11: ExampleELB_AttachLoadBalancerToSubnets
func ExampleELB_AttachLoadBalancerToSubnets() {
svc := elb.New(nil)
params := &elb.AttachLoadBalancerToSubnetsInput{
LoadBalancerName: aws.String("AccessPointName"), // Required
Subnets: []*string{ // Required
aws.String("SubnetId"), // Required
// More values...
},
}
resp, err := svc.AttachLoadBalancerToSubnets(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)
}
示例12: ExampleELB_DeleteLoadBalancerListeners
func ExampleELB_DeleteLoadBalancerListeners() {
svc := elb.New(nil)
params := &elb.DeleteLoadBalancerListenersInput{
LoadBalancerName: aws.String("AccessPointName"), // Required
LoadBalancerPorts: []*int64{ // Required
aws.Int64(1), // Required
// More values...
},
}
resp, err := svc.DeleteLoadBalancerListeners(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)
}
示例13: ExampleELB_EnableAvailabilityZonesForLoadBalancer
func ExampleELB_EnableAvailabilityZonesForLoadBalancer() {
svc := elb.New(nil)
params := &elb.EnableAvailabilityZonesForLoadBalancerInput{
AvailabilityZones: []*string{ // Required
aws.String("AvailabilityZone"), // Required
// More values...
},
LoadBalancerName: aws.String("AccessPointName"), // Required
}
resp, err := svc.EnableAvailabilityZonesForLoadBalancer(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)
}
示例14: ExampleELB_SetLoadBalancerPoliciesForBackendServer
func ExampleELB_SetLoadBalancerPoliciesForBackendServer() {
svc := elb.New(nil)
params := &elb.SetLoadBalancerPoliciesForBackendServerInput{
InstancePort: aws.Int64(1), // Required
LoadBalancerName: aws.String("AccessPointName"), // Required
PolicyNames: []*string{ // Required
aws.String("PolicyName"), // Required
// More values...
},
}
resp, err := svc.SetLoadBalancerPoliciesForBackendServer(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)
}
示例15: ExampleELB_RegisterInstancesWithLoadBalancer
func ExampleELB_RegisterInstancesWithLoadBalancer() {
svc := elb.New(nil)
params := &elb.RegisterInstancesWithLoadBalancerInput{
Instances: []*elb.Instance{ // Required
{ // Required
InstanceId: aws.String("InstanceId"),
},
// More values...
},
LoadBalancerName: aws.String("AccessPointName"), // Required
}
resp, err := svc.RegisterInstancesWithLoadBalancer(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)
}