Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Support Content MD5 hash (#126)
Browse files Browse the repository at this point in the history
* Support Content MD5 hash

Signed-off-by: Haytham Abuelfutuh <[email protected]>

* Update to released stow version

Signed-off-by: Haytham Abuelfutuh <[email protected]>

* Update to released stow version

Signed-off-by: Haytham Abuelfutuh <[email protected]>
  • Loading branch information
EngHabu committed Apr 8, 2022
1 parent 90d35d4 commit d0a5767
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607
github.com/fatih/color v1.10.0
github.com/fatih/structtag v1.2.0
github.com/flyteorg/stow v0.3.1
github.com/flyteorg/stow v0.3.3
github.com/fsnotify/fsnotify v1.4.9
github.com/ghodss/yaml v1.0.0
github.com/go-test/deep v1.0.7
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/flyteorg/stow v0.3.1 h1:cBMbWl03Gsy5KoA5mutUYTuYpqtT7Pb8+ANGCLnmFEs=
github.com/flyteorg/stow v0.3.1/go.mod h1:HBld7ud0i4khMHwJjkO8v+NSP7ddKa/ruhf4I8fliaA=
github.com/flyteorg/stow v0.3.3 h1:tzeNl8mSZFL3oJDi0ACZj6FAineQAF4qyEp6bXtIdQY=
github.com/flyteorg/stow v0.3.3/go.mod h1:HBld7ud0i4khMHwJjkO8v+NSP7ddKa/ruhf4I8fliaA=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
Expand Down
7 changes: 6 additions & 1 deletion storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ type DataStore struct {
ReferenceConstructor
}

// SignedURLProperties encapsulates properties about the signedURL operation.
type SignedURLProperties struct {
Scope stow.ClientMethod
// Scope defines the permission level allowed for the generated URL.
Scope stow.ClientMethod
// ExpiresIn defines the expiration duration for the URL. It's strongly recommended setting it.
ExpiresIn time.Duration
// ContentMD5 defines the expected hash of the generated file. It's strongly recommended setting it.
ContentMD5 string
}

type SignedURLResponse struct {
Expand Down
3 changes: 2 additions & 1 deletion storage/stow_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ func (s *StowStore) CreateSignedURL(ctx context.Context, reference DataReference
}

urlStr, err := c.PreSignRequest(ctx, properties.Scope, key, stow.PresignRequestParams{
ExpiresIn: properties.ExpiresIn,
ExpiresIn: properties.ExpiresIn,
ContentMD5: properties.ContentMD5,
})

if err != nil {
Expand Down

0 comments on commit d0a5767

Please sign in to comment.