Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flaps/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ const (
metadataSet
metadataGet
metadataDel
getS3LogsToken
)
20 changes: 20 additions & 0 deletions flaps/flaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"regexp"
"slices"
"strings"
"time"

"github.com/cenkalti/backoff/v4"
fly "github.com/superfly/fly-go"
Expand Down Expand Up @@ -323,3 +324,22 @@ func handleAPIError(statusCode int, responseBody []byte) error {
return errors.New("something went terribly wrong")
}
}

type S3LogsTokenResponse struct {
Version int
AccessKeyID string `json:"AccessKeyId"`
SecretAccessKey string
SessionToken string
Expiration *time.Time
AccountID string `json:"AccountId"`
}

func (f *Client) GetS3LogsToken(ctx context.Context, orgSlug string) (S3LogsTokenResponse, error) {
ctx = contextWithAction(ctx, getS3LogsToken)
var token S3LogsTokenResponse
err := f._sendRequest(ctx, http.MethodPost, fmt.Sprintf("/orgs/%s/tokens/s3_logs", orgSlug), nil, &token, nil)
if err != nil {
return token, fmt.Errorf("failed to get S3 Logs token: %w", err)
}
return token, nil
}
Loading