Files
threshold/internal/proto/local/controller/api/services/v1/project_service.proto
T

139 lines
4.6 KiB
Protocol Buffer

syntax = "proto3";
package controller.api.services.v1;
option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api/services;services";
import "protoc-gen-swagger/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/field_mask.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}"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
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"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
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"
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
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}"
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
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}"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
summary: "Deletes a Project"
};
}
}
message GetProjectRequest {
string org_id = 1;
string id = 2;
string view = 3;
}
message GetProjectResponse {
resources.scopes.v1.Project item = 1;
}
message ListProjectsRequest {
string org_id = 1;
string view = 2;
}
message ListProjectsResponse {
repeated resources.scopes.v1.Project items = 1;
}
message CreateProjectRequest {
string org_id = 1;
resources.scopes.v1.Project item = 2;
}
message CreateProjectResponse {
string uri = 1;
resources.scopes.v1.Project item = 2;
}
message UpdateProjectRequest {
string org_id = 1;
string id = 2;
resources.scopes.v1.Project item = 3;
google.protobuf.FieldMask update_mask = 4;
}
message UpdateProjectResponse {
resources.scopes.v1.Project item = 1;
}
message DeleteProjectRequest {
string org_id = 1;
string id = 2;
}
message DeleteProjectResponse {
bool existed = 1;
}