*: fix rest methods
* use POST instead of PUT for resource creation * use PUT instead of POST for resource special actions
This commit is contained in:
parent
595590e611
commit
f3781c9087
|
@ -133,7 +133,7 @@ func (c *Client) CreateProjectGroup(ctx context.Context, projectGroup *types.Pro
|
|||
}
|
||||
|
||||
projectGroup = new(types.ProjectGroup)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", "/projectgroups", nil, jsonContent, bytes.NewReader(pj), projectGroup)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", "/projectgroups", nil, jsonContent, bytes.NewReader(pj), projectGroup)
|
||||
return projectGroup, resp, err
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ func (c *Client) CreateProject(ctx context.Context, project *types.Project) (*ty
|
|||
}
|
||||
|
||||
project = new(types.Project)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", "/projects", nil, jsonContent, bytes.NewReader(pj), project)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", "/projects", nil, jsonContent, bytes.NewReader(pj), project)
|
||||
return project, resp, err
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ func (c *Client) CreateProjectGroupSecret(ctx context.Context, projectGroupRef s
|
|||
}
|
||||
|
||||
secret = new(types.Secret)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", fmt.Sprintf("/projectgroups/%s/secrets", url.PathEscape(projectGroupRef)), nil, jsonContent, bytes.NewReader(pj), secret)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", fmt.Sprintf("/projectgroups/%s/secrets", url.PathEscape(projectGroupRef)), nil, jsonContent, bytes.NewReader(pj), secret)
|
||||
return secret, resp, err
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ func (c *Client) CreateProjectSecret(ctx context.Context, projectRef string, sec
|
|||
}
|
||||
|
||||
secret = new(types.Secret)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", fmt.Sprintf("/projects/%s/secrets", url.PathEscape(projectRef)), nil, jsonContent, bytes.NewReader(pj), secret)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", fmt.Sprintf("/projects/%s/secrets", url.PathEscape(projectRef)), nil, jsonContent, bytes.NewReader(pj), secret)
|
||||
return secret, resp, err
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ func (c *Client) CreateProjectGroupVariable(ctx context.Context, projectGroupRef
|
|||
}
|
||||
|
||||
variable = new(types.Variable)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", fmt.Sprintf("/projectgroups/%s/variables", url.PathEscape(projectGroupRef)), nil, jsonContent, bytes.NewReader(pj), variable)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", fmt.Sprintf("/projectgroups/%s/variables", url.PathEscape(projectGroupRef)), nil, jsonContent, bytes.NewReader(pj), variable)
|
||||
return variable, resp, err
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ func (c *Client) CreateProjectVariable(ctx context.Context, projectRef string, v
|
|||
}
|
||||
|
||||
variable = new(types.Variable)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", fmt.Sprintf("/projects/%s/variables", url.PathEscape(projectRef)), nil, jsonContent, bytes.NewReader(pj), variable)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", fmt.Sprintf("/projects/%s/variables", url.PathEscape(projectRef)), nil, jsonContent, bytes.NewReader(pj), variable)
|
||||
return variable, resp, err
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ func (c *Client) CreateUser(ctx context.Context, req *CreateUserRequest) (*types
|
|||
}
|
||||
|
||||
user := new(types.User)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", "/users", nil, jsonContent, bytes.NewReader(reqj), user)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", "/users", nil, jsonContent, bytes.NewReader(reqj), user)
|
||||
return user, resp, err
|
||||
}
|
||||
|
||||
|
@ -353,7 +353,7 @@ func (c *Client) CreateUserLA(ctx context.Context, userName string, req *CreateU
|
|||
}
|
||||
|
||||
la := new(types.LinkedAccount)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", fmt.Sprintf("/users/%s/linkedaccounts", userName), nil, jsonContent, bytes.NewReader(reqj), la)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", fmt.Sprintf("/users/%s/linkedaccounts", userName), nil, jsonContent, bytes.NewReader(reqj), la)
|
||||
return la, resp, err
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ func (c *Client) CreateUserToken(ctx context.Context, userName string, req *Crea
|
|||
}
|
||||
|
||||
tresp := new(CreateUserTokenResponse)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", fmt.Sprintf("/users/%s/tokens", userName), nil, jsonContent, bytes.NewReader(reqj), tresp)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", fmt.Sprintf("/users/%s/tokens", userName), nil, jsonContent, bytes.NewReader(reqj), tresp)
|
||||
return tresp, resp, err
|
||||
}
|
||||
|
||||
|
@ -423,7 +423,7 @@ func (c *Client) CreateRemoteSource(ctx context.Context, rs *types.RemoteSource)
|
|||
}
|
||||
|
||||
rs = new(types.RemoteSource)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", "/remotesources", nil, jsonContent, bytes.NewReader(uj), rs)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", "/remotesources", nil, jsonContent, bytes.NewReader(uj), rs)
|
||||
return rs, resp, err
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ func (c *Client) CreateOrg(ctx context.Context, org *types.Organization) (*types
|
|||
}
|
||||
|
||||
org = new(types.Organization)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", "/orgs", nil, jsonContent, bytes.NewReader(oj), org)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", "/orgs", nil, jsonContent, bytes.NewReader(oj), org)
|
||||
return org, resp, err
|
||||
}
|
||||
|
||||
|
|
|
@ -164,47 +164,47 @@ func (s *ConfigStore) Run(ctx context.Context) error {
|
|||
apirouter.Handle("/projectgroups/{projectgroupref}", projectGroupHandler).Methods("GET")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/subgroups", projectGroupSubgroupsHandler).Methods("GET")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/projects", projectGroupProjectsHandler).Methods("GET")
|
||||
apirouter.Handle("/projectgroups", createProjectGroupHandler).Methods("PUT")
|
||||
apirouter.Handle("/projectgroups", createProjectGroupHandler).Methods("POST")
|
||||
|
||||
apirouter.Handle("/projects/{projectref}", projectHandler).Methods("GET")
|
||||
apirouter.Handle("/projects", createProjectHandler).Methods("PUT")
|
||||
apirouter.Handle("/projects", createProjectHandler).Methods("POST")
|
||||
apirouter.Handle("/projects/{projectref}", deleteProjectHandler).Methods("DELETE")
|
||||
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/secrets", secretsHandler).Methods("GET")
|
||||
apirouter.Handle("/projects/{projectref}/secrets", secretsHandler).Methods("GET")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/secrets", createSecretHandler).Methods("PUT")
|
||||
apirouter.Handle("/projects/{projectref}/secrets", createSecretHandler).Methods("PUT")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/secrets", createSecretHandler).Methods("POST")
|
||||
apirouter.Handle("/projects/{projectref}/secrets", createSecretHandler).Methods("POST")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/secrets/{secretname}", deleteSecretHandler).Methods("DELETE")
|
||||
apirouter.Handle("/projects/{projectref}/secrets/{secretname}", deleteSecretHandler).Methods("DELETE")
|
||||
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/variables", variablesHandler).Methods("GET")
|
||||
apirouter.Handle("/projects/{projectref}/variables", variablesHandler).Methods("GET")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/variables", createVariableHandler).Methods("PUT")
|
||||
apirouter.Handle("/projects/{projectref}/variables", createVariableHandler).Methods("PUT")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/variables", createVariableHandler).Methods("POST")
|
||||
apirouter.Handle("/projects/{projectref}/variables", createVariableHandler).Methods("POST")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/variables/{variablename}", deleteVariableHandler).Methods("DELETE")
|
||||
apirouter.Handle("/projects/{projectref}/variables/{variablename}", deleteVariableHandler).Methods("DELETE")
|
||||
|
||||
apirouter.Handle("/user/{userid}", userHandler).Methods("GET")
|
||||
apirouter.Handle("/users", usersHandler).Methods("GET")
|
||||
apirouter.Handle("/users", createUserHandler).Methods("PUT")
|
||||
apirouter.Handle("/users", createUserHandler).Methods("POST")
|
||||
apirouter.Handle("/users/{username}", userByNameHandler).Methods("GET")
|
||||
apirouter.Handle("/users/{username}", deleteUserHandler).Methods("DELETE")
|
||||
|
||||
apirouter.Handle("/users/{username}/linkedaccounts", createUserLAHandler).Methods("PUT")
|
||||
apirouter.Handle("/users/{username}/linkedaccounts", createUserLAHandler).Methods("POST")
|
||||
apirouter.Handle("/users/{username}/linkedaccounts/{laid}", deleteUserLAHandler).Methods("DELETE")
|
||||
apirouter.Handle("/users/{username}/linkedaccounts/{laid}", updateUserLAHandler).Methods("PUT")
|
||||
apirouter.Handle("/users/{username}/tokens", createUserTokenHandler).Methods("PUT")
|
||||
apirouter.Handle("/users/{username}/tokens", createUserTokenHandler).Methods("POST")
|
||||
apirouter.Handle("/users/{username}/tokens/{tokenname}", deleteUserTokenHandler).Methods("DELETE")
|
||||
|
||||
apirouter.Handle("/org/{orgid}", orgHandler).Methods("GET")
|
||||
apirouter.Handle("/orgs", orgsHandler).Methods("GET")
|
||||
apirouter.Handle("/orgs", createOrgHandler).Methods("PUT")
|
||||
apirouter.Handle("/orgs", createOrgHandler).Methods("POST")
|
||||
apirouter.Handle("/orgs/{orgname}", orgByNameHandler).Methods("GET")
|
||||
apirouter.Handle("/orgs/{orgname}", deleteOrgHandler).Methods("DELETE")
|
||||
|
||||
apirouter.Handle("/remotesource/{id}", remoteSourceHandler).Methods("GET")
|
||||
apirouter.Handle("/remotesources", remoteSourcesHandler).Methods("GET")
|
||||
apirouter.Handle("/remotesources", createRemoteSourceHandler).Methods("PUT")
|
||||
apirouter.Handle("/remotesources", createRemoteSourceHandler).Methods("POST")
|
||||
apirouter.Handle("/remotesources/{name}", remoteSourceByNameHandler).Methods("GET")
|
||||
apirouter.Handle("/remotesources/{name}", deleteRemoteSourceHandler).Methods("DELETE")
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ func (c *Client) CreateProjectGroup(ctx context.Context, req *CreateProjectGroup
|
|||
}
|
||||
|
||||
project := new(ProjectResponse)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", "/projectgroups", nil, jsonContent, bytes.NewReader(reqj), project)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", "/projectgroups", nil, jsonContent, bytes.NewReader(reqj), project)
|
||||
return project, resp, err
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ func (c *Client) CreateProject(ctx context.Context, req *CreateProjectRequest) (
|
|||
}
|
||||
|
||||
project := new(ProjectResponse)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", "/projects", nil, jsonContent, bytes.NewReader(reqj), project)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", "/projects", nil, jsonContent, bytes.NewReader(reqj), project)
|
||||
return project, resp, err
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ func (c *Client) CreateProjectGroupSecret(ctx context.Context, projectGroupRef s
|
|||
}
|
||||
|
||||
secret := new(SecretResponse)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", path.Join("/projectgroups", url.PathEscape(projectGroupRef), "secrets"), nil, jsonContent, bytes.NewReader(reqj), secret)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", path.Join("/projectgroups", url.PathEscape(projectGroupRef), "secrets"), nil, jsonContent, bytes.NewReader(reqj), secret)
|
||||
return secret, resp, err
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ func (c *Client) CreateProjectSecret(ctx context.Context, projectRef string, req
|
|||
}
|
||||
|
||||
secret := new(SecretResponse)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", path.Join("/projects", url.PathEscape(projectRef), "secrets"), nil, jsonContent, bytes.NewReader(reqj), secret)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", path.Join("/projects", url.PathEscape(projectRef), "secrets"), nil, jsonContent, bytes.NewReader(reqj), secret)
|
||||
return secret, resp, err
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ func (c *Client) CreateProjectGroupVariable(ctx context.Context, projectGroupRef
|
|||
}
|
||||
|
||||
variable := new(VariableResponse)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", path.Join("/projectgroups", url.PathEscape(projectGroupRef), "variables"), nil, jsonContent, bytes.NewReader(reqj), variable)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", path.Join("/projectgroups", url.PathEscape(projectGroupRef), "variables"), nil, jsonContent, bytes.NewReader(reqj), variable)
|
||||
return variable, resp, err
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ func (c *Client) CreateProjectVariable(ctx context.Context, projectRef string, r
|
|||
}
|
||||
|
||||
variable := new(VariableResponse)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", path.Join("/projects", url.PathEscape(projectRef), "variables"), nil, jsonContent, bytes.NewReader(reqj), variable)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", path.Join("/projects", url.PathEscape(projectRef), "variables"), nil, jsonContent, bytes.NewReader(reqj), variable)
|
||||
return variable, resp, err
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ func (c *Client) DeleteProject(ctx context.Context, projectRef string) (*http.Re
|
|||
}
|
||||
|
||||
func (c *Client) ReconfigProject(ctx context.Context, projectRef string) (*http.Response, error) {
|
||||
return c.getResponse(ctx, "POST", fmt.Sprintf("/projects/%s/reconfig", url.PathEscape(projectRef)), nil, jsonContent, nil)
|
||||
return c.getResponse(ctx, "PUT", fmt.Sprintf("/projects/%s/reconfig", url.PathEscape(projectRef)), nil, jsonContent, nil)
|
||||
}
|
||||
|
||||
func (c *Client) GetCurrentUser(ctx context.Context) (*UserResponse, *http.Response, error) {
|
||||
|
@ -261,7 +261,7 @@ func (c *Client) CreateUser(ctx context.Context, req *CreateUserRequest) (*UserR
|
|||
}
|
||||
|
||||
user := new(UserResponse)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", "/users", nil, jsonContent, bytes.NewReader(reqj), user)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", "/users", nil, jsonContent, bytes.NewReader(reqj), user)
|
||||
return user, resp, err
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ func (c *Client) CreateUserLA(ctx context.Context, userName string, req *CreateU
|
|||
}
|
||||
|
||||
la := new(CreateUserLAResponse)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", fmt.Sprintf("/users/%s/linkedaccounts", userName), nil, jsonContent, bytes.NewReader(reqj), la)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", fmt.Sprintf("/users/%s/linkedaccounts", userName), nil, jsonContent, bytes.NewReader(reqj), la)
|
||||
return la, resp, err
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ func (c *Client) RegisterUser(ctx context.Context, req *RegisterUserRequest) (*R
|
|||
}
|
||||
|
||||
res := new(RegisterUserResponse)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", "/register", nil, jsonContent, bytes.NewReader(reqj), res)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", "/register", nil, jsonContent, bytes.NewReader(reqj), res)
|
||||
return res, resp, err
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@ func (c *Client) CreateUserToken(ctx context.Context, userName string, req *Crea
|
|||
}
|
||||
|
||||
tresp := new(CreateUserTokenResponse)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", fmt.Sprintf("/users/%s/tokens", userName), nil, jsonContent, bytes.NewReader(reqj), tresp)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", fmt.Sprintf("/users/%s/tokens", userName), nil, jsonContent, bytes.NewReader(reqj), tresp)
|
||||
return tresp, resp, err
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ func (c *Client) CreateRemoteSource(ctx context.Context, req *CreateRemoteSource
|
|||
}
|
||||
|
||||
rs := new(RemoteSourceResponse)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", "/remotesources", nil, jsonContent, bytes.NewReader(uj), rs)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", "/remotesources", nil, jsonContent, bytes.NewReader(uj), rs)
|
||||
return rs, resp, err
|
||||
}
|
||||
|
||||
|
@ -387,7 +387,7 @@ func (c *Client) CreateOrg(ctx context.Context, req *CreateOrgRequest) (*OrgResp
|
|||
}
|
||||
|
||||
org := new(OrgResponse)
|
||||
resp, err := c.getParsedResponse(ctx, "PUT", "/orgs", nil, jsonContent, bytes.NewReader(reqj), org)
|
||||
resp, err := c.getParsedResponse(ctx, "POST", "/orgs", nil, jsonContent, bytes.NewReader(reqj), org)
|
||||
return org, resp, err
|
||||
}
|
||||
|
||||
|
|
|
@ -216,52 +216,52 @@ func (g *Gateway) Run(ctx context.Context) error {
|
|||
apirouter.Handle("/projectgroups/{projectgroupid}", authForcedHandler(projectGroupHandler)).Methods("GET")
|
||||
apirouter.Handle("/projectgroups/{projectgroupid}/subgroups", authForcedHandler(projectGroupSubgroupsHandler)).Methods("GET")
|
||||
apirouter.Handle("/projectgroups/{projectgroupid}/projects", authForcedHandler(projectGroupProjectsHandler)).Methods("GET")
|
||||
apirouter.Handle("/projectgroups", authForcedHandler(createProjectGroupHandler)).Methods("PUT")
|
||||
apirouter.Handle("/projectgroups", authForcedHandler(createProjectGroupHandler)).Methods("POST")
|
||||
//apirouter.Handle("/projectgroups/{projectgroupid}", authForcedHandler(deleteProjectGroupHandler)).Methods("DELETE")
|
||||
|
||||
apirouter.Handle("/projects/{projectid}", authForcedHandler(projectHandler)).Methods("GET")
|
||||
apirouter.Handle("/projects", authForcedHandler(createProjectHandler)).Methods("PUT")
|
||||
apirouter.Handle("/projects", authForcedHandler(createProjectHandler)).Methods("POST")
|
||||
apirouter.Handle("/projects/{projectid}", authForcedHandler(deleteProjectHandler)).Methods("DELETE")
|
||||
apirouter.Handle("/projects/{projectid}/reconfig", authForcedHandler(projectReconfigHandler)).Methods("POST")
|
||||
apirouter.Handle("/projects/{projectid}/reconfig", authForcedHandler(projectReconfigHandler)).Methods("PUT")
|
||||
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/secrets", authForcedHandler(secretHandler)).Methods("GET")
|
||||
apirouter.Handle("/projects/{projectref}/secrets", authForcedHandler(secretHandler)).Methods("GET")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/secrets", authForcedHandler(createSecretHandler)).Methods("PUT")
|
||||
apirouter.Handle("/projects/{projectref}/secrets", authForcedHandler(createSecretHandler)).Methods("PUT")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/secrets", authForcedHandler(createSecretHandler)).Methods("POST")
|
||||
apirouter.Handle("/projects/{projectref}/secrets", authForcedHandler(createSecretHandler)).Methods("POST")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/secrets/{secretname}", authForcedHandler(deleteSecretHandler)).Methods("DELETE")
|
||||
apirouter.Handle("/projects/{projectref}/secrets/{secretname}", authForcedHandler(deleteSecretHandler)).Methods("DELETE")
|
||||
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/variables", authForcedHandler(variableHandler)).Methods("GET")
|
||||
apirouter.Handle("/projects/{projectref}/variables", authForcedHandler(variableHandler)).Methods("GET")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/variables", authForcedHandler(createVariableHandler)).Methods("PUT")
|
||||
apirouter.Handle("/projects/{projectref}/variables", authForcedHandler(createVariableHandler)).Methods("PUT")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/variables", authForcedHandler(createVariableHandler)).Methods("POST")
|
||||
apirouter.Handle("/projects/{projectref}/variables", authForcedHandler(createVariableHandler)).Methods("POST")
|
||||
apirouter.Handle("/projectgroups/{projectgroupref}/variables/{variablename}", authForcedHandler(deleteVariableHandler)).Methods("DELETE")
|
||||
apirouter.Handle("/projects/{projectref}/variables/{variablename}", authForcedHandler(deleteVariableHandler)).Methods("DELETE")
|
||||
|
||||
apirouter.Handle("/user", authForcedHandler(currentUserHandler)).Methods("GET")
|
||||
apirouter.Handle("/user/{userid}", authForcedHandler(userHandler)).Methods("GET")
|
||||
apirouter.Handle("/users", authForcedHandler(usersHandler)).Methods("GET")
|
||||
apirouter.Handle("/users", authForcedHandler(createUserHandler)).Methods("PUT")
|
||||
apirouter.Handle("/users", authForcedHandler(createUserHandler)).Methods("POST")
|
||||
apirouter.Handle("/users/{username}", authForcedHandler(userByNameHandler)).Methods("GET")
|
||||
apirouter.Handle("/users/{username}", authForcedHandler(deleteUserHandler)).Methods("DELETE")
|
||||
|
||||
apirouter.Handle("/users/{username}/linkedaccounts", authForcedHandler(createUserLAHandler)).Methods("PUT")
|
||||
apirouter.Handle("/users/{username}/linkedaccounts", authForcedHandler(createUserLAHandler)).Methods("POST")
|
||||
apirouter.Handle("/users/{username}/linkedaccounts/{laid}", authForcedHandler(deleteUserLAHandler)).Methods("DELETE")
|
||||
apirouter.Handle("/users/{username}/tokens", authForcedHandler(createUserTokenHandler)).Methods("PUT")
|
||||
apirouter.Handle("/users/{username}/tokens", authForcedHandler(createUserTokenHandler)).Methods("POST")
|
||||
apirouter.Handle("/users/{username}/tokens/{tokenname}", authForcedHandler(deleteUserTokenHandler)).Methods("DELETE")
|
||||
|
||||
apirouter.Handle("/remotesource/{id}", authForcedHandler(remoteSourceHandler)).Methods("GET")
|
||||
apirouter.Handle("/remotesources", authForcedHandler(createRemoteSourceHandler)).Methods("PUT")
|
||||
apirouter.Handle("/remotesources", authForcedHandler(createRemoteSourceHandler)).Methods("POST")
|
||||
apirouter.Handle("/remotesources", authOptionalHandler(remoteSourcesHandler)).Methods("GET")
|
||||
|
||||
apirouter.Handle("/org/{orgid}", authForcedHandler(orgHandler)).Methods("GET")
|
||||
apirouter.Handle("/orgs", authForcedHandler(orgsHandler)).Methods("GET")
|
||||
apirouter.Handle("/orgs", authForcedHandler(createOrgHandler)).Methods("PUT")
|
||||
apirouter.Handle("/orgs", authForcedHandler(createOrgHandler)).Methods("POST")
|
||||
apirouter.Handle("/orgs/{orgname}", authForcedHandler(orgByNameHandler)).Methods("GET")
|
||||
apirouter.Handle("/orgs/{orgname}", authForcedHandler(deleteOrgHandler)).Methods("DELETE")
|
||||
|
||||
apirouter.Handle("/run/{runid}", authForcedHandler(runHandler)).Methods("GET")
|
||||
apirouter.Handle("/run/{runid}/actions", authForcedHandler(runActionsHandler)).Methods("POST")
|
||||
apirouter.Handle("/run/{runid}/actions", authForcedHandler(runActionsHandler)).Methods("PUT")
|
||||
apirouter.Handle("/run/{runid}/task/{taskid}", authForcedHandler(runtaskHandler)).Methods("GET")
|
||||
apirouter.Handle("/runs", authForcedHandler(runsHandler)).Methods("GET")
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ func (c *Client) CreateRun(ctx context.Context, req *RunCreateRequest) (*http.Re
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return c.getResponse(ctx, "PUT", "/runs", nil, jsonContent, bytes.NewReader(reqj))
|
||||
return c.getResponse(ctx, "POST", "/runs", nil, jsonContent, bytes.NewReader(reqj))
|
||||
}
|
||||
|
||||
func (c *Client) RunActions(ctx context.Context, runID string, req *RunActionsRequest) (*http.Response, error) {
|
||||
|
@ -202,7 +202,7 @@ func (c *Client) RunActions(ctx context.Context, runID string, req *RunActionsRe
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.getResponse(ctx, "POST", fmt.Sprintf("/runs/%s/actions", runID), nil, jsonContent, bytes.NewReader(reqj))
|
||||
return c.getResponse(ctx, "PUT", fmt.Sprintf("/runs/%s/actions", runID), nil, jsonContent, bytes.NewReader(reqj))
|
||||
}
|
||||
|
||||
func (c *Client) StartRun(ctx context.Context, runID string, changeGroupsUpdateToken string) (*http.Response, error) {
|
||||
|
@ -220,7 +220,7 @@ func (c *Client) RunTaskActions(ctx context.Context, runID, taskID string, req *
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.getResponse(ctx, "POST", fmt.Sprintf("/runs/%s/tasks/%s/actions", runID, taskID), nil, jsonContent, bytes.NewReader(reqj))
|
||||
return c.getResponse(ctx, "PUT", fmt.Sprintf("/runs/%s/tasks/%s/actions", runID, taskID), nil, jsonContent, bytes.NewReader(reqj))
|
||||
}
|
||||
|
||||
func (c *Client) ApproveRunTask(ctx context.Context, runID, taskID string, approvalAnnotations map[string]string, changeGroupsUpdateToken string) (*http.Response, error) {
|
||||
|
|
|
@ -1414,10 +1414,10 @@ func (s *Scheduler) Run(ctx context.Context) error {
|
|||
apirouter.Handle("/logs", logsHandler).Methods("GET")
|
||||
|
||||
apirouter.Handle("/runs/{runid}", runHandler).Methods("GET")
|
||||
apirouter.Handle("/runs/{runid}/actions", runActionsHandler).Methods("POST")
|
||||
apirouter.Handle("/runs/{runid}/tasks/{taskid}/actions", runTaskActionsHandler).Methods("POST")
|
||||
apirouter.Handle("/runs/{runid}/actions", runActionsHandler).Methods("PUT")
|
||||
apirouter.Handle("/runs/{runid}/tasks/{taskid}/actions", runTaskActionsHandler).Methods("PUT")
|
||||
apirouter.Handle("/runs", runsHandler).Methods("GET")
|
||||
apirouter.Handle("/runs", runCreateHandler).Methods("PUT")
|
||||
apirouter.Handle("/runs", runCreateHandler).Methods("POST")
|
||||
|
||||
apirouter.Handle("/changegroups", changeGroupsUpdateTokensHandler).Methods("GET")
|
||||
|
||||
|
|
Loading…
Reference in New Issue