fix: add involves edge from task to agent:nomos at creation
Plus sync vendor directory for Docker build compatibility.
This commit is contained in:
75
vendor/github.com/infisical/go-sdk/packages/errors/api.go
generated
vendored
Normal file
75
vendor/github.com/infisical/go-sdk/packages/errors/api.go
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
package errors
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-resty/resty/v2"
|
||||
"github.com/infisical/go-sdk/packages/util"
|
||||
)
|
||||
|
||||
// APIError represents an error response from the API
|
||||
type APIError struct {
|
||||
Operation string `json:"operation"`
|
||||
Method string `json:"method"`
|
||||
URL string `json:"url"`
|
||||
StatusCode int `json:"statusCode"`
|
||||
ErrorMessage string `json:"message,omitempty"`
|
||||
ReqId string `json:"reqId,omitempty"`
|
||||
}
|
||||
|
||||
func (e *APIError) Error() string {
|
||||
msg := fmt.Sprintf(
|
||||
"APIError: %s unsuccessful response [%v %v] [status-code=%v] [reqId=%v]",
|
||||
e.Operation,
|
||||
e.Method,
|
||||
e.URL,
|
||||
e.StatusCode,
|
||||
e.ReqId,
|
||||
)
|
||||
|
||||
if e.ErrorMessage != "" {
|
||||
return fmt.Sprintf("%s [message=\"%s\"]", msg, e.ErrorMessage)
|
||||
|
||||
}
|
||||
|
||||
return msg
|
||||
}
|
||||
|
||||
func NewAPIError(operation string, res *resty.Response) error {
|
||||
return &APIError{
|
||||
Operation: operation,
|
||||
Method: res.Request.Method,
|
||||
URL: res.Request.URL,
|
||||
StatusCode: res.StatusCode(),
|
||||
}
|
||||
}
|
||||
|
||||
func NewAPIErrorWithResponse(operation string, res *resty.Response) error {
|
||||
errorMessage := util.TryParseErrorBody(res)
|
||||
reqId := util.TryExtractReqId(res)
|
||||
|
||||
return &APIError{
|
||||
Operation: operation,
|
||||
Method: res.Request.Method,
|
||||
URL: res.Request.URL,
|
||||
StatusCode: res.StatusCode(),
|
||||
ErrorMessage: errorMessage,
|
||||
ReqId: reqId,
|
||||
}
|
||||
}
|
||||
|
||||
// NotModifiedError is returned when the server responds with 304 Not Modified,
|
||||
// indicating the resource has not changed since the last request (based on ETag).
|
||||
type NotModifiedError struct {
|
||||
Operation string
|
||||
}
|
||||
|
||||
func (e *NotModifiedError) Error() string {
|
||||
return fmt.Sprintf("%s: secrets not modified (HTTP 304)", e.Operation)
|
||||
}
|
||||
|
||||
func NewNotModifiedError(operation string) error {
|
||||
return &NotModifiedError{
|
||||
Operation: operation,
|
||||
}
|
||||
}
|
||||
22
vendor/github.com/infisical/go-sdk/packages/errors/request.go
generated
vendored
Normal file
22
vendor/github.com/infisical/go-sdk/packages/errors/request.go
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
package errors
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// RequestError represents an error that occurred during an API request
|
||||
type RequestError struct {
|
||||
Operation string `json:"operation"`
|
||||
error error `json:"-"`
|
||||
}
|
||||
|
||||
func (e *RequestError) Error() string {
|
||||
return fmt.Sprintf("%s: unable to complete api request [err=%s]", e.Operation, e.error)
|
||||
}
|
||||
|
||||
func NewRequestError(operation string, err error) error {
|
||||
return &RequestError{
|
||||
Operation: operation,
|
||||
error: err,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user