<p>I'm trying to use the <a href="https://github.com/kubernetes/client-go" rel="nofollow noreferrer">K8S Go client</a> to list the <code>ClusterServiceVersion</code>s.
It could be enough to have the raw response body.</p>
<p>I've tried this:</p>
<pre class="lang-golang prettyprint-override"><code>data, err := clientset.RESTClient().Get().Namespace(namespace).
    Resource(&quot;ClusterServiceVersions&quot;).
    DoRaw(context.TODO())

if err != nil {
    panic(err.Error())
}

fmt.Printf(&quot;%v&quot;, string(data))
</code></pre>
<p>But it returns the following error:</p>
<pre><code>panic: the server could not find the requested resource (get ClusterServiceVersions.meta.k8s.io)
</code></pre>
<p>How do I specify to use the <code>operators.coreos.com</code> group?</p>
<p>Looking at <a href="https://github.com/operator-framework/operator-lifecycle-manager/blob/master/pkg/api/client/clientset/versioned/typed/operators/v1alpha1/clusterserviceversion.go#L90" rel="nofollow noreferrer">some existing code</a> I've also tried to add</p>
<pre class="lang-golang prettyprint-override"><code>VersionedParams(&amp;v1.ListOptions{}, scheme.ParameterCodec)
</code></pre>
<p>But it result in this other error:</p>
<pre><code>panic: v1.ListOptions is not suitable for converting to &quot;meta.k8s.io/v1&quot; in scheme &quot;pkg/runtime/scheme.go:100&quot;
</code></pre>

xonya
<p>It is possible to do a raw request using the <code>AbsPath()</code> method.</p>
<pre class="lang-golang prettyprint-override"><code>path := fmt.Sprintf(&quot;/apis/operators.coreos.com/v1alpha1/namespaces/%s/clusterserviceversions&quot;, namespace)

data, err := clientset.RESTClient().Get().
    AbsPath(path).
    DoRaw(ctx)
</code></pre>
<p>Also notice that if you want to define <code>clientset</code> using the interface (<code>kubernetes.Interface</code>) instead of the concrete type (<code>*kubernetes.Clientset</code>) the method <code>clientset.RESTClient()</code> is not directly accessible, but you can use the following one:</p>
<pre><code>clientset.Discovery().RESTClient()
</code></pre>
