-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #244 from sdslabs/direct-deploy-final
Deploy local applications through gctl
- Loading branch information
Showing
11 changed files
with
171 additions
and
68 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 |
---|---|---|
|
@@ -17,4 +17,4 @@ site/ | |
coverage.txt | ||
releases/ | ||
gasper*.log | ||
vendor | ||
vendor/ |
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
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
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
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
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
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,49 @@ | ||
package controllers | ||
|
||
import ( | ||
"bytes" | ||
"encoding/json" | ||
"errors" | ||
_ "io/ioutil" | ||
|
||
"github.com/gin-gonic/gin" | ||
"github.com/sdslabs/gasper/lib/factory" | ||
"github.com/sdslabs/gasper/lib/utils" | ||
"github.com/sdslabs/gasper/services/master/middlewares" | ||
"github.com/sdslabs/gasper/types" | ||
) | ||
|
||
// Endpoint to create repository in GitHub | ||
func CreateRepository(c *gin.Context) { | ||
raw, err := c.GetRawData() | ||
if err != nil { | ||
c.AbortWithStatusJSON(400, gin.H{ | ||
"success": false, | ||
"error": err.Error(), | ||
}) | ||
} | ||
|
||
var data *types.RepositoryRequest = &types.RepositoryRequest{} | ||
claims := middlewares.ExtractClaims(c) | ||
if claims == nil { | ||
utils.SendServerErrorResponse(c, errors.New("failed to extract JWT claims")) | ||
return | ||
} | ||
err = json.Unmarshal(raw, data) | ||
if err != nil { | ||
c.AbortWithStatusJSON(400, gin.H{ | ||
"success": false, | ||
"error": err.Error(), | ||
}) | ||
} | ||
response, err := factory.CreateGithubRepository(claims.Username + data.Name) | ||
if err != nil { | ||
c.AbortWithStatusJSON(400, gin.H{ | ||
"success": false, | ||
"error": err.Error(), | ||
}) | ||
} | ||
responseBody := new(bytes.Buffer) | ||
json.NewEncoder(responseBody).Encode(response) | ||
c.Data(200, "application/json", responseBody.Bytes()) | ||
} |
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
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
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