Applying Host Catalog comments to Projects (#105)

* NewService for the project service now returns a non pointer and an error.

* Replacing t.Fatal calls with require.NoError calls.

* Initialize empty slices following the recommended way.

* Don't inline the prefix strings when validating requests.

* Check error when cleaning up the test.

* Add check that update updates the time.

* Use google.golang.org/protobuf where possible instead of github.com/golang/protobuf.

* Shorten the validateX function names.

* Inline API responses.

* Change test cleanup error logging to t.Errorf.

* Remove unneeded creation of an extra project.

* Inline regex check for invalid id.

* Build the pb.Project inline when converting from db to wire proto.

* Change stored repos into repo creating functions.

* Using iam.TestScopes instead of creating them myself.

* Remove out of date comments.

* Update name to match go test naming standards.

* Adding project service comments.

* Using scopeType's new prefix method inside scope.go

* Setting test project's name and desc to default to pass tests.

* Change host catalog to project in test.

* Fixing merge errors.

* Fixing some more merge errors.

* Fix typo in comments.

* Fix typos in project_service.go.

* Update error indicating provided id and the expected prefix.

* Make the RepoFactory types in a common directory.
This commit is contained in:
Todd Knight authored and GitHub committed 2020-06-08 14:43:13 -07:00
1 parent b016498d96
commit 6804c98b0b
11 files changed
+321 -245

No files matched your search

@@ -1025,26 +1025,34 @@ 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 {
// 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 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 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 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 updates an exist HostCatalog in Watchtower. The
// provided HostCatalog must not have any read only fields set.
// 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)
// 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 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)
}
@@ -1103,26 +1111,34 @@ func (c *hostCatalogServiceClient) DeleteHostCatalog(ctx context.Context, in *De
// HostCatalogServiceServer is the server API for HostCatalogService service.
type HostCatalogServiceServer interface {
// 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 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 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 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 updates an exist HostCatalog in Watchtower. The
// provided HostCatalog must not have any read only fields set.
// 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)
// 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 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)
}
@@ -933,10 +933,36 @@ 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 ProjectServiceClient interface {
// GetProject returns a stored Project if present. The provided request
// must include the org and project id for the project being retrieved. If
// any of those ids are missing, malformed or reference a non existing
// resource an error is returned.
GetProject(ctx context.Context, in *GetProjectRequest, opts ...grpc.CallOption) (*GetProjectResponse, error)
// ListProjects returns a list of stored projects which exist inside the org
// referenced inside the request. The request must include the org id for
// the projects being retrieved. If the org id is missing, malformed, or
// reference a non existing organization, an error is returned.
ListProjects(ctx context.Context, in *ListProjectsRequest, opts ...grpc.CallOption) (*ListProjectsResponse, error)
// CreateProject creates and stores a project in watchtower. The provided
// request must include the org id in which the project will be created.
// If the org id is missing, malformed or references a non existing
// organization, an error is returned. If a name is provided that is in
// use in another project in the same organization, an error is returned.
CreateProject(ctx context.Context, in *CreateProjectRequest, opts ...grpc.CallOption) (*CreateProjectResponse, error)
// UpdateProject updates an existing project in watchtower. The provided
// project must not have any read only fields set. The update mask must be
// 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
// in the provided project. An error is returned if either the organization
// or project ids are 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 organization.
UpdateProject(ctx context.Context, in *UpdateProjectRequest, opts ...grpc.CallOption) (*UpdateProjectResponse, error)
// DeleteProject remotes a project and all child resources from Watchtower.
// If the provided org or project ids are malformed or not provided an error
// is returned. No error is returned if either ids reference resources that
// do not exist as the response itself specifies if the resource existed
// before the DeleteProject request was received.
DeleteProject(ctx context.Context, in *DeleteProjectRequest, opts ...grpc.CallOption) (*DeleteProjectResponse, error)
}
@@ -995,10 +1021,36 @@ func (c *projectServiceClient) DeleteProject(ctx context.Context, in *DeleteProj
// ProjectServiceServer is the server API for ProjectService service.
type ProjectServiceServer interface {
// GetProject returns a stored Project if present. The provided request
// must include the org and project id for the project being retrieved. If
// any of those ids are missing, malformed or reference a non existing
// resource an error is returned.
GetProject(context.Context, *GetProjectRequest) (*GetProjectResponse, error)
// ListProjects returns a list of stored projects which exist inside the org
// referenced inside the request. The request must include the org id for
// the projects being retrieved. If the org id is missing, malformed, or
// reference a non existing organization, an error is returned.
ListProjects(context.Context, *ListProjectsRequest) (*ListProjectsResponse, error)
// CreateProject creates and stores a project in watchtower. The provided
// request must include the org id in which the project will be created.
// If the org id is missing, malformed or references a non existing
// organization, an error is returned. If a name is provided that is in
// use in another project in the same organization, an error is returned.
CreateProject(context.Context, *CreateProjectRequest) (*CreateProjectResponse, error)
// UpdateProject updates an existing project in watchtower. The provided
// project must not have any read only fields set. The update mask must be
// 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
// in the provided project. An error is returned if either the organization
// or project ids are 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 organization.
UpdateProject(context.Context, *UpdateProjectRequest) (*UpdateProjectResponse, error)
// DeleteProject remotes a project and all child resources from Watchtower.
// If the provided org or project ids are malformed or not provided an error
// is returned. No error is returned if either ids reference resources that
// do not exist as the response itself specifies if the resource existed
// before the DeleteProject request was received.
DeleteProject(context.Context, *DeleteProjectRequest) (*DeleteProjectResponse, error)
}