Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Updated the fetch execution to use auth
Browse files Browse the repository at this point in the history
Signed-off-by: Prafulla Mahindrakar <[email protected]>
  • Loading branch information
pmahindrakar-oss committed Apr 27, 2021
1 parent d93e6b9 commit 86bb1c7
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions cmd/get/execution_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import (
"os"

cmdCore "github.com/flyteorg/flytectl/cmd/core"
"github.com/flyteorg/flytectl/pkg/auth"
cmdUtil "github.com/flyteorg/flytectl/pkg/commandutils"
"github.com/flyteorg/flyteidl/clients/go/coreutils"
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"

"google.golang.org/grpc"
"sigs.k8s.io/yaml"
)

Expand All @@ -30,13 +32,20 @@ type ExecutionConfig struct {
}

func (f FetcherImpl) FetchExecution(ctx context.Context, name string, project string, domain string, cmdCtx cmdCore.CommandContext) (*admin.Execution, error) {
e, err := cmdCtx.AdminClient().GetExecution(ctx, &admin.WorkflowExecutionGetRequest{
Id: &core.WorkflowExecutionIdentifier{
Project: project,
Domain: domain,
Name: name,
},
})
var e *admin.Execution
var callOptions []grpc.CallOption
grpcAPICall := func(_ctx context.Context, _callOptions []grpc.CallOption) error {
var err error
e, err = cmdCtx.AdminClient().GetExecution(ctx, &admin.WorkflowExecutionGetRequest{
Id: &core.WorkflowExecutionIdentifier{
Project: project,
Domain: domain,
Name: name,
},
}, _callOptions...)
return err
}
err := auth.Do(ctx, cmdCtx.AuthClient(), grpcAPICall, callOptions)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 86bb1c7

Please sign in to comment.