@@ -175,25 +175,19 @@ func (c *VenConnClient) PostDataReadingsWithOptions(readings []*api.DataReading,
175
175
return nil
176
176
}
177
177
178
- // Post performs an HTTP POST request.
179
- func (c * VenConnClient ) Post (path string , body io.Reader ) (* http.Response , error ) {
180
- _ , token , err := c .connHandler .Get (context .Background (), c .installNS , auth.Scope {}, types.NamespacedName {Name : c .venConnName , Namespace : c .venConnNS })
181
- if err != nil {
182
- return nil , fmt .Errorf ("while loading the VenafiConnection %s/%s: %w" , c .venConnNS , c .venConnName , err )
183
- }
184
-
185
- req , err := http .NewRequest (http .MethodPost , fullURL (c .baseURL , path ), body )
186
- if err != nil {
187
- return nil , err
188
- }
189
-
190
- req .Header .Set ("Content-Type" , "application/json" )
191
-
192
- if len (token .BearerToken ) > 0 {
193
- req .Header .Set ("Authorization" , fmt .Sprintf ("Bearer %s" , token .BearerToken ))
194
- }
178
+ // PostDataReadings isn't implemented for Venafi Cloud. This is because Venafi
179
+ // Cloud needs a `clusterName` and `clusterDescription`, but this function can
180
+ // only pass `orgID` and `clusterID` which are both useless in Venafi Cloud. Use
181
+ // PostDataReadingsWithOptions instead.
182
+ func (c * VenConnClient ) PostDataReadings (_orgID , _clusterID string , readings []* api.DataReading ) error {
183
+ return fmt .Errorf ("programmer mistake: PostDataReadings is not implemented for Venafi Cloud" )
184
+ }
195
185
196
- return c .client .Do (req )
186
+ // Post isn't implemented for Venafi Cloud because /v1/tlspk/upload/clusterdata
187
+ // requires using the query parameters `name` and `description` which can't be
188
+ // set using Post. Use PostDataReadingsWithOptions instead.
189
+ func (c * VenConnClient ) Post (path string , body io.Reader ) (* http.Response , error ) {
190
+ return nil , fmt .Errorf ("programmer mistake: Post is not implemented for Venafi Cloud" )
197
191
}
198
192
199
193
func loadRESTConfig (path string ) (* rest.Config , error ) {
0 commit comments