| 125 | } |
| 126 | |
| 127 | func (i *imlServiceService) Check(ctx context.Context, id string, rule map[string]bool) (*Service, error) { |
| 128 | pro, err := i.Get(ctx, id) |
| 129 | if err != nil { |
| 130 | return nil, err |
| 131 | } |
| 132 | if rule == nil || len(rule) == 0 { |
| 133 | return pro, nil |
| 134 | } |
| 135 | if rule["as_server"] && !pro.AsServer { |
| 136 | return nil, fmt.Errorf("project %s is not as server", id) |
| 137 | } |
| 138 | if rule["as_app"] && !pro.AsApp { |
| 139 | return nil, fmt.Errorf("project %s is not as app", id) |
| 140 | } |
| 141 | return pro, nil |
| 142 | } |
| 143 | |
| 144 | func (i *imlServiceService) GetLabels(ctx context.Context, ids ...string) map[string]string { |
| 145 | if len(ids) == 0 { |