Handler hostcatalogs (#86)

* Created host catalog service.

* Fixing uri generation for create.

* Use newly submitted static host catalog.

* Copying over tests from projects.

* Fix UpdateHostCatalogRequest merging proto.

* Properly use static host catalog prefixes in tests.

* Correct test to verify the expected uri and id prefix is set.

* Add test for unsetting descriptions.

* Correct bad spelling in comment.

* Tweaking variable names.

* Adding Stringer to the catalog type and setting the type on the response.

* Setting up the catalogType to contain more info regarding its type.

* Validate the type field in requests.

* Remove unused method.

* Comment describing invariants around types.

* Wiring in the repo into the static catalog handler.

* Updated comments to the exported methods.

* fix: return the result of handlers.NotFoundError instead of just calling it.

* Fixing typos referencing just hosts instead of host catlogs.

* Update NewService returns an error and a non pointer type.

* Pull "org_id" and "project_id" into constants and the validation of them into the ValidateAncestors.

* Check errors for all Register*HandlerServer calls.

* fix: Remove left over reference that could cause a panic.

* fix: Changing "x := []string{}" to "var x []string"

* fix: Log errors in test cleanup.

* Changing the code to use google.golang.org/protobuf instead of the older github based protobuf library.

* Changing all t.Fatal checks to require.NoError calls.

* Changing unrecognized prefixes to Invalid Argument instead of Not Found.

* fix: toDbUpdateMask now returns error if it was unable to find any valid paths.

* Define CreatedTime, UpdatedTime, and Type at initialization time in toProto.

* Remove unused host catalog from test.

* Change a t.Fatal to a require.NoError that I missed earlier.

* Change shutdown error logging to t.Errorfs.

* Shorten validateX function names.

* Inline API responses.

* Add todo to make a new repo per request.

* Inline regex check for invalid id.

* Change stored repos into repo creating functions which satisfies ICU-223.

* Wrap proto comments to be under 80 characters long.

* Remove the exception on the read only fields that can be set in an Update request.

* Removing out of date comment.

* Use iam.TestScopes instead of making the project myself.

* Renaming files to be consistant with go test standards and resource naming standards.

* Remove TODO related to a task completed in an earlier commit.

* Fix the previous commit which removed the wrong TODO.
This commit is contained in:
Todd Knight authored and GitHub committed 2020-06-05 11:52:59 -07:00
1 parent 7d4993fb61
commit 7f6e78e66e
12 files changed
+1201 -143

No files matched your search

@@ -1025,12 +1025,26 @@ const _ = grpc.SupportPackageIsVersion6
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type HostCatalogServiceClient interface {
// This retrieves the host catalog specified in the request using the basic view.
// GetHostCatalog returns a stored Host Catalog if present. The provided request must include the org, project, and
// catalog id for the host catalog being retrieved. If any of those ids are missing, malformed, or reference a non
// existing resource an error is returned.
GetHostCatalog(ctx context.Context, in *GetHostCatalogRequest, opts ...grpc.CallOption) (*GetHostCatalogResponse, error)
// ListHostCatalogs returns a list of stored HostCatalogs which exist inside the project referenced in the request.
// The request must include the org and project ids for the HostCatalogs being retrieved.
// If any of those ids are missing, malformed, or reference a non existing parent resource an error is returned.
ListHostCatalogs(ctx context.Context, in *ListHostCatalogsRequest, opts ...grpc.CallOption) (*ListHostCatalogsResponse, error)
// CreateHostCatalog creates and stores a HostCatalog in watchtower. The provided request must include the org, and
// project id in which the catalog will be created and the catalog type to be created. If any of these required fields
// are missing, malformed, or reference a non existing parent resource an error is returned.
CreateHostCatalog(ctx context.Context, in *CreateHostCatalogRequest, opts ...grpc.CallOption) (*CreateHostCatalogResponse, error)
// UpdateHostCatalog updates an exist HostCatalog in Watchtower. The provided HostCatalog must not have any read only
// fields set except for potentially the id. The update mask must be provided and include at least 1 mutable
// field. To unset a field's value include that field name in the update mask and don't set the field in the HostCatalog.
UpdateHostCatalog(ctx context.Context, in *UpdateHostCatalogRequest, opts ...grpc.CallOption) (*UpdateHostCatalogResponse, error)
// Deleting a HostCatalog removes all hosts and host sets associated with this Catalog.
// DeleteHostCatalog removes a HostCatalog and all associated hosts and host sets from Watchtower. If the provided
// Org, Project, or HostCatalog ids are malformed or not provided DeleteHostCatalog returns an error. It is not
// an error to call DeleteHostCatalog for an Org, Project, or HostCatalog that does not exist as the response indicates
// if it existed or not.
DeleteHostCatalog(ctx context.Context, in *DeleteHostCatalogRequest, opts ...grpc.CallOption) (*DeleteHostCatalogResponse, error)
}
@@ -1089,12 +1103,26 @@ func (c *hostCatalogServiceClient) DeleteHostCatalog(ctx context.Context, in *De
// HostCatalogServiceServer is the server API for HostCatalogService service.
type HostCatalogServiceServer interface {
// This retrieves the host catalog specified in the request using the basic view.
// GetHostCatalog returns a stored Host Catalog if present. The provided request must include the org, project, and
// catalog id for the host catalog being retrieved. If any of those ids are missing, malformed, or reference a non
// existing resource an error is returned.
GetHostCatalog(context.Context, *GetHostCatalogRequest) (*GetHostCatalogResponse, error)
// ListHostCatalogs returns a list of stored HostCatalogs which exist inside the project referenced in the request.
// The request must include the org and project ids for the HostCatalogs being retrieved.
// If any of those ids are missing, malformed, or reference a non existing parent resource an error is returned.
ListHostCatalogs(context.Context, *ListHostCatalogsRequest) (*ListHostCatalogsResponse, error)
// CreateHostCatalog creates and stores a HostCatalog in watchtower. The provided request must include the org, and
// project id in which the catalog will be created and the catalog type to be created. If any of these required fields
// are missing, malformed, or reference a non existing parent resource an error is returned.
CreateHostCatalog(context.Context, *CreateHostCatalogRequest) (*CreateHostCatalogResponse, error)
// UpdateHostCatalog updates an exist HostCatalog in Watchtower. The provided HostCatalog must not have any read only
// fields set except for potentially the id. The update mask must be provided and include at least 1 mutable
// field. To unset a field's value include that field name in the update mask and don't set the field in the HostCatalog.
UpdateHostCatalog(context.Context, *UpdateHostCatalogRequest) (*UpdateHostCatalogResponse, error)
// Deleting a HostCatalog removes all hosts and host sets associated with this Catalog.
// DeleteHostCatalog removes a HostCatalog and all associated hosts and host sets from Watchtower. If the provided
// Org, Project, or HostCatalog ids are malformed or not provided DeleteHostCatalog returns an error. It is not
// an error to call DeleteHostCatalog for an Org, Project, or HostCatalog that does not exist as the response indicates
// if it existed or not.
DeleteHostCatalog(context.Context, *DeleteHostCatalogRequest) (*DeleteHostCatalogResponse, error)
}