Handler for Host CRUDL actions (#287)

This commit is contained in:
Todd Knight authored and GitHub committed 2020-08-20 08:20:26 -07:00
1 parent 8dad85fef4
commit d5678c4f80
33 files changed
+1944 -372

No files matched your search

@@ -4,6 +4,7 @@ package controller.api.resources.hosts.v1;
option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/resources/hosts;hosts";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "controller/api/resources/scopes/v1/scope.proto";
@@ -35,12 +36,24 @@ message Host {
// The version can be used in subsequent write requests to ensure this resource
// has not changed and to fail the write if it has.
// Output only.
uint32 version = 70;
// The type of the resource, to help differentiate schemas
google.protobuf.StringValue type = 80;
string type = 80;
// The address (DNS or IP name) used to reach the host
google.protobuf.StringValue address = 90 [(custom_options.v1.generate_sdk_option) = true];
// The host catalog this host set is a part of
// Output only
string host_catalog_id = 90 [json_name="host_catalog_id"];
// A list of host sets this host is in
// Output only.
repeated string host_set_ids = 100;
// The attributes that are applied for the specific host type.
google.protobuf.Struct attributes = 110 [(custom_options.v1.generate_sdk_option) = true];
}
message StaticHostAttributes {
// The address (DNS or IP name) used to reach the host
google.protobuf.StringValue address = 10 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"attributes.address" that: "address"}];
}
@@ -10,7 +10,10 @@ import "google/protobuf/field_mask.proto";
import "controller/api/resources/hosts/v1/host.proto";
service HostService {
// This retrieves the host specified in the request using the basic view.
// GetHost returns a stored Host if present. The provided request
// must include the host catalog and host ID for the resource being
// retrieved. If any of those IDs are missing, malformed or reference a
// non existing resource an error is returned.
rpc GetHost(GetHostRequest) returns (GetHostResponse) {
option (google.api.http) = {
get: "/v1/scopes/*/host-catalogs/{host_catalog_id}/hosts/{id}"
@@ -20,6 +23,12 @@ service HostService {
summary: "Gets a single Host"
};
}
// ListHosts returns a list of stored hosts which exist inside the scope
// referenced inside the request. The request must include the scope ID and
// the host catalog id for the hosts being retrieved. If the any of those
// are missing, malformed, or reference a non existing scope, an error is
// returned.
rpc ListHosts(ListHostsRequest) returns (ListHostsResponse) {
option (google.api.http) = {
get: "/v1/scopes/*/host-catalogs/{host_catalog_id}/hosts"
@@ -28,6 +37,12 @@ service HostService {
summary: "List all Hosts for the specified catalog"
};
}
// CreateHost creates and stores a host in boundary. The provided
// request must include the scope and host catalog ids in which the host
// will be created. If the scope or catalog id is missing, malformed or references a
// non existing resource, an error is returned. If a name is provided that
// is in use by another host in the same host catalog, an error is returned.
rpc CreateHost(CreateHostRequest) returns (CreateHostResponse) {
option (google.api.http) = {
post: "/v1/scopes/*/host-catalogs/{host_catalog_id}/hosts"
@@ -38,6 +53,15 @@ service HostService {
summary: "Create a single Host"
};
}
// UpdateHost updates an existing host in boundary. The provided
// host 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 host. An error is returned if either the scope
// or host catalog or host 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 host catalog.
rpc UpdateHost(UpdateHostRequest) returns (UpdateHostResponse) {
option (google.api.http) = {
patch: "/v1/scopes/*/host-catalogs/{host_catalog_id}/hosts/{id}"
@@ -48,6 +72,12 @@ service HostService {
summary: "Update a Host"
};
}
// DeleteHost removes a host from Boundary. If the provided scope,
// host catalog, or host ids are malformed or not provided an error is
// returned. No error is returned if any of the ids reference resources that
// do not exist since the response itself specifies if the resource existed
// before the DeleteHost request was received.
rpc DeleteHost(DeleteHostRequest) returns (DeleteHostResponse) {
option (google.api.http) = {
delete: "/v1/scopes/*/host-catalogs/{host_catalog_id}/hosts/{id}"
@@ -90,9 +120,8 @@ message CreateHostResponse {
message UpdateHostRequest {
string host_catalog_id = 1 [json_name="host_catalog_id"];
string id = 2;
uint32 version = 3;
api.resources.hosts.v1.Host item = 4;
google.protobuf.FieldMask update_mask = 5;
api.resources.hosts.v1.Host item = 3;
google.protobuf.FieldMask update_mask = 4;
}
message UpdateHostResponse {
@@ -166,11 +166,11 @@ service RoleService {
};
}
// RemoveRoleGrants removes the users and/or groups from the specified role.
// RemoveRoleGrants removes the grants from the specified role.
// The provided request must include the scope and the role IDs from which the
// users and/or groups will be removed. If either ID is missing, malformed, or
// references a non-existing org, an error is returned. It is not an error to
// have duplicate user/group IDs.
// grants will be removed. If either ID is missing, malformed, or
// references a non-existing scope, an error is returned. It is not an error to
// have duplicate grants.
rpc RemoveRoleGrants(RemoveRoleGrantsRequest) returns (RemoveRoleGrantsResponse) {
option (google.api.http) = {
post: "/v1/scopes/*/roles/{role_id}:remove-grants"
@@ -26,7 +26,7 @@ service UserService {
}
// ListUsers returns a list of stored users which exist inside the org
// referenced inside the request. The request must include the org ID for
// referenced inside the request. The request must include the scope ID for
// the users being retrieved. If the scope ID is missing, malformed, or
// reference a non existing scope, an error is returned.
rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) {
@@ -39,10 +39,10 @@ service UserService {
}
// CreateUser creates and stores a user in boundary. The provided
// request must include the org id in which the user will be created.
// If the org id is missing, malformed or references a non existing
// org, an error is returned. If a name is provided that is in
// use in another user in the same org, an error is returned.
// request must include the scope id in which the user will be created.
// If the scope id is missing, malformed or references a non existing
// scope, an error is returned. If a name is provided that is in
// use in another user in the same scope, an error is returned.
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse) {
option (google.api.http) = {
post: "/v1/scopes/*/users"
@@ -58,10 +58,10 @@ service UserService {
// user 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 user. An error is returned if either the org
// in the provided user. An error is returned if either the scope
// or user 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 org.
// already in use in this scope.
rpc UpdateUser(UpdateUserRequest) returns (UpdateUserResponse) {
option (google.api.http) = {
patch: "/v1/scopes/*/users/{id}"
@@ -73,7 +73,7 @@ service UserService {
};
}
// DeleteUser removes a user from Boundary. If the provided org or user ids
// DeleteUser removes a user from Boundary. If the provided scope or user 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 DeleteUser request was