Add enterprise support to garm-cli
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
fb344ab2f2
commit
3e3b91ee59
16 changed files with 479 additions and 62 deletions
|
|
@ -229,7 +229,7 @@ func (s *sqlDatabase) FindEnterprisePoolByTags(ctx context.Context, enterpriseID
|
|||
}
|
||||
|
||||
func (s *sqlDatabase) ListEnterprisePools(ctx context.Context, enterpriseID string) ([]params.Pool, error) {
|
||||
pools, err := s.getEnterprisePools(ctx, enterpriseID, "Tags")
|
||||
pools, err := s.getEnterprisePools(ctx, enterpriseID, "Tags", "Enterprise")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "fetching pools")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ func (s *sqlDatabase) ListAllPools(ctx context.Context) ([]params.Pool, error) {
|
|||
Preload("Tags").
|
||||
Preload("Organization").
|
||||
Preload("Repository").
|
||||
Preload("Enterprise").
|
||||
Find(&pools)
|
||||
if q.Error != nil {
|
||||
return nil, errors.Wrap(q.Error, "fetching all pools")
|
||||
|
|
|
|||
|
|
@ -128,6 +128,11 @@ func (s *sqlDatabase) sqlToCommonPool(pool Pool) params.Pool {
|
|||
ret.OrgName = pool.Organization.Name
|
||||
}
|
||||
|
||||
if pool.EnterpriseID != uuid.Nil && pool.Enterprise.Name != "" {
|
||||
ret.EnterpriseID = pool.EnterpriseID.String()
|
||||
ret.EnterpriseName = pool.Enterprise.Name
|
||||
}
|
||||
|
||||
for idx, val := range pool.Tags {
|
||||
ret.Tags[idx] = s.sqlToCommonTags(*val)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue