本文整理汇总了Golang中github.com/aws/aws-sdk-go/service/elasticbeanstalk.ElasticBeanstalk类的典型用法代码示例。如果您正苦于以下问题:Golang ElasticBeanstalk类的具体用法?Golang ElasticBeanstalk怎么用?Golang ElasticBeanstalk使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ElasticBeanstalk类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: clean
//clean up all Application Version inside "versions" slice
func clean(eb *elasticbeanstalk.ElasticBeanstalk, appName string, versions []*elasticbeanstalk.ApplicationVersionDescription, deleteSourceBundle bool) {
for _, version := range versions {
var buffer bytes.Buffer
buffer.WriteString(fmt.Sprintf("Deleting version %s .......... ", *version.VersionLabel))
_, err := eb.DeleteApplicationVersion(&elasticbeanstalk.DeleteApplicationVersionInput{
ApplicationName: &appName,
DeleteSourceBundle: &deleteSourceBundle,
VersionLabel: version.VersionLabel,
})
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
log.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
buffer.WriteString("Error")
if reqErr, ok := err.(awserr.RequestFailure); ok {
log.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
buffer.WriteString("Error")
}
} else {
log.Println(err.Error())
buffer.WriteString("Error")
}
} else {
buffer.WriteString("OK")
}
fmt.Println(buffer.String())
}
}
开发者ID:stvvan,项目名称:aws-eb-cleanup,代码行数:32,代码来源:ebclean.go
示例2: environmentStateRefreshFunc
// environmentStateRefreshFunc returns a resource.StateRefreshFunc that is used to watch
// the creation of the Beanstalk Environment
func environmentStateRefreshFunc(conn *elasticbeanstalk.ElasticBeanstalk, environmentId string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
resp, err := conn.DescribeEnvironments(&elasticbeanstalk.DescribeEnvironmentsInput{
EnvironmentIds: []*string{aws.String(environmentId)},
})
if err != nil {
log.Printf("[Err] Error waiting for Elastic Beanstalk Environment state: %s", err)
return -1, "failed", fmt.Errorf("[Err] Error waiting for Elastic Beanstalk Environment state: %s", err)
}
if resp == nil || len(resp.Environments) == 0 {
// Sometimes AWS just has consistency issues and doesn't see
// our instance yet. Return an empty state.
return nil, "", nil
}
var env *elasticbeanstalk.EnvironmentDescription
for _, e := range resp.Environments {
if environmentId == *e.EnvironmentId {
env = e
}
}
if env == nil {
return -1, "failed", fmt.Errorf("[Err] Error finding Elastic Beanstalk Environment, environment not found")
}
return env, *env.Status, nil
}
}
开发者ID:Zordrak,项目名称:terraform,代码行数:32,代码来源:resource_aws_elastic_beanstalk_environment.go
示例3: resourceAwsElasticBeanstalkEnvironmentOptionSettingsUpdate
func resourceAwsElasticBeanstalkEnvironmentOptionSettingsUpdate(conn *elasticbeanstalk.ElasticBeanstalk, d *schema.ResourceData) error {
name := d.Get("name").(string)
envId := d.Id()
log.Printf("[DEBUG] Elastic Beanstalk application: %s, update options", name)
req := &elasticbeanstalk.UpdateEnvironmentInput{
EnvironmentId: aws.String(envId),
}
if d.HasChange("setting") {
o, n := d.GetChange("setting")
if o == nil {
o = &schema.Set{F: optionSettingValueHash}
}
if n == nil {
n = &schema.Set{F: optionSettingValueHash}
}
os := o.(*schema.Set)
ns := n.(*schema.Set)
req.OptionSettings = extractOptionSettings(ns.Difference(os))
}
if _, err := conn.UpdateEnvironment(req); err != nil {
return err
}
return nil
}
开发者ID:discogestalt,项目名称:terraform,代码行数:31,代码来源:resource_aws_elastic_beanstalk_environment.go
示例4: resourceAwsElasticBeanstalkConfigurationTemplateDescriptionUpdate
func resourceAwsElasticBeanstalkConfigurationTemplateDescriptionUpdate(conn *elasticbeanstalk.ElasticBeanstalk, d *schema.ResourceData) error {
_, err := conn.UpdateConfigurationTemplate(&elasticbeanstalk.UpdateConfigurationTemplateInput{
ApplicationName: aws.String(d.Get("application").(string)),
TemplateName: aws.String(d.Get("name").(string)),
Description: aws.String(d.Get("description").(string)),
})
return err
}
开发者ID:RezaDKhan,项目名称:terraform,代码行数:9,代码来源:resource_aws_elastic_beanstalk_configuration_template.go
示例5: queryBeanstalkEnv
func queryBeanstalkEnv(svc *eb.ElasticBeanstalk, filterVal string) interface{} {
params := &eb.DescribeEnvironmentsInput{
EnvironmentNames: []*string{aws.String(filterVal)},
}
resp, err := svc.DescribeEnvironments(params)
checkError(err)
if len(resp.Environments) > 0 {
return resp
}
return nil
}
开发者ID:mefellows,项目名称:aws-search,代码行数:12,代码来源:main.go
示例6: resourceAwsElasticBeanstalkApplicationDescriptionUpdate
func resourceAwsElasticBeanstalkApplicationDescriptionUpdate(beanstalkConn *elasticbeanstalk.ElasticBeanstalk, d *schema.ResourceData) error {
name := d.Get("name").(string)
description := d.Get("description").(string)
log.Printf("[DEBUG] Elastic Beanstalk application: %s, update description: %s", name, description)
_, err := beanstalkConn.UpdateApplication(&elasticbeanstalk.UpdateApplicationInput{
ApplicationName: aws.String(name),
Description: aws.String(description),
})
return err
}
开发者ID:srikalyan,项目名称:terraform,代码行数:13,代码来源:resource_aws_elastic_beanstalk_application.go
示例7: queryBeanstalkResources
func queryBeanstalkResources(svc *eb.ElasticBeanstalk, filterVal string) interface{} {
params := &eb.DescribeEnvironmentResourcesInput{
EnvironmentName: aws.String(filterVal),
}
resp, err := svc.DescribeEnvironmentResources(params)
checkError(err)
if resp.EnvironmentResources != nil {
return resp
}
return nil
}
开发者ID:mefellows,项目名称:aws-search,代码行数:13,代码来源:main.go
示例8: resourceAwsElasticBeanstalkEnvironmentSolutionStackUpdate
func resourceAwsElasticBeanstalkEnvironmentSolutionStackUpdate(conn *elasticbeanstalk.ElasticBeanstalk, d *schema.ResourceData) error {
name := d.Get("name").(string)
solutionStack := d.Get("solution_stack_name").(string)
envId := d.Id()
log.Printf("[DEBUG] Elastic Beanstalk application: %s, update solution_stack_name: %s", name, solutionStack)
_, err := conn.UpdateEnvironment(&elasticbeanstalk.UpdateEnvironmentInput{
EnvironmentId: aws.String(envId),
SolutionStackName: aws.String(solutionStack),
})
return err
}
开发者ID:discogestalt,项目名称:terraform,代码行数:14,代码来源:resource_aws_elastic_beanstalk_environment.go
示例9: resourceAwsElasticBeanstalkEnvironmentDescriptionUpdate
func resourceAwsElasticBeanstalkEnvironmentDescriptionUpdate(conn *elasticbeanstalk.ElasticBeanstalk, d *schema.ResourceData) error {
name := d.Get("name").(string)
desc := d.Get("description").(string)
envId := d.Id()
log.Printf("[DEBUG] Elastic Beanstalk application: %s, update description: %s", name, desc)
_, err := conn.UpdateEnvironment(&elasticbeanstalk.UpdateEnvironmentInput{
EnvironmentId: aws.String(envId),
Description: aws.String(desc),
})
return err
}
开发者ID:discogestalt,项目名称:terraform,代码行数:14,代码来源:resource_aws_elastic_beanstalk_environment.go
示例10: queryBeanstalk
func queryBeanstalk(svc *eb.ElasticBeanstalk, filterVal string) interface{} {
params := &eb.DescribeApplicationsInput{
ApplicationNames: []*string{
aws.String(filterVal),
},
}
resp, err := svc.DescribeApplications(params)
checkError(err)
if len(resp.Applications) > 0 {
return resp
}
return nil
}
开发者ID:mefellows,项目名称:aws-search,代码行数:14,代码来源:main.go
示例11: resourceAwsElasticBeanstalkConfigurationTemplateOptionSettingsUpdate
func resourceAwsElasticBeanstalkConfigurationTemplateOptionSettingsUpdate(conn *elasticbeanstalk.ElasticBeanstalk, d *schema.ResourceData) error {
if d.HasChange("setting") {
_, err := conn.ValidateConfigurationSettings(&elasticbeanstalk.ValidateConfigurationSettingsInput{
ApplicationName: aws.String(d.Get("application").(string)),
TemplateName: aws.String(d.Get("name").(string)),
OptionSettings: gatherOptionSettings(d),
})
if err != nil {
return err
}
o, n := d.GetChange("setting")
if o == nil {
o = new(schema.Set)
}
if n == nil {
n = new(schema.Set)
}
os := o.(*schema.Set)
ns := o.(*schema.Set)
remove := extractOptionSettings(os.Difference(ns))
add := extractOptionSettings(ns.Difference(os))
req := &elasticbeanstalk.UpdateConfigurationTemplateInput{
ApplicationName: aws.String(d.Get("application").(string)),
TemplateName: aws.String(d.Get("name").(string)),
OptionSettings: add,
}
for _, elem := range remove {
req.OptionsToRemove = append(req.OptionsToRemove, &elasticbeanstalk.OptionSpecification{
Namespace: elem.Namespace,
OptionName: elem.OptionName,
})
}
if _, err := conn.UpdateConfigurationTemplate(req); err != nil {
return err
}
}
return nil
}
开发者ID:monkeylittleinc,项目名称:terraform,代码行数:45,代码来源:resource_aws_elastic_beanstalk_configuration_template.go
示例12: describeBeanstalkEnv
func describeBeanstalkEnv(conn *elasticbeanstalk.ElasticBeanstalk,
envID *string) (*elasticbeanstalk.EnvironmentDescription, error) {
describeBeanstalkEnvOpts := &elasticbeanstalk.DescribeEnvironmentsInput{
EnvironmentIds: []*string{envID},
}
log.Printf("[DEBUG] Elastic Beanstalk Environment TEST describe opts: %s", describeBeanstalkEnvOpts)
resp, err := conn.DescribeEnvironments(describeBeanstalkEnvOpts)
if err != nil {
return &elasticbeanstalk.EnvironmentDescription{}, err
}
if len(resp.Environments) == 0 {
return &elasticbeanstalk.EnvironmentDescription{}, fmt.Errorf("Elastic Beanstalk ENV not found.")
}
if len(resp.Environments) > 1 {
return &elasticbeanstalk.EnvironmentDescription{}, fmt.Errorf("Found %d environments, expected 1.", len(resp.Environments))
}
return resp.Environments[0], nil
}
开发者ID:tompao,项目名称:terraform,代码行数:20,代码来源:resource_aws_elastic_beanstalk_environment_test.go
示例13: describeBeanstalkEvents
func describeBeanstalkEvents(conn *elasticbeanstalk.ElasticBeanstalk, environmentId string, t time.Time) error {
beanstalkErrors, err := conn.DescribeEvents(&elasticbeanstalk.DescribeEventsInput{
EnvironmentId: aws.String(environmentId),
Severity: aws.String("ERROR"),
StartTime: aws.Time(t),
})
if err != nil {
log.Printf("[Err] Unable to get Elastic Beanstalk Evironment events: %s", err)
}
events := ""
for _, event := range beanstalkErrors.Events {
events = events + "\n" + event.EventDate.String() + ": " + *event.Message
}
if events != "" {
return fmt.Errorf("%s", events)
}
return nil
}
开发者ID:Zordrak,项目名称:terraform,代码行数:22,代码来源:resource_aws_elastic_beanstalk_environment.go
示例14: resourceAwsElasticBeanstalkConfigurationTemplateOptionSettingsUpdate
func resourceAwsElasticBeanstalkConfigurationTemplateOptionSettingsUpdate(conn *elasticbeanstalk.ElasticBeanstalk, d *schema.ResourceData) error {
if d.HasChange("setting") {
_, err := conn.ValidateConfigurationSettings(&elasticbeanstalk.ValidateConfigurationSettingsInput{
ApplicationName: aws.String(d.Get("application").(string)),
TemplateName: aws.String(d.Get("name").(string)),
OptionSettings: gatherOptionSettings(d),
})
if err != nil {
return err
}
o, n := d.GetChange("setting")
if o == nil {
o = new(schema.Set)
}
if n == nil {
n = new(schema.Set)
}
os := o.(*schema.Set)
ns := n.(*schema.Set)
rm := extractOptionSettings(os.Difference(ns))
add := extractOptionSettings(ns.Difference(os))
// Additions and removals of options are done in a single API call, so we
// can't do our normal "remove these" and then later "add these", re-adding
// any updated settings.
// Because of this, we need to remove any settings in the "removable"
// settings that are also found in the "add" settings, otherwise they
// conflict. Here we loop through all the initial removables from the set
// difference, and we build up a slice of settings not found in the "add"
// set
var remove []*elasticbeanstalk.ConfigurationOptionSetting
for _, r := range rm {
for _, a := range add {
if *r.Namespace == *a.Namespace && *r.OptionName == *a.OptionName {
continue
}
remove = append(remove, r)
}
}
req := &elasticbeanstalk.UpdateConfigurationTemplateInput{
ApplicationName: aws.String(d.Get("application").(string)),
TemplateName: aws.String(d.Get("name").(string)),
OptionSettings: add,
}
for _, elem := range remove {
req.OptionsToRemove = append(req.OptionsToRemove, &elasticbeanstalk.OptionSpecification{
Namespace: elem.Namespace,
OptionName: elem.OptionName,
})
}
log.Printf("[DEBUG] Update Configuration Template request: %s", req)
if _, err := conn.UpdateConfigurationTemplate(req); err != nil {
return err
}
}
return nil
}
开发者ID:RezaDKhan,项目名称:terraform,代码行数:64,代码来源:resource_aws_elastic_beanstalk_configuration_template.go
示例15: inspect
// inspect and print out details of disposable versions for a given application
func inspect(eb *elasticbeanstalk.ElasticBeanstalk, appName string, duration int) []*elasticbeanstalk.ApplicationVersionDescription {
applicationVersionResp, err := eb.DescribeApplicationVersions(&elasticbeanstalk.DescribeApplicationVersionsInput{ApplicationName: &appName})
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
fmt.Println(err.Error())
}
os.Exit(1)
}
environmentResp, err := eb.DescribeEnvironments(&elasticbeanstalk.DescribeEnvironmentsInput{ApplicationName: &appName})
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
fmt.Println(err.Error())
}
os.Exit(1)
}
var disposableVersions = make([]*elasticbeanstalk.ApplicationVersionDescription, 0)
var buffer bytes.Buffer
buffer.WriteString(fmt.Sprintf("Application Name: %s\n", appName))
buffer.WriteString(fmt.Sprintf("Total version: %d\n", len(applicationVersionResp.ApplicationVersions)))
table := termtables.CreateTable()
table.AddHeaders("Version Label", "Date Created", "Environment")
for _, version := range applicationVersionResp.ApplicationVersions {
var found bool = false
for _, environment := range environmentResp.Environments {
if *version.VersionLabel == *environment.VersionLabel {
table.AddRow(*version.VersionLabel, version.DateCreated, *environment.EnvironmentName)
found = true
}
}
if !found {
if time.Now().After(version.DateCreated.AddDate(0, 0, duration)) {
disposableVersions = append(disposableVersions, version)
table.AddRow(*version.VersionLabel, version.DateCreated, "*Disposable*")
} else {
table.AddRow(*version.VersionLabel, version.DateCreated, "Not disposable")
}
}
}
buffer.WriteString(table.Render())
buffer.WriteString(fmt.Sprintf("Disposable version count: %d\n", len(disposableVersions)))
fmt.Println(buffer.String())
return disposableVersions
}
开发者ID:stvvan,项目名称:aws-eb-cleanup,代码行数:67,代码来源:ebclean.go
注:本文中的github.com/aws/aws-sdk-go/service/elasticbeanstalk.ElasticBeanstalk类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论