-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skeleton code for AWS EFS provider (#5940)
- Loading branch information
Hakan Memisoglu
authored and
Ilya Kislenko
committed
Jun 27, 2019
1 parent
272ef43
commit 92fa1f7
Showing
3 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package awsefs | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
|
||
"github.com/kanisterio/kanister/pkg/blockstorage" | ||
) | ||
|
||
type efs struct { | ||
} | ||
|
||
var _ blockstorage.Provider = (*efs)(nil) | ||
|
||
// NewEFSProvider retuns a blockstorage provider for AWS EFS. | ||
func NewEFSProvider() blockstorage.Provider { | ||
return &efs{} | ||
} | ||
|
||
func (e *efs) Type() blockstorage.Type { | ||
return blockstorage.TypeEFS | ||
} | ||
|
||
func (e *efs) VolumeCreate(context.Context, blockstorage.Volume) (*blockstorage.Volume, error) { | ||
return nil, errors.New("Not implemented") | ||
} | ||
|
||
func (e *efs) VolumeCreateFromSnapshot(ctx context.Context, snapshot blockstorage.Snapshot, tags map[string]string) (*blockstorage.Volume, error) { | ||
return nil, errors.New("Not implemented") | ||
} | ||
|
||
func (e *efs) VolumeDelete(context.Context, *blockstorage.Volume) error { | ||
return errors.New("Not implemented") | ||
} | ||
|
||
func (e *efs) VolumeGet(ctx context.Context, id string, zone string) (*blockstorage.Volume, error) { | ||
return nil, errors.New("Not implemented") | ||
} | ||
|
||
func (e *efs) SnapshotCopy(ctx context.Context, from blockstorage.Snapshot, to blockstorage.Snapshot) (*blockstorage.Snapshot, error) { | ||
return nil, errors.New("Not implemented") | ||
} | ||
|
||
func (e *efs) SnapshotCreate(ctx context.Context, volume blockstorage.Volume, tags map[string]string) (*blockstorage.Snapshot, error) { | ||
return nil, errors.New("Not implemented") | ||
} | ||
|
||
func (e *efs) SnapshotCreateWaitForCompletion(context.Context, *blockstorage.Snapshot) error { | ||
return errors.New("Not implemented") | ||
} | ||
|
||
func (e *efs) SnapshotDelete(context.Context, *blockstorage.Snapshot) error { | ||
return errors.New("Not implemented") | ||
} | ||
|
||
func (e *efs) SnapshotGet(ctx context.Context, id string) (*blockstorage.Snapshot, error) { | ||
return nil, errors.New("Not implemented") | ||
} | ||
|
||
func (e *efs) SetTags(ctx context.Context, resource interface{}, tags map[string]string) error { | ||
return errors.New("Not implemented") | ||
} | ||
|
||
func (e *efs) VolumesList(ctx context.Context, tags map[string]string, zone string) ([]*blockstorage.Volume, error) { | ||
return nil, errors.New("Not implemented") | ||
} | ||
|
||
func (e *efs) SnapshotsList(ctx context.Context, tags map[string]string) ([]*blockstorage.Snapshot, error) { | ||
return nil, errors.New("Not implemented") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package awsefs | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/kanisterio/kanister/pkg/blockstorage" | ||
. "gopkg.in/check.v1" | ||
) | ||
|
||
func Test(t *testing.T) { TestingT(t) } | ||
|
||
type AWSEFSTestSuite struct { | ||
provider blockstorage.Provider | ||
} | ||
|
||
func (s *AWSEFSTestSuite) SetUpSuite(c *C) { | ||
s.provider = NewEFSProvider() | ||
} | ||
func (s *AWSEFSTestSuite) TestVolumeCreateGetDelete(c *C) { | ||
c.Skip("Implementation is not ready") | ||
ctx := context.Background() | ||
az := "us-west-2a" | ||
tags := make(map[string]string) | ||
vol := blockstorage.Volume{ | ||
Az: az, | ||
Type: blockstorage.TypeEFS, | ||
Attributes: tags, | ||
} | ||
|
||
vol1, err := s.provider.VolumeCreate(ctx, vol) | ||
c.Assert(err, IsNil) | ||
c.Assert(vol1.ID, Equals, vol.ID) | ||
|
||
vol2, err := s.provider.VolumeGet(ctx, vol1.ID, vol1.Az) | ||
c.Assert(err, IsNil) | ||
c.Assert(vol2.ID, Equals, vol1.ID) | ||
|
||
vols1, err := s.provider.VolumesList(ctx, tags, vol2.Az) | ||
c.Assert(err, IsNil) | ||
c.Assert(vols1, HasLen, 1) | ||
|
||
err = s.provider.VolumeDelete(ctx, vol2) | ||
c.Assert(err, IsNil) | ||
|
||
// Deleting second time must not fail | ||
err = s.provider.VolumeDelete(ctx, vol2) | ||
c.Assert(err, IsNil) | ||
|
||
// Get for deleted volume must return error | ||
_, err = s.provider.VolumeGet(ctx, vol2.ID, vol2.Az) | ||
c.Assert(err, NotNil) | ||
|
||
vols2, err := s.provider.VolumesList(ctx, tags, vol2.Az) | ||
c.Assert(err, IsNil) | ||
c.Assert(vols2, HasLen, 0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters