Added the clone command in SSM

This commit is contained in:
Leon Mika 2022-04-05 13:39:14 +10:00
parent ee6011bc3e
commit 306640abdb
9 changed files with 102 additions and 10 deletions

View file

@ -7,4 +7,5 @@ import (
type SSMProvider interface {
List(ctx context.Context, prefix string, maxCount int) (*models.SSMParameters, error)
Put(ctx context.Context, param models.SSMParameter, override bool) error
}

View file

@ -17,4 +17,13 @@ func NewService(provider SSMProvider) *Service {
func (s *Service) List(ctx context.Context, prefix string) (*models.SSMParameters, error) {
return s.provider.List(ctx, prefix, 100)
}
func (s *Service) Clone(ctx context.Context, param models.SSMParameter, newName string) error {
newParam := models.SSMParameter{
Name: newName,
Type: param.Type,
Value: param.Value,
}
return s.provider.Put(ctx, newParam, false)
}