本文整理匯總了Golang中bosun/org/_third_party/github.com/aws/aws-sdk-go/service/elb.New函數的典型用法代碼示例。如果您正苦於以下問題:Golang New函數的具體用法?Golang New怎麽用?Golang New使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了New函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: 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)
}
示例2: 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)
}
示例3: 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)
}
示例4: 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)
}
示例5: c_aws
func c_aws(accessKey, secretKey, region string) (opentsdb.MultiDataPoint, error) {
var md opentsdb.MultiDataPoint
creds := credentials.NewStaticCredentials(accessKey, secretKey, "")
conf := &aws.Config{
Credentials: creds,
Region: ®ion,
}
ecc := ec2.New(conf)
if ecc == nil {
return nil, fmt.Errorf("unable to login to EC2")
}
as := autoscaling.New(conf)
if as == nil {
return nil, fmt.Errorf("unable to login to AutoScaling")
}
elb := elb.New(conf)
if elb == nil {
return nil, fmt.Errorf("unable to login to ELB")
}
cw := cloudwatch.New(conf)
if cw == nil {
return nil, fmt.Errorf("unable to login to CloudWatch")
}
instances, err := awsGetInstances(*ecc)
if err != nil {
slog.Info("No EC2 Instances found.")
}
loadBalancers, err := awsGetLoadBalancers(*elb)
if err != nil {
slog.Info("No ELB Load Balancecrs found.")
}
asgs, err := awsGetAutoScaleGroups(*as)
if err != nil {
slog.Info("No AutoScaleGroups found.")
}
for _, loadBalancer := range loadBalancers {
awsGetELBLatency(*cw, &md, loadBalancer)
awsGetELBHostCounts(*cw, &md, loadBalancer)
awsGetELB2XX(*cw, &md, loadBalancer)
awsGetELB5XX(*cw, &md, loadBalancer)
}
for _, instance := range instances {
awsGetCPU(*cw, &md, instance)
awsGetNetwork(*cw, &md, instance)
awsGetDiskBytes(*cw, &md, instance)
awsGetDiskOps(*cw, &md, instance)
awsGetStatusChecks(*cw, &md, instance)
}
for _, asg := range asgs {
awsGetAsgCPU(*cw, &md, asg)
}
return md, nil
}
示例6: 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)
}
示例7: 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)
}
示例8: 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)
}
示例9: 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)
}
示例10: 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)
}
示例11: 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)
}
示例12: 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)
}
示例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_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)
}
示例15: 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)
}