cloudfoundry / cf-java-client

Java Client Library for Cloud Foundry
Apache License 2.0
328 stars 318 forks source link

Provide organization suspensation in update method #1106

Open andrejb-dev opened 3 years ago

andrejb-dev commented 3 years ago

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 commented 3 years ago

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 |   -- | -- | -- | -- | --
dmikusa commented 3 years ago

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!

andrejb-dev commented 3 years ago

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();

}
dmikusa commented 3 years ago

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