// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT.
// source: livekit_cloud_agent.proto

package livekit

import context "context"
import fmt "fmt"
import http "net/http"
import io "io"
import json "encoding/json"
import strconv "strconv"
import strings "strings"

import protojson "google.golang.org/protobuf/encoding/protojson"
import proto "google.golang.org/protobuf/proto"
import twirp "github.com/twitchtv/twirp"
import ctxsetters "github.com/twitchtv/twirp/ctxsetters"

// Version compatibility assertion.
// If the constant is not defined in the package, that likely means
// the package needs to be updated to work with this generated code.
// See https://twitchtv.github.io/twirp/docs/version_matrix.html
const _ = twirp.TwirpPackageMinVersion_8_1_0

// ====================
// CloudAgent Interface
// ====================

type CloudAgent interface {
	CreateAgent(context.Context, *CreateAgentRequest) (*CreateAgentResponse, error)

	ListAgents(context.Context, *ListAgentsRequest) (*ListAgentsResponse, error)

	ListAgentVersions(context.Context, *ListAgentVersionsRequest) (*ListAgentVersionsResponse, error)

	ListAgentSecrets(context.Context, *ListAgentSecretsRequest) (*ListAgentSecretsResponse, error)

	UpdateAgent(context.Context, *UpdateAgentRequest) (*UpdateAgentResponse, error)

	RestartAgent(context.Context, *RestartAgentRequest) (*RestartAgentResponse, error)

	DeployAgent(context.Context, *DeployAgentRequest) (*DeployAgentResponse, error)

	UpdateAgentSecrets(context.Context, *UpdateAgentSecretsRequest) (*UpdateAgentSecretsResponse, error)

	RollbackAgent(context.Context, *RollbackAgentRequest) (*RollbackAgentResponse, error)

	DeleteAgent(context.Context, *DeleteAgentRequest) (*DeleteAgentResponse, error)

	GetClientSettings(context.Context, *ClientSettingsRequest) (*ClientSettingsResponse, error)
}

// ==========================
// CloudAgent Protobuf Client
// ==========================

type cloudAgentProtobufClient struct {
	client      HTTPClient
	urls        [11]string
	interceptor twirp.Interceptor
	opts        twirp.ClientOptions
}

// NewCloudAgentProtobufClient creates a Protobuf client that implements the CloudAgent interface.
// It communicates using Protobuf and can be configured with a custom HTTPClient.
func NewCloudAgentProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) CloudAgent {
	if c, ok := client.(*http.Client); ok {
		client = withoutRedirects(c)
	}

	clientOpts := twirp.ClientOptions{}
	for _, o := range opts {
		o(&clientOpts)
	}

	// Using ReadOpt allows backwards and forwards compatibility with new options in the future
	literalURLs := false
	_ = clientOpts.ReadOpt("literalURLs", &literalURLs)
	var pathPrefix string
	if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok {
		pathPrefix = "/twirp" // default prefix
	}

	// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>
	serviceURL := sanitizeBaseURL(baseURL)
	serviceURL += baseServicePath(pathPrefix, "livekit", "CloudAgent")
	urls := [11]string{
		serviceURL + "CreateAgent",
		serviceURL + "ListAgents",
		serviceURL + "ListAgentVersions",
		serviceURL + "ListAgentSecrets",
		serviceURL + "UpdateAgent",
		serviceURL + "RestartAgent",
		serviceURL + "DeployAgent",
		serviceURL + "UpdateAgentSecrets",
		serviceURL + "RollbackAgent",
		serviceURL + "DeleteAgent",
		serviceURL + "GetClientSettings",
	}

	return &cloudAgentProtobufClient{
		client:      client,
		urls:        urls,
		interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),
		opts:        clientOpts,
	}
}

func (c *cloudAgentProtobufClient) CreateAgent(ctx context.Context, in *CreateAgentRequest) (*CreateAgentResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "CreateAgent")
	caller := c.callCreateAgent
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *CreateAgentRequest) (*CreateAgentResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*CreateAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*CreateAgentRequest) when calling interceptor")
					}
					return c.callCreateAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*CreateAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*CreateAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentProtobufClient) callCreateAgent(ctx context.Context, in *CreateAgentRequest) (*CreateAgentResponse, error) {
	out := new(CreateAgentResponse)
	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentProtobufClient) ListAgents(ctx context.Context, in *ListAgentsRequest) (*ListAgentsResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "ListAgents")
	caller := c.callListAgents
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *ListAgentsRequest) (*ListAgentsResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ListAgentsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ListAgentsRequest) when calling interceptor")
					}
					return c.callListAgents(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ListAgentsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ListAgentsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentProtobufClient) callListAgents(ctx context.Context, in *ListAgentsRequest) (*ListAgentsResponse, error) {
	out := new(ListAgentsResponse)
	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentProtobufClient) ListAgentVersions(ctx context.Context, in *ListAgentVersionsRequest) (*ListAgentVersionsResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "ListAgentVersions")
	caller := c.callListAgentVersions
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *ListAgentVersionsRequest) (*ListAgentVersionsResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ListAgentVersionsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ListAgentVersionsRequest) when calling interceptor")
					}
					return c.callListAgentVersions(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ListAgentVersionsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ListAgentVersionsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentProtobufClient) callListAgentVersions(ctx context.Context, in *ListAgentVersionsRequest) (*ListAgentVersionsResponse, error) {
	out := new(ListAgentVersionsResponse)
	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentProtobufClient) ListAgentSecrets(ctx context.Context, in *ListAgentSecretsRequest) (*ListAgentSecretsResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "ListAgentSecrets")
	caller := c.callListAgentSecrets
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *ListAgentSecretsRequest) (*ListAgentSecretsResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ListAgentSecretsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ListAgentSecretsRequest) when calling interceptor")
					}
					return c.callListAgentSecrets(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ListAgentSecretsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ListAgentSecretsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentProtobufClient) callListAgentSecrets(ctx context.Context, in *ListAgentSecretsRequest) (*ListAgentSecretsResponse, error) {
	out := new(ListAgentSecretsResponse)
	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentProtobufClient) UpdateAgent(ctx context.Context, in *UpdateAgentRequest) (*UpdateAgentResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "UpdateAgent")
	caller := c.callUpdateAgent
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *UpdateAgentRequest) (*UpdateAgentResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*UpdateAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*UpdateAgentRequest) when calling interceptor")
					}
					return c.callUpdateAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*UpdateAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*UpdateAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentProtobufClient) callUpdateAgent(ctx context.Context, in *UpdateAgentRequest) (*UpdateAgentResponse, error) {
	out := new(UpdateAgentResponse)
	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentProtobufClient) RestartAgent(ctx context.Context, in *RestartAgentRequest) (*RestartAgentResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "RestartAgent")
	caller := c.callRestartAgent
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *RestartAgentRequest) (*RestartAgentResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*RestartAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*RestartAgentRequest) when calling interceptor")
					}
					return c.callRestartAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*RestartAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*RestartAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentProtobufClient) callRestartAgent(ctx context.Context, in *RestartAgentRequest) (*RestartAgentResponse, error) {
	out := new(RestartAgentResponse)
	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[5], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentProtobufClient) DeployAgent(ctx context.Context, in *DeployAgentRequest) (*DeployAgentResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "DeployAgent")
	caller := c.callDeployAgent
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *DeployAgentRequest) (*DeployAgentResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*DeployAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*DeployAgentRequest) when calling interceptor")
					}
					return c.callDeployAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*DeployAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*DeployAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentProtobufClient) callDeployAgent(ctx context.Context, in *DeployAgentRequest) (*DeployAgentResponse, error) {
	out := new(DeployAgentResponse)
	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[6], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentProtobufClient) UpdateAgentSecrets(ctx context.Context, in *UpdateAgentSecretsRequest) (*UpdateAgentSecretsResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "UpdateAgentSecrets")
	caller := c.callUpdateAgentSecrets
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *UpdateAgentSecretsRequest) (*UpdateAgentSecretsResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*UpdateAgentSecretsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*UpdateAgentSecretsRequest) when calling interceptor")
					}
					return c.callUpdateAgentSecrets(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*UpdateAgentSecretsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*UpdateAgentSecretsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentProtobufClient) callUpdateAgentSecrets(ctx context.Context, in *UpdateAgentSecretsRequest) (*UpdateAgentSecretsResponse, error) {
	out := new(UpdateAgentSecretsResponse)
	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[7], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentProtobufClient) RollbackAgent(ctx context.Context, in *RollbackAgentRequest) (*RollbackAgentResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "RollbackAgent")
	caller := c.callRollbackAgent
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *RollbackAgentRequest) (*RollbackAgentResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*RollbackAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*RollbackAgentRequest) when calling interceptor")
					}
					return c.callRollbackAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*RollbackAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*RollbackAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentProtobufClient) callRollbackAgent(ctx context.Context, in *RollbackAgentRequest) (*RollbackAgentResponse, error) {
	out := new(RollbackAgentResponse)
	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[8], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentProtobufClient) DeleteAgent(ctx context.Context, in *DeleteAgentRequest) (*DeleteAgentResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "DeleteAgent")
	caller := c.callDeleteAgent
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *DeleteAgentRequest) (*DeleteAgentResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*DeleteAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*DeleteAgentRequest) when calling interceptor")
					}
					return c.callDeleteAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*DeleteAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*DeleteAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentProtobufClient) callDeleteAgent(ctx context.Context, in *DeleteAgentRequest) (*DeleteAgentResponse, error) {
	out := new(DeleteAgentResponse)
	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[9], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentProtobufClient) GetClientSettings(ctx context.Context, in *ClientSettingsRequest) (*ClientSettingsResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "GetClientSettings")
	caller := c.callGetClientSettings
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *ClientSettingsRequest) (*ClientSettingsResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ClientSettingsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ClientSettingsRequest) when calling interceptor")
					}
					return c.callGetClientSettings(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ClientSettingsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ClientSettingsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentProtobufClient) callGetClientSettings(ctx context.Context, in *ClientSettingsRequest) (*ClientSettingsResponse, error) {
	out := new(ClientSettingsResponse)
	ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[10], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

// ======================
// CloudAgent JSON Client
// ======================

type cloudAgentJSONClient struct {
	client      HTTPClient
	urls        [11]string
	interceptor twirp.Interceptor
	opts        twirp.ClientOptions
}

// NewCloudAgentJSONClient creates a JSON client that implements the CloudAgent interface.
// It communicates using JSON and can be configured with a custom HTTPClient.
func NewCloudAgentJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) CloudAgent {
	if c, ok := client.(*http.Client); ok {
		client = withoutRedirects(c)
	}

	clientOpts := twirp.ClientOptions{}
	for _, o := range opts {
		o(&clientOpts)
	}

	// Using ReadOpt allows backwards and forwards compatibility with new options in the future
	literalURLs := false
	_ = clientOpts.ReadOpt("literalURLs", &literalURLs)
	var pathPrefix string
	if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok {
		pathPrefix = "/twirp" // default prefix
	}

	// Build method URLs: <baseURL>[<prefix>]/<package>.<Service>/<Method>
	serviceURL := sanitizeBaseURL(baseURL)
	serviceURL += baseServicePath(pathPrefix, "livekit", "CloudAgent")
	urls := [11]string{
		serviceURL + "CreateAgent",
		serviceURL + "ListAgents",
		serviceURL + "ListAgentVersions",
		serviceURL + "ListAgentSecrets",
		serviceURL + "UpdateAgent",
		serviceURL + "RestartAgent",
		serviceURL + "DeployAgent",
		serviceURL + "UpdateAgentSecrets",
		serviceURL + "RollbackAgent",
		serviceURL + "DeleteAgent",
		serviceURL + "GetClientSettings",
	}

	return &cloudAgentJSONClient{
		client:      client,
		urls:        urls,
		interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...),
		opts:        clientOpts,
	}
}

func (c *cloudAgentJSONClient) CreateAgent(ctx context.Context, in *CreateAgentRequest) (*CreateAgentResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "CreateAgent")
	caller := c.callCreateAgent
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *CreateAgentRequest) (*CreateAgentResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*CreateAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*CreateAgentRequest) when calling interceptor")
					}
					return c.callCreateAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*CreateAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*CreateAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentJSONClient) callCreateAgent(ctx context.Context, in *CreateAgentRequest) (*CreateAgentResponse, error) {
	out := new(CreateAgentResponse)
	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentJSONClient) ListAgents(ctx context.Context, in *ListAgentsRequest) (*ListAgentsResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "ListAgents")
	caller := c.callListAgents
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *ListAgentsRequest) (*ListAgentsResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ListAgentsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ListAgentsRequest) when calling interceptor")
					}
					return c.callListAgents(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ListAgentsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ListAgentsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentJSONClient) callListAgents(ctx context.Context, in *ListAgentsRequest) (*ListAgentsResponse, error) {
	out := new(ListAgentsResponse)
	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentJSONClient) ListAgentVersions(ctx context.Context, in *ListAgentVersionsRequest) (*ListAgentVersionsResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "ListAgentVersions")
	caller := c.callListAgentVersions
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *ListAgentVersionsRequest) (*ListAgentVersionsResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ListAgentVersionsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ListAgentVersionsRequest) when calling interceptor")
					}
					return c.callListAgentVersions(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ListAgentVersionsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ListAgentVersionsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentJSONClient) callListAgentVersions(ctx context.Context, in *ListAgentVersionsRequest) (*ListAgentVersionsResponse, error) {
	out := new(ListAgentVersionsResponse)
	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentJSONClient) ListAgentSecrets(ctx context.Context, in *ListAgentSecretsRequest) (*ListAgentSecretsResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "ListAgentSecrets")
	caller := c.callListAgentSecrets
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *ListAgentSecretsRequest) (*ListAgentSecretsResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ListAgentSecretsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ListAgentSecretsRequest) when calling interceptor")
					}
					return c.callListAgentSecrets(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ListAgentSecretsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ListAgentSecretsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentJSONClient) callListAgentSecrets(ctx context.Context, in *ListAgentSecretsRequest) (*ListAgentSecretsResponse, error) {
	out := new(ListAgentSecretsResponse)
	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentJSONClient) UpdateAgent(ctx context.Context, in *UpdateAgentRequest) (*UpdateAgentResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "UpdateAgent")
	caller := c.callUpdateAgent
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *UpdateAgentRequest) (*UpdateAgentResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*UpdateAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*UpdateAgentRequest) when calling interceptor")
					}
					return c.callUpdateAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*UpdateAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*UpdateAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentJSONClient) callUpdateAgent(ctx context.Context, in *UpdateAgentRequest) (*UpdateAgentResponse, error) {
	out := new(UpdateAgentResponse)
	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentJSONClient) RestartAgent(ctx context.Context, in *RestartAgentRequest) (*RestartAgentResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "RestartAgent")
	caller := c.callRestartAgent
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *RestartAgentRequest) (*RestartAgentResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*RestartAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*RestartAgentRequest) when calling interceptor")
					}
					return c.callRestartAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*RestartAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*RestartAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentJSONClient) callRestartAgent(ctx context.Context, in *RestartAgentRequest) (*RestartAgentResponse, error) {
	out := new(RestartAgentResponse)
	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[5], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentJSONClient) DeployAgent(ctx context.Context, in *DeployAgentRequest) (*DeployAgentResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "DeployAgent")
	caller := c.callDeployAgent
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *DeployAgentRequest) (*DeployAgentResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*DeployAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*DeployAgentRequest) when calling interceptor")
					}
					return c.callDeployAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*DeployAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*DeployAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentJSONClient) callDeployAgent(ctx context.Context, in *DeployAgentRequest) (*DeployAgentResponse, error) {
	out := new(DeployAgentResponse)
	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[6], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentJSONClient) UpdateAgentSecrets(ctx context.Context, in *UpdateAgentSecretsRequest) (*UpdateAgentSecretsResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "UpdateAgentSecrets")
	caller := c.callUpdateAgentSecrets
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *UpdateAgentSecretsRequest) (*UpdateAgentSecretsResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*UpdateAgentSecretsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*UpdateAgentSecretsRequest) when calling interceptor")
					}
					return c.callUpdateAgentSecrets(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*UpdateAgentSecretsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*UpdateAgentSecretsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentJSONClient) callUpdateAgentSecrets(ctx context.Context, in *UpdateAgentSecretsRequest) (*UpdateAgentSecretsResponse, error) {
	out := new(UpdateAgentSecretsResponse)
	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[7], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentJSONClient) RollbackAgent(ctx context.Context, in *RollbackAgentRequest) (*RollbackAgentResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "RollbackAgent")
	caller := c.callRollbackAgent
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *RollbackAgentRequest) (*RollbackAgentResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*RollbackAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*RollbackAgentRequest) when calling interceptor")
					}
					return c.callRollbackAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*RollbackAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*RollbackAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentJSONClient) callRollbackAgent(ctx context.Context, in *RollbackAgentRequest) (*RollbackAgentResponse, error) {
	out := new(RollbackAgentResponse)
	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[8], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentJSONClient) DeleteAgent(ctx context.Context, in *DeleteAgentRequest) (*DeleteAgentResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "DeleteAgent")
	caller := c.callDeleteAgent
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *DeleteAgentRequest) (*DeleteAgentResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*DeleteAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*DeleteAgentRequest) when calling interceptor")
					}
					return c.callDeleteAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*DeleteAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*DeleteAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentJSONClient) callDeleteAgent(ctx context.Context, in *DeleteAgentRequest) (*DeleteAgentResponse, error) {
	out := new(DeleteAgentResponse)
	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[9], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

func (c *cloudAgentJSONClient) GetClientSettings(ctx context.Context, in *ClientSettingsRequest) (*ClientSettingsResponse, error) {
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithMethodName(ctx, "GetClientSettings")
	caller := c.callGetClientSettings
	if c.interceptor != nil {
		caller = func(ctx context.Context, req *ClientSettingsRequest) (*ClientSettingsResponse, error) {
			resp, err := c.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ClientSettingsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ClientSettingsRequest) when calling interceptor")
					}
					return c.callGetClientSettings(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ClientSettingsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ClientSettingsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}
	return caller(ctx, in)
}

func (c *cloudAgentJSONClient) callGetClientSettings(ctx context.Context, in *ClientSettingsRequest) (*ClientSettingsResponse, error) {
	out := new(ClientSettingsResponse)
	ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[10], in, out)
	if err != nil {
		twerr, ok := err.(twirp.Error)
		if !ok {
			twerr = twirp.InternalErrorWith(err)
		}
		callClientError(ctx, c.opts.Hooks, twerr)
		return nil, err
	}

	callClientResponseReceived(ctx, c.opts.Hooks)

	return out, nil
}

// =========================
// CloudAgent Server Handler
// =========================

type cloudAgentServer struct {
	CloudAgent
	interceptor      twirp.Interceptor
	hooks            *twirp.ServerHooks
	pathPrefix       string // prefix for routing
	jsonSkipDefaults bool   // do not include unpopulated fields (default values) in the response
	jsonCamelCase    bool   // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names
}

// NewCloudAgentServer builds a TwirpServer that can be used as an http.Handler to handle
// HTTP requests that are routed to the right method in the provided svc implementation.
// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).
func NewCloudAgentServer(svc CloudAgent, opts ...interface{}) TwirpServer {
	serverOpts := newServerOpts(opts)

	// Using ReadOpt allows backwards and forwards compatibility with new options in the future
	jsonSkipDefaults := false
	_ = serverOpts.ReadOpt("jsonSkipDefaults", &jsonSkipDefaults)
	jsonCamelCase := false
	_ = serverOpts.ReadOpt("jsonCamelCase", &jsonCamelCase)
	var pathPrefix string
	if ok := serverOpts.ReadOpt("pathPrefix", &pathPrefix); !ok {
		pathPrefix = "/twirp" // default prefix
	}

	return &cloudAgentServer{
		CloudAgent:       svc,
		hooks:            serverOpts.Hooks,
		interceptor:      twirp.ChainInterceptors(serverOpts.Interceptors...),
		pathPrefix:       pathPrefix,
		jsonSkipDefaults: jsonSkipDefaults,
		jsonCamelCase:    jsonCamelCase,
	}
}

// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks.
// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)
func (s *cloudAgentServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) {
	writeError(ctx, resp, err, s.hooks)
}

// handleRequestBodyError is used to handle error when the twirp server cannot read request
func (s *cloudAgentServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) {
	if context.Canceled == ctx.Err() {
		s.writeError(ctx, resp, twirp.NewError(twirp.Canceled, "failed to read request: context canceled"))
		return
	}
	if context.DeadlineExceeded == ctx.Err() {
		s.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, "failed to read request: deadline exceeded"))
		return
	}
	s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err))
}

// CloudAgentPathPrefix is a convenience constant that may identify URL paths.
// Should be used with caution, it only matches routes generated by Twirp Go clients,
// with the default "/twirp" prefix and default CamelCase service and method names.
// More info: https://twitchtv.github.io/twirp/docs/routing.html
const CloudAgentPathPrefix = "/twirp/livekit.CloudAgent/"

func (s *cloudAgentServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
	ctx := req.Context()
	ctx = ctxsetters.WithPackageName(ctx, "livekit")
	ctx = ctxsetters.WithServiceName(ctx, "CloudAgent")
	ctx = ctxsetters.WithResponseWriter(ctx, resp)

	var err error
	ctx, err = callRequestReceived(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	if req.Method != "POST" {
		msg := fmt.Sprintf("unsupported method %q (only POST is allowed)", req.Method)
		s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))
		return
	}

	// Verify path format: [<prefix>]/<package>.<Service>/<Method>
	prefix, pkgService, method := parseTwirpPath(req.URL.Path)
	if pkgService != "livekit.CloudAgent" {
		msg := fmt.Sprintf("no handler for path %q", req.URL.Path)
		s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))
		return
	}
	if prefix != s.pathPrefix {
		msg := fmt.Sprintf("invalid path prefix %q, expected %q, on path %q", prefix, s.pathPrefix, req.URL.Path)
		s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))
		return
	}

	switch method {
	case "CreateAgent":
		s.serveCreateAgent(ctx, resp, req)
		return
	case "ListAgents":
		s.serveListAgents(ctx, resp, req)
		return
	case "ListAgentVersions":
		s.serveListAgentVersions(ctx, resp, req)
		return
	case "ListAgentSecrets":
		s.serveListAgentSecrets(ctx, resp, req)
		return
	case "UpdateAgent":
		s.serveUpdateAgent(ctx, resp, req)
		return
	case "RestartAgent":
		s.serveRestartAgent(ctx, resp, req)
		return
	case "DeployAgent":
		s.serveDeployAgent(ctx, resp, req)
		return
	case "UpdateAgentSecrets":
		s.serveUpdateAgentSecrets(ctx, resp, req)
		return
	case "RollbackAgent":
		s.serveRollbackAgent(ctx, resp, req)
		return
	case "DeleteAgent":
		s.serveDeleteAgent(ctx, resp, req)
		return
	case "GetClientSettings":
		s.serveGetClientSettings(ctx, resp, req)
		return
	default:
		msg := fmt.Sprintf("no handler for path %q", req.URL.Path)
		s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path))
		return
	}
}

func (s *cloudAgentServer) serveCreateAgent(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	header := req.Header.Get("Content-Type")
	i := strings.Index(header, ";")
	if i == -1 {
		i = len(header)
	}
	switch strings.TrimSpace(strings.ToLower(header[:i])) {
	case "application/json":
		s.serveCreateAgentJSON(ctx, resp, req)
	case "application/protobuf":
		s.serveCreateAgentProtobuf(ctx, resp, req)
	default:
		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
		twerr := badRouteError(msg, req.Method, req.URL.Path)
		s.writeError(ctx, resp, twerr)
	}
}

func (s *cloudAgentServer) serveCreateAgentJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "CreateAgent")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	d := json.NewDecoder(req.Body)
	rawReqBody := json.RawMessage{}
	if err := d.Decode(&rawReqBody); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}
	reqContent := new(CreateAgentRequest)
	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}

	handler := s.CloudAgent.CreateAgent
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *CreateAgentRequest) (*CreateAgentResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*CreateAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*CreateAgentRequest) when calling interceptor")
					}
					return s.CloudAgent.CreateAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*CreateAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*CreateAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *CreateAgentResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateAgentResponse and nil error while calling CreateAgent. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
	respBytes, err := marshaler.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/json")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)

	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveCreateAgentProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "CreateAgent")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	buf, err := io.ReadAll(req.Body)
	if err != nil {
		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
		return
	}
	reqContent := new(CreateAgentRequest)
	if err = proto.Unmarshal(buf, reqContent); err != nil {
		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
		return
	}

	handler := s.CloudAgent.CreateAgent
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *CreateAgentRequest) (*CreateAgentResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*CreateAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*CreateAgentRequest) when calling interceptor")
					}
					return s.CloudAgent.CreateAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*CreateAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*CreateAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *CreateAgentResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateAgentResponse and nil error while calling CreateAgent. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	respBytes, err := proto.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/protobuf")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)
	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveListAgents(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	header := req.Header.Get("Content-Type")
	i := strings.Index(header, ";")
	if i == -1 {
		i = len(header)
	}
	switch strings.TrimSpace(strings.ToLower(header[:i])) {
	case "application/json":
		s.serveListAgentsJSON(ctx, resp, req)
	case "application/protobuf":
		s.serveListAgentsProtobuf(ctx, resp, req)
	default:
		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
		twerr := badRouteError(msg, req.Method, req.URL.Path)
		s.writeError(ctx, resp, twerr)
	}
}

func (s *cloudAgentServer) serveListAgentsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "ListAgents")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	d := json.NewDecoder(req.Body)
	rawReqBody := json.RawMessage{}
	if err := d.Decode(&rawReqBody); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}
	reqContent := new(ListAgentsRequest)
	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}

	handler := s.CloudAgent.ListAgents
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *ListAgentsRequest) (*ListAgentsResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ListAgentsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ListAgentsRequest) when calling interceptor")
					}
					return s.CloudAgent.ListAgents(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ListAgentsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ListAgentsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *ListAgentsResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *ListAgentsResponse and nil error while calling ListAgents. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
	respBytes, err := marshaler.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/json")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)

	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveListAgentsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "ListAgents")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	buf, err := io.ReadAll(req.Body)
	if err != nil {
		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
		return
	}
	reqContent := new(ListAgentsRequest)
	if err = proto.Unmarshal(buf, reqContent); err != nil {
		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
		return
	}

	handler := s.CloudAgent.ListAgents
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *ListAgentsRequest) (*ListAgentsResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ListAgentsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ListAgentsRequest) when calling interceptor")
					}
					return s.CloudAgent.ListAgents(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ListAgentsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ListAgentsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *ListAgentsResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *ListAgentsResponse and nil error while calling ListAgents. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	respBytes, err := proto.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/protobuf")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)
	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveListAgentVersions(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	header := req.Header.Get("Content-Type")
	i := strings.Index(header, ";")
	if i == -1 {
		i = len(header)
	}
	switch strings.TrimSpace(strings.ToLower(header[:i])) {
	case "application/json":
		s.serveListAgentVersionsJSON(ctx, resp, req)
	case "application/protobuf":
		s.serveListAgentVersionsProtobuf(ctx, resp, req)
	default:
		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
		twerr := badRouteError(msg, req.Method, req.URL.Path)
		s.writeError(ctx, resp, twerr)
	}
}

func (s *cloudAgentServer) serveListAgentVersionsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "ListAgentVersions")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	d := json.NewDecoder(req.Body)
	rawReqBody := json.RawMessage{}
	if err := d.Decode(&rawReqBody); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}
	reqContent := new(ListAgentVersionsRequest)
	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}

	handler := s.CloudAgent.ListAgentVersions
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *ListAgentVersionsRequest) (*ListAgentVersionsResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ListAgentVersionsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ListAgentVersionsRequest) when calling interceptor")
					}
					return s.CloudAgent.ListAgentVersions(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ListAgentVersionsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ListAgentVersionsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *ListAgentVersionsResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *ListAgentVersionsResponse and nil error while calling ListAgentVersions. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
	respBytes, err := marshaler.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/json")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)

	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveListAgentVersionsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "ListAgentVersions")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	buf, err := io.ReadAll(req.Body)
	if err != nil {
		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
		return
	}
	reqContent := new(ListAgentVersionsRequest)
	if err = proto.Unmarshal(buf, reqContent); err != nil {
		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
		return
	}

	handler := s.CloudAgent.ListAgentVersions
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *ListAgentVersionsRequest) (*ListAgentVersionsResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ListAgentVersionsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ListAgentVersionsRequest) when calling interceptor")
					}
					return s.CloudAgent.ListAgentVersions(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ListAgentVersionsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ListAgentVersionsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *ListAgentVersionsResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *ListAgentVersionsResponse and nil error while calling ListAgentVersions. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	respBytes, err := proto.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/protobuf")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)
	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveListAgentSecrets(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	header := req.Header.Get("Content-Type")
	i := strings.Index(header, ";")
	if i == -1 {
		i = len(header)
	}
	switch strings.TrimSpace(strings.ToLower(header[:i])) {
	case "application/json":
		s.serveListAgentSecretsJSON(ctx, resp, req)
	case "application/protobuf":
		s.serveListAgentSecretsProtobuf(ctx, resp, req)
	default:
		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
		twerr := badRouteError(msg, req.Method, req.URL.Path)
		s.writeError(ctx, resp, twerr)
	}
}

func (s *cloudAgentServer) serveListAgentSecretsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "ListAgentSecrets")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	d := json.NewDecoder(req.Body)
	rawReqBody := json.RawMessage{}
	if err := d.Decode(&rawReqBody); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}
	reqContent := new(ListAgentSecretsRequest)
	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}

	handler := s.CloudAgent.ListAgentSecrets
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *ListAgentSecretsRequest) (*ListAgentSecretsResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ListAgentSecretsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ListAgentSecretsRequest) when calling interceptor")
					}
					return s.CloudAgent.ListAgentSecrets(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ListAgentSecretsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ListAgentSecretsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *ListAgentSecretsResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *ListAgentSecretsResponse and nil error while calling ListAgentSecrets. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
	respBytes, err := marshaler.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/json")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)

	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveListAgentSecretsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "ListAgentSecrets")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	buf, err := io.ReadAll(req.Body)
	if err != nil {
		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
		return
	}
	reqContent := new(ListAgentSecretsRequest)
	if err = proto.Unmarshal(buf, reqContent); err != nil {
		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
		return
	}

	handler := s.CloudAgent.ListAgentSecrets
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *ListAgentSecretsRequest) (*ListAgentSecretsResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ListAgentSecretsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ListAgentSecretsRequest) when calling interceptor")
					}
					return s.CloudAgent.ListAgentSecrets(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ListAgentSecretsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ListAgentSecretsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *ListAgentSecretsResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *ListAgentSecretsResponse and nil error while calling ListAgentSecrets. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	respBytes, err := proto.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/protobuf")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)
	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveUpdateAgent(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	header := req.Header.Get("Content-Type")
	i := strings.Index(header, ";")
	if i == -1 {
		i = len(header)
	}
	switch strings.TrimSpace(strings.ToLower(header[:i])) {
	case "application/json":
		s.serveUpdateAgentJSON(ctx, resp, req)
	case "application/protobuf":
		s.serveUpdateAgentProtobuf(ctx, resp, req)
	default:
		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
		twerr := badRouteError(msg, req.Method, req.URL.Path)
		s.writeError(ctx, resp, twerr)
	}
}

func (s *cloudAgentServer) serveUpdateAgentJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "UpdateAgent")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	d := json.NewDecoder(req.Body)
	rawReqBody := json.RawMessage{}
	if err := d.Decode(&rawReqBody); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}
	reqContent := new(UpdateAgentRequest)
	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}

	handler := s.CloudAgent.UpdateAgent
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *UpdateAgentRequest) (*UpdateAgentResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*UpdateAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*UpdateAgentRequest) when calling interceptor")
					}
					return s.CloudAgent.UpdateAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*UpdateAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*UpdateAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *UpdateAgentResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *UpdateAgentResponse and nil error while calling UpdateAgent. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
	respBytes, err := marshaler.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/json")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)

	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveUpdateAgentProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "UpdateAgent")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	buf, err := io.ReadAll(req.Body)
	if err != nil {
		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
		return
	}
	reqContent := new(UpdateAgentRequest)
	if err = proto.Unmarshal(buf, reqContent); err != nil {
		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
		return
	}

	handler := s.CloudAgent.UpdateAgent
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *UpdateAgentRequest) (*UpdateAgentResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*UpdateAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*UpdateAgentRequest) when calling interceptor")
					}
					return s.CloudAgent.UpdateAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*UpdateAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*UpdateAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *UpdateAgentResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *UpdateAgentResponse and nil error while calling UpdateAgent. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	respBytes, err := proto.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/protobuf")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)
	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveRestartAgent(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	header := req.Header.Get("Content-Type")
	i := strings.Index(header, ";")
	if i == -1 {
		i = len(header)
	}
	switch strings.TrimSpace(strings.ToLower(header[:i])) {
	case "application/json":
		s.serveRestartAgentJSON(ctx, resp, req)
	case "application/protobuf":
		s.serveRestartAgentProtobuf(ctx, resp, req)
	default:
		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
		twerr := badRouteError(msg, req.Method, req.URL.Path)
		s.writeError(ctx, resp, twerr)
	}
}

func (s *cloudAgentServer) serveRestartAgentJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "RestartAgent")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	d := json.NewDecoder(req.Body)
	rawReqBody := json.RawMessage{}
	if err := d.Decode(&rawReqBody); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}
	reqContent := new(RestartAgentRequest)
	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}

	handler := s.CloudAgent.RestartAgent
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *RestartAgentRequest) (*RestartAgentResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*RestartAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*RestartAgentRequest) when calling interceptor")
					}
					return s.CloudAgent.RestartAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*RestartAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*RestartAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *RestartAgentResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *RestartAgentResponse and nil error while calling RestartAgent. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
	respBytes, err := marshaler.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/json")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)

	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveRestartAgentProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "RestartAgent")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	buf, err := io.ReadAll(req.Body)
	if err != nil {
		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
		return
	}
	reqContent := new(RestartAgentRequest)
	if err = proto.Unmarshal(buf, reqContent); err != nil {
		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
		return
	}

	handler := s.CloudAgent.RestartAgent
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *RestartAgentRequest) (*RestartAgentResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*RestartAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*RestartAgentRequest) when calling interceptor")
					}
					return s.CloudAgent.RestartAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*RestartAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*RestartAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *RestartAgentResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *RestartAgentResponse and nil error while calling RestartAgent. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	respBytes, err := proto.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/protobuf")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)
	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveDeployAgent(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	header := req.Header.Get("Content-Type")
	i := strings.Index(header, ";")
	if i == -1 {
		i = len(header)
	}
	switch strings.TrimSpace(strings.ToLower(header[:i])) {
	case "application/json":
		s.serveDeployAgentJSON(ctx, resp, req)
	case "application/protobuf":
		s.serveDeployAgentProtobuf(ctx, resp, req)
	default:
		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
		twerr := badRouteError(msg, req.Method, req.URL.Path)
		s.writeError(ctx, resp, twerr)
	}
}

func (s *cloudAgentServer) serveDeployAgentJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "DeployAgent")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	d := json.NewDecoder(req.Body)
	rawReqBody := json.RawMessage{}
	if err := d.Decode(&rawReqBody); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}
	reqContent := new(DeployAgentRequest)
	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}

	handler := s.CloudAgent.DeployAgent
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *DeployAgentRequest) (*DeployAgentResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*DeployAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*DeployAgentRequest) when calling interceptor")
					}
					return s.CloudAgent.DeployAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*DeployAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*DeployAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *DeployAgentResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *DeployAgentResponse and nil error while calling DeployAgent. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
	respBytes, err := marshaler.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/json")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)

	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveDeployAgentProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "DeployAgent")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	buf, err := io.ReadAll(req.Body)
	if err != nil {
		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
		return
	}
	reqContent := new(DeployAgentRequest)
	if err = proto.Unmarshal(buf, reqContent); err != nil {
		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
		return
	}

	handler := s.CloudAgent.DeployAgent
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *DeployAgentRequest) (*DeployAgentResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*DeployAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*DeployAgentRequest) when calling interceptor")
					}
					return s.CloudAgent.DeployAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*DeployAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*DeployAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *DeployAgentResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *DeployAgentResponse and nil error while calling DeployAgent. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	respBytes, err := proto.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/protobuf")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)
	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveUpdateAgentSecrets(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	header := req.Header.Get("Content-Type")
	i := strings.Index(header, ";")
	if i == -1 {
		i = len(header)
	}
	switch strings.TrimSpace(strings.ToLower(header[:i])) {
	case "application/json":
		s.serveUpdateAgentSecretsJSON(ctx, resp, req)
	case "application/protobuf":
		s.serveUpdateAgentSecretsProtobuf(ctx, resp, req)
	default:
		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
		twerr := badRouteError(msg, req.Method, req.URL.Path)
		s.writeError(ctx, resp, twerr)
	}
}

func (s *cloudAgentServer) serveUpdateAgentSecretsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "UpdateAgentSecrets")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	d := json.NewDecoder(req.Body)
	rawReqBody := json.RawMessage{}
	if err := d.Decode(&rawReqBody); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}
	reqContent := new(UpdateAgentSecretsRequest)
	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}

	handler := s.CloudAgent.UpdateAgentSecrets
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *UpdateAgentSecretsRequest) (*UpdateAgentSecretsResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*UpdateAgentSecretsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*UpdateAgentSecretsRequest) when calling interceptor")
					}
					return s.CloudAgent.UpdateAgentSecrets(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*UpdateAgentSecretsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*UpdateAgentSecretsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *UpdateAgentSecretsResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *UpdateAgentSecretsResponse and nil error while calling UpdateAgentSecrets. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
	respBytes, err := marshaler.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/json")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)

	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveUpdateAgentSecretsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "UpdateAgentSecrets")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	buf, err := io.ReadAll(req.Body)
	if err != nil {
		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
		return
	}
	reqContent := new(UpdateAgentSecretsRequest)
	if err = proto.Unmarshal(buf, reqContent); err != nil {
		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
		return
	}

	handler := s.CloudAgent.UpdateAgentSecrets
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *UpdateAgentSecretsRequest) (*UpdateAgentSecretsResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*UpdateAgentSecretsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*UpdateAgentSecretsRequest) when calling interceptor")
					}
					return s.CloudAgent.UpdateAgentSecrets(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*UpdateAgentSecretsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*UpdateAgentSecretsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *UpdateAgentSecretsResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *UpdateAgentSecretsResponse and nil error while calling UpdateAgentSecrets. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	respBytes, err := proto.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/protobuf")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)
	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveRollbackAgent(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	header := req.Header.Get("Content-Type")
	i := strings.Index(header, ";")
	if i == -1 {
		i = len(header)
	}
	switch strings.TrimSpace(strings.ToLower(header[:i])) {
	case "application/json":
		s.serveRollbackAgentJSON(ctx, resp, req)
	case "application/protobuf":
		s.serveRollbackAgentProtobuf(ctx, resp, req)
	default:
		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
		twerr := badRouteError(msg, req.Method, req.URL.Path)
		s.writeError(ctx, resp, twerr)
	}
}

func (s *cloudAgentServer) serveRollbackAgentJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "RollbackAgent")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	d := json.NewDecoder(req.Body)
	rawReqBody := json.RawMessage{}
	if err := d.Decode(&rawReqBody); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}
	reqContent := new(RollbackAgentRequest)
	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}

	handler := s.CloudAgent.RollbackAgent
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *RollbackAgentRequest) (*RollbackAgentResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*RollbackAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*RollbackAgentRequest) when calling interceptor")
					}
					return s.CloudAgent.RollbackAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*RollbackAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*RollbackAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *RollbackAgentResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *RollbackAgentResponse and nil error while calling RollbackAgent. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
	respBytes, err := marshaler.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/json")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)

	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveRollbackAgentProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "RollbackAgent")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	buf, err := io.ReadAll(req.Body)
	if err != nil {
		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
		return
	}
	reqContent := new(RollbackAgentRequest)
	if err = proto.Unmarshal(buf, reqContent); err != nil {
		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
		return
	}

	handler := s.CloudAgent.RollbackAgent
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *RollbackAgentRequest) (*RollbackAgentResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*RollbackAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*RollbackAgentRequest) when calling interceptor")
					}
					return s.CloudAgent.RollbackAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*RollbackAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*RollbackAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *RollbackAgentResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *RollbackAgentResponse and nil error while calling RollbackAgent. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	respBytes, err := proto.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/protobuf")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)
	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveDeleteAgent(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	header := req.Header.Get("Content-Type")
	i := strings.Index(header, ";")
	if i == -1 {
		i = len(header)
	}
	switch strings.TrimSpace(strings.ToLower(header[:i])) {
	case "application/json":
		s.serveDeleteAgentJSON(ctx, resp, req)
	case "application/protobuf":
		s.serveDeleteAgentProtobuf(ctx, resp, req)
	default:
		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
		twerr := badRouteError(msg, req.Method, req.URL.Path)
		s.writeError(ctx, resp, twerr)
	}
}

