k8s-openapi icon indicating copy to clipboard operation
k8s-openapi copied to clipboard

Add docs for naming conventions

Open Arnavion opened this issue 6 years ago • 0 comments

These are common to spec-generated clients of all languages, but it helps Rust devs who haven't used the other languages' clients before.

  • Resource types are under api, etc, then under modules corresponding to the API group and version, like core/v1/Pod -> core::v1::Pod

  • Functions are associated with the relevant resource type. Eg functions dealing with pods are found in api::core::v1::Pod's docs.

    Exceptions: Subresources like Status or pod logs are returned by functions of the base resource, eq Foo::read_*_status or Pod::read_namespaced_pod_log.

    Exceptions to the exceptions: Some subresources like api::authentication::v1::TokenRequest and api::core::v1::Binding are created from functions associated with their own type (TokenRequest::create_namespaced_service_account_token and Binding::create_namespaced_pod_binding respectively) instead of the parent resource's type.

  • Create a resource with create_*. Get an existing resource with read_*. Update with patch_*. Delete with delete_*. Delete a collection with delete_collection_*. Get a list of resources with list_*. Watch with watch_*.

  • _namespaced_ in the function name is just a convention for resources that are namespaced. (Are there resources that have both _namespaced_ and non-_namespaced_ functions to compare with?)

Arnavion avatar Sep 26 '19 15:09 Arnavion