|
5 | 5 | "encoding/json" |
6 | 6 | "fmt" |
7 | 7 | "io" |
| 8 | + "net/http" |
8 | 9 | "regexp" |
9 | 10 | "strings" |
10 | 11 |
|
@@ -129,7 +130,7 @@ func resourceStreamingSinkDelete(ctx context.Context, resourceData *schema.Resou |
129 | 130 | } |
130 | 131 |
|
131 | 132 | astraClient := meta.(astraClients).astraClient.(*astra.ClientWithResponses) |
132 | | - streamingClientv3 := meta.(astraClients).astraStreamingClientv3 |
| 133 | + streamingClientv3 := meta.(astraClients).astraStreamingClient.(*astrastreaming.ClientWithResponses) |
133 | 134 |
|
134 | 135 | tenantName := resourceData.Get("tenant_name").(string) |
135 | 136 | sinkName := resourceData.Get("sink_name").(string) |
@@ -202,7 +203,7 @@ type SinkResponse struct { |
202 | 203 |
|
203 | 204 | func resourceStreamingSinkRead(ctx context.Context, resourceData *schema.ResourceData, meta interface{}) diag.Diagnostics { |
204 | 205 | astraClient := meta.(astraClients).astraClient.(*astra.ClientWithResponses) |
205 | | - streamingClientv3 := meta.(astraClients).astraStreamingClientv3 |
| 206 | + streamingClientv3 := meta.(astraClients).astraStreamingClient.(*astrastreaming.ClientWithResponses) |
206 | 207 |
|
207 | 208 | tenantName := resourceData.Get("tenant_name").(string) |
208 | 209 | sinkName := resourceData.Get("sink_name").(string) |
@@ -249,7 +250,7 @@ func resourceStreamingSinkRead(ctx context.Context, resourceData *schema.Resourc |
249 | 250 |
|
250 | 251 | func resourceStreamingSinkCreate(ctx context.Context, resourceData *schema.ResourceData, meta interface{}) diag.Diagnostics { |
251 | 252 | astraClient := meta.(astraClients).astraClient.(*astra.ClientWithResponses) |
252 | | - streamingClientv3 := meta.(astraClients).astraStreamingClientv3 |
| 253 | + streamingClientv3 := meta.(astraClients).astraStreamingClient.(*astrastreaming.ClientWithResponses) |
253 | 254 |
|
254 | 255 | rawRegion := resourceData.Get("region").(string) |
255 | 256 | region := strings.ReplaceAll(rawRegion, "-", "") |
@@ -285,9 +286,8 @@ func resourceStreamingSinkCreate(ctx context.Context, resourceData *schema.Resou |
285 | 286 | return diag.FromErr(fmt.Errorf("failed to request pulsar clusters: %w", err)) |
286 | 287 | } |
287 | 288 |
|
288 | | - var streamingClusters StreamingClusters |
289 | | - if err = json.Unmarshal(streamingClustersResponse.Body, &streamingClusters); err != nil { |
290 | | - return diag.FromErr(fmt.Errorf("failed to read pulsar clusters: %w", err)) |
| 289 | + if streamingClustersResponse.StatusCode() != http.StatusOK { |
| 290 | + return diag.FromErr(fmt.Errorf("failed to read pulsar clusters. Status code: %s, msg:\n%s", streamingClustersResponse.Status(), string(streamingClustersResponse.Body))) |
291 | 291 | } |
292 | 292 |
|
293 | 293 | pulsarCluster := getPulsarCluster("", cloudProvider, region, "") |
|
0 commit comments