MCPcopy Create free account
hub / github.com/eksctl-io/eksctl / ListStackNames

Method ListStackNames

pkg/cfn/manager/api.go:488–511  ·  view source on GitHub ↗

ListStackNames lists all stack names matching regExp.

(ctx context.Context, regExp string)

Source from the content-addressed store, hash-verified

486
487// ListStackNames lists all stack names matching regExp.
488func (c *StackCollection) ListStackNames(ctx context.Context, regExp string) ([]string, error) {
489 re, err := regexp.Compile(regExp)
490 if err != nil {
491 return nil, fmt.Errorf("unexpected error compiling RegExp: %w", err)
492 }
493 paginator := cloudformation.NewListStacksPaginator(c.cloudformationAPI, &cloudformation.ListStacksInput{
494 StackStatusFilter: defaultStackStatusFilter(),
495 })
496 var stackNames []string
497 for paginator.HasMorePages() {
498 out, err := paginator.NextPage(ctx)
499 if err != nil {
500 return nil, err
501 }
502
503 for _, s := range out.StackSummaries {
504 if re.MatchString(*s.StackName) {
505 stackNames = append(stackNames, *s.StackName)
506 }
507 }
508 }
509
510 return stackNames, nil
511}
512
513// ListClusterStackNames gets all stack names matching regex
514func (c *StackCollection) ListClusterStackNames(ctx context.Context) ([]string, error) {

Callers 3

ListClusterStackNamesMethod · 0.95

Calls 1

defaultStackStatusFilterFunction · 0.85

Tested by

no test coverage detected