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

client.request should also return the statuscode #28

Closed
clux opened this issue May 27, 2019 · 3 comments
Closed

client.request should also return the statuscode #28

clux opened this issue May 27, 2019 · 3 comments
Milestone

Comments

@clux
Copy link
Member

clux commented May 27, 2019

We often need a way to distinguish from CREATED, ACCEPTED, and OK as these often map to kube notions such as "configured", "created", "unchanged".

Document the common results in .create(), .replace() etc.

@clux clux closed this as completed in 5640b55 May 27, 2019
@clux
Copy link
Member Author

clux commented May 27, 2019

Have brute-forced this in. I'm assuming it's hideable by #23 for an easier interface.

@clux clux reopened this May 28, 2019
@clux clux added this to the 0.8.0 milestone May 28, 2019
@clux
Copy link
Member Author

clux commented May 28, 2019

Need to rethink this a bit for 0.8.0. The tuple is awkward in most cases. It seems that replace and create are the main users that can distinguish between OK/ACCEPTED/CREATED. Maybe think of something better for those?

delete_collection + delete is super weird: https://docs.rs/k8s-openapi/0.4.0/src/k8s_openapi/v1_13/api/apps/v1/deployment.rs.html
replace also acts on it:

pub enum DeleteNamespacedDeploymentResponse {
    OkStatus(crate::v1_13::apimachinery::pkg::apis::meta::v1::Status),
    OkValue(crate::v1_13::api::apps::v1::Deployment),
    Accepted(crate::v1_13::apimachinery::pkg::apis::meta::v1::Status),
    Unauthorized,
    Other,
}
pub enum DeleteNamespacedDeploymentResponse {
    OkStatus(crate::v1_13::apimachinery::pkg::apis::meta::v1::Status),
    OkValue(crate::v1_13::api::apps::v1::Deployment),
    Accepted(crate::v1_13::apimachinery::pkg::apis::meta::v1::Status),
    Unauthorized,
    Other,
}
pub enum CreateNamespacedDeploymentResponse {
    Ok(crate::v1_13::api::apps::v1::Deployment),
    Created(crate::v1_13::api::apps::v1::Deployment),
    Accepted(crate::v1_13::api::apps::v1::Deployment),
    Unauthorized,
    Other,
}
pub enum ReplaceNamespacedDeploymentResponse { // dittof for DeploymentStatus
    Ok(crate::v1_13::api::apps::v1::Deployment),
    Created(crate::v1_13::api::apps::v1::Deployment),
    Unauthorized,
    Other,
}

need to find appropriate kube docs to cross-reference..

@clux
Copy link
Member Author

clux commented May 28, 2019

OkStatus is actually not that weird! It's what we've called ApiError somewhat speculatively: https://github.com/kubernetes/apimachinery/blob/1f207b29b4411fb6ecfd342ae73fa60a921a5046/pkg/apis/meta/v1/types.go#L607-L638

By reading the api conventions doc we can see that it's actually returned on successful deletes as well! Although I've not actually seen an API call return that. Probably need some better tests.

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

No branches or pull requests

1 participant