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 "total_service_keys" to quota json unmarshalling #2881

Conversation

sleungcy-sap
Copy link

@sleungcy-sap sleungcy-sap commented May 6, 2024

Description of the Change

Consumers of this library can access the total_service_keys field from the api with this change.

Why Is This PR Valuable?

The value of this parameters is not included into unmarshalled data and is missing at the moment. The value should be available from the API as documented in https://v3-apidocs.cloudfoundry.org/version/3.163.0/#organization-quotas-in-v3

Copy link
Member

@gururajsh gururajsh left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution to CLI. Looks like this change needs to be applied at other places like quota_resource_test.go and space and org quota tests in different packages and several other non test files. Can you please update the PR with these changes?

The same goes for other PRs as well

@@ -71,6 +71,7 @@ func (al *AppLimit) UnmarshalJSON(rawJSON []byte) error {
type ServiceLimit struct {
TotalServiceInstances *types.NullInt `json:"total_service_instances,omitempty"`
PaidServicePlans *bool `json:"paid_services_allowed,omitempty"`
TotalServiceKeys *types.NullInt `json:"total_service_keys,omitempty"`
}

func (sl *ServiceLimit) UnmarshalJSON(rawJSON []byte) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

question Do we need some custom logic + test to handle the nil case? Seems like we have that already for TotalServiceInstances. See https://github.com/cloudfoundry/cli/pull/2881/files#diff-305a3cec50fa59b749c31f4599960a65a465a66bfca7afe1ccce4fcb58fad06eL87-L92

Copy link
Member

Choose a reason for hiding this comment

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

With this in mind, I'm curious to see the results of min_capi tests when they will get fixed.

@sleungcy-sap sleungcy-sap requested review from a-b, gururajsh and Samze May 15, 2024 23:08
@Samze
Copy link
Contributor

Samze commented May 17, 2024

LGTM, two quick questions I had is that while this change adds the definition to the go-lang structs, this does not add them to any CLI output https://github.com/cloudfoundry/cli/blob/main/command/v7/shared/quota_displayer.go#L57-L66

Firstly, @sleungcy-sap I want to double check that was the intention - this is just a change in the CLI library for consumers of the go module right?

Secondly (non-blocking on this MR), @a-b / @gururajsh if we have this in the struct - should we be adding this to the CLI output? The column output is treated like an API contract right, is there a process for adding new columns (e.g. can we just add a new column on the end or is this considered a breaking change)?

@sleungcy-sap
Copy link
Author

sleungcy-sap commented May 17, 2024

@Samze Yes, this change is for consumers of this repo as a go module

@Samze
Copy link
Contributor

Samze commented May 28, 2024

@sleungcy-sap we discussed this on the WG call this week. While the cli is listed as an experimental client, ideally we would not add functionality to the cli library without exposing the feature in the UX of the CLI itself.

As an alternative have you considered using https://github.com/cloudfoundry/go-cfclient which is now listed as the Go tools area in https://github.com/cloudfoundry/community/blob/main/toc/working-groups/app-runtime-interfaces.md.

If you are interested in expanding the PR to include contributions for UX changes, then we can discuss the next steps for that.

@gururajsh
Copy link
Member

Closing this PR for now, feel free to create an issue that includes a proposal for the UX changes.

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.

4 participants