Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(queue): add GetInfo func #257

Merged
merged 21 commits into from
Sep 25, 2023
16 changes: 16 additions & 0 deletions vela/admin.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Target Brands, Inc. All rights reserved.

Check failure on line 1 in vela/admin.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] vela/admin.go#L1

: # github.com/go-vela/sdk-go/vela [github.com/go-vela/sdk-go/vela.test]
Raw output
vela/admin.go:1: : # github.com/go-vela/sdk-go/vela [github.com/go-vela/sdk-go/vela.test]
//
// Use of this source code is governed by the LICENSE file in this repository.

Expand All @@ -7,6 +7,7 @@
import (
"errors"
"fmt"
"github.com/sirupsen/logrus"
"strings"

"github.com/go-vela/types"
Expand Down Expand Up @@ -254,3 +255,18 @@

return t, resp, err
}

// GetQueueCreds fetches queue credentials based valid registration token.
func (svc *AdminWorkerService) GetQueueCreds() (*library.QueueRegistration, *Response, error) {

Check failure on line 260 in vela/admin.go

View workflow job for this annotation

GitHub Actions / diff-review

undefined: library.QueueRegistration

Check failure on line 260 in vela/admin.go

View workflow job for this annotation

GitHub Actions / diff-review

undefined: library.QueueRegistration

Check failure on line 260 in vela/admin.go

View workflow job for this annotation

GitHub Actions / full-review

undefined: library.QueueRegistration

Check failure on line 260 in vela/admin.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] vela/admin.go#L260

undefined: library.QueueRegistration
Raw output
vela/admin.go:260:58: undefined: library.QueueRegistration
timhuynh94 marked this conversation as resolved.
Show resolved Hide resolved
timhuynh94 marked this conversation as resolved.
Show resolved Hide resolved

// set the API endpoint path we send the request to
url := "/api/v1/queue-registration"

// library Token type we want to return
t := new(library.QueueRegistration)

Check failure on line 266 in vela/admin.go

View workflow job for this annotation

GitHub Actions / diff-review

undefined: library.QueueRegistration (typecheck)

Check failure on line 266 in vela/admin.go

View workflow job for this annotation

GitHub Actions / diff-review

undefined: library.QueueRegistration (typecheck)

Check failure on line 266 in vela/admin.go

View workflow job for this annotation

GitHub Actions / full-review

undefined: library.QueueRegistration (typecheck)

Check failure on line 266 in vela/admin.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] vela/admin.go#L266

undefined: library.QueueRegistration (typecheck)
Raw output
vela/admin.go:266:19: undefined: library.QueueRegistration (typecheck)
// Copyright (c) 2023 Target Brands, Inc. All rights reserved.
timhuynh94 marked this conversation as resolved.
Show resolved Hide resolved
timhuynh94 marked this conversation as resolved.
Show resolved Hide resolved

// send request using client
resp, err := svc.client.Call("POST", url, nil, t)
logrus.Infof(" Queue cred %v: ", t)
return t, resp, err
}
Loading