fix(provider): detect source code drift and validate package/function references
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package resources
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
"terraform-provider-fission/internal/client"
|
||||
)
|
||||
|
||||
func ensureEnvironmentExists(ctx context.Context, fissionClient *client.Client, namespace, name string) error {
|
||||
_, err := fissionClient.GetEnvironment(ctx, namespace, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("environment %q не найден в namespace %q: %w", name, namespace, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func ensurePackageExists(ctx context.Context, fissionClient *client.Client, namespace, name string) (*unstructured.Unstructured, error) {
|
||||
pkg, err := fissionClient.GetPackage(ctx, namespace, name)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("package %q не найден в namespace %q: %w", name, namespace, err)
|
||||
}
|
||||
|
||||
return pkg, nil
|
||||
}
|
||||
Reference in New Issue
Block a user