serviceapi

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceAPI

type ServiceAPI struct {
	// contains filtered or unexported fields
}

ServiceAPI provides high-level methods for retrieving Kubernetes services.

func NewServiceAPI

func NewServiceAPI(client kubernetes.Interface) *ServiceAPI

NewServiceAPI creates a new ServiceAPI instance using the provided client.

func (*ServiceAPI) GetServiceByName

func (s *ServiceAPI) GetServiceByName(ctx context.Context, namespace, name string) (*corev1.Service, error)

GetServiceByName retrieves a specific Service by namespace and name.

Parameters:

  • ctx: Context for cancellation.
  • namespace: Namespace of the service (must be non-empty).
  • name: Name of the service (must be non-empty).

Returns the matched *corev1.Service or an error if not found or invalid.

func (*ServiceAPI) ListServicesByField

func (s *ServiceAPI) ListServicesByField(ctx context.Context, namespace string, fieldSelector string) ([]corev1.Service, error)

ListServicesByField lists services by namespace and field selector.

Parameters:

  • ctx: Context for cancellation.
  • namespace: Namespace scope.
  • fieldSelector: Kubernetes field selector syntax.

Returns all matching services or an error.

func (*ServiceAPI) ListServicesByLabel

func (s *ServiceAPI) ListServicesByLabel(ctx context.Context, namespace string, labelSelector string) ([]corev1.Service, error)

ListServicesByLabel lists services by namespace and label selector.

Parameters:

  • ctx: Context for cancellation.
  • namespace: Namespace scope.
  • labelSelector: Kubernetes label selector syntax.

Returns all matching services or an error.

Jump to

Keyboard shortcuts

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