2020-09-29 13:17:59 -07:00
// Copyright (c) HashiCorp, Inc.
2020-09-26 08:30:27 -04:00
// SPDX-License-Identifier: MPL-2.0
2023-02-02 17:15:17 -08:00
2020-05-01 12:38:01 -07:00
syntax = "proto3" ;
2020-05-01 18:05:54 -04:00
package controller.api.services.v1 ;
2020-05-01 12:38:01 -07:00
2020-08-27 20:43:33 -04:00
import "controller/api/resources/hostsets/v1/host_set.proto" ;
2022-04-13 12:58:33 -04:00
import "controller/custom_options/v1/options.proto" ;
2020-05-01 12:38:01 -07:00
import "google/api/annotations.proto" ;
import "google/protobuf/field_mask.proto" ;
2020-07-23 11:26:15 -07:00
import "protoc-gen-openapiv2/options/annotations.proto" ;
2022-04-13 12:58:33 -04:00
2020-08-10 17:15:02 -04:00
option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/services;services" ;
2022-04-13 12:58:33 -04:00
option ( custom_options.v1.domain ) = "host" ;
2020-05-01 12:38:01 -07:00
service HostSetService {
2024-04-08 13:55:17 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag ) = {
name : "Host set service"
description :
"A host set is a resource that represents a collection of hosts that are considered equivalent for the purposes of access control. "
"The host set service provides endpoints for managing host sets in Boundary."
external_docs : {
url : "https://developer.hashicorp.com/boundary/docs/concepts/domain-model/host-sets" ;
description : "Read about host sets in the Boundary domain model" ;
}
};
2020-08-21 10:57:30 -07:00
// GetHostSet returns a stored Host Set if present. The provided request
2020-09-29 13:17:59 -07:00
// must include the Host Set ID for the resource being retrieved. If missing,
// malformed or reference a non existing resource an error is returned.
2020-05-01 12:38:01 -07:00
rpc GetHostSet ( GetHostSetRequest ) returns ( GetHostSetResponse ) {
option ( google.api.http ) = {
2020-09-01 12:31:54 -04:00
get : "/v1/host-sets/{id}"
2020-05-01 12:38:01 -07:00
response_body : "item"
};
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Get a single Host Set." };
2020-05-01 12:38:01 -07:00
}
2020-08-21 10:57:30 -07:00
2020-09-29 13:17:59 -07:00
// ListHostSets returns a list of stored Host Sets which exist inside the
// Host Catalog provided. The request must include a properly formatted
// Host Catalog id or an error is returned.
2020-05-01 12:38:01 -07:00
rpc ListHostSets ( ListHostSetsRequest ) returns ( ListHostSetsResponse ) {
option ( google.api.http ) = { get : "/v1/host-sets" };
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "List all Host Sets under the specific Catalog." };
2020-05-01 12:38:01 -07:00
}
2020-08-21 10:57:30 -07:00
2020-09-29 13:17:59 -07:00
// CreateHostSet creates and stores a Host Set in boundary. The provided
// request must include the Host Catalog id in which the Host Set
// will be created. If the Host Catalog id is missing, malformed or
2020-08-21 10:57:30 -07:00
// references a non existing resource, an error is returned. If a name is
2020-09-29 13:17:59 -07:00
// provided that is in use by another Host Set in the same Host Catalog, an
2020-08-21 10:57:30 -07:00
// error is returned.
2020-05-01 12:38:01 -07:00
rpc CreateHostSet ( CreateHostSetRequest ) returns ( CreateHostSetResponse ) {
option ( google.api.http ) = {
2020-09-01 12:31:54 -04:00
post : "/v1/host-sets"
2020-05-01 12:38:01 -07:00
body : "item"
response_body : "item"
};
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Create a Host Set." };
2020-05-01 12:38:01 -07:00
}
2020-08-21 10:57:30 -07:00
2020-09-29 13:17:59 -07:00
// UpdateHostSet updates an existing Host Set in boundary. The provided
// Host Set must not have any read only fields set. The update mask must be
2020-08-21 10:57:30 -07:00
// 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
2020-09-29 13:17:59 -07:00
// in the provided Host Set. An error is returned if the Host Set id is
// 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.
2020-05-01 12:38:01 -07:00
rpc UpdateHostSet ( UpdateHostSetRequest ) returns ( UpdateHostSetResponse ) {
option ( google.api.http ) = {
2020-09-01 12:31:54 -04:00
patch : "/v1/host-sets/{id}"
2020-05-01 12:38:01 -07:00
body : "item"
response_body : "item"
};
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Update a Host Set." };
2020-05-01 12:38:01 -07:00
}
2020-08-21 10:57:30 -07:00
2020-09-29 13:17:59 -07:00
// DeleteHostSet removes a Host Set from Boundary. If the provided
// Host Set id is malformed or not provided an error is returned.
2020-05-01 12:38:01 -07:00
rpc DeleteHostSet ( DeleteHostSetRequest ) returns ( DeleteHostSetResponse ) {
option ( google.api.http ) = { delete : "/v1/host-sets/{id}" };
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Delete a Host Set." };
2020-05-01 12:38:01 -07:00
}
2020-09-29 13:17:59 -07:00
// AddHostSetHosts adds a Host to a Host Set. The provided request must
// include the Host Set ID to which the Host will be added.
// All hosts added to the provided Host Set must be a child of the same
// Catalog that this Host Set is a child of. If the Host Set IDs is
2020-08-21 10:57:30 -07:00
// missing, malformed, or reference non-existing resources, an error is
2020-09-29 13:17:59 -07:00
// returned. It is an error to add a Host which already exists in the
// Host Set.
2020-08-11 11:20:06 -04:00
rpc AddHostSetHosts ( AddHostSetHostsRequest ) returns ( AddHostSetHostsResponse ) {
2020-05-01 12:38:01 -07:00
option ( google.api.http ) = {
2020-09-01 12:31:54 -04:00
post : "/v1/host-sets/{id}:add-hosts"
2020-08-21 10:57:30 -07:00
body : "*"
response_body : "item"
2020-05-01 12:38:01 -07:00
};
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Adds existing Hosts to a Host Set." };
2020-05-01 12:38:01 -07:00
}
2020-09-29 13:17:59 -07:00
// SetHostSetHosts sets the Host Set's hosts. Any existing hosts on the
// Host Set are deleted if they are not included in this request. The
// provided request must include the Host Set ID on which the hosts will be
// set. All Hosts in the request must be a child of the same Catalog that
// the provided Host Set is. An error is returned if any of the provided
// ids are malformed or references a non-existing resource.
2020-08-11 11:20:06 -04:00
rpc SetHostSetHosts ( SetHostSetHostsRequest ) returns ( SetHostSetHostsResponse ) {
option ( google.api.http ) = {
2020-09-01 12:31:54 -04:00
post : "/v1/host-sets/{id}:set-hosts"
2020-08-21 10:57:30 -07:00
body : "*"
response_body : "item"
2020-08-11 11:20:06 -04:00
};
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Sets the Hosts on the Host Set." };
}
2020-09-29 13:17:59 -07:00
// RemoveHostSetHosts removes the Hosts from the specified Host Set. The
// provided request must include the Host Set ID which the Host will be
// removed. An error is a returned if any of the provided IDs are malformed,
// or references a non-existing scope or catalog, or if a Host id is included
// which is not in the provided Host Set.
2020-08-11 11:20:06 -04:00
rpc RemoveHostSetHosts ( RemoveHostSetHostsRequest ) returns ( RemoveHostSetHostsResponse ) {
2020-05-01 12:38:01 -07:00
option ( google.api.http ) = {
2020-09-01 12:31:54 -04:00
post : "/v1/host-sets/{id}:remove-hosts"
2020-08-21 10:57:30 -07:00
body : "*"
response_body : "item"
2020-05-01 12:38:01 -07:00
};
2020-07-23 11:26:15 -07:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = { summary : "Removes Hosts from the Host Set." };
2020-05-01 12:38:01 -07:00
}
}
message GetHostSetRequest {
2022-04-13 12:58:33 -04:00
string id = 1 ; // @gotags: `class:"public"`
2020-05-01 12:38:01 -07:00
}
message GetHostSetResponse {
2020-08-27 20:43:33 -04:00
api.resources.hostsets.v1.HostSet item = 1 ;
2020-05-01 12:38:01 -07:00
}
message ListHostSetsRequest {
2022-04-13 12:58:33 -04:00
string host_catalog_id = 1 [ json_name = "host_catalog_id" ]; // @gotags: `class:"public"`
2024-04-08 13:55:17 -07:00
// You can specify that the filter should only return items that match.
// Refer to [filter expressions](https://developer.hashicorp.com/boundary/docs/concepts/filtering) for more information.
2022-04-13 12:58:33 -04:00
string filter = 30 [ json_name = "filter" ]; // @gotags: `class:"public"`
2024-04-08 13:55:17 -07:00
// An opaque token that Boundary uses to continue an existing iteration or
// request updated items. If you do not specify a token, pagination
// starts from the beginning. To learn more about list pagination
// in Boundary, refer to [list pagination](https://developer.hashicorp.com/boundary/docs/api-clients/api/pagination).
2023-12-13 19:47:34 -08:00
string list_token = 40 [ json_name = "list_token" ]; // @gotags: `class:"public"`
// The maximum size of a page in this iteration.
// If unset, the default page size configured will be used.
// If the page_size is greater than the default page configured,
2024-04-08 13:55:17 -07:00
// the page size will be truncated to this number..
2023-12-13 19:47:34 -08:00
uint32 page_size = 50 [ json_name = "page_size" ]; // @gotags: `class:"public"`
2020-05-01 12:38:01 -07:00
}
message ListHostSetsResponse {
2020-08-27 20:43:33 -04:00
repeated api.resources.hostsets.v1.HostSet items = 1 ;
2023-12-13 19:47:34 -08:00
// The type of response, either "delta" or "complete".
// Delta signifies that this is part of a paginated result
// or an update to a previously completed pagination.
// Complete signifies that it is the last page.
string response_type = 2 [ json_name = "response_type" ]; // @gotags: `class:"public"`
// An opaque token used to continue an existing pagination or
// request updated items. Use this token in the next list request
// to request the next page.
string list_token = 3 [ json_name = "list_token" ]; // @gotags: `class:"public"`
// The name of the field which the items are sorted by.
string sort_by = 4 [ json_name = "sort_by" ]; // @gotags: `class:"public"`
// The direction of the sort, either "asc" or "desc".
string sort_dir = 5 [ json_name = "sort_dir" ]; // @gotags: `class:"public"`
// A list of item IDs that have been removed since they were returned
// as part of a pagination. They should be dropped from any client cache.
// This may contain items that are not known to the cache, if they were
// created and deleted between listings.
repeated string removed_ids = 6 [ json_name = "removed_ids" ]; // @gotags: `class:"public"`
// An estimate at the total items available. This may change during pagination.
uint32 est_item_count = 7 [ json_name = "est_item_count" ]; // @gotags: `class:"public"`
2020-05-01 12:38:01 -07:00
}
message CreateHostSetRequest {
2020-09-02 19:43:41 -07:00
api.resources.hostsets.v1.HostSet item = 1 ;
2020-05-01 12:38:01 -07:00
}
message CreateHostSetResponse {
2022-04-13 12:58:33 -04:00
string uri = 1 ; // @gotags: `class:"public"`
2020-08-27 20:43:33 -04:00
api.resources.hostsets.v1.HostSet item = 2 ;
2020-05-01 12:38:01 -07:00
}
message UpdateHostSetRequest {
2022-04-13 12:58:33 -04:00
string id = 1 ; // @gotags: `class:"public"`
2020-09-02 19:43:41 -07:00
api.resources.hostsets.v1.HostSet item = 2 ;
2020-09-26 08:30:27 -04:00
google.protobuf.FieldMask update_mask = 3 [ json_name = "update_mask" ];
2020-05-01 12:38:01 -07:00
}
message UpdateHostSetResponse {
2020-08-27 20:43:33 -04:00
api.resources.hostsets.v1.HostSet item = 1 ;
2020-05-01 12:38:01 -07:00
}
message DeleteHostSetRequest {
2022-04-13 12:58:33 -04:00
string id = 1 ; // @gotags: `class:"public"`
2020-05-01 12:38:01 -07:00
}
2020-09-08 23:57:26 -04:00
message DeleteHostSetResponse {}
2020-05-01 12:38:01 -07:00
2020-08-11 11:20:06 -04:00
message AddHostSetHostsRequest {
2022-04-13 12:58:33 -04:00
string id = 1 ; // @gotags: `class:"public"`
2020-09-29 13:17:59 -07:00
// Version is used to ensure this resource has not changed.
// The mutation will fail if the version does not match the latest known good version.
2022-04-13 12:58:33 -04:00
uint32 version = 2 ; // @gotags: `class:"public"`
2020-05-01 12:38:01 -07:00
2020-09-26 08:30:27 -04:00
// A list of Host IDs which will be added to this Host Set. Each Host referenced here must be a child of the same Host Catalog of which this Host Set is a child.
2022-04-13 12:58:33 -04:00
repeated string host_ids = 3 [ json_name = "host_ids" ]; // @gotags: `class:"public"`
2020-05-01 12:38:01 -07:00
}
2020-08-11 11:20:06 -04:00
message AddHostSetHostsResponse {
2020-08-27 20:43:33 -04:00
api.resources.hostsets.v1.HostSet item = 1 ;
2020-08-11 11:20:06 -04:00
}
message SetHostSetHostsRequest {
2022-04-13 12:58:33 -04:00
string id = 1 ; // @gotags: `class:"public"`
2020-09-29 13:17:59 -07:00
// Version is used to ensure this resource has not changed.
// The mutation will fail if the version does not match the latest known good version.
2022-04-13 12:58:33 -04:00
uint32 version = 2 ; // @gotags: `class:"public"`
2020-08-11 11:20:06 -04:00
2020-09-26 08:30:27 -04:00
// A list of Host IDs which will be set on this Host Set. Each Host referenced here must be a child of the same Host Catalog of which this Host Set is a child.
2022-04-13 12:58:33 -04:00
repeated string host_ids = 3 [ json_name = "host_ids" ]; // @gotags: `class:"public"`
2020-08-11 11:20:06 -04:00
}
message SetHostSetHostsResponse {
2020-08-27 20:43:33 -04:00
api.resources.hostsets.v1.HostSet item = 1 ;
2020-05-01 12:38:01 -07:00
}
2020-08-11 11:20:06 -04:00
message RemoveHostSetHostsRequest {
2022-04-13 12:58:33 -04:00
string id = 1 ; // @gotags: `class:"public"`
2020-09-29 13:17:59 -07:00
// Version is used to ensure this resource has not changed.
// The mutation will fail if the version does not match the latest known good version.
2022-04-13 12:58:33 -04:00
uint32 version = 2 ; // @gotags: `class:"public"`
2020-05-01 12:38:01 -07:00
2020-09-26 08:30:27 -04:00
// A list of Host IDs which will be removed from this Host Set.
2022-04-13 12:58:33 -04:00
repeated string host_ids = 3 [ json_name = "host_ids" ]; // @gotags: `class:"public"`
2020-05-01 12:38:01 -07:00
}
2020-08-11 11:20:06 -04:00
message RemoveHostSetHostsResponse {
2020-08-27 20:43:33 -04:00
api.resources.hostsets.v1.HostSet item = 1 ;
2020-05-01 12:38:01 -07:00
}