Applying Host Catalog comments to Projects (#105)
* NewService for the project service now returns a non pointer and an error. * Replacing t.Fatal calls with require.NoError calls. * Initialize empty slices following the recommended way. * Don't inline the prefix strings when validating requests. * Check error when cleaning up the test. * Add check that update updates the time. * Use google.golang.org/protobuf where possible instead of github.com/golang/protobuf. * Shorten the validateX function names. * Inline API responses. * Change test cleanup error logging to t.Errorf. * Remove unneeded creation of an extra project. * Inline regex check for invalid id. * Build the pb.Project inline when converting from db to wire proto. * Change stored repos into repo creating functions. * Using iam.TestScopes instead of creating them myself. * Remove out of date comments. * Update name to match go test naming standards. * Adding project service comments. * Using scopeType's new prefix method inside scope.go * Setting test project's name and desc to default to pass tests. * Change host catalog to project in test. * Fixing merge errors. * Fixing some more merge errors. * Fix typo in comments. * Fix typos in project_service.go. * Update error indicating provided id and the expected prefix. * Make the RepoFactory types in a common directory.
This commit is contained in:
1 parent
b016498d96
commit
6804c98b0b
11 files changed
+321
-245
No files matched your search
@@ -11,6 +11,11 @@ import "google/protobuf/wrappers.proto";
|
||||
import "controller/api/resources/scopes/v1/project.proto";
|
||||
|
||||
service ProjectService {
|
||||
|
||||
// GetProject returns a stored Project if present. The provided request
|
||||
// must include the org and project id for the project being retrieved. If
|
||||
// any of those ids are missing, malformed or reference a non existing
|
||||
// resource an error is returned.
|
||||
rpc GetProject(GetProjectRequest) returns (GetProjectResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/orgs/{org_id}/projects/{id}"
|
||||
@@ -20,6 +25,11 @@ service ProjectService {
|
||||
summary: "Gets a single Project"
|
||||
};
|
||||
}
|
||||
|
||||
// ListProjects returns a list of stored projects which exist inside the org
|
||||
// referenced inside the request. The request must include the org id for
|
||||
// the projects being retrieved. If the org id is missing, malformed, or
|
||||
// reference a non existing organization, an error is returned.
|
||||
rpc ListProjects(ListProjectsRequest) returns (ListProjectsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/orgs/{org_id}/projects"
|
||||
@@ -28,6 +38,12 @@ service ProjectService {
|
||||
summary: "Lists all Projects"
|
||||
};
|
||||
}
|
||||
|
||||
// CreateProject creates and stores a project in watchtower. The provided
|
||||
// request must include the org id in which the project will be created.
|
||||
// If the org id is missing, malformed or references a non existing
|
||||
// organization, an error is returned. If a name is provided that is in
|
||||
// use in another project in the same organization, an error is returned.
|
||||
rpc CreateProject(CreateProjectRequest) returns (CreateProjectResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/orgs/{org_id}/projects"
|
||||
@@ -38,6 +54,15 @@ service ProjectService {
|
||||
summary: "Creates a single Project"
|
||||
};
|
||||
}
|
||||
|
||||
// UpdateProject updates an existing project in watchtower. The provided
|
||||
// project must not have any read only fields set. The update mask must be
|
||||
// included in the request and contain at least 1 mutable field. To unset
|
||||
// a field's value, include the field in the update mask and don't set it
|
||||
// in the provided project. An error is returned if either the organization
|
||||
// or project ids are missing or reference a non existing resource. An error
|
||||
// is also returned if the request attempts to update the name to one that is
|
||||
// already in use in this organization.
|
||||
rpc UpdateProject(UpdateProjectRequest) returns (UpdateProjectResponse) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v1/orgs/{org_id}/projects/{id}"
|
||||
@@ -48,6 +73,12 @@ service ProjectService {
|
||||
summary: "Updates a Project"
|
||||
};
|
||||
}
|
||||
|
||||
// DeleteProject remotes a project and all child resources from Watchtower.
|
||||
// If the provided org or project ids are malformed or not provided an error
|
||||
// is returned. No error is returned if either ids reference resources that
|
||||
// do not exist as the response itself specifies if the resource existed
|
||||
// before the DeleteProject request was received.
|
||||
rpc DeleteProject(DeleteProjectRequest) returns (DeleteProjectResponse) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v1/orgs/{org_id}/projects/{id}"
|
||||
|
||||
Reference in new issue
Block a user