cf-java-client icon indicating copy to clipboard operation
cf-java-client copied to clipboard

Provide organization suspensation in update method

Open andrejb-dev opened this issue 4 years ago • 4 comments

I tried to find how could I suspend an organization, based on the suspend option in update rest api endpoint http://v3-apidocs.cloudfoundry.org/version/3.101.0/index.html#update-an-organization

Definition

PATCH /v3/organizations/:guid

Optional parameters

Name Type Description
name string Organization name
suspended boolean Whether an organization is suspended or not
metadata.labels label object Labels applied to the organization
metadata.annotations annotation object Annotations applied to the organization

Did I overlooked it or is it possible to include this feature in the roadmap of the cf-java-client project? I found some status property, but I am not sure that it should be the suspend option, which is boolean

andrejb-dev avatar Jun 22 '21 08:06 andrejb-dev

Oh I found it I think - https://apidocs.cloudfoundry.org/16.13.0/organizations/update_an_organization.html

status Status of the organization   - active - suspended  

andrejb-dev avatar Jun 22 '21 09:06 andrejb-dev

It looks like it will vary based on the v2 or v3 API. The v2 has the status field, which takes active or suspended as a value. The v3 API appears to have a suspended field, which is a boolean (true/false). Both should work, but just an FYI that the v2 API is deprecated so long-term, you should go for the v3 API.

Hope that helps!

dmikusa avatar Jun 22 '21 13:06 dmikusa

Thank you for the response. In the client implementation of v3 api I did not found that suspended filed in the request object although api provides it

@JsonSerialize
@Value.Immutable
abstract class _UpdateOrganizationRequest {

    /**
     * The metadata
     */
    @JsonProperty("metadata")
    @Nullable
    abstract Metadata getMetadata();

    /**
     * The organization id
     */
    @JsonIgnore
    abstract String getOrganizationId();

}

andrejb-dev avatar Jun 22 '21 20:06 andrejb-dev

OK, it's possible that this field was added to the API after we initially added support into cf-java-client and it's missing that field. We'll need to add it in.

If you'd like to submit a PR, feel free. I can review and help to get it merged. That is always the quickest path. If not, I have updated the labels so this is flagged as a feature enhancement and we'll add it to the list.

Thanks

dmikusa avatar Jun 29 '21 20:06 dmikusa