* Renamed fakeRepo to mockRepo * Changing around TODOs to capture current plans with the code. * Remove the repo interface and use a real DB for tests. * Fixed a few tests. * Adding checks for properly formatted identifiers. * Updating code to account for recent merges. Relaxing some restrictions on what an id can look like. * Added small comment explaining why RegisterGrpcGatewayer interface exists. * Move project service up a call level. Long term I think it would make sense to define these services even higher up the call stack, potentially at the initialization of the controller server, near where the DB is initialized. * Making these fields align with those in the resources under hosts/... * Hard code the service initialization in the handler registration code. * Regenerate project related code proto code. * Removing type field for project. * Adds basic project handling in CLI/SDK (#47) * Adds SDK for creating and reading projects * Reorganizes a bit * Adds CLI for creating and reading projects * Fixes some some generation bugs * Adds redirect support for default org ID * Fix protobuf import references being moved. * Update client test to look for "orgs" and "projects" instead of "org" and "project" * Update expected segments test * Fix setAddr handling when default organization is in use * Set client in target after create or read Co-authored-by: Jim Lambert <jimlambrt@Jims-MBP-3.home> Co-authored-by: Jim <jlambert@hashicorp.com> Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com> Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
118 lines
2.5 KiB
Go
118 lines
2.5 KiB
Go
package main
|
|
|
|
import "os"
|
|
|
|
type structInfo struct {
|
|
inFile string
|
|
inName string
|
|
outFile string
|
|
outName string
|
|
outPkg string
|
|
structFields string
|
|
parentName string
|
|
detailName string
|
|
templateType templateType
|
|
}
|
|
|
|
var inputStructs = []*structInfo{
|
|
{
|
|
os.Getenv("GEN_BASEPATH") + "/internal/gen/controller/api/error.pb.go",
|
|
"Error",
|
|
os.Getenv("GEN_BASEPATH") + "/api/error.gen.go",
|
|
"Error",
|
|
"api",
|
|
"",
|
|
"",
|
|
"",
|
|
templateTypeResource,
|
|
},
|
|
{
|
|
os.Getenv("GEN_BASEPATH") + "/internal/gen/controller/api/error.pb.go",
|
|
"ErrorDetails",
|
|
os.Getenv("GEN_BASEPATH") + "/api/error_details.gen.go",
|
|
"ErrorDetails",
|
|
"api",
|
|
"",
|
|
"",
|
|
"",
|
|
templateTypeResource,
|
|
},
|
|
{
|
|
os.Getenv("GEN_BASEPATH") + "/internal/gen/controller/api/resources/hosts/host.pb.go",
|
|
"Host",
|
|
os.Getenv("GEN_BASEPATH") + "/api/hosts/host.gen.go",
|
|
"Host",
|
|
"hosts",
|
|
"",
|
|
"",
|
|
"",
|
|
templateTypeResource,
|
|
},
|
|
{
|
|
os.Getenv("GEN_BASEPATH") + "/internal/gen/controller/api/resources/hosts/host_set.pb.go",
|
|
"HostSet",
|
|
os.Getenv("GEN_BASEPATH") + "/api/hosts/host_set.gen.go",
|
|
"HostSet",
|
|
"hosts",
|
|
"",
|
|
"",
|
|
"",
|
|
templateTypeResource,
|
|
},
|
|
{
|
|
os.Getenv("GEN_BASEPATH") + "/internal/gen/controller/api/resources/hosts/host_catalog.pb.go",
|
|
"HostCatalog",
|
|
os.Getenv("GEN_BASEPATH") + "/api/hosts/host_catalog.gen.go",
|
|
"HostCatalog",
|
|
"hosts",
|
|
"",
|
|
"",
|
|
"",
|
|
templateTypeResource,
|
|
},
|
|
{
|
|
os.Getenv("GEN_BASEPATH") + "/internal/gen/controller/api/resources/scopes/organization.pb.go",
|
|
"Organization",
|
|
os.Getenv("GEN_BASEPATH") + "/api/scopes/organization.gen.go",
|
|
"Organization",
|
|
"scopes",
|
|
"",
|
|
"",
|
|
"",
|
|
templateTypeResource,
|
|
},
|
|
{
|
|
os.Getenv("GEN_BASEPATH") + "/internal/gen/controller/api/resources/scopes/project.pb.go",
|
|
"Project",
|
|
os.Getenv("GEN_BASEPATH") + "/api/scopes/project.gen.go",
|
|
"Project",
|
|
"scopes",
|
|
"",
|
|
"",
|
|
"",
|
|
templateTypeResource,
|
|
},
|
|
{
|
|
os.Getenv("GEN_BASEPATH") + "/internal/gen/controller/api/resources/hosts/host_catalog.pb.go",
|
|
"StaticHostCatalogDetails",
|
|
os.Getenv("GEN_BASEPATH") + "/api/hosts/static_host_catalog.gen.go",
|
|
"StaticHostCatalogDetails",
|
|
"hosts",
|
|
"",
|
|
"HostCatalog",
|
|
"StaticHostCatalog",
|
|
templateTypeDetail,
|
|
},
|
|
{
|
|
os.Getenv("GEN_BASEPATH") + "/internal/gen/controller/api/resources/hosts/host_catalog.pb.go",
|
|
"AwsEc2HostCatalogDetails",
|
|
os.Getenv("GEN_BASEPATH") + "/api/hosts/awsec2_host_catalog.gen.go",
|
|
"AwsEc2HostCatalogDetails",
|
|
"hosts",
|
|
"",
|
|
"HostCatalog",
|
|
"AwsEc2HostCatalog",
|
|
templateTypeDetail,
|
|
},
|
|
}
|