<p>I am using below line of code to get details about a particular PVC</p>

<pre><code>response = await `serverModule.kubeclient.api.v1.namespaces(ns).persistentvolumeclaims(pvc).get();`
</code></pre>

<p>The corresponding API for above call is <a href="https://github.com/kubernetes-client/java/blob/master/kubernetes/docs/CoreV1Api.md#readnamespacedpersistentvolumeclaim" rel="nofollow noreferrer">readNamespacedPersistentVolumeClaim</a> with below format</p>

<pre><code>GET /api/v1/namespaces/{namespace}/persistentvolumeclaims/{name}
</code></pre>

<p>Now, I am trying to call <a href="https://github.com/kubernetes-client/java/blob/master/kubernetes/docs/StorageV1Api.md#readstorageclass" rel="nofollow noreferrer">readStorageClass</a> using same convention as above</p>

<blockquote>
  <p>response = await serverModule.kubeclient.apis.storage.k8s.io.v1.storageclasses(sc).get();</p>
</blockquote>

<p>As you can see in the link, <code>GET /apis/storage.k8s.io/v1/storageclasses/{name}</code> is the format, I have used above syntax. But for some reason the code fails with error</p>

<pre><code>Exported kubeclient, ready to process requests
TypeError: Cannot read property 'k8s' of undefined
</code></pre>

<p>What is the syntax error that I have made. I tried various combinations but none worked.</p>

ambikanair
<p>This issue is listing <code>PersistentVolumeClaim</code> is a part of <code>coreV1Api</code> of kubernetes and listing <code>StorageClass</code> is the part of <code>StorageV1beta1Api</code>. Following it the simplest code for listing storage class using JAVA client:</p>

<pre><code>ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure API key authorization: BearerToken
ApiKeyAuth BearerToken = (ApiKeyAuth) defaultClient.getAuthentication("BearerToken");
BearerToken.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//BearerToken.setApiKeyPrefix("Token");

StorageV1beta1Api apiInstance = new StorageV1beta1Api();
try {
    V1beta1StorageClassList result = apiInstance.listStorageClass();
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling StorageV1beta1Api#listStorageClass");
    e.printStackTrace();
}
</code></pre>

<p>Following is the official documentation link for your reference:</p>

<p><a href="https://github.com/kubernetes-client/java/blob/master/kubernetes/docs/StorageV1beta1Api.md#listStorageClass" rel="nofollow noreferrer">https://github.com/kubernetes-client/java/blob/master/kubernetes/docs/StorageV1beta1Api.md#listStorageClass</a></p>

<p>Hope this helps.</p>
