(app *gateway.ApplicationRelease)
| 53 | } |
| 54 | |
| 55 | func (a *ApplicationClient) toApinto(app *gateway.ApplicationRelease) interface{} { |
| 56 | auths := make([]*entity.Authorization, 0, len(app.Authorizations)) |
| 57 | for _, info := range app.Authorizations { |
| 58 | driver, has := auth.Get(info.Type) |
| 59 | if !has { |
| 60 | continue |
| 61 | } |
| 62 | auths = append(auths, &entity.Authorization{ |
| 63 | Type: info.Type, |
| 64 | Position: strings.ToLower(info.Position), |
| 65 | TokenName: info.TokenName, |
| 66 | Config: driver.ToConfig(info.Config), |
| 67 | Users: []*entity.AuthUser{ |
| 68 | { |
| 69 | Expire: info.Expire, |
| 70 | Pattern: driver.ToPattern(info.Config), |
| 71 | HideCredential: info.HideCredential, |
| 72 | Labels: info.Label, |
| 73 | }, |
| 74 | }, |
| 75 | Labels: info.Label, |
| 76 | }) |
| 77 | } |
| 78 | labels := make(map[string]string) |
| 79 | if app.Labels != nil { |
| 80 | labels = app.Labels |
| 81 | } |
| 82 | return &entity.Application{ |
| 83 | BasicInfo: &entity.BasicInfo{ |
| 84 | ID: genWorkerID(app.ID, gateway.ProfessionApplication), |
| 85 | Name: app.ID, |
| 86 | Description: app.Description, |
| 87 | Driver: "app", |
| 88 | Version: app.Version, |
| 89 | Matches: nil, |
| 90 | }, |
| 91 | Labels: labels, |
| 92 | Authorizations: auths, |
| 93 | } |
| 94 | } |
no test coverage detected