ListStackNames lists all stack names matching regExp.
(ctx context.Context, regExp string)
| 486 | |
| 487 | // ListStackNames lists all stack names matching regExp. |
| 488 | func (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 |
| 514 | func (c *StackCollection) ListClusterStackNames(ctx context.Context) ([]string, error) { |
no test coverage detected