Skip to content

Commit

Permalink
Rename function to indicate it's a stub
Browse files Browse the repository at this point in the history
  • Loading branch information
mtibben authored Sep 2, 2018
1 parent ef03b3c commit 3e646ab
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ func StartMetadataServer() error {
}

router := http.NewServeMux()
// The AWS .NET SDK checks this endpoint during obtaining credentials/refreshing them
router.HandleFunc("/latest/meta-data/iam/info/", infoHandler)
router.HandleFunc("/latest/meta-data/iam/security-credentials/", indexHandler)
router.HandleFunc("/latest/meta-data/iam/security-credentials/local-credentials", credentialsHandler)
// The AWS Go SDK checks the instance-id endpoint to validate the existence of EC2 Metadata
router.HandleFunc("/latest/meta-data/instance-id/", instanceIdHandler)
// The AWS .NET SDK checks this endpoint during obtaining credentials/refreshing them
router.HandleFunc("/latest/meta-data/iam/info/", infoHandlerStub)

l, err := net.Listen("tcp", metadataBind)
if err != nil {
Expand All @@ -49,9 +49,8 @@ type metadataHandler struct {
http.Handler
}

func infoHandler(w http.ResponseWriter, r *http.Request) {
var jsonStr = []byte(`{"Code" : "Success"}`)
fmt.Fprintf(w, string(jsonStr))
func infoHandlerStub(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, `{"Code" : "Success"}`)
}

func indexHandler(w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit 3e646ab

Please sign in to comment.