Update Watchtower to use grpc-gateway v2 (#204)

* Migration to grpc gateway v2.
This commit is contained in:
Todd Knight authored and GitHub committed 2020-07-23 11:26:15 -07:00
1 parent 6de1f7ee16
commit f47046f158
67 files changed
+2281 -2070

No files matched your search

@@ -4,7 +4,7 @@ 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 "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/struct.proto";
import "controller/api/resources/authtokens/v1/authtoken.proto";
@@ -17,7 +17,7 @@ service AuthenticationService {
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Authenticate a user to an scope and retrieve an authentication token."
};
}
@@ -30,7 +30,7 @@ service AuthenticationService {
option (google.api.http) = {
post: "/v1/:deauthenticate"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Deauthenticate an authentication token."
};
}
@@ -4,7 +4,7 @@ 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 "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
import "controller/api/resources/authtokens/v1/authtoken.proto";
@@ -19,7 +19,7 @@ service AuthTokenService {
get: "/v1/scopes/*/auth-tokens/{id}"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Gets a single AuthToken"
};
}
@@ -32,7 +32,7 @@ service AuthTokenService {
option (google.api.http) = {
get: "/v1/scopes/*/auth-tokens"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Lists all AuthTokens"
};
}
@@ -46,7 +46,7 @@ service AuthTokenService {
option (google.api.http) = {
delete: "/v1/scopes/*/auth-tokens/{id}"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Deletes an AuthTokens"
};
}
@@ -4,7 +4,7 @@ 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 "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/wrappers.proto";
@@ -22,7 +22,7 @@ service GroupService {
get: "/v1/scopes/*/groups/{id}"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Gets a single Group"
};
}
@@ -35,7 +35,7 @@ service GroupService {
option (google.api.http) = {
get: "/v1/scopes/*/groups"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Lists all Groups"
};
}
@@ -51,7 +51,7 @@ service GroupService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Creates a single Group"
};
}
@@ -70,7 +70,7 @@ service GroupService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Updates a Group"
};
}
@@ -84,7 +84,7 @@ service GroupService {
option (google.api.http) = {
delete: "/v1/scopes/*/groups/{id}"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Deletes a Group"
};
}
@@ -99,7 +99,7 @@ service GroupService {
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Adds Users as members to a Group"
};
}
@@ -115,7 +115,7 @@ service GroupService {
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Set a Group's members to exactly the list of provided in the request, removing any members that are not specified."
};
}
@@ -130,7 +130,7 @@ service GroupService {
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Removes the specified members from a Group."
};
}
@@ -4,13 +4,13 @@ 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 "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/field_mask.proto";
import "controller/api/resources/hosts/v1/host_catalog.proto";
service HostCatalogService {
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_tag) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = {
description: "The host catalog service allows you to get/mutate Host catalogs of every type."
};
@@ -24,7 +24,7 @@ service HostCatalogService {
get: "/v1/scopes/*/host-catalogs/{id}"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Gets a single HostCatalog"
description: "Gets a single Host Catalog with the provided identifier."
};
@@ -39,7 +39,7 @@ service HostCatalogService {
option (google.api.http) = {
get: "/v1/scopes/*/host-catalogs"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Gets a list of HostCatalogs"
};
}
@@ -55,7 +55,7 @@ service HostCatalogService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Creates a HostCatalog"
description: "Creates a single host catalog under the specified scope"
};
@@ -72,7 +72,7 @@ service HostCatalogService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Updates a HostCatalog"
};
}
@@ -86,7 +86,7 @@ service HostCatalogService {
option (google.api.http) = {
delete: "/v1/scopes/*/host-catalogs/{id}"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Deletes a HostCatalog"
};
}
@@ -4,7 +4,7 @@ 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 "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/field_mask.proto";
import "controller/api/resources/hosts/v1/host.proto";
@@ -16,7 +16,7 @@ service HostService {
get: "/v1/scopes/*/host-catalogs/{host_catalog_id}/hosts/{id}"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Gets a single Host"
};
}
@@ -24,7 +24,7 @@ service HostService {
option (google.api.http) = {
get: "/v1/scopes/*/host-catalogs/{host_catalog_id}/hosts"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "List all Hosts for the specified catalog"
};
}
@@ -34,7 +34,7 @@ service HostService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Create a single Host"
};
}
@@ -44,7 +44,7 @@ service HostService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Update a Host"
};
}
@@ -52,7 +52,7 @@ service HostService {
option (google.api.http) = {
delete: "/v1/scopes/*/host-catalogs/{host_catalog_id}/hosts/{id}"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Delete a Host"
};
}
@@ -4,12 +4,12 @@ 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 "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/field_mask.proto";
import "controller/api/resources/hosts/v1/host_set.proto";
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "Controller API"
version: "0.0.1"
@@ -26,7 +26,7 @@ service HostSetService {
get: "/v1/scopes/*/host-catalogs/{host_catalog_id}/host-sets/{id}"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Get a single HostSet"
};
}
@@ -34,7 +34,7 @@ service HostSetService {
option (google.api.http) = {
get: "/v1/scopes/*/host-catalogs/{host_catalog_id}/host-sets"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "List all HostSets under the specific catalog"
};
}
@@ -44,7 +44,7 @@ service HostSetService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Create a HostSet"
};
}
@@ -54,7 +54,7 @@ service HostSetService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Update a HostSet"
};
}
@@ -62,7 +62,7 @@ service HostSetService {
option (google.api.http) = {
delete: "/v1/scopes/*/host-catalogs/{host_catalog_id}/host-sets/{id}"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Delete a HostSet"
};
}
@@ -71,7 +71,7 @@ service HostSetService {
option (google.api.http) = {
post: "/v1/scopes/*/host-catalogs/{host_catalog_id}/host-sets/{id}:add-hosts"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Adds existing Hosts to the Host Set"
description: "Adds the hosts to this Host Set if possible. All hosts added must be a child of the same host catalog this host set is a child of."
};
@@ -81,7 +81,7 @@ service HostSetService {
option (google.api.http) = {
post: "/v1/scopes/*/host-catalogs/{host_catalog_id}/host-sets/{id}:remove-hosts"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Removes Hosts to the Host Set"
description: "Removes the hosts from this Host Set if present. If it is not present then no action is taken and no error is returned."
};
@@ -4,7 +4,7 @@ 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 "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/wrappers.proto";
@@ -20,7 +20,7 @@ service RoleService {
get: "/v1/scopes/*/roles/{id}"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Gets a single Role"
};
}
@@ -33,7 +33,7 @@ service RoleService {
option (google.api.http) = {
get: "/v1/scopes/*/roles"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Lists all Roles"
};
}
@@ -49,7 +49,7 @@ service RoleService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Creates a single Role"
};
}
@@ -68,7 +68,7 @@ service RoleService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Updates a Role"
};
}
@@ -82,7 +82,7 @@ service RoleService {
option (google.api.http) = {
delete: "/v1/scopes/*/roles/{id}"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Deletes a Role"
};
}
@@ -97,7 +97,7 @@ service RoleService {
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Adds Users and/or Groups to a Role"
};
}
@@ -114,7 +114,7 @@ service RoleService {
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Set Users and/or Groups to a Role, removing any principals that are not specified in the request."
};
}
@@ -130,7 +130,7 @@ service RoleService {
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Removes the specified Users and/or Groups from a Role."
};
}
@@ -145,7 +145,7 @@ service RoleService {
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Adds grants to a role"
};
}
@@ -161,7 +161,7 @@ service RoleService {
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Set grants for a role, removing any grants that are not specified in the request."
};
}
@@ -177,7 +177,7 @@ service RoleService {
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Removes grants from a role."
};
}
@@ -4,7 +4,7 @@ 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 "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/field_mask.proto";
import "controller/api/resources/scopes/v1/scope.proto";
@@ -20,7 +20,7 @@ service ScopeService {
get: "/v1/scopes/{id}"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Gets a single Scope"
};
}
@@ -31,7 +31,7 @@ service ScopeService {
option (google.api.http) = {
get: "/v1/scopes"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Lists all Scopes within the scope of the token making the request"
};
}
@@ -47,7 +47,7 @@ service ScopeService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Creates a single Scope"
};
}
@@ -66,7 +66,7 @@ service ScopeService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Updates a Scope"
};
}
@@ -80,7 +80,7 @@ service ScopeService {
option (google.api.http) = {
delete: "/v1/scopes/{id}"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Deletes a Scope"
};
}
@@ -4,7 +4,7 @@ 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 "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/field_mask.proto";
import "controller/api/resources/users/v1/user.proto";
@@ -20,6 +20,9 @@ service UserService {
get: "/v1/scopes/*/users/{id}"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Gets a single User"
};
}
// ListUsers returns a list of stored users which exist inside the org
@@ -30,7 +33,7 @@ service UserService {
option (google.api.http) = {
get: "/v1/scopes/*/users"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Lists all Users"
};
}
@@ -46,7 +49,7 @@ service UserService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Creates a single User"
};
}
@@ -65,7 +68,7 @@ service UserService {
body: "item"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Updates a User"
};
}
@@ -79,7 +82,7 @@ service UserService {
option (google.api.http) = {
delete: "/v1/scopes/*/users/{id}"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Deletes a User"
};
}