-
Notifications
You must be signed in to change notification settings - Fork 179
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 #575 from convox/release-20160425
Release 20160425
- Loading branch information
Showing
132 changed files
with
12,488 additions
and
1,740 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,61 @@ | ||
package controllers | ||
|
||
import ( | ||
"net/http" | ||
"sort" | ||
"strings" | ||
|
||
"github.com/convox/rack/api/httperr" | ||
"github.com/convox/rack/api/provider" | ||
"github.com/gorilla/mux" | ||
) | ||
|
||
func CertificateCreate(rw http.ResponseWriter, r *http.Request) *httperr.Error { | ||
pub := r.FormValue("public") | ||
key := r.FormValue("private") | ||
chain := r.FormValue("chain") | ||
|
||
cert, err := provider.CertificateCreate(pub, key, chain) | ||
|
||
if err != nil { | ||
return httperr.Server(err) | ||
} | ||
|
||
return RenderJson(rw, cert) | ||
} | ||
|
||
func CertificateDelete(rw http.ResponseWriter, r *http.Request) *httperr.Error { | ||
id := mux.Vars(r)["id"] | ||
|
||
err := provider.CertificateDelete(id) | ||
|
||
if err != nil { | ||
return httperr.Server(err) | ||
} | ||
|
||
return RenderSuccess(rw) | ||
} | ||
|
||
func CertificateGenerate(rw http.ResponseWriter, r *http.Request) *httperr.Error { | ||
domains := strings.Split(r.FormValue("domains"), ",") | ||
|
||
cert, err := provider.CertificateGenerate(domains) | ||
|
||
if err != nil { | ||
return httperr.Server(err) | ||
} | ||
|
||
return RenderJson(rw, cert) | ||
} | ||
|
||
func CertificateList(rw http.ResponseWriter, r *http.Request) *httperr.Error { | ||
certs, err := provider.CertificateList() | ||
|
||
if err != nil { | ||
return httperr.Server(err) | ||
} | ||
|
||
sort.Sort(certs) | ||
|
||
return RenderJson(rw, certs) | ||
} |
Oops, something went wrong.