• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

UiPath / uipathcli / 18678624158

21 Oct 2025 09:01AM UTC coverage: 90.797% (-0.08%) from 90.88%
18678624158

push

github

thschmitt
Improve configure command by providing tenant list

499 of 548 new or added lines in 18 files covered. (91.06%)

17 existing lines in 4 files now uncovered.

7044 of 7758 relevant lines covered (90.8%)

1.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.86
/executor/plugin_executor.go
1
package executor
2

3
import (
4
        "github.com/UiPath/uipathcli/auth"
5
        "github.com/UiPath/uipathcli/log"
6
        "github.com/UiPath/uipathcli/output"
7
        "github.com/UiPath/uipathcli/plugin"
8
)
9

10
// The PluginExecutor implements the Executor interface and invokes the
11
// registered plugin for the executed command.
12
// The plugin takes care of sending the HTTP request or performing other
13
// operations.
14
type PluginExecutor struct {
15
        authenticators []auth.Authenticator
16
}
17

18
func (e PluginExecutor) authenticatorContext(ctx ExecutionContext, logger log.Logger) auth.AuthenticatorContext {
1✔
19
        authRequest := *auth.NewAuthenticatorRequest(ctx.BaseUri.String(), map[string]string{})
1✔
20
        return *auth.NewAuthenticatorContext(
1✔
21
                ctx.AuthConfig,
1✔
22
                ctx.IdentityUri,
1✔
23
                ctx.Settings.OperationId,
1✔
24
                ctx.Settings.Insecure,
1✔
25
                ctx.Debug,
1✔
26
                authRequest,
1✔
27
                logger)
1✔
28
}
1✔
29

30
func (e PluginExecutor) executeAuthenticators(ctx ExecutionContext, logger log.Logger) (*auth.AuthenticatorResult, error) {
1✔
31
        var token *auth.AuthToken = nil
1✔
32
        for _, authProvider := range e.authenticators {
2✔
33
                authContext := e.authenticatorContext(ctx, logger)
1✔
34
                result := authProvider.Auth(authContext)
1✔
35
                if result.Error != nil {
1✔
NEW
36
                        return nil, result.Error
×
UNCOV
37
                }
×
38
                if result.Token != nil {
2✔
39
                        token = result.Token
1✔
40
                }
1✔
41
        }
42
        return auth.AuthenticatorSuccess(token), nil
1✔
43
}
44

45
func (e PluginExecutor) convertToPluginParameters(parameters []ExecutionParameter) []plugin.ExecutionParameter {
1✔
46
        result := []plugin.ExecutionParameter{}
1✔
47
        for _, parameter := range parameters {
2✔
48
                param := plugin.NewExecutionParameter(parameter.Name, parameter.Value)
1✔
49
                result = append(result, *param)
1✔
50
        }
1✔
51
        return result
1✔
52
}
53

54
func (e PluginExecutor) pluginAuth(auth *auth.AuthenticatorResult) plugin.AuthResult {
1✔
55
        return plugin.AuthResult{
1✔
56
                Token: auth.Token,
1✔
57
        }
1✔
58
}
1✔
59

60
func (e PluginExecutor) Call(ctx ExecutionContext, writer output.OutputWriter, logger log.Logger) error {
1✔
61
        auth, err := e.executeAuthenticators(ctx, logger)
1✔
62
        if err != nil {
1✔
63
                return err
×
64
        }
×
65

66
        pluginAuth := e.pluginAuth(auth)
1✔
67
        pluginParams := e.convertToPluginParameters(ctx.Parameters)
1✔
68
        pluginContext := plugin.NewExecutionContext(
1✔
69
                ctx.Organization,
1✔
70
                ctx.Tenant,
1✔
71
                ctx.BaseUri,
1✔
72
                pluginAuth,
1✔
73
                ctx.IdentityUri,
1✔
74
                ctx.Input,
1✔
75
                pluginParams,
1✔
76
                ctx.Debug,
1✔
77
                *plugin.NewExecutionSettings(ctx.Settings.OperationId, ctx.Settings.Header, ctx.Settings.Timeout, ctx.Settings.MaxAttempts, ctx.Settings.Insecure))
1✔
78
        return ctx.Plugin.Execute(*pluginContext, writer, logger)
1✔
79
}
80

81
func NewPluginExecutor(authenticators []auth.Authenticator) *PluginExecutor {
1✔
82
        return &PluginExecutor{authenticators}
1✔
83
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc