Migrate target host sets -> host sources (#1424)

This follows the same model as https://github.com/hashicorp/boundary/pull/1413

See there and CHANGELOG for more details.
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-07-30 08:48:03 -04:00
1 parent 6b78108ecf
commit f8a51b987c
39 files changed
+3385 -964

No files matched your search

@@ -10,6 +10,14 @@ import "google/protobuf/struct.proto";
import "controller/api/resources/scopes/v1/scope.proto";
import "controller/custom_options/v1/options.proto";
message HostSource {
// Output only. The ID of the Host Set.
string id = 10;
// Output only. The Host Catalog to which this Host Source belongs.
string host_catalog_id = 20 [json_name="host_catalog_id"];
}
message HostSet {
// Output only. The ID of the Host Set.
string id = 10;
@@ -110,6 +118,12 @@ message Target {
// Output only. The Host Sets associated with this Target.
repeated HostSet host_sets = 110 [json_name="host_sets"];
// The IDs of the Host Sources associated with this Target.
repeated string host_source_ids = 420 [json_name="host_source_ids"];
// Output only. The Host Sources associated with this Target.
repeated HostSource host_sources = 430 [json_name="host_sources"];
// Maximum total lifetime of a created Session, in seconds.
google.protobuf.UInt32Value session_max_seconds = 120 [json_name="session_max_seconds", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this: "session_max_seconds" that: "SessionMaxSeconds"}];
@@ -149,6 +149,60 @@ service TargetService {
};
}
// AddTargetHostSources adds Host Sources to this Target. The provided request
// must include the Target ID to which the Host Sources will be added. All
// Host Sources added to the provided Target must be a child of a Catalog that
// is a child of the same scope as this Target. If the scope or Target IDs are
// missing, malformed, or reference non-existing resources, an error is
// returned. An error is returned if a Host Source is attempted to be added to a
// target that is already present on the Target.
rpc AddTargetHostSources(AddTargetHostSourcesRequest) returns (AddTargetHostSourcesResponse) {
option (google.api.http) = {
post: "/v1/targets/{id}:add-host-sources"
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Adds existing Host Sources to a Target."
};
}
// SetTargetHostSources sets the Target's Host Sources. Any existing Host
// Sources on the Target are deleted if they are not included in this request.
// The provided request must include the scope, and the Target ID on which the
// Host Sources will be set. All Host Sources in the request must be a child
// of a Catalog that is in the same scope as the provided Target. If any IDs
// are missing, malformed, or references a non-existing resource, an error is
// returned.
rpc SetTargetHostSources(SetTargetHostSourcesRequest) returns (SetTargetHostSourcesResponse) {
option (google.api.http) = {
post: "/v1/targets/{id}:set-host-sources"
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Sources the Host Sources on the Target."
};
}
// RemoveTargetHostSources removes the Host Sources from the specified Target.
// The provided request must include the Target ID for the Target from which
// the Host Sources will be removed. If the ID is missing, malformed, or
// references a non-existing scope or Catalog, an error is returned. An error
// is returned if a Host Source is attempted to be removed from the Target
// when the Target does not have the Host Set.
rpc RemoveTargetHostSources(RemoveTargetHostSourcesRequest) returns (RemoveTargetHostSourcesResponse) {
option (google.api.http) = {
post: "/v1/targets/{id}:remove-host-sources"
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Removes Host Sources from the Target."
};
}
// AddTargetCredentialLibraries adds Credential Libraries to this Target.
// The provided request must include the Target ID to which the Credential
// Libraries will be added. All Credential Libraries added to the provided
@@ -340,6 +394,42 @@ message RemoveTargetHostSetsResponse {
api.resources.targets.v1.Target item = 1;
}
message AddTargetHostSourcesRequest {
string id = 1;
// 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.
uint32 version = 2;
repeated string host_source_ids = 3 [json_name="host_source_ids"];
}
message AddTargetHostSourcesResponse {
api.resources.targets.v1.Target item = 1;
}
message SetTargetHostSourcesRequest {
string id = 1;
// 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.
uint32 version = 2;
repeated string host_source_ids = 3 [json_name="host_source_ids"];
}
message SetTargetHostSourcesResponse {
api.resources.targets.v1.Target item = 1;
}
message RemoveTargetHostSourcesRequest {
string id = 1;
// 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.
uint32 version = 2;
repeated string host_source_ids = 3 [json_name="host_source_ids"];
}
message RemoveTargetHostSourcesResponse {
api.resources.targets.v1.Target item = 1;
}
message AddTargetCredentialLibrariesRequest {
string id = 1;
// Version is used to ensure this resource has not changed.