diff --git a/TEST_STAND/buck0/main.tf b/TEST_STAND/buck0/main.tf index 8da875a..21eae5e 100644 --- a/TEST_STAND/buck0/main.tf +++ b/TEST_STAND/buck0/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { nubes = { source = "terra.k8c.ru/nubes-test/nubes" - version = "5.0.69" + version = "5.0.70" } } } diff --git a/universal_rebuild/internal/core/client.go b/universal_rebuild/internal/core/client.go index 85082d8..8534a34 100644 --- a/universal_rebuild/internal/core/client.go +++ b/universal_rebuild/internal/core/client.go @@ -507,7 +507,7 @@ func (c *UniversalClient) FindInstanceByDisplayName(ctx context.Context, service if len(found) == 0 { page := 1 for { - reqURL := fmt.Sprintf("%s/instances?page=%d&size=100", c.ApiEndpoint, page) + reqURL := fmt.Sprintf("%s?endpoint=/instances&page=%d&size=100", c.ApiEndpoint, page) req, err := http.NewRequestWithContext(ctx, "GET", reqURL, nil) if err != nil { return nil, err @@ -581,7 +581,7 @@ func (c *UniversalClient) FindInstanceByDisplayName(ctx context.Context, service } func (c *UniversalClient) GetInstanceState(ctx context.Context, instanceUid string) (*InstanceStateResponse, error) { - url := fmt.Sprintf("%s/instances/%s", c.ApiEndpoint, instanceUid) + url := fmt.Sprintf("%s?endpoint=/instances/%s", c.ApiEndpoint, instanceUid) req, err := http.NewRequestWithContext(ctx, "GET", url, nil) if err != nil { return nil, err @@ -627,7 +627,7 @@ func isInstanceDeleted(state *InstanceStateResponse) bool { // GetInstanceStateRaw получает состояние инстанса БЕЗ валидации статуса. // Используется для проверки ref-параметров: нужно читать даже deleted/suspended инстансы. func (c *UniversalClient) GetInstanceStateRaw(ctx context.Context, instanceUid string) (*InstanceStateResponse, error) { - reqURL := fmt.Sprintf("%s/instances/%s", c.ApiEndpoint, instanceUid) + reqURL := fmt.Sprintf("%s?endpoint=/instances/%s", c.ApiEndpoint, instanceUid) req, err := http.NewRequestWithContext(ctx, "GET", reqURL, nil) if err != nil { return nil, err @@ -834,8 +834,23 @@ func (c *UniversalClient) doRequest(ctx context.Context, method, path string, pa } // ?endpoint= формат — как генератор (Python) и curl + endpointPath := path + extraQuery := "" + if idx := strings.Index(path, "?"); idx >= 0 { + endpointPath = path[:idx] + extraQuery = path[idx+1:] + } q := req.URL.Query() - q.Set("endpoint", path) + q.Set("endpoint", endpointPath) + if extraQuery != "" { + // Добавляем параметры из path в URL (не в endpoint) + for _, param := range strings.Split(extraQuery, "&") { + kv := strings.SplitN(param, "=", 2) + if len(kv) == 2 { + q.Set(kv[0], kv[1]) + } + } + } req.URL.RawQuery = q.Encode() req.Header.Set("User-Agent", userAgent) diff --git a/universal_rebuild/main.go b/universal_rebuild/main.go index e1f07e9..af5a54d 100644 --- a/universal_rebuild/main.go +++ b/universal_rebuild/main.go @@ -10,7 +10,7 @@ import ( ) var ( - version string = "5.0.69" + version string = "5.0.70" ) func main() {