Skip to content

Commit 39bde2c

Browse files
authored
Merge pull request #102 from Scalr/fix/SCALRCORE-25897
SCALRCORE-25897: Remove ReadBySemanticVersion && make validString && …
2 parents a0d9790 + 4914e45 commit 39bde2c

File tree

2 files changed

+1
-31
lines changed

2 files changed

+1
-31
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.vscode/
22
.idea/
3+
covprofile

module_version.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ type ModuleVersions interface {
1616
List(ctx context.Context, options ModuleVersionListOptions) (*ModuleVersionList, error)
1717
// Read a module version by its ID.
1818
Read(ctx context.Context, moduleVersionID string) (*ModuleVersion, error)
19-
// ReadBySemanticVersion read module version by module and semantic version
20-
ReadBySemanticVersion(ctx context.Context, moduleId string, version string) (*ModuleVersion, error)
2119
}
2220

2321
// moduleVersions implements ModuleVersions.
@@ -105,32 +103,3 @@ func (s *moduleVersions) List(ctx context.Context, options ModuleVersionListOpti
105103

106104
return mv, nil
107105
}
108-
109-
func (s *moduleVersions) ReadBySemanticVersion(ctx context.Context, moduleID string, version string) (*ModuleVersion, error) {
110-
if !validStringID(&moduleID) {
111-
return nil, errors.New("invalid value for module id")
112-
}
113-
114-
v := &version
115-
if !validString(v) {
116-
return nil, errors.New("invalid value for version")
117-
}
118-
119-
req, err := s.client.newRequest("GET", "module-versions", &ModuleVersionListOptions{Module: moduleID, Version: v})
120-
if err != nil {
121-
return nil, err
122-
}
123-
124-
mvl := &ModuleVersionList{}
125-
err = s.client.do(ctx, req, mvl)
126-
if err != nil {
127-
return nil, err
128-
}
129-
if len(mvl.Items) != 1 {
130-
return nil, ResourceNotFoundError{
131-
Message: fmt.Sprintf("ModuleVersion with Module ID '%v' and version '%v' not found.", moduleID, version),
132-
}
133-
}
134-
135-
return mvl.Items[0], nil
136-
}

0 commit comments

Comments
 (0)