func (s *cloudAgentServer) serveDeleteAgentJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "DeleteAgent")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	d := json.NewDecoder(req.Body)
	rawReqBody := json.RawMessage{}
	if err := d.Decode(&rawReqBody); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}
	reqContent := new(DeleteAgentRequest)
	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}

	handler := s.CloudAgent.DeleteAgent
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *DeleteAgentRequest) (*DeleteAgentResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*DeleteAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*DeleteAgentRequest) when calling interceptor")
					}
					return s.CloudAgent.DeleteAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*DeleteAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*DeleteAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *DeleteAgentResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *DeleteAgentResponse and nil error while calling DeleteAgent. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
	respBytes, err := marshaler.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/json")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)

	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveDeleteAgentProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "DeleteAgent")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	buf, err := io.ReadAll(req.Body)
	if err != nil {
		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
		return
	}
	reqContent := new(DeleteAgentRequest)
	if err = proto.Unmarshal(buf, reqContent); err != nil {
		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
		return
	}

	handler := s.CloudAgent.DeleteAgent
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *DeleteAgentRequest) (*DeleteAgentResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*DeleteAgentRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*DeleteAgentRequest) when calling interceptor")
					}
					return s.CloudAgent.DeleteAgent(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*DeleteAgentResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*DeleteAgentResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *DeleteAgentResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *DeleteAgentResponse and nil error while calling DeleteAgent. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	respBytes, err := proto.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/protobuf")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)
	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveGetClientSettings(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	header := req.Header.Get("Content-Type")
	i := strings.Index(header, ";")
	if i == -1 {
		i = len(header)
	}
	switch strings.TrimSpace(strings.ToLower(header[:i])) {
	case "application/json":
		s.serveGetClientSettingsJSON(ctx, resp, req)
	case "application/protobuf":
		s.serveGetClientSettingsProtobuf(ctx, resp, req)
	default:
		msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
		twerr := badRouteError(msg, req.Method, req.URL.Path)
		s.writeError(ctx, resp, twerr)
	}
}

func (s *cloudAgentServer) serveGetClientSettingsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "GetClientSettings")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	d := json.NewDecoder(req.Body)
	rawReqBody := json.RawMessage{}
	if err := d.Decode(&rawReqBody); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}
	reqContent := new(ClientSettingsRequest)
	unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true}
	if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil {
		s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err)
		return
	}

	handler := s.CloudAgent.GetClientSettings
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *ClientSettingsRequest) (*ClientSettingsResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ClientSettingsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ClientSettingsRequest) when calling interceptor")
					}
					return s.CloudAgent.GetClientSettings(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ClientSettingsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ClientSettingsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *ClientSettingsResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *ClientSettingsResponse and nil error while calling GetClientSettings. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults}
	respBytes, err := marshaler.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/json")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)

	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) serveGetClientSettingsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
	var err error
	ctx = ctxsetters.WithMethodName(ctx, "GetClientSettings")
	ctx, err = callRequestRouted(ctx, s.hooks)
	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}

	buf, err := io.ReadAll(req.Body)
	if err != nil {
		s.handleRequestBodyError(ctx, resp, "failed to read request body", err)
		return
	}
	reqContent := new(ClientSettingsRequest)
	if err = proto.Unmarshal(buf, reqContent); err != nil {
		s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
		return
	}

	handler := s.CloudAgent.GetClientSettings
	if s.interceptor != nil {
		handler = func(ctx context.Context, req *ClientSettingsRequest) (*ClientSettingsResponse, error) {
			resp, err := s.interceptor(
				func(ctx context.Context, req interface{}) (interface{}, error) {
					typedReq, ok := req.(*ClientSettingsRequest)
					if !ok {
						return nil, twirp.InternalError("failed type assertion req.(*ClientSettingsRequest) when calling interceptor")
					}
					return s.CloudAgent.GetClientSettings(ctx, typedReq)
				},
			)(ctx, req)
			if resp != nil {
				typedResp, ok := resp.(*ClientSettingsResponse)
				if !ok {
					return nil, twirp.InternalError("failed type assertion resp.(*ClientSettingsResponse) when calling interceptor")
				}
				return typedResp, err
			}
			return nil, err
		}
	}

	// Call service method
	var respContent *ClientSettingsResponse
	func() {
		defer ensurePanicResponses(ctx, resp, s.hooks)
		respContent, err = handler(ctx, reqContent)
	}()

	if err != nil {
		s.writeError(ctx, resp, err)
		return
	}
	if respContent == nil {
		s.writeError(ctx, resp, twirp.InternalError("received a nil *ClientSettingsResponse and nil error while calling GetClientSettings. nil responses are not supported"))
		return
	}

	ctx = callResponsePrepared(ctx, s.hooks)

	respBytes, err := proto.Marshal(respContent)
	if err != nil {
		s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response"))
		return
	}

	ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK)
	resp.Header().Set("Content-Type", "application/protobuf")
	resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes)))
	resp.WriteHeader(http.StatusOK)
	if n, err := resp.Write(respBytes); err != nil {
		msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error())
		twerr := twirp.NewError(twirp.Unknown, msg)
		ctx = callError(ctx, s.hooks, twerr)
	}
	callResponseSent(ctx, s.hooks)
}

func (s *cloudAgentServer) ServiceDescriptor() ([]byte, int) {
	return twirpFileDescriptor5, 0
}

func (s *cloudAgentServer) ProtocGenTwirpVersion() string {
	return "v8.1.3"
}

// PathPrefix returns the base service path, in the form: "/<prefix>/<package>.<Service>/"
// that is everything in a Twirp route except for the <Method>. This can be used for routing,
// for example to identify the requests that are targeted to this service in a mux.
func (s *cloudAgentServer) PathPrefix() string {
	return baseServicePath(s.pathPrefix, "livekit", "CloudAgent")
}

var twirpFileDescriptor5 = []byte{
	// 1682 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0x4b, 0x53, 0x1b, 0xcb,
	0x15, 0x66, 0xf4, 0xd6, 0x11, 0x60, 0xb9, 0xc1, 0x30, 0x08, 0x63, 0xc3, 0x10, 0x57, 0x11, 0xec,
	0x92, 0x1d, 0xb2, 0xb1, 0x9d, 0x4a, 0x55, 0x64, 0x18, 0x83, 0x78, 0x08, 0x55, 0x4b, 0x90, 0x72,
	0x2a, 0x55, 0x53, 0x83, 0xd4, 0x56, 0x26, 0x68, 0x1e, 0x9e, 0xe9, 0x91, 0xcd, 0x2e, 0xdb, 0xac,
	0xb3, 0xc9, 0x2f, 0xc8, 0x22, 0x8b, 0xac, 0xb2, 0x4a, 0x7e, 0x4a, 0xd6, 0xb9, 0x8b, 0xbb, 0xb8,
	0x75, 0x7f, 0xc2, 0xad, 0xee, 0x79, 0xa8, 0x47, 0x12, 0x20, 0x83, 0xab, 0xee, 0x86, 0xa2, 0xfb,
	0x7c, 0x7d, 0x9e, 0x5f, 0x9f, 0x3e, 0x23, 0x58, 0xe9, 0x1b, 0x03, 0x72, 0x69, 0x50, 0xad, 0xd3,
	0xb7, 0xfd, 0xae, 0xa6, 0xf7, 0x88, 0x45, 0xab, 0x8e, 0x6b, 0x53, 0x1b, 0xe5, 0x43, 0x51, 0xe5,
	0x69, 0xcf, 0xb6, 0x7b, 0x7d, 0xf2, 0x92, 0x6f, 0x5f, 0xf8, 0x1f, 0x5f, 0x52, 0xc3, 0x24, 0x1e,
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