googlecloudclustergke_impl

package
v0.49.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AutocompleteGKEClusterNamesTask = inspectiontaskbase.NewCachedTask(googlecloudclustergke_contract.AutocompleteGKEClusterNamesTaskID, []taskid.UntypedTaskReference{
	googlecloudclustergke_contract.ClusterListFetcherTaskID.Ref(),
	googlecloudcommon_contract.InputProjectIdTaskID.Ref(),
}, func(ctx context.Context, prevValue inspectiontaskbase.CacheableTaskResult[*googlecloudk8scommon_contract.AutocompleteClusterNameList]) (inspectiontaskbase.CacheableTaskResult[*googlecloudk8scommon_contract.AutocompleteClusterNameList], error) {
	listFetcher := coretask.GetTaskResult(ctx, googlecloudclustergke_contract.ClusterListFetcherTaskID.Ref())

	projectID := coretask.GetTaskResult(ctx, googlecloudcommon_contract.InputProjectIdTaskID.Ref())
	if projectID != "" && projectID == prevValue.DependencyDigest {
		return prevValue, nil
	}

	if projectID != "" {
		clusters, err := listFetcher.GetClusterNames(ctx, projectID)
		if err != nil {
			slog.WarnContext(ctx, "Failed to read cluster names for project", "projectID", projectID, "error", err)
			return inspectiontaskbase.CacheableTaskResult[*googlecloudk8scommon_contract.AutocompleteClusterNameList]{
				DependencyDigest: projectID,
				Value: &googlecloudk8scommon_contract.AutocompleteClusterNameList{
					ClusterNames: []string{},
					Error:        fmt.Sprintf("Failed to list GKE cluster names: %v", err),
				},
			}, nil
		}
		return inspectiontaskbase.CacheableTaskResult[*googlecloudk8scommon_contract.AutocompleteClusterNameList]{
			DependencyDigest: projectID,
			Value: &googlecloudk8scommon_contract.AutocompleteClusterNameList{
				ClusterNames: clusters,
				Error:        "",
			},
		}, nil
	}
	return inspectiontaskbase.CacheableTaskResult[*googlecloudk8scommon_contract.AutocompleteClusterNameList]{
		DependencyDigest: projectID,
		Value: &googlecloudk8scommon_contract.AutocompleteClusterNameList{
			ClusterNames: []string{},
			Error:        "Project ID is empty",
		},
	}, nil
}, inspectioncore_contract.InspectionTypeLabel(googlecloudclustergke_contract.InspectionTypeId))

AutocompleteGKEClusterNamesTask is a task that provides autocomplete suggestions for GKE cluster names.

ClusterListFetcherTask is a task to inject ClusterListFetcherImpl instance and enable tests to inject mock instance.

GKEClusterNamePrefixTask is a task that returns an empty string as the cluster name prefix for GKE. This task is necessary to satisfy the dependency of the log source profile, but GKE does not require a prefix.

Functions

func Register

func Register(registry coreinspection.InspectionTaskRegistry) error

Register registers all googlecloudclustergke inspection tasks to the registry.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL