Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add resource bundle api. #106

Merged

Conversation

morvencao
Copy link
Contributor

@morvencao morvencao commented May 30, 2024

This PR add GET and List Resource Bundle API.

Get by Resource Bundle ID:

# curl -k -X GET -H "Content-Type: application/json" \
    https://maestro.${external_apps_domain}/api/maestro/v1/resource-bundles/68ebf474-6709-48bb-b760-386181268060

List All Resource Bundles:

# curl -k -X GET -H "Content-Type: application/json" \
    https://maestro.${external_apps_domain}/api/maestro/v1/resource-bundles

List Search by Consumer Name:

# curl -k -X GET -H "Content-Type: application/json" \
    https://maestro.${external_apps_domain}/api/maestro/v1/resource-bundles?search=consumer_name%3D%27cluster1%27

List Search By Consumer Name and Resource Bundle Name:

curl -k -X GET -H "Content-Type: application/json" \
    https://maestro.${external_apps_domain}/api/maestro/v1/resource-bundles?search=consumer_name%3D%27cluster1%27%20and%20name%3D%27resbundle1%27

ref: #103

apiV1ResourceRouter.Use(authzMiddleware.AuthorizeApi)

apiV1ResourceBundleRouter := apiV1Router.PathPrefix("/resourcebundles").Subrouter()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend to separate words with hyphens. It is more user-friendly when it comes to long-path segmented URIs.

Copy link
Contributor Author

@morvencao morvencao May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to /resource-bundles.

@@ -70,3 +74,7 @@ func (d *resourceDaoMock) FindBySource(ctx context.Context, source string) (api.
func (d *resourceDaoMock) All(ctx context.Context) (api.ResourceList, error) {
return d.resources, nil
}

func (d *resourceDaoMock) AllBundle(ctx context.Context) (api.ResourceList, error) {
return api.ResourceList{}, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResourceList or ResourceBundleList?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need a new type? Currently, all resources (single and bundle) are stored in the resources table in the database. To simplify, I only converted the resource bundle before writing the HTTP response.

@morvencao morvencao force-pushed the br_add_resource_bundle_api branch 3 times, most recently from bad3965 to 2c6acf3 Compare May 31, 2024 07:35
@morvencao morvencao changed the title [WIP]add resource bundle api. add resource bundle api. May 31, 2024
@morvencao morvencao force-pushed the br_add_resource_bundle_api branch from 2c6acf3 to c21f1d2 Compare May 31, 2024 07:49
Signed-off-by: morvencao <[email protected]>
@morvencao morvencao force-pushed the br_add_resource_bundle_api branch from c21f1d2 to 90674e6 Compare May 31, 2024 08:10
@morvencao
Copy link
Contributor Author

/assign @qiujian16 @clyang82 @skeeey

@clyang82
Copy link
Contributor

clyang82 commented Jun 3, 2024

Could you update the README to include the resource_bundles api? maybe in grpc.md file?

@morvencao morvencao force-pushed the br_add_resource_bundle_api branch from 013e605 to 4a1f619 Compare June 3, 2024 07:15
@morvencao
Copy link
Contributor Author

Added document for how to create resource bundle with gRPC API, and how to get/list resource bundle with the new restful API.

Copy link
Contributor

@clyang82 clyang82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@clyang82 clyang82 merged commit be8dc75 into openshift-online:main Jun 3, 2024
1 of 2 checks passed
@morvencao morvencao deleted the br_add_resource_bundle_api branch June 3, 2024 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants