// Code generated by go-swagger; DO NOT EDIT.

// Copyright Authors of Cilium
// SPDX-License-Identifier: Apache-2.0

package daemon

import (
	"context"
	"fmt"
	"io"
	"time"

	"github.com/go-openapi/runtime"
	httptransport "github.com/go-openapi/runtime/client"
	"github.com/go-openapi/strfmt"
)

// New creates a new daemon API client.
func New(transport runtime.ContextualTransport, formats strfmt.Registry) ClientService {
	return &Client{transport: transport, formats: formats}
}

// New creates a new daemon API client with basic auth credentials.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
	transport := httptransport.New(host, basePath, []string{scheme})
	transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
	return &Client{transport: transport, formats: strfmt.Default}
}

// New creates a new daemon API client with a bearer token for authentication.
//
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
	transport := httptransport.New(host, basePath, []string{scheme})
	transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
	return &Client{transport: transport, formats: strfmt.Default}
}

// Client for daemon API.
type Client struct {
	transport runtime.ContextualTransport
	formats   strfmt.Registry
}

// ClientOption may be used to customize the behavior of Client methods.
type ClientOption func(*runtime.ClientOperation)

// ClientService is the interface for Client methods.
type ClientService interface {

	// GetCgroupDumpMetadata retrieve cgroup metadata for all pods.
	GetCgroupDumpMetadata(params *GetCgroupDumpMetadataParams, opts ...ClientOption) (*GetCgroupDumpMetadataOK, error)

	// GetCgroupDumpMetadataContext retrieve cgroup metadata for all pods.
	GetCgroupDumpMetadataContext(ctx context.Context, params *GetCgroupDumpMetadataParams, opts ...ClientOption) (*GetCgroupDumpMetadataOK, error)

	// GetClusterNodes get nodes information stored in the cilium agent.
	GetClusterNodes(params *GetClusterNodesParams, opts ...ClientOption) (*GetClusterNodesOK, error)

	// GetClusterNodesContext get nodes information stored in the cilium agent.
	GetClusterNodesContext(ctx context.Context, params *GetClusterNodesParams, opts ...ClientOption) (*GetClusterNodesOK, error)

	// GetConfig get configuration of cilium daemon.
	GetConfig(params *GetConfigParams, opts ...ClientOption) (*GetConfigOK, error)

	// GetConfigContext get configuration of cilium daemon.
	GetConfigContext(ctx context.Context, params *GetConfigParams, opts ...ClientOption) (*GetConfigOK, error)

	// GetDebuginfo retrieve information about the agent and environment for debugging.
	GetDebuginfo(params *GetDebuginfoParams, opts ...ClientOption) (*GetDebuginfoOK, error)

	// GetDebuginfoContext retrieve information about the agent and environment for debugging.
	GetDebuginfoContext(ctx context.Context, params *GetDebuginfoParams, opts ...ClientOption) (*GetDebuginfoOK, error)

	// GetHealthz get health of cilium daemon.
	GetHealthz(params *GetHealthzParams, opts ...ClientOption) (*GetHealthzOK, error)

	// GetHealthzContext get health of cilium daemon.
	GetHealthzContext(ctx context.Context, params *GetHealthzParams, opts ...ClientOption) (*GetHealthzOK, error)

	// GetMap list all open maps.
	GetMap(params *GetMapParams, opts ...ClientOption) (*GetMapOK, error)

	// GetMapContext list all open maps.
	GetMapContext(ctx context.Context, params *GetMapParams, opts ...ClientOption) (*GetMapOK, error)

	// GetMapName retrieve contents of b p f map.
	GetMapName(params *GetMapNameParams, opts ...ClientOption) (*GetMapNameOK, error)

	// GetMapNameContext retrieve contents of b p f map.
	GetMapNameContext(ctx context.Context, params *GetMapNameParams, opts ...ClientOption) (*GetMapNameOK, error)

	// GetMapNameEvents retrieves the recent event logs associated with this endpoint.
	GetMapNameEvents(params *GetMapNameEventsParams, writer io.Writer, opts ...ClientOption) (*GetMapNameEventsOK, error)

	// GetMapNameEventsContext retrieves the recent event logs associated with this endpoint.
	GetMapNameEventsContext(ctx context.Context, params *GetMapNameEventsParams, writer io.Writer, opts ...ClientOption) (*GetMapNameEventsOK, error)

	// GetNodeIds list information about known node IDs.
	GetNodeIds(params *GetNodeIdsParams, opts ...ClientOption) (*GetNodeIdsOK, error)

	// GetNodeIdsContext list information about known node IDs.
	GetNodeIdsContext(ctx context.Context, params *GetNodeIdsParams, opts ...ClientOption) (*GetNodeIdsOK, error)

	// PatchConfig modify daemon configuration.
	PatchConfig(params *PatchConfigParams, opts ...ClientOption) (*PatchConfigOK, error)

	// PatchConfigContext modify daemon configuration.
	PatchConfigContext(ctx context.Context, params *PatchConfigParams, opts ...ClientOption) (*PatchConfigOK, error)

	SetTransport(transport runtime.ContextualTransport)
}

// GetCgroupDumpMetadata retrieves cgroup metadata for all pods.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.GetCgroupDumpMetadataContext] instead.
func (a *Client) GetCgroupDumpMetadata(params *GetCgroupDumpMetadataParams, opts ...ClientOption) (*GetCgroupDumpMetadataOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.GetCgroupDumpMetadataContext(ctx, params, opts...)
}

// GetCgroupDumpMetadataContext retrieves cgroup metadata for all pods.
//
// Do not use the deprecated [GetCgroupDumpMetadataParams.Context] with this method: it would be ignored.
func (a *Client) GetCgroupDumpMetadataContext(ctx context.Context, params *GetCgroupDumpMetadataParams, opts ...ClientOption) (*GetCgroupDumpMetadataOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewGetCgroupDumpMetadataParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "GetCgroupDumpMetadata",
		Method:             "GET",
		PathPattern:        "/cgroup-dump-metadata",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetCgroupDumpMetadataReader{formats: a.formats},
		Client:             params.HTTPClient,
	}

	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.SubmitContext(ctx, op)
	if err != nil {
		return nil, err
	}

	// only one success response has to be checked
	success, ok := result.(*GetCgroupDumpMetadataOK)
	if ok {
		return success, nil
	}

	// unexpected success response.

	// no default response is defined.
	//
	// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for GetCgroupDumpMetadata: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// GetClusterNodes gets nodes information stored in the cilium agent.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.GetClusterNodesContext] instead.
func (a *Client) GetClusterNodes(params *GetClusterNodesParams, opts ...ClientOption) (*GetClusterNodesOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.GetClusterNodesContext(ctx, params, opts...)
}

// GetClusterNodesContext gets nodes information stored in the cilium agent.
//
// Do not use the deprecated [GetClusterNodesParams.Context] with this method: it would be ignored.
func (a *Client) GetClusterNodesContext(ctx context.Context, params *GetClusterNodesParams, opts ...ClientOption) (*GetClusterNodesOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewGetClusterNodesParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "GetClusterNodes",
		Method:             "GET",
		PathPattern:        "/cluster/nodes",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetClusterNodesReader{formats: a.formats},
		Client:             params.HTTPClient,
	}

	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.SubmitContext(ctx, op)
	if err != nil {
		return nil, err
	}

	// only one success response has to be checked
	success, ok := result.(*GetClusterNodesOK)
	if ok {
		return success, nil
	}

	// unexpected success response.

	// no default response is defined.
	//
	// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for GetClusterNodes: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// GetConfig gets configuration of cilium daemon.
//
// Returns the configuration of the Cilium daemon.
// .
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.GetConfigContext] instead.
func (a *Client) GetConfig(params *GetConfigParams, opts ...ClientOption) (*GetConfigOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.GetConfigContext(ctx, params, opts...)
}

// GetConfigContext gets configuration of cilium daemon.
//
// Returns the configuration of the Cilium daemon.
// .
//
// Do not use the deprecated [GetConfigParams.Context] with this method: it would be ignored.
func (a *Client) GetConfigContext(ctx context.Context, params *GetConfigParams, opts ...ClientOption) (*GetConfigOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewGetConfigParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "GetConfig",
		Method:             "GET",
		PathPattern:        "/config",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetConfigReader{formats: a.formats},
		Client:             params.HTTPClient,
	}

	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.SubmitContext(ctx, op)
	if err != nil {
		return nil, err
	}

	// only one success response has to be checked
	success, ok := result.(*GetConfigOK)
	if ok {
		return success, nil
	}

	// unexpected success response.

	// no default response is defined.
	//
	// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for GetConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// GetDebuginfo retrieves information about the agent and environment for debugging.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.GetDebuginfoContext] instead.
func (a *Client) GetDebuginfo(params *GetDebuginfoParams, opts ...ClientOption) (*GetDebuginfoOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.GetDebuginfoContext(ctx, params, opts...)
}

// GetDebuginfoContext retrieves information about the agent and environment for debugging.
//
// Do not use the deprecated [GetDebuginfoParams.Context] with this method: it would be ignored.
func (a *Client) GetDebuginfoContext(ctx context.Context, params *GetDebuginfoParams, opts ...ClientOption) (*GetDebuginfoOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewGetDebuginfoParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "GetDebuginfo",
		Method:             "GET",
		PathPattern:        "/debuginfo",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetDebuginfoReader{formats: a.formats},
		Client:             params.HTTPClient,
	}

	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.SubmitContext(ctx, op)
	if err != nil {
		return nil, err
	}

	// only one success response has to be checked
	success, ok := result.(*GetDebuginfoOK)
	if ok {
		return success, nil
	}

	// unexpected success response.

	// no default response is defined.
	//
	// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for GetDebuginfo: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// GetHealthz gets health of cilium daemon.
//
// Returns health and status information of the Cilium daemon and related
// components such as the connected datastore, Kubernetes integration and
// Hubble.
// .
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.GetHealthzContext] instead.
func (a *Client) GetHealthz(params *GetHealthzParams, opts ...ClientOption) (*GetHealthzOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.GetHealthzContext(ctx, params, opts...)
}

// GetHealthzContext gets health of cilium daemon.
//
// Returns health and status information of the Cilium daemon and related
// components such as the connected datastore, Kubernetes integration and
// Hubble.
// .
//
// Do not use the deprecated [GetHealthzParams.Context] with this method: it would be ignored.
func (a *Client) GetHealthzContext(ctx context.Context, params *GetHealthzParams, opts ...ClientOption) (*GetHealthzOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewGetHealthzParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "GetHealthz",
		Method:             "GET",
		PathPattern:        "/healthz",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetHealthzReader{formats: a.formats},
		Client:             params.HTTPClient,
	}

	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.SubmitContext(ctx, op)
	if err != nil {
		return nil, err
	}

	// only one success response has to be checked
	success, ok := result.(*GetHealthzOK)
	if ok {
		return success, nil
	}

	// unexpected success response.

	// no default response is defined.
	//
	// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for GetHealthz: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// GetMap lists all open maps.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.GetMapContext] instead.
func (a *Client) GetMap(params *GetMapParams, opts ...ClientOption) (*GetMapOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.GetMapContext(ctx, params, opts...)
}

// GetMapContext lists all open maps.
//
// Do not use the deprecated [GetMapParams.Context] with this method: it would be ignored.
func (a *Client) GetMapContext(ctx context.Context, params *GetMapParams, opts ...ClientOption) (*GetMapOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewGetMapParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "GetMap",
		Method:             "GET",
		PathPattern:        "/map",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetMapReader{formats: a.formats},
		Client:             params.HTTPClient,
	}

	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.SubmitContext(ctx, op)
	if err != nil {
		return nil, err
	}

	// only one success response has to be checked
	success, ok := result.(*GetMapOK)
	if ok {
		return success, nil
	}

	// unexpected success response.

	// no default response is defined.
	//
	// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for GetMap: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// GetMapName retrieves contents of b p f map.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.GetMapNameContext] instead.
func (a *Client) GetMapName(params *GetMapNameParams, opts ...ClientOption) (*GetMapNameOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.GetMapNameContext(ctx, params, opts...)
}

// GetMapNameContext retrieves contents of b p f map.
//
// Do not use the deprecated [GetMapNameParams.Context] with this method: it would be ignored.
func (a *Client) GetMapNameContext(ctx context.Context, params *GetMapNameParams, opts ...ClientOption) (*GetMapNameOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewGetMapNameParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "GetMapName",
		Method:             "GET",
		PathPattern:        "/map/{name}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetMapNameReader{formats: a.formats},
		Client:             params.HTTPClient,
	}

	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.SubmitContext(ctx, op)
	if err != nil {
		return nil, err
	}

	// only one success response has to be checked
	success, ok := result.(*GetMapNameOK)
	if ok {
		return success, nil
	}

	// unexpected success response.

	// no default response is defined.
	//
	// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for GetMapName: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// GetMapNameEvents retrieves the recent event logs associated with this endpoint.
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.GetMapNameEventsContext] instead.
func (a *Client) GetMapNameEvents(params *GetMapNameEventsParams, writer io.Writer, opts ...ClientOption) (*GetMapNameEventsOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.GetMapNameEventsContext(ctx, params, writer, opts...)
}

// GetMapNameEventsContext retrieves the recent event logs associated with this endpoint.
//
// Do not use the deprecated [GetMapNameEventsParams.Context] with this method: it would be ignored.
func (a *Client) GetMapNameEventsContext(ctx context.Context, params *GetMapNameEventsParams, writer io.Writer, opts ...ClientOption) (*GetMapNameEventsOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewGetMapNameEventsParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "GetMapNameEvents",
		Method:             "GET",
		PathPattern:        "/map/{name}/events",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetMapNameEventsReader{formats: a.formats, writer: writer},
		Client:             params.HTTPClient,
	}

	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.SubmitContext(ctx, op)
	if err != nil {
		return nil, err
	}

	// only one success response has to be checked
	success, ok := result.(*GetMapNameEventsOK)
	if ok {
		return success, nil
	}

	// unexpected success response.

	// no default response is defined.
	//
	// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for GetMapNameEvents: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// GetNodeIds lists information about known node IDs.
//
// Retrieves a list of node IDs allocated by the agent and their
// associated node IP addresses.
// .
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.GetNodeIdsContext] instead.
func (a *Client) GetNodeIds(params *GetNodeIdsParams, opts ...ClientOption) (*GetNodeIdsOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.GetNodeIdsContext(ctx, params, opts...)
}

// GetNodeIdsContext lists information about known node IDs.
//
// Retrieves a list of node IDs allocated by the agent and their
// associated node IP addresses.
// .
//
// Do not use the deprecated [GetNodeIdsParams.Context] with this method: it would be ignored.
func (a *Client) GetNodeIdsContext(ctx context.Context, params *GetNodeIdsParams, opts ...ClientOption) (*GetNodeIdsOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewGetNodeIdsParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "GetNodeIds",
		Method:             "GET",
		PathPattern:        "/node/ids",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetNodeIdsReader{formats: a.formats},
		Client:             params.HTTPClient,
	}

	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.SubmitContext(ctx, op)
	if err != nil {
		return nil, err
	}

	// only one success response has to be checked
	success, ok := result.(*GetNodeIdsOK)
	if ok {
		return success, nil
	}

	// unexpected success response.

	// no default response is defined.
	//
	// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for GetNodeIds: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// PatchConfig modifies daemon configuration.
//
// Updates the daemon configuration by applying the provided
// ConfigurationMap and regenerates & recompiles all required datapath
// components.
// .
//
// This method does not support injected context.
// However, timeout and opentracing contexts are honored whenever enabled.
//
// If you need to pass a specific context, use [Client.PatchConfigContext] instead.
func (a *Client) PatchConfig(params *PatchConfigParams, opts ...ClientOption) (*PatchConfigOK, error) {
	var ctx context.Context
	if params.inner.ctx != nil {
		ctx = params.inner.ctx
	} else {
		ctx = context.Background()
	}

	return a.PatchConfigContext(ctx, params, opts...)
}

// PatchConfigContext modifies daemon configuration.
//
// Updates the daemon configuration by applying the provided
// ConfigurationMap and regenerates & recompiles all required datapath
// components.
// .
//
// Do not use the deprecated [PatchConfigParams.Context] with this method: it would be ignored.
func (a *Client) PatchConfigContext(ctx context.Context, params *PatchConfigParams, opts ...ClientOption) (*PatchConfigOK, error) {
	// NOTE: parameters are not validated before sending
	if params == nil {
		params = NewPatchConfigParams()
	}

	op := &runtime.ClientOperation{
		ID:                 "PatchConfig",
		Method:             "PATCH",
		PathPattern:        "/config",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &PatchConfigReader{formats: a.formats},
		Client:             params.HTTPClient,
	}

	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.SubmitContext(ctx, op)
	if err != nil {
		return nil, err
	}

	// only one success response has to be checked
	success, ok := result.(*PatchConfigOK)
	if ok {
		return success, nil
	}

	// unexpected success response.

	// no default response is defined.
	//
	// safeguard: normally, in the absence of a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for PatchConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ContextualTransport) {
	a.transport = transport
}

// innerParams captures internal fields so they don't conflict with user-supplied parameters.
type innerParams struct {
	timeout time.Duration

	// Deprecated: use the operation call with context to pass the context instead of [DaemonParams].
	ctx context.Context
}
